```

TALK=T;RUN( 1, 1)
PHOTON USE
p
parphi
1 5000 1

gr ou x 1
con f2 x 1 fi;0.001
upause 1
con f5 x 1 fi;0.001
upause 1
con f8 x 1 fi;0.001
upause 1
con f11 x 1 fi;0.001
upause 1
con f14 x 1 fi;0.001
upause 1
con f17 x 1 fi;0.001
upause 1
con f20 x 1 fi;0.001
upause 1
con f23 x 1 fi;0.001
upause 1
con f26 x 1 fi;0.001
upause 1
con f29 x 1 fi;0.001
upause 1
ENDUSE

TEXT(1d ocean layer; 2d pop. ; v & w as PDAs
TITLE
DISPLAY
This Q1 uses the multi-fluid model to simulate turbulence in
the surface layer of a body of water subjected to a uniform
shear stress. The process is time-dependent.

A 2D population of fluids is used, the population-defining
attributes being vertical velocity, v,  and horizontal
velocity, w.

The geometrical grid is 1D, the discretized direction being
vertical, of 1 meter length.

The shear is simulated by filling the bottom cell with the
fluid having the attributes v=0, w=0, and the top cell with
the fluid having the attributes v=0, w=1 meter/second.

The micro-mixing rate is set equal to RATE, prescribed as
1.0 hertz, times a constant: CONMIX.

Mixing is simulated by setting the effective viscosity to 1.0
meter ** 2 /seconds.
The geometrical grid is as shown below on the left and the 2D
population grid as shown on the right.

|--------|
|   T    |          v                                        NV
|--------|        +0.5 |------|------|------|------|------| int
|        |          ^  |      |      |      |      |      | erv
|--------|          |  |------|------|------|------|------| als
|        |         IV  |      |      |      |      |      |
|--------|          |  |------|------|------|------|------|
|        |          |  |   IFLUID=IV+(IW-1)*NV     |      |
|--------|          |  |------|------|------|------|------|
|        |         0.0 |  b   |      |      |      |  t   |
|--------|             |------|------|------|------|------|
|        |             |      |      |      |      |      |
|--------| y           |------|------|------|------|------|
|        |             |      |      |      |      |      |
|--------| ^           |------|------|------|------|------|
|        | |           |      |      |      |      |      |
|--------| |       -0.5|------|------|------|------|------|
|   B    | |                                IW
|--------| |             0.0   ------------> w        1.0
---> z                        NW intervals
ENDDIS

Data settings
INTEGER(NV,NW,NFLUIDS,IFLUIB,IFLUIT)
INTEGER(NFLR,NFLF)
CHAR(MFMMOD)
REAL(CONMIX)
NV=11;NW=11
CONMIX=100
MFMMOD=MFM
derived quantities
NFLF = NV
NFLR = NW
NFLUIDS=NV*NW
IFLUIB=(NV+1)/2           ! index of bottom fluid
IFLUIT=IFLUIB + NV*(NW-1) ! index of top fluid
************************************************************
group 1. run title and number
************************************************************
************************************************************
group 2. transience
GRDPWR(T,10,1000/conmix,1.0)    ! small conmix -> long time
************************************************************
group 4. y-direction grid spacing
NY      =       9
YVLAST  = 1.000000E+00
GRDPWR(Y,NY,YVLAST,1.0)
************************************************************
group 7. variables: stored,solved,named
ONEPHS  =    T
SOLVE(W1)

STORE(RATE)
IF(NFLF.GT.1) THEN
STORE(AVEF); VARMAX(AVEF)=1.0; VARMIN(AVEF)=0.0
IF(NFLR.EQ.1) THEN
STORE(MNSQ); VARMAX(MNSQ)=1.0; VARMIN(MNSQ)=0.0
ENDIF
ENDIF
IF(NFLR.GT.1) THEN
STORE(AVER); VARMAX(AVER)=1.0; VARMIN(AVER)=0.0
IF(NFLF.EQ.1) THEN
STORE(MNSQ); VARMAX(MNSQ)=1.0; VARMIN(MNSQ)=0.0
ENDIF
ENDIF
STORE(RMSO,RMSA,RMOA,FLSM,PGRD,NETM,FRSM)
INTEGER(III)
III=NFLUIDS+1
! DO loop order chosen so that
! F1 is solved first
DO II = 1,NFLUIDS
III = III-1
SOLVE(F:iii:)
VARMAX(F:iii:)=1.0; VARMIN(F:iii:)=0.0; RELAX(F:iii:,LINRLX,0.5)
VARMAX(F:iii:)=1.0; VARMIN(F:iii:)=0.0; RELAX(F:iii:,LINRLX,1.0)
ENDDO
STORE(VIST,RATE,AVER,AVEF)
************************************************************
Group 8. Terms & Devices
* Y in TERMS argument list denotes:
* 1-built-in source 2-convection 3-diffusion 4-transient
* 5-first phase variable 6-interphase transport
DO II=1,NFLUIDS
TERMS(F:II:,N,N,Y,Y,Y,N)
ENDDO
TERMS(W1,N,N,Y,P,P,P)
************************************************************
Group 9. Properties
RHO1    = 1000.0
enut=1.0
enut=.0
************************************************************
Group 11.Initialise Var/Porosity Fields
FIINIT(VIST)=1.0 ; FIINIT(RATE)=1.0
DO II=1,NFLUIDS
FIINIT(F:II:)=1/NFLUIDS
FIINIT(F:II:)=0.0
RELAX(F:II:,LINRLX,0.5)
OUTPUT(F:II:,Y,Y,N,N,Y,Y)
ENDDO
PATCH(TOPINIT,INIVAL,1,1,NY,NY,1,1,1,1)
INIT(TOPINIT,F:IFLUIT:, FIXVAL, 1.000000E+00)

PATCH(BTMINIT,INIVAL,1,1,1,1,1,1,1,1)
INIT(BTMINIT,F:IFLUIB:, FIXVAL, 1.000000E+00)

integer(ifluim)
ifluim=(ifluib + ifluit)/2
patch(midinit,inival,1,1,ny/2+1,ny/2+1,1,1,1,1)
init(midinit,F:ifluim:, FIXVAL, 1.000000E+00)

output(f1,y,y,y,y,y,y)
FSWEEP  =       1
NAMFI   =CHAM
************************************************************
Group 13. Boundary & Special Sources

PATCH(BOTTOM,CELL,1,1,1,1,1,1,1,LSTEP)       ! at the bottom there is only
DO II=1,NFLUIDS                              ! one fluid with w=0
COVAL(BOTTOM ,F:II:, FIXVAL, 0.000000E+00)   ! and v = 0
ENDDO
COVAL(BOTTOM ,F:IFLUIB:, FIXVAL, 1.000000E+00)
COVAL(BOTTOM,W1,FIXVAL,0.0)

PATCH(TOP,CELL,1,1,NY,NY,1,1,1,LSTEP)        ! at the topthere is only
DO II=1,NFLUIDS                              ! one fluid with w=maximum
COVAL(TOP ,F:II:, FIXVAL, 0.000000E+00)      ! and v = 0
ENDDO
COVAL(TOP ,F:IFLUIT:, FIXVAL, 1.000000E+00)
COVAL(TOP,W1,FIXVAL,1.0)

************************************************************
Group 15. Terminate Sweeps
LSWEEP  =    100 ;ISWC1  =       1
LITHYD  =     1 ;LITFLX =     1 ;LITC   =     1 ;ITHC1  =     1
SELREF  =    T
************************************************************
Group 19. EARTH Calls To GROUND Station
USEGRD  =    T  ;USEGRX =    T
SPEDAT(SET,MFM,MFMMOD,C,MFM)
SPEDAT(SET,MFM,NFLUIDS,I,NFLUIDS)
SPEDAT(SET,MFM,NFLF,I,NW)
SPEDAT(SET,MFM,NFLR,I,NV)
SPEDAT(SET,MFM,CONMIX,R,:CONMIX:)
************************************************************
Group 20. Preliminary Printout
ECHO    =    T
************************************************************
Group 22. Monitor Print-Out
IXMON   =       1 ;IYMON  =  ny/2 + 1 ;IZMON  =       1
NPRMON  =  100000 ;NPRMNT =       1 ;TSTSWP =      -1
UWATCH  =    T  ;USTEER =    T
HIGHLO  =    F
**********************************************************
Group 23.Field Print-Out & Plot Control
NPRINT  =  100000 ;NUMCLS =       5
IPLTF   =       1 ;IPLTL  =      -1 ;NPLT   =      -1
ISWPRF  =       1 ;ISWPRL =  100000
ITABL   =       1 ;IPROF  =       1
ABSIZ   = 5.000000E-01 ;ORSIZ  = 4.000000E-01
NTZPRF  =       1 ;NCOLPF =      50
ICHR    =       2 ;NCOLCO =      45 ;NROWCO =      20
NYPRIN=1

PATCH(Y,PROFIL,1,1,1,NY,1,1,1,1)  ! activation of line-printer plots
DO II=1,NFLUIDS
COVAL(Y,F:II:,0.0,1.0)
ENDDO
IDISPA=1
PATCH(PLOT,PROFIL,1,1,1,NY,1,1,1,LSTEP)
COVAL(PLOT,W1,0,0)
COVAL(PLOT,AVEF,0,0)
COVAL(PLOT,AVER,0,0)
PATCH(PLOT2,PROFIL,1,1,1,NY,1,1,1,LSTEP)
COVAL(PLOT2,F3,0,0)
COVAL(PLOT2,F8,0,0)
COVAL(PLOT2,F13,0,0)
COVAL(PLOT2,F18,0,0)
COVAL(PLOT2,F23,0,0)
ORSIZ=ORSIZ/2
************************************************************
Group 24. Dumps For Restarts
SAVE    =    T  ;AUTOPS =    F  ;NOWIPE =    F
NSAVE   =CHAM
lsweep=200
lstep=1
(realread of 2dpop is -5 5 0 10)  ! values read into micromix
! inactive in-form statements used in de-bugging
store(flsm,pgrd)
(stored var f9AN is anco(f9))
(stored var f9so is resi(f9))
(stored var f8so is resi(f8))
(stored var f7so is resi(f7))
(stored var f6so is resi(f6))
(stored var f5so is resi(f5))
(stored var f4so is resi(f4))
(stored var f3so is resi(f3))
(stored var f2so is resi(f2))
(stored var f1so is resi(f1))

(stored var f9ap is apco(f9))
(stored var f8ap is apco(f8))
(stored var f7ap is apco(f7))
(stored var f6ap is apco(f6))
(stored var f5ap is apco(f5))
(stored var f4ap is apco(f4))
(stored var f3ap is apco(f3))
(stored var f2ap is apco(f2))
(stored var f1ap is apco(f1))
output(w1,n,n,n,n,n,n)
output(vist,n,n,n,n,n,n)
output(RATE,n,n,n,n,n,n)
numcls=3
inifld=t

lsweep=10
nprint=1
lsweep=3
nprint=lsweep/10
selref=f
resref(f1)=0.0
resref(f2)=0.0
inifld=t

sharbegin
index 1
power 2
factor 0.00001