MB-FGE Test: Lid driven flow in a 2D skewed cavern.
  **************************************************************
  DISPLAY
   This case  concerns plane  lid driven  laminar flow  in a
   skewed cavern. Grid is created in X-Y plane.
 
   The main computational domain includes embedded fine grid.
   Position of  the fine  grid is  defined in  terms of  the
   coarse grid  cell-block, which  needs refinement  (IXFG1,
   IYFG1 - bottom left corner  of the block; NXFG1, NYFG1  -
   number of cells in the X- and Y-directions respectfully),
   and  refinement  ratios  in  X-  (IFCX1) and Y-directions
   (IFCY1).
 
   The main objective of the  case is to test the  treatment
   of non-orthogonal LINKS  in the presence  of 'ONE-to-ONE'
   or 'ONE-to-MANY' conections.
 
   The user can modify the following:
   1). By changing IXFG1, IYFG1, NXFG1 or NYFG1, place  fine
       grid in other region.  NOTE, that it is  necessary to
       apply appropriate boundary  conditions, if some  face
       of a fine grid is the wall of a cavern.
   2). By changing IFIC,  modify connection type from  'ONE-
       TO-ONE' (IFIC=1) to 'ONE-TO-MANY' (IFIC>1)
   3.) By changing skew  angle TET or Reynolds  number REYNU
       it is possible to investigate the resulting flow.
   ---------------------------------------------------------
  ENDDIS
