PHOTON USE
  p;;;;;
 
  up z
  msg velocity vectors
  * set vec ref;0.5
  vec x 1 sh;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of pressure
  con p1 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of SLTM, deduced from MFM
  con SLTM x 1 fi;0.002;  gr ou x 1
  pause;  cl
  msg contour of SLTS, dedued from single-fluid model
  con SLTS x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of c1
  con c1 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of enut
  con enut x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of ep/ke
  con RATE x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of ke
  con ke x 1 fi;0.002;  gr ou x 1
  pause;  cl
  msg contour of mnsq
  con mnsq x 1 fi;0.002;  gr ou x 1
  pause;  cl
  msg contour of avef
  con avef x 1 fi;0.002;  gr ou x 1
  pause;  cl
  msg contour of fluid 1 volume fraction
  con f1 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 2 volume fraction
  con f2 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 3 volume fraction
  con f3 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 4 volume fraction
  con f4 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 5 volume fraction
  con f5 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 6 volume fraction
  con f6 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 7 volume fraction
  con f7 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 8 volume fraction
  con f8 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 9 volume fraction
  con f9 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  pause;  cl
  msg contour of fluid 10 volume fraction
  con f10 x 1 fi;0.002;  gr ou x 1
  pause;  cl
  msg contour of fluid 11 volume fraction
  con f11 x 1 fi;0.002;  gr ou x 1
  msg Press  to continue
  enduse
 
    GROUP 1. Run title
