PHOTON USE
  p
  flow;;;;
 
  gr ou y 1
  msg the solid regions, displayed via the prl values
  con prl y 1 fi;0.1;pause
  msg the velocity vectors
  vec y 1;pause;vec off;con off;red
  msg temperature contours
  con temp y 1 fi;0.01
  enduse
    GROUP 1. Run title and other preliminaries
TEXT(Conjugate Heat Transf In Air Flow 
  DISPLAY
   The following cases concern the calculation of the temperature
   field within and around several metal plates and blocks, over
   which and around which air is flowing. The conductivity of the
   metal is supplied by the field named PRL, the information for
   is transferred to EARTH via the GREX-called subroutine GXPRL.
   
   The geometry and flow are depicted diagramatically below:
    ____________________________________________________________
    |             Zero Pressure OUTLET3            ^            |
    |----->                                      NX5 cells      |
    |                                            1.0m           |
    |                                              |       Zero |
    |----->                             <--0.2m--> |       Pressure
    |                                   _________  v       OUTLET1
    |Air                                |BLOCK 2 | ^            |
    |INLET1                             |NZ6+NZ7 | 0.2m NX4     |
    |(WIN,T1IN)       __________________|_cells__| v    cells   |
    |----->     ^0.05m|  | P L A T E 2        |  |              |
    |           v NX3 |P |____________________|P |              |
    |           ^     |l |                    |l |              |
    |----->    1.0 m  |a |                    |a |              |
    |          NX1+NX2|t |      <-1.0m->      |t |              |
    |          cells  |e |      ________      |e |              |
    |           |     |  | ^  ^ |BLOCK1| ^    |  |              |
    |           |     |1 | |  | |NZ4   |0.5m  |3 |              |
    |_adiabatic_v_____|__|_|__|_|NX1___|_v____|__|___adiabatic__|
                           Air          Zero
                  (UIN,T2IN) INLET2       Pressure OUTLET2
                      
                      NZ2 cells                NZ7 cells
    <----2.0m--------><  ><----- 2.0 m ------><  ><----2.0 m --->
         NZ1 cells   0.05m  NZ3+NZ4+NZ5+NZ6   0.05m    NZ8 cells
                                cells
 
        _
    ^   /|
    |  y (1.0m)
    x /
    |/
     -- z -->
 
   Solution for the air-flow is performed first in isolation from
   the heat-transfer problem: all of the different heat-transfer
   cases are based upon this flow-field. The flow-field, once
   obtained, is frozen, and the heat-transfer problem is solved.
 
   Users might find it instructive to try varying the inlet
   velocities, and thereby vary the amount of cooling or heating of
   the plates and blocks by the air. In particular, reduction of UIN
   will cause BLOCK1 to become much hotter. Similarly, the strength
   of the heat sources, their location, and the conductivities,
   heat capacities and densities of the plates can be adjusted
   to produce rather different problems. Imperfect contact between
   the plates and blocks might be simulated by introducing the
   relevant surface porosities with values less than one in
   appropriate places.
  ENDDIS
 
   Symbols:
   CPAIR and CPMET are the specific heats of the metal and air,
   WIN and UIN are the inlet velocities at the inlets parallel
   to the z- and x-axes,
   T1IN and T2IN are the temperatures of the air at the two inlets,
   ENLAIR is the laminar viscosity of the air,
   RHOAIR is the density of the air,
 
REAL(CPAIR,CPMET,WIN,UIN,T1IN,T2IN,ENLAIR,RHOAIR,COND1,COND2)
REAL(PRTAIR)
   **Physical parameters
RHOAIR=1.0; ENLAIR=2.0E-5; PRTAIR=0.7; CPAIR=1.0E3; CPMET=4.6E2
   **Boundary condition parameters
WIN=5.0; T1IN=20.0; UIN=1.0; T2IN=50.0
   **Grid parameters
INTEGER(NX1,NX2,NX3,NX4,NX5,NX6)
INTEGER(NZ1,NZ2,NZ3,NZ4,NZ5,NZ6,NZ7,NZ8)
INTEGER(NXW,NXE,NZL,NZH,NXZ)
NX1=5; NX2=5; NX3=3; NX4=3; NX5=10
NZ1=10; NZ2=3; NZ3=4; NZ4=4; NZ5=2; NZ6=2; NZ7=3; NZ8=10
 
    GROUP 3. X-direction grid specification
NREGX=5
IREGX=1; GRDPWR(X,NX1,0.5,1.0)
IREGX=2; GRDPWR(X,NX2,0.5,1.0)
IREGX=3; GRDPWR(X,NX3,0.05,1.0)
IREGX=4; GRDPWR(X,NX4,0.2,1.0)
IREGX=5; GRDPWR(X,NX5,1.0,1.0)
 
    GROUP 5. Z-direction grid specification
NREGZ=8
IREGZ=1; GRDPWR(Z,NZ1,2.0,1.0)
IREGZ=2; GRDPWR(Z,NZ2,0.05,1.0)
IREGZ=3; GRDPWR(Z,NZ3,0.67,1.0)
IREGZ=4; GRDPWR(Z,NZ4,0.67,1.0)
IREGZ=5; GRDPWR(Z,NZ5,0.33,1.0)
IREGZ=6; GRDPWR(Z,NZ6,0.33,1.0)
IREGZ=7; GRDPWR(Z,NZ7,0.05,1.0)
IREGZ=8; GRDPWR(Z,NZ8,2.0,1.0)
 
 
    GROUP 7. Variables stored, solved & named
SOLVE(U1,W1,P1,H1); NAME(H1)=TEMP
SOLUTN(P1,Y,Y,Y,N,N,N)
SOLUTN(TEMP,Y,N,N,N,N,N)
STORE(BLOK,PRL)
 
    GROUP 8. Terms (in differential equations) & devices
TERMS(TEMP,N,Y,Y,P,P,P)
 
    GROUP 9. Properties of the medium (or media)
ENUL=ENLAIR; RHO1=RHOAIR; ENUT=50.0*ENLAIR
   **The following statement activates the GREX call to the
     subroutine GXPRL which transfers the conductivity field
     (PRL) data to EARTH.
PRNDTL(TEMP)=-GRND1
 
    GROUP 11. Initialization of variable or porosity fields
INIADD=F
FIINIT(P1)=0.0; FIINIT(U1)=0.0; FIINIT(W1)=WIN
FIINIT(TEMP)=T1IN
   **The following statements set the conductivity field PRL
     in the air, in the plates and in the blocks. The BLOK
     field is initialized to define the zones over which
     zonal block-corrections are activated.
FIINIT(PRL)=ENLAIR/PRTAIR; FIINIT(BLOK)=1.0
 
   **Plate 1
PATCH(plte1,INIVAL,#1,#3,1,NY,#2,#2,1,LSTEP)
INIT(plte1,PRL,0.0,40.0/(CPAIR*RHOAIR))
INIT(plte1,BLOK,0.0,2.0)
 
   **plte 2
PATCH(plte2,INIVAL,#3,#3,1,NY,#3,#6,1,LSTEP)
INIT(plte2,PRL,0.0,40.0/(CPAIR*RHOAIR))
INIT(plte2,BLOK,0.0,2.0)
 
   **Plate 3
PATCH(plte3,INIVAL,#1,#3,1,NY,#7,#7,1,LSTEP)
INIT(plte3,PRL,0.0,1.0/(CPAIR*RHOAIR))
INIT(plte3,BLOK,0.0,2.0)
 
   **Inner air
PATCH(INAIR,INIVAL,#1,#2,1,NY,#3,#6,1,LSTEP)
INIT(INAIR,BLOK,0.0,4.0)
 
   **Block 1
PATCH(BLOCK1,INIVAL,#1,#1,1,NY,#4,#4,1,LSTEP)
INIT(BLOCK1,PRL,0.0,40.0/(CPAIR*RHOAIR))
INIT(BLOCK1,BLOK,0.0,3.0)
 
   **Block 2
PATCH(BLOCK2,INIVAL,#4,#4,1,NY,#6,#7,1,LSTEP)
INIT(BLOCK2,PRL,0.0,40.0/(CPAIR*RHOAIR))
INIT(BLOCK2,BLOK,0.0,5.0)
 
    GROUP 13. Boundary conditions and special sources
   **Inlet 1
INLET(INLET1,LOW,#1,#NREGX,1,NY,#1,#1,1,LSTEP)
VALUE(INLET1,P1,RHOAIR*WIN)
VALUE(INLET1,W1,WIN)
VALUE(INLET1,TEMP,T1IN)
 
   **Inlet 2
INLET(INLET2,WEST,#1,#1,1,NY,#3,#3,1,LSTEP)
VALUE(INLET2,P1,RHOAIR*UIN)
VALUE(INLET2,U1,UIN)
VALUE(INLET2,TEMP,T2IN)
 
   **Outlet 1
OUTLET(OUTLET1,HIGH,#1,#NREGX,1,NY,#NREGZ,#NREGZ,1,LSTEP)
COVAL(OUTLET1,TEMP,ONLYMS,SAME)
 
   **Outlet 2
OUTLET(OUTLET2,WEST,#1,#1,1,NY,#5,#6,1,LSTEP)
COVAL(OUTLET2,TEMP,ONLYMS,SAME)
 
   **Outlet 3
OUTLET(OUTLET3,EAST,#NREGX,#NREGX,NY,NY,2,NZ-1,1,LSTEP)
COVAL(OUTLET3,TEMP,ONLYMS,SAME)
 
   **Fix velocities in blocked regions
   **Plate 1
PATCH(PLT1W1,CELL,#1,#3,1,NY,%1,%2,1,LSTEP)
COVAL(PLT1W1,W1,FIXVAL,0.0)
PATCH(PLT1U1,CELL,#1,#3,1,NY,#2,#2,1,LSTEP)
COVAL(PLT1U1,U1,FIXVAL,0.0)
 
   **Plate 2
PATCH(PLT2W1,CELL,#3,#3,1,NY,#3,#6,1,LSTEP)
COVAL(PLT2W1,W1,FIXVAL,0.0)
PATCH(PLT2U1,CELL,%2,%3,1,NY,#3,#6,1,LSTEP)
COVAL(PLT2U1,U1,FIXVAL,0.0)
 
   **Plate 3
PATCH(PLT3U1,CELL,#1,#3,1,NY,#7,#7,1,LSTEP)
COVAL(PLT3U1,U1,FIXVAL,0.0)
PATCH(PLT3W1,CELL,#1,#3,1,NY,%6,%7,1,LSTEP)
COVAL(PLT3W1,W1,FIXVAL,0.0)
 
   **Block 1
PATCH(BLK1W1,CELL,#1,#1,1,NY,%3,%4,1,LSTEP)
COVAL(BLK1W1,W1,FIXVAL,0.0)
PATCH(BLK1U1,CELL,#1,#1,1,NY,#4,#4,1,LSTEP)
COVAL(BLK1U1,U1,FIXVAL,0.0)
 
   **Block 2
PATCH(BLK2W1,CELL,#4,#4,1,NY,%5,%7,1,LSTEP)
COVAL(BLK2W1,W1,FIXVAL,0.0)
PATCH(BLK2U1,CELL,#4,#4,1,NY,#6,#7,1,LSTEP)
COVAL(BLK2U1,U1,FIXVAL,0.0)
 
   **Heat Source of 1000 Watts in centre of right face
     of plate 1.
NXW=(NX1+NX2+NX3)/2; NXE=NXW; NZL=NZ1+NZ2; NZH=NZL
PATCH(HEATSOR,CELL,NXW,NXE,1,NY,NZL,NZH,1,LSTEP)
COVAL(HEATSOR,TEMP,FIXFLU,1000.0/CPAIR)
 
   **Case 1, fix temperature in BLOCK 1 to 100 C.
PATCH(FIXTEMP,CELL,#1,#1,1,NY,#4,#4,1,LSTEP)
COVAL(FIXTEMP,TEMP,1.0,100.0)
 
    GROUP 15. Termination of sweeps
LSWEEP=100; resfac=0.01
 
    GROUP 17. Under-relaxation devices
   **PATCH-wise under-relaxation of the velocities is used
     because the typical velocities of the air outside of
     the cavity and of that inside the cavity can be very
     different. Some of the most interesting variants of
     the base set of cases are generated by reducing UIN
     substantially.
PATCH(VELUR1,PHASEM,#1,#5,1,1,#1,#1,1,LSTEP)
COVAL(VELUR1,U1,WIN*NX,SAME); COVAL(VELUR1,W1,WIN*NZ,SAME)
 
PATCH(VELUR2,PHASEM,#4,#5,1,1,#2,#7,1,LSTEP)
COVAL(VELUR2,U1,WIN*NX,SAME); COVAL(VELUR2,W1,WIN*NZ,SAME)
 
PATCH(VELUR3,PHASEM,#1,#5,1,1,#8,#NREGZ,1,LSTEP)
COVAL(VELUR3,U1,WIN*NX,SAME); COVAL(VELUR3,W1,WIN*NZ,SAME)
 
PATCH(VELUR4,PHASEM,#1,#2,1,1,#3,#6,1,LSTEP)
COVAL(VELUR4,U1,(UIN+0.001)*NX/2.,SAME)
COVAL(VELUR4,W1,(UIN+0.001)*(NZ3+NZ4+NZ5+NZ6),SAME)
 
    GROUP 22. Spot-value print-out
IXMON=1; IZMON=22; TSTSWP=-1
 
    GROUP 24. Preparations for continuation runs.
NSAVE=FLOW