** MBFGE Test: 2D laminar two-phase flow.
  **************************************************************
  DISPLAY
  ----------------------------------------------------------
  The main purpose of the case is to demonstrate two-phase
  option with multi-blocking.
  ----------------------------------------------------------
  ENDDIS
INTEGER(IFIC); BOOLEAN(LRHTF,LRHFL)
CCM= T;  LRHTF = F;  IFIC = 2;  LRHFL = T
  **************************************************************
  PHOTON USE
   p ; ; ; ; ;
 
   msg Computational Domain:
   mgrid 1 k 1
   mgrid 2 k 1 col 4
   msg Press Any Key to Continue...
   pause
   cl
   set vec av off
   msg 1st Phase Velocity Vectors:
   mvec 1 k 1 sh
   mvec 2 k 1 sh
   msg Press Any Key to Continue...
   pause
   cl
   msg 2nd Phase Velocity Vectors:
   set vec ph 2;  mvec 1 k 1 sh;  mvec 2 k 1 sh
   msg Press Any Key to Continue...
   pause
   cl
   msg Contours of Pressure:
   mcon 1 p1 k 1 fi
   0.001
   mcon 2 p1 k 1 fi
   0.001
   pause
   cl
   msg Contours of R2:
   mcon 1 r2 k 1 fi
   0.001
   mcon 2 r2 k 1 fi
   0.001
   msg Press Any Key to Continue...
   pause
  ENDUSE
  **************************************************************
    GROUP 1. Run title and other preliminaries
