TALK=T;RUN( 1, 1)
  PHOTON USE
  * dump xxx0 means no gravity source
  * dump xxxg means  gravity source linked to calculated salt
  * dump xxxh means  gravity source linked to calculated salt
  *                  with fixv salt source at outer boundary
  * dump xxxi means  gravity source linked to calculated salt
  *                  with fixv salt source at patch whole
  p
  parphi
  3 4 1
 
 
 
 
  msg        Axi-symmetrical turbulent jet with Ys multiplied by 4
  msg        Velocity vectors:
  vec x 1 sh
  upause 1
  vec off;red
  upause 1
  msg        average mixl contours:
  con mixl x 1 fi;0.1
  upause 1
  msg        concentration contours:
  con conc x 1 fi;0.1
  upause 1
  msg        average f contours:
  con avef x 1 fi;0.1
  upause 1
  msg        root-mean-square fluctuation contours:
  con mnsq x 1 fi;0.1
  upause 1
  msg        f1 contours:
  con f1 x 1 fi;0.1
  upause 1
  msg        f5 contours:
  con f5 x 1 fi;0.1
  upause 1
  msg        f10 contours:
  con f10 x 1 fi;0.1
  upause 1
  msg        eddy-viscosity (enut) contours:
  con enut x 1 fi;0.1 
  enduse