#cls
TEXT(MFM; Stirred Tank; salt creation
TITLE
  DISPLAY
  The geometry of this case is similar to that of case W918; but,
  unlike that case, ONEPHS=T. There are therefore only 3 velocity
  components. On the other hand, 11 fluids are distinguished, formed
  by mixing an acidic fluid with an alkaline one in different
  proportions.
l(pause
 
                                             __________|.|________
  The sketch illustrates the apparatus and  |          |||        |
  the initial state of the two liquids.     | upper    |.|        |
                                            | liquid   |||        |
  They are both at rest, and are in contact |          |.|  acid  |
  at a horizontal interface                 |..........|||........|
                                            | lower    |.| alkali |
  The paddle is supposed to be suddenly set | liquid   |||        |
  in motion.                                |       ---------     |
                                            |paddle ////\\\\\     |
  The computational task is to predict both |           .         |
  the macro-mixing, represented by the      ------------|---------
  subsequent distributions of velocity,                 .< axis of
  pressure and time-average concentration,                 symmetry
  but also the extent to which the two       The stirred mixing tank
  liquids are mixed together at any point.
 
  ENDDIS
l(pause)
REAL(UDRPAD,HEIGHT,DIAM,CHATIM)
UDRPAD=10.0; HEIGHT=1.0; DIAM=1.0
  udrpad=udrpad/2
CHATIM=0.01*HEIGHT/UDRPAD
    GROUP 2. Transience; time-step specification
    The process is simulated for a 10-second period, divided
    into 10 equal intervals
STEADY=F;GRDPWR(T,10,10.0,1.0)
lstep=10; tlast=10.0
nx=1; xulast=0.1; ny=10; yvlast= DIAM*0.5; nz=10; zwlast=height
cartes=F
#unigrid
#solvel
SOLVE(C1)
solutn(u1,y,y,n,p,p,p)
solutn(v1,p,p,n,p,p,p); solutn(w1,p,p,n,p,p,p)
STORE(enut,len1,rate)
NAME(W2)=E2
turmod(kemodl)
kelin=3
    GROUP 9. Properties of the medium (or media)
ENUL=1.E-2
RHO1=1.E3
    GROUP 11. Initialization of variable or porosity fields
FIINIT(C1)=0.0
  patch START occupies the lower half of the tank
INIADD=F
PATCH(START,INIVAL,1,1,1,NY,1,NZ/2,1,LSTEP)
COVAL(START,C1,0.0,1.0)
FIINIT(RATE)=0.01*UDRPAD; FIINIT(KE)=0.01*(UDRPAD*DIAM)**2
FIINIT(EP)=FIINIT(RATE)*FIINIT(KE)
FIINIT(ENUT)=FIINIT(RATE)*DIAM;FIINIT(LEN1)=0.2
 
    GROUP 13. Boundary conditions and special sources
    Cylindrical-wall friction
WALL (CYLWALL,NORTH,1,1,NY,NY,1,NZ,1,LSTEP)
COVAL(CYLWALL,W1,LOGLAW,0.0); COVAL(CYLWALL,E2,LOGLAW,0.0)
COVAL(CYLWALL,U1,LOGLAW,0.0); COVAL(CYLWALL,U2,LOGLAW,0.0)
COVAL(CYLWALL,KE,LOGLAW,LOGLAW); COVAL(CYLWALL,EP,LOGLAW,LOGLAW)
 
    Top-wall friction
WALL (TOP,HIGH,1,1,1,NY,NZ,NZ,1,LSTEP)
COVAL(TOP,U1,LOGLAW,0.0); COVAL(TOP,U2,LOGLAW,0.0)
COVAL(TOP,V1,LOGLAW,0.0); COVAL(TOP,V2,LOGLAW,0.0)
COVAL(TOP,KE,LOGLAW,LOGLAW); COVAL(TOP,EP,LOGLAW,LOGLAW)
    Bottom-wall friction
WALL (BOTTOM,LOW,1,1,1,NY,1,1,1,LSTEP)
COVAL(BOTTOM,U1,LOGLAW,0.0); COVAL(BOTTOM,U2,LOGLAW,0.0)
COVAL(BOTTOM,V1,LOGLAW,0.0); COVAL(BOTTOM,V2,LOGLAW,0.0)
COVAL(CYLWALL,KE,LOGLAW,LOGLAW); COVAL(CYLWALL,EP,LOGLAW,LOGLAW)
    Pressure-relief condition to ensure that problem is well-posed
PATCH(PRELIEF,HIGH,1,1,NY,NY,NZ,NZ,1,100)
COVAL(PRELIEF,P1,FIXP,0.0); COVAL(PRELIEF,C1,ONLYMS,0.0)
    Paddle condition, a fixed value for the liquid u/r
PATCH(PADDLE,CELL,1,1,NY/2,NY/2,NZ/5,NZ/5,1,LSTEP)
IURVAL=-1; COVAL(PADDLE,U1,FIXVAL,UDRPAD)
    GROUP 15. Termination of sweeps
    The following conditions are not necessarily optimal
LSWEEP=100; SELREF=T; RESFAC=0.1
    GROUP 17. Under-relaxation devices
RELAX(W1,FALSDT,CHATIM); RELAX(V1,FALSDT,CHATIM)
RELAX(U1,LINRLX,0.1)
RELAX(KE,LINRLX,0.5); RELAX(EP,LINRLX,0.5)
RELAX(ENUT,LINRLX,0.1)
VARMIN(KE)=0.0001; VARMAX(RATE)=10000.
    GROUP 22. Spot-value print-out
TSTSWP=-1; NPRMON=20; IYMON=NY/2; IZMON=NZ/2
    GROUP 23. Field print-out and plot control
IURPRN=-1; NYPRIN=NY/5; NXPRIN=NZ/5
    Line-printer contour plots for various quantities are called for
PATCH(MAP,CONTUR,1,1,1,NY,1,NZ,1,LSTEP)
PLOT(MAP,W1,0.0,10); PLOT(MAP,U1,0.0,10); PLOT(MAP,V1,0.0,10)
PLOT(MAP,C1,0.0,10.0)
    A line-printer profile plot for the topmost-but-one
    slab is called for
PATCH(IZEQNZM1,PROFIL,1,1,1,NY,NZ-1,NZ-1,1,LSTEP)
PLOT(IZEQNZM1,W1,0.0,0.0)
PATCH(IZEQNZD2,PROFIL,1,1,1,NY,1,NZ/2,1,LSTEP)
PLOT(IZEQNZD2,W1,-1.0,-1.0)
PATCH(TIMEPLOT,PROFIL,1,1,NY/2,NY/2,NZ/2,NZ/2,1,LSTEP)
PLOT(TIMEPLOT,U1,0.0,0.0); PLOT(TIMEPLOT,V1,0.0,0.0)
PLOT(TIMEPLOT,W1,0.0,0.0)
PLOT(TIMEPLOT,C1,0.0,0.0)
SARAH=0.001
  ************************* MFM ****************************
(stored var mixl is len1)  
(stored var rate is epke)
  
SOLVE(SLTM); FIINIT(SLTM)=0.0 !  salt concentration from MFM
PATCH(SALT1,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(SALT1,SLTM,FIXFLU,GRND)
 
  salt concentration from single-fluid model
SOLVE(SLTS); FIINIT(SLTM)=0.0
PATCH(SALT2,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(SALT2,SLTS,FIXFLU,GRND)
 
 
#mfm
 
NFLR=1; NFLF= 11; NFLUIDS=NFLR*NFLF   ! data needed by macro varset
CONMIX=5; CONREA=0.0
TEXT(MFM; Stirred Tank; Conmix=:Conmix:
#mfm1
 
DO II = 1,NFLUIDS
 FIINIT(F:II:)=0.0
 COVAL(START,F:II:,0.0,0.0)
 RELAX(F:II:,LINRLX,1.0)
 COVAL(PRELIEF,F:II:,ONLYMS,same)
ENDDO
  fluid :nfluids: occupies the top half, fluid 1 the lower
FIINIT(F:NFLUIDS:)=1.0
COVAL(START,F1,0.0,1.0)
 
CHAR(NAMPROF)
DO II=1,NFLUIDS
 NAMPROF=PROF:II:
 PATCH(:NAMPROF:,PROFIL,1,1,1,NY,1,NZ,1,1)
 COVAL(:NAMPROF:,F:II:,0.0,0.0)
ENDDO
 
PATCH(MIDDLE,PROFIL,1,1,NY/2,NY/2,1,NZ,1,lstep)
COVAL(MIDDLE,AVEF,0.0,0.0)
COVAL(MIDDLE,MNSQ,0.0,0.0)
COVAL(MIDDLE,ENUT,0.0,0.0)
 
ORSIZ=ORSIZ/2
 
TSTSWP=-1; UWATCH=T; USTEER=T; NYPRIN=1; resfac=1.e-3
DISTIL=T
 EX(P1  )=   7.432E+01; EX(V1  )=   9.456E-02; EX(W1  )=   1.466E-01
 EX(KE  )=   5.478E-02; EX(EP  )=   2.388E-01; EX(C1  )=   4.929E-01
 EX(F1  )=   8.842E-06; EX(F2  )=   2.041E-05; EX(F3  )=   5.379E-05
 EX(F4  )=   3.485E-04; EX(F5  )=   2.076E-01; EX(F6  )=   5.029E-01
 EX(F7  )=   2.334E-01; EX(F8  )=   4.990E-02; EX(F9  )=   4.847E-03
 EX(F10 )=   7.725E-04; EX(F11 )=   1.593E-04; EX(MNSQ)=   6.252E-02
 EX(AVEF)=   5.143E-01; EX(SLTS)=   2.255E-06; EX(SLTM)=   1.989E-06
 EX(RATE)=   2.002E+00; EX(MIXL)=   1.619E-02; EX(EPKE)=   2.002E+00
 EX(LEN1)=   1.619E-02; EX(ENUT)=   1.641E-03
 STOP