PHOTON USE
  p
  phi
 
 
  msg  USE OF EARTH GENERATED WALL-FUNCTIONS
  msg
  msg        Pressure distribution:
  cl;red
  con p1 z max fi;.001
  vec z max
  msg
  msg Press  to continue
  pause
  msg
  msg        Temperature distribution:
  cl;red
  con tem1 z max fi;.001
  vec z max
  msg
  msg Press  to continue
  pause
  msg
  msg        Concentration distribution:
  cl;red
  con c1 z max fi;.001
  vec z max
  msg
  msg Press  to continue
  pause
  msg
  msg Press e to END
  enduse
 
    GROUP 1. Run title and other preliminaries
TEXT( USE OF EARTH GENERATED WALL-FUNCTIONS)
CHAR(CTURB);BOOLEAN(TURBL)
INTEGER(NXF,NXL,NYF,NYL,NZF,NZL,ISUM,N1)
REAL(VFRAC,VIN,TIN,CIN)
VIN=10.;TIN=100.;CIN=-1.
MESG(
MESG( DEMO. OF EGWF FOR FLOW AROUND A HEATED SOLUBLE CUBE
MESG(   FOR VARIOUS TURBULENCE MODELS AND LAMINAR FLOW
MESG(
MESG( The flow enters the W-S-L corner of the domain,
MESG( impinges on the solid cube, which is heated and
MESG( which has constant C1 concentration, and then
MESG( leaves the domain through the E-N-H corner. On
MESG( 3 faces of the cube the wall-functions are EGWFs
MESG( (ie. EARTH Generated Wall-Functions), and on the
MESG( other 3 faces the wall-functions are set as source
MESG( terms by means of GROUND coding
MESG(
MESG( Enter the turbulence model option; default
MESG( is KEMODL.
MESG( The options are:
MESG(  LAM    - laminar flow
MESG(  TURB   - simple mixing-length turbulence
MESG(  LVEL   - LVEL algebraic turbulence model
MESG(  KLMODL - the k-l model of turbulence
MESG(  KEMODL - the k-e model of turbulence
MESG(
MESG( For further info. please see the PHOENICS
MESG( encyclopaedia
MESG(
READVDU(CTURB,CHAR,KEMODL)
MESG(
MESG( Enter the COefficient for the WALL-functions;
MESG( the default is GRND2 (LOGLAW).
MESG( The options are:
MESG(  1/PRNDTL()         - suitable for laminar flow
MESG(  GRND1 (BLASIUS)    - suitable for laminar flow
MESG(  GRND2 (LOGLAW)     - equilibrium log-law wall-
MESG(                       function for turbulent flows
MESG(
READVDU(WALLCO,REAL,GRND2)
MESG(
TURBL=:CTURB:.NE.LAM
    GROUP 3. X-direction grid specification
NX=7;GRDPWR(X,NX,1.0,1.0)
NXF=NX/3+1;NXL=NX-NX/3
    GROUP 4. Y-direction grid specification
NY=7;GRDPWR(Y,NY,1.0,1.0)
NYF=NY/3+1;NYL=NY-NY/3
    GROUP 5. Z-direction grid specification
NZ=7;GRDPWR(Z,NZ,1.0,1.0)
NZF=NZ/3+1;NZL=NZ-NZ/3
    GROUP 7. Variables stored, solved & named
   *** Activate the harmonic averaging for solved variables
SOLVE(P1);SOLUTN(P1,Y,Y,Y,P,P,P)
SOLVE(TEM1);SOLUTN(TEM1,Y,Y,Y,P,P,Y)
SOLUTN(C1,Y,Y,Y,P,P,Y)
ISUM=0
IF(NX.GT.1) THEN
+  ISUM=ISUM+1;SOLVE(U1);SOLUTN(U1,P,P,Y,P,P,Y)
ENDIF
IF(NY.GT.1) THEN
+  ISUM=ISUM+1;SOLVE(V1);SOLUTN(V1,P,P,Y,P,P,Y)
ENDIF
IF(NZ.GT.1) THEN
+  ISUM=ISUM+1;SOLVE(W1);SOLUTN(W1,P,P,Y,P,P,Y)
ENDIF
VFRAC=ISUM**0.5
STORE(PRPS,BLOK)
IF (TURBL) THEN
+  TURMOD(:CTURB:)
+  SOLUTN(KE,P,P,P,P,P,Y)
+  SOLUTN(EP,P,P,P,P,P,Y)
ELSE IF (:CTURB: .EQ. TURB) THEN
+  STORE(LEN1,VIST)
ENDIF
   *** Store variables to contain the SKIN-friction factor,
   *** STANton number, and shear-STReSs
STORE(SKIN,STAN,STRS)
   *** Set block corrections for all variables at every
   *** solver iteration
IVARBK=-1;ISOLBK=1
    GROUP 8. Terms (in differential equations) & devices
   *** Get rid of potentially confusing heat sources that are
   *** irrelevant to the tests being performed
TERMS(TEM1,N,P,P,P,P,P)
    GROUP 9. Properties of the medium (or media)
   *** Set up the properties of the materials to be used
   *** NB. the viscosity & conductivity are boosted to make the
   *** viscous effects more noticeable for the laminar case
CSG10='q1'
  MATFLG=T;NMAT=2
   55 1.0   1.e-3 1000. 2.5 4.0e-3
  155 8000. 1.0    500. 50. 0.0
   *** Set up the turbulence models for the turbulent cases
   *** NB. at present limited to an artificially simple mixing
   *** length model
IF (:CTURB: .EQ. TURB .OR. :CTURB: .EQ. KLMODL) THEN
+  EL1=LINEARX
+  EL1A=(XULAST**2+YVLAST**2+ZWLAST**2)**0.5;EL1B=0.0
+  IF (:CTURB: .EQ. TURB) THEN
+    ENUT=PROPLEN;ENUTA=0.0;ENUTB=0.1
+  ENDIF
ENDIF
PRNDTL(TEM1)=CONDFILE;ENUL=FILE;
    GROUP 11. Initialization of variable or porosity fields
   *** Initiallise the solved variables
FIINIT(U1)=VIN/VFRAC;FIINIT(V1)=VIN/VFRAC;FIINIT(W1)=VIN/VFRAC
FIINIT(TEM1)=10.;FIINIT(C1)=CIN
   *** Settings of turbulence variables (KE & EP) are only
   *** made for k-l and k-e models
CASE :CTURB: OF
WHEN KEMODL,6
+  FIINIT(KE)=0.01*VIN*VIN
+  FIINIT(EP)=FIINIT(KE)**1.5
WHEN KLMODL,6
+  FIINIT(KE)=0.01*VIN*VIN
ENDCASE
INIADD=F
   *** Define the extents of liquid and solid
FIINIT(PRPS)=55.
PATCH(BLOCKI,INIVAL,NXF,NXL,NYF,NYL,NZF,NZL,1,1)
INIT (BLOCKI,PRPS,0.0,155.)
   *** Set up the block-corrections
INIT(BLOCKI,BLOK,0.0,2.0)
FIINIT(BLOK)=1.0;INIT(BLOCKI,BLOK,0.0,2.0)
   *** Complete initiallisations
FIINIT(SKIN)=0.0;FIINIT(STAN)=0.0;FIINIT(STRS)=0.0
    GROUP 13. Boundary conditions and special sources
   *** Set the C1 and TEM1 sources in the blocks: fixed
   *** flux for heat, and fixed values of C1 (heated
   *** rock-salt dissolving into water?)
PATCH(BLOCK,CELL,NXF,NXL,NYF,NYL,NZF,NZL,1,1)
COVAL(BLOCK,C1,FIXVAL,-CIN);COVAL(BLOCK,TEM1,FIXFLU,100.)
   *** Activate the EARTH-Generated Wall-Functions which
   *** sets default wall-functions on the block
EGWF=T
   *** Setup inlet conditions (3 PATCHes)
IF(NX.GT.1) THEN
+  INLET(XINL,WEST,1,1,1,NYF-1,1,NZF-1,1,LSTEP)
+  VALUE(XINL,P1,RHO1*VIN) ;VALUE(XINL,U1,VIN/VFRAC)
+  VALUE(XINL,V1,VIN/VFRAC);VALUE(XINL,W1,VIN/VFRAC)
+  VALUE(XINL,TEM1,TIN);VALUE(XINL,C1,CIN)
ENDIF
IF(NZ.GT.1) THEN
+  INLET(ZINL,LOW,1,NXF-1,1,NYF-1,1,1,1,LSTEP)
+  VALUE(ZINL,P1,RHO1*VIN) ;VALUE(ZINL,U1,VIN/VFRAC)
+  VALUE(ZINL,V1,VIN/VFRAC);VALUE(ZINL,W1,VIN/VFRAC)
+  VALUE(ZINL,TEM1,TIN);VALUE(ZINL,C1,CIN)
ENDIF
IF(NY.GT.1) THEN
+  INLET(YINL,SOUTH,1,NXF-1,1,1,1,NZF-1,1,LSTEP)
+  VALUE(YINL,P1,RHO1*VIN) ;VALUE(YINL,U1,VIN/VFRAC)
+  VALUE(YINL,V1,VIN/VFRAC);VALUE(YINL,W1,VIN/VFRAC)
+  VALUE(YINL,TEM1,TIN);VALUE(YINL,C1,CIN)
ENDIF
   *** Setup the outlet (3 PATCHes)
IF(NX.GT.1) THEN
+  OUTLET(XOUTL,EAST,NX,NX,NYL+1,NY,NZL+1,NZ,1,LSTEP)
+  VALUE(XOUTL,P1,0.0)
ENDIF
IF(NY.GT.1) THEN
+  OUTLET(ZOUTL,HIGH,NXL+1,NX,NYL+1,NY,NZ,NZ,1,LSTEP)
+  VALUE(ZOUTL,P1,0.0)
ENDIF
IF(NZ.GT.1) THEN
+  OUTLET(YOUTL,NORTH,NXL+1,NX,NY,NY,NZL+1,NZ,1,LSTEP)
+  VALUE(YOUTL,P1,0.0)
ENDIF
   *** Put in wall-PATCHes for 3 sides of the block
   *** These will over-ride the EGWFs
IF(NX.GT.1) THEN
+  PATCH(XBWALL,WWALL,NXL+1,NXL+1,NYF,NYL,NZF,NZL,1,LSTEP)
+  COVAL(XBWALL,V1,WALLCO,SAME);COVAL(XBWALL,W1,WALLCO,SAME)
+  COVAL(XBWALL,C1,WALLCO,SAME);COVAL(XBWALL,TEM1,WALLCO,SAME)
ENDIF
IF(NY.GT.1) THEN
+  PATCH(YBWALL,SWALL,NXF,NXL,NYL+1,NYL+1,NZF,NZL,1,LSTEP)
+  COVAL(YBWALL,W1,WALLCO,SAME);COVAL(YBWALL,U1,WALLCO,SAME)
+  COVAL(YBWALL,C1,WALLCO,SAME);COVAL(YBWALL,TEM1,WALLCO,SAME)
ENDIF
IF(NZ.GT.1) THEN
+  PATCH(ZBWALL,LWALL,NXF,NXL,NYF,NYL,NZL+1,NZL+1,1,LSTEP)
+  COVAL(ZBWALL,U1,WALLCO,SAME);COVAL(ZBWALL,V1,WALLCO,SAME)
+  COVAL(ZBWALL,C1,WALLCO,SAME);COVAL(ZBWALL,TEM1,WALLCO,SAME)
ENDIF
   *** Apply wall-PATCHes to the domain boundaries
IF(NX.GT.1) THEN
+  WALL(X1WALL,WEST,1,1,NYF,NY,1,NZ,1,LSTEP)
+  COVAL(X1WALL,C1,WALLCO,0.0);COVAL(X1WALL,TEM1,WALLCO,0.0)
+  WALL(X1WALA,WEST,1,1,1,NYF-1,NZF,NZ,1,LSTEP)
+  COVAL(X1WALA,C1,WALLCO,0.0);COVAL(X1WALA,TEM1,WALLCO,0.0)
+  WALL(XNWALL,EAST,NX,NX,1,NY,1,NZL,1,LSTEP)
+  COVAL(XNWALL,C1,WALLCO,0.0);COVAL(XNWALL,TEM1,WALLCO,0.0)
+  WALL(XNWALA,EAST,NX,NX,1,NYL,NZL+1,NZ,1,LSTEP)
+  COVAL(XNWALA,C1,WALLCO,0.0);COVAL(XNWALA,TEM1,WALLCO,0.0)
ENDIF
IF(NY.GT.1) THEN
+  WALL(Y1WALL,SOUTH,1,NX,1,1,NZF,NZ,1,LSTEP)
+  COVAL(Y1WALL,C1,WALLCO,0.0);COVAL(Y1WALL,TEM1,WALLCO,0.0)
+  WALL(Y1WALA,SOUTH,NXF,NX,1,1,1,NZF-1,1,LSTEP)
+  COVAL(Y1WALA,C1,WALLCO,0.0);COVAL(Y1WALA,TEM1,WALLCO,0.0)
+  WALL(YNWALL,NORTH,1,NXL,NY,NY,1,NZ,1,LSTEP)
+  COVAL(YNWALL,C1,WALLCO,0.0);COVAL(YNWALL,TEM1,WALLCO,0.0)
+  WALL(YNWALA,NORTH,NXL+1,NX,NY,NY,1,NZL,1,LSTEP)
+  COVAL(YNWALA,C1,WALLCO,0.0);COVAL(YNWALA,TEM1,WALLCO,0.0)
ENDIF
IF(NZ.GT.1) THEN
+  WALL(Z1WALL,LOW,NXF,NX,1,NY,1,1,1,LSTEP)
+  COVAL(Z1WALL,C1,WALLCO,0.0);COVAL(Z1WALL,TEM1,WALLCO,0.0)
+  WALL(Z1WALA,LOW,1,NXF-1,NYF,NY,1,1,1,LSTEP)
+  COVAL(Z1WALA,C1,WALLCO,0.0);COVAL(Z1WALL,TEM1,WALLCO,0.0)
+  WALL(ZNWALL,HIGH,1,NX,1,NYL,NZ,NZ,1,LSTEP)
+  COVAL(ZNWALL,C1,WALLCO,0.0);COVAL(ZNWALL,TEM1,WALLCO,0.0)
+  WALL(ZNWALA,HIGH,1,NXL,NYL+1,NY,NZ,NZ,1,LSTEP)
+  COVAL(ZNWALA,C1,WALLCO,0.0);COVAL(ZNWALA,TEM1,WALLCO,0.0)
ENDIF
   *** If the LVEL model is used then for wall-PATCHes
   *** set COVALs for the LTLS variable used in the calculation
   *** of the wall-distance
IF(:CTURB: .EQ. KEMODL .OR. :CTURB: .EQ. KLMODL) THEN
+  COVAL(XBWALL,KE,WALLCO,WALLCO)
+  COVAL(X1WALL,KE,WALLCO,WALLCO);COVAL(XNWALL,KE,WALLCO,WALLCO)
+  COVAL(YBWALL,KE,WALLCO,WALLCO)
+  COVAL(Y1WALL,KE,WALLCO,WALLCO);COVAL(YNWALL,KE,WALLCO,WALLCO)
+  COVAL(ZBWALL,KE,WALLCO,WALLCO)
+  COVAL(Z1WALL,KE,WALLCO,WALLCO);COVAL(ZNWALL,KE,WALLCO,WALLCO)
ENDIF
IF(:CTURB: .EQ. KEMODL) THEN
+  COVAL(XBWALL,EP,WALLCO,WALLCO)
+  COVAL(X1WALL,EP,WALLCO,WALLCO);COVAL(XNWALL,EP,WALLCO,WALLCO)
+  COVAL(YBWALL,EP,WALLCO,WALLCO)
+  COVAL(Y1WALL,EP,WALLCO,WALLCO);COVAL(YNWALL,EP,WALLCO,WALLCO)
+  COVAL(ZBWALL,EP,WALLCO,WALLCO)
+  COVAL(Z1WALL,EP,WALLCO,WALLCO);COVAL(ZNWALL,EP,WALLCO,WALLCO)
ENDIF
IF(:CTURB: .EQ. LVEL) THEN
+  COVAL(XBWALL,LTLS,1.0,0.0)
+  COVAL(X1WALL,LTLS,1.0,0.0);COVAL(XNWALL,LTLS,1.0,0.0)
+  COVAL(YBWALL,LTLS,1.0,0.0)
+  COVAL(Y1WALL,LTLS,1.0,0.0);COVAL(YNWALL,LTLS,1.0,0.0)
+  COVAL(ZBWALL,LTLS,1.0,0.0)
+  COVAL(Z1WALL,LTLS,1.0,0.0);COVAL(ZNWALL,LTLS,1.0,0.0)
ENDIF
    GROUP 15. Termination of sweeps
LSWEEP=50
    GROUP 16. Termination of iterations
LITER(TEM1)=20;LITER(C1)=20;LITER(U1)=10;LITER(V1)=10
    GROUP 17. Under-relaxation devices
RELAX(U1,FALSDT,5.*XULAST/(NX*VIN))
RELAX(V1,FALSDT,5.*YVLAST/(NY*VIN))
RELAX(W1,FALSDT,5.*ZWLAST/(NZ*VIN))
RELAX(KE,FALSDT,5.*YVLAST/(NY*VIN))
RELAX(EP,FALSDT,5.*YVLAST/(NY*VIN))
RELAX(TEM1,FALSDT,1000.); RELAX(C1,FALSDT,1000.)
    GROUP 19.
USEGRX=T
    GROUP 21. Print-out of variables
OUTPUT(P1,Y,P,P,Y,Y,Y);OUTPUT(U1,Y,P,P,Y,Y,Y)
OUTPUT(V1,Y,P,P,Y,Y,Y);OUTPUT(W1,Y,P,P,Y,Y,Y)
OUTPUT(TEM1,Y,P,P,Y,Y,Y);OUTPUT(C1,Y,P,P,Y,Y,Y)
IF (:CTURB: .EQ. KEMODL .OR. :CTURB: .EQ. KLMODL) THEN
+  OUTPUT(KE,Y,P,P,Y,Y,Y)
ENDIF
    GROUP 22. Spot-value print-out
IXMON=NX-1;IYMON=NY-1;IZMON=NZ-1;TSTSWP=-1
    GROUP 23. Field print-out and plot control
NXPRIN=1;NYPRIN=1;NZPRIN=1
IF(NZ.GT.1) THEN
+  PATCH(CONZ,CONTUR,1,NX,1,NY,NZ/2+1,NZ/2+1,1,1)
+  PLOT (CONZ,P1,0.0,20.);PLOT (CONZ,TEM1,0.0,20.)
+  PLOT (CONZ,C1,0.0,20.)
+  PATCH(PRFZ,PROFIL,NX/2+1,NX/2+1,NY/2+1,NY/2+1,1,NZ,1,1)
+  PLOT (PRFZ,TEM1,100.0,1000.);PLOT (PRFZ,C1,-1.,1.)
ENDIF
IF(NX.GT.1) THEN
+  PATCH(PRFX,PROFIL,1,NX,NY/2+1,NY/2+1,NZ/2+1,NZ/2+1,1,1)
+  PLOT (PRFX,TEM1,100.0,1000.);PLOT (PRFX,C1,-1.,1.)
+  PATCH(CONX,CONTUR,NX/2+1,NX/2+1,1,NY,1,NZ,1,1)
+  PLOT (CONX,P1,0.0,20.)
+  PLOT (CONX,TEM1,0.0,20.);PLOT (CONX,C1,0.0,20.)
ENDIF
IF(NY.GT.1) THEN
+  PATCH(CONY,CONTUR,1,NX,NY/2+1,NY/2+1,1,NZ,1,1)
+  PLOT (CONY,P1,0.0,20.);PLOT (CONY,TEM1,0.0,20.)
+  PLOT (CONY,C1,0.0,20.)
+  PATCH(PRFY,PROFIL,NX/2+1,NX/2+1,1,NY,NZ/2+1,NZ/2+1,1,1)
+  PLOT (PRFY,TEM1,100.0,1000.);PLOT (PRFY,C1,-1.,1.)
ENDIF
    GROUP 24. Dumps for restarts