#immersol
#declare
#cls
  DISPLAY
  Hot air flows steadily through a box having two cooled walls.
 
  A centrally-placed metal block takes up an intermediate
  temperature, under the influences of conduction, convection and
  radiation.
  
  Values which it may be interesting to vary are:
  * gas absorptivity/emissivity coefficient:  EMISS
  * gas scattering coefficient             :  SCAT
  * hot-wall emissivity                    :  EMISH
  * cold-wall emissivity                   :  EMISC
  * block emissivity                       :  EMISB
  
  **************************************************************
  ENDDIS
#pause
    PHOTON USE
   p;;;;;
 
   view 2 1 1
   msg Computational Domain:
   gr k 1
   use patgeo
   pause;cl
   set vec av off
   msg tem1 contours
   do kk = 1, 10
   con tem1 k kk  fi;0.001
   enddo
   pause;cl
   msg t3 contours
   do kk = 1, 10
   con t3 k kk  fi;0.001
   enddo
   pause;cl
   msg qrz contours
   do kk = 1, 10
   con qrz k kk  fi;0.001
   enddo
   msg Press E  to exit PHOTON ...
  ENDUSE
 
  **************************************************************
TEXT(3D TEM1 + T3, Participating ideal gas :205
TITLE
SIZX = 1.85;  SIZY= 5.5;  SIZZ= 8.2;  THOT= 1500.;  TCLD= 300.
EMISS= 0.5;   SCATT= 0.5;  EMISH= 0.9;  EMISC= 0.8 ; EMISB=0.7
UIN  = 1.0
    GROUP 3,4,4 grid specification
nx=12; xulast=sizx; ny=12; yvlast=sizy;  nz=10; zwlast=sizz
#unigrid
 
    GROUP 7. Variables stored, solved & named
SOLVE(P1,U1,V1,W1,TEM1); STORE(PRPS)
 SOLUTN(P1,Y,Y,Y,P,P,P);  SOLUTN(TEM1,Y,Y,Y,P,P,P)
 SOLUTN(T3,Y,Y,Y,P,P,P)
#radflux
    GROUP 8. Terms (in differential equations) & devices
TERMS(TEM1,Y,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)= 2.*TCLD;  FIINIT(PRPS)= 0.0
    *** Solid walls:
PATCH(SOL1,INIVAL,1,NX,1,1,2,NZ-1,1,LSTEP);INIT(SOL1,PRPS,0.0,111.)
PATCH(SOL2,INIVAL,NX,NX,2,6,2,NZ-1,1,LSTEP);INIT(SOL2,PRPS,0.0,111.)
PATCH(SOL3,INIVAL, 1, 1,2,3,2,NZ-1,1,LSTEP);INIT(SOL3,PRPS,0.0,111.)
PATCH(SOL4,INIVAL,1,NX,NY,NY,2,NZ-1,1,LSTEP)
INIT(SOL4,PRPS,0.0,112.)
PATCH(SOL5,INIVAL,NX,NX,NY-2,NY-1,2,NZ-1,1,LSTEP)
 INIT(SOL5,PRPS,0.0,112.)
PATCH(SOL6,INIVAL, 1 ,1,NY-2,NY-1,2,NZ-1,1,LSTEP)
 INIT(SOL6,PRPS,0.0,112.)
PATCH(SOL7,INIVAL, 1, 1,NY/2,NY/2+1,2,NZ-1,1,LSTEP)
 INIT(SOL7,PRPS,0.0,112.)
PATCH(SOL8,INIVAL,1,NX,1,NY,1,1,1,LSTEP);INIT(SOL8,PRPS,0.0,112.)
PATCH(SOL9,INIVAL,1,NX,1,NY,NZ,NZ,1,LSTEP);INIT(SOL9,PRPS,0.0,112.)
    *** Solid in the middle:
PATCH(BLK,INIVAL,NX/2-1,NX/2+1,NY/2-1,NY/2+1,NZ/2-1,NZ/2+1,1,LSTEP)
INIT(BLK,PRPS,0.0,111.)
  
  Set values via whole-field stored arrays
STORE(EMIS,SCAT)
FIINIT(EMIS)=EMISS
FIINIT(SCAT)=SCATT
INIT(SOL1,EMIS,0.0,EMISH)
INIT(SOL2,EMIS,0.0,EMISH)
INIT(SOL3,EMIS,0.0,EMISH)
INIT(SOL4,EMIS,0.0,EMISC)
INIT(SOL5,EMIS,0.0,EMISC)
INIT(SOL6,EMIS,0.0,EMISC)
INIT(SOL7,EMIS,0.0,EMISC)
INIT(SOL8,EMIS,0.0,EMISC)
INIT(SOL9,EMIS,0.0,EMISC)
INIT(BLK ,EMIS,0.0,EMISB)
  
  
  Not in use. Setting emissivity via property values is not advised
  SPEDAT(SET,EMISSIVITY,111,R,:EMISH:)
  SPEDAT(SET,EMISSIVITY,112,R,:EMISC:)
 
    GROUP 13. Boundary conditions and special sources
    *** Inlets:
PATCH(IN1,WEST, 1, 1,8,9,2,NZ-1,1,LSTEP)
COVAL(IN1,P1,FIXFLU,UIN); COVAL(IN1,TEM1,ONLYMS,THOT)
COVAL(IN1,U1,ONLYMS,UIN); COVAL(IN1,  V1,ONLYMS, 0.0)
COVAL(IN1,W1,ONLYMS,0.0)
 
PATCH(IN2,EAST,NX,NX,7,9,2,NZ-1,1,LSTEP)
COVAL(IN2,P1,FIXFLU, UIN); COVAL(IN2,TEM1,ONLYMS,THOT)
COVAL(IN2,U1,ONLYMS,-UIN); COVAL(IN2,  V1,ONLYMS, 0.0)
COVAL(IN2,W1,ONLYMS,0.0)
    *** Outlet:
PATCH(OUT,WEST, 1, 1,4,5,2,NZ-1,1,LSTEP)
COVAL(OUT,P1,300.,0.0)
    *** Cold plates
PATCH(COLD1,CELL,1,NX, 1, 1,1,NZ,1,LSTEP)
COVAL(COLD1,TEM1,FIXVAL,TCLD)
PATCH(COLD2,CELL,1,NX,NY,NY,1,NZ,1,LSTEP)
COVAL(COLD2,TEM1,FIXVAL,TCLD)
    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;
                               
VARMAX(T3)=THOT;VARMIN(T3)=TCLD
VARMAX(TEM1)=THOT;VARMIN(TEM1)=TCLD