TALK=T;RUN(1,1)
  DISPLAY
  A heavier saline solution lies below a lighter fresh-water layer.
  Both have the same temperature, and are at rest.

  The lower fluid is heated, for a limited period. It becomes light$
er
  than the upper fluid, and therefore rises through it.

  However, after some time it sinks again because it loses heat
  much faster than it loses salt.

  The phenomena are described in the lecture which may be seen by
   clicking here.$


  The setting IDISPA=1 ensures that a parphi (or parada) file is
  created enabling the development in time to be viewed by way of
  PHOTON, with the z-axis being used for time.

  A PHOTON USE file is supplied.
  ENDDIS
    photon use
    p;parphi
   1000 1 1

   view y
   gr ou y 1
   con r1 y 1 fi;0.1
   msg lower-phase concentration
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con h1 y 1 fi;0.1
   msg lower-phase temperature
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con h2 y 1 fi;0.1
   msg higher-phase temperature
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con den1 y 1 fi;0.1
   msg lower-phase density
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con den2 y 1 fi;0.1
   msg higher-phase density
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con u1 y 1 fi;0.1
   msg lower-phase velocity
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con u2 y 1 fi;0.1
   msg higher-phase velocity
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con c1 y 1 fi;0.1
   msg lower-phase c-value
   msg horizontal coordinate is time, increasing to the right

   pause;con off;red;con c2 y 1 fi;0.1
   msg higher-phase c-value
   msg horizontal coordinate is time, increasing to the right

   *pause;*con off;*red;*con p1 y 1 fi;0.1
   *msg pressure in both phases
   *msg horizontal coordinate is time, increasing to the right

   enduse
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
 ************************************************************
 
 TEXT(Stafford's saline-layer experiment      )
 
 ************************************************************
 ************************************************************
 
 IRUNN = 1 ;LIBREF = 14
 ************************************************************
  Group 2. Time dependence
 STEADY = F
    * Set overall time and no. of steps
 TFIRST =0. ;TLAST =500.
 FSTEP = 1 ;LSTEP = 200
 TFRAC(1)=5.0E-03 ;TFRAC(41)=0.205
 TFRAC(81)=0.405 ;TFRAC(121)=0.605
 TFRAC(161)=0.805
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES = T
 NX = 20
 XULAST =0.1
 XFRAC(1)=0.05 ;XFRAC(2)=0.1
 XFRAC(3)=0.15 ;XFRAC(4)=0.2
 XFRAC(5)=0.25 ;XFRAC(6)=0.3
 XFRAC(7)=0.35 ;XFRAC(8)=0.4
 XFRAC(9)=0.45 ;XFRAC(10)=0.5
 XFRAC(11)=0.55 ;XFRAC(12)=0.6
 XFRAC(13)=0.65 ;XFRAC(14)=0.7
 XFRAC(15)=0.75 ;XFRAC(16)=0.8
 XFRAC(17)=0.85 ;XFRAC(18)=0.9
 XFRAC(19)=0.95 ;XFRAC(20)=1.
 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NY = 1
 YVLAST =1.
 YFRAC(1)=1.
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 PARAB = F
 NZ = 1
 ZWLAST =1.
 ZFRAC(1)=1.
 ************************************************************
  Group 6. Body-Fitted Coordinates
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS = F
 EQUVEL = F
 NAME(1)=P1 ;NAME(3)=U1
 NAME(4)=U2 ;NAME(9)=R1
 NAME(10)=R2 ;NAME(14)=H1
 NAME(15)=H2 ;NAME(16)=C1
 NAME(17)=C2 ;NAME(149)=DEN2
 NAME(150)=DEN1
    * Y in SOLUTN argument list denotes:
    * 1-stored 2-solved 3-whole-field
    * 4-point-by-point 5-explicit 6-harmonic averaging 
 SOLUTN(P1,Y,Y,N,N,N,Y)
 SOLUTN(U1,Y,Y,N,N,N,Y)
 SOLUTN(U2,Y,Y,N,N,N,Y)
 SOLUTN(R1,Y,Y,N,N,N,Y)
 SOLUTN(R2,Y,Y,N,N,N,Y)
 SOLUTN(H1,Y,Y,N,N,N,Y)
 SOLUTN(H2,Y,Y,N,N,N,Y)
 SOLUTN(C1,Y,Y,N,N,N,Y)
 SOLUTN(C2,Y,Y,N,N,N,Y)
 SOLUTN(DEN2,Y,N,N,N,N,Y)
 SOLUTN(DEN1,Y,N,N,N,N,Y)
 DEN1 = 150
 DEN2 = 149
 ************************************************************
  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         
 TERMS(P1,Y,Y,Y,N,Y,Y)
 TERMS(U1,Y,Y,Y,Y,Y,Y)
 TERMS(U2,Y,Y,Y,Y,N,Y)
 TERMS(R1,Y,Y,N,Y,Y,Y)
 TERMS(R2,Y,Y,N,Y,N,Y)
 TERMS(H1,N,Y,Y,Y,Y,Y)
 TERMS(H2,N,Y,Y,Y,N,Y)
 TERMS(C1,N,Y,Y,Y,Y,Y)
 TERMS(C2,N,Y,Y,Y,N,Y)
 DIFCUT =0.5 ;ZDIFAC =1.
 GALA = F ;ADDDIF = F
 NEWRH1 = T
 NEWRH2 = T
 EQDVDP = F
 HUNIT =1.
 ISOLX = -1 ;ISOLY = -1 ;ISOLZ = -1
 ************************************************************
  Group 9. Properties used if PRPS is not
  stored, and where PRPS = -1.0 if it is!
 RHO1 = GRND1 ;TMP1 =0. ;EL1 =0.
 TSURR =0. ;TEMP0 =0. ;PRESS0 =0.
 DVO1DT =0. ;DRH1DP =0.
 RHO1A =1000. ;RHO1B =-1. ;RHO1C =1.
 EMISS =0. ;SCATT =0.
 RADIA =0. ;RADIB =0.
 RHO2 = GRND1 ;TMP2 =0. ;EL2 =0.
 DVO2DT =0. ;DRH2DP =0.
 RHO2A =1000. ;RHO2B =-1. ;RHO2C =1.
 ENUL =1.0E-05 ;ENUT =0.
 DRH2DP =0.
 PHINT(U1)=-2.022E+04 ;PHINT(U2)=-2.022E+04
 PHINT(R1)=-2.022E+04 ;PHINT(R2)=-2.022E+04
 PHINT(H1)=-2.022E+04 ;PHINT(H2)=-2.022E+04
 PHINT(C1)=-2.022E+04 ;PHINT(C2)=-2.022E+04
 PRNDTL(U1)=1. ;PRNDTL(U2)=1.
 PRNDTL(H1)=1. ;PRNDTL(H2)=1.
 PRNDTL(C1)=1. ;PRNDTL(C2)=1.
 PRT(U1)=1. ;PRT(U2)=1.
 PRT(H1)=1. ;PRT(H2)=1.
 PRT(C1)=1. ;PRT(C2)=1.
 CP1 =1. ;CP2 =1.
 ************************************************************
  Group 10.Inter-Phase Transfer Processes
 CFIPS =10.
 RLOLIM =0. ;CMDOT =0.
 CINT(P1)=1. ;CINT(U1)=1.
 CINT(U2)=1. ;CINT(R1)=1.
 CINT(R2)=1. ;CINT(H1)=5.0E-04
 CINT(H2)=1. ;CINT(C1)=5.0E-06
 CINT(C2)=1.
 PHINT(P1)=-2.022E+04 ;PHINT(U1)=-2.022E+04
 PHINT(U2)=-2.022E+04 ;PHINT(R1)=-2.022E+04
 PHINT(R2)=-2.022E+04 ;PHINT(H1)=-2.022E+04
 PHINT(H2)=-2.022E+04 ;PHINT(C1)=-2.022E+04
 PHINT(C2)=-2.022E+04
 ************************************************************
  Group 11.Initial field variables (PHIs)
 FIINIT(P1)=1.0E-10 ;FIINIT(U1)=1.0E-10
 FIINIT(U2)=1.0E-10 ;FIINIT(R1)=1.
 FIINIT(R2)=0. ;FIINIT(H1)=0.
 FIINIT(H2)=0. ;FIINIT(C1)=1.
 FIINIT(C2)=0. ;FIINIT(DEN2)=1.0E-10
 FIINIT(DEN1)=1.0E-10
 
 PATCH(START ,INIVAL, 11, 20, 1, 1, 1, 1, 1, 1)
 INIT(START ,R1 ,0. ,0. )
 INIT(START ,R2 ,0. ,1. )
 INIADD = F
 FSWEEP = 1
 NAMFI =CHAM
 ************************************************************
  Group 12. Patchwise adjustment of terms
  Patches for this group are printed with those
  for Group 13.
  Their names begin either with GP12 or &
 ************************************************************
  Group 13. Boundary & Special Sources
 
 PATCH(GRAVITY ,PHASEM, 1, 20, 1, 1, 1, 1, 1, 200)
 COVAL(GRAVITY ,U1 , FIXFLU ,-9.81 )
 COVAL(GRAVITY ,U2 , FIXFLU ,-9.81 )
 
 PATCH(TOP ,CELL , 20, 20, 1, 1, 1, 1, 1, 200)
 COVAL(TOP ,R1 ,1. ,0. )
 COVAL(TOP ,R2 ,1000. ,0. )
 
 PATCH(HEAT ,PHASEM, 1, 10, 1, 1, 1, 1, 1, 50)
 COVAL(HEAT ,H1 , FIXFLU ,0.02 )
 XCYCLE = F
 EGWF = T
 WALLCO = GRND2
 ************************************************************
  Group 14. Downstream Pressure For PARAB
 ************************************************************
  Group 15. Terminate Sweeps
 LSWEEP = 100 ;ISWC1 = 1
 LITHYD = 1 ;LITFLX = 1 ;LITC = 1 ;ITHC1 = 1
 ISWR1 = 1 ;ISWR2 = 10000
 SELREF = T
 RESFAC =1.0E-04
 ************************************************************
  Group 16. Terminate Iterations
 LITER(P1)=20 ;LITER(U1)=10
 LITER(U2)=10 ;LITER(R1)=1
 LITER(R2)=1 ;LITER(H1)=20
 LITER(H2)=20 ;LITER(C1)=20
 LITER(C2)=20
 ENDIT(P1)=1.0E-03 ;ENDIT(U1)=1.0E-03
 ENDIT(U2)=1.0E-03 ;ENDIT(R1)=1.0E-03
 ENDIT(R2)=1.0E-03 ;ENDIT(H1)=1.0E-03
 ENDIT(H2)=1.0E-03 ;ENDIT(C1)=1.0E-03
 ENDIT(C2)=1.0E-03
 ************************************************************
  Group 17. Relaxation
 RELAX(P1,LINRLX,0.25)
 RELAX(U1,FALSDT,0.1)
 RELAX(U2,FALSDT,0.1)
 RELAX(R1,LINRLX,0.25)
 RELAX(R2,LINRLX,0.25)
 RELAX(H1,FALSDT,1.)
 RELAX(H2,FALSDT,1.)
 RELAX(C1,FALSDT,1.)
 RELAX(C2,FALSDT,1.)
 RELAX(DEN2,LINRLX,1.)
 RELAX(DEN1,LINRLX,1.)
 OVRRLX =0.
 EXPERT = F ;NNORSL = F
 ************************************************************
  Group 18. Limits
 VARMAX(P1)=1.0E+10 ;VARMIN(P1)=-1.0E+10
 VARMAX(U1)=1.0E+06 ;VARMIN(U1)=-1.0E+06
 VARMAX(U2)=1.0E+06 ;VARMIN(U2)=-1.0E+06
 VARMAX(R1)=1. ;VARMIN(R1)=1.0E-06
 VARMAX(R2)=1. ;VARMIN(R2)=1.0E-06
 VARMAX(H1)=1.0E+10 ;VARMIN(H1)=-1.0E+10
 VARMAX(H2)=1.0E+10 ;VARMIN(H2)=-1.0E+10
 VARMAX(C1)=1.0E+10 ;VARMIN(C1)=-1.0E+10
 VARMAX(C2)=1.0E+10 ;VARMIN(C2)=-1.0E+10
 VARMAX(DEN2)=1.0E+10 ;VARMIN(DEN2)=900.
 VARMAX(DEN1)=1.0E+10 ;VARMIN(DEN1)=900.
 ************************************************************
  Group 19. Data transmitted to GROUND
 PARSOL = F
 IBUOYB = 14 ;IBUOYC = 16
 ISG62 = 1
 SPEDAT(SET,GXMONI,TRANSIENT,L,F)
 SPEDAT(SET,GXMONI,PLOTALL,L,T)
 ************************************************************
  Group 20. Preliminary Printout
 ************************************************************
  Group 21. Print-out of Variables
 INIFLD = F ;SUBWGR = F
    * Y in OUTPUT argument list denotes:
    * 1-field 2-correction-eq. monitor 3-selective dumping      
    * 4-whole-field residual 5-spot-value table 6-residual table
 OUTPUT(P1,Y,Y,Y,Y,Y,Y)
 OUTPUT(U1,Y,Y,Y,Y,Y,Y)
 OUTPUT(U2,Y,Y,Y,Y,Y,Y)
 OUTPUT(R1,N,N,N,N,N,N)
 OUTPUT(R2,Y,Y,Y,Y,Y,Y)
 OUTPUT(H1,Y,N,Y,Y,Y,Y)
 OUTPUT(H2,Y,N,Y,Y,Y,Y)
 OUTPUT(C1,Y,N,Y,Y,Y,Y)
 OUTPUT(C2,Y,N,Y,Y,Y,Y)
 OUTPUT(DEN2,Y,N,Y,N,N,N)
 OUTPUT(DEN1,Y,N,Y,N,N,N)
 ************************************************************
  Group 22. Monitor Print-Out
 IXMON = 10 ;IYMON = 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
 NTPRIN = 40 ;ISTPRF = 1 ;ISTPRL = 100000
 NXPRIN = -1 ;IXPRF = 1 ;IXPRL = 10000
 IPLTF = 2 ;IPLTL = 100 ;NPLT = -1
 ISWPRF = 1 ;ISWPRL = 100000
 ITABL = 3 ;IPROF = 3
 ABSIZ =0.5 ;ORSIZ =0.4
 NTZPRF = 1 ;NCOLPF = 50
 ICHR = 2 ;NCOLCO = 45 ;NROWCO = 20
 
 PATCH(PROFILE ,PROFIL, 1, 20, 1, 1, 1, 1, 1, 200)
 PLOT(PROFILE ,P1 ,0. ,0. )
 PLOT(PROFILE ,U1 ,-1. ,-1. )
 PLOT(PROFILE ,U2 ,-1. ,-1. )
 PLOT(PROFILE ,R1 ,0. ,0. )
 
 PATCH(TIMEPLOT,PROFIL, 20, 20, 1, 1, 1, 1, 1, 200)
 PLOT(TIMEPLOT,R1 ,0. ,0. )
 ************************************************************
  Group 24. Dumps For Restarts
 SAVE = T ;NOWIPE = F
 NSAVE =CHAM
 IDISPA = 1 ;IDISPB = 0 ;IDISPC = 0
STOP