#immersol)                                                                      
#declare                                                                        
   IMMERSOL Wall, h1                                                            
            Radiative heat exchange in a participating media.                   
            IMMERSOL-WALL treatment.                                            
TEXT(IMMERSOL-WALL 1D for H1-T3.     :207                                       
TITLE                                                                           
  **************************************************************                
   PHOTON USE                                                                   
   AUTOPLOT                                                                     
   FILE                                                                         
   PHI 5                                                                        
                                                                                
   CL;DA 1 TMP1;DA 1 T3;COL3 1;BLB4 2;REDR                                      
   MSG    Temperature and T3 profiles.                                          
   ENDUSE                                                                       
  **************************************************************                
#direct                                                                         
#temps                                                                          
MESG(  ENTER optical thickness Kr*Wg (default 1.):                              
READVDU(OPTHI,REAL,1.0)                                                         
WGAP = 1.0;  KGAS= 0.0                                                          
KROSS= OPTHI/WGAP;  SCATT= 0.0;  EMISS= KROSS-SCATT                             
QCNV = KGAS/WGAP*(THOT-TCLD)                                                    
QRAD= SIGMA*(THOT**4-TCLD**4)                                                   
NNH  = KGAS*KROSS/(4.*SIGMA*THOT**3)                                            
NNC  = KGAS*KROSS/(4.*SIGMA*TCLD**3)                                            
AEMISH= (1./EMISH-0.5)/(1.+0.75*NNH)                                            
AEMISC= (1./EMISC-0.5)/(1.+0.75*NNC)                                            
QRAD = (QRAD + QCNV*0.75*OPTHI)/(0.75*OPTHI + AEMISH + AEMISC)                  
QRAD                                                                            
TGH=(THOT**4-QRAD/SIGMA*AEMISH)**.25                                            
TGH                                                                             
TGC=(TCLD**4+QRAD/SIGMA*AEMISC)**.25                                            
TGC                                                                             
SOLVE(H1)                                                                       
#geom2                                                                          
#radflux                                                                        
TERMS(H1,N,N,Y,N,Y,N)                                                           
    *** Set diffusivities for H1 and T3 (i.e. PRNDTL() must be                  
        set to -Value). NOTE! value of diffusivity for T3 in a gas              
        is not important (correct value is calculated by EARTH);                
PRNDTL(H1)= -KGAS;                                                              
CP1     = 1.005000E+03 
    *** Define enthalpy-temperature link:                                       
TMP1= LINH;  TMP1B= 1./CP1                                                      
INIADD= F; FIINIT(T3)=0.5*(THOT+TCLD)                                           
FIINIT(H1)= CP1*FIINIT(T3)                                                      
FIINIT(EMIS)= EMISS; FIINIT(SCAT)= SCATT                                        
RELAX(H1,LINRLX,0.5)                                                            
                                                                                
                                                           
    *** IMMERSOL-WALL settings (CO=GRND4 for T3; VAL=GRND4 for H1):             
        NOTE! Coefficient for H1 must be set as for standard                    
        wall-patch, i.e. it might be GRND2 for turbulent flows.                 
SPEDAT(SET,EMISSIVITY,OF IMSWL1,R,:EMISH:)                                      
SPEDAT(SET,EMISSIVITY,OF IMSWL2,R,:EMISC:)                                      
 COVAL(IMSWL1,T3,GRND4,THOT); COVAL(IMSWL2,T3,GRND4,TCLD)                       
 COVAL(IMSWL1,H1,1.0,GRND4);  COVAL(IMSWL2,H1,1.0,GRND4)                        
LSWEEP= 200; SELREF=F; RESREF(T3)= 1.E-3                                        
IXMON=NX/2+1;IYMON=NY/2+1;IZMON=NZ/2+1;                                         
NXPRIN=1; NYPRIN=1; NZPRIN=1                                                    
OUTPUT(LTLS,N,N,N,N,N,N); OUTPUT(WDIS,N,N,N,N,N,N)                              

VARMAX(T3)=THOT;VARMIN(T3)=TCLD
STORE(TMP1,SPH1)
VARMAX(TMP1)=THOT;VARMIN(TMP1)=TCLD
  inform7begin
(stored var #3-1 is t3-tmp1)
(stored var #rs1 is resi(h1))
(stored var #rs3 is resi(t3))
(stored var #ap1 is apco(h1))
(stored var #ap3 is apco(t3))
if(idir.eq.1) then
(stored var #ae1 is aeco(h1))
(stored var #ae3 is aeco(t3))
endif 
if(idir.eq.2) then
(stored var #an1 is anco(h1))
(stored var #an3 is anco(t3))
endif 
if(idir.eq.3) then
(stored var #ah1 is ahco(h1))
(stored var #ah3 is ahco(t3))
endif 
  inform7end