Page 331 - Introduction to Computational Fluid Dynamics
P. 331
P2: IWV
P1: ICD/GKJ
0 521 85326 5
May 25, 2005
11:59
0521853265appc
CB908/Date
310
APPENDIX C. 2D CARTESIAN CODE
Subroutine OMEGA In this routine, the user sets out solution of the mass transfer
equation(s) as well as the enthalpy equation by defining new variables O (I, J) and
HH (I, J). If the problem is unsteady then OO (I, J) and HHO (I, J) must also be
defined. If there are several mass fractions solved (as in a combustion problem),
then additional variable names must be defined and declared in the COM2D.FOR
file. For all these variables, subroutine COEF is first called. Then, source terms and
boundary conditions are specified for each variable with appropriate updates of Su
and Sp. Finally, the variable under consideration is solved by calling the SOLVE
routine. The USER file for the evaporation problem shows how this is done by
solving for the vapor mass fraction.
C.4 File LIB2D.FOR
Subroutine MAINPR This is the main routine from which all other routines are
called for program execution. The sequence of calling is important.
Subroutine INITIA Here, all variables are initialised.
Subroutine TAG In this routine node tagging is accomplished. The routine is
called from subroutine BSPEC in the USER2D.FOR file. CHAR1 and CHAR2
carry logical variables whereas IB, IL and JB, JL carry specification limits in the I
and J directions. Note that NTAG (I, J) = 1 for the blocked region; it is already set
to zero in routine INITIA otherwise.
Subroutine BOUND This routine implements the boundary conditions. The rou-
tine can be written more compactly. Here, boundary conditions for west, east, south,
and north are written explicitly for ease of understanding. Note that periodic bound-
aries are treated as inflow boundaries. Therefore, velocities at such boundaries must
be provided by the user in the ADSORB routine in the USER2D.FOR file. The
routine provides boundary conditions for only six variables: u, v, w, e, , and T .
For all other variables such as mass fractions or enthalpy, the boundary conditions
are given in the routine OMEGA in the USER2D.FOR file.
Subroutine GRID In this routine, node and/or cell-face coordinates are evaluated
depending on logical specifications GRCELL and GRNODE. Also, repeatedly used
incremental distances and cell volume are calculated and stored. The sum of cell
volumes must equal the domain volume. Hence, the latter is printed via SUMVOL.
The USER should always check SUMVOL in output file OO opened in PROGRAM
MAIN. Note that R (J) and RC (J) are set to 1 for the plane case but are equated to
Y (J) and YC (J), respectively, for the axisymmetric case.
Subroutine COEF In this routine, coefficients AE, AW, AN, and AS are calcu-
lated for transport equations and for the pressure-correction equation. Note that, in
evaluation of transport equation coefficients, the cell-face viscosities are evaluated