Programs in the book Computational Mathematics in Engineering and Applied Science (CRC Press, Inc., Boca Raton, Florida, ISBN: 0-8493-7373-5) by W. E. Schiesser Iacocca Hall, Room D307 Lehigh University 111 Research Drive Bethlehem, PA 18015 USA (610) 758-4264 (office) (610) 758-5297 (fax) wes1@lehigh.edu (Internet) Please read the following information before using the programs on the diskette, which is written as a series of DOS-formatted files stored in subdirectories according to the chapters in the book (the contents of this printed set of instructions is in file README.1ST in the root directory of the diskette). (1) The diskette contains programs with one of the following formats: (1.1) Stand-alone (self-contained) Fortran. (1.2) Calls to SNSQE [1] for the solution of systems of non- linear algebraic/transcendental equations. (1.3) Calls to ODE an integrator, e.g., subroutine RKF45 [2], the fixed step Runge Kutta integrator FS_RKF45 of Program 2.3a (listed on pp. 65-67) or the Adam-Bashforth integra- tor listed in Appendix A. (1.4) Calls to spatial differentiation routines, e.g., DSS004, for the integration of PDEs by the method of lines. These calls to spatial differentiation routines are within format (1.3) since the method of lines converts PDEs to approxi- mating sets of ODEs. [1] SNSQE.SP and the subordinate routines BLAS.SP, XERROR.SP and MACHCON.SP are taken from: Kahaner, D., C. B. Moler and S. Nash, Numerical Methods and Software, Prentice Hall, Englewood Cliffs, NJ 07632, 1989. Note in particular MACHCON.SP requires setting five machine constants; the active values are for a 32-bit computer with single precision Fortran in real function R1MACH: Single precision Fortran (in five-element array RMACH): DATA RMACH/ 1.00E-38, + 1.00E+38, + 0.5E-7, + 1.00E-7, + 0.30102999566/ SNSQE.DP, the double precision version of SNSQE, and the set of subordinate routines BLAS.DP, XERROR.DP and MACHCON.DP were generously provided by David Kahaner, the first author of the book cited above. Note that MACHCON.DP requires setting five machine constants; the active values are for a 32-bit computer with double precision Fortran in real function D1MACH: Double precision Fortran (in five-element array DMACH): DATA DMACH/ 2.23D-308, + 1.79D+308, + 1.11D-16, + 2.22D-16, + 0.301029995663981195D0/ Note that the smallest and largest nonzero numbers, 2.23D-308 and 1.79D+308, correspond to a dynamic range of 2*308 = 616 orders of magnitude. Some computers do not have such a large dynamic range, and in some cases, the dynamic range is the same as for single precision, e.g., 2*38 = 76 orders of magnitude. Therefore, some adjustment of the smallest and largest nonzero numbers may be required; however, precise values are not re- quired for the correct operation of DDRIV2. Similarly, the numbers reflecting the machine epsilon (unit round-off), 0.5E-7 and 1.0E-07 for single precis- ion, and 1.11D-16 and 2.22D-16 for double precision, need not be precise for the correct operation of SNSQE.SP and SNSQE.DP. These single precision values (0.5E-07, 1.0E-07), and double precision values (1.11D-16, 2.22D-16), can be used on most 32-bit computers. Finally, despite the appearance of high precision for the fifth number, e.g., 0.30102999566 in single precision, it is not critical to the performance of SNSQE.SP and SNSQE.DP. [2] RKF45 is taken from Forsythe, G. E., M. A. Malcolm and C. B. Moler, Computer Methods for Mathematical Computations, Prentice-Hall, Englewood Cliffs, NJ 1977. The general purpose routines, e.g., SNSQE, RKF45, are in the subdirectory \LIBRARY. The fixed step RKF45 integrator listed on pp 65-67 is in file FS_RKF45.DP (in \LIBRARY) and the second- order Adams-Bashforth integrator listed in Appendix B is in file ADAMS.SP. Some routines discussed in the book, e.g., LSODE, LSODES, LSODI, DASSL for ODE/DAE integration, are not included on the diskette because of their size, but they are available from the author as part of the DSS/2 system (discussed below) or from the original authors. A series of spatial differentiation routines, e.g., DSS004, is also included in \LIBRARY: DSS002.SP, DSS004.SP, DSS012.SP, DSS020.SP, DSS034.SP, DSS036.SP, DSS042.SP, DSS044.SP (single precision) DSS002.DP, DSS004.DP, DSS012.DP, DSS020.DP, DSS034.DP, DSS036.DP, DSS042.DP, DSS044.DP (double precision). Note that the extensions are of two types: .SP for single precision routines. .DP for double precision routines. These extensions indicate one potential problem that can easily lead to incorrect results: the mixing of precisions. In other words, it is essential to use single precision library routines from \LIBRARY for execution of a single precision problem (to be discussed subsequently), and conversely, double precision routines must be used consistently. Mixing precisions is a subtle source of errors since generally Fortran compilers will process routines of mixed precision, linkers will link the routines, and execution will proceed, with no error messages, but the results will be incorrect (and very often perplexing since the incorrect results generally have no apparent relationship to the basic problem, i.e., the mixing of precisions). (2) A series of utilities routines is also included in \LIBRARY, e.g., SPLOTS and TPLOTS for point plotting, JMAP and EIGEN for mapping an ODE Jacobian matrix and computing the Jacobian eigenvalues. All of these routines should be readily identifiable from a list of files produced by the DOS command DIR/P on the subdirectory \LIBRARY. (3) Subdirectories CHAP2 to CHAP5 contain the programs discussed in Chapters 2 to 5 (Chapter 1 does not have any programs that can be included on the diskette). The files in these four subdirector- ies have names and extensions which identify their types, e.g.,: .MAI - a Fortran source file with a main and subordinate routines to execute a particular problem. .FOR - a Fortran source file for a particular problem. .DAT - a data file associated with a .MAI and .FOR file of the same name. In some programs, more than one data file is used, e.g., the coarse integration discussed on p 31 uses data file PRO2P1SP.COR, while the fine integration discussed on p 37 uses data file PRO2P1SP.FIN. Thus a review of the various files may be required to put together a complete program. To facilitate this process of formulating a complete program, the file names indicate the particular programs in the book. For example, Program 2.1 (Program 1 in Chapter 2 discussed on pp 23-37) has the name PRO2P1SP; all of the routines required to execute Program 2.1 (in single precision format) are in \CHAP2 under the name PRO2P1SP; Program 2.1 in double precision format is in PRO2P1DP. Similarly, Program 2.2 discussed on pp 41-55 is named PRO2P2SP (single precision format) and PRO2P2DP (double precision format). Program 2.3 discussed on pp 65-71 is named PRO2P3 (it is only in double precision format). Thus, to put together a particular program from the book, all files with the same name, e.g., PRO2P1SP, but with different extensions, are combined with the subordinate library routines in \LIBBRARY to make up a complete program. For example, to execute Program 2.1 discussed on pp 23-37, the following files would be used: PRO2P1SP.FOR + SNSQE.SP + BLAS.SP + XERROR.SP + MACHCON.SP (from \CHAP2) (from \LIBRARY) compiled and executed with data file PRO2P1SP.COR for the coarse integration or data file PRO2P1SP.FIN for the fine integration. PRO2P1SP.FOR contains: (a) the main program ORBIT of Program 2.1a listed on pp 23-25, (b) subroutine INITAL of Program 2.1b on p27, (c) subroutine DERV of Program 2.1c on p28, (d) subroutine PRINT of Program 2.1d on p29, and (e) subroutines ENERGY and PLOT of Program 2.1e on pp 30-31. Note that all of these routines are in single precision format so that the single precision SNSQE (called by the main program ORBIT) in \LIBRARY\SNSQE.SP, and the subordinate routines BLAS.SP, XERROR.SP and MACHCON.SP in \LIBRARY should be used (with data file PRO2P1SP.COR or PRO2P1SP.FIN). We recommend that you put this program together and execute it; if the numerical results discussed on pp 32-36 (using data file PRO2P1SP.COR) and on pp 38-39 (using data file PRO2P1SP.FIN) are reproduced, the use of any of the programs on the diskette should then follow logically. Note that single precision routines were used in the preceding example. If the double precision version is to be used, the formulation would be: PRO2P1DP.FOR + SNSQE.DP + BLAS.DP + XERROR.DP + MACHCON.DP (from \CHAP2) (from \LIBRARY) compiled and executed with data file PRO2P1DP.COR for the coarse integration or data file PRO2P1DP.FIN for the fine integration. To reiterate, the programs in Chapters 2 to 5 in some cases are coded in single precision Fortran, while for other programs, the coding is in double precision. Therefore, as noted previously, care must be given to putting together a complete Fortran program to ensure the same precision is used consis- tently. Also, if one or more routines is inadvertently left out in putting together a program, the link/execute step will generally produce an error message(s) identifying the missing routine(s); these can then be located on the diskette and added to the program. Please contact the author if you cannot find a particular routine(s). The execution may require renaming data and output files or modification of the OPEN statements in the main program, which generally are of the form (e.g., see Program 2.1a on p23): NI=5 NO=6 OPEN(NI,FILE='DATA', STATUS='OLD') OPEN(NO,FILE='OUTPUT',STATUS='NEW') Thus, if these I/O statements are used, and data file PRO2P1SP.COR is to be used, it should be renamed to DATA. A summary of the applications programs in Chapters 2 to 5 follows: File Description PRO2P1SP.FOR Greenspan problem via SNSQE in single precision for coarse PRO2P1SP.COR grid of 21 points and fine grid of 201 points (thus, two PRO2P1SP.FIN data files). PRO2P1DP.FOR Greenspan problem via SNSQE in double precision for coarse PRO2P1DP.COR grid of 21 points and fine grid of 201 points (thus, two PRO2P1DP.FIN data files). PRO2P2SP.FOR Greenspan problem via RKF45 in single precision for coarse PRO2P2SP.COR grid of 21 points and fine grid of 201 points (thus, two PRO2P2SP.FIN data files); for the 21-point orbit, set NP=21 in INITAL; for the 201-point orbit, set NP=201 in INITAL. PRO2P2DP.FOR Greenspan problem via RKF45 in double precision for coarse PRO2P2DP.COR grid of 21 points and fine grid of 201 points (thus, two PRO2P2DP.FIN data files); for the 21-point orbit, set NP=21 in INITAL; for the 201-point orbit, set NP=201 in INITAL. PRO2P3.MAI dy/dt + y = 0, y(0) = 1, by fixed step RKF45 in subroutine PRO2P3.FOR FS_RKF45 (which is part of PRO2P3.MAI). PRO2P3.DAT PRO2P4.FOR lambda*h analysis of explicit RK methods of various orders. PRO2P5.FOR Einstein equation by fixed step Adams Bashforth integrator PRO2P5.EUL PRO2P5.EUL - Euler method (data file) PRO2P5.MEU PRO2P5.MEU - modified Euler method (data file) PRO2P5.ADA PRO2P5.ADA - Adams Bashforth started with modified Euler ADAMS.SP method (data file). PRO2P6.FOR DYI/DT + I*YI = YI-1, YI(0) = 0, (Y0 = 1) by Adams Bashforth. PRO2P6.DAT ADAMS.SP PRO2P7.FOR Krogh's ODE problem, nonstiff case, by RKF45. PRO2P7.DATA PRO2P8.FOR Krogh's ODE problem, stiff and nonstiff cases, by LSODE. PRO2P8.DAT PRO2P8A.FOR Krogh's ODE problem, stiff and nonstiff cases, by DASSL. PRO2P8A.DAT PRO2P9.MAI Normal probability distribution by RKF45. PRO2P9.FOR PRO29P.DAT PRO2P10.MAI Elliptic integrals by RKF45. PRO2P10.FOR PRO2P10.DAT PRO2P11.MAI Two dimensional integral by RKF45. PRO2P11.FOR PRO2P11.DAT PRO2P12.MAI Linear integro-differential equation. PRO2P12.FOR PRO2P12.DAT PRO2P13.MAI Boundary value ODE; the main program sets NORUNS=22 PRO2P13.FOR and uses a DO loop. PRO2P13.DAT PRO2P14.MAI Boundary value ODE with reverse time integration; PRO2P14.FOR the main program sets NORUNS=1 and uses a DO loop. PRO2P14.DAT PRO3P1.MAI Bateman problem. PRO3P1.FOR PRO3P1.DAT PRO3P2.MAI Safety lead problem based on Maxwell's equations. PRO3P2.FOR PRO3P2.DAT PRO3P5.MAI Cubic Schrodinger equation. PRO3P5.FOR PRO3P5.DAT PRO4P1.MAI Burgers' equation by DSS020 and DSS042. PRO4P1.FOR PRO4P1.DAT PRO4P2.MAI Burgers' equation by DSS038. PRO4P2.FOR PRO4P2.DAT PRO4P3.MAI Modified Burgers' equation, u = u*u - u*u by DSS020 PRO4P3.FOR t xx x PRO4P3.DAT and DSS042. PRO4P4.MAI u = u - 3u + u PRO4P4.FOR t xx xy yy PRO4P4.DAT PRO4P5.MAI Skeel problem to demonstrate the solution of a complicated PRO4P5.FOR Parabolic PDE and the use of DASSL with banded Jacobian. PRO4P5.DAT PRO4P6.MAI Nevada two-domain problem. PRO4P6.FOR PRO4P6.DAT PRO4P7.MAI MOL bandwidth reduction via the Bateman problem. PRO4P7.FOR PRO4P7.DAT PRO4P8.MAI Finite integral transforms to illustrate series solutions, PRO4P8.FOR orthogonal functions, introduction to weighted residual PRO4P8.DAT methods. PRO4P9.MAI Weighted residual method via Galerkin's method using linear PRO4P9.FOR finite elements. PRO4P9.DAT PRO4P10.MAI Finite volume method. PRO4P10.FOR PRO4P10.DAT PRO4P11.MAI Two dimensional advection equation with analytical solution. PRO4P11.FOR PRO4P11.DAT PRO5P1.MAI Uniform transmission line equations. PRO5P1.FOR PRO5P1.DAT PRO5P2.MAI Maxwell's equation. PRO5P2.FOR PRO5P2.DAT PRO5P3.MAI au + bu = cu + du PRO5P3.FOR tt t xx PRO5P3.DAT PRO5P4.MAI Three pass shell and tube heat exchanger solved as boundary PRO5P4.FOR value ODE problem using MOL. PRO5P4.DAT PRO5P5.MAI Prasher aquifer problem as a solution to Poisson's equation. PRO5P5.FOR PRO5P5.DAT Finally, DSS/2, a library of routines for the solution of ODEs/DAEs/PDEs which is available at nominal cost, contains many more routines than could be put on a diskette, e.g., the spatial differentiation routines listed in Appendix B of the book. Also, nine sets of applications that run under DSS/2 are available. A list of the application titles for eight sets is given in Appendix C; the ninth set, called DIFFPACK, is a collection of problems in stiff and nonstiff ODEs, and one, two and three dimensional, elliptic, parabolic and hyperbolic PDEs, which is intended to illustrate the method of lines solution of all of the major classes of ODEs and PDEs within a single software framework. The organization of the series of programs which call different utility routines has been a challenge. I hope the arrangement of the files on the diskette will facilitate the use of the programs in the book. If you encounter any difficulties in using the diskette, please feel free to contact me. W. E. Schiesser 01JAN94