PHOTON USE
  p ;;;;
 
  view -2 1 1
 
  g ou i 1;  g ou i m;  g ou j 1;  g ou j m
 
  msg pressure contours for mid-plane
  con p1  x  4  fill ;0.001;  pause
  msg temperature contours for mid-plane
  con tem1  x  4  fill;  0.001;pause
  msg with wall-distance contours for mid-plane
  con wdis  x  4  fill;  0.001;pause
  vec x 4;pause
  ENDUSE
    GROUP 1. Run title and other preliminaries
TEXT(PHOENICS-Letter Masking,     CHAM 
#cls 
TITLE
 
  DISPLAY
  A simple example of the letter-masking feature. The word CHAM will
  appear in the ZY plane as below. Flow goes from left to right;
  letters are held at contant temperature of 400 deg C
  ..................................................................
  ..................................................................
  ..................................................................
  ..............CCCC.....HH....HH.......AA.......M.....M............
  .............CCCCC.....HH....HH......AAAA......MM...MM............
  ............CCC........HH....HH.....AA..AA.....MMM.MMM............
  ............CC.........HH....HH.....AA..AA.....MMMMMMM............
  ............CC.........HHHHHHHH.....AAAAAA.....MM.M.MM............
  ............CCC........HH....HH.....AAAAAA.....MM...MM............
  .............CCCCC.....HH....HH.....AA..AA.....MM...MM............
  ..............CCCC.....HH....HH.....AA..AA.....MM...MM............
  ..................................................................
  ..................................................................
  ..................................................................
  ..................................................................
  ENDDIS
#pause  
    GROUP 3/4/5. X/Y/Z-direction grid specification
RSET(M,1,1,1,  0.11)
RSET(D,CHAM,2.00,2.00,6.00)
  *-------------- Provide refinement factors RFX, RFY, RFZ
INTEGER(RFX,RFY,RFZ)
  *----- setting factors to 1 means no refinement
RFX=1;RFY=1;RFZ=1
  *-------------- Set out domain grid dimensions
NX=7*RFX
NY=15*RFY
NZ=65*RFZ
RSET(M,NX,NY,NZ)
  *-------------- Define number of F-array cells needed for letters
                  and provide storage via the nfuser facility.
                  Note that X and Y refer to the horizontal and
                  vertical directions on the face of the letter, not
                  to the PHOENICS-coordinate system.
INTEGER(MBX,MBY,NUMLET)
                  Since the lettter-faces are set in the YX plane, 
                  by the %& below, MBX is multiplied by RFZ and MBY
                  by RFY  
MBX=9*RFZ; MBY=9*RFY; NUMLET=4
NFUSER=MBX*MBY*NUMLET
  *-------------- starting indices for the four letters   C, H, A & M
INTEGER(IXC,IYC,IZC, IXH,IYH,IZH)
INTEGER(IXA,IYA,IZA, IXM,IYM,IZM)
  *-------------- numbers of cellS in the four letters
INTEGER(NXC, NYC, NZC)  
INTEGER(NXH, NYH, NZH)  
INTEGER(NXA, NYA, NZA)  
INTEGER(NXM, NYM, NZM)  
IXC=2*RFX; IYC=3*RFY; IZC=10*RFZ  
IXH=2*RFX; IYH=3*RFY; IZH=22*RFZ  
IXA=2*RFX; IYA=3*RFY; IZA=34*RFZ  
IXM=2*RFX; IYM=3*RFY; IZM=46*RFZ 
NXC=3*RFX; NYC=9*RFY; NZC=9*RFZ 
NXh=3*RFX; NYh=9*RFY; NZh=9*RFZ 
NXA=3*RFX; NYA=9*RFY; NZA=9*RFZ 
NXM=3*RFX; NYM=9*RFY; NZM=9*RFZ 
    GROUP 7. Variables stored, solved & named
  *-------------- Set up solution controls
SOLVE(P1,TEM1,W1,V1,U1); SOLUTN(P1,Y,Y,Y,P,P,P)
SOLUTN(TEM1,Y,Y,Y,N,N,Y)
STORE(DEN1,PRPS)
  *------------ Switch on the L-VEL turbulence model
TURMOD(LVEL)
    GROUP 9. Properties of the medium (or media)
#use_props
TEMP0=273.0         ; PRESS0=1.00E+05
    GROUP 11. Initialization of variable or porosity fields
:fluid:=airideal ; FIINIT(TEM1)= 20.00
  *------------ Set up initial values and boundary patches:
                           Property value = 103 Copper
                           Fixed temperature = 400 deg C
                           %&C = C letter orientated in ZY plane
PATCH(Z%&C0001,INIVAL,IXC+1,IXC+NXC,IYC+1,IYC+NYC,IZC+1,IZC+NZC,1,1)
INIT(Z%&C0001,PRPS,0, 103)

                           %&H = H letter orientated in ZY plane
PATCH(Z%&H0002,INIVAL,IXH+1,IXH+NXH,IYH+1,IYH+NYH,IZH+1,IZH+NZH,1,1)
INIT(Z%&H0002,PRPS,0, 103)

                           %&A = A letter orientated in ZY plane
PATCH(Z%&A0003,INIVAL,IXA+1,IXA+NXA,IYA+1,IYA+NYA,IZA+1,IZA+NZA,1,1)
INIT(Z%&A0003,PRPS,0, 103)
                           
                           %&M = M letter orientated in ZY plane
PATCH(Z%&M0004,INIVAL,IXM+1,IXM+NXM,IYM+1,IYM+NYM,IZM+1,IZM+NZM,1,1)
INIT(Z%&M0004,PRPS,0, 103)
    
    GROUP 13. Boundary conditions and special sources
  
  *---- fix the temperatures of the letters  
PATCH(%&C0001 ,VOLUME, IXC+1,IXC+NXC,IYC+1,IYC+NYC,IZC+1,IZC+NZC,1,1)
COVAL(%&C0001 ,TEM1, 0.5*FIXVAL,   400.0)
                           %&H = H letter orientated in ZY plane
PATCH(%&H0002 ,VOLUME,IXH+1,IXH+NXH,IYH+1,IYH+NYH,IZH+1,IZH+NZH,1,1)
COVAL(%&H0002 ,TEM1, 0.5*FIXVAL,   400.0)
                           %&A = A letter orientated in ZY plane
PATCH(%&A0003 ,VOLUME,IXA+1,IXA+NXA,IYA+1,IYA+NYA,IZA+1,IZA+NZA,1,1)
COVAL(%&A0003 ,TEM1, 0.5*FIXVAL,   400.0)
                           %&M = M letter orientated in ZY plane
PATCH(%&M0004 ,VOLUME,IXM+1,IXM+NXM,IYM+1,IYM+NYM,IZM+1,IZM+NZM,1,1)
COVAL(%&M0004 ,TEM1, 0.5*FIXVAL,   400.0)

EGWF=T
  *------------ Buoyancy source
PATCH(BUOYANCY,PHASEM,1,NX,1,NY,1,NZ,1,1)
COVAL(BUOYANCY,V1,FIXFLU,DENSDIFF)
BUOYA=0.0; BUOYB=-9.81; BUOYC=0.0
  *------------ Reference density calculated from atmospheric p & T
REAL(GASCON); GASCON=287.0
BUOYD=PRESS0/(TEMP0+FIINIT(TEM1))/GASCON
  *------------ Set up inlet and outlet
INLET(INLET,LOW,1,NX,1,NY,1,1,1,1)
COVAL(INLET,P1,FIXFLU,   0.2973)
COVAL(INLET,W1,ONLYMS,   0.2500)
COVAL(INLET,TEM1,ONLYMS, 20.0)
PATCH(VENT,HIGH,1,NX,1,NY,NZ,NZ,1,1)
COVAL(VENT,P1,FIXP,0)
COVAL(VENT,TEM1,ONLYMS, 20.0)
  *------------ Set source terms for wall friction
                           ** 1. HIGH Y (NORTH) WALLS
PATCH(WALL_N,NWALL,1,NX,NY,NY,1,NZ,1,LSTEP)
COVAL(WALL_N,U1,LOGLAW,0.0)
COVAL(WALL_N,W1,LOGLAW,0.0)
                           ** 2. LOW Y (SOUTH) WALLS
PATCH(WALL_S,SWALL,1,NX,1,1,1,NZ,1,LSTEP)
COVAL(WALL_S,U1,LOGLAW,0.0)
COVAL(WALL_S,W1,LOGLAW,0.0)
                           ** 3. HIGH X (EAST) WALLS
PATCH(WALL_E,EWALL,NX,NX,1,NY,1,NZ,1,LSTEP)
COVAL(WALL_E,V1,LOGLAW,0.0)
COVAL(WALL_E,W1,LOGLAW,0.0)
                           ** 4. LOW X (WEST) WALLS
PATCH(WALL_W,WWALL,1,1,1,NY,1,NZ,1,LSTEP)
COVAL(WALL_W,V1,LOGLAW,0.0)
COVAL(WALL_W,W1,LOGLAW,0.0)
EGWF=T
    GROUP 15. Termination of sweeps
SELREF=T; RESFAC=1.E-6
LSWEEP=100
    GROUP 16. Termination of iterations
LITER(LTLS)=20
    GROUP 17. Under-relaxation devices
  *------------ Set values for relaxation
RELAX(P1,LINRLX,0.1); RELAX(U1,FALSDT,0.4)
RELAX(V1,FALSDT,0.4); RELAX(W1,FALSDT,0.4)
RELAX(TEM1,FALSDT,1.0)
    GROUP 22. Monitor print-out
  *------------ Monitor position offset from centre of the domain
IXMON=4; IYMON=8; IZMON=33
TSTSWP=-1