TALK=F;RUN( 1, 1)
    
  PHOTON USE
  p
  
  
  
  CON P1 Z 1 FILL;0.01
  PAUSE
  VEC Z 1 
  ENDUSE

TEXT(2D Square Lid-Driven Cavity, Re=10000
REAL(RE,NORVEL,EASVEL,WESVEL,SOUVEL)

RE=10000.

INTEGER(GRD)
MESG(
MESG(
MESG(
MESG(    2D SQUARE LID-DRIVEN CAVITY, Re=10000
MESG(
MESG(
MESG( This case illustrates the speed-up that MIGAL 
MESG( produces and the way it increases with the number
MESG( of cells. It also demonstrates that a pressure
MESG( relief condition is not necessary with MIGAL.
MESG(
MESG(
MESG(
MESG( Enter required grid ID :  1 - 87x87 (default)
MESG(                           2 - 133x133 
MESG(                           3 - 166x166 
MESG(                           4 - 194x194 
MESG(                           5 - 218x218 
MESG(                           6 - 240x240 
MESG(                           7 - 260x260 
MESG(
READVDU(GRD,INT,1)
CASE GRD
WHEN 1
+ NX=87 
WHEN 2
+ NX=133
WHEN 3
+ NX=166
WHEN 4
+ NX=194
WHEN 5
+ NX=218
WHEN 6
+ NX=240
WHEN 7
+ NX=260
ENDCASE
NY=NX

INTEGER(SLV)
MESG( Enter required solver ID :  1 - MIGAL (default)
MESG(                             2 - SIMPLEST 
MESG(
READVDU(SLV,INT,1)

EASVEL=0.;WESVEL=0.;NORVEL=1.;SOUVEL=0.
GRDPWR(X,NX,1.,1.);GRDPWR(Y,NY,1.,1.)
SOLVE(P1,U1,V1)
DIFCUT=0.;ENUL=1./RE
FIINIT(U1)=1.
WALL (SOUTH,SOUTH,1,NX,1,1,1,1,1,1)
COVAL(SOUTH,U1,1.,SOUVEL)
WALL (NORTH,NORTH,1,NX,NY,NY,1,1,1,1)
COVAL(NORTH,U1,1.,NORVEL)
WALL (WEST,WEST,1,1,1,NY,1,1,1,1)
COVAL(WEST,V1,1.,WESVEL)
WALL (EAST,EAST,NX,NX,1,NY,1,1,1,1)
COVAL(EAST,V1,1.,EASVEL)

PATCH(REL1,CELL,1,1,1,1,1,1,1,1)
COVAL(REL1,P1,1.0000,0.0) 
COVAL(REL1,U1,ONLYMS,0.0)
COVAL(REL1,V1,ONLYMS,0.0)


IF(GRD.EQ.1) THEN
+ RELAX(U1,FALSDT,0.3)
+ RELAX(V1,FALSDT,0.3)
+ lsweep=1000
ENDIF
IF(GRD.EQ.2) THEN
+ RELAX(U1,FALSDT,0.25)
+ RELAX(V1,FALSDT,0.25)
+ lsweep=2000
ENDIF
IF(GRD.EQ.3) THEN
+ RELAX(U1,FALSDT,0.2)
+ RELAX(V1,FALSDT,0.2)
+ lsweep=3000
ENDIF
IF(GRD.EQ.4) THEN
+ RELAX(U1,FALSDT,0.15)
+ RELAX(V1,FALSDT,0.15)
+ lsweep=3900
ENDIF
IF(GRD.EQ.5) THEN
+ RELAX(U1,FALSDT,0.1)
+ RELAX(V1,FALSDT,0.1)
+ lsweep=5300
ENDIF
IF(GRD.EQ.6) THEN
+ RELAX(U1,FALSDT,0.05)
+ RELAX(V1,FALSDT,0.05)
+ lsweep=6800
ENDIF
IF(GRD.EQ.7) THEN
+ RELAX(U1,FALSDT,0.03)
+ RELAX(V1,FALSDT,0.03)
+ lsweep=9300
ENDIF

OUTPUT(U1,Y,N,N,Y,Y,Y);OUTPUT(V1,Y,N,N,Y,Y,Y)
IXMON=NX/2;IYMON=NY/2;NXPRIN=NX/3;NYPRIN=NY/3
TSTSWP=-1
 
FIINIT(V1)=1.
selref=F;
resref(P1)=1.E-5;
resref(U1)=1.E-5;
resref(V1)=1.E-5;

ITABL=3
NPLT=1

IF(SLV.EQ.1) THEN

  MIGAL parameters
  ----------------

  A relief pressure condition is not necessary for MIGAL

+ REL1=skip

  Overwrite the false time steps with large values

+ relax(u1,falsdt,1.E+10) 
+ relax(v1,falsdt,1.E+10)
 
+ spedat(MIGAL,SOLVED1, c, HYDRO)
+ spedat(MIGAL,LINRLX1, r, 0.9)
+ spedat(MIGAL,RELAX1,  r, 0.9)

ENDIF

IF(GRD.EQ.1.AND.SLV.EQ.1) THEN
+ lsweep=22
ENDIF
IF(GRD.EQ.2.AND.SLV.EQ.1) THEN
+ lsweep=33
ENDIF
IF(GRD.EQ.3.AND.SLV.EQ.1) THEN
+ lsweep=35
ENDIF
IF(GRD.EQ.4.AND.SLV.EQ.1) THEN
+ lsweep=37
ENDIF
IF(GRD.EQ.5.AND.SLV.EQ.1) THEN
+ lsweep=39
ENDIF
IF(GRD.EQ.6.AND.SLV.EQ.1) THEN
+ lsweep=35
ENDIF
IF(GRD.EQ.7.AND.SLV.EQ.1) THEN
+ lsweep=34
ENDIF