Page 308 - Introduction to Computational Fluid Dynamics
P. 308

P1: ICD
                            CB908/Date
                                         0 521 85326 5
                                                                                   May 11, 2005
            0521853265appb
                                                                                                    287
                        APPENDIX B. 1D CONDUCTION CODE
                        nonuniformity (if any) in the specified grid. When a nonuniform grid is specified,  15:43
                        it is advisable to ensure that the ratio of two consecutive cell sizes does not
                        exceed 2.
                        Subroutine INIT In this routine, an initial guess for T at ITER = 0 in a steady-
                        state problem or at t = 0 in an unsteady-state problem is given. In a steady-state
                        problem, the number of iterations (and hence the computer time) greatly depends
                        on how close the initial guess is to the final converged solution. In the fin prob-
                        lem (Problem 2, Chapter 2), a linear temperature profile is given with T 1 = 225
                        (given) and TN = 205 (which is guessed) although the converged solution is
                        nonlinear.
                        Subroutine NEWVAL In this routine, boundary conditions at a new time (if dif-
                        ferent from the initial time) are specified.
                        Subroutine PROPS In this routine, thermal conductivity and specific heat are
                        given. They may be functions of x, t, or T. The density is of course constant in our
                        formulation (see Chapter 2).

                        Subroutine SORCE A problem-dependent source (q  V ) is given in this routine.
                        It may be a function of T , x, and/or 	.
                        Subroutine INTPRI This routine prints the converged solution at the current time
                        step. The routine can also be used to store current values in dummy arrays DUM1
                        and DUM2 for later printing or plotting. Here, the STOP condition may be given.
                        Functions HPERI, AREA, and PERI These function routines calculate heat trans-
                        fer coefficient at node I and area and perimeter at location X or XCF as per the
                        specifications in their arguments. Note that heat transfer coefficients may be func-
                        tions of T , x, and/or t.
                        Subroutine RESULT In this last routine, the converged solution is printed along
                        with evaluation and printing of derived parameters. For example, in Problem 2
                        of Chapter 2, it is of interest to calculate heat loss from the fin as well as fin
                        effectiveness and compare them with the exact solutions. This routine can also be
                        used to create files containing results for postprocessing using graphics packages
                        such as GNUPLOT or GRAPHER.



                        B.4 File LIB1D.FOR
                        Subroutine MAIN All subroutines in the code are called from this subroutine.
                        First, subroutines GRID and INIT are called. Then, starting with TTIME = 0, an
                        outer DO loop (3000) is initiated to begin calculations at a time step NTIME and
                        TTIME is incremented by DELT. Subroutine NEWVAL is called to set boundary
                        conditions at a new time step. Then, iterations are carried out in an inner loop
                        (1000) in which subroutines PROPS, COEF, SORCE, BOUND, and SOLVE are
                        called in turn. The SOLVE routine returns the value of FCMX. If this value is less
   303   304   305   306   307   308   309   310   311   312   313