Group 1. Run Title
 TEXT(Residence-Time Demonstration            
  DISPLAY
   This case provides a simple demonstration of the calculation of
   residence time for plane turbulent channel flow over a cavity.
   The channel is 0.5m high by 3m long, and the cavity, which is
   located centrally beneath the channel, is 2.5m high by 1.5m wide.
   Fluid enters with a velocity of 1m/s corresponding to a Reynolds
   number of 3.24E4. The turbulence is represented by means of the
   standard k-e model.
 
   The procedure for calculating the residence time corresponds
   closely to the way residence times are measured in practice:
 
   1) obtain the steady-state solution for the hydrodynamics.
   2) perform a restart calculation from these solution fields so
      as to make a transient analysis for a single scalar quantity
      C1, which enters in a short pulse and is then convected out
      of the solution domain.
 
   The spread in time corresponds corresponds in part to the
   convective and diffusive mixing processes; but numerical
   diffusion is also present. The residence time is determined by
   monitoring the exit concentration with time, and noting when
   the exit value reaches a maximum. The PHOENICS simulation
   predicts the expected residence time of 3s, as may be seen
   on inspection of the PROFIL plot at the end of the RESULT
   file.
 
  ENDDIS
 
   The user may introduce the following FORTRAN coding in Group
   19 Section 8 of GROUND (Finish of time step) to temporal
   printout of the mass-averaged exit concentration in a file
   called TC1.DAT.
 
      198 CONTINUE
          IF(ISTEP.EQ.1) THEN
            OPEN(65,FILE='TC1.DAT')
            WRITE(65,1987)
    1987    FORMAT(2X,'ISTEP',3X,'T',7X,'C1EX'/)
          ENDIF
          CALL GETSOR('OUTLET',P1,GMOUT)
          CALL GETSOR('OUTLET',C1,GCOUT)
          GC1EX=GCOUT/(GMOUT+1.E-20)
          WRITE(65,'(I4,2X,F6.1,2X,1P2E11.5)') ISTEP,TIM,GC1EX
          RETURN
 
 ************************************************************
  Group 2. Transience
 
 MESG( Do you want to run steady ? (y/n)
 MESG( A steady run is needed before running a transient
 MESG( analysis for the residence-time computation)
 READVDU(ANS,CHAR,Y)
 IF(:ANS:.EQ.Y) THEN
 + STEADY=T
 + MESG(Steady hydrodynamics run
 ELSE
 + STEADY=F
 + MESG(Transient residence-time run
 ENDIF
 
    * Set overall time and no. of steps
 IF(.NOT.STEADY) THEN
 + RSET(U,0.000000E+00,5.000000E+00,100)
 ENDIF
 ************************************************************
  Groups 3, 4, 5  Grid Information
    * Overall number of cells, RSET(M,NX,NY,NZ,tolerance)
 RSET(M,20,20,1)
    * Set overall domain extent:
    *        xulast  yvlast  zwlast
            name
 XSI= 3.000000E+00; YSI= 3.000000E+00; ZSI= 1.000000E+00
 RSET(D,CHAM    )
    * Set objects: x0     y0     z0
    *              dx     dy     dz
                   name
 XPO= 0.000000E+00; YPO= 0.000000E+00; ZPO= 0.000000E+00
 XSI= 7.500000E-01; YSI= 2.500000E+00; ZSI= 1.000000E+00
 RSET(B,B1      )
 XPO= 2.250000E+00; YPO= 0.000000E+00; ZPO= 0.000000E+00
 XSI= 7.500000E-01; YSI= 2.500000E+00; ZSI= 1.000000E+00
 RSET(B,B2      )
    * Modify default grid
 RSET(X,1,5,1.000000E+00)
 RSET(X,2,10,1.000000E+00)
 RSET(X,3,5,1.000000E+00)
 
 RSET(Y,1,16,1.000000E+00)
 RSET(Y,2,4,1.000000E+00)
 ************************************************************
  Group 6. Body-Fitted coordinates
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
    * Non-default variable names
 NAME(146) =EPKE ; NAME(147) =EL1
 NAME(148) =ENUT ; NAME(149) =DEN1
 NAME(150) =PRPS
    * Solved variables list
 SOLVE(P1,C1)
 IF(STEADY) THEN
 + SOLVE(U1,V1);STORE(C1)
 ELSE
 + STORE(U1,V1)
 ENDIF
    * Stored variables list
 STORE(PRPS,DEN1,ENUT,EL1 ,EPKE)
    * Additional solver options
 SOLUTN(P1  ,Y,Y,Y,N,N,Y)
 IF(STEADY) THEN
 + TURMOD(KEMODL)
 ELSE
 + STORE(KE,EP)
 ENDIF
 
 ************************************************************
  Group 8. Terms & Devices
 TERMS (C1,N,Y,N,Y,Y,Y)
 
 IF(.NOT.STEADY) THEN
 + SCHEME(VANL1,C1)
 ENDIF
 
 NEWRH1  =    T
 NEWENL  =    T
 ************************************************************
  Group 9. Properties
 RHO1    = GRND10
 CP1     = 1.005000E+03
 ENUL    = GRND10
 PRT   (EP  ) =  1.314000E+00
 ************************************************************
  Group 10.Inter-Phase Transfer Processes
 ************************************************************
  Group 11.Initialise Var/Porosity Fields
 IF(STEADY) THEN
 + FIINIT(KE  ) = 2.500000E-03 ;FIINIT(EP  ) = 8.2000E-04
 + FIINIT(EPKE) = 1.000000E+00 ;FIINIT(PRPS) = 0.0
 ELSE
 + RESTRT(ALL)
 + NAMFI = 'HYDR'
 ENDIF
 
 PATCH(BLOCK1,INIVAL,#1,#1,#1,#1,#1,#1,1,1)
 INIT(BLOCK1,PRPS,0.0,198.0)
 
 PATCH(BLOCK2,INIVAL,#3,#3,#1,#1,#1,#1,1,1)
 INIT(BLOCK2,PRPS,0.0,198.0)
 
 ************************************************************
  Group 12. Convection and diffusion adjustments
   No PATCHes used for this Group
 ************************************************************
  Group 13. Boundary & Special Sources
 
 IF(STEADY) THEN
 + INLET (INLET,WEST,#1,#1,#2,#2,#1,#1,1,1)
 + VALUE (INLET,P1,1.189)
 + VALUE (INLET,U1,1.0)
 + VALUE (INLET,KE,2.500000E-03)
 + VALUE (INLET,EP,8.2000E-04)
 
 + WALL (NORWAL,NORTH,1,NX,NY,NY,1,1,1,1)
 ELSE
 
 + INLET (INLETP,WEST,#1,#1,#2,#2,#1,#1,1,1)
 + VALUE (INLETP,P1,1.189)
 + VALUE (INLETP,U1,1.0)
 + VALUE (INLETP,KE,2.500000E-03)
 + VALUE (INLETP,EP,8.2000E-04)
 + VALUE (INLETP,C1,1.0)
 
 + INLET (INLET,WEST,#1,#1,#2,#2,#1,#1,2,LSTEP)
 + VALUE (INLET,P1,1.189)
 + VALUE (INLET,U1,1.0)
 + VALUE (INLET,KE,2.500000E-03)
 + VALUE (INLET,EP,8.2000E-04)
 
 ENDIF
 
 PATCH (OUTLET,EAST  ,#3,#3,#2,#2,1,1,1,LSTEP)
 COVAL (OUTLET,P1  , 1.000000E+00, 0.000000E+00)
 
 EGWF    =    T
 ************************************************************
  Group 14. Downstream Pressure For PARAB
 ************************************************************
  Group 15. Terminate Sweeps
 IF(STEADY) THEN
 + LSWEEP = 300
 ELSE
 + LSWEEP = 5
 ENDIF
 RESFAC  = 1.000000E-04
 ************************************************************
  Group 16. Terminate Iterations
 ************************************************************
  Group 17. Relaxation
 RELAX(P1  ,LINRLX, 1.000000E+00)
 RELAX(U1  ,FALSDT, 1.0)
 RELAX(V1  ,FALSDT, 1.0)
 RELAX(KE  ,LINRLX, 4.000000E-01)
 RELAX(EP  ,LINRLX, 4.000000E-01)
 RELAX(C1  ,FALSDT, 100.0)
 KELIN   =       3
 ************************************************************
  Group 18. Limits
 VARMAX(U1  ) = 1.000000E+06 ;VARMIN(U1  ) =-1.000000E+06
 VARMAX(V1  ) = 1.000000E+06 ;VARMIN(V1  ) =-1.000000E+06
 VARMAX(C1  ) = 1.0 ;VARMIN(C1  ) =1.E-10
 ************************************************************
  Group 19. EARTH Calls To GROUND Station
 USEGRD  =    T  ;USEGRX =    T
 GENK    =    T
 SPEDAT(SET,GXMONI,TRANSIENT,L,F)
 ************************************************************
  Group 20. Preliminary Printout
 ECHO    =    T
 ************************************************************
  Group 21. Print-out of Variables
 ************************************************************
  Group 22. Monitor Print-Out
 IXMON   =      19 ;IYMON  =      18 ;IZMON  =       1
 NPRMON  =  100000 ;ITABL  =       3
 IF(STEADY) THEN
 + NPLT = 5
 ELSE
 + NPLT = 1
 ENDIF
 NPRMNT  =       1
 TSTSWP  =      -1
 ************************************************************
  Group 23.Field Print-Out & Plot Control
 NPRINT  =  100000
 ISWPRF  =       1 ;ISWPRL =  100000
   No PATCHes used for this Group
 IF(.NOT.STEADY) THEN
 + NTZPRF=1
 + PATCH(C1EXIT,PROFIL,%3,%3,$2,$2,1,1,1,LSTEP)
 + PLOT(C1EXIT,C1,0.0,0.0)
 ENDIF
 ************************************************************
  Group 24. Dumps For Restarts
 ************************************************************
 MENSAV(S,RELX,DEF,5.0000E-02,1,1.0000E-01)
 MENSAV(S,PHSPROP,DEF,200,0,1.1890E+00,1.5440E-05)
 MENSAV(S,FLPRP,DEF,K-E,NOTSET,AIR-CONSTANT)
IF(STEADY) THEN
+ NSAVE=HYDR
ENDIF
STOP