l(cls
    GROUP 1. Run title and other preliminaries
TEXT(Round Jet; MFM; parabolic
TITLE
  DISPLAY
     The development of the wake downstream of an underwater
     vessel, the propulsion system of which creates an
     axi-symmetrical jet of velocity greater than that of the
     vessel.
 
     The jet does not remain axi-symmetrical as distance from
     the vessel's stern increases, because it is postulated that
     the vessel is moving through density-stratified water. This
     causes mixing in the vertical direction to differ
     significantly from that in the horizontal direction.
 
     MFM is used for the computation of the turbulence length
     scale and the effective viscosity. Longitudinal velocity is
     used as the sole PDA.
 
     In-Form is used so as to define the density distribution in
     the undisturbed water.
  ENDDIS
 
  The locally-defined variables are as follows:
 
     WJET     Jet velocity at the upstream boundary      (m/s)
     CJET     The jet concentration at the inlet          (C)
     CFREE    The concentration of the free stream        (C)
 
           Initial data of problem
           -----------------------
REAL(RHOL); RHOL=1027.     ! Density near the bottom, kg/m^3
REAL(RHOH); RHOH=1023.     ! Density near the surface, kg/m^3
 
REAL(WJET,WFREE,CJET,CFREE)
WJET=10.0; WFREE=0.5*WJET; CJET=1.0; CFREE=0.0
WFREE=0.5*WJET
INTEGER(NFLUIDS,NFLR,NFLF)
CHAR(MFMMOD)
NFLF=10; NFLR=1            ! 1D population is used with w1 as pda
NFLUIDS=NFLF*NFLR
 
REAL(VISCON,LENCON,CONMIX)
MFMMOD=MNSQ  ! use the RMS w fluctuations in micro-mixing rate
             ! length generation and
             ! effective viscosity computation
CONMIX=5.0 ; LENCON=0.5; VISCON=10.0 ! the constants (not optimised)
                                     ! see also enut = grnd10
                                     ! and $mnsq patch below
    group 3. x-direction grid specification
CARTES=F                   ! polar coordinates
   GRDPWR(X,12,3.1416,1)      ! uniform 180-degree grid
GRDPWR(X,1,1,0.1)          ! one small-angle cell
 
    GROUP 4. Y-direction grid specification
   *** Linear grid expansion of DYGDZ
  change dimensions and grid
REAL(REALNY,REALNZ)
NY=20; NZ=100
REALNY=NY; REALNZ=NZ
YVLAST  = 10.0       ! upstream outer radius of the domain
YFRAC(1) = -REALNY ;YFRAC(2) =  1./REALNY  ! uniform y-grid
AZYV=1.0   ! exponent in width-expansion formula.
           ! 1.0 signifies linear expansion
ZWADD=20.0*YVLAST     ! indirectly sets grid-enlargement angle
 
    GROUP 5. Z-direction grid specification
PARAB=T
NZ=100
AZDZ=PROPY ! i.e. grnd2, means dz is proportional to yvlast
DZW1=0.1   ! the proportionality constant
    
    GROUP 7. Variables stored, solved & named
SOLVE(P1,U1,V1,W1,C1); NAME(C1)=CONC; STORE(ENUT,RHO1)
SOLVE(MIXL,SALT)     ! solve both for length scale and salt
STORE(RATE,ENUT)
STORE(AVEF); VARMAX(AVEF)=1.0; VARMIN(AVEF)=0.0
STORE(MNSQ); VARMAX(MNSQ)=1.0; VARMIN(MNSQ)=0.0
 
INTEGER(III)         ! Solve, and set limits for the fluids
III=NFLUIDS+1        ! in the population
DO II = 1,NFLUIDS    ! DO loop order chosen so that
 III = III-1         ! F1 is solved first
 SOLVE(F:III:)
 VARMAX(F:III:)=1.0; VARMIN(F:III:)=0.0; RELAX(F:III:,LINRLX,0.5)
ENDDO
 
    GROUP 8. Terms (in differential equations) & devices
DIFCUT=0.0
 
    GROUP 9. Properties of the medium (or media)
ENUT=GRND10      ! this means efffective viscosity from MNSQ & MIXL

GOTO SKIPKE      ! deactivate this line if k-epsilon turbulence
TURMOD(KEMODL)   ! model is required
VARMIN(KE)=0.001*WFREE**2
FIINIT(KE)=VARMIN(KE)
VARMAX(KE)=WFREE**2
VARMIN(EP)=1.E-6
FIINIT(EP)=FIINIT(KE)*100
VARMAX(EP)=1.E6
RELAX(KE,LINRLX,0.5);RELAX(EP,LINRLX,0.5)
VARMIN(ENUT)=0.0001
VARMAX(ENUT)=10.0
RELAX(ENUT,LINRLX,0.1)
KELIN=3
LABEL SKIPKE
  
RHO1=0.5*(:RHOH: + :RHOL:)
  
  inform9begin
   ** For the stratification of water
char(form)   ! the formula is transmittd as character string below
FORM=:RHOL:+0.5*(TANH (yg*cos(xg)/yvlast) +1)*(:RHOH:-:RHOL:)
(PROPERTY of RHO1 is salt)
  INFORM9END
 
    GROUP 11 initial values
FIINIT(MIXL)= YVLAST          ! it is important to initialise to
                              ! reasonable values
PATCH(START2,INIVAL,1,NX,NY/2+1,NY,1,1,1,1)
COVAL(START2,F:NFLUIDS:,0.0,1.0)
PATCH(START1,INIVAL,1,1,1,NY/2,1,1,1,1)
COVAL(START1,F1,0.0,1.0)
  inform11begin
(initial of salt is form)    ** this gives the density profiles at
                              ! all jet boundaries the appropriate
                              ! values, but allows alteration within
                              ! jet in accordance with convection &
                              ! and diffusion of salt
  inform11end
  GROUP 13. Boundary conditions and special sources
REAL(ENTRCON)                 ! 'entrainment constant' used so as to
ENTRCON=0.075                 ! impose inflow rather than fix pressure
                              ! at outer boundary
    
    1. Outer Boundary-- free stream
PATCH(FREE,NORTH,1,NX,NY,NY,1,NZ,1,1)
COVAL(FREE,P1,FIXFLU,RHO1*WFREE*ENTRCON)
COVAL(FREE,W1,ONLYMS,WFREE)
COVAL(FREE,V1,ONLYMS,0.0)
COVAL(FREE,CONC,ONLYMS,CFREE)
COVAL(FREE,KE,ONLYMS,FIINIT(KE))
COVAL(FREE,EP,ONLYMS,FIINIT(EP))
DO II = 1,NFLUIDS            ! only the last-numbered fluid enters
 COVAL(FREE,F:II:,ONLYMS,0.0)
ENDDO
COVAL(FREE,F:NFLUIDS:,ONLYMS,1.0)
  inform13begin
(source of salt at free is form with fixval)
  inform13end
 
    2. Upstream Boundary -- the higher-velocity jet
PATCH(UPSTJET,LOW,1,NX,1,NY/2,1,1,1,1)
COVAL(UPSTJET,P1,FIXFLU,RHO1*WJET)
COVAL(UPSTJET,W1,ONLYMS,WJET)
COVAL(UPSTJET,CONC,ONLYMS,CJET)
COVAL(UPSTJET,SALT,ONLYMS,SAME)  ! takes the initial value
COVAL(UPSTJET,ke,onlyms,fiinit(ke)*10)
COVAL(UPSTJET,ep,onlyms,fiinit(ep)*10)
DO II = 1,NFLUIDS
 COVAL(UPSTJET,F:II:,ONLYMS,0.0)
ENDDO
COVAL(UPSTJET,F1,ONLYMS,1.0)
 
    3. Upstream boundary -- free stream
PATCH(UPSTFREE,LOW,1,NX,NY/2+1,NY,1,1,1,1)
COVAL(UPSTFREE,P1,FIXFLU,RHO1*WFREE)
COVAL(UPSTFREE,W1,ONLYMS,WFREE)
COVAL(UPSTFREE,CONC,ONLYMS,CFREE)
COVAL(UPSTFREE,SALT,ONLYMS,SAME)
COVAL(UPSTFREE,ke,ONLYMS,fiinit(ke)*10)
COVAL(UPSTFREE,ep,ONLYMS,fiinit(ep)*10)
DO II = 1,NFLUIDS
 COVAL(UPSTFREE,F:II:,ONLYMS,0.0)
ENDDO
COVAL(FREE,F:NFLUIDS:,ONLYMS,1.0)
 
PATCH(MICROMIX,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP) ! existence of this
                                  ! patch activates micro-mixing
 
  the following statements dictate that there is a source of MIXL,
  per unit volume, equal to LENCON*MNSQ
PATCH($MNSQ,PHASEM,1,NX,1,NY,1,NZ,1,1)    ! the $ ensures the above 
COVAL($MNSQ, MIXL, LENCON*1.0E-5, 1.E5)   ! multiplication by MNSQ
 
PATCH(whole,phasem,1,NX,1,NY,1,NZ,1,1)

  inform13begin
real(rhomean)
rhomean = 0.5 * (rhol + rhoh)
  (source of u1 at whole is 9.81*(rho1-rhomean)*sin(xu)) ** buoyancy
  (source of v1 at whole is 9.81*(rho1-rhomean)*cos(xg)) ** buoyancy
(source of salt at whole is form with fixval)
  inform13end
    
    GROUP 14. Downstream pressure for PARAB=T
    
IPARAB=0  ! average pressure fixed to ensure continuity 
    
    GROUP 16. Termination of iterations
SELREF=T; RESFAC=1.E-3; LITHYD=30; liter(p1) = 100
    
    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.5)      ! these relaxation factors have not been
RELAX(SALT,LINRLX,0.1)    ! optimised
RELAX(V1,FALSDT,1.); RELAX(W1,FALSDT,10.)
RELAX(U1,FALSDT,1.E-2)

    GROUP 18. Limits on variables or increments to them
VARMIN(V1)=-1.E3; VARMAX(V1)=1.E3
 
    GROUP 19. Data communicated by SATELLITE to GROUND
SPEDAT(MFM,MFMMOD, C,:MFMMOD:)    ! most mfm-related constants
SPEDAT(MFM,NFLUIDS,I,:NFLUIDS:)   ! are communicated via spedats
SPEDAT(MFM,NFLR,   I,:NFLR:)
SPEDAT(MFM,NFLF,   I,:NFLF:)
SPEDAT(MFM,CONMIX, R,:CONMIX:)
SPEDAT(MFM,VISCON, R,:VISCON:)
SPEDAT(MFM,POPMIN, R,:WFREE:)
SPEDAT(MFM,POPMAX, R,:WJET:)

    GROUP 22. Monitor print-out
IZMON=NZ/2;IYMON=1; ITABL=1;NPLT=1;IPLTL=LITHYD
TSTSWP=-5;NYPRIN=ny/5
    GROUP 23. Field print-out and plot control
ORSIZ=0.4
PATCH(IZEQNZ,PROFIL,1,1,1,NY,NZ,NZ,1,1)     ! final cross-stream
PLOT(IZEQNZ,W1,0.0,0.0); PLOT(IZEQNZ,CONC,0.0,0.0)
PLOT(IZEQNZ,ENUT,0.0,0.0)
NZPRIN=NZ
  ----------------------------------------- ! longitudinal
PATCH(MIDDLE,PROFIL,1,nx,NY/2,NY/2,1,NZ,1,1)
COVAL(MIDDLE,F1,0.0,0.0); COVAL(MIDDLE,F4,0.0,0.0)
COVAL(MIDDLE,F7,0.0,0.0); COVAL(MIDDLE,F10,0.0,0.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(FINAL,PROFIL,1,1,1,NY,NZ,NZ,1,1)
COVAL(FINAL,W1,0.0,0.0); COVAL(FINAL,MNSQ,0.0,0.0)
COVAL(FINAL,MIXL,0.0,0.0); COVAL(FINAL,ENUT,0.0,0.0)
ORSIZ=ORSIZ/2
IDISPA=1   ! dump for photon plot at each z step
    GROUP 24. Dumps for restarts
 
 
    late modifications
 
  nz=1
lithyd=100
                 inform debug statements
  infrbegin
  debug t
  stored t
  source t
  formula t
  infrend
TSTSWP=-1; IYMON=1; IZMON=1; RESFAC=1.E-3
STOP