IRUNN   =       1 ;LIBREF =     166
 ************************************************************
  Group 1. Run Title
 TEXT(1D Darcy Flow With Heat Transfer )
  Water flows horizontally through a 1m-cube porous medium at a rate
  of 1E-3 m3/s. The medium has a porosity of 5% and a permeability K
  of 1E-8 m2. The Reynolds number based on K is 0.1 so that the flow
  can be represented by the Darcy model, for which the analytical
  pressure drop per unit length is given by (velocity*dynamic
  viscosity/permeability).
 
  The water enters at 20 degC and the solid matrix is heated by mean
  of a volumetric heat source. The fluid and porous structure are
  assumed to be in local thermal equilibrium, which is an adequate
  assumption for small-pore media (as encountered, for example, in
  geothermal reservoirs). The simulation is performed as a transient
  so as to demonstrate how the effective thermal capacity of the
  porous medium can be implemented in PHOENICS by means of the PLANT
  feature. The expected steady-state outlet temperature is 50 degC.
 
  PHOTON USE
    AUTOPLOT
  file
  m5 5
  m10
  m15
 
  d 1 tem1;d 2 tem1;d 3 tem1
  col3 1;col9 2;colf 3
  redr
  ENDUSE
 
 REAL(CPS,CPFL,DREY,KEFF,KFL,KPERM,KS,QIN,QVOLS)
 REAL(RHOCPE,RHOFL,RHOS,SF,TIN,VF,VOLT,VOLS,WIN)
 ************************************************************
  Group 2. Transience
 STEADY=F
 REAL(TIME,DTIME);TIME=900.0
 LSTEP=15;DTIME=TIME/LSTEP
 GRDPWR(T,LSTEP,TIME,1.0)
 ************************************************************
  Groups 3, 4, 5  Grid Information
 NZ=40
 GRDPWR(Z,NZ,1.0,1.0)
 CARTES=T
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
   ** W1 is the superficial velocity
 SOLVE(P1,W1);SOLUTN(P1,Y,Y,Y,N,N,Y);STORE(DEN1)
 SOLVE(TEM1);SOLUTN(TEM1,Y,Y,Y,N,N,Y)
 STORE(PRPS)
 STORE(SPH1,KOND)
   ** Store for TEM1 values on the previous time step
 STORE(OTEM)
 ************************************************************
  Group 8. Terms & Devices
   ** The required form of the energy-equation for the homogeneous
      porous medium reads:
 
          d(rhocpe*tem1)/dt+d(rhofl*w*cpfl*tem1)/dz =
 
                  d(keff*d(tem1)/dz)/dz + sf*qvols
 
      where  rhocpe = vf*rhofl*cpfl + sf*rhos*cps   and
             keff   = vf*kfl + sf*ks.
 
   ** deactivate built-in transient term d(rhofl*cpfl*tem1)/dt
TERMS(TEM1,P,P,P,N,P,P)
   ** deactivate convection, diffusion & transience of w1
      for economy
TERMS(W1,P,N,N,N,P,P)
 ************************************************************
  Group 9. Properties
   ** VF is the void fraction (i.e.porosity)
 VF=0.05;SF=1.-VF
   ** KEFF is the effective thermal conductivity of
           the porous medium
 KS=2.5; KFL=0.6; KEFF=VF*KFL+SF*KS
 
 CPFL=4.2E3;CPS=1.E3
 
   ** RHOCPE is the effective thermal capacity of the porous medium
 RHOFL=1000.; RHOS=2500.; RHOCPE=VF*RHO1*CPFL+SF*RHOS*CPS
   ** VOLS is the volume of solid material
 VOLT=XULAST*YVLAST*ZWLAST; VOLS=SF*VOLT
  ** QVOL is the heat-generation rate per volume of solid material
 QIN=126.0E3; QVOLS=QIN/VOLS
 ENUL=1.E-6
   ** KPERM is the permeability of the porous medium in m2.
 KPERM=ENUL/100.; DREY=0.1; DARCON=ENUL/KPERM
 
 WIN=ENUL*DREY/(KPERM)**0.5 ; TIN = 20.0
 
 RHO1=RHOFL; CP1 = CPFL; PRNDTL(TEM1) = -KEFF
 ENUT   = 0.000E+00
 ************************************************************
  Group 11.Initialise Var/Porosity Fields
 FIINIT(P1)=0.0; FIINIT(TEM1)=20.0; FIINIT(OTEM)=20.0
 FIINIT(W1)=WIN
 ************************************************************
  Group 13. Boundary & Special Sources
 
  **  Darcy resistance term for the porous media
PATCH(DARCYR,PHASEM,1,1,1,NY,1,NZ,1,LSTEP)
COVAL(DARCYR,W1,DARCON,0.0)
  **  Water inlet
PATCH(INLET,LOW,1,1,1,NY,1,1,1,LSTEP)
COVAL(INLET,P1,FIXFLU,RHO1*WIN)
COVAL(INLET,W1,ONLYMS,WIN)
COVAL(INLET,TEM1,ONLYMS,TIN)
  **  Water outlet
PATCH(OUTLET,HIGH,1,1,1,NY,NZ,NZ,1,LSTEP)
COVAL(OUTLET,P1,1.E3,0.0)
COVAL(OUTLET,TEM1,ONLYMS,SAME)
  ** Heat generation in the porous media
PATCH(HEAT,VOLUME,1,1,1,NY,1,NZ,1,LSTEP)
COVAL(HEAT,TEM1,FIXFLU,QVOLS*SF)
  ** Time-dependent term for porous medium ie d(rhocpe*tem1)/dt
PATCH(DHDT,VOLUME,1,1,1,NY,1,NZ,1,LSTEP)
   VAL=OTEM
COVAL(DHDT,TEM1,RHOCPE/DTIME,GRND)
   OTEM=TEM1
 ************************************************************
  Group 15. Terminate Sweeps
 LSWEEP  = 10
 SELREF  =    T; RESFAC  = 1.000E-03
 ************************************************************
  Group 17. Relaxation
 RELAX(P1  ,LINRLX, 1.000E+00)
 ************************************************************
  Group 19. EARTH Calls To GROUND Station
 ************************************************************
  Group 20. Preliminary Printout
ECHO    =    T
   ** activate PLANT feature
NAMSAT=MOSG
 ************************************************************
  Group 21. Print-out of Variables
 OUTPUT(DEN1,Y,N,Y,N,N,N)
 INIFLD = T
 ************************************************************
  Group 22. Monitor Print-Out
 IXMON   =       1 ;IYMON  =  1 ;IZMON  = NZ
 TSTSWP  =      -1 ; NPLT  =  1
 ************************************************************
  Group 23.Field Print-Out & Plot Control
 NTPRIN  =       5 ;ISTPRF =       1 ;ISTPRL =   10000
 NYPRIN  =       1; NZPRIN  =       1; ITABL   =       2
 ************************************************************
  Group 24. Dumps For Restarts
IDISPA  =5; CSG1    =M
 ************************************************************
DISTIL=T
EX(P1  )=4.875E+01;EX(KOND)=2.405E+00;EX(SPH1)=4.200E+03
EX(TEM1)=3.536E+01;EX(DEN1)=1.000E+03;EX(OTEM)=3.529E+01