L(PAUSE
  **************************************************************
  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 Velocity Vectors:
   gr out x  1 y 1 20 z 1 1
   gr out x 21 y 1 20 z 1 1
   gr out y  1 x 1 20 z 1 1
   gr out y 21 x 1 20 z 1 1
   mvec 1 k 1 sh
   mvec 2 k 1 sh
   msg Press Any Key to Continue...
   pause
   cl
   msg Contours of U-component:
   mgrid 1 k 1
   mgrid 2 k 1
   mcon 1 UC1 k 1 fi
   0.001
   mcon 2 uc1 k 1 fi
   0.001
   msg Press Any Key to Continue...
   pause
   cl
   msg Contours of V-component:
   mgrid 1 k 1
   mgrid 2 k 1
   mcon 1 vc1 k 1 fi
   0.001
   mcon 2 vc1 k 1 fi
   0.001
   msg Press E  to exit PHOTON ...
   pause
  ENDUSE
    GROUP 1. Run title and other preliminaries
TEXT(MB-FGE: 2D skewed cavity with moving lid.
TITLE
INTEGER(NX1,NY1,NZ1,NX2,NY2,NZ2,IC,JC)
INTEGER(IXFG1,NXFG1,IFCX1,IYFG1,NYFG1,IFCY1)
REAL(REYNU,UIN,DCAV,TET,PI,XCR,YCR,DTHYD)
REAL(XE1,YE1,XE2,YE2,XE3,YE3,XE4,YE4)
  ** Problem definition:
REYNU= 1.E4;    UIN= 1.0;   DCAV= 0.1;  TET = 50.0
PI   = 3.1415;  TET= PI*TET/180.
  ** Number of cells in the main coarse grid:
NX1  = 20;      NY1= 20;    NZ1 = 1
  ** Position and characteristics of the fine grid:
IXFG1= 1;  NXFG1= 10; IFCX1= 2;  IYFG1= 1;  NYFG1= 8;  IFCY1= 2
NX2  = NXFG1*IFCX1;   NY2  = NYFG1*IFCY1;   NZ2  = 1
    GROUP 6. Body-fitted coordinates or grid distortion
BFC= T; GSET(D,NX1,NY1,NZ1,DCAV,DCAV,DCAV)
GSET(P,P1,    0.0,0.0,0.0);   GSET(P,P2,DCAV,0.0,0.0)
GSET(P,S2,DCAV/2.,0.0,0.0)
XCR = DCAV+DCAV/2.*COS(TET);  YCR = DCAV/2.*SIN(TET)
GSET(P,P3,XCR,YCR,0.0);
XCR = DCAV+DCAV*COS(TET);     YCR = DCAV*SIN(TET)
GSET(P,P4,        XCR,YCR,0.0); GSET(P,P5,XCR-DCAV,YCR,0.0)
GSET(P,S5,XCR-DCAV/2.,YCR,0.0)
XCR = DCAV/2.*COS(TET);       YCR = DCAV/2.*SIN(TET)
GSET(P,P6,XCR,YCR,0.0);
GSET(L,L12,P1,S2,NX1/2, 1.0); GSET(L,LS2,S2,P2,    NX1/2,-1.3)
GSET(L,L23,P2,P3,NYFG1, 1.0); GSET(L,L34,P3,P4,NY1-NYFG1,-1.3)
GSET(L,L45,P4,S5,NX1/2, 1.3); GSET(L,LS5,S5,P5,    NX1/2, 1.0)
GSET(L,L56,P5,P6,NY1-NYFG1, 1.3); GSET(L,L61,P6,P1,NYFG1,1.0)
GSET(F,F1,P1,S2,P2,P3,P4,S5,P5,P6); GSET(M,F1,+I+J,1,1,1)
  ** Define grid points and lines for the first embedded grid:
IC = IXFG1+NXFG1;            JC = IYFG1+NYFG1
XE1= XC(IXFG1,IYFG1,1);      YE1= YC(IXFG1,IYFG1,1)
XE2= XC(IC,   IYFG1,1);      YE2= YC(IC,   IYFG1,1)
XE3= XC(IC,   JC,   1);      YE3= YC(IC,   JC,   1)
XE4= XC(IXFG1,JC,   1);      YE4= YC(IXFG1,JC,   1)
GSET(P,E1,XE1,YE1,0.0);      GSET(P,E2,XE2,YE2,0.0)
GSET(P,E3,XE3,YE3,0.0);      GSET(P,E4,XE4,YE4,0.0)
GSET(L,LE12,E1,E2,NX2,1.0);  GSET(L,LE23,E2,E3,NY2,1.0)
GSET(L,LE34,E3,E4,NX2,1.0);  GSET(L,LE41,E4,E1,NY2,1.0)
  ** Create grid for the main domain:
GSET(C,K:NZ+1:,F,K1,1,NX1,1,NY1,+,0.0,0.0,DCAV,INC,1.0)
DUMPC(MBGR1)
  ** Create embedded grid:
GSET(D,NX2,NY2,NZ2,DCAV,DCAV,DCAV)
GSET(F,F2,E1,-,E2,-,E3,-,E4,-); GSET(M,F2,+I+J,1,1,1)
GSET(C,K:NZ2+1:,F,K1,1,NX2,1,NY2,+,0.0,0.0,DCAV,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)
L($F150)
    GROUP 9. Properties of the medium (or media)
ENUL= UIN*DCAV/REYNU; RHO1 = 1.189
    GROUP 11. Initialization of variable or porosity fields
INIADD= F
    GROUP 13. Boundary conditions and special sources
    ** Walls.
    ****** Coarse grid:
MPATCH(1,WS1,SWALL,  1,NX1,  1,  1,1,NZ1,1,LSTEP)
COVAL(WS1,UC1,1.0,0.0); COVAL(WS1,VC1,1.0,0.0)
MPATCH(1,WN, NWALL,  1,NX1,NY1,NY1,1,NZ1,1,LSTEP)
COVAL(WN, UC1,1.0,UIN); COVAL(WN, VC1,1.0,UIN*COS(TET))
MPATCH(1,WW1,WWALL,  1,  1,  1,NY1,1,NZ1,1,LSTEP)
COVAL(WW1,UC1,1.0,0.0); COVAL(WW1,VC1,1.0,0.0)
MPATCH(1,WE, EWALL,NX1,NX1,  1,NY1,1,NZ1,1,LSTEP)
COVAL(WE, UC1,1.0,0.0); COVAL(WE, VC1,1.0,0.0)
    ****** Fine grid:
MPATCH(2,WS2,SWALL,  1,NX2,  1,  1,1,NZ2,1,LSTEP)
COVAL(WS2,UC1,1.0,0.0); COVAL(WS2,VC1,1.0,0.0)
MPATCH(2,WW2,WWALL,  1,  1,  1,NY2,1,NZ2,1,LSTEP)
COVAL(WW2,UC1,1.0,0.0); COVAL(WW2,VC1,1.0,0.0)
  ** Pressure relief
MPATCH(1,FIXPRS,CELL,1,1,NY1,NY1,1,NZ1,1,LSTEP)
COVAL(FIXPRS,P1,FIXP,0.0)
    GROUP 15. Termination of sweeps
LSWEEP= 500; TSTSWP= -1
    GROUP 16. Termination of iterations
SELREF= T;   RESFAC= 1.E-3
    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.2); DTHYD = 10.0*DCAV/NY/UIN
RELAX(UC1,FALSDT,DTHYD); RELAX(VC1,FALSDT,DTHYD)
    GROUP 19. Data communicated by satellite to GROUND
    * LSG3 = T, activates curvilinearity treatment;
    * LSG4 = T, activates nonorthogonality treatment.
LSG3= T; LSG4= T
    GROUP 22. Spot-value print-out
IXMON= NX1/2+1; IYMON= NY1/2+1; IZMON = 1