Page 333 - Introduction to Computational Fluid Dynamics
P. 333
P2: IWV
P1: ICD/GKJ
0 521 85326 5
11:59
May 25, 2005
0521853265appc
CB908/Date
312
APPENDIX C. 2D CARTESIAN CODE
at the periodic boundaries. When BSOR (9) is .TRUE., fixed-pressure conditions
are given in the ADSORB routine of the USER2D.FOR file.
Subroutine INDATA This routine simply writes out input data given in BLOCK
DATA in the OO file for verification.
Subroutine SOLVE This routine solves the discretised equations by the ADI
method. At the start of this routine (i.e., at iteration level l) residuals are calcu-
lated at each node and the root-sum-square value of residuals is stored in RSUM.
Subroutine SOLP This routine is the same as the SOLVE routine but is exclusively
used for the pressure-correction equation. Note that subroutine BOUNDP is called
at each sweep when a periodic boundary condition is specified.
Subroutine EQN In this routine the outer DO loop (2000) is initiated for an
unsteady calculation and the inner loop (1000) carries out iterative calculations.
For each chosen variable (specified by logical SLVE), subroutines COEF, SORCE,
BOUND, APCOF, and SOLVE are called in turn. To carry out appropriate updates
of Su and Sp, UNST and ADSORB routines are also called. When all relevant
variables are covered, subroutine PROPS is called to update the properties. Then,
the maximum residual among all variables is stored in RSTOP. In a steady-state
problem, if the convergence criterion is satisfied, the inner loop is exited and control
is returned to the subroutine MAINPR. In an unsteady problem, upon exiting the
inner loop, subroutine UPDATE is called to reset the values and the STOP condition
is based on the maximum value of FDIF. The outer loop is continued until the
maximum number of steps specified in BLOCK DATA is executed. At each time
step, however, the inner loop is executed for the MXIT number of iterations. In
many problems, because of the impossibility of specifying good initial guesses, the
number of iterations required may run into the thousands. For this reason, variables
are written out in file NSOUT at every MFREQ iteration, where MFREQ is set in
the BLOCK DATA routine. 2
Subroutine TDMA This routine calculates the recurrence coefficients and carries
out back substitution as required in TDMA execution.
Subroutine OPT In this routine, all variables are written out in binary form in file
NSOUT.
SubroutineIPT Inthisroutine,allvariablesarereadinbinaryformfromfileNSIN.
Therefore, before execution of the program in a continuation can commence, file
NSOUT must be copied to file NSIN.
Subroutines PRINTK This routine is used to print out 2D variables.
2 At every iteration, the three main residuals for u, v, and p are stored in arrays RESIU(NITER),
RESIV(NITER), and RESIM(NITER). Their evaluation has been commented on. However, the
USER may activate this evaluation to enable printing of residual history in the RESULT routine
when required.