Page 309 - Introduction to Computational Fluid Dynamics
P. 309
P1: ICD
15:43
CB908/Date
0 521 85326 5
0521853265appb
May 11, 2005
288
APPENDIX B. 1D CONDUCTION CODE
−4
than 10 , the inner loop is exited; otherwise a further iteration is carried out by
returning to “1000 ITER = ITER + 1.” In a steady-state problem, a minimum of
two iterations are performed. If the problem is steady, there is no need to carry out
calculations at a new time step and, therefore, the outer loop is also now exited and
control is transferred to statement “5000 CONTINUE.” If the problem is unsteady,
subroutines UPDATE and INTPRI are called and the outer loop continues.
Subroutine GRID In this routine, depending on logical XCELL or XNODE, co-
ordinates XCF or X are set and area, perimeter, and cell volume are calculated and
printed. It is always desirable to check these specifications in the output file OO
(see PROGRAM ONED).
Subroutine COEF In this routine, coefficients AE and AW are evaluated. Note
that cell-face conductivities are evaluated by harmonic mean.
Subroutine BOUND This routine implements specified boundary conditions at
I = 1 and I = N. The implementation is carried out by updating Su and Sp at
near-boundary nodes as explained in Chapter 2.
Subroutine SOLVE In this routine, Su and Sp are further updated if the problem
is unsteady. Also, if the stability criterion is violated, a warning message is printed.
AP and Su are further augmented to take account of the underrelaxation factor.
Thus, all coefficients are ready to solve the discretised equations. This is done by
GS or by TDMA depending on the user choice specified in the BLOCK DATA
routine.
Subroutine UPDATE This routine sets all new variables to their “OLD”
counterparts.
Subroutine PRINT The arguments of this general routine carry the variable F and
its logical name “HEADER” specified from point-of-call. The routine is written
to print six variables on a line. If N > 6, the next six variables are printed on the
next line, and so on. The values are printed in E-format but the user may change to
F-format, if desired.
COMMON BLOCK COM1D.FOR
C *** THIS IS COMMON BLOCK FOR 1-D CONDUCTION PROGRAM
PARAMETER(IT=50,PI=3.1415927,SMALL=1E-30,GREAT=1E30)
LOGICAL T1SPEC,H1SPEC,Q1SPEC,TNSPEC,HNSPEC,QNSPEC
LOGICAL STEADY,UNSTEADY,GAUSS,THOMAS,XCELL,XNODE
COMMON/BOUNDS/T1SPEC,H1SPEC,Q1SPEC,TNSPEC,HNSPEC,QNSPEC
COMMON/STATE/STEADY,UNSTEADY,GAUSS,THOMAS,XCELL,XNODE
COMMON/CVAR/T(IT),TO(IT),SPH(IT),COND(IT),RHO(IT)
COMMON/COORDS/X(IT),XCF(IT),ACF(IT),PERIM(IT),VOL(IT),AL
COMMON/COEFF/AP(IT),AE(IT),AW(IT),SU(IT),SP(IT),STAB(IT)
COMMON/CONTRO/ITERMX,N,RP,RSU,FCMX,CC,ISTOP