PHOTON USE
  p
  phi
  5 1
 
 
 
  msg grid
  gr z 1
  msg Press  to continue
  pause
  cl
  msg 1st-phase velocity vectors at t=5s
  set vec ref;2
  set vec comp
  au1 cv1 -
  vec z 1 sh
  gr ou z 1
  msg Press  to continue
  pause
  cl
  msg 2nd-phase velocity vectors at t=5s
  set vec ref;0.25
  set vec comp
  bu2 dv2 -
  vec z 1 sh
  gr ou z 1
  msg Press  to continue
  pause
  cl
  msg contour of pressure at t=5s
  con p1 z 1 fi;0.002
  gr ou z 1
  msg Press  to continue
  pause
  cl
  msg contour of 1st-phase volume fraction at t=5s
  con r1 z 1 fi;0.002
  gr ou z 1
  msg Press  to continue
  pause
  cl
  msg contour of 1st-phase volume fraction at t=5s
  con r2 z 1 fi;0.002
  gr ou z 1
  msg Press e to END
  enduse
    GROUP 1. Run title and other preliminaries
TEXT(TRANSIENT 2PH FLOW WITH MOVING WALL:W441
TITLE
  DISPLAY
  A light fluid lies above a heavy one in a box of which the lid
  is suddenly set in motion. A vortex begins to form in the upper
  fluid, and a second one,rotating in the opposite direction, in
  the lower one.
    This is a transient problem, much easier to conceive than to
  solve. A point to watch for is:does the sharp discontinuity
  of the volume fraction, characterising the interface, remain
  intact?
    It should be observed that a number of special devices have
  been activated in order to promote convergence, for example
  EQDVDP (which causes the velocities of the two fluids to be
  adjusted by equal amounts at the correction stage) and
  ISWR1=5 (which allows 5 sweeps of velocity adjustment, at each
  time step, before the volume fractions are solved for).
  The choices and settings of these convergence-promoting
  parameters may not be the best, so the search for better ones
  could prove instructive.
  ENDDIS
    GROUP 2. Transience; time-step specification
STEADY=F;GRDPWR(T,5,5.0,1.0)
    GROUP 3. X-direction grid specification
GRDPWR(X,5,1.0,1.0)
    GROUP 4. Y-direction grid specification
GRDPWR(Y,5,1.0,1.0)
    GROUP 7. Variables stored, solved & named
ONEPHS=F;SOLVE(P1,U1,V1,U2,V2,R1,R2)
SOLUTN(P1,P,P,P,P,P,N)
SOLUTN(U1,P,P,P,P,P,N);SOLUTN(U2,P,P,P,P,P,N)
SOLUTN(V1,P,P,P,P,P,N);SOLUTN(V2,P,P,P,P,P,N)
SOLUTN(R1,P,P,P,P,P,N);SOLUTN(R2,P,P,P,P,P,N)
NAME(U1)=AU1;NAME(U2)=BU2;NAME(V1)=CV1;NAME(V2)=DV2
    GROUP 8. Terms (in differential equations) & devices
  ** Make the velocity-pressure sensitivity coefficients
     (i.e. the d(vel)/dp's ) for both phases equal to
     the weighted average (by volume fraction) of the
     ones for each phase.
EQDVDP=T;RHO2=1.E3
    GROUP 9. Properties of the medium (or media)
ENUL=1.E-3
    GROUP 10. Inter-phase-transfer processes and properties
  ** Set a constant inter-phase friction coefficient.
CFIPS=1.E5
    GROUP 11. Initialization of variable or porosity fields
FIINIT(R1)=1.0;FIINIT(R2)=0.0;FIINIT(P1)=0.0
FIINIT(AU1)=0.;FIINIT(CV1)=0.;FIINIT(BU2)=0.;FIINIT(DV2)=0.
INIADD=T
PATCH(INIT,INIVAL,1,NX,1,2,1,1,1,1)
INIT(INIT,R1,0.0,-1.0);INIT(INIT,R2,0.0,1.0)
INIT(INIT,P1,0.0,1.0E3)
    GROUP 13. Boundary conditions and special sources
  ** Pressure relief
PATCH(REFP,CELL,1,NX,NY,NY,1,1,1,LSTEP);COVAL(REFP,P1,1.E-5,0.0)
  ** Moving wall
WALL (MOVWALL,NORTH,1,NX,NY,NY,1,1,2,LSTEP)
COVAL(MOVWALL,AU1,1.0,1.0)
  ** West wall
WALL (WFUNWEST,WEST,1,1,1,NY,1,1,1,LSTEP)
COVAL(WFUNWEST,CV1,1.0,0.0);COVAL(WFUNWEST,DV2,1.0,0.0)
  ** East wall
WALL (WFUNEAST,EAST,NX,NX,1,NY,1,1,1,LSTEP)
COVAL(WFUNEAST,CV1,1.0,0.0);COVAL(WFUNEAST,DV2,1.0,0.0)
  ** South wall
WALL (WFUNSOUT,SOUTH,1,NX,1,1,1,1,1,LSTEP)
COVAL(WFUNSOUT,BU2,1.0,0.0)
  ** Gravity
PATCH(GRAVITY,PHASEM,1,NX,1,NY,1,1,1,LSTEP)
COVAL(GRAVITY,CV1,FIXFLU,-10.0);COVAL(GRAVITY,DV2,FIXFLU,-10.0)
    GROUP 15. Termination of sweeps
ISWR1=5
LSWEEP=20;RESREF(P1)=1.E-5;RESREF(R1)=1.E-5;RESREF(R2)=1.E-5
    GROUP 17. Under-relaxation devices
RELAX(R1,LINRLX,0.1);RELAX(R2,LINRLX,0.1)
RELAX(AU1,FALSDT,0.01);RELAX(CV1,FALSDT,0.001)
RELAX(BU2,FALSDT,0.01);RELAX(DV2,FALSDT,0.01)
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
    GROUP 22. Spot-value print-out
IXMON=4;IYMON=4
    GROUP 23. Field print-out and plot control
NTPRIN=10;ITABL=1;IPLTL=100;TSTSWP=-1
PATCH(CONT,CONTUR,1,NX,1,NY,1,1,1,LSTEP)
PLOT(CONT,R2,0.0,10);PLOT(CONT,BU2,0.0,10)
PLOT(CONT,AU1,0.0,10)
PATCH(IXEQ2,PROFIL,2,2,1,NY,1,1,1,LSTEP)
PLOT(IXEQ2,AU1,-0.05,0.05);PLOT(IXEQ2,P1,0.0,4.E3)