#immersol
#declare
  **************************************************************
  PHOTON USE
   p ; ; ; ; ;
 
   msg Computational Domain:
   gr x 1
   use patgeo
   msg Press Any Key to Continue...
   pause
   cl
   set vec av off
   gr x 1
   msg Velocity Vectors:
   vec i 1 sh
   msg Press Any Key to Continue...
   pause
   cl;gr ou x 1
   msg Contours of Gas  and Solid Temperature Tem1:
   con tem1 i 1 fi;0.005
   pause
   cl;gr ou x 1
   msg Contours of Radiation Temperature T3:
   con t3 i 1 fi;0.005
   pause
   cl;gr ou x 1
   msg Contours of y-direction Radiation flux QRZ:
   con qry i 1 fi;0.005
   pause
   cl;gr ou x 1
   msg Contours of z-direction Radiation flux QRZ:
   con qrz i 1 fi;0.005
   pause
   cl;gr ou x 1
   msg Contours of Pressure:
   con p1 i 1 fi;0.005
   pause
   msg Press E  to exit PHOTON ...
  ENDUSE
  **************************************************************
#cls
  DISPLAY
  A gas stream enter steadily into a 2D thick-walled channel, the
  outer surfaces of which are held at different temperatures.
 
  A solid block within the vessel takes up an intermediate
  temperature, under the influences of convection and radiation,
  in which the gas participates.
 
  The task is to determine the temperature distribution in the block.
 
  Values which it may be interesting to vary are:
  * gas absorptivity/emissivity coefficient:  EMISS
  * gas scattering coefficient             :  SCATT
  * emissivities of north wall, south wall and block:
                            EMIS_N , EMIS_S and EMIS_C
  * their material indices: MAT_N , MAT_S and MAT_C
  * their temperatures    : TEM_N , TEM_S and TEM_C
 
  ENDDIS
#pause
TEXT(2D TEM1 + T3, Participating gas
TITLE
  ** declarations not already in macro declare
REAL(EMIS_N, EMIS_S, EMIS_B, VEL_IN, TEM_IN,TEM_S, TEM_N)
REAL(MAT_N, MAT_S, MAT_B)
  ** data settings
SIZZ = 0.1;   SIZY= 0.02;  TEM_IN= 500.;  TEM_S= 300. ;TEM_N=400.
EMISS= 1.0;   SCATT= 0.0
EMIS_N= 0.9;    EMIS_S= 0.8; EMIS_B  = 0.7
  ** solids consist of poorly-conducting epoxy resin
MAT_N=104 ; MAT_S=104; MAT_B = 104
VEL_IN  = 1.0
VEL_IN  = 0.1
    GROUP 4. Y-direction grid specification
GRDPWR(Y,48,SIZY,1.0)
    GROUP 5. Z-direction grid specification
GRDPWR(Z,24,SIZZ,1.0)
    GROUP 7. Variables stored, solved & named
SOLVE(P1,V1,W1,T3,TEM1)    
SOLUTN(  P1,Y,Y,Y,P,P,P); SOLUTN(  V1,Y,Y,Y,P,P,P)
SOLUTN(  W1,Y,Y,Y,P,P,P)
SOLUTN(T3,Y,Y,Y,P,P,P); SOLUTN(TEM1,Y,Y,Y,P,P,P)
STORE(PRPS,EMIS,SCAT,QRY,QRZ,KOND)

    GROUP 8. Terms (in differential equations) & devices
TERMS(TEM1,N,Y,Y,N,Y,N)
    GROUP 9. Properties of the medium (or media)
    
    GROUP 11. Initialization of variable or porosity fields
INIADD= F;  FIINIT(TEM1)= TEM_IN;  FIINIT(PRPS)= 0.0
FIINIT(EMIS)=EMISS; FIINIT(SCAT)=SCATT
    
    *** Solid walls:
PATCH(SOUTH,INIVAL,1,NX,1,NY/6,1,NZ,1,LSTEP)
INIT(SOUTH,PRPS,0.0,MAT_S); INIT(SOUTH,EMIS,0.0,EMIS_S)

PATCH(NORTH,INIVAL,1,NX,5*NY/6+1,NY,1,NZ,1,LSTEP)
INIT(NORTH,PRPS,0.0,MAT_N); INIT(NORTH,EMIS,0.0,EMIS_N)
    
    *** Solid block
PATCH(BLK,INIVAL,1,NX,NY/3+1,2*NY/3,NZ/4+1,3*NZ/4,1,LSTEP)
INIT(BLK,PRPS,0.0,MAT_B); INIT(BLK ,EMIS,0.0,EMIS_B)
 
    GROUP 13. Boundary conditions and special sources
    *** Inlet:
PATCH(INLET,LOW,1,NX,1,ny,1,1,1,LSTEP)
 COVAL(INLET,P1,FIXFLU,VEL_IN); COVAL(INLET,TEM1,ONLYMS,TEM_IN)
 COVAL(INLET,W1,ONLYMS,VEL_IN)
 
    *** Outlet:
PATCH(OUTLET,HIGH,1,NX,1,NY,NZ,NZ,1,LSTEP)
COVAL(OUTLET,P1,FIXP,0.0)
 
    *** Cold plates
PATCH(NORTHWAL,CELL,1,NX, 1, 1,1,NZ,1,LSTEP)
COVAL(NORTHWAL,TEM1,1.e5,TEM_N)

PATCH(SOUTHWAL,CELL,1,NX,NY,NY,1,NZ,1,LSTEP)
COVAL(SOUTHWAL,TEM1,1.e5,TEM_S)
 
    GROUP 15. Termination of sweeps
LSWEEP= 300;  TSTSWP= -1
    GROUP 16. Termination of iterations
SELREF=T; RESFAC= 0.0001
  RELAX(TEM1,LINRLX,0.5); RELAX(T3,LINRLX,0.5)
 
    GROUP 22. Spot-value print-out
OUTPUT(LTLS,N,N,N,N,N,N); OUTPUT(WDIS,N,N,N,N,N,N)
IXMON= NX/2+1;  IYMON= NY/2+1;  IZMON= NZ/2+1
  ** line-printer output to show differences between TEM1 and T3
PATCH(HALF_Z,PROFIL,1,1,1,NY,NZ/2,NZ/2,1,1)
COVAL(HALF_Z,TEM1,0,0); COVAL(HALF_Z,T3,0,0)
PATCH(S_SPACE,PROFIL,1,1,NY/4,NY/4,1,NZ,1,1)
COVAL(S_SPACE,TEM1,0,0); COVAL(S_SPACE,T3,0,0)
IPROF=3
  inform7begin
(stored var #3-1 is t3-tem1)
(stored var #rs1 is resi(tem1))
(stored var #rs3 is resi(t3))
(stored var #ap1 is apco(tem1))
(stored var #ap3 is apco(t3))
(stored var #an1 is anco(tem1))
(stored var #an3 is anco(t3))
(stored var #ah1 is ahco(tem1))
(stored var #ah3 is ahco(t3))
  inform7end
STOP