TEXT(MBFGE: 2 phase 2D X-flow (X-Y plane, Re=500).
TITLE
REAL(REYNO,UIN,DIAM,LPIP,LBL1,R1IN,R2IN)
INTEGER(NX1,NY1,NZ1,NX2,NY2,NZ2)
  ** Problem definition:
REYNO= 500.0;  UIN = 1.0;   DIAM= 0.03;  LPIP= 10.*DIAM
R1IN = 0.5;    R2IN= 1.0-R1IN;    LBL1= LPIP/2.
IF(LRHTF) THEN
+ NY1 = 4; NY2 = IFIC*NY1
ELSE
+ NY2 = 4; NY1 = IFIC*NY2
ENDIF
NX1 = 8;  NZ1 = 1;  NX2 = 8;  NZ2  = 1
    GROUP 6. Body-fitted coordinates or grid distortion
BFC = T
  ** Define grid points and lines for the first domain:
GSET(P,P1,0.0, 0.0, 0.0);  GSET(P,P2,LBL1,0.0, 0.0)
GSET(P,P3,LBL1,DIAM,0.0);  GSET(P,P4,0.0, DIAM,0.0)
GSET(L,L12,P1,P2,NX1,1.0); GSET(L,L23,P2,P3,NY1,1.0)
GSET(L,L34,P3,P4,NX1,1.0); GSET(L,L41,P4,P1,NY1,1.0)
  ** Define grid points and lines for the second domain:
GSET(P,P5,LBL1,0.0, 0.0);  GSET(P,P6,LPIP,0.0, 0.0)
GSET(P,P7,LPIP,DIAM,0.0);  GSET(P,P8,LBL1,DIAM,0.0)
GSET(L,L56,P5,P6,NX2,1.0); GSET(L,L67,P6,P7,NY2,1.0)
GSET(L,L78,P7,P8,NX2,1.0); GSET(L,L85,P8,P5,NY2,1.0)
  ** Create grid for the first domain.
GSET(D,NX1,NY1,NZ1,LBL1,DIAM,DIAM)
GSET(F,F1,P1,-,P2,-,P3,-,P4,-); GSET(M,F1,+I+J,1,1,1)
GSET(C,K:NZ1+1:,F,K1,1,NX1,1,NY1,+,0.0,0.0,DIAM,INC,1.0)
DUMPC(MBGR1)
  ** Create grid for the second domain.
GSET(D,NX2,NY2,NZ2,LPIP-LBL1,DIAM,DIAM)
GSET(F,F2,P5,-,P6,-,P7,-,P8,-); GSET(M,F2,+I+J,1,1,1)
GSET(C,K:NZ2+1:,F,K1,1,NX2,1,NY2,+,0.0,0.0,DIAM,INC,1.0)
DUMPC(MBGR2)
  ** Assemble blocks:
NUMBLK = 2
READCO(MBGR+L); GVIEW(Z); VIEW
    GROUP 7. Variables stored, solved & named
ONEPHS = F
NAME(C1)= UC1; NAME(C2)= UC2; NAME(C3)= VC1; NAME(C4)= VC2
SOLVE(P1,U1,U2,V1,V2,R1,R2,UC1,UC2,VC1,VC2)
SOLUTN(R1,P,P,P,N,P,P); SOLUTN(R2,P,P,P,N,P,P)
    GROUP 9. Properties of the medium (or media)
ENUL= UIN*DIAM/REYNO;  RHO1= 1.0;  RHO2= 1.0
    GROUP 10. Inter-phase-transfer processes and properties
CFIPS= GRND2;  CFIPA= 1E-4; CFIPC= 10000.
    GROUP 11. Initialization of variable or porosity fields
INIADD= F;  FIINIT(R1)= R1IN;  FIINIT(R2)= R2IN
FIINIT(UC1) = UIN; FIINIT(VC1) = 1.E-5
FIINIT(UC2) = UIN; FIINIT(VC2) = 1.E-5
    GROUP 13. Boundary conditions and special sources
    ** Inlet.
IF(LRHFL) THEN
+ MPATCH(1,IN,WEST,1,  1,  1,NY1,1,1,1,1)
+  COVAL(IN,UC1,ONLYMS, UIN); COVAL(IN,UC2,ONLYMS, UIN)
ELSE
+ MPATCH(2,IN,EAST,NX2,NX2,1,NY2,1,1,1,1)
+  COVAL(IN,UC1,ONLYMS,-UIN); COVAL(IN,UC2,ONLYMS,-UIN)
ENDIF
COVAL(IN,P1,FIXFLU,R1IN*RHO1*UIN); COVAL(IN,P2,FIXFLU,R2IN*RHO1*UIN)
COVAL(IN,VC1,ONLYMS,0.0); COVAL(IN,VC2,ONLYMS,0.0)
    ** Walls.
MPATCH(1,WS1,SWALL,1,NX1,1,1,1,NZ1,1,1)
 COVAL(WS1,UC1,1.0,0.0); COVAL(WS1,VC1,1.0,0.0)
 COVAL(WS1,UC2,1.0,0.0); COVAL(WS1,VC2,1.0,0.0)
MPATCH(2,WS2,SWALL,1,NX2,1,1,1,NZ2,1,1)
 COVAL(WS2,UC1,1.0,0.0); COVAL(WS2,VC1,1.0,0.0)
 COVAL(WS2,UC2,1.0,0.0); COVAL(WS2,VC2,1.0,0.0)
MPATCH(1,WN1,NWALL,1,NX1,NY1,NY1,1,NZ1,1,1)
 COVAL(WN1,UC1,1.0,0.0); COVAL(WN1,VC1,1.0,0.0)
 COVAL(WN1,UC2,1.0,0.0); COVAL(WN1,VC2,1.0,0.0)
MPATCH(2,WN2,NWALL,1,NX2,NY2,NY2,1,NZ2,1,1)
 COVAL(WN2,UC1,1.0,0.0); COVAL(WN2,VC1,1.0,0.0)
 COVAL(WN2,UC2,1.0,0.0); COVAL(WN2,VC2,1.0,0.0)
    ** Outlet.
IF(LRHFL) THEN
+ MPATCH(2,OUT,EAST,NX2,NX2,1,NY2,1,NZ2,1,1)
ELSE
+ MPATCH(1,OUT,WEST,1,  1,  1,NY1,1,NZ1,1,1)
ENDIF
 COVAL(OUT,P1,1.E3,0.0); COVAL(OUT,P2,1.E3*RHO2/RHO1,0.0)
    GROUP 15. Termination of sweeps
LSWEEP = 100; TSTSWP = -1
    GROUP 16. Termination of iterations
SELREF = T;   RESFAC = 1.E-3
    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.5)
    GROUP 22. Spot-value print-out
IXMON = NX1/2+1; IYMON = NY1/2+1; IZMON = 1