MB-FGE Test: Flow over back-facing step.
  **************************************************************
  DISPLAY
   This case  concerns 2D  incompressible, laminar/turbulent
   flow over back-facing step.  Geometry of the problem  was
   taken from GAMM-workshop 1984 (Re=50, 150, 500). A  fully
   developed parabolic laminar flow profile is prescribed at
   the inflow.
 
   Computational domain comprises fine grid, which is embedded
   after the step. Sizes (NXFG, NYFG) and refinement ratios
   (IFCX, IFCY) of the fine grid may be modified:
    
            NXFG                                
               NYFG                             
             
   Simulation of the turbulent (LTURB=T) flow can be carried
   out with either the Lam-Bremhorst low-Re extension of the
   Chen-Kim  K-E model (LTWOL=F)  or the 2-layer  low-Re K-E
   model (LTWOL=T).
 
   User can  use higher  order convective  schemes (MINMOD-,
   SUPER-BB-, SMART- or QUICK-scheme) by setting appropriate
   name of the scheme for solved variable.
  ----------------------------------------------------------
  ENDDIS
L(PAUSE
  **************************************************************
BOOLEAN(LUNIF,LTURB,LTWOL,LSCHM)
LUNIF= F;  LTURB = T;  LTWOL= T;  LSCHM= T
IF(LTURB) THEN
+ LUNIF= T
ENDIF
  **************************************************************
  PHOTON USE
   p ; ; ; ; ;
 
   msg Computational Domain:
   mgrid 1 k 1
   mgrid 2 k 1 col 2
   msg Press Any Key to Continue...
   pause
   cl
   set vec av off
   msg Velocity Vectors:
   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.01
   mcon 2 p1 k 1 fi
   0.01
   pause
   cl
   msg Contours of U1-velocity:
   mcon 1 u1 k 1 fi
   0.01
   mcon 2 u1 k 1 fi
   0.01
   msg Press E  to exit PHOTON ...
   pause
  ENDUSE
  **************************************************************
    GROUP 1. Run title and other preliminaries
INTEGER(NX1,NXSTEP,NY1,NZ1,NX2,NY2,NZ2,NXFG,NYFG,IFCX,IFCY,IC,JC)
REAL(XE1,YE1,XE2,YE2,XE3,YE3,XE4,YE4)
REAL(REYNU,UIN,HSTEP,STEPL,HCHAN,LCHAN,YCUR,UCR,DTHYD,TKEIN,EPSIN)
IF(LTURB) THEN
+ REYNU= 4.5E4;  UIN= 1.0
+IF(LTWOL) THEN
+ TEXT(MB-FGE: 2D Flow Over Back-Step (2L K-E).
+ELSE
+ TEXT(MB-FGE: 2D Flow Over Back-Step (L-B K-E).
+ENDIF
ELSE
+ REYNU= 150.0;  UIN= 1.0
+ TEXT(MB-FGE: 2D Flow Over Back-Step (Re=150).
ENDIF
TITLE
HSTEP= 0.5;  STEPL = 3.0;  HCHAN= 1.5;  LCHAN= 22.0
   ** First domain.
NXSTEP= 6;  NX1= 22;  NY1= 12;  NZ1= 1
   ** Fine grid:
NXFG= 8;  NYFG= 8;  IFCX= 3;          IFCY= 2
NX2 = NXFG*IFCX;    NY2 = NYFG*IFCY;  NZ2 = 1
    GROUP 6. Body-fitted coordinates or grid distortion
BFC= T; GSET(D,NX1,NY1,NZ1,LCHAN,HCHAN,0.1)
  ** Define grid points and lines for the main domain:
GSET(P,P1,  0.0,  0.0,0.0);  GSET(P,P2,STEPL,  0.0,0.0)
GSET(P,P3,LCHAN,  0.0,0.0);  GSET(P,P4,LCHAN,HSTEP,0.0)
GSET(P,P5,LCHAN,HCHAN,0.0);  GSET(P,P6,STEPL,HCHAN,0.0)
GSET(P,P7,  0.0,HCHAN,0.0);  GSET(P,P8,  0.0,HSTEP,0.0)
GSET(L,L12,P1,P2,    NXSTEP,-1.3); GSET(L,L23,P2,P3,NX1-NXSTEP,1.0)
GSET(L,L34,P3,P4,     NY1/3, 1.0); GSET(L,L45,P4,P5,   2*NY1/3,1.0)
GSET(L,L56,P5,P6,NX1-NXSTEP, 1.0); GSET(L,L67,P6,P7,    NXSTEP,1.3)
GSET(L,L78,P7,P8,   2*NY1/3, 1.0); GSET(L,L81,P8,P1,     NY1/3,1.0)
GSET(F,F1,P1,P2,P3,P4,P5,P6,P7,P8); GSET(M,F1,+I+J,1,1,1)
GSET(C,K:NZ1+1:,F,K1,1,NX1,1,NY1,+,0.0,0.0,0.1,INC,1.0)
  ** Define grid nodes to insert fine grid:
IC= NXSTEP+1; XE1= XC(IC, 1,1); YE1= YC(IC, 1,1)
IC= IC+NXFG;  XE2= XC(IC, 1,1); YE2= YC(IC, 1,1)
JC= NYFG+1;   XE3= XC(IC,JC,1); YE3= YC(IC,JC,1)
IC= IC-NXFG;  XE4= XC(IC,JC,1); YE4= YC(IC,JC,1)
DUMPC(MBGR1)
  ** Define grid points and lines for the fine grid:
GSET(D,NX2,NY2,NZ2,1.0,1.0,0.1)
GSET(P,P1,XE1,YE1,0.0);  GSET(P,P2,XE2,YE2,0.0)
GSET(P,P3,XE3,YE3,0.0);  GSET(P,P4,XE4,YE4,0.0)
GSET(L,L12,P1,P2,NX2,1.0); GSET(L,L23,P2,P3,NY2,1.0)
GSET(L,L34,P3,P4,NX2,1.0); GSET(L,L41,P4,P1,NY2,1.0)
GSET(F,F1,P1,-,P2,-,P3,-,P4,-); GSET(M,F1,+I+J,1,1,1)
GSET(C,K:NZ1+1:,F,K1,1,NX2,1,NY2,+,0.0,0.0,0.1,INC,1.0)
DUMPC(MBGR2)
  ** Assemble blocks:
NUMBLK = 2; READCO(MBGR+L); GVIEW(Z); VIEW
  ** Set links:
  ** You can use MBLINK command instead of READCO(...+L).
    MBLINK(2,IN,1)
    GROUP 7. Variables stored, solved & named
STORE(VPOR); SOLVE(P1,U1,V1)
IF(LTURB) THEN
+ STORE(GEN1,ENUT,LEN1);
+ IF(LTWOL) THEN
+  TURMOD(KEMODL-2L)
+ ELSE
+  TURMOD(KECHEN-LOWRE)
+ ENDIF
ENDIF
L($F150)
    GROUP 9. Properties of the medium (or media)
ENUL= UIN*HSTEP/REYNU
    GROUP 11. Initialization of variable or porosity fields
INIADD= F; FIINIT(UC1)= UIN
MPATCH(1,STEP,INIVAL,1,NXSTEP,1,NY1/3,1,NZ1,1,1)
INIT(STEP,VPOR,0.0,0.0)
IF(LTURB) THEN
+ TKEIN= (0.05*UIN)**2; EPSIN= 0.1643*TKEIN**1.5/0.09/HSTEP
+ FIINIT(P1)  = 1.3E-4; FIINIT(KE)= TKEIN;  FIINIT(EP)= EPSIN
+ FIINIT(ENUT)= 1.E-3
ENDIF
    GROUP 13. Boundary conditions and special sources
    ** Inlet.
JC= NY1/3+1
DO II = JC,NY1
+ IF(LUNIF) THEN
+  UCR = UIN
+ ELSE
+  YCUR= HSTEP+(2*(II-JC)+1)/2*(HCHAN-HSTEP)/(NY1-JC+1)
+  UCR = UIN*(1.0-((2*YCUR-HCHAN-HSTEP)/(HCHAN-HSTEP))**2)
+ ENDIF
+ MPATCH(1,INL:II:,WEST,1,1,II,II,1,NZ1,1,LSTEP)
+  COVAL(INL:II:,P1, FIXFLU,UCR*RHO1)
+  COVAL(INL:II:,UC1,ONLYMS,UCR); COVAL(INL:II:,VC1,ONLYMS,0.0)
+ IF(LTURB) THEN
+  COVAL(INL:II:,KE,ONLYMS,TKEIN);COVAL(INL:II:,EP,ONLYMS,EPSIN)
+ ENDIF
ENDDO
    ** Outlet:
MPATCH(1,OUT,EAST,NX1,NX1,1,NY1,1,NZ1,1,LSTEP)
COVAL(OUT,P1,1000.,0.0)
    ** Walls.
MPATCH(1,WS1,SWALL,       1,NXSTEP, JC,        JC,1,NZ1,1,LSTEP)
MPATCH(1,WS2,SWALL,NXSTEP+1,   NX1,  1,         1,1,NZ2,1,LSTEP)
MPATCH(1,WN1,NWALL,       1,   NX1,NY1,       NY1,1,NZ1,1,LSTEP)
MPATCH(2,WW1,WWALL,       1,     1,  1,NY1/3*IFCY,1,NZ2,1,LSTEP)
MPATCH(2,WS3,SWALL,       1,   NX2,  1,         1,1,NZ2,1,LSTEP)
IF(LTURB) THEN
+ COVAL(WS1,UC1,LOGLAW,0.0); COVAL(WS1, VC1,LOGLAW,0.0)
+ COVAL(WS1, KE,  1.0,0.0); COVAL(WS1,LTLS,  1.0,0.0)
+ COVAL(WS2,UC1,LOGLAW,0.0); COVAL(WS2, VC1,LOGLAW,0.0)
+ COVAL(WS2, KE,  1.0,0.0); COVAL(WS2,LTLS,  1.0,0.0)
+ COVAL(WN1,UC1,LOGLAW,0.0); COVAL(WN1, VC1,LOGLAW,0.0)
+ COVAL(WN1, KE,  1.0,0.0); COVAL(WN1,LTLS,  1.0,0.0)
+ COVAL(WW1,UC1,LOGLAW,0.0); COVAL(WW1, VC1,LOGLAW,0.0)
+ COVAL(WW1, KE,  1.0,0.0); COVAL(WW1,LTLS,  1.0,0.0)
+ COVAL(WS3,UC1,LOGLAW,0.0); COVAL(WS3, VC1,LOGLAW,0.0)
+ COVAL(WS3, KE,  1.0,0.0); COVAL(WS3,LTLS,  1.0,0.0)
+ COVAL(OUT,KE,ONLYMS,SAME); COVAL(OUT,EP,ONLYMS,SAME)
ELSE
+ COVAL(WS1,UC1,1.0,0.0); COVAL(WS1,VC1,1.0,0.0)
+ COVAL(WS2,UC1,1.0,0.0); COVAL(WS2,VC1,1.0,0.0)
+ COVAL(WN1,UC1,1.0,0.0); COVAL(WN1,VC1,1.0,0.0)
+ COVAL(WW1,UC1,1.0,0.0); COVAL(WW1,VC1,1.0,0.0)
+ COVAL(WS3,UC1,1.0,0.0); COVAL(WS3,VC1,1.0,0.0)
ENDIF
    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)
IF(LTURB) THEN
+ LSWEEP= 200;  DTHYD= LCHAN/NX/UIN;  KELIN= 1
+ RELAX(  KE,LINRLX,0.5); RELAX( EP,LINRLX,0.1)
+ RELAX( UC1,FALSDT,DTHYD); RELAX(VC1,FALSDT,DTHYD)
+ RELAX(ENUT,LINRLX,0.1)
ENDIF
    GROUP 19. Data communicated by satellite to GROUND
    * LSG7 permits CCM-solver to use higher order schemes.
LSG7= LSCHM
  SCHMBEGIN
      VARNAM UC1 SCHEME MINMOD
      VARNAM VC1 SCHEME MINMOD
      VARNAM KE  SCHEME MINMOD
      VARNAM EP  SCHEME MINMOD
  SCHMEND
    GROUP 22. Spot-value print-out
IXMON= NX1+NX2/2+2; IYMON= NY2/2+1; IZMON=1