```

CASE 7  A 3D shell-and-tube heat-exchanger, similar
to that studied by S.V.Patankar and D.B.Spalding
in 1974 and reported in: "Heat-exchanger design
and theory sourcebook", edited by N.Afgan and
E.Schluender, Hemisphere, Washington, 1976,
which paper was probably the first to show how
the fluid dynamics of the shell-side fluid could
be included in a heat-exchanger simulation.

The heat exchanger considered is an imaginary one,
having two baffles within the shell and with the tubes
arranged if five passes. As the calculations show, the
design is not a good one; for it results in transfer of
heat in the wrong direction in some parts of the shell.

GROUP 1. Run title
TEXT(Case 7 3D Shell,Tube Heat Exchnger
TITLE
User-defined variables
T1IN = inlet temperature of shell fluid
T2IN = inlet temperature of tube fluid
FLO1 = mass-flow rate of shell fluid
FLO2 = mass-flow rate of tube fluid
COEF1 = heat-transfer coefficient on shell-fluid side
COEF2 = heat-transfer coefficient on tube-fluid side
COEF12 = overall heat-transfer coefficient from fluid 1
to fluid 2
RESCO = flow-resistance coefficient of the tube bank

REAL(T1IN,T2IN,FLO1,FLO2,COEF1,COEF2,COEF12)
T1IN=1.0;T2IN=0.0;FLO1=0.1;FLO2=0.1;COEF1=0.1;COEF2=0.4
COEF12=1.0/(1.0/COEF1+1.0/COEF2)
REAL(RESCO);RESCO=1.E2

GROUP 3. X-direction grid specification

The heat exchanger is a rectangular box, 1m high,
1m wide and 4m long. A uniform 5*3*8 grid is used,
as was done by Patankar and Spalding.

Only one half of the exchanger is included in the
calculation domain, because of the symmetry of the
geometry.

GRDPWR(X,5,1.0,1.0)
GROUP 4. Y-direction grid specification
GRDPWR(Y,3,0.5,1.0)
GROUP 5. Z-direction grid specification
GRDPWR(Z,8,4.0,1.0)

GROUP 7. Variables stored, solved , named

The shell-side fluid is a single-phase one, for which
five variables must be solved; only the enthalpy needs
be computed for the tube-side fluid.

SOLVE(P1,U1,V1,W1,H1,H2)
NAME(H1)=1STH;NAME(H2)=2NDH

STORE(EPOR,NPOR,HPOR)

GROUP 8. Terms (in differential equations) & devices

The "diffusion" terms are cut out for all variables, and
the built-in sources for the enthalpies.

TERMS(U1,Y,Y,N,Y,Y,Y);TERMS(V1,Y,Y,N,Y,Y,Y)
TERMS(W1,Y,Y,N,Y,Y,Y);TERMS(1STH,N,Y,N,Y,Y,Y)
TERMS(2NDH,N,N,N,Y,N,N)

GROUP 11. Initialization of variable or porosity fields
FIINIT(W1)=FLO1;FIINIT(U1)=0.0;FIINIT(V1)=0.0
FIINIT(1STH)=T1IN;FIINIT(2NDH)=T2IN
FIINIT(EPOR)=0.5;FIINIT(NPOR)=0.5;FIINIT(HPOR)=0.5

GROUP 13. Boundary conditions and special sources

West boundary; shell fluid inlet ; 2 cells in west wall
INLET(INLET1,CELL,1,1,2,3,2,2,1,1000)
VALUE(INLET1,P1,FLO1/2.0);VALUE(INLET1,1STH,T1IN)
VALUE(INLET1,2NDH,SAME)

East boundary; shell fluid outlet; 2 cells in east wall
PATCH(OUTLET1,EAST,NX,NX,2,3,NZ-1,NZ-1,1,1000)
COVAL(OUTLET1,P1,FIXP,0.0)

High boundary, tube fluid inlet; 5 cells in high wall
PATCH(INLET2,CELL,1,1,1,NY,NZ,NZ,1,1000)
COVAL(INLET2,2NDH,FLO2/3.0,T2IN)

Note how the giving of special names to patches,
beginning NE (for neighbour), coupled with LOCNE in the
"value" location, produces sources which simulate along-
the-tube convection fluid-to-metal heat transfer etc,
by activating special calls to GROUND, the relevant
extract from which appears in an appendix to this file.

Flow of tube fluid in first pass
PATCH(NEH1,CELL,1,1,1,NY,1,NZ-1,1,1000)
COVAL(NEH1,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in first bend
PATCH(NEW1,CELL,2,2,1,NY,1,1,1,1000)
COVAL(NEW1,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in second pass
PATCH(NEL1,CELL,2,2,1,NY,2,NZ,1,1000)
COVAL(NEL1,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in second bend
PATCH(NEW2,CELL,3,3,1,NY,NZ,NZ,1,1000)
COVAL(NEW2,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in third pass
PATCH(NEH2,CELL,3,3,1,NY,1,NZ-1,1,1000)
COVAL(NEH2,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in third bend
PATCH(NEW3,CELL,4,4,1,NY,1,1,1,1000)
COVAL(NEW3,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in fourth pass
PATCH(NEL2,CELL,4,4,1,NY,2,NZ,1,1000)
COVAL(NEL2,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in fourth bend
PATCH(NEW4,CELL,NX,NX,1,NY,NZ,NZ,1,1000)
COVAL(NEW4,2NDH,FLO2/3.0,LOCNE)

Flow of tube fluid in fifth pass
PATCH(NEH3,CELL,NX,NX,1,NY,1,NZ-1,1,1000)
COVAL(NEH3,2NDH,FLO2/3.0,LOCNE)

Heat-exchange with tube fluid, throughout the exchanger.
PATCH(NEPLUS,VOLUME,1,NX,1,NY,1,NZ,1,1000)
COVAL(NEPLUS,1STH,COEF12,LOCNE)

Heat-exchange with shell fluid, throughout the exchanger.
PATCH(NEMINUS,VOLUME,1,NX,1,NY,1,NZ,1,1000)
COVAL(NEMINUS,2NDH,COEF12,LOCNE)

Baffle 1 at NZ=3
PATCH(BAFFLE1,HIGH,1,NX-1,1,NY,3,3,1,1000)
COVAL(BAFFLE1,W1,FIXVAL,0.0)

Baffle 2 at NZ=5
PATCH(BAFFLE2,HIGH,2,NX,1,NY,5,5,1,1000)
COVAL(BAFFLE2,W1,FIXVAL,0.0)

Resistance to flow exerted by tubes, throughout the shell.
PATCH(RESIST,PHASEM,1,NX,1,NY,1,NZ,1,1000)
COVAL(RESIST,U1,RESCO,0.0);COVAL(RESIST,V1,RESCO,0.0)
COVAL(RESIST,W1,0.5*RESCO,0.0)

GROUP 15. Termination of sweeps
LSWEEP=50
GROUP 16. Termination of iterations
LITER(P1)=100
GROUP 17. Under-relaxation devices
RELAX(U1,FALSDT,1.0);RELAX(V1,FALSDT,1.0)
RELAX(W1,FALSDT,1.0)

GROUP 21. Print-out of variables
Print-out of porosities is suppressed.
OUTPUT(EPOR,N,N,N,N,N,N);OUTPUT(NPOR,N,N,N,N,N,N)
OUTPUT(HPOR,N,N,N,N,N,N)
OUTPUT(1STH,N,N,Y,Y,Y,Y);OUTPUT(2NDH,N,N,Y,Y,Y,Y)

GROUP 22. Spot-value print-out
IXMON=5;IYMON=5;TSTSWP=5
GROUP 23. Field print-out and plot control
IPLTL=LSWEEP;IPROF=1;ORSIZ=0.4;XZPR=T;NPLT=1

PATCH(PASS1,PROFIL,1,1,2,2,1,NZ,1,1000)
PLOT(PASS1,1STH,T2IN,T1IN);PLOT(PASS1,2NDH,T2IN,T1IN)

PATCH(PASS2,PROFIL,2,2,2,2,1,NZ,1,1000)
PLOT(PASS2,1STH,T2IN,T1IN);PLOT(PASS2,2NDH,T2IN,T1IN)

PATCH(PASS3,PROFIL,3,3,2,2,1,NZ,1,1000)
PLOT(PASS3,1STH,T2IN,T1IN);PLOT(PASS3,2NDH,T2IN,T1IN)

PATCH(PASS4,PROFIL,4,4,2,2,1,NZ,1,1000)
PLOT(PASS4,1STH,T2IN,T1IN);PLOT(PASS4,2NDH,T2IN,T1IN)

PATCH(PASS5,PROFIL,5,5,2,2,1,NZ,1,1000)
PLOT(PASS5,1STH,T2IN,T1IN);PLOT(PASS5,2NDH,T2IN,T1IN)

PATCH(TABMAP,CONTUR,1,NX,1,NY,4,4,1,1000)
PLOT(TABMAP,1STH,0.0,10.0);PLOT(TABMAP,2NDH,0.0,10.0)

PATCH(TABYEQ3,CONTUR,1,NX,3,3,1,NZ,1,1000)
PLOT(TABYEQ3,P1,0.0,10.0);PLOT(TABYEQ3,1STH,0.0,10.0)
PLOT(TABYEQ3,2NDH,0.0,10.0)
GROUP 24. Dumps for restarts
```