Techniques of Water-Resources Investigations of the Uni tes Geological Survey l A MODU FINITE-DIFFE By Mich el G. McDonald Arl n W. Harbaugh pen-file and U.S. Geological Report 83-875 Book 6 MODELING TECHNIQUES Click here to return to USGS Publications DEPARTMENT OF THE INTERIOR DONALD PAUL HODEL, Secretary U.S. GEOLOGICAL SURVEY Dallas 1. Peck, Director A copy of the source program of the Modular Model is available at cost, from: Chief, Office of Ground Water, MS 411, National Center, U.S. Geological Survey, Reston, Virginia 22092 UNITED STATES GOVERNMENT PRINTING OFFICE, WASHINGTON For sale by the Books and Open-File Reports Section, U.S. Geological Survey, Federal Center, Box 25425, Denver, CO 80225 : 1988 PREFACE The series of manuals on techniques describes procedures for planning and executingspecializedwork in water-resourcesinvestigations.The material is grouped under major subject headingscalled books and further subdivided into sections and chapters. Section A of Book 6 is on ground-water modeling. Provisional drafts of chapters are distributed to field offices of the U.S. Geological Survey for their use. These drafts are subject to revision becauseof experiencein use or because of advancement in knowledge, techniques, or equipment. After the technique describedin a chapter is sufficiently developed,the chapter is published and is for sale by the Books and Open-File Reports Section, US. Geological Survey, Federal Center, Box 25425, Denver, Colorado 80225. Reference to trade names, commercial products, manufacturers, or distributors in this manual constitutes neither endorsement by the U.S. Geological Survey nor recommendationfor use. ... III TECHNIQUES OF WATER-RESOURCES INVESTIGATIONS UNITED STATES GEOLOGICAL SURVEY OF THE The U.S. Geological Survey publishes a series of manuals describing procedures for planning and conducting specializedwork in water-resourcesinvestigations.The manualspublished to date are listed below and may be ordered by mail from the U.S. Geoiogical Survey Books and Open-File Reports, Federal Center, Box 25425,Denver,Colorado 80225an authorized agent of the Superintendent of Documents, Government Printing Office). Prepaymentis required. Remittance should be sentby check or money order payableto U.S. Geological Survey.Prices are not included in the listing below as they are subject to change. Current prices can be obtained by writing to the USGS, Books and Open File Reports. Prices include cost of domestic surface transportation. l%r transmittal outside the U.S.A. (except to Canada and Mexico) a surcharge of 25 percent of the net bill should be included to cover surface transportation. When ordering any of thesepublications, pleasegive the title, book number, chapter number, and “U.S. Geological Survey Techniques of Water-ResourcesInvestigations.” TWI 1-Dl. TWI 1.D2. Water temperature-influential factors, field measurement, and data presentation, by H.H. Stevens,Jr., J.F. Flcke, and GE Smoot, 1975,65 pages. Guidelines for collection and field analysii of ground-water samples for selected unstable constituents, by W.W. Wood. 1976. 24 Application of surface geophysics to ground water investigations, by A.A.R. Zohdy, G.P. Eaton, and D.R. Mabey. 1974.116 pages. Application of borehole geophysics to water-resources investigations, by W.S. Keys and L.M. MacCaly. 1971. 126 pages. General field and office procedures for indirect discharge measurement, by M.A. Benson and Tate Dahymple. 1967.30 pages Measurement of peak discharge by the slope-area method, by Tate Dabymple and MA. Benson. 1967.12 pages Measurement of peak discharge.at culverts by indirect methods, by G.L. Bcdhaine. 1968. 60 pages. Measurement of peak discharge at width contractions by indirect methods, by H.F. Matthai. 1967. 44 pages Measurement of peak discharge at dams by indirect methods, by Harry Hulsing. 1967.29 pages. General procedure for gaging streams, by R.W. Carter and Jacob Davidian. 1968.13 pages Stage measurements at gaging stations, by T.J. Buchanan and W.P. Somers. 1968.28 pages Discharge measurements at gaging stations, by TJ. Buchanan and W.P. Somers. 1969.65 pages. Measurement of time of travel and dispersion in streams by dye tracing, by E.P. Hubbard, F.A. Kilpatrick, L.A. Martens, and J.F. Wilson, Jr. 1982.44 pages l-WI 3-AlO. Discharge ratings at gaging stations, by EJ. Kennedy. 1984.59 pages. TWI 3-All. Measurement of discharge by moving-boat method, by G.F. Smoot and CC. Novak. 1969. 22 pages. TWI 3-A12. Fluorometric procedures for dye tracing. Revised, by James F. Wilson, Jr., Ernest D. Cobb, and Frederick A. Kilpatrick. 1986.41 TWI TWI TWI TWI TWI TWI TWI TWI TWI TWI TWI 2-Dl. 2-El. 3-Al. 3-A2. 3-A3. 3-A4. 3-As. 3-A6. 3-A7. 3-A8. 3-A9. TWI TWI TWI TWI TWI TWI TWI 3-A13. 3-A14. 3-A15 3-A16 3-A17. 3-Bl. 3-B2. TWI 3-B3. TWI 3-BS. TWI 3-B6. TWI TWI TWI TWI TWI TWI TWI TWI TWI TWI 3x1. 3x2. 3x3. 4-Al. 4-A2. 4-Bl. 4-B2. 4-B3. 4-Dl. S-Al. TWI 542. Iv Computation of continuous records of streamflow, by Edward J. Kennedy. 1983.53 pages. Use of flumes in measuring discharge, by EA. Kilpatrick, and V.R. Schneider. 1983.46 pages. Computation of water-surface profiles in open channels, by Jacob Davidian. 1984. 48 pages Measurement of discharge using tracers, by F.A. Kilpatrick and E.D. Cobb. 1985.52 pages. Acoustic velocity meter systems, by Antonius Laenen. 1985. 38 pages. Aquifer-test design, observation, and data analysii by R.W. Stallman. 1971. 26 pages Introduction to ground-water hydraulics, a programmed text for self-instruction, by G.D. Bennett. 1976. 172 pages. Spanish translation TWL 3-B2 also available. Type cures for selected problems of flow to wells in confined aquifers, by J.E. Reed. 1980. 106 p. Definition of boundaxy and initial conditions in the analysis of saturated ground-water flow systems-an introduction, by 0. Lehn Franke, Thomas E. Reilly, and Gordon D. Bennett. 1987. 15 pages. The principle of superposition and its application in ground-water hydraulics, by Thomas E. Reilly, 0. Lehn Franke, and Gordon D. Bennett.1987. 28 pages. Fluvial sediment concepts, by H.P. Guy. 1970.55 pages. Field methods of measurement of fluvial sediment, by H.P. Guy and V.W. Norman. 1970. 59 pages. Computation of fluvial-sediment discharge, by George Portertield. 1972. 66 pages. Some statistical tools in hydrology, by H.C. Riw. 1968. 39 pages. Frequency curves, by H.C. Riggs, 1968. 15 pages. Low-flow investigations, by H.C. Riggs. 1972. 18 pages Storage analyses for water supply, by H.C. Riggs and C.H. Hardison. 1973.20 pages Regional analyses of streamflow characteristics, by H.C. Riggs. 1973. 15 pages. Computation of rate and volume of stream depletion by wells, by C.T. Jenkins. 1970. 17 page& Methods for determination of inorganic substancesin water and fluvial sediments, by M.W. Skougstad and others, editors. 1979.626 pages. Determination of minor elements in water by emission spectroscopy, by P.R. Bamett and E.C. Mallory, Jr. 1971. 31 pages. TWI 543. TWI S-A4 TWI 545. TWI 5-A6. lwI 5x1. TWI 6-Al. TWI 7x1. TWI 7x2. TWI 7-C% TWI 8-Al. TWI 842. TWI 8-B2. Methods for the determination of organic substancesin water and fluvial sediments, edited by R.L. Wershaw, M.J. Fishman, R.R. Grabbe, and L.E. Lowe. 1987.80 pages This manual is a revision of “Methods for Analysii of Organic Substancesin Water” by Donald F. Goerlitz and Eugene Brown, Book 5, Chapter A3, published in 1972. Methods for collection and analysis of aquatic biological and microbiological samples, edited by P.E. Greeson, T.A. Ehlke, G.A. Irwin, B.W. Lium, and K.V. Slack. 1977. 332 pages. Methods for determination of radioactive substances in water and fluvial sediments, by L.L. Thatcher, VJ. Janzer, and K.W. Edwards. 1977.95 pages. Quality assurance practices for the chemical and biological analyses of water and fluvial sediments, by L.C. Friedman and D.E. Erdmann. 1982. 181 pages. Laboratory theory and methods for sediment analysis, by H.P. Guy. 1969.58 pages. A modular threedimensional finitedifference ground-water flow model, by Michael G. McDonald and Arlen W. Harbaugh. 1988. 586 pages. Finite difference model for aquifer simulation in two dimensions with results of numerical experiments, by P.C. Txxxcott, G.F. Pinder, and S.P. Larson. 1976. 116 pages. Computer model of two-dimensional solute transport and dispersion in ground water, by L.F. Konikow and J.D. Bredehoeft. 1978. 90 pages. A model for simulation of flow in singular and interconnected channels, by R.W. Schaffranek, R.A. Baltzer, and DE Goldberg. 1981.110 pages. Methods of measuring water levels in deep wells, by M.S. Garber and EC. Koopman. 1968. 23 pages. Installation and setice manual for U.S. Geological Survey monometers, by J.D. Craig. 1983. 57 pages. Calibration and maintenance of vertical-axis type current meters, by G.F. Smoot and C.E. Novak. 1968.15 pages. CONTENTS Page Abstract .............................................................. Introduction .............................................. Chapter 1. Purpose ............................................................. Organization of This Report ......................................... Acknowledgement ..................................................... Chapter 2. Derivation of the Finite-Difference Equation..............2 Mathematical Model .................................................. Discretization Convention ........................................... Finite-Difference Equation .......................................... Iteration ........................................................... Formulation of equations for solution ............................... Types of Model Cell and Simulation of Boundaries....................2-2 Conceptual Aspects of Vertical Discretization.......................2-2 Chapter 3. Program Design ............................................ Overall Structure ................................................... Array Boundaries and Aquifer Boundaries ............................. Volumetric Budget ................................................... Space Allocation .................................................... Three-Dimensional Subscripts for Model Arrays.......................3-2 Input Structure ..................................................... Output Structure .................................................... ............................... Main Program........................ FORTRAN Listing of the Main Program. ............................... ............................... Chapter 4. Basic Package............. Conceptualization and Implementation ............................... Selection of Major Options and Des i gnation of Input Files.........4............................... The IBOUND Array.................. Initial Conditions ................................................ Discretization of Time ............................................ output ............................................................ Budget Calculations in the Basic Package .......................... Input Instructions .................................................. ll- 1 2 l- 2 ll- 3 7 - 1 2- 1 2- 2 2- 5 2-20 2-25 7 9 3- 1 33-1; 3-16 3-22 3 3-24 3-28 3-29 3-32 4- 1 4- 1 1 . 4- 2 44444- 2 5 5 8 9 4-13 Sample Input ...................................................... 4-14 Input Instructions for Output Control ............................... 4-17 Sample Input for Output Control ................................... 4-18 Module Documentation ................................................ 4-19 BASlDF ............................................................ 4-23 BASlAL ............................................................. BASlRP . . . . . . . .‘I. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27 4-31 BASlST ............................................................ 4-35 BASlAD ............................................................ 4-39 BASlFM ............................................................ 4-42 BASlOC ............................................................ 4-46 BASlOT ............................................................ 4-51 SBASlD ............................................................ 4-55 SBASlH ............................................................ SABSlI ............................................................ vii 4-59 Page SBASlT ............................................................ SBASlV ............................................................ Chapter 5. Block-Centered Flow Package ............................... ................................ Conceptualization and Implementation Basic Conductance Equations ....................................... Horizontal Conductance Under Confined Conditions..................5 Horizontal Conductance Under Water Table Conditions...............5 Vertical Conductance Formulation .................................. Vertical Flow Calculation Under Dewatered Conditions..............5-19 Storage Formulation ............................................... Storage Term Conversion ........................................... Applicability and Limitations of Optional Formulations............5-3 Data Requirements ................................................. Input Instructions .................................................. Sample Input ...................................................... Module Documentation ................................................ BCFlAL ............................................................ BCFlRP ............................................................ BCFlFM ............................................................ BCFlBD ............................................................ SBCFlN ............................................................ SBCFlH ............................................................ SBCFlC ............................................................ SBCF1B............................................................ SBCFlF ............................................................ Chapter 6. River Package ............................................. ................................ Conceptualization and Implementation .................................................. Input Instructions Sample Input ...................................................... Module Documentation ................................................ RIVlAL ............................................................ RIVlRP ............................................................ 4-63 4-66 5- 1 5- 1 5- 2 - 6 - 9 5-11 5-24 5-26 0 5-30 5-37 5-41 5-42 5-44 5-50 5-56 5-62 5-68 5-73 5-77 5-81 5-86 6- 1 6- 1 6-14 6-16 6-17 6-18 6-22 RIVlFM ............................................................ 6-26 RIVlBD ............................................................ 6-30 7- 1 7- 1 7- 6 7- 8 7- 9 7-10 7-14 7-18 7-22 8- 1 8- 1 8- 3 8- 4 8- 5 8- 6 8-10 8-14 8-17 Chapter 7. Recharge Package .......................................... ................................ Conceptualization and Implementation .................................................. Input Instructions Sample Input ...................................................... Module Documentation ................................................ RCH1AL ............................................................ RCHlRP ............................................................ RCHlFM............................................................ ........................... RCHlBD .................................. Chapter 8. Well Package .............................................. ................................ Conceptualization and Implementation Input Instructions .................................................. Sample Input ...................................................... Module Documentation ................................................ WELlAL ............................................................ WELlRP ............................................................ WELlFM............................................................ WELlBD ............................................................ ... Vlll Page Chapter 9. Drain Conceptualization Package .............................................. ................................. and Implementation Input Instructions ................................................... Sample Input ....................................................... 9- 1 9- 1 ;-- ; 9-10 Module Documentation ................................................. 9-11 DRNlAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 DRNlRP ............................................................. 9-19 DRNlFM............................................................. 9-23 DRNlBD ............................................................. lo- 1 Package ............................... Chapter 10. Evapotranspiration lo- 1 Conceptualization and Implementation ................................ Input Instructions .................................................. Sample Input ...................................................... Module Documentation ................................................ EVTlAL ............................................................ EVTlRP ............................................................ EVTlFM ............................................................ EVTlBD............................................................ Chapter 11. General-Head Boundary Package ............................ ................................ Conceptualization and Implementation Input Instructions .................................................. Sampl e Input ...................................................... Module Documentation ................................................ GHBlAL ............................................................ GHBlRP............................................................ GHBlFM............................................................ GHBlBD............................................................ Implicit Procedure Package......................12 Chapter 12. Strongly Conceptualization and Implementation ................................ General Theory .................................................... Transfer of Arrays ................................................ .............................................. Order of Calculation Iteration Parameters .............................................. Input Instructions .................................................. Sample Input ...................................................... Module Documentation ................................................ lo- 8 10-10 10-11 10-12 lo-16 10-20 lo-24 ll- 1 ll- 1 ll- 5 ll- 7 ll- 8 ll- 9 11-13 11-17 11-21 - 1 12- 1 12- 1 12-20 12-21 12-23 12-30 12-31 12-32 SIPlAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-33 12-37 SI PlRP ............................................................ 12-41 SIPlAP ............................................................ 12-56 SSIPlP ............................................................ 12-59 SSIPlI ............................................................ Overrelaxation Package..................13 - 1 Chapter 13. Slice-Successive 13- 1 Conceptualization and Implementation ................................ 13-10 Input Instructions .................................................. 13-11 Module Documentation ................................................ SORlAL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12 SORlRP............................................................ SORlAP ............................................................ SSORlB ............................................................ Utility Modules .......................................... Chapter 14. Input Instructions for Array Readers ................................ UBUDSV..*.......*................................................. ix 13-16 13-19 13-29 14- 1 14- 4 14- 6 Page 14- 9 14-12 14-17 14-22 14-26 ULASAV............................................................ ULAPRS............................................................ ULAPRW............................................................ UCOLNO............................................................ UZDREL............................................................ UZDINT............................................................ UlDREL ............................................................ References ............................................................ ........................................ Appendix A--Program Portability Appendix B--Space Requirements in the X Array .......................... Appendix C--Continuation of a Previous Run ............................. Appendix D--Sample Problem ............................................. Appendix E--Abbreviated Input Instructions ............................. x 14-30 14-35 14-39 A- 1 B- 1 c- 1 D- 1 E- 1 ILLUSTRATIONS Page Figure 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 22. 23. 24. 25. 26. 27. 28. 29. 30. A discretized hypothetical aquifer system................2 - 3 Grids showing the difference between block-centered and point-centered formulations........................2 - 6 Cell i,j,k and the six adjacent cells....................2 - 8 Flow into cell i,j,k from cell i.j-l.k...................Z - 9 Conceptual representation of leakage through a 2-14 riverbed into a cell ................................... 2-17 ................................ Hydrograph for cell i,j,k Iterative calculation of a head distribution.............Z-2 2 Discretized aquifer showing boundaries and cell 2-28 designations ........................................... Schemes of vertical discretization.......................Z-3 0 Possible pattern of flow in a cross section consisting of two high conductivity units separated by a low conductivity unit...................Z-3 2 A cross section in which a low conductivity unit is represented by six model layers.....................Z-3 3 A cross section in which a low conductivity unit is represented by the conductance between model layers....Z-3 5 32 ................................ Overall program structure Organization of modules by procedures and packages.......3 - 6 Primary modules organized by procedure and package.......3 - 8 Overall program structure showing all primary modules....3-12 Specification of major options using the IUNIT array.....3-2 6 Sample input data showing role of the IUNIT array........3-2 7 Example of the boundary array (IBOUND) for a single 4- 3 layer .................................................. Flow of head distributions during a simulation...........4 - 4 Division of simulation time into stress periods and 4- 6 time steps ............................................. Sample overall volumetric water budget...................4 - 7 Prism of porous material illustrating Darcy's law........5 - 3 Calculation of conductance through several prisms 5- 5 in series .............................................. Calculation of conductance between nodes using transmissivities and dimensions of cells...............5 - 7 Diagram for calculation of vertical leakance, Vcont, between two nodes which fall within a single 5-14 geohydrologic unit ..................................... Diagram for calculation of vertical leakance, Vcont, between two nodes located at the midpoints of vertically 5-15 adjacent geohydrologic units ........................... Diagram for calculation of vertical leakance, Vcont, between two nodes located at the midpoints of aquifers which are separated by a semiconfining unit............5-17 Situation in which a correction is required to limit the downward flow into cell i,j,k+l as a result of partial desaturation of the cell.......................5-2 0 A model cell which uses two storage factors during 5-29 one iteration .......................................... xi Page Figure 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. Relationship among the modules in the Block-Centered Flow Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-43 Discretization of a stream into reaches.................62 (a) Cross section of an aquifer containing a stream, and (b) conceptual representation of stream-aquifer interconnection in simulation . . . . . . . . . . . . . . . . . . . . . . ...63 Idealization of streambed conductance in an individual cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6- 4 Cross sections showing the relation between head at the base of the streambed layer and head in the ccl 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6- 7 Flow between stream and node i,j,k as a function of head in the aquifer, hi j,k . . . . . . . . . . . . . . . . . . . . . . . . . . . 6- 9 Limiting seepage from a stream at unit hydraulic gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Hypothetical problem showing which cells receive recharge under the three options available in the 7- 3 Recharge Package ..*................................... Cross section through cell i,j,k illustrating head loss in convergent flow into drain....................g2 Factors affecting head loss immediately around a drain: (a) buried drain pipe in backfilled ditch; (b) open drain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9- 4 Plot of flow into drain, QD, vs. head in cell i,j,k using equations (69-a) and (69-b).....................g6 Volumetric evapotranspiration from cell i,j,k as a eqUatiOnS (75)-(77)...103 function of head hi ’ k, Using Hypothetical problem <i 6wing cells from which ET will be abstracted under the two options available in the ET Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . lo- 6 Schematic diagram illustrating principle of General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ll- 2 head boundary package Graph of flow from source into cell i,j,k vs. head in the cell, as computed by the General-head boundary package using equation (78).................113 Correspondence between the finite-difference equations and the matrix equation for a grid of three rows, four columns, and two layers.........................lZ3 Structure of coefficient matrix showing nonzero diagonals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12- 4 Symmetric coefficient matrix for a grid containing two rows, three columns, and two layers..............lZ6 Decomposition of a coefficient matrix into lower and upper triangular matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12- 7 Structure of matrix [A+B] showing nonzero diagonals....lZ-10 Structure, showing nonzero diagonals, of (a) the lower triangular factor [L] of [A+B], and (b) the upper triangular factor [U] of [A+B].............lZ-11 Estimation of a function at one corner of a rectangle in terms of the values of the function at the other three corners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14 xii Page Figure 53. 54. 55. 56. Cell numbering schemes for a grid using three indices and using one index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-18 Division of the three-dimensional model array into vertical slices for processing in the SSOR package....l32 Coefficient matrix for slice equations and corresponding computer storage array..................l39 Illustration of wrap and strip forms of printed output for a layer containing 7 rows and 17 columns...l42 TABLES Table of packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10 1. List 2. Print-format codes for utility modules ULAPRS and ULAPRW. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14- 3 ... Xl11 A MODULARTHREE-DIMENSIONAL FINITE-DIFFERENCE By Michael G. McDonald and Arlen GROUND-WATERFLOW MODEL W. Harbaugh ABSTRACT This report presents a finite-difference model and its associated modular computer program. The model simulates flow in three dimensions. The report includes detailed explanations of physical and mathematical concepts on which the model is based and an explanation of how those concepts are incorporated in the modular structure of the computer program. The modular structure consists of a Main Program and a series of highly independent subroutines called "modules." The modules are grouped into "packages." Each package deals with a specific feature of the hydrologic system which is to be simulated, such as flow from rivers or flow into drains, or with a specific method of solving linear equations which describe the flow system, such as the Strongly Implicit Procedure or Slice-Successive Overrelaxation. The division of the program into modules permits the user to examine specific hydrologic features of the model independently. This also facilitates development of additional capabilities because new packages can be added to the program without modifying the existing packages. The input and output systems of the computer program are also designed to permit maximum flexibility. Ground-water flow within the aquifer is simulated using a block-centered finite-difference approach. Layers can be simulated as confined, unconfined, or a combination of confined and unconfined. Flow associated with external stresses, such as wells, area1 recharge, evapotranspiration, drains, and streams, can also be simulated. The finite-difference equations can be solved using either the Strongly Implicit .Procedure or Slice-Successive Overrelaxation. The program is written in FORTRAN 77 and will run without modification on most computers that have a FORTRAN 77 compiler. For each program module, this report includes a narrative description, a flow chart, a list of variables, and a module listing. l-l CHAPTER 1 INTRODUCTION Puroose Since their inception, models described Pinder, basic and others concepts presented flow by Trescott and Larson Survey (1976) for with minimal changes, a program could similar tational option options used for thereby of other two- user may select with The in the model was of computers respect to computer of changing to options that of the program. size that is available various and specific structure, existing of model input Variable without has also model output 1-2 compu- Input to suit used can procedures data may be stored allows input to the program. been generalized options subroutines. The model may be formatting modification each new are not being applications. files. structure in such a manner that the necessity each type external together, Because of this the so that uses a modular options. to be read in any format of output report or three-dimensional and read from separate The type flow. modified, on a variety are constructed pertaining reducing have been generalized arrays Geological a new ground-water be readily efficient are grouped options subroutines either could in this functions can be added without be deleted, of ground-water be executed documented program independent In addition, U.S. have been incorporated that and Trescott, time. and hydrologic is (1976), by the in designing and was relatively The model program wherein models finite-difference and Larson simulation objectives to use and maintain, memory and execution the in those The primary here. Trescott have been used extensively the computer embodied and three-dimensional (1975), model were to produce simple data the two- so that a particular need. The program was originally Harbaugh, This 1984). report has subsequently documents portable; it computers, about It will minor the run, The major options the effects and "general-head iteration is contained the Overrelaxation used in this use the series turn, program. of highly deals with report The program independent into a single the effect effect and the the Strongly which the Implicit of This drains, procedures to evapotranspiration, available (SIP) include and the two Slice- subroutines the mathematical and the into called "packages." modules. A package of wells, the River SIP Package solves chapter Package simulates l-3 to use. and a The modules, For example, a system report. needed to in is a group of modules Many of the packages of this input concepts a main program of the simulation. Procedure. in a separate Report of the'program, user may or may not have occasion is described include Procedure has been divided aspect Package simulates of rivers, A discussion A. algorithms is to describe the design have been grouped that On some method (SSOR). of this program, 0 Implicit Organization The purpose rivers, The solution Strongly or desirable. available recharge, boundaries". techniques, Successive are presently of wells, is highly on most computers. in Appendix and to use FORTRAN 77. The program may be necessary that FORTRAN66 (McDonald been modified modification, modification portability using FORTRAN77 version. without program simulate written of equations represent Each of the Two preliminary the Well the using options packages chapters describe topics relating finite-difference the overall that to the equation design topics 4 through of each package (2) of input tion of the individual tion and Implemementation the Package, riverbed, and a discussion cribe the into instructions "items." An item similar described records, section or it herein, two-dimensional arrays, package described consist For items which the line first records, while FORTRANnotation. for in the the of a single gives For an input in the approximates record 12 and 13 des- record or a collection input in this followed fields of those consists the model list by a note of an array, with are numbered, or comment). records, comprising fields, of The input associated or a group of similar shows the format item which items of of read as a collection each model layer.) names of the in terms of arrays.(In are always a can be 13 are presented (sometimes through equation 4 through of the 1-4 describing flow Chapters the entries the chapter in the model. with chapter; and mathematical or a collection a list The Conceptualiza- available arrays one associated second line which and and (3) documenta- physical equation. may be an array entry the may be a single presents A-E The description package, to show how that Chapters of input Appendices "Conceptualization For example, currently of two lines consist the describes is derived in 3 describes. modules tasks. in the package. is provided in that the utility packages. entitled contained three-dimensional in each chapter and generally a section package. procedures special individual the finite-difference solution 2 derives of the model. instructions an equation The input input (1) section the River incorporated operation modules used to build Chapter 14 describes to perform 13 describe consists Implementation," concepts Chapter packages to the program; is used in the model and Chapter of the program. relating Chapters the that are used by various cover overall the in standard the first line the of the entry name of the concerning gives utility utility modules the other those all falls items example, sented items for pumping rate, which in a simulation). read the or, Input which appear to describe that in the model itself Basic Package, input which with is always the optional items in Chapters the separately; input thus items for section This an independent with which in capital I-5 describes Basic letters input items describes associated Package. the list is followed control the describes input following of fields to and do not appear under consideration. explanation read used in the 4, which explanation the output are further one of these of the is presented the package associated items; repre- subroutine are terms Chapter (for period list a utility entirely the other 13. input or procedures, of input fields the (subroutines) call case print while 4 through into "FOR EACH SIMULATION" in the model program; fields control" of input cases by a sample input again, input required, is subdivided during of the are printed two lists "output An explanation put which as FORTRANvariables. includes time the modules or arrays the 14. is needed in each simulation; sections in mixed upper and lower instructions details may be needed in each simulation indicate are used as FORTRANvariables gives "FOR EACH STRESS PERIOD", and includes may change with items line Further items one entry in the case of an array, array. Chapter second under the heading entries which the array. of input These major by headings item, list only heading several in falls which which subdivided the One of these under the for the while reads the are provided packages, sections. and includes name of the array, module which For most of the two major the of inin most In Chapter option 4, are treated and sample input are provided for output control. In each simulation, the program input for array, with the each option is given Chapter is not through required at the 4. Following provides input descriptions of a module generally of the module, module, (2) simple of the in which narrative. they contains a flow four chart are performed. The flow used in the user must if the file option discussion of 13, each chapter up the associated in the package. package, followed The detailed description (1) a narrative description (3) is omitted. performed of terms "output a FORTRANlisting of the names which are used in the module. chart so that Chapters number of the Further of the modules documents: in the the 4 through making of the functions The blocks for is to be read; of the module, flow in in 3 and 4. of the variable the A location sections unit location. Chapters of a list numbers used in the narrative An explanation Chapters in the option in this section input of each of the modules. modules, is a numbered list the of the modules and (4) a list For very in consists by detailed for is entered a documentation documentation order input a one-dimensional discussion location, the numbers associated is to be utilized, IUNIT array which input of from which system. of the of the file is done through operating beginning of the options the are the unit the option is provided the array beginning If a zero IUNIT array This by the computer in the designated or channel This in this 13, and at the in enter, entries which and must indicate is to be read. files IUNIT array control" the the required 5 through user must designate are to be utilized, IUNIT; the the flow The narrative by the module showing chart chart is a graphic l-6 chart the can be cross is contained the equivalent are numbered with the two documents flow description on the same referenced. sheet with the flow chart. The program corresponding to those fourth of the listing that record and definition is used only in other given its modules of the as "Package"; range is given the under 6 through 11 provide and their representation operation of particular generated provided ated input in narratives. but not outside name, If the as "Module"; is used in the modules and day shows the used in the module. package, The the time of variables range is given organization of this and Implementation" to the overall if it variable is used the package, its of more than one package, design "Conceptualization and discussions Chapter solvers instructions, section of range is and functioning flow Implementation" Input instructions for and discussions is 5; Chapters or sinks 12 and 13 discuss of finite The appendices Chapter sources the systems a discussion program; the aquifer in external 4, provide of the within and Chapters 2 and 3, and Chapter for chapter; 14. Chapters of particular in the model; relevant report, representing in the model. in the is provided variable of coefficients discussed tions The list numbers as "Global." relevant formulation and the its it "Conceptualization discussions the if charts comments with a comment showing modified. module, contains flow contains of every in that To summarize the used in the the module was last range, listing provide difference each package of input the for utility equaare modules a sample problem, of certain abbrevi- computer-related topics. Acknowledgement The authors addition to providing he provided of the wish to extend report thanks the administrative encouragement greatly special and guidance improved its to Gordon Bennett. support along clarity. 1-7 for the way. In the model development, His critical review CHAPTER2 DERIVATION OF THE FINITE-DIFFERENCE Mathematical The three-dimensional porous earth material Model movement of ground water may be described EQUATION by the of constant density partial-differential through equation %;(K,,a-h-, +ii (Kyyii) t a,(Kzzii) - w=ss;; ax a2 (1) where KXX, Kyy and Kzz are values and z coordinate major h axes, axes of hydraulic W is a volumetric sinks of water is time conductivity etc.) equation Equation (l), boundaries system. expression the x, y, to the (Lt.-l); volume and represents sources and/or (t-l); storage of the porous (1) see for material example and W may be a function (1) describes in a heterogeneous axes of hydraulic conditions, per unit of equation Kxx = KXX(x,y,z), conditions are assumed to be parallel (L-l); Rushton SS, KxX, Kyy, and KZz may be functions W(x,y,z,t)); along and (t). For a derivation In general, conductivity head (L); flux S, is the specific at the which is the potentiometric t of hydraulic giving are aligned with of an aquifer constitutes A solution and anisotropic conductivity together ground-water specification system a mathematical of equation h(x,y,z,t) (l), of space (S, = Ss(x,y,z), of space and time flow medium, with of flow 2-I provided and/or and specification in an analytical (W = under nonequilibrium the the coordinate representation such that, and Redshaw (1979). principal directions. head conditions of initial-head of a ground-water sense, when the derivatives is flow an algebraic of h with respect its to space and time initial and boundary distribution of this both the energy to calculate approximate set nature of flow for very possible, wherein conditions simple the continuous points points. The process leads equations; their points and times. head distribution that partial-differential rules an alternative physical by equation calculus; of blocks rows, 1 shows a spatial called columns, cells, and layers. the by a finite derivatives linear are at these algebraic of head at specific to the time-varying solution of the (1) may be derived in the discussion procedure by applying presented aim of simplifying the computational regarding to obtain replaced an approximation however, (1) are method, in head values by an analytical the is partial values of equation used with (1) of simultaneous here, the mathematical in terms of familiar the flow system. Discretization Figure and the constitute analog is measures of equation is the f inite-difference yields of flow. approach concepts solution equation and explaining treatment to systems be given of difference so lutions from the differences would The finite-difference the described These values it and can be used methods must be employed numerical calculated in storage, and head in that system, flow analytical in space and time, by terms the equation of movement. systems, system replaced difference the (l), A time-varying are satisfied. One such approach solutions. equation volume of water and rates so various of discrete into characterizes and the directions Except rarely are substituted Convention discretization locations An i,j,k of an aquifer of which indexing 2-2 system with are described system is used. in terms a mesh of For a system Columns (J) 123456789 Layers (K) Explanation --- - Aqurfer 0 Active 0 Inactive Boundary Cell Cell ArJ Drmension of Cell Along the Row Direction AC1 Drmension of Cell Along the Column A”K Dimension of the Cell Along Figure 1. -A Subscript Directron. the Vertical discretized (J) Indicates Subscrrpt Direction. 2-3 (I) Indicates Subscript hypothetical the Number of the Column the Number (K) Indicates of the Row the Number aquifer system. of the Layer consisting of "nrow" index, i = 1,2,. is the layer rows, . . nrow; index, system with "ncol" columns, j is the k = 1,2,. nrow = 5, ncol column index, . . nlay. an assumption was made that to horizontal geohydrologic units the convention followed increment k index in the in this k index rows would be considered row index, i, considered parallel j, would would correspond in constructing that the parallel to decreases so that in x. 1; however, fall and does not the to the x axis, increases figure along along vertical, applications require equations correspond of Cartesian z; because the in elevation. Similarly increments and columns increments and k from the top down, an in the These conventions consistent the generally so that in y; in the would be column index, were followed of the model requires orthogonal the designation row 1 shows a Thus in terms to a decrease to the y axis, rows and columns layers, corresponds . . ncol; figure would model is to number layers correspond to layers changes i is the In formulating = 5. or intervals. denotes layers, j = 1,2,. For example, = 9, and nlay of the model, coordinates, and "nlay" directions of x, y, only within or z coordinate axes. Following row direction, in the the conventions at a given column direction ness of cells coordinates in a given (i,j,k) used in figure column, j, at a given layer, = (4,8,3) k, 1, the width is designated row, i, Arj; is designated is designated Avk. has a volume of ArgC4AV3. 2-4 of cells the width ACi; in the of cells and the thick- Thus a cell with Within each cell Figure to be calculated. for defining the nodes--the configuration start sets of the cells. In the around the nodes with of nodes should are, in fact, lines aquifer respect with sets faces two sets the halfway be chosen so that location lines, the hydraulic ence equation developed in the following however, the block-centered of parallel lines the blocks and cells formed are drawn In either properties over the extent holds spacing The finite-differ- for is presently case, of the system of a cell. section formulation formulation. the nodes are at the between nodes. uniform of nodes are at the center formulation, of parallel head is two conventions to the formulation, are the cells; point-centered of the at which and the point-centered generally only with In the block-centered of parallel points the a "node" in two dimensions, of cells by dividing intersection called formulation are orthogonal. by the is a point 2 illustrates, block-centered Both systems which there either formulation; used in the model. In equation that, time in the (l), the head, finite-difference domain is also h, is a function formulation, discretization follows into from the of the constant, the cell. ground-water application and out of the cell within as well as space so of the continuous required. Finite-Difference Development of time flow of the must be equal equation equation continuity Under the assumption the continuity Equation equation: to the that expressing in finite-difference rate sum of all flows of change in storage the density the the form balance of ground of flow water for is a cell (2) 2-5 is Block-Centered Grid System A ‘J Point-Centered Grid System Explanation 0 Nodes Grid Lines - - - Cell Boundaries for Point Centered Formulation Cells Associated Selected Nodes Figure 2.-Grids With showing the difference between block-centered and point-centered grids. 2-6 where Qi is a flow rate into the SS has been introduced finite-difference that cell (L3tW1); as the notation formulation; can be injected its per unit specific definition (I)--i.e., of S, in equation for it storage in the is equivalent to is the volume of water volume of aquifer material which per unit change in head (L-l); AV is the volume of the cell Ah is the into Equation storage (2) right over is stated are represented and change in head o er a time The term on the taken (L3); hand side a time by defining to the At given of inflow outflow of length is equival'ent nterval in terms interval volume of water a change in head of Ah. and storage as negative At. gain. inflow Outflow and loss and loss as negative gain. Figure i+l,j,k; 3 depicts i,j-1,k; development, and the all i,j+l,k; flows negative terms. direction i,j,k sign from cell usually these i,j-l,k and six i,j,k-1; are considered Following qi,j-l/Z,k a cell adjacent and i,j,k+l. positive incorporated conventions, (figure if they is given the are entering into i-l,j,k; cells To simplify in Darcy's flow 4), aquifer following cell i,j,k; law has been dropped cell i,j,k by Darcy's in the row law as (hi ,j-1,k - hi,j,k) = KRi ,j -1/2,kA CiA Vk------------------- (3) Arj-1/2 where hi,j,k qi,j-1/2,k is the head at node i,j,k, is the volumetric cells i,j,k and hi,j-l,k fluid and i,j-l,k discharge (L3tW1); 2-7 that through at node i,j-1,k; the face between from Figure 3.-Cell i,j,k and indices for the six adjacent cells. 2-8 0 0 0 /- Cell i,j-l,k / / Cell i,j, k 0 . . .. . 0 0 0 0 :0 I Avk I - I; l f I I I \ - Figure 4.-Flow into cell i,j,k from cell i,j-l,k. 2-9 KRi,j-1/2,k is the hydraulic and i,j-1,k i,j,k is the distance Arj-1/2 Although with it the discussion can be misleading a specific equation point described by, for gives the exact block of aquifer cross sectional Similar through the face for and flow into 9i-1/2,j,k row direction; of flow in terms calculated into Rather, the term conductivity for as a harmonic (1961). If this from node i,j-1,k the central of equation the entire is done, of region sense equation case, to node i,j,k (3) KRi,j-1/2,k mean in the steady-state and (L). j-1/2 the subscript hydraulic (3) through a and having a , can be written five faces, i,j,k approximating for i.e., flow the flow in the into the row direction cell through and i,j+l,k, = KRi ,j+l/e,kACi - hi,j,k) (hi, j+l,k AVk--------------"" (4) Mj+1/2 the column direction, qi+1/2,j,k nodes ACiAvk. between cells qi,j+1/2,k while remaining to the is phrased a one-dimensional extending row between and i,j-1,k Collins for flow, expressions the normal between the nodes. example, area faces to associate normally the between nodes i,j,k (3) is the effective between the nodes, along (Lt'l); is the area of the cell ACiAVk cell, conductivity flow into the (hi+l,j,k = KCi+1/2,j,k~jAVk------,f;;;;------ the block through = KCi -1/2,j the rear block - hi,j,k) face (hi-l,j,k the forward (5) is - hi,j,k) ,kllrj AVk----------““-----. Ei -l/2 2-10 through (6) face is For the vertical inflow direction, qi,j,k+l/Z the bottom face is (hi,j,k+l - hi,j,k) A rjA Ci -0---0-0-0-----o-o- KVi ,j ,k+1/2 = through (7) A”k+l/Z while inflow through the upper face by (hi,j,k-1 = KVi , j ,k-l/g qi ,j &-l/2 is given - hi,j,k) rjACi------------------- (8) l A Vk-1/2 Each of equations of heads, grid be simplified a single expresses and hydraulic dimensions, by combining constant, the inflow grid through conductivity. dimensions "hydraulic a face or, i,j,k The notation and hydraulic conductance" of cell in terms can conductivity more simply, the into "conduct- For example, ance." D (3)-(8) mi,j-1/2,k = KRi ,j-1/2,kACiAVk/Arj-1/2 mi,j.,1/2,k is the conductance (9) where i,j-1,k Conductance is thus area of flow divided distance between the and i,j,k the product by the in row i and layer k between nodes (L2t-l). of hydraulic length of the flow nodes.) l 2-11 conductivity path (in and cross-sectional this case, the Substituting conductance = CRi,j-1/2,k(hi,j-1,k qi,j-l/Z,k Similarly, equations (4)-(8) (9) into equation (3) yields (10) - hi,j,k)* can be rewritten to yield qi,j+l/2,k = CRi,j+l/2,k(hi,j+l,k - hi,j,k) (11) qi-1/2,j,k = CCi-1/2,j,k(hi-l,j,k - hi,j,k) (12) qi+1/2,j,k = CCi+l/E,j,k(hi+l,j,k - hi,j,k) (13) qi,j,k-l/2 = cvi,j,k-1/2(hi,j,k-1 - hi,j,k) (14) qi,j,k+l/il = Cvi,j,ktl/2(hi,j,ktl - hi,j,k) (15) where the conductances Equations adjacent cesses account To account cells. external for or wells, for flows on the head in the cell. to CRi,j-1/2,k the flow into additional or they heads in the aquifer, receiving analogously into terms cell may be entirely the aquifer in equation i,j,k drains, (9). from the six from features are required. receiving Flow from outside cell the cell such as streams, to the aquifer, may be dependent other are defined (lo)-(15) evapotranspiration the from equation area1 or prorecharge, These flows but independent independent of all of head in may be represented by the expression ai,j,k,n = Pi,j,k,nhi,j,k (16) t qi,j,k,n where di j k n represents , , (LW1): and pi,j,k,n flow from the rlth external are constants and qi,j,k,n source ((L*t-1) into cell i,j,k and (Lst'l), respectively). For example, from a well suppose a cell and seepage through is receiving a riverbed. 2-12 flow from two sources, For the first source recharge (n=l), since B iS the zero flow from the well aquifer rate (n=2), the can be treated seepage is proportional to the head in cell vertical streambed In this pi,j,k,l case, from the 16, while as it Similarly, all other expression of the or stresses external into conductivity the cell, (18) stream- so that between the river stage we have (18) cell is a conductance i,j,k. For example, 5, CRIV would of the divided can be rewritten be given riverbed in as the material and the by the thickness of the as (19) + aIVi,j,k,2Ri,j,k* corresponds -mIvi,j,k,z CRIVi,j,k,2Ri,j,k sources form of equation affecting the conductance, (L) and aIVi,j,k,2 river crosses term, the term thus in figure hydraulic conductance as a simple river = - mIVi,j,k,2hi,j,k The negative is made that - hi,j,k) Equation material. ai,j,k,2 sources flow assumption 5); shown schematically of the streambed (figure head in the controlling area of the equation i,j,k is the situation product the well. head difference = aIVi,j,k,2(Ri,j,k where Ri,j,k (L2tW1) for of head, (17) second source ai,j,k,2 D recharge interconnection and the the assumed to be independent = qi,j,k,l* For the the is the and qi,j,k,l ai,j,k,l is a single corresponds or stresses In general, 16. to pi,j,k,2 cell, t0 qi,j,k,2. can be represented if there the combined Of by an are N external flow is expressed by QSi,j,k Defining Pi,j,k N = "ai ,j ,k,n n=l e and Qi,j,k = N cPi,j,k,n hi,j,k n=l by the eXpreSSiOnS 2-13 N + cqi,j,k,n* n=l (20) Head in Stream, Ri,j,k / Conductance used to Represent Stream-Aquifer Interconnection, CRIvi,j,k Head in Cell h i,j,k Figure S-Conceptual representation of leakage through a riverbed into a cell. 2-14 r4 pi ,j,k = Epi,j,k,n n=l Qi,j,k N = cqi,j,k,ns n=l the general external Q%,j,k Applying flows and flow term for = pi,j,khi,j,k the continuity from the six cell i,j,k is (21) + Qi,j,k* equation adjacent (2) to cell cells, as well i,j,k, taking into account as the external flow rate, the QS, yields qi,j-1/2,k + qi,j+1/2,k + qi,j,k-l/2 B + qi-1/2,j,k + 9i ,j,k+1/2 + qi+l/Z,j,k Ahi,j,k = SSi,j,k--;;--4rjAciAvk + QSi,j,k (22) where Ahi,j,k ------- is a finite-difference approximation for the derivative of head At with ssi , j , k represents At’jACiAVk Equations give the respect (10) is the through the specific volume of cell (15) finite-difference (Lt-I); storage i,j,k of cell i,j,k - hi,j,k) (L-l); and (L3). and (21) may be substituted approximation mi,j-1/2,k(hi,j-1,k D to time for cell i,j,k + ai,j+l/2,k(hi,j+l,k into equation as - hi,j,k) t CCi-1/2,j,k(hi-l,j,k - hi,j,k) + CCi+l/P,j,k(hi+l,j,k - hi,j,k) + cvi,j,k-1/2(hi,j,k-1 - hi,j,k) + ~i,j,k+l/2(hi,j,k+l - hi,j,k) + pi,j,khi,j,k + Qi,j,k = SSi,j,k(ArjACiAVk)Ahi,j,k/At* 2-15 (22) (23) to The finite-difference Ahi,j,k ------- must next At approximation be expressed 6 shows a hydrograph of equation in terms of head values shown on the horizontal axis: of head at time by the time with interval tm-tm,1; hydrograph slope, )m the time at which approach, in that backward in time There are other we could flow is centered is, the successive it of flow or propagation flow tm. are designated is interval This terms The head by superscript to the time derivative m-l - hi,j,k h;,j,k at which could approximated which is termed over a time the which time; evaluation, terms or over both of error during 2-16 are calculated. a time may cause numerical in a simulation. extends example, at the time however, the and ends with, which for begins extending the a backward-difference interval flow using precedes, be approximated; interval to some later These alternatives, times bh/At over a time and extends precedes head difference derivative, a time from tm, the time at the time growth ' approximated ways in which the are m m-l hi,j,k - hi,j,k --------------tm - tm-1 is evaluated. Ah/ At is approximate evaluation from it. flow the Figure is, or time change in head at the node over which times of head, of time at which An approximation that At Thus the a time by dividing bi,j,k ( ------- Two values is the time these respectively. tm is obtained derivative heads and times. at node i,j,k. and tm-1, associated the time of specific tm, which (23) are evaluated; values at node i,j,k m m-l and hi,j,k, as hi,j,k for calculation interval forward of which and backward instability--that of heads at Head ---------------I I ----------*$yk 11 ---- t -T ../ I I I I II I I /j I i -At, -I t m-l i I I tm t m+l Time Explanation tm h;k3I time at end of time step m head at node i,j,k at time t, -------.*a Backward difference approximation slope of hydrograph at time t, Figure 6.-Hydrograph 2-17 for cell i,j,k. to In an unstable situation, at a particular progresses, the until will introduced For this they to large each time Equation approach diminish systems of equations terms time derivative which flow, equation calculation By contrast, stable--that is, at succeeding times. is preferred must be solved interval, interval even though simultaneously for to tm; that the is: m - hi,j,k) + CRi,j+I/2,k(hY,j+I,k - hy,j,k) + Qvi,j,k+I/2(hy,j,k+I m m-l - hi,j,k) (hi,j,k = SSi ,j ,k ( Arj ACi Avk)-----------------tm - tm-1 of the partial Like the term equation differential the Qi,j,k, which (24) can be used as the equation of ground water coefficients of the various in equation (24) are all known, as is the head at the beginning m-l The seven heads at time tm, the end of the time of the time step, hi,j,k. head terms step, are unknown; represents this type is only equations that is, Thus equation predicted. a single they (24) equation can be written for one unknown head for in it form by specifying and approximating tm,I is a backward-difference a simulation (1). as the - hF,j,k) + %,j,k + pi,j,khT,j,k for any reason result. in backward-difference - hy,j,k) + cvi,j,k-I/2(h!i,j,k-I basis numerically approach can be rewritten cBi,j-1/2,k(h!l,j-1,k (24) the for heads are to be computed. of head over the Equation time progressively at tm, the end of the time flow dominate is always backward-difference (23) the calculation at each succeeding the at which enter completely at any time reason, which increase finally backward-difference errors leads time errors "n" unknowns. are part cannot of the head distribution be solved in seven unknowns. each active each cell, cell independently, However, Such a system 2-18 with can be solved since an equation in the mesh; and, we are left to be since a system it of there of "n" simultaneously. The objective distributions boundary of transient at successive conditions, The initial-head is, finite-difference Values the time is taken time 2 Of hi,j,k as 2, while is taken is, k - hi' j,k) Y ¶ and the external of hf,j,k (25), axis in the solution t2, therefore, which the superscripts and should stresses. beginning of the is divided process which in in the is to marks the end of the head superscript appears in only m one head becomes + CRi,j+l/p,k(hf j+I k - hi' j k) , , , Y - hi' j k) + Cvi,j,k+l/E(hf Y Y + Qi,j,k the at each point of head at the heads at time therefore = 55i,j,k taken step head head distribution, which the time The equation j k-I , , + pi,j,khf,j,k are into The first --that initial to predict j k - hf j k) +CCi+l/Z,j,k(ht+I Y Y Y Y + cvi,j,k-1/2(ht where again values m-l, j-I Y +CCi-1/2,j,k(hf-I steps generally a value the superscript as 1. CRi,j-I/2,k(hf the In equation step. the parameters provides provides process. Calculate term, it is given the hydraulic of the discrete first times, distribution the mesh ---that first simulation j k - hi j k) Y , Y Y j k+I , , - hi j k) , , 1 (Arj ACi AVk)(h:,j,k - hi,j,k) -----L---------------~~~~~~~ t2 - t1 1 and 2 refer not be interpreted (25) to the time as exponents. 2-19 at which the heads An equation which of this head is free of equations to vary with is solved have been obtained, 2 as time the process step. subscript t3; set of equations at time as necessary to cover It is reformulated step the for to note that step; is the end of the and the heads at time to obtain equation t2. (25) subscript is m. is continued Again, the now a system heads at time the head as many time steps the set of finite-difference that is, at each step which equations there is is a new system The heads at the end of the time this system must be solved; are among the known terms repeated t3, reapplied, to obtain for system When these heads at time simultaneously to be solved. of the step process cells), range of interest. make up the unknowns for solution process the time equations beginning repeated is solved This at each time of simultaneous the in the mesh in where the unknowns are now the t3. important cell (variable-head for is every m-l and 3 as time is formulated, distribution for To do this, of equations and this time simultaneously end of the second time using form is written at each time in the step yielding the heads at equations. a new array The of heads step. Iteration The model described the solution In these step to the methods, is started in this system the report initiated calculation by arbitrarily head values which which these step. the end of a given time value, values, with then take of calculation 2-20 for each time A procedure estimated head values and the procedure a trial step. agreement methods to obtain equations of head values assigning are in closer These new, or interim, assumed heads, alters iterative of finite-difference head at each node at the end of that then utilizes for or estimate, of calculation producing the system the place is for a new set of equations. of the repeated, initially producing the is of a third set stage producing system "iteration." during for for which the number, of the end of step m; Tim,* would array also of final head values shows the array the array for of final step Tim-1~~ (where again closure). represent for The head values they it in this (24)-- in the calculation heads for which the time iteration computed were initially appear 7, a total array is designated for appear the preceding of heads for time step, 2-21 step Thus for the in the assumed for in the of n iterations step fim~n. 7 time for in the storage term of m-l hi,j,k on the right side for which m. the Figure were required t ime step is m; thus the end of the preceding n iterations symbol, second indicates of iteration, step are by an array of values are used in the term equation represent the time is assumed that (24)--i.e., arrays the heads at the end of time head values equation head the head array. computed in the first closure one interim the of values The head values paragraph. head indicates produced In the example of figure l?',o. to achieve which in of interim 7, these while m, to begi n the process step designated are calculated, iteration and so on. the end of time arrays superscript would is utilized each identified lattices, an by succeeding containing In figure the which in a subsequent step, each array satisfies values behaviour a time The first the array second iteration; This at each is termed heads approach node in the mesh. the heads in the array Tim,* represents required for in succession, or level, more nearly as discussed iteration, two superscripts. successively, the changes produced of equations, as three-dimensional bearing array interim the calculations each active repeated of the calculation become very small. are generated represented li, the set when to stop Thus, values as the is heads which Each repetition of calculation determining procedure of interim Ultimately, satisfy stages value a new set of equations. exactly This of head values. of Recause they computations have c hm+l,o qp ---------- Initial Trial Head Values for Time Step. m+l (Set -m+l.o= firn) h Start Time Step m+l -Be End Time Step m The Criteria for Terminating Iteration for Time Step, m is 1 iv” - iP”-’ 1 5 gitit~lyd fp,n c,os”re Final Head Values for Time Step, m. After n Iterations Criterion hm,n-I Interim Head Values After One Iteration fp.0 Interim Head Values for Time Step, m, after (n-l) Iterations Step, m Initial Trial Head Values for Time Step, m (set pw = p-1 ) Start Time Step m End Time Step m-l h-ml= -ml.n h Final Head Values for Time Step, m-l Figure 7.4terative calculation 2-22 of a head distribution. already for been completed, time time step step. they m; thus they Similarly, constants Ideally, retain the in the storage one would like the solution iterating specify level After absolute it is less value exceeds and the 'criterion comparable a value level of accuracy values m+l. stop when the However, method of specifying termed is specified when to is to the "closure by the user. The largest the closure criterion, criterion, iteration is terminated is said for that iteration calculated is an order of thumb, of magnitude if to have "closed" step. is adequate. head, If continues; time to a level As a rule criterion. of these criterion. iteration to change in computed that because from one iteration quantity, the closure criterion Normally, Note that and that values of of accuracy it is wise to use smaller than the in the head results. herein per time maximum number of iterations, step solution. nodes in the mesh. necessarily desired m are used as of computed head change in that when to stop The program described number of iterations which process to the closure of closure criterion," refers head are not themselves step time iteration is compared with method of determining the closure a certain all than the closure or "converged," this for head change values largest than absolute are examined for to the exact an indirect time equation of the The method most commonly employed must be less each iteration, calculations that in the in each iteration in computed heads occuring or "convergence iteration this is unknown, the changes to the next criterion" close constants of head for to specify must be used. that values term during heads are suitably stop the same value final calculated actual appear as predetermined step. the also incorporates If closure iterative 2-23 is process a maximum permissible not achieved will within be terminated this and a corresponding message printed designated per time in the output. HCLOSE in the model input, while step is designated The initial of figure would eventually initial than heads computed values the for array Tim-l~n iterations, for are complete, user for succeeding final time estimates step. of head, of head are transferred initial estimates, Head values for beginning of the or trial to be equal and to provide of convergence. Chapters basis first in this the report, initial to the trial Thus in figure obtained the time after for 7, n step m-l array wso, heads at the end step in the heads specified of various including and Molz (1971). discussions, an introduction of iteration for to the for of by the simulation. references, one of these choice calculations values, the end of the of the mathematical in many standard When the process be much greater are used as the same values review reading would these reader rate step iterative of the In the model described the and Remson, Hornberger role the work required the end of the (1977) the regardless Tihs" be chosen according the step m-l. Discussions be found same result are assumed initially the Theoretically, end of each time contains step m, in array could end of time step m. simulation or they the and used as the of time to the others. the of head for arbitrarily, although for is the maximum number of iterations the end of time conventions. converge head values, some choices of head for be assigned to a number of different criterion MXITER. estimates 7, could The closure both to such topics parameters, In particular, 12 and 13 of this and the 2-24 methods may Peaceman (1977), It is suggested Crichlow that to? clarify general as the use of matrix influence such a review report. iterative of various is the concepts notation, factors recommended prior on to c An iterative D the system of this of finite-difference which solutions each step, these discrepancy for be given this point are increased. solution be only with regard storage The model described options for iterative and is organized disruption it solution so that of the program is convenient D and all the current step time terms for and time-step even if it time would that are on the accuracy, are generally 2-25 normally and present. all are grouped side. nt @i two diffe equations, may be added without scheme of solution are independent right-hand a formal hydraulic incorporates (24) so that step In Solution presently Whatever equation heads at the end of the current of the equation, error. in that schemes of solution structure. of equation of the set of finite-difference alternative to rearrange that be obtained, boundaries report The to the system the truncation are seldom known with in this at and the head h(Xi,yj,Zk,tm) in the field, of Equations even if (1)). as the mesh spacing could to hydrologic Formulation (equation must be recognized equation closure an approximation of the differential to become greater of were obtained by the solution is termed to conditions and specific uncertainties solution the to note that be only of flow solution the accuracy including important node and time, it step; equations given and time, of the differential conductivity hy,j,k, Finally, an approximation is equation a given tends factors, it to the each time would themselves by the formal error for of finite-difference solutions corresponding general, However, of the differential equations which would length exact an approximation upon several between the head, difference the set only equations is employed. to the to the solution for yields approximation.depends criterion exact procedure terms on the is employed, containing left-hand side of head at the end of The resulting equation is m m + CRi,j-1/2,khi,j-1,k j ,k-1 t CCi-1/2,j,khy-l,j,k Cvi , j ,k-1/2hi, + (-CVi,j,k-l/2 - CCi-1/2,j,k - CCi+l/2,j,k - Cvi , j ,k+1/2 - CRi,j-1/2,k - CRi,j+l/2,k + HCOFi,j,k)hY,j,k t CRi,j+l/2,kh!l,j+l ,k m + CVi,j,k+l/2hi,j,k+l + CCi+l/2,j,kh~+l.,j,k (26) = RHSi,j,k where HCOF. ~,j,k - SCli = 'i,j,k = - %,j,k SCli,j,k = SSi,j,kArjACiAVk. equation for system (LVl) - tm,1); - SC1,i ,j ,khy;: RHSi,j,k The entire ,j ,k/(tm ,k/(tm - tm,1) ; and (LWl) (L2) of equations each variable-head of the cell form of (26), wh ich includes in the mesh, may be wr itten one in matrix form as CA1{h) = (9) where [A] equation at the is a matrix (26), end of time the constant this for report a series (27) of the all active step terms, RHS, for assembles the of subroutines, comprising [A] the matrix equations m for coefficients of head, nodes in the mesh; {h) all all vector nodes of the mesh. {q) for transferred the vector to modules Ih) . 2-26 of of head values of The model described in {q) which side is a vector and the terms that The vector left is a vector nodes in the mesh; and {q) or "modules". are then from the comprise [A] through and the terms actually solve Types of Model Cell In practice, the form of cells it (24) is generally for is specified and Simulation every cell in advance unnecessary in order to simulate In the model described are grouped into two categories-- cells. Constant-head specified steps flow of the into tion. this in advance, The remaining report, vary with cell to represent figure along cells is always been used to delete The figure also may be used, major surface constant through water inflow for features. head is through are those step all for system time which of the cells Other in and free varies terms terms. 2-27 to for of equations each must in the simulation. boundaries. superimposed no-flow array along boundary no simula- cells on an array shape, cells beyond the one section is with or through head, of whereas have there- aquifer of the in direct conditions, herein For example, is of irregular of the or areas where inflow source type (or (24) must be formulated where the aquifer source the are unspecified in outline; the portion the use of external and external The aquifer rectangular example, which “variable-head" hydrologic boundary shows constant-head these of this are used in the model described various the model. step conditions and "inactive" in any time form of each time and no flow for the model array cells of the of of certain cells value cells by heads which for conditions generated specified or no-flow 8 shows the map of an aquifer cells fore at this in the mesh, and the resulting simultaneously Constant-head for are those of the mesh, termed An equation variable-head report, cells is permitted, are characterized time. be solved cells in this cells Inactive or out of the cell an equation the boundary "constant-head" and is held simulation. to formulate in a model mesh, as the status of the problem. "no-flow") of Boundaries boundary. boundary; contact such as areas with of can be simulated a combination of no-flow Explanation - Aquifer -- - Boundary Model Impermeable tal ........ Boundary Inactive Cell cl ........ :i:i:;:f:;:i:;:i Constant-Head ........ ....... Variable-Head Cell Cell Figure 8.-Discretized aquifer showing boundaries and cell designations. 2-28 Conceptual Aspects The model described in the horizontal columns cells contain direction to be used, or embody the to explicit reading ways of viewing vertical the flow vertical aquifers or permeable shows a typical to both there no attempt this leads, into segments desired along in the --in is followed arbitrary which in preference two different first leads between geohydrologic is made to make the mesh conform the model layer varying to a deformed thickness mesh. B 2-29 Figure 9-a according viewpoint, to rigid extreme, individual of the model. mesh on the geohydrologic correspondence in part At the opposite to represent as an of governed has been discretized to the viewpoint simply process vertical, results. sequence which The first the layers 9-b according to simulate in effect, of the parameters to accomodate as an effort Under the second viewpoint, variable, approach more or less three-dimensional irregulaties. of the Discretization can be visualized zones by individual to the second. model layers, the width hydraulic in order can be viewed may be a general sidered This discretization geohydrologic of an orthogonal is, number of in the model by specifying and by specifying thickness vertical interpretations according (that of space the row or column). is handled thickness. resolution discretization discretization discretization. system vertical handles the number of rows, to the of area1 discretization--a dividing by the layer of layer At one extreme, extension by reading transverse vertical number of layers document Discretization of each row and column in the direction space in the in this direction and the width of Vertical and in 9-c superposition system; layers while and to stratigraphic thickness' is con- of geohydrologic units; ........... ........ ....... .:.......... ....... ... ........ _: .:. ’ ....... .. : .*......r\.*:.: -‘-:**,.Coarse.‘.’ .... (a) Aquifer Cross Section Grid Layer 1 Cell Contains Material Grid Layer 2 from Three Stratigraphic Units. All Faces Are Rectangles Grid Layer 3 (b) Aquifer Cross Section With Rectilinear Grid Superimposed -la Grid Layer 1 Grid Layer 2 Cell Contains Material from Only One Stratigraphic Unit. Faces Are Not Rectangles Grid Layer 3 (c) Aquifer Cross Section With Deformed Grid Superimposed Figure 9.-Schemes of vertical discretization. 2-30 Each of these B has advantages, based on the dual cells, methods and each presents hydraulic or at least that meaningful for greater within likely conform accuracy which under the configuration model equations aligned l with departures model layers for the model axis. is also On the hand, the deformed of the necessary viewpoints boundaries to use more than simply more the may no longer conductivity is always to achieve discretization have may not be introduced illustrated in figures conform to geohydrologic one layer the schemes turn by these resolution are of uniform thickness, and each could deformation nor fully vertical within each unit. of the mesh. each unit Similarly, is figure sands is sustained from storage in the of storage required, clay. release several separated flow if in any of the layers; in the be represented However, information If by vertical the objective in the Figure results. by a clay; the by a single fully flow layer horizontal in which of water of represent pumpage released is to determine model layers 10 units on the direction system of analysis clay, several 2-31 may be must be used to 11 shows a sand-clay partially it geohydrologic is neither layers For example, contacts, a single required of two sand units out to be a com- 9-b and 9-c. to simulate consisting pattern upon which cells axes of hydraulic shows a system from the other individual Some error many vertical even where layer flow to inter- from assumed conditions. bination without More- and this example, and the major 9-c. correspond to many of the assumptions are based; In practice unit, as in figure to be met is negligible, of 9-c. to conform faces, if indivi- parameters are more likely units are within or integrated conditions can be expected head loss are uniform average these process The model equations properties to geohydrologic vertical mesh of 9-c fails rectangular each cell; discretization difficulties. that when model layers vals the vertical assumption can be specified over, of viewing would be the Sand Clay Sand Figure lO.-Possible pattern of flow in a cross section consisting of two high conductivity units separated by a low conductivity unit. 2-32 Layer Sand Clay Sand Figure Il.-A cross section in which a low conductivity represented by six model layers. 2-33 unit is required hand, only to represent figure flow used to represent each sand, conductance tization.has sometimes The approaches step. the various been termed the this as noted above, the user. (24)) in confined product of hydraulic conductivity storage coefficient, the product is also used. hydraulic as head minus bottom calculated as hydraulic layer thickness and head. contains can vary Chapter a discussion corresponding layer, for to vertical elevation, times from cell to cell 5, which describes of the formulation 2-34 rather, specified which by is the is specified; and layer bottom is is then thickness. depending on bottom of conductance and thickness saturated Centered and thickness, elevation Saturated ways of conceptualizing is (hvk of and transmissivity the Block and by the program; storage each cell. results, discretization layers thickness, at in general, document coefficients aquifer conductivity to the various in this lead to in the way of the transmissivity, of specific are input calculated layers and layer For an unconfined conductivity hydraulic discre- simutaneously and, resolution read explicitly is embedded in various For example, the by approach. arise are formulated of individual is never simply above all approaches in may be to vertical described approaches the thickness model layer three-dimensional" The model described l any of these 1 and equation thickness terms occurs and flow which must be solved to be solved, results. of implementing figure "quasi among these and storage release horizontal, approach discretization The differences of the storage may be represented This of the form of (26), On the other case a single the clay layers. in the number of equations in that, while between conductances the accuracy in which In this to vertical a set of equations system vertical. the vertical capable as shown in the figure. in the sand is essentially is essentially each time unit, 12 shows a sand-clay in the sands, the clay that Thus, elevation Flow Package, and storage the vertical terms discretization. Heads in This Layer Are Not Calculated. Resistance in the Conductance Terms Between Layers 1 & 2. Figure 12.-A to Flow in This Layer Is Included cross section in which a low conductivity unit is represented by the conductance between model layers. 2-35 Clay CHAPTER 3 PROGRAMDESIGN Overall This chapter describes program consists dependent the overall subroutines called design of the model program. (MAIN) and a large of a main program of MAIN and explain tions Structure modules. This chapter The number of highly will explain how the modules can be grouped into the infunc- "packages" and "procedures". The functions shown in figure "stress l which Each stress within period, which in turn, time stress into into parameters a series a series of are constant. of time of the form of equation steps. (27) The is Iterative solution methods are used to solve Thus within step. loop, within an iteration prior to entering which pertain a simulation, which there there for are three is a time-step the heads for nested loop, which loops: a in turn loop. in figure the stress to the simulation 13 is termed loop, as a whole. is defined: simulation (transient or steady-state), hydrologic options, and the solution Procedure, In the Read and Prepare a "procedure". the program executes to be simulated the Allocate is divided are the head at each node at the end of each Each rectangle problem equations simulation to yield stress-period contains specified a typical and solved step. each time for of simulation is divided system of f inite-difference formulated D The period 13. per iods" must be performed the size three procedures In the Define Procedure, of the model, the type the number of stress periods, the of the In scheme to be used are specified. memory space required Procedure, For example, by the a 11 data that 3-l program is allocated. are not functions of time DEFINE - Read data specifying number of rows, columns, layers, stress periods, and major program options. ALLOCATE store data. - Allocate space in the computer to READ AND PREPARE- Read data which isconstant throughout the simulation. Prepare the data by performing whatever calculations can be made at this stage. L I I Read & Prepare STRESS - Determine the length of a stress period and calculate terms to divide stress periods into trme steps. I READ AND PREPARE - Read data whrch changes from one stress period to the next. Prepare the data by performrng whatever calculations can be made at thts stage Formulate I ADVANCE - Calculate length of trme step and set heads at beginning of a new time step equal to heads calculated for the end of the previous time step. 1 , 3 .! : FORMULATE - Calculate the coefficients finrte difference equatrons for each cell. : f APROXIMATE - Make one cut at approximating a solution to the system of finite difference equations. of the C i OUTPUT should CONTROL be written - or saved Determine whether results on disk for this time step. Send signals to the BUDGET and OUTPUT procedures to rndrcateexactly what information should be put out. BUDGET - Calculate terms for the overall volumetric budget and calculate and save cell-by-cell flow terms for each component of flow. OUTPUT - Print and save heads, drawdown overall volumetric budgets in accordance signals from OUTPUT CONTROL procedure. Figure 13.~Overall program structure. 3-2 and with These data may include are read. conditions, initial conductivity, tops heads (starting specific and bottoms, Certain further Within stress period are also made in this period, length of the time Procedure proceeds the Output heads, budget budget entries recorded, heads, of layer solution scheme. procedure to prepare is termed the the number of time to calculate which until terms, drawdown, is calculated and cell-by-cell volumetric section. terms contains Procedure for a specified head. maximum iteration of the computed Procedure, are printed In the Output budget are printed 3-3 loop In the Budget flow in the and coefficients the disposition terms. are and the heads At the end of the determines in a subsequent 13); equations or until that recharge, and the Approximate reached. flow data (figure the conductances is achieved is all of each time The iteration (27), and cell-by-cell and the step (NSTP) in the length and area1 to the system of linear Procedure are calculated as explained determines by equation iterations Control the Procedure, are initialized. closure steps loop is then entered of the time step a solution number of allowable loop, procedure such as pumping rates The time-step the approximates Iteration procedure information each node as required which loop the first In a second Read and Prepare Advance Procedure, for period In this to a stress the Formulate elevations calculations and certain are read. the start coefficients, hydraulic by the specified read and processed. for storage transmissivity, required the stress Procedure. pertain heads), boundary processing. Stress step yield, or some of the following: and parameters preliminary data for all or Procedure, or recorded. As shown in the preceding for the overa 11 program of the indication also within itself most of which required. for do that termed "secondary" according to 1, modules various the procedure can also modules required algorithm into package which the Well it The work of figure 13--is of call determine performed The modules a module is do the work of in the directly statements, whether does not itself proper sequence by the main program are called the these they by other modules to are are termed example, (Modules packages are required hydrologic process in all or solution The procedure is perform. SIP Package) hydrologic modules indicates required simulations, 3-4 (for includes example, or solution on the other be active only and while package of The will most are needed only in the . the operation modules simulation; Chapter those process by the main program in the in are both useful. which method embodied classification, As noted of understanding are called be grouped where a package a particular of grouping for to or the two methods 13 are implemented can accordingly by "packages", In terms of a package which in figure help simulation. simulation. user.) indicated Package, to incorporate are part by the that and an are implemented; sequence and the modules be grouped classification, in a given various procedures, by the main program. which are called procedures modules; Package, the model, the those modules; individual River tests chart modules. Thus the through called a flow of the model. rectangles the main program Modules which "primary" the various procedures an organized to "IF" calls 13 provides the main program is simply merely work. those or modules, are coupled it of the within Accordingly, simulation; the chart subroutines, main program a list in which the procedures--i.e., by individual figure structure, sequence a flow provides discussion, if they some when the is hand, specified defines the specific function modules of the allocate package. allocates the few options in the relatively small increase, to complete Allocate the indicates that package. Entries utilize secondary modules the for procedure submodules the which to accomplish are available of primary which used in a single few packages package. are is handled specified modules (i.e., by a by the user are called is not a subscript only "U" indicate utility to many packages. ‘3-5 required modules in the primary function; modules called in indicated modules submodules package. which are Entries utilize are secondary by to procedures, absence of an "X" in a single primary modules and An "X" is entered "S" indicate their by procedure 14 correspond to packages. in question tasks; of modules a module exists; are utilized their is to each of these and more modules rows in figure in accomplishing subscript Procedure; As the options correspond marked with modules marked with of a matrix of the matrix whose function Procedure the classification columns of other task. The horizontal vertical modules relatively the simulation, space allocation in terms each block which enter functions the arrays Allocate number of modules. the main program). while and the 14 illustrates by package for are specified, simulation, the Figure which under the space required more packages to the several or features involved in relation For example, space are grouped modules If of the module utility modules Flow Component Packages Solver Pat kages Stress Pat kages 6 A S Procedures B C F WRRDEGSS E C I R V H I L H V N T B P 0 R x x x x x x x x x x Xs Xs Define (DF) X Allocate (AL) x x Read & Prepare (RP) xU Xus X Stress (ST) X Read & Prepare (RP) xu x x xu x i Advance X (AD) Formulate X (FM) Approximate XS x x x x x x (AP) Output Control Budget (BD) Output (OT) (OC) X Xus Figure 14.-Organization packages. of modules by procedures 3-6 and The primary cates both the three characters number, modules package last 14, a module is indicated module is designated that the module is part that it for allocate the the a package ments, version a different modified Figure matrix modules that primary was used in figure submodules 14. are utilized is to data. The number module designation place to effect to distinguish modified modules the versions. arranged As in figure improve- in the same 14, a subscript "S" and "U" indicates that utility are utilized. Submodules character are designated is always designating number, or from other that well is modified from the original Thus function of the six-character be used in this AL, of specified particular would WEL, indicate package. simulation memory used to store If the package Procedure. two letters, in that the and its 15 shows the names of the format indicates number. with version in figure letters, the last indi- The first For example, Procedure wells, place belong. is a package three Package; deals which Package and Allocate Allocate that fourth integer package the fourth Well Well as through in the they the procedure. the space in computer one appearing to which package, of the performs or input, to a convention as WELlAL; the first module is one of those withdrawal is the two indicate This this and the procedure designate and the indicate are named according the the package letter "S". in version for one of the indicating example, the Block-Centered 3-7 name in which is followed mnemonic to distinguish of the same package; is a submodule This name, a numeral and a one-character submodules by a six-character by three the the first characters package version the module from other secondary module "SBCFlC" Flow Package. Utility Packages I I BAS P R 0 C E D U R E S I BCF Define (DF) BASl DF Allocate (AL) BASlAL BCFlAL Read 8. Prepare (RP) BASl RP, BCFl RP,, Stress (ST) BASlST Read 8. Prepare (RP) Advance (AD) BASlAD Formulate BASlFM (FM) Approximate BCFlFM, I WEL WELlAL I I RCH RI’/ DRN EVT GHB SIP SOR RCH~AL RlVlAL DRNlAL EVTlAL GHBlAL SlPlAL SORlAL SlPlRP SORlRP WELlRP RCHlRP, RlVlRP DRNlRP EVTlRP” GHBlRP WELlFM RCHlFM RlVlFM DRNlFM EVTlFM GHBlFM (AP) Output Control (OC) Budget (ED) Output (OT) BASl OT, I Figure 1S-Primary modules organized by proceduie and pat kage. 3-8 I I modules are designated mnemonic. which For example, the 1 lists the real various the three-character and provides a brief "U" followed secondary reads two-dimensional Table gives by the letter module "UPDREL" is a utility packages description solver packages; those which each cell. This formulates the category internal packages or boundary describing flow are those which difference category, and the which between implement This one incorporating utilizing a variety However, approach, Centered for describes categories formulation of the entire packages, certainly of internal for example, be developed Flow Package. 3-9 utilizing Each of the external packages systems of finitein this of solution, The only Basic package Package, which simulation. option flow which the coefficients Procedure is the described terms in this in the equations. a point and used in place for and flow two packages Overrelaxation. in support equation The solver of the Implicit are a particular stream. Flow Package is the only the alternative could Strongly any of these of tasks The Block-Centered documentation documentation the packages packages. solution a stress between cells describing cate- and the packages, Package calculates for Slice-Successive into flow and a surface algorithms packages Flow Package, of stress the River scheme, Two major finite-difference (describing the coefficients a cell publication, component Block-Centered subcategory example, equations. other The flow the terms and the for does not fit addresses flow component component of the includes formulates flow; of flow the coefficients to or from storage); stress the category flow may be recognized. calculate in this of the package operation. of package may be recognized--the subcategory documented used in the module designation gories package module arrays. abbreviation within by a five-character centered of the Block- Table 1 .--List of packages. Package Name Abbreviation Package Description Basic BAS Handles those tasks that are part of the model as a whole. Among those tasks are specification of boundaries, determination of time-step length, establishment of initial conditions, and printing of results. BlockCentered Flow BCF Calculates terms of finitedifference equations which represent flow within porous medium; specifically, flow from cell to cell and flow into storage. Well WEL Adds terms representing to wells to the finitedifference equations. Recharge RCH Adds terms representing areally distributed recharge to the finite-difference equations. flow River RIV Adds terms representing flow to rivers to the finite-difference equations. Drain DRN Adds terms representing flow to drains to the finitedifference equations. Evapotranspiration EVT Adds terms representing the finite-difference tions. General-Head Boundaries GHB Adds terms representing generalhead boundaries to the finitedifference equations. Strongly Implicit Procedure SIP - Flow _ Component Packages _ Stress Packages ET to equa- - Iteratively solves the system of finite-difference equations using the Strongly Implicit Procedure. - SliceSuccessive Overrelaxation SOR Iteratively solves the system of finite-difference equations using Slice-Successive Overrelaxation. 3-10 Solver Packages Similarly, additional algorithms, could simulation (or solver be added, must include a suitable depend on the are totally Basic other packages. loped for addition If an entirely modules influencing in proper problem. of the three of an individual sequence) of the in such a way that involved Every packages. Flow Package Beyond this, the new package solution Block-Centered package. the exception or removal stress the have been designed with different are at the option processes each of the procedures those Package, in a simulation independent; above, additional and a solver hydrologic noted call the in the program incorporating as could replacement) ages to be included modules packages, the user, packand will The individual the packages required packages package has no effect is desired, modules on can be deve- (and the main program modified without affecting other packages to of the program. Figure all 16 shows a detailed of the primary modules or not each module tion all with beginning tion tions, design flow of the during determine an appreciation of the model is such that simulation, whether in conjuncof the over- conductances takes place depend upon saturated Flow Package, be developed. formulation although The lateral 3-11 the conductance (26)) and are reformulated Reformulation Block-Centered indicating of the model. only readily which 16 may be studied 1, for At present, age could the tests Figure change at each iteration. by the of the main program, (CC, CR, and CV of equation solution. where the with 13 and 15, and table and operation The overall cell-to-cell together chart is to be called. figures structure flow terms are formulated if necessary only conductance situa- which may of conductances again, at the at each itera- in unconfined thickness, is done a replacement terms for pack- (CC and CR Figure 16.-Overall program structure showing all primary modules. 3-12 in equation nodes, tical (26)) using are computed parameters conductance is specified solver specified terms package, for the are stored HCOFi,j.k formulation is done progressively, process of each iteration, throughout the the mesh. interval which equations for active with that of HCOFi,j,k The Block-Centered - tm,1) tO at each node. RHSi,j,k given by an expression (constant) stream and adds the until each package transferred arrays time to the step, value nodes in the mesh. calculates package. that nodes. The solver are affected and adds terms At the beginning adds the term and adds the term by flow (hs-hi,j,k), This with sums the 3-13 process continues contribution the three heads at the identifies of HCOF at each node to create to HCOFi,j,k, -Psi,j,k to HCOF The HCOF and RHS arrays together which from a stream, where h, is the h, to RHSi,j,k. package This are set to zero package adds the term containing IBOUND array, are i ,j ,k package, and the (26) hm-1 node of the mesh. solver are solved. of equation by the user has added its (CC,CR and CV), an array and active the -Psi,j,k specified and RHS at each indicated then the River term (27)) at each node, of the form Psi,j,k head, constant For cells passed to the Flow Package then -ssi , j ,kArjACiAVk ----m-----------tm - tm-1 which The various nodes. and RHSi,j,k to HCOFi,j,k the ver- information are ultimately as each package associated values -SSi,j,kArjACiAVk/(tm between between cells; using (equation all intervals individual and the term RHSi,j,k anew at each iteration, the particular the is calculated in arrays formulated for (26)) vertical where the matrix The coefficient means for by the user for (CV in equation directly conductance as harmonic six a single conductance beginning constand head, conductance coefficient are of the no flow terms of hi,j,k and (corresponding to the term in brackets one iteration solution array, of the solution procedure the the program stored in Chapter in terms packages. discussion of each module included describes of a particular and listing Array As noted dimensional out used in the one-dimensional assemblage The size water document Each of these including chapters and of this calculations, in the model, contains a listing The remainder budget discuss space and provides a brief of the main program. Boundaries and Aquifer Boundaries 2, the model may be visualized of cells, each cell associated of the model array in terms with s specified of a three- a node of the by the user in terms number of rows (NROW), number of co umns (NCOL) and number of layers (NLAY); these a rectangular terms define box. In formulating conductance surface cell-to-cell of this terms a three-dimensional rectangular conductance array. term a conductance term for of cells interval for to the is developed (NCOL), but not for Similar are established the for 3-14 the equations, flow the interval form of cell-to- on the outer along interval opposite interval in the other in the of cells Thus considering (NCOL-1) and column conventions the exterior is developed the array the finite-difference are omitted 1 and column 2, but not for similarly, arrays of a single in the package. are handled in Chapter model array. cell and carries 13 of this package, the way boundaries, and input-output description 4 through of individual description of the as segments 1, Chapters a detailed allocation The various procedure. are actually (26)), "X" array. As noted chapter in equation a row, a between column side of column 1; between column beyond column two directions, (NCOL). so that in effect B the array cell flow is occurs. bounded externally If these embedded in the program, they can be relied boundaries boundaries impermeable character. by specifying head, by using cells and external further cell will external stress representing is formulated; to a constant-head constant-head cell. from the inactive between an inactive As pointed thus cell B with this portions of the array for no-flow box. which shape, fall while interval layer stress example, terms seepage. (26) is formulated cells, each variable-head cells, flow for no equation cell adjacent to and from the no equation is simulated is formulated, cell for flow to or across the interval cell. as initially Where the inactive 3-15 no cell-to- above the uppermost terms--for of any adjacent outside 2, and is from above is frequently a term describing no flow rectangular be noted that the of no-flow in Chapter For constant-head the model array has the form of a rectangular however, not be of a simple a combination of the form of and any adjacent out above, coincide for this in the equation cell; also external For inactive and no term appears or will or by using or stream contains In general, aquifer or constant- the equation cell those as no-flow in the mesh. however, in form, along the array equation cell by the user. in the aquifer, within into evapotranspiration each variable-head condition are actually must be simu- are formulated A finite-difference boundaries This was discussed in the model through which boundary should flow no cell-to- the aquifer terms. of the model array, represented the no-flow terms, It which cases, cells stress terms impermeable be irregular below. conductance with In these across of the model array, intervention certain discussed layer coincide further the aquifer lated boundaries upon to simulate without by planes the limits cells aquifer generated of an aquifer always do not may be used to delete boundaries; this was discussed through constant-head bodies an example cells which aquifer Well level which are characterized may be simulated Package, nodes just varies the in proportion boundary. specifying artificial streambed cell the boundary, a way as to duplicate Constant-head guished array cells, one element for a given by a constant rate of flow a no-flow boundary for cell where these again conductance values inactive cells the with rates General are applied the to which Head Boundary to nodes just Package would involve values at each chosen in such relationships. and variable-head in the model through the in the mesh. the type or out of the are deliberately head-flow Bound- by inflow and stream-head required indicates into characterized using water the aquifer. or recharge Use of the River each cell as surface in conjunction withdrawal Boundaries where these the from one another contains with boundary. to a no-flow along contact appropriate Package, in the same example, such features to head can be simulated Package or the River interior As noted are in full using by assigning inside 2. may be used to represent of constant aries in Chapter of cell cells IROUND array, The entry are distinwhich in the according IBOUND to the following convention: IBOUND (I,J,K) IBOUND (I,J,K) IBOUND (I,J,K) < 0 . . . .Cell = 0 . . . .Cell > 0 . . . .Cell The IBOUND codes are initially the codes are adjusted by the user specified equal and with as active so that specified they intermediate but are given a water budget. In this report, are consistent cells head head user. with For example, transmissivity Volumetric inflows is constant is inactive is variable by the results. to zero are changed to inactive A summary of all I,J,K I,J,K I,J,K If other necessary, data specified cells which are and vertical-leakance values by the program. Budget and outflows the water 3-16 to a region budget is generally is termed called a volumetric budget B thus because strictly it deals speaking been used in reference model program the on the attained. should also Each flow flows and flow flow storage process, are all as printed is also effectively effectively in itself, involves acceptability equal budget and in this is, the is calculated sense may solution. into flow its own contribution part does not include to or from constant budget regime. 3-17 of water budget from the to the flow--even the transfer internal into head cells, terms. of the overall removes water adds water to the or out of the model as a whole. in the overall considered is Continuity should the water in the output flows solution by the model actually outflow process, of a valid to the may stop and out of the model--that and total solution included solvers each model cell. In the model program, budget in storage release ground water into to or from rivers, to wells accumulation for do not always of the overall solved component package calculates and out of storage B flows between model cells--only For example, iterative an indication inflow evidence The total The summarized equations approximation statement of the equation independent budget. provides the total change in storage. provide term has model as a check on to provide simultaneous close between total independently for in particular, continuity for this rates; model reports. the overall and in order The system of equations exist the difference total budget of a flow in other budget for techniques a sufficiently A water budgets although flow system. answer; of the solution. consists a water solution before and volumetric is not a mass balance, to volumetric flow in a correct iterating volumes of water of the solution, Numerical result it calculates acceptability information with Flow into inasmuch flow system, though neither or out of the as and For every time step, rate of flow calculates the simulated by the flow are stored the volumes volumes, stored in the of flow, entering from the in array beginning volumes in the step printed ouflows; inflow. from the of flow. the convention as an outflow In addition, while total step step length. calculated inflows, outflows with to flow, the time are then budget beginning Inflows water inflow above, Cumulative and for the last are from entering storage is treated are printed, and outflow. the requested separately water outflow using and cumula- of simulation form storage and total error , calculated rates are printed released inflow at the times the flow indicated between total as a percent the is printed, volumes each component as the difference printed and time simulation, to print When a budget following is treated of the In addition the model during rate only Plow Package deals to storage. BAS Package uses the and cumulative for of flow VBVL array by the model user. time Most packages deal with VBVL. Module SBASlV in the tive and flow due to the process for each component of Block-Centered and leaving as the product system and outflows VBVL array. but the head cells of water are calculated and out of the The inflows separately to constant module of each flow component package budget into package. one such component two--flow the as an as well The difference is then formula: lOO(IN-OUT) D = iiN;O--Tj72- where IN is the total is the percent the percent error an indication while error cumulative inflow term. should of solution volumes to the If OUT is the total the model equations be small. validity system, In general, for the time are an indication 3-18 outflow are correctly flow rates step to which of validity for and D solved, may be taken they apply, the entire as simulation up to the time end of each stress period There are situations various subregions of the printout. The budget whether or not. requested in which of the model. has been made to save flow terms it is useful individual cells external cell flows to here as "cell-by-cell" four general individual types: cell (1) such as evapotranspiration terms, which net flow cell; the flows, is, between (3) which cell-by-cell adjacent model cells. in subsequent two flags sect ion of the Basic set each time for In addition, each flow the cell-by-cell the types ICBCFL flag in the flow flows--are under the Basic will computed control storage cell faces--that term are to the Output which is set Package input each time is step set, for constant-head in the Block-Centered Flow Package, 3-19 cell-bywhich Three of the four above --storage, flag, if Thus if listed of a single must be are to be saved. a flag set. cell-by-cell ICBCFL, which terms the cell-by- of cell-by-cell a f lag, is also give internal package are to be saved. be saved for in an which The input includes Package input terms terms, individual which any cell-by-cell terms in the To save any of these Package includes package or from an of storage and (4) kinds in the Evapotranspiration of cell-by-cell fall across must be set. computed by that evapotranspiration and internal thus flag cells; paragraphs. component terms the appropriate cell step flow These four in the model input Control for the flows into cell-by-cell or depletion constant-head can and are of represented (2) constant-head for provision so they terms, or flows stresses of accummulation are actually discussed terms, rate flow or recharge; to or from individual cell further give terms These individual flows, due to one of the external model, individual stress flow on disk to the model itself. cell-by-cell at the such calculations, be used in computations are referred to calculate To facilitate for is printed IBCFCB, in the input cell and to that Thus in general package. set, and ICBCFL is also in the cell-by-cell volumes Cell-by-cell a particular the cell, cell-by-cell water flows are flow evapotranspiration is out of the cell. model cell, for requested. That for flow Package, cells for that is, flow is flow terms even when that for i,j,k cell into would data. The cell, value is is zero, saved,for the cell-by-cell For example, budget and terms if it every flow stress is components, when using values value stress is saved on disk is the River only amount of disk a flow at the flow and negative For many of the Thus the give Cell-by-cell of the model grid can be large; value where For example, i,j,k. the which cell-by-cell by rivers. time, or out of the model, stress. for at most model cells. are traversed water UBUDSV module for external flow of flow. be nonzero at those space required stored for each may be saved at many steps. The cell-by-cell in a variable:head the mesh is storage cell. term An array saved in transient is are saved nor cumulative the into stress the size component flag form to make the most from cell component an array will cell-by-cell model cell time each stress be zero there if values model input for rates term A cell-by-cell each requested will positive this to disk. due to one particular are considered all in unformatted are written if are volume per unit used for out of the model by evapotranspiration flows volumes see the narrative space; stress Only flow step. dimensions are stored on how the data are saved on disk the time neither files; values use of disk information for types are in the same units flow efficient three The flow are included. cell-by-cell set disk volume and time all gives the of these simulations 3-20 net flow terms, if to or from storage one for the appropriate each cell flags in are set. Withdrawal accumulation from storage in storage The cell-by-cell the constant-head cells which contribute all provides representing the net flow portion into The internal value cells. value flow Flow Package for and i+l,j,k), and flow these flow across values (Although flow across flow for they opposite across the right face flow has six three (between layer flows indicates that is sides cell cell only is accounted sides.) of increasing number, These internal cell for i,j,k cell flow terms Each of cell. are required; in the calculations Flows are considered row number, cell-by-cell i,j,k and i,j+l,k), and i,j,k+l). and are considered 3-21 are set. (between and a neighboring three the and constant-head flags face i,j,k across are saved by the cell (between cell neighbors, to those are in the direction directions. face between a given adjacent number or increasing and the net flow cell-by-cell the front the other cells cell the variable-head that each variable-head across each cell (into represent are flow the lower represents value Three such terms of a model cell. terms The cell-by- between that cell in the mesh, whenever the appropriate These three may be each constant-head A positive indicates cell cells. for associated cell. cell-by-cell faces Block-Centered if variable-head flow or the surrounding A constant-head sum of the flows a negative whereas into is always than with is away from the constant-head the constant-head cell a single variable-head of the mesh); individual adjacent the flow This term the flow. the algebraic of the adjacent term gives rather or receive positive, negative. cell. itself, by as many as six calculation cell, cell is considered flow constant-head with cell is considered constant-head out of an individual surrounded in the cell flow positive increasing negative values of column if in the are useful in calculations model, of the ground-water or in constructing In theory budget one could by using in practice flow flow calculate a budget the cell-by-cell flow The cell-by-cell component is the net flow that of the same type, Only the net flow for the cell other hand, a negative budget positive flow and outflow inflow summing individual ponding terms However, either at a cell flows cell at the same cell terms cell-by-cell as calculated the difference of the to the overall is not always a given stress which could include and some positive. disk in the model, are assembled file. on the separately, so that would be added to the outflow the entire values, inflow inflow term term. model are calculated they may differ by the model program between or flow possibly would be added to the for true may be summed for as performed at an individual Thus if subregions is saved in the cell-by-cell and negative flow the budgets some negative calculations and a positive This component, two or more flows In the overall identical terms. value for various vectors. because in some situations differently. into from the corres- in the overall and outflow should by budget. be the same for calculation. Space Allocation Space in the central lists is allocated "X" array. at execution The'Allocate the model which memory of the computer allocates Procedure in a simulation number of cells referring contains a module for package. depends on the type and generally in the grid. to the length in a one-dimensional space needed by that of words needed in the X array required time used by data will array called the each package of The total number range from 10 to 20 times the two statements both of which appear 3-22 and and number of packages The main program contains of the X array, arrays in the first part of the program ation these listing. statements are 30000 in the statements must be increased if In the COMMONX(30000) refers the listing reproduced this and LENX = 30000. to the length storage with of the X array; requirements of the document- The number this problem number exceed 30000 elements. Three-Dimensional The conceptualization designate cell Subscripts for and implementation locations by row, column, Model Arrays sections and layer indices (usually designated as i,j,k), as is customary however, this of indices is not the most efficient subscripts three in the model program. dimensional The order stored array in computer subscripts program. should Typically row, is important when comparing sections memory. of the in the of the program, this array are declared difference 3-23 order order to be in the how data such that for subscripts. are the model the most has been used throughout the column subscript, is J,I,K the model program to the conceptualization report. is J is used for but the order to bear in mind this for determines program row, and layer on most computers; layer, literature; order FORTRANlanguage be in column, and K for order have row, column and layer The design in the report in that in scientific Many model parameters and accordingly subscripts memory access is used for It arrays of array efficient the order of this rather subscript than I,J,K. ordering and implementation I Input The input gathered, element the structure as it of the file file externally the Output an optional output, segments considered input for here as an option, This Block-Centered even though Flow in the number, number; of the a major for generally in terms Basic option. since is presently the addition done of "major are utilized individual only packages; Package are considered package but flexibility The balance it is to statements. Package providing Block-Centered it is is not an individual Basic identifies the output to the the to be is based on an which program which except input name of each input this system generally an option be read. has been done to allow It between the operating which Control, Package is not considered must always unit packages Basic it unit a link They correspond segment of the is also files. program may be discussed of the existing options. the to permit is to be read (or to which through are major request. all program called corresponding purposes, at the user's rather input to the program, these in fact, the is designed from many different FORTRANlanguage and the For input options"; program The user must provide be written). major is needed, from which or output of the Structure is always in a of the utilized and Flow has been treated required in all of replacement simulations. packages for future. c 3-24 One of the first the major options (figure 17) which option is invoked steps are to be used. is by inserting of the IUNIT array; element is set to zero. whether an option data required to the unit B if it number of the file In the main program, the program If procedures. procedure is not called. is called and input is zero, data is of array Package. the value to specify An if the the Drain number the Drain IUNIT array of the element input of the data for (figure array zero, associated is set of the module associated read from the file 18) the package. in several than of the to indicate the unit For example, IUNIT (3) is greater If Basic as a flag IUNIT (3) is tested of which "IUNIT" by the serves the third containing value it serves element is to be used, the is not desired, by the option. the third is to specify number in the appropriate IUNIT array and also data is done using unit an option Thus the Package is not to be used, is set to zero; if input Procedure an input is active, input This read in the Define element containing in organizing with the with the subroutine the unit number. As noted trol option, above, the Basic (BAS) Package, is used for every simulation; Package are always unit number 1 as specified number for Basic required. BAS input exclusive and input Package data in the main program. can be changed to meet the of the Output data (figure If for the Con- Basic 18) are read from necessary, requirements the unit of a particular computer. The first which data present, for the because cell-to-cell always element flow of the IUNIT array Block-Centered BCF is the only terms, must contain the unit number from Flow (BCF) Package are to be read. package available a non-zero entry required. 3-25 for in the first the formulation element of At of IUNIT is Assignment of Major Options to Elements in the IUNIT Array IUNIT Element Number Sample IUNIT Input Record IUNIT Element Number . 13 41 0 0 81 0 0 0 26 0 0 17 , 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 7 8 9 11 12 BCF WEL DRN RIV EVT GHB RCH SIP SOR Output Control Figure 1 ‘I.-Specification Input Is on Input Is on Is Inactive Is Inactive Input Is on Is Inactive Is Inactive Input Is on Is Inactive Input Is on Unit 13 Unit 41 Unit 81 Unit 26 Unit 17 of major options using the IUNIT array. 3-26 ----_-----------------------7 This Is BAS Input Read from Unit 1 Options Are Specified in UNIT. The Locations n IUNIT Are Assigned ---L --------------------------- ._--------------------This Is the First Record on Which User Puts Heading for the Problem This Is the Second Card of the Heading IS Follows: I J 1 BCF package 2 WEL package 3 4 5 7 8 9 11 12 DRN package RIV package EVT package GHB package RCH package SIP package SOR package Output control lunit24. I 1. l. r-----------w-------------, I These are IBOUND Array Values for Layer Two Read on Unit 24 I J L ------------------------ I 1111110 1111111 1 1 1 1 1 l-l --- --------------e--- r---- 1 This Is BCF Input Read from Unit 17. i,,---- ----1 0 17 1 -,,,-,-,----A 10 1. 4. (2OF4.0) 17 .3048 (12F7.2) 50. 70. 90. 110. 125. 0 30.48 . 0001 t 0 . 0oo~oOi 17 l. 5 5 (8i8.3) 7 5 5 6 6 4 i 5 2 135. 140. 6 7 6 5 8 7 6 6 9 7 7 This Is for WEL Input Read on Unit 23 i---,,---------- --------J 1 0 : 3 1 .003 #------------------------1 I I r I This Is RCH Input Read on Unit 57 I L _--_--__-- -------------:, : 0 .00000005 This Is SIP Input Read on Unit 77 L 50 1. Figure 18.-Sample I-I ----c----------------- 5 .Ol input data showing 3-27 1 2 role of the IUNIT array. Most of the data and two-dimensional record" major control option is calls for have the same value, is not necessary array the on the array specified in the control from which the control is a great deal record If values according The unit is read, elements. for the of an array record the elements and it of the are read from the unit to a format which is also number may be the same as that or it regarding the elements control may be different. the organization Thus there of the input data a simulation. a certain to avoid length in units any mixing of ftz/day results and time amount of freedom of units. the use of inconsistent the record record. of flexibility Any consistent gives control the array on the control array. the array as an "array number specified all is specified containing specified for If the array. of one-dimensional containing read from the unit value consist are submitted of records to read the associated records vary, a series record which by the user will Those arrays arrays. optionally, plus, The array submitted will units to the user, There is units. frequency and pumpage as ms/s, of the overall if model data. This must be exercised the program transmissivity the program will to detect is entered run, but be meaningless. structure of information the printing but care no way for For example, Outout The output may be used for Structure is designed to be printed to control or written of head and drawdown by layer volumetric budget. It the also 3-28 amount, on disk. and time step, controls disk type, It controls and the output and printing of head, drawdown, and cell-by-cell the model, or in user-supplied Output Package, Control, receives frequency unit option twelfth element read, output file is specified convention and budget terms is option invoked. printed for some printer output. specified in the main program. of a particular within unit the (IUNIT 12); input default the printer This for unit Basic of the output output the the Output as the information by this is unit IUNIT array, consists the end of each stress All data input identified element to amount and number must be entered from the file This the the the user must specify from which This external programs. contained option, as the twelfth generates requirements and plotting this IUNIT array step, use in calculations from the user to control or channel are to be read. of the for is a major To utilize at each time a zero terms printing instructions of output. Control If which number of the then flow number. a default of head values period. Every goes to unit simulation number 6 as number can be changed to meet the computer. The Main Program The main program-serves in which system for the primary information. modules which purposes: are executed, It does so with name, a module to be executed arguments) two major are accessible and lists and (2) (1) it it controls serves CALL statements the names of data by both the main program 3-29 the order as a switching which fields specify, by (subroutine and the module. The arrangement procedures the shown in the system calls to specific procedure precede of CALL statements modules all other correspond to the 3. chart Set the length dimension of the the output to unit Define the problem stress periods, If the with Note: input for a procedure, X array 6. Read and prepare 7. For each stress if all a CALL must modules numbers in the following LENX should list listing). data be set equal arrays to the to compilation. the Basic Package to unit 1; assign printed 6. in terms and major space in the X and redefine of number of rows, options X array for columns, layers, to be used. individual is not big enough for the data problem, arrays and lists. STOP. (Redimension LENX.) information which is constant throughout the simulation. period: (a) Read stress-period timing information. (b) Read and prepare information that (c) that (LENX) in which prior of one exception: Package, (the "X" array X array Assign 5. in order of the are stored. Allocate Within numbers of the comments in the main program and lists 4. 13). the order The main program calls procedure. tasks, reflects (figure can be in any order CALLS in that the following 2. flow has a CALL to a module in the Basic to perform 1. in the program For each time step: 3-30 changes each stress period. (1) Calculate the current time-step heads from the preceding "old" (2) time heads of the current Iteratively formulate length step time and solve a. Formulate the finite-difference b. Calculate an approximate and move "new" to the array containing step. the system of equations: equations. solution to the system of equations. If c. (3) Determine time (4) (5) 8. the type Calculate overall and print or record Print If criterion has been met, and amount of output stop iterating. needed for this step. overall (6) convergence and/or budget record volumetric iteration fails terms and, if cell-by-cell flow heads and/or drawdown. budget and timing to meet convergence END PROGRAM. 3-31 specified, calculate terms. Print the summary. criterion, STOP. *~**W*t****W**X*t******~*********~**~~******~*~~~~~~**~~*~*~*~*~~* 9/1/87 MAIN CODE FOR MODULAR MODEL -BY MICHAEL G. MCDONALD AND ARLEN W. HARBAUGH C C C C-----VERSION 1638 24JUL1987MAIN1 ************************************************************~***** : SPECIFICATIONS: C -----------------------------------------------------------------C COMMONX(30000) CObt4ON /FLWCOM/LAYCON(80) CHARACTER*4 HEADNGsVBNM DIMENSION HEADNG(32)rVBNM(4,20)rVBVL(4r20)rIUNIT(24) DOUBLE PRECISIONDUMMY EQUIVALENCE (DUMMY,X(l)) E Cl---- SET SIZE OF X ARRAY. REMEMBER TO REDIMENSION X. LENX=30000 C c2--- ASSIGNBASIC INPUT UNIT AND PRINTER UNIT. INBAS=l IOUT= C Q------ DEFINE PROBLEM-ROWS, COLUMNS,LAYERS, STRESS PERIODS, PACKAGES CALL BASlDF(ISUM,HEADNG,NPER,ITMUNI,TOTIM,NCOLrNRCW,NLAY, NODES~INBAS~IOUTIIUNIT) 1 C c4------ALLOCATE CALL BASlAL 1 2 IN “X” ARRAY. (ISUM,LENX, LCHNEW,LCHOLD, LCIBOU,LCCR, LCCC, LCCV, SPACE LCHCOF, LCRHS, LCDELR, LCDELC, LCSTRT, LCBUFF, LCIOFL, INBAS,ISTRT,NCOL, NROWnNLAY,IOUT) IF(IUNIT(l).GT.O) CALL BCFlAL(ISUM,LENX,LCSClrLCHY, 1 LCBOT,LCTOP,LCSC~,LCTRPYIIUNIT(~)~ISSI 2 NCOLrNRChVW,NLAY,IOUT,IBCFCB) IF(IUNIT(P).GT.O) CALL WELIAL(ISUMILENXILCWELL,MXWELLINWELLS, 1 IUNIT(2),IOUT,IWELCB) IF(IUNIT(3).GT.O) CALL DRNlAL~ISUM,lENX,LCDRAI.NDRAIN.MXDRN. 1 IUNIT(3).IOUT,IDRNCB) IF(IUNIT(B).GT.O) CALL RCHlAL(ISUM,LENX,LCIRCHrLCRECHrNRCHOP, 1 NCOLrNROWrIUNIT(8)rIOUT,IRCHCB) IF(IUNIT(S).GT.O) CALL EVTlAL(ISUM,LENXtLCIEVT,LCEVTFbLCEXDP, LCSURF, NCOL, NRW, NEVTOP, IUNIT( IOUT,IEVTCB) 1 IF(IUNIT(4).GT.O) CALL RIVlAL(ISUM,LENX,LCRIVR,MXRIVR,NRIVER, 1 IUNIT(4)rIOUT,IRIVCB) IF(IUNIT(‘I).GT.O) CALL GHB~AL(ISUM,LENX,LCBNDS,NBOUNDIMXBNDI 1 IUNIT(7)rIOUT,IGHBCB) IF(IUNIT(9).GT.O) CALL SIP~AL(ISUM,LENXILCEL~LCFL~LCGLILCVI LCHDCGrLCLRCH, LCW,MXITER,NPAJ?MINCOLINROW,NLAYI : IUNIT(9),IOUT) IF(IUNIT(ll).GT.O) CALL SOR~AL(ISUM,LENXILCAILCRES,LCHDCGILCLRCH~ 1 LCIEQP,MXITER,NCOL,NLAY,NSLICE,MBWIIUNIT~~~~~IOUT~ C c5------IF ME “X” ARRAY IS NOT BIG ENOUGH THEN STOP. IFtISUM-l.GT.LENX) STOP C C6---- READ AND PREPARE INFORMATION FOR ENTIRE SIMULATION. CALL BASlRP(X(LCIBOU)rX(LCHNEW)rX(LCSTRT)rX(LCHOLD)r 1 ISTRT,INBAS,HEADNG,NCCL, NROW,NLAY, NODES, VBVL,X(LCIOFL) 2 , IUNIT(~~),IHEDFM,IDDNFM,IHEDUNIIDDNUNIIOUT) IF(IUNIT(l).GT.O) CALL BCFlRP(X(LCIBOLJ)rX(LCHNEW)rX(LCSCl)r 1 X(lCHY),X(LCCR)rX(LCCC)rX(LCCV)rX(LCDELR)r 2 X(LCDELC)rX(LCBOT)rX(LCTOP)rX(LCSCZ)rX(LCTRPY)r 3 IUNIT(~)~ISS,NCOL,NRCWINLAY,NODESIIOUT) 3-32 IF(IUNIT(9) .GT.O) CALL SIPlRP(NPARM,MXITER,ACCL,HCLOSE,X(LCW), IUNIT(9) rIPCAL& IPRSIP, IOUT) IF(IUNIT(ll).GT.O) CALL SOR~RP(MXITER,ACCL~HCLOSEIIUNIT(~~)~ 1 IF’RSOR, IOUT) 1 C C7------ SIMULATE EACH STRESS PERIOD. DO 300 KPER=lrNPER KKPER=KPER C C7A.ms-m- READ STRESS PERIOD TIMING INFORMATION. CALL BASlST( NSTP, DELT, TSMULT, PERTIM, KKPER, INBAS, IOUT) C C7&---READ AND PREPARE INFORMATION FOR STRESS PERIOD. IF(IUNIT(2).GT.O) CALL WELlRP(X(LCWELL)rNWELLS,MXWELL,IUNIT(P)r 1 IOUT) IF(IUNIT(3).GT.O) CALL DRNlRP(X(LCDRAI)rNDRAIN,MXDRN,IUNIT(3), 1 IOUT) IF(IUNIT(8).GT.O) CALL RCHlRP(NRCHOP,X(LCIRCH)rX(LCRECH)r X(LCDELR),X(LCDELC)~NRCW,NCQLIIUNIT(~)~IDUT) 1 IF(IUNIT(5).GT.O) CALL EVTlRP(NEVTOP,X(LCIEVT)rX(LCEVTR)r 1 X(LCEXDP),X(LCSURF)rX(LCDELR)rX(LCDELC)rNCDLrNRC%‘r 1 IUNIT(5) rIDUT) IF(IUNIT(4).GT.O) CALL RIV~RP(X(LCRIVR)~NRIVER,MXRIVRIIUNIT(~)~ 1 IOUT) IF(IUNIT(71.GT.O) CALL GHB~RP(X(LCBNDS)~NBOUND,MXBNDIIUNIT(~)~ 1 IDUT) C C7C----- SIMULATE EACH TIME STEP. 00 200 KSTP=lrNSTP KKSTP=KSTP C C7Cl---- CALCULATE TIME STEP LENGTH. SET HOLD-HNEW.. CALL BAS~AD(DELT,TSMULTITOTIM,PERTIM,X(LCHN~)~X(LCHOLD)~KKSTPI 1 NCQL, NRCW, NLAY 1 C C7C2---- ITERATIVELY FORMULATE AND SOLVE THE EQUATIONS. DO 100 KITER=lrMXITER KKITER=KITER C C7CPA---FORMULATE THE FINITE DIFFERENCE EQUATIONS. CALL BASlFM(X(LCHCOF)rX(LCRHS),NODES) IF(IUNIT(l).GT.O) CALL BCFlFM(X(LCHCOF)rX(LCRHS)rX(LCHOLD)r X(LCSCl)rX(LCHNEW)rX(LCIBOU)rX(LCCR),X(LCCC)rX(LCCV)r 1 2 X(LCHY)rX(LCTRPY)rX(LCBOT)rX(LCTOP)rX(LCSC2), X(LCDELR)rX(LCDELC),DELT,ISS,KKITER,KKSTP,KKPER,NCOL, 3 4 NROW,NLAY, IOUT) IF(IUNIT(2).GT.O) CALL WELlFM(NWELLS,MXWELL,X(LCRHS)rX(LCWELL)r 1 X(LCIBoU) rNCOLrNROW,NLAY) IF(IUNIT(3).GT.O) CALL DRNlFM(NDRAIN,MXDRN,X(LCDRAI)rX(LCHNEW)r 1 X(LCHCDF),X(LCRHS),X(LCIBOU),NCCLINROW,NLAY) IF(IUNIT(81.GT.O) CALL RCHlFM(NRCHOP,X(LCIRCH),X(LCRECH)r 1 X(LCRHS)rX(LCIBDU)rNCOL,NROW,NLAY) IF(IUNIT(S).GT.O) CALL EVTlFM(NEVTOP,X(LCIEVT)rX(LCEVTR)r 1 X(LCEXDP)rX(LCSURF)rX(LCRHS)rX(LCHCOF)rX(LCIBOU), 1 X(LCHNEW)rNCDLrNROWtNLAY) IF(IUNIT(4) .GT.O) CALL RIVlFM(NRIVER,MXRIVR,X(LCRIVR)rX(LCHNEW)r 1 X(LCHCDF)rX(LCRHS)rX(LCIBDU)rNCDLrNRCW,NLAY) IF(IUNIT(7).GT.O) CALL GHBlFM(NBCUND,MXBND,X(LCBNDS)rX(LCHCQF)r 1 X(LCRHS)rX(LCIBDU),NCCLrNROWrNLAY) C 3-33 ONE CUT AT AN APPROXIMATE SOLUTION. IF(IUNIT(9).GT.O) CALL SIPlAP(X(LCHNRJ)rX(LCIBOU)rX(LCCR);X(LCCC)r X(LCCV),X(LCHCOF),X(LCRHS),X(LCEL),X(LCFL)rX(LCGL)rX(LCV)r 1 X(LCW),X(LCHDCG),X(LCLRCH)~NPARM,KKITER,HCLOSE,ACCLIICNVGI 2 KKSTP,KKPER, IPCALC, IPRSIP,MXITER,NSTP, NCCL, NRwklr NLAY, NODES, 3 4 IOUT) IF(IUNIT(ll).GT.O) CALL SORlAP(X(LCHNEW)rX(LCIBOU)rX(LCCR)r X(LCCC),X(LCCV),X(LCHCOF)rX(LCRHS)rX(LCA)rX(LCRES)rX(LCIEQP)r 1 C7CZB---MAKE X(LCHDCG),X(LCLRCH),KKITER,HCLOSE,ACCL~ICNVG,KKSTP,KKPERI IPRSOR,MXITER,NSTP,NCOL~NRC~!W~NLAY,NSLICE~MBWIIOUT) C C7C2C---IF CONVERGENCECRITERIONHAS BEEN luET STOP ITERATING. IF(ICNVG.EQ.l) GOTO 110 100 CONTINUE KITER=MXITER 110 CONTINUE C WHICHOUTPUT IS NEEDED. c7c3---- DETERMINE CALL BASlOC(NSTP,KKSTP,ICNVG,X(LCIOFL)rNLAY, 1 IBUDFL,ICBCFL,IHDDFL,IUNIT(12)rIOUT) C c7C4---- CALCULATE BUDGET TERMS. SAVE CELL-BY-CELL FLOW TERMS. 9 MSUMl IF(IUNIT(l).GT.O) CALL BCFlBD(VBNM,VBVL,MSUM,X(LCHNEW)r X(LCIBOU),X(LCHOLD),X(LCSC1),X(LCCR)rX(LCCC)rX(LCCV)r 1 X(LCTOP),X(LCSC~),DELT,ISS,NCOL,NROW,NLAY,KKSTP,KKPERI 2 IBCFCB,ICBCFLrX(LCBUFF)rIOUT) 3 IF(IUNIT(2).GT.O) CALL WELlBD(NWELLS,MXWELL,VBNM,VBVLrMSUM, X~LCWELL~,X~LCIBOU~,DELT,NCOL,NROW,NLAY,KKSTP,KKPERIIWELCBI 1 ICBCFLrX(LCBUFF)rIOUT) 1 IF(IUNIT(31 .GT.O) CALL DRNlBD(NDRAIN,MXDRN,VBNM,VBVL,MSUM, X(LCDRAI),DELT,X(LCHNEW),NCOL,NROW,NLAYIX(LCIBOU),KKSTPI KKPER,IDRNCB,ICBCFL,X(LCBUFF)rIOUT) IF(IUNIT(81.GT.O) CALL RCHlBD(NRCHOP,X(LCIRCH)rX(LCRECH)r XtLCIBOU),NR(XJ, NCOL,NLAY,DELT, VBVLrVBNM,MSUM,KKSTP,KKPER, 1 IRCHCF3.ICBCFLrX(LCEtlFF),IOUT) 2 IF(IUNIT(S).GT.O) CALL EVTlBD(NEVTOP,X(LCIEVT),X(LCEVTR)r 1 X(LCEXDP)rX(LCSURF)rX(LCIBOU)rX(LCHNEW)rNCOLrNRCklrNLAY, 2 DELT,VBVL,VBNM,MSUM,KKSTP,KKPER,IEVTCB,ICBCFL,X(LCBUFF)rIOUT) IF(IUNIT(4) .GT.O) CALL RIV~BD(NRIVER,MXRIVRIX(LCRIVR)~X(LCIBOU)~ X(LCHNEW),NCOL,NROW,NLAY,DELT,VBVL,VBNM,MSUMI 1 1 2 2 KKSTPIKKPER,IRIVCB,ICBCFL~X(LCBUFF)~IOUT) IF(IUNIT(71.GT.O) CALL GHB~BD(NBOUND,MXBND,VBNMIVBVLIMSUMI X(LCBNDS)rDELT,X(LCHNEW)rNCOL,NROWrNLAY,X(LCIBOU)rKKSTP, KKPER,IGHBCB,ICBCFLrX(LCBUFF)rIOUT) : C c7c5--- PRINT AND OR SAVE HEADS AND DRAWDOWNS.PRINT OVERALLBUDGET. CALL BASlOT~X~LCHNEW~,X~LCSTRT~,ISTRT,X~LCBUFF~,X~LCIOFL~r MSUM,X(LCIBOU),VBNM,VBVL,KKSTP,KKPER,DELT, PERTIMsTOTIM, ITMUNI,NCOL, NRW, NLAY, ICNVG, 1 2 3 IHDDFL,IBUDFL,IHEDFM,IHEDUN,IDDNFM,IDDNUN,IOUT~ C C7C6---- IF ITERATIONFAILED TO CONVERGE THENSTOP. IF(ICNVG.EQ.0) STOP 200 CONTINUE 300 CONTINUE C PROGRAM ca------END STOP C END 3-34 CHAPTER 4 BASIC PACKAGE Conceptualization The Basic periods, it Package handles a number of administrative It reads data on the number of rows, model. for and Implementation on the major those options It allocates options. reads data specifying implements starting budget; to be used, data establishing head arrays and it for controls columns, layers, and on the location space in computer initial and boundary step; model output it calculates according to user Selection of Major Options and Designation The selection of major options and the designation numbers were discussed in the preceding Basic operations Chapter option Package in these 3, the entries array is to be used and (b) the unit is to be read. element in this is to read the menever corresponding a new major to that option determine option it up the an overall water specification. Files of their IUNIT array; (a) whether input role unit of the as noted in or not a major data for the option is added to the program, must be added to the 4-1 model arrays; sets of Input number from which data reads and The primary chapter. the of input it of time; for and stress memory for conditions; the discretization each time tasks IUNIT array. an The IBOUND Array Recall that the finite-difference CRi,j-1/2,k(hY,j-l,k-hY,j,k) + CVi,j,k-1/2(hy,j,k-l-hy,j,k) + Cvi,j,k+l/2(hF,j,k+l-h!i,j,k) = scli,j,k of this Package, contains head varies (constant-head with (h~,j,k-IJ~T~,k)/btm- form is written which The IBOUND array, for cell), (variable-head cell). the state of a cell IBOUND code entries for a typical at the of each time after the first, equal to the head distribution the first specified time step; time initial however, "starting step time is step required (figure at the (1) head is constant the cell (no-flow packages the distribution start form, if of heads" may also are specified head calculation be saved, 4-2 a head distribu- to calculate 20). the For each time of one time at the end of the previous heads are used for they whether Conditions the head distribution step, and read by the by other is in backward-difference (28) at the end of that in the model layer. Because equation distribution within 19 illustrates Initial beginning (2) the place cell indicates can be modified Figure changes. which cell), takes The IBOUND array or inactive by the user each cell or (3) no flow (28) each variable-head is specified a code for time has the form - h;,j,k) m - hi,j,k) + CCi+l/2,j,k(hT+l,j,k grid. tion a cell + CCi-1/2,j,k(h?-l,j,k-h!i,j,k) One equation the for + CRi,j+l/E,k(hy,j+l,k + Pi,j,khT,j,k%,j,k Basic equation time by the user. only in the array step step. head step is set For These in the first STRT, and used to Area Where Heads Vary Aquifer Boundary Constant Head IBOUND Codes < 0 Constant Head = 0 No Flow > 0 Variable Head Figure 19.-Example of the boundary layer. array (IBOUND) 4-3 for a single 52 Start Starting heads (STRT) are the heads at the beginning of the simulation. Set New Heads (HNEW) Equal to STRT New Heads (HNEW) are the latest estimate of the heads at the end of the current time step. Each iteration produces a new estimate. Old Heads beginning They are, at the end I I Set Old Heads (HOLD) Equal to HNEW Use HOLD and HNEW to Formulate Equations I (HOLD) are the heads at the of the current time step. therefore, equal to the heads of the previous time step. v Solve Equations for New Estimate of HNEW (-xi--) Figure 20.-Flow of head distributions 4-4 during a simulation. I 1 calculate drawdown, and some later the difference between the starting head distribution. Discretization Simulation which all time steps time external steps is divided stresses period, the time 21. step multiplier, time of each time stress Within or ratio step. step periods--time steps in turn, each stress period, into specifies which of the length Using these in the stress intervals are, The user progression. the number of time of the preceding length into of Time are constant--which as shown in figure form a geometric stress head distribution terms, it during divided into the time the length of the is to be divided, of each time the program step and to that calculates the period. output The primary control the Output If the frequency "Output Other output Control Output items Control of each stress option, include option head distribution were saved. at which Control" output also the end of a stress heads are printed a major option or saved on disk contained drawdowns and volumetric provides for storage The user may budget or printing terms; output option and the overall volumetric budget are printed printed 22 shows an example of a volumetric period. 4-5 if Package. the of these a default and drawdowns are also through in the Basic is not utilized, period, Figure of the program is head distribution. terms. is invoked--the starting budget at the end heads printout for Well 1 Well 2 c 5 .o ;ii $7 ZE iii 100 GPM 0 GPM Well 1 Well 2 Stress Period 1 100 GPM 400 GPM Well 1 Well 2 Stress Period 2 ) 0 GPM 400 GPM Stress Period 3 6 5 c 1 Time Step 1 4) Time Step 2 Delt (1) = PERLEN Time Step 1 * (l-TSMULT) 1 - TSMULT* Delt (m + 1) = TSMULT* Time Step 1 Time Step 2 Specified Time Step 4 by User PERLEN.. . . . . . . . . Length of Stress Period TSMULT . . . . . . . . . .Time Step Multiplier NSTP . . . . . . . . . . . . . Number of Time Steps in Stress Period * NSTP Delt (m) Calculated Delt(m). Figure 21.- Division Time Step 3 by Program . . . . . . . . . . Length of Time Step m of simulation time into stress periods and time steps. 4-6 o--m 5: zl .. 5 0 Y I s; I zi: gi w ocl - 8 d I i I ii I- a 4-7 Budget Calculations The calculation the calculation of budget explained in Chapter of flow, are calculated one-dimenisonal which of the array sums and prints volumetric entries , which in the flow the budget The array budget correspond component Package is carried and the summation 3 the entries VBVL. in the Basic out in two parts, of those to individual packages and stored VBVL is passed to the entries. 4-8 entries. Basic As components in the Package Basic Input for the Basic from unit 1 as specified number for BAS input can computer. Input for the specified in IUNIT( 12). Information for Packaae Inout (BAS) Package except for output control is read in the main program. If necessary, the unit be changed to meet the requirements of a particular output control option is read from the unit number the Basic Package must be submitted in the following order: FOR EACH SIMULATION BASlDF 1. Data: Format: HEADNG(32) 20A4 2. Data: Format: HEADNG (continued) 12A4 3. Data: Format: NLAY 110 NROW 110 NCOL 110 NPER 110 ITMUNI 110 4. Data: IUNIT( 24) Format: 2413 (BCF wEL DRN RIV EVT xxx GHB RCH SIP xxx SIR oc) BASlAL 5. Data: Format: IAPART 110 ISTRT 110 BASlRP 6. Data: Module: NOTE: IBOUND(NCOL,NROW) U2DINT (One array for each layer 7. Data: Format: HNOFLO FlQ.0 8. Data: Module: Shead(NCOL,NROW) U3DREL (One array for each layer in the grid) in the grid) IBOUND and Shead are treated as three-dimensional arrays in the program. However, the input to each of these arrays is handled a series of two-dimensional arrays, one for each layer in the grid. 4-9 as FOR EACH STRESS PERIOD BASlST 9. Data: Format: PERLEN F10.0 NSTP TSMULT 110 F10.0 Explanation Input of Fields Used in Instructions HEADNG--is the simulation title that is printed on the printout. It may be up to 132 characters long; 80 in the first record and 52 in the second. Both records must be included even if they are blank. NLAY--is the number of model layers. NROW--is the number of model rows. NCOL--is the number of model columns. NPER--is the number of stress periods in the simulation. (It is used only for printout ITMUNI--indicates the time unit of model data. It does not affect model calculations.) of elapsed simulation time. o- 3- hours 4 - days undefined 1 - seconds 2 - minutes 5 - years The unit of time must be consistent for all data values that involve For example, if years is the chosen time unit, stress-period length, must all be expressed using years step length, transmissivity, etc., Likewise, the length unit must also be consistent. their time units. 4-10 time. timefor IUNIT--is a 24-element table of input units for use by all major options. Only 10 elements (l-5, 7-9, 11, and 12) are being used. Element 6 has been reserved for a transient leakage package, while element 10 has been reserved for an additional solver, both on the assumption that such packages will be added to the model in the future. Elements 13-24 are reserved for future major options. MAJOR IUNIT OPTION LOCATION Block-Centered Flow Package Well Package Drain Package River Package Evapotranspiration Package Reserved for Transient Leakage Package General-Head Boundary Package Recharge Package SIP Package Reserved for additional solver SSOR Package Output Control Option 1 2 3 4 6” 7 8 1; 11 12 If IUNIT -< 0, the corresponding If IUNIT > 0, the corresponding major option is being used and data for that option will be read from the unit number contained in IUNIT( The unit numbers in IUNIT should be integers from 1 to 99. Although the same number may be used for all or some of the it is recommended that a different major options, Printer number be used for each major option. output is assigned to unit 6 (unless it is changed to meet computer requirements). That unit number should not be used for any other input or output. The user is also permitted to assign unit numbers Those numbers should be different for output. from those assigned to input. The Basic Package reads from unit 1 (unless it is changed to meet It is permissible but computer requirements). unwise to use that unit for other major options. IAPART--indicates whether array major BUFF is separate option is from array not being used. RHS. If IAPART = 0, the arrays BUFF and RHS occupy the same space. This This option should be used option conserves space. unless some other package explicitly says otherwise. If IAPART f 0, the arrays BUFF and RHS occupy different space. This option is not needed in the program as documented in It may be needed for packages yet this publication. to be written. 4-11 ISTRT--indicates whether starting heads are to be saved. If they are saved, they will be stored in array STRT. They must be saved if drawdown is calculated. If ISTRT = 0, starting heads are not saved. If ISTRT f 0, starting heads are saved. IBOUND--is the boundary array. If IBOUND(I,J,K) < 0, cell I,J,K has a constant If IBOUND(I,J,K) = 0, cell I,J,K is inactive If IBOUND(I,J,K) > 0, cell I,J,K is variable-head. head. (no-flow). HNOFLO--is the value of head to be assigned to all inactive cells (IBOUND = 0) throughout the simulation. Since heads at inactive cells are unused, this does not affect model results but serves to identify inactive cells when head is printed. This value is also used as drawdown at inactive cells if the drawdown option is Even if the user does not anticipate having inactive cells, used. a value for HNOFLO must be submitted. Regardless of whether starting of the simulation. values must be input to initialize the solution. Shead--is head at the start head is saved, these PERLEN--is the period. NSTP--is the length of a stress number of time TSMULT--is the multiplier of the first time by the relation steps period. It is specified in a stress for each stress period. for the length of successive time steps. The length step DELT(l) is related to PERLEN, NSTP and TSMULT DELT( 1) = PERLEN(l-TSMULT)/(l-TSMULT**NSTP). 4-12 s-l r-l m r(rlrld N N 4-13 . . . . . . . . . . . . . . . . . . . . Outout Control 1nm.A Output Control is a major option separate from the rest of the Basic Package. Input to Output Control is read from the unit specified in IUNIT(12). If IUNIT(12) is zero, no output control data are read, and default output control is used. Under the default, head and total budget are printed at the end of every stress period. Additionally, if starting heads are saved (ISTRT is not 0), drawdown is printed at the end of every stress period. The default printout format for head and drawdown is 10611.4. All printer If necessary, the output goes to unit 6 as specified in the main program. unit number for printer output can be changed to meet the requirements of a particular computer. FOR EACH SIMULATION BASlRP 1. Data: Format: IHEDFM 110 IDDNFM 110 IHEDUN 110 IDDNUN 110 FOR EACH TIME STEP BASlOC 2. Data: Format: INCODE IHDDFL 110 110 IBUDFL 110 ICBCFL 110 3. Data: Format: Hdpr 110 Hdsv 110 Ddsv 110 Ddpr 110 (Record 3 is read 0, 1, or NLAY times, depending on the value of INCODE.) Explanation Input IHEDFM--is a code for the format of Fields Used in Instruct ions in which heads will be printed. IDDNFM--is a code for the format in which drawdowns will be printed. Format A positive codes have the same meaning for both head and drawdown. format code indicates that each row of data is printed completely This means that when there are more before starting the next row. columns in a row than will fit on one line, additional lines are used This format is called the wrap format. as required to complete'the row. A negative format code indicates that the printout is broken into strips where only that number of columns that will fit across one line are As many strips are used as are required to print printed in a strip. This format is called the strip format. The the entire model width. absolute value of the format code specifies the printout format as follows. 4-14 0 1 2 3 4 5 6 IHEDUN--is the unit on disk. 7 - (2OF5.0) 8 - (20F5.1) 9 - (20F5.2) - (10611.4) - (11610.3) - (9613.6) - 10 - (20F5.3) 11 - (20F5.4) (15F7.1) (15F7.2) (15F7.3) (15F7.4) 12 - (10611.4) number to which heads will IDDNUN--is the unit number to which saved on disk. INCODE--is the head/drawdown ouput records in input item 3. be written drawdowns will be written It determines code. if INCODE < 0, layer-by-layer specifications from the are used. Input item 3 is not read. If INCODE = 0, all will If INCODE > 0, input IHDDFL--is If item 3 will a head and drawdown output IHDDFL = 0, neither consist if are saved they are the number of If layers are treated the consist of one record. they same way. last time steps Input item 3 of one record for each layer. flag. heads nor drawdowns will be printed or saved on disk. If IBUDFL--is IHDDFL # 0, heads and drawdowns will be printed or saved according to the flags for each layer specified in in$ut item 3. a budget print flag. If IBUDFL = 0, overall volumetric budget will not be printed. If IBUDFL # 0, overall volumetric budget will be printed. (Note that the overall volumetric budget will always be printed at the end of a stress period, even if the value of IBUDFL is zero.) ICBCFL--is a cell-by-cell flow-term flag. If ICBCFL 7 0, cell-by-cell If ICBCFL # 0, cell-by-cell flow terms are printed or recorded depending on flags set in the component of flow IWELCB, IRCHCB, etc. i.e., flow 4-15 terms are not saved or printed. on disk packages, Hdpr--is the output flag for head printout. If Hdpr = 0, head is not printed for If Hdpr # 0, head is printed the corresponding Ddpr--is the output flag for for Ddpr = 0, drawdown is If Ddpr # 0, drawdown is printed the output flag for not printed for Hdsv = 0, head is not saved for If Hdsv f 0, head is saved for the output flag for for the corresponding the corresponding layer. layer. head save. If Ddsv--is layer. drawdown printout. If Hdsv--is layer. the corresponding the corresponding the corresponding layer. layer. drawdown save. If Odsv = 0, drawdown is not saved for If Ddsv f 0, drawdown is saved for 4-16 the the corresponding corresponding layer. layer. Module Documentation The Basic submodules. Package (BASl) The modules for consists the Basic of eight Packaae primary modules and five are: Primary Modules BASlDF Defines and sets key model parameters. BASl AL Allocates space for Package. BASlRP Reads and prepares BASIST Reads timing information and initializes needed to calculate the length of time BASl AD Calculates the length of time elapsed time, and intializes of each time step. BASl FM Clears BASlOC Sets flags which indicate or recorded on disk. when data BASlOT Prints and records heads, volumetric budget. drawdowns, data arrays data accumulators for used by the the Basic Basic Package. variables steps. steps, accumulates heads at the beginning RHS and HCOF. should be printed and overall Submodules SBASlD Calculates, SBASlH Writes SBASlI Initializes SBASlT Prints SBASlV Calculates writes, and records and records the a time drawdown distribution. head distribution. Output Control System. summary. and prints 4-18 the overall volumetric budget. Narrative The BASlDF module defines the following Print 3-. Read and print 3. Read the the number of layers, 4. Print 5. Select major option. option will counter input table. If indicates does so in that into columns, and stress IUNIT entry option is major the codes). the total 4-19 periods. all major options. to a particular option is to be used corresponding not going of input to that to the major to be used, the to zero. time RETURN. units units. number from which is set equal (ISUM) and calculate the time and units is used when printing for a certain the the total-elapsed but has been assigned is the unit a major periods, the time numbers IUNIT for Each entry integer stress instructions rows, unit specifies IUNIT element Initialize input a message showing The integer be read. (see the the The user corresponding 8. and print a positive columns, model calculations number of layers, a 24-element by putting array time Read and print option. 7. the rows, ITMUNI is a code which the amount of elapsed major It a heading. It does not affect model data. IUNIT is key model parameters. name of the program. code ITMUNI. ' 6. and sets order: 1. of time Module BASlDF for counter (TDTIM) and the storage- number of cells. Flow Chart for Module BASlDF ITMUNI is a code which indicates units of time used in the input data. This code is only used to print a table showing elapsed time in seconds, It minutes, hours, days, and years. is not used in forrmlating or solving the finite-difference equation. IUNIT is a table that indicates which major options are to be used and the unit numbers from which input is to be read. TOTIM is an accumulator in which It simulation time is stored. incremented at each time step. total READ AND PRINT A HEADING is ISUM is a location counter for the first unallocated space in the X It is incremented by each array. module in the Allocate Procedure. READ # OF LAYERS, ROWS, COLUMNS, STRESS PERIODS, AND ITMUNI PRINT # OF LAYERS, ROWS, COLUMNS, AND STRESS PERIODS SELECT AND PRINT MESSAGE SHOWING TIME UNITS READ IUNIT TABLE 4-20 B 1 c C-----VERSION 1513 12MAY1987 BASlDF ****************************************************************** C C DEFINE KEY MODEL PARAMETERS ****************************************************************** C C C SPECIFICATIONS: C B SUBROUTINE BAS~DF(ISUMIHEADNG~NPERIITMUNI~TOTIM,NCOL~NRCW~ NLAY,NODES,INBASIIOUT,IUNIT) CHARACTER*4 HEADffi DIKNSION HEADNG(32)rIUNIT(24) ------------------L-___________________L---------------- &------PRINT THE NA~~E0F x-iE pRcGFaw. WRITE(IOUT,l) 1 FOFIMAT(lH1,20X,‘U. S. GEOLOGICAL SURVEYMODULAR’, 1 ’ FINITE-DIFFERENCE GROUND-WATERMODEL’) c c2--READ AND PRINT A HEADING. READ(INBAS,Z) HEADNG 2 FOF&‘AT(2OA4) WRITE(IOUTs3) HEADNG 3 FORMAT(lH0’32A4) C C3------READ NUMBEROF LAYERStROWS,COLUMNS,STRESSPERIODS AND B------UNITS OF TIE CODE. READ(INBAS,4) NLAY,NRCW,NCOL,NPERtITMUNI 4 FOf@lAT(8110) c C4------PRINT # OF LAYERS, ROWS, COLUMNSAND STRESS PERIODS. WRITE(IOUT,5) NLAY,NROllrNCDL 5 FORMAT(lX,I4,’ LAYERS’rIlO,’ RQVS’rIlO,’ COLUMNS’) WRITE(IOUT,6) NPER 6 FORMAT(lX,I3,’ STRESS PERIOD(S) IN SIMULATION’) C C5------SELECT AND PRINT A MESSAGESHOWINGTIME UNITS. IF(ITMUNI.LT.0 .OR. ITMUNI.GT.5) ITMUNI=O GO TO (10,20r30.40,50) rITMUN1 WRITE(IOUT,9) 9 FORMAT(lX,‘MDDEL TIME UNITS ARE UNDEFINED’) GO TO 100 10 WRITE(IOUT,ll) 11 FORMAT(lX,‘MODEL TIME UNIT IS SECONDS’) GO TO 100 20 WRITE(IOUT’21) 21 FORMAT(lX,‘MODEL TIME UNIT IS MINUTES’) GO TO 100 30 WRITE(IOUT,31) 31 FORMAT(lX,‘MODEL TIRE UNIT IS HOURS’1 GO TO 100 40 WRITE(IOUT,41) 41 FORMAT(lX,‘MODEL TIRE UNIT IS DAYS’) GO TO 100 50 WRITE(IOUT,Sl) 51 FORMAT(lX,‘MODEL TIME UNIT IS YEARS’ 1 c C&--m READ 6 PRINT INPUT UNIT NUMBERS(IUNIT) FOR MAJOR OPTIONS. 100 READ(INBAS,lOl) IUNIT 101 FORJdAT(2413) WRITE(IOUT,lOZ) (1,1=1,24),IUNIT 102 FORMAT(lHO,‘I/O UNITS:‘/lXt’ELEMENT OF IUNIT:‘r2413, 1 /1x, ’ I/O UNIT:‘,24131 C C7---INITIALIZE TOAL ELAPSED TIME COUNTERSTORAGEARRAY COUNTER C7---AND CALCULATE NUMBEROF CELLS. TOTIM=D. ISUHl NODES=NCOL*NROW*NLAY c C&-----RETURN RETURN END 4-21 List Variable of Variables for Module BASlDF Definition Range I Module Index. I NBAS Package Primary unit number from which input to the Package will be read. INBAS = 1. IOUT Global Primary ISUM Global Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. ITMUNI Package Code for unit number for time units all for printed this output. BASl IOUT = 6. problem: o- undefined seconds 2 - minutes 3- hours 4 - days 5 - years l- IUNIT Module DIMENSION (24), Primary major options. input HEADNG Package DIMENSION (32), the problem. printed NCOL Global Number of columns NLAY Global Number of layers NODES Global Number of cells NPER Global Number of stress NROW Global Number of rows in the TOTIM Package Elapsed time Heading in the in the (nodes) 4-22 for on output each of the to identify grid. grid. in the periods. in the units grid. simulation. finite-difference grid. Narrative for Module BASlAL Module BASlAL allocates space for data arrays used by the BAS Package. Space is al located for HNEW, HOLD, IBOUND, CR, CC, CV, HCOF, RHS, DELR, DELC, and IOFLG. Space is allocated for the STRT array if the user intends to calculate d rawdown. Space is also allocated for an array called BUFFER, which is used to accumulate various data arrays such as drawdown and cellby-cell flow terms when they are being calculated prior to output. To conserve space, the user may specify that arrays BUFFER and RHS should occupy the same space. The number of spaces allocated for each of the arrays--HOLD, IBOUND, CR, CC, CV, HCOF, RHS, STRT, and BUFFER is equal to the number of cells in the grid. Twice that number of spaces is reserved for HNEW because it is double precision. DELR and DELC are allocated a number of spaces equal to the number of rows and columns, respectively. IOFLG (an array of flags used by Output Control) is allocated a number of spaces equal to four times the number of layers. Module BASlAL performs 1. Print its functions a message identifying in the following order: the package. 2. Read and print flags IAPART and ISTRT which indicate whether the BUFFER and RHS arrays should occupy the same space and whether the start array (STRT) should be saved. 3. Store in Calculate space. 4. Allocate DELC, and IOFLG. location number of cells ISOLD the the space for in the X array in the grid. of the first unallocated HNEW, HOLD, IBOUND, CR, CC, CV, HCOF, RHS, DELR, If the user specified that BUFFER and RHS should share space (IAPAk equal to zero) set the address of the BUFFER (LCBUFF) equal to allocate separate space for BUFFER. the address of RHS(LCRk); otherwise, 6. allocate If the user specified space for STRT. 7. Print 8. RETURN. that the starting array must be saved, the amount of space used by the BAS Package. 4-23 Flow Chart for Module BASlAL IAPART is a flag specified by the user which, if equal to zero, indicates that the arrays BUFFER and RHS should overlay each other. BUFFER is an array in which data is temporarily stored while it is being gathered for printing. I PRINT A MESSAGE IDENTIFYING THIS PACKAGE I RHS is an array which contains the right hand side of each finite-difference equation. READ AND PRINT FLAGS IAPART AND ISTRT ISTRT is a flag specified by If it is not the user. equal to zero, starting heads are to be saved. STORE ISUM IN ISOLD. CALCULATE # OF CELLS IN GRID ISOLD marks the location of ISUM before any space was allocated by this module. After all space is allocated, ISOLD is subtracted from ISUM to calculate the amount of space allocated by this module. ALLOCATE SPACE FOR EACH ARRAY. ISUM is a counter which contains the location of the first unallocated element in the Each time space is X array. allocated for an array; the value in ISUM is incremented by the size of the array. 7 r-l PRINT THE AMOUNT OF SPACE USED 4-24 c Cl---PRINT A KSSAGEIDENTIFYINOTHEPACKAGE. uRITE(IOur,1)INBAS 1 FOFMAT(lHO.'BASl- BASICMDDEL PACKABE, VERSION1, 9/l/87', 2’ INPUTREAD FRCU UNIT’,131 C C2----READ C2------FLAG 6 PRINT FLAB IAPART (RHS 6 BUFFER SHARE SPACE?) AND ISTRT (SHCULD STARTINGHEADS BE SAVED FOR MAWDCUN?) READ(INBAS,2)IAPART,ISTRT 2 FORMAT(2110) IF(IAPART.EQ.0) WRITE(IOUT,3) 3 FOFMAT(lX,‘ARRAYS FOiS AND BUFF WILL SHARE EMORY.‘) 1FtISTRT.NE.D) WRITE(IDUT,4) 4 FOIMAT(lX,‘START HEAD WILL BE SAVED’) IF(ISTRT.EQ.0) URITE(IOUT,S) 5 FORMAT(lX.‘START HEAD WILL NOT BE SAVED’, 1 ’ -- DRAWDCMNCANNOT BE CALCULATED’ ) C Q----STORE,IN ISaD, ISOLD=ISUM LOCATION OF FIRST UNALLOCATED SPACEIN NRCL=NRCW*NCOL”NLAY c C4------ALLOCATE SPACE FOR ARRAYS. LCHNEW=ISUM ISlJM=ISUM+2*NRCL LCHOLD=ISUM 1sUN=1suMwRCL LCIBOU=ISUN 'ISUM=ISUFHNRCL LCCR=ISUM ISUM=ISuMcNRCL LCCC=ISUM ISUM=ISUM+NRcL LCCv=IsUM ISUM=ISUM+NR~*NCOL*(NLAY-1) LCliCOF=ISUM IsUM=IslJMtNRCL LCRHS=ISlM ISUM=ISUM+NRCL LCDELRISUM ISUKISUM+NCOL LCDELOISUM ISUM=ISUM+NROW LCIOFL=ISUM ISUK;ISUM+NLAY*4 Es------IF BUFFER AND RRS SHARE SPACE THEN LCBUFF*LCRHS. LCBUFPLCRHS IF(IAPART.EQ.0) GOTO 50 LCBUFF=ISUH ISUKISUMeNfiCL ii6------IF STRTWILL BE SAVEDMEN ALLaTE SPACE. 50 LCSTRT=ISUM IF(ISlRT.NE.0) ISUKISUMtNRCL ISP=ISU~ISOLD C C7-----PRINT AHOUNT OF SPACE USED. WRITE(IOLJT,6)ISP 6 FOfMAT(lX,IS,' ELEMENTS IN X ARRAY ARE USED BY BA.3’) 1sUM1=1sUM-1 WRITE(IOUT,7)ISlJMl.LENX 7 FDMAT(lX,I8,' ELEKNTSOF X ARRAYUSEDOUTOF',181 IF(ISUHl.GT.LENX) WRITE(IOUT.8) 8 FOFIMAT(1X, ' *“*X ARRAY MUST BE DIMtENSIONED LARBET(r**O : C8------RETURN RETURN C 4-25 X. List Variable Ranqe IAPART Module I NBAS Package IOUT ISOLD Global Package ISP I STRT Module Package ISUM Global I SUM1 Module LCBUFF LCCC LCCR LCCV LCDELC LCDELR LCHCOF LCHNEW LCHOLD LCIBOU LCIOFL LCRHS LCSTRT LENX Package Package Package Package Package Package Package Package Package Package Package Package Package Global NCOL NLAY NRCL NROW Global Global Module Global of Variables for Module BASlAL Definition Flag set by user. = 0, arrays RHS and BUFFER will share space in the X array. f 0, arrays RHS and BUFFER will not share space in the X array. Primary unit number from which input to the BASl Package will be read. INBAS = 1. Primary unit number for all printed output. IOUT = 6. Before this module allocates space, ISOLD is set equal ISOLD is subtracted to ISUM. After allocation, from ISUM to get ISP, the amount of space in the X array allocated by this module. Number of words in the X array allocated by this module. Flag. f 0, starting heads will be saved so that drawdown can be calculated. = 0, starting heads will not be saved. Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. Index number of the last element of the X array allocated by this module. Location in the X array of the first element of array BUFF. Location in the X array of the first element of array CC. Location in the X array of the first element of array CR. Location in the X array of the first element of array CV. Location in the X array of the first element of array DELC. Location in the X array of the first element of array DELR. Location in the X array of the first element of array HCOF. Location in the X array of the first element of array HNEW. Location in the X array of the first element of array HOLD. Location in the X array of the first element of array IBOUND. Location in the X array of the first element of array IOFLG. Location in the X array of the first element of array RHS. Location in the X array of the first element of array STRT. Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. Number of columns in the grid. Number of layers in the grid. Number of cells in the grid. Number of rows in the grid. 4-26 Narrative for Module BASlRP This module reads and prepares data for the BAS Package. It reads the boundary array (IBOUND) and the starting-head array (HNEW), sets the heads in no-flow cells to a user-supplied value (for printout convenience), initializes the starting-head array (STRT) and the volumetric-budget accumulators (VBVL), and sets up the Output Control System. The IBOUND codes are as follows. Code , Status negative zero positive * constant inactive variable head (no-flow) head The user must specify a head value HNOFLO that he wants printed for no-flow (inactive) cells. That value is only used during printing and makes inactive cells stand out on the listing (e.g., 0.0 and 9999.99). Recall that initial heads are needed for each time step; however, they must be read for only the first time step, at which time they are called the starting heads. For subsequent time steps, the ending heads of the preceding time step will be used as the initial heads of the current time step. The starting heads are read in single precision into the array HOLD and converted to double precision as they are moved into HNEW. Module BASlRP performs its functions in the following 1. Print 2. Read the 3. Read and print 4. Read the starting heads into 5. Copy the HOLD into HNEW. starting heads (and convert the simulation title and calculate the order: number of cells in a layer. 6. If the 7. Initialize 8. Call 9. . RETURN. boundary starting array the head value to be printed array heads must be saved, volumetric-budget submodule (IBOUND). for no-flow cells HOLD. to double precision) from copy them from HOLD to STRT. accumulators. SBASlI to initialize 4-27 (HNOFLO). the Output Control System. Flow Chart for Module BASlRP HNOFLO is a value assigned to head in It makes inactive (no-flow) cells. those cells stand out in listings of heads. HNEW is an array containing the latest estimates of heads. It starts each time step with heads calculated for the end of the previous time step. It is changed at each iteration until the last iteration when it contains the heads at the end of the time step. HOLD is an array containing heads at the beginning of the current time step. At the beginning of a time step, HOLD AND HNEW contain identical values. HNEW changes from one iteration to the next; HOLD does not. OUTPUT CONTROL is part of the Basic Package which gives the user the ability to control the kind and amount of information that is printed by the program. UEDINT is a utility two-dimensional module which integer arrays. CALL MODULE UPDINT TO READ BOUNDARY ARRAY 1 FOR EACH LAYER reads IF STARTING HEADS ARE TO BEc%-D* HOLD TO START INITIALIZE THE ;;l--td;TRIC ACCUMULATORS CALL MODULE SBASlI TO SET UP OUTPUT CONTROL 4-28 . SUBROUTINE BASlRP(IBOUND,HNEWtSTRTtHOLD,ISTRT,INBAS, HEADNGINCOL~NROW,NLAY~NODES,VBVL~IOFLG,INOC,IHEDFN, 2 IDDNFM,IHEDUN,IDDNUN,IOUT) 1 C-----VERSION 1628 15MAY1987 BASlRF ****~************************************************************* C c READ AND INITIALIZE BASICMODEL ARRAYS Y***((t****lt**************~*********~*~~***********~**~********~~** : C SPECIFICATIONS: CHARACTER*4 HEADNG,ANAME DOUBLE PRECISION HNEW,HNOFLO DIMENSION HNEW(NODES),IBOUND(NODES)rSTRT(NODES),HOLD(NCDES), 1 ANAME(6r2)rVBVL(4,20)rIOFLG(NLAY,4),HEADNG(32) C DATA ANAME~lrl~,ANAME~2rl~rANAME~3rl~rANAME~4,1~,ANAME~Srl~, ‘,’ BD’r’UNDA’r’RY A’r’RRAY’/ ANANE(6,l) /’ 1,’ DATA ANAME(l,2)rANAME(2,2)rANAME(3r2),ANAME(4,2),ANAME(5,2)r 1 ANAME(6,2)/' 1,' 1,' ','INIT'r'IAL ‘,‘HEAD’/ 1 cCl------PRINT SIMULATION TITLE. CALCULATE # OF CELLS IN A LAYER. WRITE(IOUT,l) HEADNG 1 FORMAT(lH1,32A4) NCR=NCOL*NROW C C2------READ BOUNDARYARRAY(IBOUND) ONE LAYER AT A TIME. DO 100 K=l,NLAY KK=K LOC=l+(K-l)*NCR CALL U2DINT(IBCUND(LOC),ANAME(l,l)rNROW,NCCL,KK,INBAS,IOUT) 100 CONTINUE ------READ ANDPRINTHEADVALUETO BE PRINTED FOR NO-FLOW CELLS. READ(INBAS,Z) TMP 2 FORMAT(FlO.0) HNOFLO=TMP WRITE(IOUT,3)TMP 3 FO~AT(lHOr’ADUIFER HEAD WILL BE SET TO ‘rlPGll.5, 1 ’ AT ALL NGFLON NODES (IBOUND=O).‘) &------READ STARTING HEADS. DO 300 K=l,NLAY KK=K LOC=l+(K-l)*NCR CALL U~DREL(HOLD(LCC)~ANAME(~~~)~NR~IV~NCOL,KKIINBAS,IOUT) 300 CONTINUE C c5------COPY INITIAL HEADS FROMHOLD TO HNEW. DO400 I=l,NODES HNEW(I)=HOLD(I) IF(IBOUND(I).EQ.O) HNEW(I)=HNOFLO 400 CONTINUE C (X------IF STARTING HEADS ARE TO BE SAVED THEN COPY HOLD TO STRT. IF(ISTRT.EQ.0) GOTO 590 DO500 I=l,NODES STRT(I)=HOLD(I) 500 CONTINUE C C7------INITIALIZE VOLUMETRIC BUDGET ACCUMULATORS TO ZERO. 590 DO 600 I=1120 DO 600 J=lr4 VBVL(J,I)=O. 600 CONTINUE &------SET UP OUTPUT CCNTRDL CALLSBASlI(NLAY,ISTRT,iOFLG,INOC,IOUT,IHEDFM, 1 IDDNFM,IHEDUN,IDDNUN) &----~~RN 1000 RETURN END 4-29 List Variable Module Package HNEW Global HNOFLO Module HOLD Global I I BOUND Module Global I DDNFM IDDNUN Package Package I HEDFM I HEDUN Package Package INBAS Package INOC Package I OFLG Package I OUT I STRT Global Package J Module Module Module LOC NCOL NCR NLAY NODES NROW STRT TMP VBVL Module Global Module Global Global Global Package Module Global for Module BASlRP Definition Range ANAME HEADNG K KK of Variables Label for printout of input array. DIMENSION (32), Heading printed on output to identify problem. DIMENSION(NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. User specified value for head in cells which are inactive at the start of simulation. DIMENSION (NCOL,NROW,NLAY), Head at the start of the current time step. Index. DIMENSION(NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Code for format in which drawdown should be printed. Unit number on which an unformatted record containing drawdown should be recorded. Code for format in which head should be printed. Unit number on which an unformatted record containing head should be recorded. Primary unit number from which input to BASl Package INBAS = 1. will be read. Unit number from which input to output control option will be read. DIMENSION (NLAY,4), Flags to control printing and recording of head and drawdown for each layer. (NLAY ,l) f 0, heads will be printed. (NLAY,E) # 0, drawdown will be printed. (NLAY,3) f 0, heads will be recorded. (NLAY,l) f 0, drawdown will be recorded. Primary unit number for all printed output. IOUT = 6. Flag. f 0, starting heads will be saved so that drawdown can be calculated. = 0, starting heads will not be saved. Index. Index. Temporary variable set equal to K. KK‘is used as an actual argument in subroutine calls to avoid using the DO loop variable K as an argument, which causes problems with some compilers. Pointer to location in an array for a specific layer. Number of columns in the grid. Number of cells in a layer. Number of layers in the grid. Number of cells (nodes) in the finite-difference grid. Number of rows in the grid. DIMENSION (NCOL,NROW,NLAY), Starting head. Single-precision temporary storage place for HNOFLO. DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N) Rate for current time step into the flow field. (2,N) Rate for current time step out of the flow field. (3,N) Volume into the flow field during simulation. (4,N) Volume out of the flow field during simulation. 4-30 B Narrative for Module BASlST Module BASlST reads timing information for a stress period and initializes variables used to calculate the length of time steps and elapsed time. Each stress period is divided into time steps which form a geometric progression (for a stress period, there is a multiplier TSMULT such that the length of a time step is equal to TSMULT times the length of the previous time If the length of the stress period (PERLEN) and the number of time step). steps (NSTP) is known, the length of the first time step DELT can be calculated with the equation DELT = (l-TSMULT)*PERLEN/(l-TSMULT**NSTP). Note: When TSMULT is equal to one, all the time steps are the same length. In that case, the time-step length is the length of the stress period (PERLEN) divided by the number of time steps (NSTP). Module BASlST performs steps'in 2. l its functions in the following order: Read the length of the stress period (PERLEN) the number of time the stress period (NSTP), and the time-step miltiplier (TSMULT). Calculate the length of the first (a) Assume the time-step calculate (b) the If the time-step multiplier first term of the geometric 3. Print time multiplier step. is equal to one. - 4. within 5. the timing Initialize the a stress period. (TSMULT) is not equal progression. to one, information. variable PERTIM which RETURN. 4-31 keeps track of elapsed time Flow Chart PERLEN is the length of a stress NSTP is the number of time stress period. steps for Module BASlST period. in a TSMULT is a constant which, when rmltiplied by the length of a time step, gives the length of the next time step. DELT is the length of the first time Since the time steps form a step. geometric progression, the formula for calculating DELT is: READ PERLEN, NSTP, AND TSMULT DELT=(l-TSMULT)*PERLEN/(l-TSMULT**NSTP) PERTIM is a field in which elapsed time during a stress period is accumulated. During each time step, the length of the time step is added to PERTIM. CALCULATE THE LENGTH OF THE FIRST TIME STEP PRINT PERLEN, NSTP, TSMULT, AND 4-32 DELT SUBROUTINE BASlSTt NSTP, DELT, TSMULT,PERTIM, KPER, INBAS,IOUT) C C C-----VERSION C C C 1614 08SEP1982 BASlST *+****************************************~*********************** SETUP TIME PARAMETERSFOR NEW TIME PERIOD ****i************************************************************* E SPECIFICATIONS: -----------------------------------------------------------------C -----------------------------------------------------------------C C Cl--READ LENGTH OF STRESS PERIOD, NUMBEROF TIME STEPS AND. STEPMULTIPLIER. Cl ------TIME READ (INBAS,l) PERLEN,NSTP,TSMULT 1 FORMAT(F10.O,I10,F10.0) C c2 ------CALCULATE THE LENGTH OF THE FIRST TIME STEP. C (-J2/+-ASSUME TIME STEP MULTIPLIERIS EQUAL TO ONE. DELT=PERLEN/FLOAT(NSTP) :2Eb ----IF TIME STEP MULTIPLIERIS NOTONETHENCALCULATE FIRST c25 ----TERM OF GEOMETRIC PROGRESSION. IF(TSMULT.NE.1.) DELT=PERLEN*(l.-TSMULT)/(l.-TSMULT**NSTP) C c3------PRINT TIMING INFORMATION. WRITE ( IOUT, 2 1 KPER, PERLEN, NSTP, TSMULT,DELT 2 FORMAT(lHlr51X,‘STRESS PERIOD NO.‘rI4,‘, LENGTH =‘rG15.7/52X 1,46(‘-‘)//52X,‘NUMBER OF TIME STEPS =‘,I6 2//53X, ‘MULTIPLIER FOR DELT =‘rF10.3 3//50X,'INITIAL TIME STEP SIZE =',G15.7) C c4------INITIALIZE PERTIM=O. C PERTIM (ELAPSED TIME WITHIN STRESS PERIOD). c5 ------RETURN RETURN END 4-33 List Variable of Variables Module BASlST for Definition Range DELT Global Length of the current INBAS Package Primary unit number from which input to the Package will be read. INBAS = 1. IOUT Global Primary KPER Global Stress NSTP Global Number of time PERLEN Module Length PERTIM Package Elapsed TSMULT Package Multiplier next. unit time number for period printed BASl IOUT = 6. output. counter. steps of the stress time all step. during in the current period. period. the current to get from one time 4-34 stress stress step period. length to the Narrative Module BASlAD calculates elapsed time for the old head values Within the equal a stress progression--the length stress of the calculated previous step period to the time the are copied If length period the length step. of the time step steps is a constant The length accumulates period, the and sets form a geometric (TSMULT) times of the first this for the heads at the time step the is the end of the beginning last time of the current HOLD. its functions is not the first step time (DELT). in the step following in the stress Note: The length since the order: period;-‘calculate of the first time step by BASlST. Accumulate the elapsed time Set the heads at the of the stress beginning heads at the end of the previous 4. step, simulation the heads calculated (TOTIM) and the beginning 3. and the total are also into of the time is calculated 2. of the time new head values. the HNEW contains Module BASlAD performs 1. length of each time Those heads which time Module BASlAD in module BASlST. The array step. the period, length for -of this time RETURN. 4-35 step beginning period time of the simulation (PERTIM). step (HNEW). (HOLD) equal to Flow Chart for Module BASlAD TOTIM is an accumulator in which the total elapsed time since the beginning of the simulation is stored. PERTIM is an accumulator in which total elapsed time during the current stress period is stored. the HOLD is the head distribution beginning of a time step. at the HNEW is the head distribution end of a time step. at the (K) I CALCULATE LENGTH OF TIME STEP YES 2 I ADD TIMESTEP LENGTH TO TOTIM AND PERTIM EQUAL TO HNEW c RETURN 4-36 4 B SUBROUTINE BAS~AD(DELT, TSMULT,TOTIM, PERTIM, HNEW,HOLD,KSTP, 1 NCOL,NROW,NLAY1 C C-----VERSION 1412 22FEB1982 BASlAD C ****************************************************************** C ADVANCE TO NEXT TIME STEP C ********************~**************************~****************** C C SPECIFICATIONS: C C -----------_-----------------------------------------------------DOUBLE PRECISIONHNEW C DIMENSION HNEW(NCOL,NROW,NLAY)r HOLD(NCOL,NROW,NLAY) -----------------------------------------------------------------C C Cl----IF NOT FIRST TIME STEP THEN CALCULATE TIME STEP LENGTH. IF(KSTP.NE.l) DELT=TSMULT*DELT C c2--ACCUMULATEELAPSED TIME IN SIMULATIONtTOTIM) AND IN THIS Q----- l STRESSPERIODtPERTIM). TOTIM=TOTIM+DELT PERTIM=PERTIM+DELT C c3------COPY HNEW TO HOLD. DO 10 K=lrNLAY DO 10 I=l,NROW DO 10 J=l,NCOL 10 HOLD(J,I,K)=HNEW(J,I,K) C c4------RETURN RETURN END 4-37 List Variable of Variables for Module BASlAD Definition Range DELT Global Length of the current time step. HNEW Global DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. HOLD Global DIMENSION (NCOL,NROW,NLAY), Head at the start current time step. I Module Row index. 3 Module Column index. K Module Layer KSTP Global Time step period. NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the grid. PERTIM Package Elapsed time during the current TOTIM Package Elapsed time in the simulation. TSMULT Package Multiplier of the index. counter. Reset at the start of each stress in the grid. in the grid. to get from one time 4-38 stress step period. length to the next. Narrative b This module initializes and the that right hand side hi,j,k on the They are calculated hand side are the every For each cell, cell i,j,k 2. right hand side sum of terms its initialize related the equations functions (set (RHS) equal 4-39 RHSi,j,k which on the multiplies The right-hand-side term and to many of the flow components. are formulated. in the RETURN. a term ( h-coefficient) HCOFi,j,k accumulators. D the contains of the equation. time Module BASlFM performs 1. for and a coefficient the h-coefficient in which are accumulated. the equation left Module BASlFM the arrays h-coefficient,(HCOF) Recall for following to zero) order: the HCOF and RHS SUBROUTINE BASlFM(HCOF,RHS, NODES) C C C-----VERSION 1632 24JUL1987 BASlFM : C C C C C ********i********************************************************* SET HCOF=RHS=O. ***+**~*t**************~****************************************** SPECIFICATIONS: -----------------------------------------------------------------DIMENSIONHCOF(NODES),RHS(NODES) ------------------------------------------------------------------ El ------FOR EACH CELL INITIALIZE HCOF AND RHS ACCUMULATORS. DO 100 I=lrNODES HCOF(I)=O. RHS(I)=O. 100 CONTINUE C C2------RETURN RETURN END 4-40 List Variable of Variables for Module BASlFM Definition Range I Module Index. HCOF Global DIMENSION (NODES), Coefficient (J,I,K) in the finite-difference of head in cell equation. NODES Global Number of cells finite-difference RHS Global DIMENSION (NODES), Right difference equation. of terms from several (nodes) 4-41 in the hand side of the finiteRHS is an accumulation different packages. grid. Narrative for Module BASlOC Module BASlOC sets flags used by the budget and output procedures to determine what data should be printed or recorded on disk. There are three individual flags and one table of flags. The individual flags are IHDDFL which indicates that head or drawdown is to be printed or recorded, IBUDFL which indicates that the overall budget should be printed, and ICBCFL which indicates that cell-by-cell flow terms should be calculated and printed or recorded. The table of flags called IOFLG has four flags for They correspond to the four options: print heads, print drawdown, each layer. save heads, and save drawdown. The flags in IOFLG are used in conjunction If IHDDFL is set, IOFLG is used to determine head and with the flag IHDDFL. drawdown on a layer-by-layer basis. If IHDDFL is not set, heads and drawdown are not printed or saved and IOFLG is ignored. step; flags If the user is controlling output, if not, IOFLG is set at the start are set at each time step. Module BASlOC performs its the flags are read at each time of the simulation and the individual functions in the following order: that he will control output. 1. Determine if the user has specified He does so by coding a positive integer in the twelfth element of the That integer is read by module BASlDF and is passed to this IUNIT table. module (BASlOC) under the name INOC. Go to either 2 or 3. 2. The user is not controlling output. Set flags for default-output Flags IHDDFL and IBUDFL are set only at the last time and then return. step in each stress period or when the iterative procedure fails to converge. RETURN. output. Read and print the code 3. The user has chosen to control INCODE and flags IHDDFL, IBUDFL, and ICBCFL. The code INCODE gives the user several options for specifying the flag table IOFLG. 4. Determine greater than zero. whether INCODE is less Go to 5, 6, or 7. than zero, equal to zero, time INCODE is 5. step and print Use the IOFLG flags used in the less than zero. a message to that effect. Go to 8. flags INCODE is 6. in all other Read IOFLG for equal to zero. layers equal to those in layer 7. the the INCODE is greater than zero. layer 1 and then 1. Go to 8. Read IOFLG array. RETURN. 4-42 previous set Go to 8. of what the user has specified, set the 8. Regardless iterative procedure failed to converge or if the current last time step in the stress period. 9. or flag IBUDFL if time step is Flow Chart for Module BASlOC (x-) INOC is the input unit for Output Control specifications. It is specified by the user as the twelfth element of the IUNIT array. If it is less than or equal to zero, the user has chosen the default output. If it is greater than zero, the user has chosen to control output. INCODE provides the user with for filling the IOFLG array. options If INCODE < 0, IOFLG from the last time step is reused. READ INCODE If INCODE = 0, IOFLG for layer 1 is read and all other layers are set equal to layer 1. If INCODE > 0, IOFLG is read. IOFLG is a table of flags with one entry for each layer. Each entry has four flags: 1 ---head print 2 ---drawdown print 3 ---head save 4 ---drawdown save If REUSE IOFLG FROM LAST TIME STEP a flag is set (equal to l), head or drawdown for the corresponding layer is either printed or saved on disk. READ IOFLG FOR LAYER 1 AND SET ALL OTHER LAYERS EOUAL I ‘I IHDDFL is the head/drawdown flag. If it is set, heads and drawdowns will be written in accordance with the flags in IOFLG. IF LAST TIME STEP IN STRESS PERIOD OR FAILED TO C~,NVl~~E. SET IBUDFL is the budget print flag. If it is set, the overall budget will be printed. ICBCFL is the cell-by-cell flow term If it is set, cell-by-cell flag. flow terms will be printed or recorded on disk for those components of flow for which the CBC flag (IWELCB, IRCHCB, IDRNCB, etc.) is set. 4-43 READ IOFLG 1 c SUBROUTINEBASlCC(NSTP,KSTP,ICNVG,IOFLGtNLAYt IBUDFLrICBCFLrIHDDFLrINOCtIOUT) 1632 24JUL1987 BASlCC ******t**************************************~****************~*** C-----VERSION C OUTPUTCONTROLLERFOR HEAD, DRAWDOWN, AND BUDGET *********************************************~***~**************** C C C SPECIFICATIONS: -----------------------------------------------------------------DIMNSION IOFLG(NLAY,4) ----------------L------------------------------------------------- C Cl------TEST UNIT NUMBER(INCC (INOC=IUNIT(lP))) Cl------OUTPUT CONTROLIS ACTIVE. TO SEE IF IF(INOC.NE.O)GO TO 500 n k2 ------IF OUTPUTCONTROLIS INACTIVE THEN SET DEFAULTS AND RETURN. IHDDFL=O IF(ICNVG.EQ.0 .OR. KSTP.EQ.NSTP)IHDDFL=l IBUDFL=O IF(ICNVG.EQ.0 .OR. KSTP.EQ.NSTP)IBUDFL=l ICBCFL=O GO TO 1000 -------READ AND PRINT OUTPUT FLAGS AND CODE FOR DEFINING IOFLG. 500 READ(INOC,l) INCODE,IHDDFLrIBUDFL,ICBCFL 1 FORMAT(4110) WRITE(IOUT,3) IHDDFLrIBUDFLrICBCFL 3 FORMAT(lHO,‘HEAD/DRAWDOWN PRINTOUT FLAG =‘.12r 1 5X,‘TOTAL BUDGETPRINTOUTFLAG =‘112, 2 SX,‘CELL-BY-CELL FLOW TERM FLAG =‘,I21 C C4------DECODE INCQDE TO DETERMINEHOWTO SET FLAGS IN IOFLG. IF(INCODE) 100,200,300 C IOFLG FROMLAST TIt4E STEP. 100 WRITE(IOUT,lOl) C5------USE 101 FORMATtlH #‘REUSING PREVIOUS VALUES OF IOFLG') GO TO 600 W------READ IOFLG FOR LAYER 1 AND ASSIGN SAMETO ALL LAYERS 200 REtW(INOC.201) (IOFLG(l,M)rM=l,4) 201 FORMAT(4110) DO 210 K=l,NLAY IOFLG(K,1)=IOFLG(lrl) IOFLG(K,2)=IOFLG(1,2) IOFLG(K,3)=IOFLG(1,3) IOFLG(K,4)=IOFLG(lr4) 210 CONTINUE WRITE(IOUT,Pll) (IOFLG(l,M),M=1,4) 211 FORMAT(~HDI’OUTPUT FLAGS FOR ALL LAYERS ARE THE SAME:‘/ 1 1X,’ HEAD DRAWDOWNHEAD DRAWDOWN’/ 1X;‘PRINTOUT PRINTOUT SAVE SAVE’/ 1X.34(‘-0/1X,15r110,18,18) GO TO 600 C c7----- READ IOFLG IN ENTIRETY 300 READ(INOCb301) ((IOFLG(K,I),I=1,4),K=l,NLAY) 301 FOlUdAT(4IlO) WRITE(IOUT.302) 302 FORMAT(lH01 ‘OUTPUT FLAGS FOR EACH LAYER: ‘/ 1 1X,' HEAD ORAWDOWNHEAD DRAWDOWN’/ 2 lX,‘LAYER PRINTOUT PRINTOUT SAVE SAVE’/ 3 1X.41(‘-‘)) -WRITEii&T,3U3) (Kt(IOFLG(K,I),I=l,4),K=l,NLAY) 303 F0RMAT(1X,14,18,110,18,18) C CB------ME LAST STEP IN A STRESS PERIOD AND STEPS WHEREITERATIVE C&-----PROCEDURE FAILED TO CONVERGEGET A VOLUM-RIC BUDGET. 600 IF(ICNVG.EQ.0 .OR. KSTP.EQ.NSTP) IBUDFL=l c C9------RENRN 1000 RETURN END 4-44 List Variable I of Variables for Definition Range IBUDFL Module Package ICBCFL Global I CNVG Global I HDDFL Package INCODE Module INOC Package I OFLG Package IOUT K KSTP Global Module Global M NLAY NSTP Module Global Global Module BASlOC Index. Flag. = 0, volumetric budget will not be printed for the current time step. # 0, volumetric budget should be printed for the current time step. Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. # 0, cell-by-cell flow terms will be recorded or printed for the current time step. procedure Flag is set equal to 1 when the iteration has converged. Flag. = 0, neither head nor drawdown will be printed at this time step. # 0, head and drawdown may be printed at the end of the current time step. Code specified by user. < 0, reuse contents of IOFLG from the last time step. = 0, read IOFLG for layer 1 and set all other layers to the same thing. > 0, read IOFLG contents for each layer. Unit number from which input to output control option will be read. DIMENSION (NLAY,4), Flags to control printing and recordina of head and drawdown for each layer. be printed. (NLAY,l)"# 0, heads wi 11 be printed. (NLAYJ) # 0, drawdown be recorded. (NLAY,3) # 0, heads wi 11 be recorded. (NLAY,4) # 0, drawdown printed output. IOUT = 6. Primary unit number for a Layer index. of each stress Time step counter. Reset at the start period. Index. Number of layers in the grid. Number of time steps in the current stress period. 4-45 Narrative Module BASlOT invokes Those results summary. which include Results of flags should be written module drawdowns step (printer results which that If the results flag flag the its If set, volumetric functions It controls the procedure flag which which IBUDFL is flag iterative budget, layers budget. a time set it should printing failed After heads and every invoked time summary is printed. order: in this of a time to be written. SBASlV is following later set, heads and drawdown submodule in the is and a time IHDDFL is SBASlH and SBASlD to write This IPFLG. simulation. IHDDFL, IOFLG, and IBUDFL to flags have been printed, If the head and drawdown flag SBASlH and SBASlD to write in the table 4. calculate 5. print volumetric and for overall of the converge, module if any summary. print a message effect. 3. flags results Control). submodules If are printed. 2. overall according or disk) calls and print Clear write named IOFLG is used to determine Module BASlOT performs 1. which drawdown, are printed respectively. during submodules head, (BASlOT) to calculate Module BASlOT by module BASlOC (Output are set a table This for If If the heads and drawdowns are set, call in accordance submodules with the IOFLG. budget and print a time 6. the (IHDDFL) the printout flag (IBUDFL) volumetric flag is set, call submodule SBASlV to budget. (IPFLG) summary. RETURN. 4-46 is set, call submodule SBASlT to to Flow Chart for Module BASlOT IPFLG is the printout flag. It is set when any results are If it is set, a printed. time summary is printed. SBASlH is a submodule which writes heads. SBASlD is a submodule which writes drawdown. SBASlV is a submodule which prints the volumetric budget. SBASlT is a submodule which prints a time summary. IHDDFL is the head/drawdown If it is set, heads flag. and drawdown will be written in accordance with flag settings in IOFLG. IBUDFL is the budget print If it is set, volumetric flag. budget will be printed. NO I J IOFLG is a table of flags with one entry for each layer. Each entry has four flags: 1 ---head print 2 ---drawdown print 3 ---head save save 4 ---drawdown 4A I NO IF IPFLG IS SET, CALL SBASlT TO PRINT TIME SUMMARY L 8 I 1 SUBROUTINE BASlOTt HNEW,STRT, ISTRT,BUFF, IOFLG, MSUM,IBOUND, VBNM, VBVL, KSTP,KPER,DELT,PERTIM,TOTIM, ITMUNI,NCOL,NROW,NLAY, ICNVG, 2 IHDDFL,IBUDFL,IHEDFM,IHEDUN,IDDNFM,IDDNUN,IOUT~ -----VERSION 1522 12MAY1987 BASlOT ***************~****************************************~********* OUTPUT TIME, VOLUMETRIC BUDGET, HEAD, AND DRAWDOWN *************+**************************************************** : C C C C SPECIFICATIONS: -------------------------- C ---------------------------------------- CHARACTER*4 VBNM DOUBLE PRECISION HNEW C C C Cl--- C CLEAR PRINTOUT FLAG IPFLG=O c2--- C DIMENSION HNEW(NCOL,NROW,NLAY),STRTtNCOL,NROW,NLAY), VBNM(4,20),VBVL(4,20),10FLG(NLAY,4~, 1 IBOUND(NCOL,NROW,NLAY)rBUFF(NCOLINROW,NLAY~ 2 -----------------------------------------------------------------(IPFLG) f IF ITERATIVEPROCEDUREFAILED TO CONVERGEPRINT MESSAGE IF(ICNVG.EQ.0)WRITE(IOUT,l)KSTP,KPER 1 FORMAT(1HO,1OX,‘****FAILED TO CONVERGEIN TIME STEP'rI3, ' OFSTRESS PERIOD'rI3,'****') 1 C3-----C3------ IF HEAD AND DRAWDOWNFLAG (IHDDFL) DRAWDOWNIN ACCORDANCEWITHFLAGS IF(IHDDFL.EQ.0)GOTO 100 IS SET WRITEHEAD AND IN IOFLG. C CALL SBASlH(HNEW,BUFF,IOFLG,KSTP,KPER,NCOL,NROW, NLAY, IOUT, IHEDFM, IHEDUN, IPFLG,PERTIM, TOTIM) CALL SBASlD(HNEW,BUFF,IOFLG,KSTP,KPER,NCOL,NROW,NLAY,IOUT, 1 IDDNFM,IDDNUN,STRT,ISTRT, IBOUND,IPFLG,PERTIM,TOTIM) 1 C c4------PRINT TOTAL BUDGET IF REQUESTED 100 IF(IBUDFL.EQ.0) GO TO 120 CALL SBASlVt MSUM,VBNM,VBVL, KSTP,KPER, IPFLG=l IOUT) :5 ------END PRINTOUT WITHTIME SUMMARYAND FORM FEED IF ANY PRINTOUT c5 ------WILL BE PRODUCED. 120 IF(IPFLG.EQ.0) RETURN CALL SBASlTt KSTP, KPER, DELT, PERTIMITOTIM, ITMUNI,IOUT) WRITE(IOUT,lOl) 101 FORMATt1Hl) C C6------RETURN RETURN END 4-48 , List Variable of Variables for Definition Range BUFF Global DELT HNEW Global Global I BOUND Global I BUDFL Package I CNVG Global IDDNFM IDDNUN Package Package IHDDFL Package I HEDFM I HEDUN Package Package I OFLG Package IOUT I PFLG Global Package I STRT Package ITMUNI Package Module BASlOT DIMENSION (NCOL,NROw,NLAY), Buffer used to accumulate information before printing or recording it. Length of the current time step. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. DIMENSION (NCOL,NR~W,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Flag. = 0, volumetric budget will not be printed for the current time step. f 0, volumetric budget should be printed for the current time step. Flag is set equal to one when the iteration procedure has converged. Code for format in which drawdown should be printed. Unit number on which an unformatted record containing drawdown should be recorded. Flag. = 0, neither head nor drawdown will be printed at this time step. # 0, head and drawdown may be printed at the end of the current time step. Code for the format in which head should be printed. Unit number on which an unformatted record containing head should be recorded. DIMENSION (NLAY,4), Flags to control printing and recording of head and drawdown for each layer. (NLAY,l) # 0, heads will be printed. (NLAY,2) # 0, drawdown will be printed. (NLAY,3) # 0, heads will be recorded. (NLAY,4) # 0, drawdown will be recorded. Primary unit number for all printed output. IOUT = 6. Flag. = 0 means nothing has been printed this time step. f 0 means something has been printed this time a time summary must be printed. step; therefore, Flag. # 0, starting heads will be saved so that drawdown can be calculated. = 0, starting heads will not be saved. Code for time units for this problem: 0 - undefined lseconds 2 - minutes 3 - hours 4 - days 5 - years 4-49 List Variable of Variables for Module BASlOT (Continued) Definition Range KPER Global KSTP Global MSUM NCOL NLAY NROW PERTIM STRT TOTIM VBNM Global Global Global Global Package Package Package Global VBVL Global Stress period counter. Time step counter. Reset at the start of each stress period. Counter for budget entries and labels in VBVL and VBNM. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Elapsed time during the current stress period. DIMENSION (NcOL,NROW,NLAY), Starting head. Elapsed time in the simulation. DIMENSION (4,20), Labels for entries in the volumetric budget. Entries for the volumetric budget. , DIMENSION (4,20), For flow component N, the values in VBVL are: (l,N) Rate for the current time step into the flow field. (2,N) Rate for the current time step out of the flow field. (3,N) Volume into the flow field during simulation. (4,N) Volume out of the flow field during simulation. 4-50 Narrative for Module SBASlD Module SBASlD is called by module BASlOT to calculate and write drawdown' for every cell in certain layers in the grid. The module is called at the end of each time step if the head and drawdown flag (IHDDFL) is set. It calculates drawdown only if the user has specified that starting heads should be saved. The layers for which drawdown is to be written are determined by the In IOFLG, there are four flags settings of flags in the table named IOFLG. The second flag, if it is set, causes drawdown to be printed. each layer. The fourth flag, if it is set, causes drawdown to be recorded. Module SBASlD performs 1. For each layer, If flags indicate 2. on to the next layer. 3. 4 or 5. Test flag its functions do steps that in the following order: 2-5. drawdown is ISTRT to see if starting 4. Starting heads were not saved. 5. Starting heads were saved. not needed for this heads were saved. Write layer, go Go to either a message to that effect drawdown for layer. and STOP. Calculate if drawdown is to be printed, 6. For each layer, or ULAPRW, depending on the format requested (IDDNFM), 7. to write 8. if drawdown is to be recorded, For each layer, the drawdown to the unit specified in IDDNUN. RETURN. 4-51 this call module ULAPRS to print drawdown. call module ULASAV for Flow Chart IOFLG is a table containing one entry for each layer. Each element consists of four flags which, when set. cause (1) head to be printed, (2) drawdown to be printed, (3) head to be recorded, and (4) drawdown to be recorded. for Module SBASlD (YE--) FOR EACH LAYER 1 ULAPRW is a utility module which prints a value for each cell in a wrao format. In the wrap format', all values for one row are printed before any values for the next row. PRINT MESSAGE SAYING STARTING HEADS WERE NOT SAVED ULAPRS is a utility module which prints a value for each cell in the layer in In the a strip format. strip format, all values in a group of N columns are printed before any values in the next N columns are printed. CALCULATE DRAWDOWN FOR EACH LAYER ULASAV is a utility module which records a value for each cell in a layer. IDDNUN is a unit number, specified by the user, on which drawdown will recorded. I 6 CALL MODULES ULAPRW OR ULAPRS TO PRINT DRAWDOWN be 4-52 b SUBRWTINE SBAS~D(HNEW~BUFF~IOFLG,KSTF’,KPERINCOL,NRCW, 1 NLAY,IOUT,IDDNFM,IDDNUN,STRT,ISTRTtIBWND,IPFLGt 2 PERTIMsTOTIM) C-----VERSION 1630 lSMAY1987 SBASlD *************************************************~***** C CALCULATEPRINT AND RECORDDRAWDOWNS c **+*******~***C*****~******~********~**********~*****~~ c kC SPECIFICATIONS ------------------------------------------------------CHARACTER*4TEXT DOUBLEPRECISION HMW C 1 2 DIMENSION HNEW(NCOLrNROW,NLAY),IOFLG(NLAY,4)rTEXT(4), BUFF(NCOLrNRCW,NLAY),STRT(NCOL,NROW,NLAY), IBCUND(NCOL,NRCW,NLAY) c DATA TEXT(l),TEXT(2)rTEXT(3l,TEXT(4) 1 'DOWN'/ ------_------------------------------------------------ /’ ‘,’ ‘r’DRAW’r c C Cl------FOR EACH LAYER CALCULATEDRAWDOWN IF PRINT OR RECORD Cl------IS REQUESTED DO 59 K=l,NLAY C C2------IS DRAWDOWN NEEDEDFRO THIS LAYER? IF(IOFLG(K,Z).EQ.O .AND. IOFLG(Ks4).EQ.O) GO TO 59 n B i3 ------DRAWDOWN IS NEEDED. WERESTARTING HEADS SAVED? IF(ISTRT.NE.0) GO TO 53 C a------STARTING HEADS WERENOT SAVED. PRINT MESSAGEAND STOP. WRITE(IOUT,52) 52 FORMATtlHOr’CANNOT CALCULATEDRAWDOWN BECAUSESTART’, 1 ’ HEADSWERENOT SAVED’) STOP C CS------CALCULATE DRAWDOWN FOR THE LAYER. 53 DO 58 I=l,NRW DO 58 J=l,NCOL HSING=HNEW(J,I,K) E!UFF(J,I,K)=HSING IF(IBCiJND(J,I,K).NE.O) BUFF(J,I,K)=STFtT(J,I,Kl-HSING 58 CONTINUE 59 CONTINUE C C6------FOR EACH LAYER: DETERMINEIF DRAWDOWN SHOULDBE PRINTED. IX------IF SO THEN CALL ULAPRS OR ULAFRWTO PRINT DRAWDOWN. DO 69 K=ltNLAY KK=K IF(IOFLG(K,Z).EQ.O) GO TO 69 IF(IDDNFM.LT.0) CALL ULAPRS(BUFF(l,l,K),TEXT(l),KSTP,KPER, 1 NCOL,NRW,KK,-IDDNFM,IOUT) IF(IDDNFM.GE.0) CALL ULAPRW(BUFF(lrlrK),TEXT(l),KSTP,KPER, 1 NCOL,NR~,KK,IDDNFM,IOUT) IPFLG=l 69 CONTINUE C C7------FOR EACH LAYER: DETERMINEIF DRAWDOWN SHOULDBE RECORDED. C7------IF SO THEN CALL ULASAV TO RECORDDRAWDOWN. IFIRST=l IF(IDDNUN.LE.0) GO TO 80 DO 79 K=lrNLAY KK=K IF(IOFLG(K,4).LE.O) GO TO 79 IF(IFIRST.EQ.l) WRITE(IOUT,74) IDDNUN,KSTP,KF’ER 74 FO~AT(lHD,‘DRAWDOWN WILL BE SAVED ON llNIT’tI3, 1 ’ AT END OF TIME STEP’rI3r’s STRESS PERIOD’,131 IFIRST=O CALL ULASAV(BUFF(lrltK),TEXT(l)rKSTP,KPER,PERTIM,TOTIM,~L, 1 NRCW,KK,IDDNUN) 79 CONTINUE c C8------RETURN 80 RETURN END 4-53 List Variable for Global HNEW Global HSING I I BOUND Module Module Global I DDNFM I DDNUN Package Package IFIRST Module I OFLG Package IOUT I PFLG Global Package I STRT Package J K KK Module Module Module KPER KSTP Global Global NCOL NLAY NROW PERTIM STRT TEXT Global Global Global Package Package Module Package Module SBASlD Definition Ranae BUFF TOTIM of Variables DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. Single-precision temporary field for HNEW (J,I,K). Index for rows. DIMENSION (NcOL,NR~W,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Code for format in which drawdown should be printed. Unit number on which an unformatted record containing drawdown should be recorded. Flag to indicate that a notice should be printed when drawdown is recorded. DIMENSION (NLAY,4), Flags to control printing and recording of head and drawdown for each layer. (NLAY,l) # 0, heads will be printed. (NLAY,2) # 0, drawdown will be printed. (NLAY,3) # 0, heads will be recorded. (NLAY,4) # 0, drawdown will be recorded. Primary unit number for all printed output. IOUT = 6. Flag. = 0 means nothing has been printed this time step. f 0 means something has been printed this time step; therefore, a time summary must be printed. Flag. # 0, starting heads will be saved so that drawdown can be calculated. = 0, starting heads will not be saved. Index for columns. Index for layers. Temporary variable set equal to K. KK is used as an actual argument in subroutine calls to avoid using the DO loop variable K as an argument, which causes problems with some compilers. Stress period counter. Reset at the start of each stress Time step counter. period. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Elapsed time during the current stress period. DIMENSION (NCOL,NROW,NLAY), Starting head. Label to be printed or recorded with array data. Elapsed time in the simulation. 4-54 Narrative for Module SBASlH Module SBASlH prints and records head for every cell in certain layers in the grid. It is called by module BASlOT at the end of each time step if the head and drawdown flag (IHDDFL) is set. The layers for which head is written is controlled by the settings of flags in the table named IOFLG. In IOFLG, there are four flags for each layer. The first flag, if it is set, causes head for the corresponding layer to be printed. The third flag, if it is set, causes head to be recorded. Module SBASlH performs 1. For each layer, its functions in the following order: DO STEPS 2-4. this 2. Test the flag table (IOFLG) to see if If so, DO STEPS 3 AND 4, layer. heads should array 3. Copy heads for this layer (which are contained in the double-precision (HNEW)) into the single-precision buffer array (BUFF). code, call 4. Depending on the print-format ULAPRS to print the contents of the buffer array. either be printed for module ULAPRW or 5. Test the unit number for recording heads (IHEDUN) to see if it is If it is not positive, heads will not be recorded (SKIP STEPS positive. heads may be recorded in accordance with the setting If it is positive, 6-9). of flags in the IOFLG array. DO STEPS 6-9. 6. this For each layer, If 7. layer, DO STEPS 7-9. flags in IOFLG indicate that move on to the next layer. 8. Copy heads from the HNEW array (single-precision). 9. 10. Call module ULASAV to record RETURN. 4-55 heads are not to be recorded (double-precision) the heads on unit for to the BUFF array IHEDUN. Flow Chart for Module SBASlH IOFLG is a table containing one Each entry for each layer. element consists of four flags which, when set, cause (1) head to be printed, (2) drawdown to be printed, (3) head to be recorded, and (4) drawdown to be recorded. NO ULAPRW is a utility module which prints a value for each cell in the layer in a wrap format. In the wrap format, all values for one row are printed before any values for the next row. COPY HEADS INTO BUFFER ULAPRS is a utility module which prints a value for each cell in the layer in a strip format. In the strip format, all values in a group of N columns are printed before any values in the next N columns are printed. ULASAV is a utility records a value in a layer. CALL ULAPRW OR ULAPRS TO PRINT HEADS module which for each cell FOR EACH LAYER IHEDUN is a unit number, specified by the user, on which heads will If IHEDUN is less be recorded. than or equal to zero, heads will not be recorded. I I YES r6 Y t YES COPY HEADS RECORD HEADS 4-56 1 SUBROUTINE SBAS~H(HNEW,BIJFFIIOFLG,KSTPIKPERINCOL,NROW, 1 NLAY~IOUT,IHEDFMIIHEDUN,IPFLG,F'ERTIM,TOTIM) C C-----VERSION 1653 15MAY1987SBASlH ******************************************************* c" PRINT AND RECORD HEADS ******************************************************* : C SPECIFICATIONS ------------------------------------------------------- C CHARACTER*4 TEXT DOUBLE PRECISION HNEW C DIMENSIONHNEW(NCOL,NROW,NLAY),IOFLG(NLAY,4),TEXT(4), 1 BUFF(NCOL,NRCW,NLAY) C DATA TEXT(l),rrXT(2)rrrXT(3),TEXT(4) ‘HEAD’/ --_--------------------------------------------------- 1 : Cl--- /’ ‘,’ 1,’ ‘, FOR EACH LAYER: PRINT HEAD IF REQUESTED. DO 39 K=lrNLAY KK=K C CP------TEST IOFLG TO SEE IF(IOFLG(K,l).EQ.O) IPFLG=l C C3------COPY HEADS FOR IF HEAD SHOULD BE PRINTED. GOTO 39 THIS LAYER INTO BUFFER. DO32 I-1rNROW DO 32 J=lrNCOL BUFF(J,I,l)=HNEW(J,I,K) 32 CONTINUE C c4 ------CALL UTILITY MODULE TO PRINT CONTENTS OF BUFFER. IF(IHEDFM.LT.0) CALL ULAPRS(BLIFF,TEXT(l)rKSTP,KPER,NCOLrNRUV,KK, 1 -1HEOFMrIOUT) IF(IHEDFM.GE.0) CALL ULAPRW(BUFFITEXT(~)~KSTPIKPERINCOL,NROW,KK, IHEDFM,IOUT) 391CONTINUE :5 C ------IF UNIT FOR RECORDING HEADS <= 0: THEN RETURN. IF(IHEDUN.LE.O)GOTO 50 IFIRST=l C&-----FOR EACH LAYER: RECORD HEAD IF REQUESTED. DO 49 K=l,NLAY KK=K C C7----- -CHECK IOFLG TO SEE IF HEAD FOR THIS LAYER SHOULD BE RECORDED. IF(IOFLG(K,3).LE.O) GO TO 49 IF(IFIRST.EQ.l) WRITE(IOUT,41) IHEDUNnKSTPrKPER 41 FORMAT(lHDs’HEAD WILL BE SAVED ON UNIT’rI3,’ AT END OF TIME STEP’, 1 13,‘s STRESS PERIOD’s131 C IFIRST=O HEADS FOR THIS LAYER INTO BUFFER. DO44 I=l,NROW DO 44 J=l,NCOL BUFF(JrI,l)=HNEW(J,I,K) 44 CONTINUE CB------COPY C C9------RECORD CONTENTS OF BUFFER ON UNIT=IHEDUN CALL ULASAV(BUFFITEXT(~),KSTP,KPER,PERTIM,TOTIM,NCOL~NROW,KK, 1 IHEDUN) 49 CONTINUE C ClD-----RETURN 50 RETURN END 4-57 List Variable for Global HNEW Global I I FIRST Module Module I HEDFM I HEDUN Package Package I OFLG Package IOUT I PFLG Global Package 3 Module Module Module DIMENSION (NC~L,NR~W,NLAY), Buffer used to accumulate information before printing or recording it. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. Index for rows. Flag which, if set (equal to l), indicates that a notice should be printed when head is recorded. Code for format in which head should be printed. Unit number on which an unformatted record containing head should be recorded. DIMENSION (NLAY,4), Flags to control printing and recording of head and drawdown for each layer. (NLAY,l) # 0, heads will be printed. (NLAY,2) # 0, drawdown will be printed. (NLAY,3) # 0, heads will be recorded. (NLAY,4) # 0, drawdown will be recorded. Primary unit number for all printed output. IOUT = 6. Flag. = 0 means nothing has been printed this time step. # 0 means something has been printed this time a time summary must be printed. step; therefore, Index for columns. Index for layers. Temporary variable set equal to K. KK is used as an actual KPER KSTP Global Global NCOL NLAY NRCW PERTIM TEXT TOTIM Global Global Global Package Module Package Module SBASlH Definition Range BUFF K KK of Variables argument in subroutine the DO loop variable K as an problems with some compilers. Stress period counter. Reset at the Time step counter. period. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Elapsed time during the current Label to be printed or recorded Elapsed time in the simulation. 4-58 calls to argument, start avoid using which causes of each stress stress period. with array data. Narrative for Module SBASlI Module SBASlI initializes the Output Control System. If the user does not opt to control output, the formats for printing head and drawdown are set to the default format and flags are set so that, whenever heads or drawdowns are printed, they are printed for all layers. If the user does opt to control output, the formats for printing and the unit numbers for recording head and drawdown are read. A table named IOFLG contains one entry for each layer in the grid. Each entry consists of four flags corresponding to four operations: (1) head print, (2) drawdown print, (3) head record, and (4) drawdown record. The module BASlOT examines the table and, for each layer, performs only the operations for which the corresponding flags are set (equal to one). This module (SBASlI) sets the head-print flag if the user opts for default output. If starting heads are saved, it also sets the drawdown-print flag. If the user opts to control output, the flags in IOFLG are read at each time step. Module SBASlI performs its functions in the following order: (IUNIT (12)), which is known 1. Test the unit number for Output Control If it is positive, in this module by the name INOC, to see if it is positive. the Output Control option is active and output specification will be read from the unit number contained in INOC. If it is not positive, the Output Control option is not active and flags are set to defaults. GO TO 2 OR 3. is active. Read and print the head-print format 2. Output Control code (IHEDFM), the drawdown-print format code (IDDNFM), the unit number to record heads (IHEDUN), and the unit number to record drawdown (IDDNUN). GO TO 6. Note: The formats and associated codes are listed in the Input Instructions for Output Control. 3. Output Control is 4. Set the print-format get the default format. all 5. Set the layers. 6. flags inactive. codes Print a message listing (IHEDFM and IDDNFM) equal in IOFLG so that RETURN. 4-59 the defaults. to zero to head and drawdown are printed for Flow Chart for Module SBASlI INOC is the input unit for Output Control. It is the same as element 12 in the IUNIT table. When it is greater than zero, Output Control is active--the user will provide output speciWhen it is less fications. than or equal to zero, Output Control is inactive--output will be controlled by default. ENTER SBASl I ci IOFLG is a table containing one entry for each layer. Each entry consists of four flags which, when set, cause (1) head to be printed, (2) drawdown to be printed, (3) head to be recorded, and (4) drawdown to be recorded. +4. SET THE FORMAT CODES EQUAL ’ l- 4-60 SET IOFLG FOR HEAD PRINT IN ALL LAYERS B SUBROUTINE SBAS1I(NLAY,ISTRT,IOFLG,INOC,IOUT,IHEDFM, 1 IDDNFM, IHEDUN,IDDNUN) -----VERSION 1531 12MAY1987SBASlI ************************************************************** C C SET UP OUTPUT CONTROL C ************************************************************** SPECIFICATIONS: C DIMENSION IOFLG(NLAYs4) --------------------------------------------------------------- El ------TEST UNIT NUMBERFROM IUNIT (INOC) TO SEE IF OUTPUT Cl ------CONTROL IS ACTIVE. IF(INOC.LE.0) GOTO 600 C ------READ AND PRINT FORMATSFOR PRINTING AND UNIT NUMBERSFOR :x ------RECORDING HEADS AND DRAWDOWN.THEN RETURN. 500 READ (INOC,l)IHEDFM,IDDNFM,IHEDUN,IDDNUN 1 FORMAT (4110) WRITE (IOUT, 1IHEDFM, IDDNFM 3 FORMAT (lHO,‘HEAD PRINT FORMATIS FORMATNUMBER’rI4, I 1 DRAWDOWN PRINT FORMATIS FORMATNUMBER’,141 WRITE(IOUT,4)IHEDUN,IDDNUN 4 FORMAT (lHO,'HEADSWILL BE SAVED ON UNIT'rI3, 1 1 DRAWDOWNS WILL BE SAVED ON UNIT',131 WRITE(IOUT,561) 561 FORMAT(lHO,‘OUTPUT CONTROLIS SPECIFIED EVERY TIME STEP’) GO TO 1000 C c3------OUTPUT CONTROLIS INACTIVE. PRINT A MESSAGELISTING DEFAULTS. 600 WRITE(IOUT,641) 641 FORMAT(lHO,‘DEFAULT OUTPUT CONTROL-- THE FOLLOWINGOUTPUT’, 1 ’ COMESAT THE END OF EACH STRESS PERIOD: '1 WRITE(IOUT,642) 642 FORMAT{1X, ‘TOTAL VOLUMETRICBUDGET’1 WRITE(IOUT,643) 643 FORMAT(lXrlOX,'HEAD') IF(ISTRT.NE.O)WRITE(IOUT,644) 644 FORMAT(lX,lOX,'DRAWDOWN') C c4------SET THE FORMATCODES EQUAL TO THE DEFAULT FORMAT. IHEDFM=O IDDNFM=O C ------SET DEFAULT FLAGS IN IOFLG SO THAT HEAD (AND DRAWDOWN)IS FOR EVERY LAYER. E ------PRINTED ID=0 IF(ISTRT.NE.0) ID=1 670 DO680 K=l,NLAY IOFLG(K,l)=l IOFLG(K,2)=ID C D IOFLG(K,3)=0 IOFLG(K,4)=0 680 CONTINUE GOTO 1000 C6------RETURN 1000 RETURN END 4-61 List Variable of Variables for Module SBASlI Definition Range ID Module Flag to show if means no). STRT was saved IDDNFM Package Code for in which IDDNUN Package Unit number on which an unformatted drawdown should be recorded. IHEDFM Package Code for IHEDUN Package Unit INOC Package Unit number from which will be read. IOFLG Package DIMENSION (NLAY,4), Flags to control printing and recording of head and drawdown for each layer. (NLAY,l) # 0, heads will be printed. (NLAY,Z) # 0, drawdown will be printed. (NLAY,3) # 0, heads will be recorded. (NLAY,4) # 0, drawdown will be recorded. IOUT Global Primary I STRT Package Flag. format format (one means yes; drawdown should in which number on which an unformatted head should be recorded. unit number for input all f 0, starting heads will can be calculated. = 0, starting heads will K Module Index for NLAY Global Number of layers layers 4-62 in the grid. containing be printed. record to output printed be printed. record head should zero containing control output. be saved so that not be saved. option IOUT = 6. drawdown Narrative Submodule SBASlT prints length and the elapsed program given the option those units (ITMUNI) other If are being the conversion units. units However, that convenient days, he is units. and years. the using user and the The user The is program specifies indicator time factor (ITMUNI) to determine the conversion to seconds. is equal to zero, nonstandard time units used. (a) nonstandard Print the time-step length and the elapsed time in the units. (b) 3. hours, of the time-step in module BASlDF. (CNV) needed to convert 2. consists minutes, set of time the time to all Use the time-unit 1. factor to specify units summary which in seconds, can use any consistent converts time a time time Module SBASlT for RETURN. Calculate the length of the time Calculate the time-step step and the elapsed times in seconds. 4. hours, days, length and the elapsed times in minutes, and years. 5. Print the time-step 6. RETURN. length and the elapsed 4-63 times in all time units. SUBROUTINE SBAS1T(KSTP,KPER,DELT,PERTIM,TOTIM,ITMUNIrIOUT) C C C-----VERSION 0837 09APRh982 SBASlT ****************************************************************** PRINT SIMULATION TIME C cC C C C C ****************************************************************** SPECIFICATIONS: -----------------------------------------------------------------_----------------------------------------------------------------WRITE(IOUTn199) KSTPnKPER 199 FO~AT(lHO,///lOX,‘TIME SUMMARY AT END OF TIME STEP’rI3r ' IN STRESS F'ERIOD'rI3) 1 C Cl----- C a USE TIME UNIT INDICATOR TO GET FACTOR TO CONVERT TO SECONDS. CNV=O. IF(ITMUNI.EQ.l) CNV-1. IF(ITMUNI.EQ.2)CNV=60. IF(ITMUNI.EQ.3)CNV=3600. IF(ITMUNI.EQ.4)CNV=86400. IF(ITMUNI.EQ.5)CNV=31557600. f-3--- IF FACTOR=0 THEN TIMEUNITS ARE NON-STANDARD. IF(CNV.NE.0.) GO TO 100 TIMESIN NON-STANDARD TIME UNITS. WRITE(IOUTs301) DELT,PERTIM,TOTIM 301 FORMAT( 21X,' TIME STEP LENGTH =‘rG15.6/ 1 21X,' STRESS PERIODTIME='rG15.6/ 21X,'TOTALSIMULATION TIME=',Gl5.6) 2 :2A -----PRINT C CPE?-----RETURN RETURN C C3-----CALCULATE LENGTH OF TIME STEP 8 ELAPSED TIMESIN SECONDS. 100 DELSEC=CNV*DELT TOTSEC=CNV*TOTIM PERSEC=CNV*PERTIM C TIMESIN MINUTESIHOURSIDAYS AND YEARS. c4 ------CALCULATE DELMN=DELSEC/60. DELHR=DELMN/BO. DELDY=DELHW24. DELYR=DELDY/365.25 TOTMN=TOTSEC/BO. TOTHR=TOTMN/60. TOTDY=TOTHW24. TOTYR=TOTDY/365.25 PERMN=PERSEC/60. PERHR=PERMN/60. PERDY=PERHW24. PERYR=PERDY/365.25 C Cl+--PRINT TIME STEP LENGTH AND ELAPSED TIES IN ALL TIM UNITS. WRITE(IOUT,POO) C 200 FORMATt 27X, ’ SECONDS MINUTES 1 ‘DAYS YEARS’/27X,75(‘-‘1) WRITE (IOUT, DELSEC,DELMN,DELHR,DELDY,DELYR 201 FOfU.fAT(lX,’ TIME STEP LENGTH',5X,5615.6) WRITE(IOUT,POP) PERSEC,PERMN,PERHR,PERDYrPERYR 202 FORMAT(lX,’ STRESS PERIOD TIME'rSX,5G15.6) WRITE(IOUT,203) TOTSEC~TOTMN~TOTHRITOTDYITOTYR 203 FORMAT(lX,‘TOTAL SIMULATION TIME',SX,5G15.6) C6------RETURN RETURN END 4-64 HOURS',lOX, a List Variable Ranae CNV Module DELDY DELHR DELMN DELSEC DELT DELYR IOUT ITMUNI Module Module Module Module Global Module Global Package KPER KSTP Global Global PERDY PERHR PERMN PERSEC Module Module Module Module Package Module Module Module Package Module Module Module PERTIM PERYR TOTDY TOTHR TOTIM TOTMN TOTSEC TOTYR of Variables for Module SBASlT Definition Factor to convert elapsed time from units, specified by the user, to seconds. Length of the time step in days. Length of the time step in hours. Length of the time step in minutes. Length of the time step in seconds. Length of the current time step. Length of the time step in years. Primary unit number for all printed output. IOUT = 6. Code for time units for this problem: 0 - undefined 1 - seconds 2 - minutes 3 - hours 4 - days 5 - years Stress period counter. Reset at the start of each stress Time step counter. period. Elapsed time in the stress period in days. Elapsed time in the stress period in hours. Elapsed time in the stress period in minutes. Elapsed time in the stress period in seconds. Elapsed time during the current stress period. Elapsed time in the stress period in years. Elapsed time in the simulation in days. Elapsed time in the simulation in hours. Elapsed time in the simulation. Elapsed time in the simulation in minutes. Elapsed time in the simulation in seconds. Elapsed time in the simulation in years. 4-65 Narrative for Module SBASlV Module SBASlV calculates and prints the overall volumetric budget. The individual entries for the budget, which are calculated by the budget packages, are passed to this modules in each of the component-of-flow module in a tab le named VBVL. Each entry in VBVL corresponds to a component-of-flow. It consists rate of inflow for the current time step, rate of outflow of four values: for the current time step, accumulated volume of inflow since the beginning of the simulation, and accumulated volume of outflow since the beginning of the simulation. In this module, the total of all inflow rates (TOTRIN), outflow rates (TOTROT), inflow-accumulated volumes (TOTVIN), and outflowaccumulated volumes (TOTVOT) are calculated. The percent differences between those totals are also calculated and printed. The labels for the entries are supplied by the budget modules in the component-of-flow packages and passed in the table VBNM. Module SBASlV performs Use the (MSUMl). 1. terms counter its functions MSUM to determine in the the following order: number of individual budget for rates and volumes. The accumulators 2. Clear the four accumulators are total rate into the system (TOTRIN), total rate out of the system (TOTROT), accumulated volume into the system (TOTVIN), and accumulated volume out of the system (TOTVOT). 3. For each source calculated by the budget or sink, modules, add the budget entries to the accumulators. 4. Print the number of the time 5. Print the individual input 6. Print the individual output step rates rates and stress and volumes and volumes (rates and volumes), period. and their and their totals. totals. the difference between flow into and out of the simulated7. Calculate flow system. Calculate the percent difference between input and output rates (lOO*(TOTRIN-TOTROT)/((TOTRINtTOTROT)/2)). Calculate the percent difference between input and output accumulated volumes (lOO*(TOTVIN-TOTVOT)/ ((TOTVIN+TOTVOT)/2)). 8. output 9. Print the differences rates and volumes. and percent RETURN. 4-66 differences between input and Flow Chart for Module SBASlV The inflow and outflow rates for the current time step and accumulated volumes since the beginning of the simulation for each budget entry (component-of-flow) are added to the four accumulators to obtain the total inflow and outflow rates for the current time step and the total accumulated volume of flow in and volume of flow out since the start of the simulation. ENTER SBASlV THE NUMBER CLEAR THE FOUR RATE AND VOLUME ACCUMULATORS FOR EACH BUDGET ENTRY ADD THE RATES AND VOLUMES FOR THE CURRENT TIME STEP TO THE ACCUMULATORS i FOR EACH BUDGET ENTRY 4 PRINT THE NUMBER OF THE TIME STEP AND XFDRESS - PRINT INFLOW RATE AND A;C$luM;ELATED 4-67 SUBROUTINE SBASlVt MSUM,VBNM,VBVL, KSl?, KPER, IOUT) C C C-----VERSION 1531 12MAY1987SBASlV *********************************************************~******** C C PRINT VOLUMETRIC BUDGET ********************************************************~********* C C C SPECIFICATIONS: -------_---------------------------------------------------------- C CHARACTER*4 VBNM DIMENSION VBNM(4,20)rVBVL(4,20) ------------------------------------------------------------------ C C Cl--- DETERMINE NUMBEROF INDIVIDUAL BUDGET ENTRIES. MSUMl=MSUM-1 IF(MSUMl.LE.0) RETURN C C2---- CLEAR RATE AND VOLUME ACCUMULATORS. TOlRIN=O. TOTROT=O . TOTVIN=O. TOTVOT=O. C C3------ ADD RATES AND VOLUMES (IN AND OUT) TO ACCUMULATORS. DO 100 L=lrMSUMl TOTRIN=TOTRIN+VBVL(3,L) TOTROT=TOTROT+VBVL(4rL) TOTVIN=TOTVIN+VBVL(lrL) TOTVOT=TOTVOT+VBVL(Z,L) 100 CONTINUE C cx------PRINT TIME STEP NUMBERAND STRESS PERIODNUMBER. WRITE(IOUT,260) KSTP,KPER WRITE(IOUTp265) C C5------ PRINT INDIVIDUAL INFLOWRATES AND VOLUMES AND THEIR TOTALS.. DO 200 L=lrMSUMl WRITE(IOUT,275) (VBNM(I,L)rI=l,4)rVBVL(lrL)r(VBNM(I,L),I=l,4~ l,VBVL(3,L) 200 CONTINUE WRITE(IOUT,286) TOTVIN,TOTRIN :6 ------PRINT INDIVIDUAL OUTFLOWRATES WRITE(IOUT,287) DO 250 L=lrMSUMl 4-68 ANDVOLUMES AND MEIR TOTALS. B WRITE(IOUT,275) (VBNM(I,L)rI=lr4)rVBVL(2rL),(VBNM(I,L)rI=l,4~ lrVBVL(4rL) 250 CONTINUE WRITE(IOUT,298) TOTVOT,TOTROT ------CALCULATE THE DIFFERENCE BETWEEN INFLOW AND OUTFLOW. C C7A-m-s CALCULATE DIFFERENCE BETWEENRATE IN AND RATE OUT. DIFFR=TOTRIN-TOTROT C c7 B----- CALCULATE PERCENT DIFFERENCE BETWEENRATE IN AND RATE OUT. PDIFFR=100.*DIFFR/((TOTRIN+TOTROT)/2) C C7C----- C CALCULATE DIFFERENCE BETWEENVOLUME IN AND VOLUME OUT. DI FFV=TOTVIN-TOTVOT C7D----- GET PERCENT DIFFERENCE BETWEENVOLUME IN AND VOLUME OUT. PDIFFV=100.*DIFFV/((TOTVIN+TOTVOT)/2) C (33--PRINT DIFFERENCES AND PERCENT DIFFERENCES BETWEENINPUT C&--AND OUTPUT RATES AND VOLUMES. WRITE(IOUT,299) DIFFVIDIFFR WRITE(IOUTt300) PDIFFVIPDIFFR C c9------RETURN l RETURN C C C ---FORMATS 260 FORMAT(lHO,///30X,‘VOLUMETRIC BUDGET FOR ENTIRE MODEL AT END OF’ 1,’ TIME STEP'rI3,' IN STRESS PERIOD',I3/30X,77('-'1) 265 FORMAT(lH0,19X,‘CUMULATIVE VOLUMES’r6X,‘L**3’,37X 1,'RATES FOR THIS TIME STEP’r6X,‘L**3/T’/20X,l8(‘-‘),47X,24(’-’) 2//26X,'IN:',68X,'IN:'/26X,'---'r68X,'---') 275 FORMAT(lX,18X,4A4,’ =‘,G14.5,39X,4A4,’ =‘,G14.5) 286 FORMAT(lHO,26X,‘TOTAL IN ='rG14.5,47X,'TOTAL IN =’ 1,614.5) 287 FORMAT(lHO,24X,‘OUT:‘r67X,‘OUT:‘/25X,4(’-’),67X,4(‘-‘)) 298 FORMAT(lH0,25X, ‘TOTAL OUT =‘,G14.5,46X, ‘TOTAL OUT =’ 1,614.5) 299 FORMAT(lH0,26X,‘IN - OUT =',G14.5,47X,'IN - OUT =‘rG14.5) 300 FORMAT(lHO,15X,‘PERCENT DISCREPANCY =‘rF20.2 1,30X,‘PERCENT DISCREPANCY =‘,F20.2,///) C END 4-69 List Variable Range DIFFR Module DIFFV Module I IOUT KPER KSTP Module Global Global Global L MSUM Module Global MSUMl PDIFFR PDIFFV TOTRIN TOTROT TOTVIN TOTVOT VBNM Module Module Module Module Module Module Module Global VBVL Global of Variables for Module SBASlV Definition Sum of all inflow rates minus sum of all outflow rates (TOTRI N-TOTROT). Sum of all inflow volumes minus sum of all outflow volumes (TOTVIN-TOTVOT). Index. Primary unit number for all printed output. IOUT = 6. Stress period counter. Reset at the start of each stress Time step counter. period. Index for individual flows. Counter for the budget entries and labels in VBVL and VBNM. MSUM-1. Percent difference between the rate in and rate out. Percent difference between the volume in and volume out. Accumulator for the total of all inflow rates. Accumulator for the total of all outflow rates. Accumulator for the total of all inflow volumes. Accumulator for the total of all outflow volumes. DIMENSION (4,20), Labels for entries in the volumetric budget. DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N) Rate for the current time step into the flow field. (2,N) Rate (3,N) (4,N) field. Volume into the flow field during simulation. Volume out of the flow field during simulation. for 4-70 the current time step out of the flow CHAPTER 5 I BLOCK-CENTEREDFLOW PACKAGE Conceptualization The Block-Centered components adjacent the Flow (BCF) Package computes of the finite-difference It also cells. movement of water it and Implementation a node is located name Block-Centered developed computes the terms Flow is 2, the equation which that determine determine To make the to and from storage. is assumed that In Chapter equation at the center given the conductance flow the required between rate of calculations, of each model cell; thus to the package. of flow for each cell in the model was as +CCi-1/2,j,khi-l,j,ktCRi,j-1/2,khi,j-l,k Cvi,j,k-1/2hi,j,k-1 t (-Cvi,j,k-1/2’CCi-l/2,j,k-CRi,j-1/2,k-cRi,j+l/2,k - CCi+l/2,j,k-CVi,j,k+1/2t~~~Fi,j,k)hi,j,kt~~i,jtl/2,khi,jtl,k + ~~i+l/2,j,khi+l,j,kt~~i,j,k+l/2hi,j,k+l The CV, CR, and CC coefficients called "branch of external source conductances terms that partially and storage between nodes--sometimes The HCOF and RHS coefficients and storage terms, Besides terms. the BCF Package calculates but correct downward flow Under these increases rather the flow reaches in proportion a constant equations, to correspond conditions to this aquifer the flow limiting limiting value. reducing value. the flow-correction becomes to the underlying to the head difference in effect 5-l are composed calculating are added to HCOF and RHS when an underlying no longer aquifers, terms terms unsaturated. aquifer are conductances conductances." (2% = RHSi,j,k* between The additional the expressions for The following d scussion is divided of the BCF package Equations, Horizontal Conductance of the conceptualization into Conductance Under Wat r Table Vertical Flow Calculation Storage Term Conversion, nine sections: Basic Under Confined Conditions, Applicability Conductance Conditions, Vertical Under Desaturating and implementation Horizontal Conductance Conditions, Formulation, Storage and Limitations Formulation, of Optional Formulations and Data Requirements. Basic The concept (equation It (9)). of equivalent of hydraulic (figure Darcy's is conductance reviewed conductance Conductance law. is Conductance for was introduced here and extended elements a combination law defines Equations arranged of several one-dimensional flow in Chapter to cover 2 the calculation in series. parameters in a prism used in Darcy's of porous material 23) as Q = KA(h2-hI)/L (30) where Q is the flow (Lst-1); K is the hydraulic flow conductivity is the L is the Conductance, in the direction of (Lt-1); A is the cross-sectional h2-hl of the material area perpendicular head differences length of the flow C, is defined across path to the flow the prism parallel (L*); to flow (L); and (L). as C = KA/L. (31) 5-2 a Q Q Explanation K Is Hydraulic Conductivity h, Is the Head at the Left End of the Prism hl Is the Head at the Right End of the Prism Q Is the Flow Rate from the Left End to the Right End L Is the Length of the Flow Path A Is the Cross Sectional Figure 23.-Prism Area Perpendicular to the Direction of porous material illustrating 5-3 of Flow Darcy’s law. Therefore, Darcy's law can be written as Q = C(h2-hl). Another (32) form of the conductance definition for horizontal flow in a prism is C = TW/L (33) where T is transmissivity of flow (L*t-1); W is the width Conductance particular three If a prism series--that 24--and representing for a particular aligned the entire prism is the of flow of a prism differ. in the direction can be calculated. is of flow, n C i=l known, a conductance The equ ivalent in the prism div ided conductance by the (32)) (34) of head across each section in series gives Ahi = hA-hD. for head change across 9i -- i=l Ci the identity (35) each section gives n c head the prism. continuity Substituting in as shown in c = Q/b/+$) Assuming a by three of two or more subprisms of each subprism rate and for the conductances generally consists sequentially of material medium characterized will material prism prism conductivity, directions the conductance the entire change across for of hydraulic of porous is, in the direction (L). In an anisotropic principal of the prism) and is defined directions in these thickness of the prism direction. principal figure (K times = hA-hg. 5-4 using Darcy's law (equation C” -- 1 -=-1 c Cl L -----m-s 1 +-+-+...+- 1 1 c2 C3 C" Y Explanation Q Is the Flow Rate %l Is Conductance of Prism m hfn Is Head at the Right Side of Prism m Ah,,, Is the Head Change Across Prism m C Figure Is the Conductance of the Entire Prism 24.-Calculation of conductance in series. 5-5 through several prisms Since flow tion is one-dimensional all in storage, and we are assuming qi are equal to the total hA-hB n -t = hA-hB and ----= 1 Ci i=l Q Q; i=l By comparison with equation no accumulation flow or deple- Q; therefore, 1 --. Ci (34),.it (37) can be seen that 1 nl m-s = c mm . C is1 Ci Thus for valent a set of conductances conductance tances. the sum of the inverses of the are only two sections, . the equations between rather specify the subscript the conductance of conductances terms, horizontal individual equivalent conduc- conductance presented adjacent ccl defined within nodes. CR terms Conditions in this Is--i CR and CC of equation report .e., (29), "l/2" between nodes i,j,k 25 illustrates the conductance two cells For example, conduc- cells. The are calculated along within CRi,j+l/2,k rows and Similarly, same column. as opposed to conductance is used. use equiva- “branch individual are oriented between two nodes in the between nodes, notation Under Confined between two nodes in the same row. conductance conductance to calculate nodes conductance specify Figure than conductance between adjacent of the equi- (39) The finite-difference conductances inverse + C2). Conductance horizontal nate in series, Horizontal tances,"-- terms arranged the to c = ClC2/(Cl thus equals When there reduces lent (36) CC To desiga cell, represents and i,j+l,k. along between nodes. 5-6 a row, and the parameters Two assumptions are made: used (1) I I I+----DELRi-fPDELRi+,- T i TRi,j+l,k I I & i,j+l,k DELCi I I 1. T*i CRi Ij+x I k = 2 DELCi x TR Ij *k TRi 9j+l ?k ijk I 8 DELRj+, + TRi 9j+,*k DELRj Explanation TRi 1 j 1k CRi 1 j+% ,k Is Transmissivity in the Row Direction in Cell i,j,k Is Conductance in the Row Direction Between Nodes i,j,k and i,j+l,k Figure 25.-Calculation of conductance between nodes using transmissivity and dimensions of cells. 5-7 the nodes are in the form over center conductance (39) gives of two half mi,j+1/2,k Substituting = ClC2/(Cl the cells and (2) the transmissivity Thus the conductance each cell. lent of the conductance cells between the in series is uni- nodes is the (Cl and C2). equiva- Applying equation (40) + CZ)* for each half cell from equation (33) gives TRi,j,k DELCi TRi,j+l ,k DELCi ------------m-------------l/2 DELRj+l l/2 DELRj = ----------------------------------TRi,j,k DELCi TRi,j+l,k DELCi -------B----+ m----w--------l/2 DELRj+l 1/2 DELRj CRi,j+1/2,k where TR is transmissivity in the row direction DELR is the grid width along a row (L); DELC is the grid width along a column DELR and DELC are identical which were introduced new notation Centered Simplification mi,j+1/2,k is and (L). to the terms Ar and AC, respectively, in figure introduced (L*t-l); 4 and equation here to conform (3), to the Chapter input 2. of the The Block- Flow Package. of the above expression = 2 DELCi gives the final equation TRi,j,kTRi,j+l,k -------------------------------TRi,j,kDELRj+l + TRi,j+l,kDELRj. 5-8 (41) The same process can be applied to the calculation of cci+l/z,j,k giving TCi,j,kTCi+l,j,k = Z DELRj ----------_-------------------TCi,j,kDELCi+I + TCi+I,j,kDELCi cci+l/z,j,k (42) where TC is the transmissivity (41) and (42) are used in the conductances between the transmissivity in the cells set equal unconfined, the cell dimensions then using Transmissivity one of the if following HNEWi,j,k then if TOPi ,j,k then as the product conductance equations (41) within a cell three equations However, where between the nodes conductance is unconfined start horizontal Conditions horizontal conductance is done at the is calculated thickness; a layer Equations the equations. Under Water Table of horizontal This head fluctuates. saturated If the conductance invoking is confined, simulation. new values transmissivity to zero without which (Lzt-1). of the model. the is zero, Conductance In a model layer for each layer of both cells is column direction BCF Package to calculate nodes within Horizontal constant in the will or potentially must be calculated of each iteration. of hydraulic is calculated be as the First, conductivity from transmissivity and and and (42). in the row direction is calculated using 2 TOPi,j,k, TRi,j,k = (TOPi,j,k > HNEWi,j,k TRi,j,k - BOTi,j,k) HYRi,j,k; (43) > BOTi,j,k, = (HNEWi,j,k - BOTi,j,k) 5-9 HYRi,j,k; (44) if HNEWi,j,k then 2 BOTi,j,k, TRi,j,k = 0 (45) where HYRi,j,k is the hydraulic direction conform (Lt.-l); to the (this input of cell notation of the is the elevation of the top BOTi,j,k is the elevation of the bottom sivity in the user; the horizontal When head drops below the aquifer model has no provision errors may arise in water-level heads occur for in attempts occur. during Errors iteration; head to drop erroneously to no flow controlling slowing the for the all problem, rate of the equations section whether on data arise botton the set to no flow; the cell. oscillations iterative solvers herein a layer-type actual contain reversals of computed the steps. a Thus oscillations of the cell, and time and cell (45)), in which if by each layer. (equation of a dewatered situations iterations cell cause will change As a means of provisions for convergence. or not the simulation (43)-(45) bottom such computational below the In the program described specify can also if succeeding this to simulate specified from transmissivity and is permanently resaturation of transmis- for dimensions. and (L). is a constant are calculated to be dewatered, i,j,k factor in each direction is cons idered (L); anisotropy Conductances cell here to is the product factor row Flow Package); i,j,k of cell and a horizontal anisotropy in the introduced of cell in the column direction row direction is i,j,k Block-Centered TOPi,j,k Transmissivity the conductivity a is to be invoked. of water This requirements. 5-10 table flag, LAYCON, is used to conditions is discussed through more fully in the a Vertical Vertical conductance from an input conductivity from cell i,j,k in a single thicknesses Azl, Az2 horizontal (or map) areas calculated g, in this interval to contain between two nodes, n geohydrologic conductivities KI,Kz the vertical conductance area is given around nodes of an individual by Kg DELRj*DELCi = -------------- % layers . . . . Kn and The map area of the cells . . . . AZ,. data hydraulic the vertical hydraulic the model using and vertical and using is DELRj*DELCi; layer, within both thickness may be considered vertical and i,j,k+l geohydrologic incorporates term, Formulation are calculated In general, dimensions. having terms which and and i,j,k+l, or units, i,j,k array Conductance (46) Azg The equivalent interval between geohydrologic vertical nodes i,j,k layers conductance, and i,j,k+I as conductances 1 ---------- for ci,j,k+l/z, is found in series; the by treating this full the vertical n individual yields = Ci,j,k+l/Z 1 91 i rearranging equation n Azg 1 ----------------- --- = ----------- KgDELRj*DELCi ------------Azg DELRj*DELCi *I g=l Kg (47) (47) Ci,j,k+l/Z ------------DELRj*DELCi 1 = ------mn AZ c g=l 5-11 -ii; (48) g The quantity ----------has been termed the "vertical DELRj*DELCi Vcont. l,j,k+l/2 in this report; thus we have is designated leakance ' and 1 vconti , j ,k+l/2 Vcont herein. (or is the term That is, harmonic node i,j,k which rather than mean) vertical the values this multiples is generally for the interval it. for between will the It foll ows that a series Vconti,j,k+l/2, intervals the Although to be given t0 between specifies of the hydraulic cell interval and cell Vcont array is not the discussion layers. 5-12 the Vcont array, leakance for and the the layer lowermost read into program; input vertical the The The Vcont is, read, of three-dimensional that area, The to the (49). is the read for of Vcont are thus cell conductance. externally is between and thickness. i,j,k+l--that the array fact by the of a two-dimensional which emphas ize the interval vconti,j,k+l/2, of equation for in terms the vertical of Vconti,j arrays, and an equivalent divided conductivity an application input for or determined i,j,k values thickness the term area to obtain Each value layer of two-dimensional continue a total read as the elements between in the model described conductivity user calculated each layer. interval in the model . both done through are actually Vconti,j, the Vcont by cell of Vcont must'be values specifying conductance and as such incorporates used as input hydraulic and node i,j,k+l, is actually program actually (4% = below layer the model through in this array va lues section notation, refer to the b Figure within a single Kz i,j which application hydrogeologic is uniform of equation at least where Azk+1/2, the *vk+l m---w in which 2 ' might be found, Figure represent and i,j,k+l represents for example, fall which is again for unit layer thickness where several in order adjacent by its Vcont in this model layers of these so that nodes i,j,k Each layers. hydraulic over the are used to cell conductivity, area. The case becomes where Avk is the thickness B units, situation resolution. model layers of vertical 1 = ------------------- (51) (*"k&2 + ---mw----- Kz i,j,k Kz i,j,ktl of model layer is the thickness layer This vertical geohydrologic at least 1. and are used to represent greater hydrogeologic (4"k)/2 -------- i,j,k case, *vk is the sum of --2- as in figure to provide own value Vcon+,i,j,ktl/2 KZ For this (50) between nodes, assumed to be uniform Avk+l conduct ivity Kz i,j = ------Bk+1/2 , j ,k+l/2 at the midpoints is characterized both fall hydraulic area. 27 shows a case in which two adjacent layer expression the cell within distance AV two vertically and i,j,k+l (49) yields vertical geohydrologic nodes i,j,k hav ing a vertical unit, vconti a single in which 26 shows a situation k of model layer is the vertical in cell i,j,k K, i j k+l is the vertical lby&r in cell i,j,ktl hydraulic hydraulic 5-13 ktl conductivity conductivity of the upper of the lower , I DELRj Single Geohydrologic Unit I I I id,k Az k+‘/; A-----0’ I /’ I 00 0 ! /0 I I i,j,k+l 0 Avk+ 0 0 0 0 0 0 0 . &“I< I . I I A”k Boundary between model layers -- A”k+l 2 -- I ------- / Figure 26.-Diagram for calculation of vertical leakance, Vcont, between two nodes which fall within a single geohydrologic unit. 5-14 DELRj I I I I I Boundary between model layers --(Coincident with Geohydrologic Boundary) Geohydrologic Unit A 0 Uk 0-t----/ /’ i /’ I /’ - Kzi,j,k -1----- b”k+l AT--Geohydrologic / Unit B I I A”k+l 0 0 / Kzi,j,k+l 0 i,j,k+l ---- ------ 0 /’ / 4’ Figure 27.-Diagram for calculation of vertical leakance, Vcont, between two nodes located at the midpoints of vertically adjacent geohydrologic units. 5-15 -B--m-_ If one value larger only of K, is much smaller K, value the term denominator i,j,k+l be negligible involving of Figure will the within situation, (51). Thus for this need be retained in the upper the In this unit. summation of equation semiconfining The resulting in which the condition, in the node i,j,k at the median depths (i.e., by a semiconfining be represented aquifer. KZ value the term containing (51). are taken aquifer, in equation smaller 28 shows a third are separated than the other, unit, expression of) case, (49)--the two aquifers three intervals lower half and the upper half for and node which must of the of the lower Vcont is 1 .l VCOnti,j,k+l/2 = (52) ------~~~~~~~~~~----- UL/2 &l/2 A-% --m-m + --- t -me-Kzu KZC KZL where AZ~ is the thickness of the upper aquifer AZc is the thickness of the confining AZL is the thickness of the K,, for aquifer vertical hydraulic conductivity of the upper Kzc is the vertical hydraulic conductivity of the semiconfining K,L is the vertical hydraulic conductivity of the (i,j) is much smaller involving bed is the each of these location lower a K,, terms must in general In many applications of the nodes. than either be considered K,, or K,L; and K,L are negligible in these in equation lower to vary with it turns situations (52) so that aquifer unit aquifer; and the map out that K,, the terms the expression Vcont becomes Kzc Vconti,j,ktl/Z = ;; (53) -, a 5-16 DELRj Kzu AZ,/2 I Upper Aquifer vertical conductancx of lower half = Cu 0 i,j,k -- -N--L- AzC - -/ Kzc AZL/2 Semiconfining layer vertical conductance =C, I I KZL 0 i,i,k+l Lower Aquifer vertical conductance of upper half = CL ---Be- 1 -=-+-+-= % 1 1 CIJ CC 1 CL A 2,/2 + VCONT.. + KZL 1 I,j,k + l/2 = AZ,/2 -IK zu 28.-Diagram A 2~12 AZ, Kzc Kzu Figure -- / for calculation of vertical Az, -l- K zc leakance, AZLI~ KZL Vcont, between two nodes located at the midpoints of aquifers which are separated by a semiconfining unit. 5-17 Boundary Between Model Layers If the formulation in figure 28, and if of equation the further bed makes no measureable storage sents the capacity the confining two model layers. This and is frequently referred In summary, Vcont, which ness, rather program requires using than user to calculate in the interval situations also if used as input spacing figure elevation data. terms, to either three-dimensional for data, unconfined) 26-28. it formulation, without to the storage actually of figure layers (51 1, (52) approach This occur or (53) involves the flexibility vertical the orthogonal 9-c, simulation of the of conductivity coefficient reads either modification 5-18 (50), this The program, (or hydraulic three-dimensional array, and thick- n hydrogeologic transmissivity mesh such as that input conductance. increases and layer 12, approach. vertical While actually the model never a direct of figure and conductivity. or equat ions nodes) and between the conductivity externally case (where k, repre- aquifer, a single thickness Vcont values between lower conductance utilizes hydraulic Thus the model can implement 9-b or a deformed be adapted herein or the model layer to that area to obtain Because layer model application. equivalent conductance the vertical shown the confining "quasi-three-dimensional" inputs general of input represents vertical shown in figures some preprocessing and bottom both Vcont by cell in the vertical in effect is to as the independent (49) then as the the model described multiplies the simply are made that horizontal k+l formulation incorporates equation in the model layer to the situation to the model layer, bed is treated is applied assumptions contribution of either upper aquifer, (53) are gird mesh of and can similarly or to the quasiprogram. Vertical The basic given Flow Calculation finite difference - h!i,j,k) + In this equation cell Qi,j,k the term i,j,k (equation i,j,k through where following indicates flow cell. its into however, situations unsaturated--for to fall, (24)) was + + this by a confining value value indicates that the water of the top of the cell. of a confined aquifer below the top of the aquifer. condition is shown in figure bed are simulated between the two layers, a positive flow that level is using and the confining by cell In terms Two aquifers i,j,k, bed by the Pumping from the 5-19 out of cells in each may become the vertical lower levels of separated the quasi-three-dimensional represented CVi,j,k+I/2. 29. of qi,j,k+I/2 There are, when drawdown due to pumpage causes water locally, i,j,k+l, - i.e., a portion the flow (55) and (55) are based on the assumption in which in which the upper aquifer by cell gives - 'hy,j,k) (24), and a negative saturated (54) i.e. (hy,j,k+I the elevation example, at least simulation, (54) than m - hi,j,k) of equation i,j,k are fully higher face, = CVi,j,k+l/2 cell Equations stands lower the convention and i,j,k+l i,j,k - hT,j,k) + CCi+I/2,j,k(h!i+I,j,k CVi,j,k+I/2(hy,j,k+I qi,j,k+1/2 aquifer cell - hl,j,k) Pi,j,khy,j,k cell for - hY,j,k) + CVi,j,k+I/Z(hT,j,k+I m m-l hi j k - hi,j,k = ssi,j,k(ArjACiAVk) --Iii-~-;--;--m- CVi,j,k-I/2(h!i,j,k-1 the equation Conditions as + CCi-I/2,j,k(h!i-I,j,k into Under Dewatered approach, underlying conductance layer has. 0 Cell i,j,k Confining Unit Topi Ij 9k+l hi 3j Ik+l -M-B -w-B Cell i,j,k+l Figure 29.-Situation in which a correction is required to limit the downward flow into cell i,j,k+l, as a result of partial desaturation of the cell. 5-20 b lowered the water the cell, area. level so that the aquifer An assumption pressure taken unit the top of the through hi,j,k+l lower is simply lower cell. in equation If will level, in the in formulating expression given of equation (55). However, system direct substitution solution used. would of finite process. The flow of equation (54). this confining the head is simply Just below the at that lower prevail, unit that surface so that the is atmospheric-- point-i.e., elevation from cell base of the the elevation is designated by substituting of TOPi,j,k+l, the TOPi,j,k+l for this m - hi,j,k) the flow lower (56) if will cell. for we consider matrix To avoid this term of equation The flow no longer i,j,k into in unsymmetric, condition, in place into cell i,j,k probelm the [A] of the of equation the equation problems for in the on the by this (27)), node approach to remain as computed flow of the expression an alternative is allowed 5-21 to this of coefficients generating (55) on the water be to substitute (matrix (56) (i.e., be negative); approach the matrix equations i,j,k+l be dependent would (54), (56) will qi,j,k+l/z equation difference to cell The simplest cell into i,j,k (26), of the expression render saturated across Thus the head at the of equation the equation entire i,j,k B in fully unit = CVi,j,k+l/2(TOPi,j,k+l be downward, condition hi,j,k+l, remains of the confining this the cell (55), the convention but under this layer conditions bed is obtained qi,j,k+1/2 following surface the elevation the confining Thus the flow unsaturated in the model formulation. confining flow however, sensed on the as zero i,j,k--hi,j,k. of the top of within the head difference of the confining in cell unit, unconfined the confining and we consider in the upper aquifer below the elevation is effectively At the upper surface of the confining i,j,k+l is made that from top to bottom, unit. in cell is left term, side is CVi,j,k+l/2(h~,j,k+l (where in this indicating case, since hi,j,k movement out of cell c - hy,j,k) > hi,j,k+J, i,j,k.) the computed The "actual" flow can be obtained qc, by subtracting equation negative, flow into cell i ,j,k m - hi ,j,k) (where again is given by equation (56) as CVi,j,k+J/2(TOPi,j,k+J m indicating movement out of the ce 11). > TOPi,j,k+l hi,j,k term, is (56) A correct ion from equation (55)s i.e. qc = (computed flow into - ("actual" cell flow i,j,k) into all i,j,k) equation the (24), (54), operation is for allowing of the model, qc is added to the involving circumvent computed flow the term qc is added to the rearranged introduces the equation (54), to the form of equation right a difficulty, this right side which is (26); RHS, of equation since qc contains difficulty, from the preceding to remain side, unknown heads must be kept on the qc is actually interation, rather (57) - TOPi,j,k+l) CVi,j,k+l/2(h!J,j,k+l To compensate = side of equation identical (26). This side of (54). In to equation the term immediately hF,j,k+J, and all of equation computed using than that left and in practice, the term left on the the (26). value from the current terms to of hF,j,k+J iteration, i.e. m,n-1 qc,n = CVi,j,,k+l/2(hi,j,k+l (58) - TOPi,j,k+l) where qc,n is the value of qc to be added to RHS in the nth iteration, m,n-1 is the value of hm l,j,k+l from the preceding iteration, n-l. hi ,j,k+l m,n-1 m,n convergence is approached the difference between hi,j,k+J and hi,j,k+J progressively smaller, and the approximation 5-22 involved in (58) thus and As becomes becomes more accurate. In the Value Of hi ,j ,k+I i,j,k correction cell level cell, cell, in formulating To examine this i,j,k-1. minus cell, For this flow, should be added to the programming point of view, is to add the term while adding HCOF forms case, into the computed whereas of equation the of the coefficient (54) left TOPi,j,k) of hy,j,k, side to the which of the coefficient matrix, this symmetry of the coefficient matrix; at the same time, an unknown head value on the correction right cell into cell i,j,k flow into computed m - hi,j,k) where q,' or (26). From a this correction of equation RHS term. (26), Because on the main does not affect side A the "actual" falls diagonal in placing flow way to handle to HCOF on the l for from the The difference, the most efficient (CVi,j,k,I/2 for i,j,k = CVi,j,k-I/E(TOPi,j,k hand side cvi,j,k-l/2 the term part right trial of the cell. we now take flow - TOPi ,j,k)* qc' initial equations the equations correction, - hy,j,k) is thus the below the top and we consider iS CVi,j,k-1/2(h~,j,k-l "actual" the has "dewatered"-i.e., be applied from above iS CVi,j,k-I/2(hy,j,k-I the Cell i,j,k+l, has fallen itself. step, q,. in i,j,k+l to be the dewatered overlying of each time above is used in formulating underlying must also dewatered i,j,k described when the when the water iteration is used in computing The process cell first the the problems entailed of the equation are avoided. In summary, must be made--one cell, whenever dewatering in formulating and one in formulating of a cell equation equation (26) 5-23 (26) as it occurs, as it two corrections applies applies to the overlying to the dewatered cell These two corrections itself. case using (26) the designation It is formulated. i,j,k is are applied corrections has been developed [A] the procedure program (27), limiting to be implemented. This discussed in the distinguishes constant between throughout flow on data may "convert" as the water This from described in the For a layer the simulation, of the storage applies terms, simulation, value in a cell falls the storage coefficient and those in which to a water section requirements. on data storage storage expression to an individual coefficient formulation in equation cell, = ssi ,j,k or not conditions is LAYCON, as i,j,k, described the (24) flag, form m hi,j,k of the cell. LAYCON, as is to remain This coefficient or vice-versa, above the top or (54). remain storage value, layer herein values is based upon a direct constant during application expression, which has the AV -- table below or rises the use of the the form of the whether type-flag, program is made through in which both efficiency. specifies layer that of the coefficient under dewatered the equation Formulation in which a confined level distinction layers the in each requirements. of storage the the user is done through formulation and that program herein, which however, and to maximize Storage In the event, above, for the symmetry vertical section the cell to preserve described for separately to keep in mind, in any dewatering of equation In the to represent important corrections matrix are discussed (ArjACiAVk) At ------v-------- m-l - hi,j,k tm - tm-l 5-24 033) AV where -- is the rate of accumulation of water in the cell, and as such must At appear on the storage SiOnS; right side of equation (24) or (54); of the material in cell i,j,k; m hi,j,k is the head in cell i,j,k is the head in cell the end of time In equation (26) i,j,k step m; and tm,I is the time at the the "storage capacity" the "primary" or the which for rate "primary storage is used when storage m-l of accumulation step m; hi,j,k SCIi,j,k capacity" term m-l. is termed i,j,k; from a secondary conversion in storage step of cell scli,j,k Using the concept section. dimen- where the term is used to distinguish in the following the expression report cell end of time was introduced, scli,j,k In this designation capacity explained notation specific m-l; tm is the time at step the are the at the end of time end of time ssi,j,kArjACihVk. storage and Avk ACi at the = SCIi,j,k Arj, is the ssi,j,k is invoked, of storage in cell i,j,k as capacity, can be written m-l - hi,j,k)/(tm scli,j,k(hy,j,k This expression SCIi,j,k through is separated hy,j,k/(tm-tm_I), the term in the term to the storage a confined these storage of the cell ssi,j,k Avk; material for in the and on the of dimensionless layer two terms which HCOFi,j,k, RHSi,j,k The input into right side an unconfined layer (26), left /(tm-tm-I), side which of (26) is included of (26). values coefficient multiplied in the l Flow Package requires coefficient material cell. hTIi,k Block-Centered storage in equation is incorporated scli,j,k - tm-1) in each layer values by layer they The incorporation 5-25 are given thickness are equal of layer to the thickness specification of the model; for by the specific in the cell, specific into yield the of the confined storage term maintains of varying the flexibility and to implement thickness, or "quasi-three-dimensional" The storage as array values in the by the cell areas, stored in the input instructions. ArjACi, to create the simulations during cell in which of the falls in effect the versa, possible, cell simulation. capacity, SCli,j,k Values through of the cell values, and they are coefficient is used to of confined for storage the two-dimensional level cell specific coefficient area; a secondary yield multiplied array sfl. 5-26 conditions, the the represent each cell pumpage, or if or appear to be for will saturated) of the cell--then conditions is done, of a cell (fully table layer for throughout of simulated to water remains the top above the top When this by cell input crosses term conversion in the cell in a confined Where these any cell represent level from confined flag. multiplied is adequate scli,j,k in each individual rises storage layer-type above, as a result cell simulation. user may invoke use of the SCzi,j,k are designated are then multiplied capacity the water the water "converts" the level If if system through storage they or below the top of the in an unconfined during the storage described the water of the below the top level by layer; discretization. Term Conversion capacity a simulation--i.e., the water vice storage above the top course three-dimensional of vertical These values layers SC1 array. The primary either the direct are read layer Storage for either conceptualizations coefficient sfl of the program to represent entire primary the storage by cell in the These confined layer layer storage confined capacity, area. are read storage coefficient values capacities, which for each cell array are stored in the layer unconfined expression for which rate in the yield storage In a layer by cell areas to obtain SCl. Values array are read through These specific sf2. obtain are multiplied values are multiplied has been designated of accumulation areas in array for storage term in storage in cell i,j,k yield input by cell are stored storage of specific the two-dimensional which capacities, confined to SC?. conversion, the is formulated as follows AV it m SCB (hi,j,k - TOPi,j,k) + SCA (TOPi,j,k = ------------------------------------------------tm - tm-l Av -- is rate of accumulation At as such must appear on the right side where again storage capacity SCB is the effect "current" during in cell in effect i,j,k the Since time the step, storage given storage iteration at the the cell. there storage the time step the following for (hy,j,k) iteration in process. of time is no free capacity is, time i,j,k (24) at the start is, the also or (54); surface at that storage and SCA is the of the time step; capacity in the cell time at the is taken start and in equal to SCIi,j,k. 5-27 to SCIi,j,k; of the as the confined If, during of head for to be above the top of the cell, set i,j,k a case in which the head m-l step m (hi,j,k) is above the top of step m, the computed value is in cell Consider SCA is set equal is found (61) in storage of equation capacity--that beginning capacity--that iteration in cell of water m-l - hi,j,k) equation a the end of SCB for (61) for that iteration then reverts to the form of equation in a given value i,j,k of hm cell, as shown in figure is set equal computed iteration 30, the turns value to SCZ, the unconfined rate of release of water (60). However, if the computed out to be below the top of the of SCB for storage the following iteration In this case the capacity. from storage in the time step has two components: scli the rate of release from confined SC2i,j,k the rate of release If top of cell i,j,k, (61) so that is a free m, the computed value of head for However, if the computed to be above the top to SCIi,j,k, intervals rate or water the of the confined of rising water of accumulation table storage cell, storage level, of water hi,j,k, within during the the end of the time (61) again head for is below the cell, SCA in an iteration SCB in the subsequent and equation t0 SCZi,j,k 9 m-l step, exists If, to SCZi,j,k. equal - tm-1) of the time surface of the cell, and storage. equal (60). the table Set to be below the top set from water storage; - TOPi,j,k)/(tm (h!i,j,k 9 - tm-1) or compressive the head at the beginning equation step m-l - hi ,j,k)/(tm (TOPi ,j,k ,j,k reverts step to the SCB in the subsequent and again This two components in storage--one and one corresponding form of equation step turns out is set occurs equal during are computed corresponding to confined out is also iteration situation time turns iteration the end of the time capacity. for for to unconfined or compressive storage. Equation Av ii (61) can be rearranged SCB m = ~~~~~~~~~ hi ,j,k tm - tm,1 as follows m-l SCA (TOPi,j,k - hi,j,k) - SCB*TOPi,j,k + ---__---------------__________________ tm - tm-l 5-28 (62) m-l hiJ,k ---_-- -m --. ToPi,j,k m hi,j,k - - l - - - - - - - - . ..*, Interval wver wmch Confined Storage Coefficient Is Applied Interval Over Which Specific Yield Is Applied 0 i,j,k Figure 30.-A model cell which uses two storage factors during one iteration. 5-29 Ai' Again, -- represents At on the right (26), of accumulation hand side, while on the appear right. and Limitations The options for conditions, limitation calculation and storage term model layer corresponds these horizons these options of problems conversion table table incorrect (and irreversible is expected may occur as iterations the decision is the units are carried by several of cells out. to use any of the three table more than ) conversion horizon, each and that Use of may lead to a variety For example, under water to traverse that of low permeability. are not satisfied represented conditions, assumption or permeable in simulation. aquifer under water under desaturating aquifer conditions calculation the water flow by distinct Formulations conductance developed,on to a distinct where these where a water of horizontal were all are separated conductance of Optional of vertical and inaccuracies horizontal and as such would (24) or (54). In the formulation of equation SCB the term --------is subtracted from HCOFi,j,k on-the left tm - tm-l m-l SCA(TOPi,j,k - hi,j,k) - SCB*TOPi,j,k the term ----_-------------------------------is added to tm - tm-1 Applicability table in storage in equation therefore, RHSi,j,k rate if the option conditions is used model- layers one layer to a no-flow during , and simulation, condition Thus care should be exercised options noted above. Data Requirements The fundamental variables in the model are entered These variables, depending controlling through on the the cell-to-cell Block-Centered-Flow options 5-30 which flow and storage Package input. are invoked, for may include in transmissivity, hydraulic coefficient, vertical elevation. conductivity, leakance, Each of these aquifer variables module UZDREL, which is described either reads a two-dimensional array a single throughout value provided for the array, The model utilizes the simulation indicates transmissivities hydraulic conversion code identifies arrays of data required set of two-dimensional initially, until That is, provides layers all of the then all input process of three-dimensional the layer required storage for for than would be possible corresponding from layer-type indicates each layer parameter, layer layer of the data for This method of data arrays it identifies each required of the arrays or flow layer, by layer; arrays code term Because the in a given for layer-type of vertical and thus to as the product whether conditions. layer, according are to be used, limitation one array have been covered. a simpler of a series the arrays, in sequence, all thickness; to be employed for or value layers at each iteration The data are entered to be read. read in turn. values under dewatered module layer, that top array- This a single In particular, and whether the options 14. code to classify and saturated above is to be invoked and aquifer layer. transmissivity is to be used; the kinds in the are to be calculated conductivity for storage the utility in Chapter are used. specified elevation using confined by the user and applies cells that bottom of data a layer-type options whether all yield, is entered reader accepts specific a is 1 are read 2, and so on organization using to the the alternative various parameters. Within every cell, each layer including the required constant-head parameters should and no-flow cells. 5-31 be specified For no-flow for cells, the entered values be specified; the other are never for constant parameters used in calculation, head cells, the storage and realistic are, and thus values for any values may terms are not used but those parameters must be entered. transmissivity Two parameters, the designation of two values read for To reduce each of these parameters, direction; these row-direction anisotropy factor to obtain single value of the layer, through layer except actually layer. the apply to the For example, layer of layer 1 and the midpoint In addition Package input whether the includes simulation whether ISS flag is storage skipped. set cell coefficient Thus for above, user A for each with each layer next during lower the interval between the Block-Centered input the midpoint (DELR and DELC), a flag or steady state (ISS), terms are to be saved conditions (ISS # 0), or specific steady-state by an 2. is transient steady-state row values. a given and the entered to the dimensions flow with layer values mentioned cell-by-cell for of Vcont of layer array in the multiplied are associated associated applies to the terms indicate for 1 actually values by the and a single column-direction or K,/Az) values row direction only the each require TRPY (NLAY). between that array for only specified array the sequence is (Vcont, interval the effort, are subsequently factor terms lowermost; input the corresponding anisotropy leakance in the giving values the one-dimensional Vertical conductivity, at each cell--one one in the column direction. is and hydraulic runs, yield and storage arrays 5-32 of storage Flow to indicate and a flag (IBCFCB). to If the no space is allocated calculations coefficients are or specific yields must not be included the data sequence will or of a LAYCON value Four types combinations be misread. will also of layer types provided layer are stored in the one-dimensional O--In of transmissivity for conditions, will fraction present) storage the entered is the in the be specified value which assigned without Tran for or specific yield row-direction array by providing is applied to all level cells 5-33 falls confined unconfined to be a layer in the are entered leakance Again, values parameter or by providing in this (if input of layer array in the unless are values a single The parameter type or below the the transmissivities, of the layer. the simulation. conversion, is transient, are entered vertical array, of a simulation modification in which simulation (NCOL, NROW). the entire at the beginning change throughout Vcont for term transmissivities in the model, which The code values a layer the values (NCOL, NROW); and following input codes, from the overlying If to be negligible. various drawdowns are expected and flow sequence. Package. used to simulate be used to simulate ISS below. storage is normally thickness lowermost layer-type water of array Block-Centered-Flow is no provision provided are included, incoporating are given varies, type data LAYCON (NLAY). there they specification of the from above if prevail, of layer NROW); then layer level layer always coefficient array category if erroneous by their array flow also is expected sfl(NCOL, input This but could conditions small this of vertical cell. by the characteristics as water limitation top of the layer data; by the model, are identified corresponding Layer-type Note that are recognized of the options input cause misreading These four and the in the may default values are retained Layer-type l--This or in the uppermost are expected tion. layer assumption that is made for water table flow 1 is used only transmissivities includes yield direction If layer layer Layer-type between confined and limitation a high layer array be inappropriate except equal NROW). to one, given indicating of hydraulic Thus the elevation, as transient, NROW). in the in the vertical input Row array array BOT(NCOL, leakance values Because use of this in the uppermost LAYCON is However, sfl(NCOL, entered one layer, Vcont(NCOL, since layer. indicated are entered more than and no provision bottom array are then of the conditions, the is of simula- by virtue as the products input elevations conditions of a model. within model period prevail; and cell values bottom input layer, a value a check of of one; the uppermost if the model message is printed. Z--This layer type and unconfined of flow of the is used where the conditions, so that from above under dewatered but where the saturated fraction values in the number is made whenever an error desirable; always conductivity are entered number is not also layer, the entire term conversion, will thickness conductivity in the type would layer storage the uppermost the model contains are entered where unconfined throughout If the simulation HY(NCOL, NROW) and cell the for hydraulic values hydraulic NROW). layer in a single-layer from above under dewatered than transmissivity. specific only and only conditions and saturated data is utilized are computed at each iteration conductivity rather in the is made for limiting layer-type type of a model, to persist No provision input layer layer thickness thickness storage conditions is expected throughout 5-34 situation the to period may alternate term conversion are both remain everywhere of simulation, so that recalculation tivity and saturated thickness option requires both yield value specified limit that be specified for flow confined array sfl(NCOL, array Tran(NCOL, NROW). leakance Specific yield simulation values values Flow options 3--This associated are recalculated are next used in the values are entered values layer entered and finally elevation If the in the array layer simulation in the lowermost in the array be option are then entered is the entered bottom layer type to is input in the in the model, Vcont(NCOL, sfZ(NCOL, top elevations with water incorporates at each iteration elevations, and both data thus includes storage vertical leakances are entered coefficients in the are then and layer input entered (if array NROW). NROW) if are entered hydraulic in the the model, vertical the in array Specific yield conductivities and and limitation are implemented. layer The re- bottom specific yields Confined storage (NCOL, NROW); hydraulic elevations, (if the layer are next values 5-35 is the entered are then transient), coefficients conductivity HY(NCOL, NROW), and aquifer Unless values Block-Centered- Transmissivities term conversion transient), leakance of the conductivities, sfl in BOT(NCOL, NROW). NROW). using top elevations. elevations Vcont(NCOL, conditions. conditions hydraulic all table storage from above under dewatered confined values the the top is also term conversion and a specific conditions. Transmissivity Unless coefficient conduc- TOP (NCOL, NROW). Layer-Type quired elevation of hydraulic The storage and that coefficient are then is transient; the array of flow storage each cell, the top NROW). vertical layer a confined storage product is not necessary. for each cell; as the from above under dewatered transient, P of transmissivity lowermost bottom in in the array entered in the array sfZ(NCOL,NROW); array aquifer top elevations are entered in the TOP(NCOL, NROW). The input the and finally utility required sequence modules formats and in appendix is outlined which in the following are used are described are illustrated in the "Sample in Input section. Chapter to the Both of 14, and the BCF Package" D. a a 5-36 Block-Centered Flow Package Input Input for the Block-Centered specified in IUNIT(1). Flow (BCF) Package is read from the unit FOR EACH SIMULATION BCFlAL 1. Data: Format: ISS 110 IBCFCB 110 2. Data: Format: LAYCON(NLAY) 4012 (Maximum of 80 layers) (If there are 40 or fewer use two records.) layers, use one record; otherwise, BCFlRP l 3. Data: Module: TRPY(NLAY) UlDREL 4. Data: Module: DELR(NCOL) UlDREL 5. Data: Module: DELC(NROW) UlDREL A subset of the following two-dimensional arrays are used to describe The arrays needed for each layer depend on the layer type code each layer. [i-~~C~N~)and whether the simulation is transient (ISS = 0) or steady state If an array is not needed, it must be omitted. All of the arrays (iiems 6-12) for layer 1 are read first; then all of the arrays for layer 2, etc. IF THE SIMULATION IS TRANSIENT 6. Data: Module: sfl(NCOL,NROW) UEDREL IF THE LAYER TYPE CODE (LAYCON) IS ZERO OR TWO 7. Data: Module: Tran(NCOL,NROW) UZDREL IF THE LAYER TYPE CODE (LAYCON) IS ONE OR THREE D 8. Data: Module: HY(NCOL,NROW) UEDREL 9. Data: Module: BOT(NCOL,NROW) UEDREL 5-37 IF THIS IS NOT THE BOTTOMLAYER 10. Data: Module: Vcont(NCOL,NROW) U2DREL IF THE SIMULATION IS TRANSIENT AND THE LAYER TYPE CODE (LAYCON) IS TWO OR THREE 11. Data: Module: sf2(NCOL,NROW) U2DREL IF THE LAYER TYPE CODE IS TWO OR THREE 12. Data: Module: Explanation ISS--is the steady-state TOP(NCOL,NROW) U2DREL of Fields Used in ISS # 0, the simulation is steady If ISS = 0, the simulation is transient. a flag Instructions flag. If IBCFCB--is Input and a unit state. number. If IBCFCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set; the terms which are saved will include cell-by-cell storage terms, cell-by-cell constant head flows, and internal cell-by-cell flows. If IBCFCB = 0, cell-by-cell recorded. If IBCFCB < 0, flow for each constant-head cell will be printed, rather than saved on disk, whenever ICBCFL is set; cell-by-cell storage terms and internal cell-by-cell flows will neither be saved nor printed. flow terms will not be printed or Each element holds the code for the LAYCON--is the layer type table. Read one value for each layer. There is a limit respective layer. Leave unused elements blank. of 80 layers. o- confined--Transmissivity and storage coefficient of the layer are constant for the entire simulation. l- It is calculated unconfined--Transmissivity of the layer varies. from the saturated thickness and hydraulic conductivity. The storage coefficient is constant; valid only for layer 1. 5-38 3 of the layer is constant. 2 - confined/unconfined--Transmissivity The storage coefficient may alternate between Vertical confined and unconfined values. leakage from above is limited if the layer desaturates. of the layer varies. It 3 - confined/unconfined--Transmissivity is calculated from the saturated thickness and hydraulic conductivity. The storage coefficient may alternate between confined Vertical leakage from and unconfined values. above is limited if the aquifer desaturates. TRPY--is a one-dimensional array containing an anisotropy factor for each It is the ratio of transmissivity or hydraulic conductivity layer. (whichever is being used) along a column to transmissivity or hydraulic conductivity along a row. Read one value per layer. Set to 1.0 for isotropic conditions. NOTE: This is one array with one value for each layer. D Read one value DELR--is the cell columns. width along rows. DELC--is the cell rows. width along columns. for Read one value each of the NCOL for each of the NROW Read onlv for a transient simulation sfl--is the orimarv storaae coefficient. always (steady'-statbflag, iSS, is 0). Note that f& Laycon= 1 sfl will be specific yield, while for Laycon= or 3, sfl will a 1'iays be confined be confined For Laycon=O, sfl would normally storage coefficient. however, layer-type 0 can also be used for simulation storage coefficient; of water table conditions where drawdowns are expected to remain everywhere a small fraction of the saturated thickness, and where there is no layer above, or flow from the layer above is neglig i ble; and in this case specific yield values would be entered in sfl. Tran--is the transmissivity along obtain transmissivity along LAYCON is zero or two. rows. Tran is multiplied Read only for columns. by TRPY to layers where HY--is the hydraulic conductivity along rows. TRPY to obtain the hydraulic conductivity for layers where LAYCON is one or three. HY is multiplied along columns. BOT--is the elevation of the aquifer LAYCON is one or three. Read only Vcont--is bottom. for by Read only layers where the vertical hydraulic conductivity divided by the thickness from Since there is not a layer beneath a layer to the layer beneath it. Vcont cannot be specified for the bottom layer. the bottom layer, 5-39 Read it only for layers where sf2--is the secondary storage coefficient. LAYCON is two or three and only if a transient simulation (steadyThe secondary storage coefficient is always state flag, ISS, is zero). specific yield. TOP--is the elevation of the aquifer LAYCON is two or three. 5-40 top. Read only for layers where I--I-wcnl-I-wu-lwm mmmmmmmmmm NNNNNNNNCIN I II I III III l-l 0 . N ! i t 4: :‘P 32 >” 5-41 Module Documentation for the Block-Centered Flow Package The Block-Centered Flow Package (BCFl) has four primary modules and The relationship of the modules to MAIN and to each three submodules. other is shown in figure 31. The flow of information used to calculate horizontal-hydraulic conductances (CC and CR) is shown for several of the For example, BCFlRP passes transmissivity (T) and cell dimensions modules. (DELR and DELC) to SBCFlN. Module SBCFlN then returns CC and CR to BCFlRP. The modules are: Primary Modules BCFlAL Allocates BCFlRP Reads all data needed by the package, invokes SBCFlN to reconcile input transmissive values with the IBOUND array, and calculates storage capacities and constant conductances. BCFlFM Calculates all coefficients of the system of equations that are not constant and invokes SBCFlH to calculate horizontal-branch conductances in partially saturated layers. BCFlBD Calculates flow rates and accumulated flow volumes into and out of storage and constant-head boundaries. When cell-by-cell flow is specified, flow across all sides of each cell is also calculated. space for data arrays. Submodules SBCFlN Reconciles input transmissive values with the IBOUND array and calculates storage capacities and constant Invokes SBCFlC to calculate horizontalconductances. branch conductances for layers where transmissivity is constant. SBCFlH Calculates transmissivity for cells in layers where it depends on heads and invokes SBCFlC to calculate horizontal-branch conductances. SBCFlC Calculates horizontal-branch transmissivity. SBCFlB Calculates SBCFlF Calculates flow terms (both cell-by-cell and entries to overall budget) for flow to and from constanthead cells. cell-by-cell conductance flow 5-42 terms across from cell cell faces. /[-1 BCFl AL FOR LAYER TYPES 0 AND 2 / I BCFl BD Explanation HY Hydraulic TOP Elevation of the Top of a Layer Transmissivity BOT Elevation of the Bottom of a Layer Grid Spacing in the Row Direction DELC Grid Spacing in the Column cc Conductance in the Column Direction CR Conductance in the Row Direction T DELR among the modules Figure 31. -Relationship Centered Flow Package. 5-43 Conductivity in the Block- Direction Narrative This module allocates It Package. Print 2. Read and print unit and flag are flow to the right, 3. which data following the for flag ISS and the Cell-by-cell (IBCFCB). the Block-Centered Flow the package. steady-state flow arrays order: the message identifying flow-term to constant space for is done in the 1. Module BCFlAL for forward, flow flow cell-by-cell terms down, increase for the BCF Package in storage, and flow heads. Read and print need the TOP array (a) Read the the layer-type code and count the number of layers and the BOTTOM array. layer-type codes. 0 = confined 1 = unconfined (b) layers needing (c) and/or print 2 = confined/unconfined but transmissivity is 3 = confined/unconfined but transmissivity depends on head Initialize KT and KB in which the numbers of the TOP and BOTTOM are accumulated. For each layer, BOTTOM arrays an error the counters constant print the layer-type code and determine if TOP (type = l), are needed. (1) Print (2) If the a layer layer other number and the than message and STOP. 5-44 the top layer-type layer is code. unconfined counter, counter, (3) If the layer type is one or three, add one to the BOTTOM (4) If the layer type is two or three, add one to the TOP KB. KT. 4. Calculate 5. Allocate the number of elements space for the following SC1 Primary SC2 Secondary-storage TRPY Horizontal BOT Bottom of layers TOP Top of layers HY Hydraulic The following If notes in the storage grid and in a layer. arrays: capacity; capacity anisotropy conductivity type 2 or 3 only); factor; (layer (layer (layer type type 2 or 3 only); 2 or 3 only); (layer type and 1 or 3 only). apply: the simulation is trans ient (ISS = 0), storage coeff icients needed. The number of vertical conductance arrays is one less number of layers. 6. Print the amount of space used by the BCF Package. 7. RETURN. 5-45 than the are Flow Chart ISS is the steady-state flag. If is set (ISS = l), the simulation is steady state (storage is not considered). IBCFCB is a flag and a unit for Module BCFlAL (y-z--) it number. If IBCFCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. If IBCFCB = 0, cell-by-cell terms will not be printed recorded. IDENTIFYING THIS PACKAGE flow READ AND PRINT ISS AND IBCFCB or If IBCFCB < 0, flow from constantbe printed whenever head cells will ICBCFL is set. LAYCON is a layer-type each layer). READ LAYERTYPE CODES code (one for 4-i 1 INITIALIZE TOP 1 AND BOTTOM COUNTERS KT AND KB I I I I confined lunconfined but 2 - confined/unconfined transmissivity is constant 3 - confined/unconfined O- t, TYPES AND COUNT LAYERS THAT NEED TOP OR BOTTOM KT is a counter for the number of layers for which TOP is needed. (It is also, the number of layers for which a secondary storage factor is needed.) CALCULATE KB is a counter for the number of layers for which BOTTOM is needed. (It is also the number of layers for which hydraulic conductivity is needed.) ALLOCATE SPACE FOR PRINT THE 5-46 SUBROUTINE BCFlAL(ISUM,LENX,LCSClrLCHY,LCBOT, LCTOP, LCSCZ,LCTRPY, IN, ISS, NCCL, NROW,NLAY, IOUT,IBCFCB) 1 C C-----VERSION 1542 12MAY1987BCFlAL ************************************************************~***** ALLOCATE ARRAY STORAGE FOR BLOCK-CENTEREDFLOW PACKAGE *****+************************************************************ E C C C C SPECIFICATIONS: ------------------_----------------------------------------------- C COMMON/FLWCOM/LAYCON(80) ----------_-----L------------------------------------------------C C Cl ------IDENTIFY PACKAGE WRITE(IOUT,l)IN 1 FORMATtlHO, ‘BCFl -- BLOCK-CENTEREDFLOW PACKAGE, l'r 9/l/87',' INPUT READ FROM UNIT',131 C C2---C2----- 2 3 B 4 9 C 88 VERSION1' , ISS (STEADY-STATE FLAG) AND IBCFCB (FLAG FOR PRINTINGOR UNITf FOR RECORDINGCELL-BY-CELL FLOW TERMS) READtIN, ISS,IBCFCB FORMAT(2110) IF(ISS.EQ.0) WRITE(IOUT,3) FORMAT(lX,‘TRANSIENT SIMULATION') IF(ISS.NE.0) WRITE(IOUT,4) FORMAT(lX,‘STEADY-STATE SIMULATION') IF(IBCFCB.GT.0) WRITE(IOUT,9) IBCFCB FORMAT(lX,‘CELL-BY-CELL FLOWS WILL BE RECORDEDON UNIT',131 IF(IBCFCB.LT.0) WRITE(IOUT,88) FORMAT(lX,‘CONSTANT HEAD CELL-BY-CELL FLWS WILL BE PRINTED') READ AND PRINT c3 ------READ TYPE CODE FOR EACH LAYER AND COUNT TOPS AND BOTTOMS IF(NLAY.LE.80) GO TO 50 WRITE(IOUT,ll) 11 FORMAT(lHO,‘YOU HAVE SPECIFIEDMORE THAN 80 MODEL LAYERS’/lX, 1 ‘SPACE IS RESERVED FOR A MAXIMUM OF 80 LAYERS IN ARRAY LAYCON’) STOP C C3A---emREAD LAYER TYPE CODES. 50 READtIN, (LAYCON(I)rI=l,NLAY) 51 FORMAT(40121 C BOTTOMIS READ FOR TYPES lr3 TOP IS READ FOR TYPES 2r3 WRITE(IOUT,52) 52 FORMAT(lX,SX,‘LAYER AQUIFERTYPE'r/lX,SXr19('-')I C c3B----- INITIALIZE TOP AND BOTTOMCOUNTERS. NBOT=O NTOP=O C C3C------ B PRINT LAYER TYPE AND COUNT TOPS AND BOTTOMSNEEDED. DO 100 I=lrNLAY C 5-47 C3Cl---- PRINT LAYER NUMBERAND LAYER TYPE CODE. L=LAYCON(I) WRITE(IOUT,7) 1,L 7 FORMAT(lX,I9,110) :3C2----ONLY THE TOP LAYER CAN BE UNCONFINED(LAYCON=l). .OR. I.EQ.l) GOTO 70 IF(L.NE.l WRITE(IOUTn8) 8 FORMAT(lHO,‘AQUIFER TYPE 1 STOP C c3c3---- IS ONLY ALLOWEDIN TOP LAYER’) 1 AND 3 NEED A BOTTOM. ADD 1 TO KB. .OR. L.EQ.3) NBOT=NBOT+l LAYER TYPES 70 IF(L.EQ.l :3C4 ----LAYER TYPES 2 AND 3 NEED A TOP. ADD 1 TO KT. NTOP=NTOP+l IF(L.EQ.2 .OR. L.EQ.3) 100 CONTINUE C C E4------COMPUTE DIMENSIONS FOR ARRAYS. NRC=NROW *NCOL ISIZ=NRC*NLAY C SPACE FOR ARRAYS. IF RUN IS TRANSIENT(ISS=O) c5------ALLOCATE C5------ THEN SPACE MUST BE ALLOCATED FOR STORAGE. ISOLD=ISUM LCSCl=ISUM IF(ISS.EQ.0) ISUM=ISUM+ISIZ LCSCZ=ISUM IF(ISS.EQ.0) ISUM=ISUM+NRC*NTOP LCTRPY=ISUM ISUM=ISUM+NLAY LCBOT=ISUM ISUM=ISUM+NRC*NBOT LCHY=ISUM ISUM=ISUM+NRC*NBOT LCTOP=ISUM ISUM=ISUM+NRC*NTOP ii6------PRINT ME AMOUNTOF SPACE USED BY THE BCF PACKAGE. ISF'=ISUM-ISOLD WRITE(IOUT,lOl) ISP 101 FORMAT(lX,I8,' ELEMENTS IN X ARRAY ARE USED BY BCF’) ISUMl=ISUM-1 WRITE(IOUT,102) ISUMlrLENX 102 FORMAT(lX,I8,’ ELEMENTS OF X ARRAY USED OUT OF’,181 IF(ISUMl.GT.LENX) WRITE(IOUT,103) 103 FORMAT(1X, ’ ***X ARRAY MUST BE DIMENSIONED LARGER***‘) C C7------RETURN RETURN END 5-48 List Variable I for Range IBCFCB Module Package IN Package IOUT ISOLO Global Module Package ISP ISS Module Package ISUM Global ISUMl L LAYCON Module Module Package LCBOT LCHY LCSCl LCSCZ LCTOP LCTRPY LENX Package Package Package Package Package Package Global NBOT Module NCOL -NLAY NRC NROW NTOP Global Global Module Global Module ISIZ of Variables Module BCFIAL Definition Index. Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will be not be printed or recorded. < 0, flow from each constant-head cell will be printed whenever ICBCFL is set. Primary unit number from which input for this package will be read. Primary unit number for all printed output. IOUT = 6. Number-of cells in the grid.. Before this module allocates space, ISOLD is set equa 1 ISOLD is subtracted to ISUM. After allocation, from ISUM to get ISP, the amount of space in the X array allocated by this module. Number of words in the X array allocated by this module. Flag. = 0, simulation is transient. f 0, simulation is steady state. Index number of the lowest element in the X array which has not yet been allocated. When space is allocated the size of the array is added to ISUM. for an array, ISUM-1. Temporary storage for LAYCON( DIMENSION (80) Layer type code: 0 - Layer strictly confined. 1 - Layer strictly unconfined. 2 - Layer confined/unconfined (transmissivity is constant). 3- Layer confined/unconfined (transmissivity varies). Location in the X array of the first element of array BOT. Location in the X array of the first element of array HY. Location in the X array of the first element of array SCl. Location in the X array of the first element of array SC2. Location in the X array of the first element of array TOP. Location in the X array of the first element of array TRPY. Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. Counter for the number of layers which need elevation of Layers for which LAYCON = 1 or 3. the bottom. Number of columns in the grid. Number of layers in the grid. Number of cells in a layer. Number of rows in the grid. Counter for the number of layers which need elevation of the top. LAYCON = 2 or 3. 5-49 Narrative for Module BCFlRP This module reads transmissivity along rows, hydraulic conductivity vertical conductance, elevation of top along rows, storage coefficients, It also calls SBCFlN to of layer, and elevation of bottom of layer. It does calculate parameters which are constant throughout simulation. this in the following order: module UlDREL to read DELR, DELC, and TRPY which 1. Call utility TRPY is the one value for each column, row, and layer, respectively. ratio of transmissivity along columns to transmissivity along rows for each layer. ,’ have use utility module UPDREL to read the properties 2. For each layer, The data requirements for each layer are determined of the porous medium. by the layer-type code. (a) storage Find the address If the (b) coefficient. simulation (c) For constant the transmissivity. hydraulic of the layer in the is transient (ISS = 0), arrays. read the primary transmissivity layers (LAYCON = 0 or 2), read (d) For variable transmissivity conductivity and bottom. layers (LAYCON = 1 or 3), read (e) Read vertical-hydraulic These values will be multiplied For each vertical conductance. next lower layer is calculated. calculated for the lowest layer conductivity divided by thickness. in the program by cell areas to get layer, the vertical conductance to the Therefore, no vertical conductance is in the mesh. (f) If the simulation is transient read the secondary storage coefficient three, three-dimension (g) Read the top elevation if the and the layer type (specific yield). layer type is two or is two or three. conductance and storage terms which are 3. Call SBCFlN to calculate constant during the simulation and check to see that branch conductances agree with boundaries specified in the IBOUND array. 4. RETURN. 5-50 Flow Chart for Module BCFl RP DELR is the grid spacing in the row direction. DELC is the grid spacing in the column direction. TRPY is the ratio of transmissivity in the column direction to transmissivity in the row direction. FOR EACH LAYER LAYCON is a layer-type code (one for each layer). + 0 - confined 1 - unconfined 2 - confined/unconfined but transmissivity is constant 3 - confined/unconfined I 2 IF TRANSIENT SIMULATION, READ PRIMARY STORAGE COEFFICIENT 1 I pii& 2c Secondary Storage coefficient is relevant only for convertible layers (LAYCON = 2 or 3); then it is equal to specific yield. IF&;y3CgIAl; 1 HYDdAULlC CONDUCTIVITY AND BOTTOM 2E . IF TRANSIENT AND LAYCON IS 2 OR 3, READ SECONDARY STORAGE COEFFICIENT I I IF LAYCCN IS 2 OR 3. READ TOP PREPARE AND CHECK BCF DATA 5-51 I I 1 \ SUBROUTINE BCF~RP(IBOUND,HNEW,SC~,HY,CR,CC,CVIDELRIDELC, BOT, TOP, SCZ,TRPY, IN, ISS, NCOL,NROW,NLAY, NODES,IOUT) C .---VERSION 1636 15MAY1987 BCFlRP CMm C ***********************~*****************~************************ C C READ AND INITIALIZE DATA FOR BLOCK-CENTERED FLOW PACKAGE ****************************************************************** C C SPECIFICATIONS: C --------_--------------------------------------------------------C CHARACTER*4 ANAME DOUBLE PRECISION HNEW C DIMENSIONHNEW~NODES~rSC1~NODES~,HY~NODES~rCR~NODES~,CC~NODES~, CV.(NODES)rANAME(6,10),DELR(NCOL),DELC(NROW)rBOT(NODES)r 1 1 TOP(NODES),SC2(NODES),TRPY(NLAY),IBOUND(NODES~ C COMMON/FLWCOM/LAYCON( 80 1 C C C DATA AN~E~lrl~,ANAME~2rl~,ANAME~3,l~,~~E~4,l~,ANA~~5,l~, ','PRIM','ARY ‘r’STOR’,‘AGE ‘r’COEF’/ 1 ANAME(6,l) /’ DATA ANAME(lr2),ANAME(2,2)rANAME(3,2),~~(4,2),AN~E(5,2), AL’r’ONG ‘,‘ROWS’/ ‘,‘TRAN’r’SMIS’r’. 1 ANAME(6r2) /’ DATA ANAME(l,3),ANAME(2,3),ANAME(3,3),~~(4,3),~~E(5,3), AL’,‘ONG ‘,‘ROWS’/ ‘,‘COND’,‘. 1 ANAME(6r3) /’ H’r’YD. DATA ANAME(lr4),ANAME(2,4)rANAME(3,4)rANAME(4,4),ANAME(5r4)r 1 ANAME(6,4) /‘VERT’,’ HYD’,’ CON’r’D /T'r'HICK','NESS'/ DATA ANAME(lr5),ANAME(2,5)rANAME(3,5)rANAME(4,5),AN~E(5,5), ‘,’ BO’,‘TTOM’/ 1 ANAME(6,5) /’ DATA ANAME~l,6~,AN~;2,6~:~AME~;:~~rAN~~4,6~,ANAME~5,6~, ‘,’ TOP’/ 1 ANAME(6r6) /’ ‘,’ 1,’ 1,’ ‘8’ DATA ANAME(1,7),ANAME(2,7)rANAME(3,7),~~(4,7),~~(5,7), SE’r’COND’r’ARY ‘r’STOR’,‘AGE ‘,‘COEF’/ 1 ANAME(6,7) /’ DATA ANAME(1,8),ANAME(2,8),ANAME(3,8),~~(4,8),~~(5,8), 1 ANAME(6,8) /‘COLU’r’MN T’,‘O RO’r’W AN’r’ISOT’,‘ROPY’/ DATA ANAME(lr9),ANAME(2,9)rANAME(3,9),~~(4,9),~~(5,9)~ ‘r’DELR’/ 1 ANAME(6,9) /’ ‘,’ ‘,’ ‘,’ ‘,’ DATA ANAME~1r.~0~,ANAME~2,10~,ANAME~3,10~,~~~4,10~,~~~5,10~, ‘r’DELC’/ 1 ANAME(6rlO) /' ',' ',' ',' ',' ------------------------------------------------------------------ Cl- -----CALCULATE NUMBEROF NODES IN A LAYER AND READ TRPY, DELR,DELC NIJ=NCOL*NROW C CALL UlDREL(TRPY,ANAME(lr8) ,NLAY, IN, IOUT) CALL U1DREL(DELR,ANAME(lr9),NCOL,IN,IOUT) CALL U1DREL(DELC,ANAME(lrlO~,NRW,IN,IOUT) 5-52 C C2----- READ ALL PARAMETERSFOR EACH LAYER KT=O KB=O DO 200 K=lrNLAY KK=K C C2/+-- C c2B----- FIND ADDRESS OF EACH LAYER IN THREE DIMENSION ARRAYS. IF(LAYCON(K1.EQ.l .OR. LAYCON(K1.EQ.3) KB=KB+l IF(LAYCON(Kl.EQ.2 .OR. LAYCON(K1.EQ.3) KT=KT+l LOC=l+(K-l)*NIJ LOCB=l+(KB-l)*NIJ LOCT=l+(KT-l)*NIJ READ PRIMARY STORAGECOEFFICIENT INTO ARRAY SC1 IF TRANSIENT IF(ISS.EQ.O)CALL U2DREL(SC1(LOC),ANAMEME(lrl)rNROW,NCOL,KK,IN,IOUT~ C c2c---. READ TRANSMISSIVITY INTO ARRAY CC IF LAYER TYPE IS 0 OR 2 IF(LAYCON(K1.EQ.3 .OR. LAYCON(K1.EQ.l) GO TO 100 CALL U2DREL(CC(LOC),ANAME(lr2),NR~,NCOL,KK,IN,IOUT~ GO TO 110 :2D -----READ HYDRAULIC CONDUCTIVITYtHY) AND BOTTOMELEVATIONtBOT) C2D-w-m IF LAYER TYPE IS 1 OR 3 100 CALL U2DREL(HY(LOCB),ANAMEME(lr3)rNROW,NCOL,KK,IN,IOUT~ CALL U2DREL(BOT(LOCB)rANAME(lr5)rNROWINCOLIKK,IN,IOUT~ C C2E-----READ VERTICAL HYCOND/THICK INTO ARRAY CV IF NOT BOTTOMLAYER (32E--READ AS HYCOND/THICKNESS -- CONVERTEDTO CONDUCTANCELATER 110 IF(K. EQ. NLAY) GO TO 120 CALL U2DREL(CV(LOC)rANAME(1,4),NROW,NCOL,KK,IN,IOUT~ C (32F--w-w READ SECONDARYSTORAGECOEFFICIENT INTO ARRAY SC2 IF TRANSIENT C2F-----AND LAYER TYPE IS 2 OR 3 120 IF(LAYCON(K1.NE.3 .AND. LAYCON(K1.NE.2) GO TO 200 IF(ISS.EQ.O)CALL U2DREL(SC2(LOCT)rANAME~l,7),NROW,NCOL,KK,IN,IOUT~ C C2G ----READ TOP ELEVATIONtTOP) IF LAYER TYPE IS 2 OR 3 CALL U2DREL(TOP(LOCT)rANAMEME(lr6)rNROW,NCOL,KK,IN,IOUT~ 200 CONTINUE C c3 ------PREPARE AND CHECK BCF DATA CALL SBCFlN~HNEW,IBOUND,SClrSC2,CR,CC,CV,HY,TPY,DELR,DELC,ISS, 1 NCOL,NROW,NLAY, IOUT) C c4 ------RETURN RETURN END 5-53 List Variable Range ANAME BOT Module Package cc Global CR Global cv Global DELC Global DELR Global HNEW Global HY Package I BOUND Global IN Package IOUT ISS Global Package K KB Module Module KK Module KT Module LAYCON Package of Variables for Module BCFlRP Definition Label for printout of input array. DIMENSION (NCOL,NROW,NBOT), Elevation of the bottom of each layer. (NBOT is the number of layers for which LAYCON = 1 or 3.) DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,I+l,K), This array is used to temporarily hold transmissivity. DIMENSION (NCOL,NROW,NLAY), Conductance in the row CR(J,I,K) contains conductance between direction. nodes (J,I,K) and (J+l,I,K). DIMENSION (NCOL,NROW,NLAY-l), Conductance in the CV(J, I ,K) contains conductance vertical direction. between nodes (J,I,K) and (J,I,K+l). This array is used to temporarily to hold Vcont. DIMENSION (NROW), Cell dimension in the column direction. DELC(1) contains width of row I. DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column J. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. DIMENSION (NCOL,NROW,NBOT), Hydraulic conductivity of (NBOT is the number of layers where a cell. LAYCON = 1 or 3.) DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Primary unit number from which input for this package will be read. Primary unit number for all printed output. IOUT = 6. Flag. = 0, simulation is transient. # 0, simulation is steady state. Index for layers. Counter for the number of layers for which the bottom elevation is needed (LAYCON = 1 or 3). Temporary variable set equal to K. KK is used as an actual argument in subroutine calls to avoid using the DO loop variable K as an argument, which causes problems with some compilers. Counter for the number of layers for which the top elevation is needed (LAYCON = 2 or 3). DIMENSION (80) Layer type code: confined. o- Layer strictly Layer strictly unconfined. l(transmissivity is Z- Layer confined/unconfined constant). (transmissivity 3- Layer confined/unconfined 5-54 b List Variable Module LOCB Module LOCT Module NCOL tsc1 Global Module Global Global Global Package tsc2 Package NIJ B for Module RCFlRP (Continued) Definition Range LDC NLAY NODES NROW of Variables TOP Package TRPY Package Pointer to parts of the conductance arrays corresponding to particular layers. Pointer to parts of the BOT and HY arrays corresponding to particular layers. Pointer to parts of the TOP and SC1 arrays corresponding to particular layers. Number of columns in the grid. Number of cells in a layer. Number of layers in the grid. Number of cells (nodes) in the finite-difference grid. Number of rows in the grid. DIMENSION (NCOL,NROW,NLAY), Primary storage capacity of each cell (S*DELC*DELR). DIMENSION (NCOL,NROW,NTOP), Secondary storage capacity (NTOP is the number of of each cell in the grid. layers for which LAYCON = 2 or 3.) DIMENSION (NCOL,NROW,NTOP), Elevation of the top of the layers. (NTOP is the number of layers for which LAYCON = 2 or 3.) DIMENSION (NLAY), Ratio of transmissivity in the column direction to transmissivity in the row direction. tInitially, storage coefficient values are multiplied by cell capacities. values are read into these arrays; areas in submodule SBCFlN to yield 5-55 these storage Narrative for Module BCFlFM This module calculates branch conductances which are not constant adds storage terms to the accumulators in which throughout the simulation, HCOF and RHS are formed, and adds terms to RHS and HCOF which correct for overestimation of flow down into partially saturated cells. 1. or 3), for For each layer in which transmissivity varies with head (LAYCON = 1 call submodule SBCFlH to calculate branch conductance. If the simulation is transient, calculate 2. each layer. If the simulation is steady state, t3. Determine if there is one storage If there is only one storage factor t4. calculate storage terms and add them to the h-coefficient (HCOF). factor storage terms (STEPS 3-5) GO TO STEP 6. or two. (LAYCON = 0 or l), use it to right hand side (RHS) and the then, using head at the beginning If there are two storage factors, t5. of the time step (HOLD), determine the storage factor at the beginning of the time step (SOLD) and use the latest estimate of head at the end of the time step (HNEW) to determine the storage factor at the end of the time the storage terms to add to step (SNEW). Use SOLD and SNEW to calculate RHS and HCOF. down F&o For each layer determine if a partially skurated layer 7. calculate If the layer is partially saturated and there correction terms and add to RHS and HCOF. 8. saturated, If 9. this is not the bottom calculate the correction are needed for is flow flow from above, layer and the layer below is partially terms and add to RHS and HCOF. RETURN. tThe term storage capacity divided SCA/(tm-tm,l), equivalent correction terms (STEPS 7-8). factor, by time as used in Subroutine BCFlFM, refers SOLD is thus equivalent step length. in the notation of equations to SCB/(tm-tm,1). 5-56 (61) and (62), to storage here to while SNEWis Flow Chart LAYCON is a layer-type (one for each layer). 0 - confined 1 - unconfined 2 - confined/unconfined but transmissivity is constant 3 - confined/unconfined for Module BCFlFM code (-E--) FOR EACH LAYER 1 IF T VARIES, CALCULATE HORIZONTAL CONDUCTANCES FOR EACH LAYER ADD STORAGE TERMS TO RHS AND HCOF ADDSTORAGE TE;t$ &FtIHS I I FOR EACH LAYER IF LAYCON IS 2 OR 3, GET CORRECTION TERMS FOR FLOW FROM ABOVE , * I IF LAYCON FOR LAYER BELOW IS 2 OR 3. GET CORRECTION TERMS FOR FLOW DOWN 5-57 SUBROUTINE BCF~FM(HCOFIRHS,HOLOISC~~HNEW~IBOUND,CR,CC,CV~HY,TR~‘YI BOT,TCP~SC~~DELRIDELC,DELT,ISSIKITERIKSTP~KPERI 2 NCOL,NRC%V,NLAY,IOUT) 1640 15MAY1987 BCFlFM C-----VERSION C ****************************************************************** C ADD LEAKAGE CORRECTION AND STORAGE TO HCOF AND RHS, AND CALCULATE C CONDUCTANCE AS REQUIRED C *********************************~~******************************* E SPECIFICATIONS: C 1 ” DOUBLE PRECISION HNEW C DIMENSION HCOF(NCOL~NR~,NLAY)~RHS(NCOL,NRUVINLAY)~ 1 2 3 4 5 HOLD(NCOLrNROW,NLAY),SCl(NCOLrNROW,NLAY)rHNEW(NCOLrNROW,NLAY), IBOLIND(NCOL,NROW,NLAY),CR(NCCL.NROW,NLAY)r CC(NCOL,NROW,NLAY)rCV(NCOL,NROW,NLAY)rHY(NCOL,NROW,NLAY)r TRPY(NLAY),BOT(NCOL,NROW,NLAY)rTOP(NCOL,NRaJ,NLAY)rDELR(NCOL)r DELC(NROW)rSC2(NCOLrNRCW,NLAY) COMMON/FLWCON/LAYCON(BO) -----------------------------------------------------------------KB=O KT=O C C Cl--- C ClA--- FOR EACH LAYER: IF T VARIES CALCULATE HORIZONTAL CONDUCTANCES DO 100 K=lrNLAY KK=K IF(LAYCON(K1.EQ.3 .OR. LAYCON(Kl.EQ.2) KT=KT+l IF LAYER TYPE IS NOT 1 OR 3 THEN SKIP THIS LAYER. IF(LAYCON(K).NE.3 .AND. LAYCON(Kl.NE.1) GO TO 100 KB=KB+l ----FOR LAYER TYPES 1 6 3 CALL SBCFHl TO CALCULATE HORIZONTAL CONDUCTANCES. CALL SBCFlH~HNEW,IBOUND,CR,CC,CV,HY,TRPY,DELR,DELC,BOT,TOP, KK,KB,KT,KITER,KSTP,KPER,NCOLrNR(XJ,NLAY,IOUT) IOO’CONTINUE ClB----- C CZ------IF THE SIMULATIONIS TRANSIENTADD STORAGE TO HCOF AND RHS IF(ISS.NE.0) TLED=l ./DELT GO TO 201 KT=O DO 200 K-1rNLAY ------SEE IF THIS LAYER IS CONVERTIBLE OR NON-CONVERTIBLE. IF(LAYCON(K1.EQ.3 .OR. LAYCON(Kl.EQ.2) GO TO 150 c4 ------NON-CONVERTIBLE LAYER, SO USE PRIMARY STORAGE DO 140 I=l,NROW DO 140 J=lrNCOL IF(IBOlJND(J,I,K).LE.O) GO TO 140 RHO=SCl(J,I,K)*TLED HCOF(JrI,K)=HCOF(J,I,K)-RHO RHS(J,I,K)=RHS(J,I,K)-RHO*HOLDtJ,I,K) C 140 CONTINUE GO TO 200 C5-----A CONVERTIBLE LAYER, SO CHECK OLD AND NEW HEADS TO DETERMINE c5 ------WHEN TO USE PRIMARY AND SECONDARY STORAGE 150 KT=KT+l DO 180 I=l,NRW DO 180 J=lrNCOL C C5A---mm IF THE CELL IS EXTERNAL THEN SKIP IT. IF(IBOlJND(J,I,K).LE.O) GO TO 180 TP=TOP(J,I,KT) RHOZ=SC2(J,I,KT)*TLED 5-58 RHOl=SCl(J,I,K)*TLEO C Q B--- FIND STORAGEFACTOR AT START OF TIME STEP. SOLD=RHOZ IF(HOLD(J,I,K).GT.TP) SOLD=RHOl E5c -----FIND STORAGEFACTOR AT END OF TIME STEP. HTMP=HNEW(J,I,K) SNEW=RHM IF(HTMP.GT.TP) SNEW=RHOl C pJJ--- ADD STORAGETERMS TO RHS AND HCOF. HCOF(J,I,K)=HCOF(J,I,K)-SNEW - SOLD*(HOLD(J,I,K)-TP) RHS(J,I,K)=RHS(J,I,K) - SNEW*TP C 180 CONTINUE C 200 CONTINUE C c6 ------FOR EACH LAYER DETERMINE IF CORRECTIONTERMS ARE NEEDED FOR c6 ------FLOW DOWNINTO PARTIALLY SATURATEDLAYERS. 201 KT=O DO 300 K=l,NLAY C C7------ SEE IF CORRECTION IS NEEDED FOR LEAKAGE FROM ABOVE. IF(LAYCON(K1.NE.3 .AND. LAYCON(K1.NE.P) GO TO 250 KT=KT+l IF(K.EQ.l) GO TO 250 n :7A -----FOR EACH CELL MAKE THE CORRECTIONIF NEEDED. DO 220 I=lrNRw DO 220 J=lrNCOL C c75---IF THE CELL IS EXTERNAL(IBOUND<=O) THEN SKIP IT. IF(IBOUND(J,I,K).LE.0) GO TO 220 HTMP=HNEW(JrIrK) k7c -----IF HEAD IS ABOVE TOP THEN CORRECTIONNOT NEEDED IF(HTMP.GE.TOP(J,I,KT)) GO TO 220 :7D -----WITH HEAD BELOWTOP ADD CORRECTIONTEMS TO RHS AND HCOF. RHS(J,I,K)=RHS(J,I,K) HCOF(J,IrK)=HCOF(J,I,K) 220 CONTINUE + CV(J,I,K-l)*TCf’(J,I,KT) + CV(J,I,K-1) C ca------SEE IF THIS LAYER MAY NEED CORRECTION FOR LEAKAGE TO BELOW. 250 IF(K.EQ.NLAY) GO TO 300 IF(LAYCON(K+l).NE.3 .AND. LAYCON(K+l).NE.Z) GO TO 300 KTT=KT+l &A -----FOR EACH CELL MAKE THE CORRECTIONIF NEEDED. DO 280 I=lrNROW DO 2&l J=l,NCOL El35 ----IF CELL IS EXTERNAL (IBOUND<= IF(IBOUND(J,I,K).LE.O) GO TO 280 THEN SKIP IT. C C8C--- IF HEAD IN THE LOWERCELL IS LESS THAN TOP ADD CORRECTION C8C-----TEfW TO RHS. HTMP=HNEW(J,I,K+l) IF(HlMP.LT.TOF’(J,I,KTT)) 1 RHS(J,I,K)=RHS(J,I,K) - CV(J,I,K)*(TOP(J,I,KTT)-HIMP) 280 CONTINUE 300 CONTINUE C c9 ------RETURN RETURN END 5-59 List of Variables for Module BCFlFM Definition Variable Range BOT Package cc Global CR Global cv Global DELC Global DELR Global DELT HCOF Global Global HNEW Global HOLD Global HTMP HY Module Package I I BOUND Module Global IOUT ISS Global Package J K KB Module Module Module KITER KK Global Iteration Module KPER KSTP Global Global KT KTT Module Module Temporary variable set equal to K. KK is actual argument in subroutine calls to the DO loop variable K as an argument, problems with some compilers. Stress period counter. Reset at the start of Time step counter. period. Counter for layers for which top elevation Pointer to TOP array of layer immediately DIMENSION (NC~L,NROW,NB~T), Elevation of bottom of each layer. (NBOT is the number of layers for which LAYCON = 1 or 3.) DIMENSION (NCOL,NROW,NLAY), Conductance in the column direction. CC(J,I,K) contains conductance between nodes (J,I,K) and (J,I+l,K). DIMENSION (NCOL,NROW,NLAY), Conductance in the row direction. CR(J, 1,K) contains conductance between nodes (J,I,K) and (J+l,I,K). DIMENSION (NCOL,NROW,NLAY-l), Conductance in the vertical direction. CV(J,I,K) contains conductance between nodes (J,I,K) and (J,I,K+l). DIMENSION (NROW), Cell dimension in the column direction. DELC(1) contains the width of row I. DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column J. Length of the current time step. DIMENSION (NCOL,NROW,NLAY), Coefficient of head in cell (J,I,K) in the finite-difference equation. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head in each cell. HNEWchanges at each iteration. DIMENSION (NCOL,NROW,NLAY), Head at the start of the current time step. Temporary single precision HNEW(J,I,K). DIMENSION (NCOL,NROW,NBOT), Hydraulic conductivity of a cell. (NBOT is the number of layers where LAYCON = 1 or 3.) Index for rows. DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Primary unit number for all printed output. IOUT = 6. Flag. = 0, simulation is transient. f 0, simulation is steady state. Index for columns. Index for layers. Counter for layers for which bottom elevation is needed. counter. 5-60 Reset at the start of each time step. used as an avoid using which causes each stress is needed. below layer K. List Variable Package NCOL NLAY NROW RHO Global Global Global Module Module Module Global SC1 Package SC2 Package tSNEW Module tSOLD Module TLED TOP Module Package TP TRPY Module Package tstorage divided for Module BCFlFM (Continued) Definition Range LAYCON tRHO1 tRH02 RHS l of Variables factor, by time DIMENSION (80) Layer type code: 0 - Layer strictly confined. 1 - Layer strictly unconfined. 2 - Layer confined/unconfined (transmissivity is constant). 3 - Layer confined/unconfined (transmissivity varies). Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Storage coefficient for strictly confined or strictly unconfined layers. Confined storage factor for convertible layers. Unconfined storage factor for convertible layers. DIMENSION (NCOL,NROW,NLAY), Right hand side of finiteRHS is an accumulation of difference equation. terms from several different packages. DIMENSION (NCOL,NROW,NLAY), Primary storage capacity 0f each cell (S*DELC*DELR). DIMENSION (NCOL,NROW,NTOP), Secondary storage capacity (NTOP is the number of of each cell in the grid. layers for which LAYCON = 2 or 3.) Storage factor at the end of the time step for convertible layers. Storage factor at the start of the time step for convertible layers. l/DELT. DIMENSION (NCOL,NROW,NTOP), Elevation of top of layers. (NTOP is the number of layers for which LAYCON = 2 or 3.) Temporary variable for TOP(J,I,K). DIMENSION (NLAY), Ratio of transmissivity in the column direction to transmissivity in the row direction. as used in Subroutine step length. BCFlFM, refers 5-61 to storage capacity Narrative for Module BCFlBD Module BCFlBD calculates flow rates within the porous medium for use in the overall volumetric budget and calculates cell-by-cell flow terms for recording on disk. Flow rates to constant heads and from storage are in the budget. accumulated and passed to the module BASlOT for inclusion They are accumulated by sign so that flow into constant-head cells is separate from flow out of constant-head cells, and flow into storage is separate from Flow rates to constant-head cells and from storage as flow out of storage. well as flow across cell boundaries can be recorded on a cell-by-cell basis for use by other programs. Flow from storage is calculated inside BCFlBD. flow to constant-head and across cell boundaries is calculated in submodules SBCFlF and SBCFlB, respectively. cells Module BCFlBD performs its tasks in the following Clear the fields STOIN and STOUT in which respectively, are accumulated. 1. storage, _ order: flow out of and into If the user has specified that cell-by-cell flow terms should 2. be recorded this time step (ICBCFL #O) and has specified a unit number (IBCFCB) for cell-by-cell flow terms for the BCF Package, set the cell-bycell flag (IBD). for If this is steady-state from storage. 3. flow If cell-by-cell 4. in STEP Z), clear the prior to skip all of the calculations flow terms are to be saved (i.e., if IBD was set buffer (BUFF) in which they will be accumulated printing. accumZiator 6. simulation, For each cell in the (STEPS 6 AND 7). Calculate flow grid, calculate from storage flow from storage and move to in the cell. If the cell-by-cell rates are being recorded, store flow rate from 7. storage in the buffer. Depending on the sign, add the flow from storage to the accumulators STOIN or STOUT. a. If the cell-by-cell 9. Store flag (IBD) is set, record the contents of the buffer. the accumulated table VBVL for inclusion appropriate label in the and volumes Call 11. If the cell-by-cell flag (IBD) is set, call and record the flow across cell boundaries. 12. SBCFlF to of flow from storage in volumetric budget. Store an location in the table VBNM. 10. calculate submodule rates in the overall corresponding calculate RETURN. 5-62 flow from constant-head submodule cells. SBCFlB to Flow Chart for Module BCFlBD STOIN is an accumulator for flow terms having a positive sign (flow from storage into the flow system) for inclusion in the volumetric budget. ACCUMULATORS FOR BUDGET ENTRIES (STOIN STOUT is an accumulator for flow terms having a negative sign (flow into storage and out of the flow system) for inclusion in the volumetric budget. TERMS ARE NEEDED, IBD is a flag which indicates that for this time step, BCF cellby-cell flow terms should be recorded. BUFF is a buffer where flow terms are gathered prior to recording them. I IF CELL-BY-CELL TERMS ARE NEEDED, CLEAR BUFF I FOR EACH LAYER 1 5 FOR EACH CELL VBVL is a table of budget entries calculated by component-of-flow packages for use in calculating the volumetric budget. VBNM is a table budget terms. of labels 6 CALCULATE FLOW FROM SCEy;AGE IN for STORE STOIN AND STOUT IN VBVL AND LABELS IN VBNM I CALL MODULE SBCFIF TO GET FLOW FROM CONSTANT HEADS I CALL MODULE SBCFlB TO GET AND RECORD FLOW ACROSS CELL WALLS I I 5-63 RETURN SUBROUTINE BCFlBDt VBNM,VBVL, MSUM,HNEW,IBOUND, HOLD, SClrCR,CC,CV, TOP,SCZ,DELT, ISS, NCOL, NRW, NLAY,KSTP,KPER, IBCFCB, ICBCFL, BUFF, IOUT) C-----VERSION 1546 12MAY1987BCFlBD 1 2 C C C C C C C C ***+****+++**tt**Y*t~~*~~**~~~***~*~**~**~****~**~~*~*~~~~****~*** COMWTE BUDGET FLOW TERMS FOR BCF -- STORAGE, CONSTANT HEAD, AND FLOW ACROSS CELL WALLS *~+~l**II*I******************************************************* SPECIFICATIONS: ------_-----L----------------------------------------------------CHARACTER*4 VBNM,TEXT DOUBLE PRECISION HNEW C DIbfiNSION HNEW(NCOL,NROW,NLAY)r IBOUND(NCOL,NRCW,NLAY)r HOLD(NCOL,NR~,NLAY), SCl(NCOL,NR~,NLAY)r CR(NCOL,NRCJfrNLAY)r CCtNCOLrNRCWrNLAY), 2 3 CVtNCOLrNRCWrNLAY), VBNM(4rZO)r VBVL(4,201, 4 SC2tNCOLrNRanlrNLAY)r TOP(NCOL,NROW,NLAY)rBUFF(NCOLINROWINLAY) 5 1 C COMMON/FLWCOM/LAYCON(801 C DIMENSION TEXT(4 1 C C C Cl--- DATA TEXT(l)rTEXT(Z)rTEXT(3)rTEXr(4) -----------------------------------------------------------------INITIALIZE STOIN=O. STOUT=O. /’ ‘,’ ‘,’ STO’r’RAGE’/ BUDGET ACCUMULATORS CELL-BY-CELL FLOWS ARE NEEDED THEN SET FLAG IBD. :2 ------IF IBD=O IF(ICBCFL.NE.0 .AND. IBCFCB.GT.01 IBD=l C C3-----IF STEADY STATE THEN SKIP ALL STORAGE CALCULATIONS IF(ISS.NE.01 GO TO 305 C CELL-BY-CELL FL@iS ARE NEEDED (IBD IS SET) CLEAR BUFFER c4 ------IF IF(IBD.EQ.0) GO TO 220 DO 210 K=lrNLAY DO 210 I=lrNRW DO 210 J=l,NCOL BUFF(J,I,K)=O. 210 CONTINUE C c5------RUN THROUGH EVERY CELL IN ME GRID 220 KT=O DO 300 K=lrNLAY LC=LAYCON(K) IF(LC.EQ.3 .OR. LC.EQ.2) KT=KT+l DO 300 I=lrNRW C DO 300 J=lrNCOL C6------CALCULATE FLW FROM STORAGE (VARIABLEHEAD CELLS ONLY) 5-64 IF(IBWND(J,I,K).LE.O) HSING=HNEW(JrIrK) c C6A---- GO TO 300 CHECK LAYER TYPE TO SEE IF ONE STORAGE CAPACITY OR TWO IF(LC.NE.3 .AND. LC.NE.2) GO TO 285 ---TWO STORAGE CAPACITIES TF’=TOP(J,I,KT) SYA=SC2(J,I,KT) SCFA=SCl(J,I,K) SoLD=SYA IF(HOLD(J, I,K) .GT.TP) SOLD=SCFA SNEW=SYA IF(HSING.GT.TP) SNEW=SCFA STRG=SCLD*(HOLD(J,I,KbTP1 + SNEW*TP- SNEWWSING GO TO 288 STORAGE CAPACITY 285 SC=SCl(J,I,K) STRG=SC*HOLD(JrI,K)- SC*HSING &----ONE -----STORE CELL-BY-CELL FLOW IN BUFFER AND ADD TO ACCUMULATORS 288 IF(IBD.EQ.l) BUFF(J,I,K)=STRG/DELT l IFtSTRG) 292,300,294 292 STCUT=STOUT-STRG GO TO 300 294 STOIN=STOIN+STRG C 300 CONTINUE C IBD FLAG IS SET RECORD THE CONTENTS OF THE BUFFER f.2-----IF IF(IBD.EQ.l) CALL UBUDSV(KSTP,KPER,TEXT, IBCFCB,BUFF,NCCLrNRC%V,NLAY,IOUT) 1 C c9 ------ADD TOTAL RATES AND VOLUMES TO VBVL 8 PUT TITLES 305 VBVL(l,MSUM)=VBVL(l,MSUM)+STOIN IN VBNM VBVL(2rMSUM)=VBVL(2,MSUM)+STOUT VBVL(3,MSUM)=STOIN/DELT VBVL(4,MSUM)=STOUT/DELT VBNM(lrMSUM)=TEXT(l) VBNM(2,MSUM)=TEXT(2) VBNM(3,MSUM)=TEXT(3) VBNM(4rMSUM)=TEXT(4) MSUM=MSUM+l C ClO----- CALCULATE FLOW FROM CONSTANT HEAD NODES CALL SBCFlF (VBNM, VBVL, MSUM,HNEW,IBOUND, C&CC, CV, TOP, DELT, NCOL, NROW,NLAY,KSTP,KPER, IBD, IBCFCB, ICBCFL,BUFF, IOUT) 1 C Cl l--Cl l--- CALCULATE AND SAVE FLOW ACROSS CELL BOUNDARIES IF C-&C FLc4J TERMS ARE REQUESTED. IF(IBD.NE.0) CALL SBCFlB(HNEWrIBOUND,CRrCC,CV,TOP,NCDLrNROWrNLAY, KSTP, KPER, IBCFCB,BUFF, IOUT) 1 C C12----RETURN RETURN END 5-65 List Variable for Global cc Global CR Global cv Global DELT HNEW Global Global HOLD Global HSING I I BCFCB Module Module Package IBD Package I BOUND Global I CBCFL Global IOUT ISS Global Package J K Module Module Global Module BCFlBD Definition Range BUFF KPER of Variables DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains the conductance direction. between nodes (J,I,K) and (J,I+l,K). DIMENSION (NCOL,NROW,NLAY), Conductance in the row direction. CR(J,I,K) contains conductance and (J+l,I,K). between nodes (J,I,K) DIMENSION (NCOL,NROW,NLAY-l), Conductance in the CV(J,I,K) contains conductance vertical direction. and (J,I,K+l). between nodes (J,I,K) Length of the current time step. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. DIMENSION (NCOL,NROW,NLAY), Head at the start of the current time step. Temporary label for element of HNEW. Index for rows. Flag and a unit number. > 0, unit number on which the cell-by-cell flow terms will be recorded whenever I CBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0. flow from each constant-head cell will be orinted whenever ICBCFL is set. Flag. = 0, cell-by-cell flow terms for this package will not be recorded. f 0, cell-by-cell flow terms for this package will be recorded. DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. f 0, cell-by-cell flow terms (flow to constant heads) will be either printed or recorded (depending on IBCFCB) for the current time step. IOUT = 6. Primary unit number for all printed output. Flag. = 0, simulation is transient. f 0, simulation is steady state. Index for columns. Index for layers. Stress period counter. 5-66 B List Variable l Global KT Module LAYCON Package LC SC1 Module Global Global Global Global Module Module Package SC2 Package SNEW* SOLD* STOUT STRG SYA TEXT TOP Module Module Module Module Module Module Module Package TP VBNM Module Global VBVL Global STOIN D Range KSTP MSUM NCOL NLAY NROW SC SCFA *Note than of Variables that the variables in BCFlFM. for Module BCFlBD (continued) Definition Time step counter. Reset at the start,of each stress period. Index for top of layers (also used for secondary storage terms). DIMENSION (80) Layer type code: 0 - Layer strictly confined. - Layer strictly unconfined. : - Layer confined/unconfined (transmissivity is constant). 3 - Layer confined/unconfined (transmissivity varies). Temporary name for LAYCON( Counter for budget entries and labels in VBVL and VBNM. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Temporary name for the storage capacity. Temporary name for the primary storage capacity. DIMENSION (NCOL, NROW, NLAY), Primary storage capacity of each cell (S*DELC*DELR). DIMENSION (NCOL, NROW, NTOP), Secondary storage capacity (NTOP is the number of of each cell in the grid. layers for which LAYCON = 2 or 3.) Storage capacity at the end of the time step. Storage capacity at the start of the time step. Sum of decreases in storage from individual cells. Sum of increases in storage for individual cells. Volume of flow into or out of storage in a single cell. Temporary name for the secondary storage capacity. Labels recorded along with the cell-by-cell flow terms. DIMENSION (NCOL, NROW, NTOP), Elevation of top of layers. (NTOP is the number of layers for which LAYCON = 2 or 3.) Temporary label for TOP(J,I,K). DIMENSION(4,20), Labels for entries in the volumetric budget. DIMENSION(4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (2,N), Rate for the current time step out of the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. SOLD and SNEWhave different 5-67 meanings in this subroutine c Narrative for Module SBCFlN This module insures that the transmissive properties of each cell agree with the codes specified in the boundary array (IBOUND) and calculates (1) horizontal-branch conductance in layers where transmissivity is constant, (2) vertical-branch conductance, and (3) storage capacity. The array IBOUND indicates following codes. the status of every Code Status zero positive negative inactive variable constant cell in the grid with the head head The values in the IBOUND array are read by the BASlRP module; transmissive properties are read by module BCFlRP. This module (SBCFlN) insures that all transmissive parameters are equal to zero for cells designated inactive 'inactive" if all transmissive by the IBOUND array and that cells are designated parameters are equal to zero. Module SBCFlN is called by module BCFlRP and calls submodule SBCFlC. The SBCFlN module performs these functions in the following order: inactive (IBOUND = 0). If 1. Check the cell to see if it is designated it is inactive, set the vertical leakance (temporarily stored in CV), transmissivity (temporarily stored in CC), and hydraulic conductivity equal to zero. 2. Check the cell that least one nonzero transmissive designate missive parameters, (a) transmissivity the (b) hydraulic is designated active to insure that there is at If there are no such nonzero transparameter. the cell inactive and print an error message. If the transmissivity or vertical-hydraulic is constant conductivity (LAYCON = 0 or Z), must be nonzero. the If the transmissivity is a function of head (LAYCON = 1 or 3), conductivity or vertical conductance must be nonzero. the horizontal-branch conductances for layers where the 3. Calculate transmissivity is constant (LAYCON = 0 or 2). Submodule SBCFlC is invoked to calculate the branch conductance from the transmissivity and cell dimensions. the vertical leakance between cells (temporarily 4. Multiply CV) by the cell dimensions to get the vertical conductance. 7. in If the simulation is transient multiply the primary storage by DELR and DELC to get the'primary storage capacity (SCl). If the layer is confined/unconfined, multiply the secondary storage by DELR and DELC to get the secondary storage capacity (SCZ). coeff:&ent coeff!iient stored RETURN. 5-68 Flow Chart LAYER TYPES are designated the LAYCON table. Layer types are: for Module SBCFlN (xi-) jn FOR EACH CELL O- confined 1 - unconfined 2 - constant/unconfined but transmissivity is constant 3 - confined/unconfined IF CELL IS INACTIVE, SET CONDUCTANCES EQUAL TO ZERO Primary storage capacity is taken as specific yield times cell area for unconfined layers, and as confined storage coefficient times cell area for confined or confined/unconfined layers. MAKE SURE THERE IS A NONZERO TRANSMISSIVE PARAMETER Secondary storage capacity is defined for confined/unconfined aquifers and is always taken as specific yield times cell area. 3 I I 1 CALCULATE HORIZONTAL BRANCHCONDUCTANCE FOR LA)(;R;YPES 0 I I I I CALCULATE CONDUCTANCE CALCULATE smm;;zY CAPACITY I 5-69 SUBROUTINE SBCFlN(HNEW,IBOUND,SCl,SCZ,CR,CC,CV,HY,TRPY,DELR,DELC, ISS, NCOL, NROW,NLAY, IOUT) 1 C C-----VERSION 1642 15MAY1987SBCFlN C C C C C C C C ****************************************************************** INITIALIZE AND CHECK BCF DATA **+*************************************************************** SPECIFICATIONS: -----------------------------------------------------------------DOUBLE PRECISION HNEWaHCNV C DIMENSIONHNEW(NCOL,NROW,NLAY)rIBOUND(NCOL,NROWINLAY) 1 ~SC~(NCOL~NRC~‘J~NLAY)~CR(NCOL,NRCW~NLAY) 2 3 4 rCC(NCOL,NROW,NLAY)rCV(NCOLINROW,NLAY) rHY(NCOL,NROW,NLAY)rTRPY~NLAY)rDELR(NCOL~ rSC2(NCOL,NROW,NLAY) C COMMON/FLWCOM/LAYCON(BO) ------------------------------------------------------------------ : IF IBOUND=O, SET CV=O.r CC=O.r AND HY=O. KB=O DO 30 K=lrNLAY IF(LAYCON(K1.EQ.3 .OR. LAYCON(K1.EQ.l) KB=KB+l DO 30 I=l,NROW DO 30 J=lrNCOL IF(IBOUND(J,IrK).NE.O1 GO TO 30 CV(J,I,K)=O. IF(K.NE.NLAY) Cl--- IF(K.NE.l) CV(J,I,K-l)=O. CC(J,I,K)=O. IFlLAYCONtK) .EQ.3 .OR. LAYCON .EQ.l) C a HY(J,I,KB)=O. 30 CONTINUE (-3--c2--- INSURE THAT EACH ACTIVE CELL HAS AT LEAST ONE NON-ZERO TRANSMISSIVEPARAMETER. IF NOT, CONVERT CELL TO NOFLOW. HCNV=888.88 KB=O DO 60 K=lrNLAY IFtLAYCONtK) .EQ.l .OR. LAYCON .EQ.3) GO TO 55 C2A--WHEN LAYER TYPE 0 OR 2, TRANSMISSIVITYOR CV MUST BE NONZERO DO 54 I=l,NROW DO 54 J=l,NCOL IF(IBOUND(J,I,K).EQ.O) GOTO 54 IF(CC(J,I,K).NE.O.) IF(K.EQ.NLAY) GOTO 54 GO TO 51 IF(CV(J,I,K).NE.O.) GOTO 54 51 IF(K.EQ.l) GOTO 53 IF(CV(J,I,K-11.NE.O.) GOTO 54 53 IBOUND(J,I,K)=O HNEW(J,I,K)=HCNV WRITE(IOUT,52) K,I,J 52 FORMAT(lX,'NODE(LAYER,ROW,COL)',314, 1 ’ ELIMINATED BECAUSEALL CONDUCTANCES TO NODEARE 0’1 54 CONTINUE GO TO 60 5-70 a C CZB----- WHEN LAYER TYPE IS 1 OR 3, HY OR CV MUST BE NONZERO 55 KB=KB+l DO 59 I=lrNROW DO 59 J=lrNCOL IF(IBCUND(J,I,K).EQ.O) GOTO 59 IF(HY(J,I,KB).NE.O.) GOTO 59 IF(K.EQ.NLAY) GO TO 56 IF(CV(J,I,K).NE.O.) GOTO 59 56 IF(K.EQ.l) GOTO 57 IF(CV(J,I,K-11.NE.O.) GOTO 59 57 IBOUND(J,I,K)=O HNEW(J,I,K)=HCNV CC(J,I,K)=O. WRITE(IOUT,52) K,I,J 59 CONTINUE 60 CONTINUE C C3..----- CALCULATE HOR. CONDUCTANCEtCRAND CC) FOR CONSTANT T LAYERS DO 65 K=lrNLAY KK=K IF(LAYCON(K1.EQ.3 .OR. LAYCON(Kl.EQ.1) GO TO 65 CALL SBCFlC(CR,CC,TRPYrDELR,DELC,KK,NCQLrNROWrNLAY) 65 CONTINUE C VERTICAL LEAKANCE BY AREA TO MAKE CONDUCTANCE c4 ------MULTIPLY IF(NLAY.EQ.l) GO TO 69 Kl=NLAY-1 DO 68 K=lrKl DO 68 I=l,NROW DO 68 J=lrNCOL CV(J,I,K)=CV(J,I,K)*DELR(J)*DELC(I) 68 CONTINUE C C5-----C5------ IF TRANSIENTMULTIPLYPRIMARYSTORAGE COEFFICIENTBY DELR d DELC TO GET PRIMARYSTORAGECAPACITYtSCl). 69 IF(ISS.NE.0) GOTO 100 KT=O DO 80 K=lrNLAY DO 70 I=lrNROW DO 70 J=lrNCOL SCl(J,I,K)=SCl(J,I,K)+DELR(J)*DELC(I) 70 CONTINUE C C6---C&--- IF LAYER IS CONF/UNCONF MULTIPLY SECONDARYSTORAGE COEFFICIENT BY DELR AND DELC TO GET SECONDARYSTORAGE CAPACITY(SC2). IF(LAYCON(Kl.NE.3 .AND. LAYCON(Kl.NE.2) GO TO 80 KT=KT+l DO 75 I=lrNROW DO 75 J=lrNCOL C SCZ(J,I,KT)=SC2(J,I,KT)*DELR(J)*DELC(I) 75 CONTINUE 80 CONTINUE C7------RETURN 100 RETURN END 5-71 List Variable of Variables for Range cc Global CR Global cv Global DELC Global DELR Global HCNV HNEW Module Global HY Package I I BOUND Module Global IOUT ISS Global Package Module SBCFlN Definition DIMENSION (NCOL,NROW,NLAY), Conductance in the column direction. CC(J,I,K) contains conductance between nodes (J,I,K) and (J,I+l,K). This array is used to temporarily hold transmissivity. DIMENSION (NCOL,NROW,NLAY), Conductance in the row direction. CR(J,I,K) contains conductance between nodes (J,I,K) AND (J+l,I,K). DIMENSION(NCOL,NROW,NLAY-l), Conductance in the vertical direction. CV( J ,I,K) contains conductance between nodes (J,I,K) and (J,I,K+l). This array is used to temporarily hold Vcont. DIMENSION (NROW), Cell dimension in the column direction. DELC(1) contains the width of row I. DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column J. Indicator in the HNEW array that the cell is inactive. DIMENSION(NCOL,NROW,NLAY), Most recent estimate of HNEW changes at each iteration. head in each cell. DIMENSION (NCOL,NR~W,NBOT), Hydraulic conductivity of the cell. (NBOT is the number of layers where LAYCON = 1 or 3.) Index for rows. DIMENSION(NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IOUT = 6. Primary unit number for all printed output. Flag. = 0, simulation is transient. * 0, simulation is steady state. Module Index KB KK Module Module Module KT Kl LAYCON Module Module Package NCOL NLAY NROW SC1 Global Global Global Package SC2 Package TRPY Package Index for layers. Index for bottom of layers. Temporary variable set equal to K. KK is used as an actual argument in subroutine calls to avoid using the DO loop variable K as an argument, which causes problems with some compilers. Index for top of layers. NLAY-1. DIMENSION(80), Layer type code: 0 - Layer strictly confined. 1 - Layer strictly unconfined. (transmissivity is 2 - Layer confined/unconfined constant). (transmissivity 3 - Layer confined/unconfined varies). Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. DIMENSION (NCOL,NROW,NLAY), Primary storage capacity of each cell (S*DELC*DELR). DIMENSION(NCOL,NROW,NTOP), Secondary storage capacity of each cell in the grid. (NTOP is the number of layers for which LAYCON = 2 or 3.) DIMENSION (NLAY), Ratio of transmissivity in the column direction to transmissivity in the row direction. ;: for columns. 5-72 Narrative for Module SBCFlH Module SBCFlH calculates the horizontal-branch conductances (conductance between nodes) for a layer in which the transmissivity is a function of head (LAYCON = 1 or 3). It calculates the transmissivity internally and calls It is called by BCFlFM submodule SBCFlC to calculate the branch conductances. for each type 1 or type 3 layer at each iteration. Transmissivity is the product of hydraulic conductivity and saturated thickness. The saturated thickness of a completely saturated layer is computed as the elevation of the top (TOP) minus the elevation of the bottom (BOT), the thickness of thickness is computed For a partially saturated layer , saturated the layer. as the head in the cell minus the elevation of the bottom of the layer. 1. For each cell, calculate If the cell is inactive, 2. move on to the next cell. the transmissivity. DO STEPS 2-6. set the transmissivity equal to zero and Calculate the thickness of the saturation. In a strictly unconfined In a layer3*the thickness is the head (HNEW) minus the bottom (BOTTOM) confiied/unconfined layer, the thickness is the head (HNEW) minus'the bottom or the top (TOP) minus the bottom, whichever is greater. 4. Check to see if the saturated thickness is greater than cell is greater than 5. If the thickness is the thickness times the hydraulic Print zero, If the saturated thickness is less than zero, the cell is dry. 6. set all branch conductances equal to a message to that effect, and set the boundary indicator (IBOUND) equal to zero. for 7. Call the layer. 8. submodule SBCFlC to calculate RETURN. 5-73 zero, the transmissivity conductivity. zero. the horizontal-branch of the conductances Flow Chart for Module SBCFlH SET TRANSMISSIVITY EQUAL TO ZERO CALCULATE SATURATED THICKNESS 6 I PRINT A MESSAGE SAYING CELL WENT DRY 1 l CALCULATE HORIZONTAL BRANCH CONDUCTANCE 5-74 I 6A SUBROUTINE SBCFlH(HNEWrIBDUND,CR,CC,CVrHY,TRPYrDELR,DELC ~~BOT,TCP,K,KB~KT,KITER,KSTP~KPERINCOL,NRCW~NLAY,IOUT) C 1442 31DEC1986SBCFlH C-----VERSION C ****************************************************************** C C COMPUTE CONDUCTANCEFROM SATURATED THICKNESS AND HYDRAULIC CONDUCTIVITY C ****************************************************************** : C C SPECIFICATIONS: -----------------------------------------------------------------DOUBLE PRECISION HNEW C DIMENSION HNEW(NCOL,NROW,NLAY)rIBCUND(NCOL,NROW,NLAY) 1, CR(NCOLrNROW,NLAY)r CC(NCOL,NROW,NLAY)r CV(NCOLrNROW,NLAY) ZrHY(NCOLrNROW,NLAY)r TRPYtNLAYlr DELRtNCOL), 3, BOT(NCOLrNROW,NLAY)rTOP(NCOL,NROW,NLAY) DELCtNROW) C COMMON/FLWCOM/LAYCON(BO) -----------------------------------------------------------------C C Cl--CALCULATE TRANSMISSIVIMAT EACH ACTIVE CELL. Cl ------WILL BE STORED TEMPORARILY IN THECC ARRAY. DO 200 I=l,NRCM DO 200 J=l,NCOL C C2--- IF CELL IS INACTIVETHEN SET T=O 6 MOVE ON TO NEXT CELL. IF(IBOUND(J,I,K).NE.O) GOTO 10 CC(J,I,K)=O. GO TO 200 C C3------CALCULATE SATURATED THICKNESS. 10 HD=HNEW(J,I,K) IF(LAYCON(K1.EQ.l) GO TO 50 IF(HD.GT.TOP(J,I,KT)) HD=TOP(J,I,KT) 50 THCK=HD-BOT(J,I,KB) C TO SEE IF SATURATED THICKNESS c4 ------CHECK IF(THCK.LE.0.) GO TO 100 C C5------ TRANSMISSIVITY IS GREATER THAN ZERO. IF SATURATED THICKNESS>0 THEN T=K*THICKNESS. CC(JrI,K)=THCK*HY(J,I,KB) GO TO 200 C SATURATED THICKNESS < 0, PRINT A MESSAGE AND SET c6 ------WHEN C6--TRANSMISSIVITY, IBOUND,AND VERTICAL CONDUCTANCE=0 C 100 WRITE(IOUT,lSO)K,IrJrKITER,KSTP,.KPER 150 FORMAT(lHO,lO('*')r'NODE'r314,' (LAYER,ROWrCOL) WENT DRY’ 1 ,I AT ITERATION=',13,' TIME STEP =‘,I3 2 ,I STRESS PERIOD=',I31 HNEW(JrI,K)=l.UO CC(J,I,K)=O. IBOUND(J,I,K)=O IF(K.LT.NLAY) CV(J,I,K)=O. IF(K.GT.l) CV(J,I,K-l)=O. GOTO 200 200 CONTINUE HORIZONTAL BRANCH CONDUCTANCESFROM TRANSMISSIVITY c7 ------COMPUTE CALL SBCFlC(CR,CC,TRPY,DELR,DELC,K,NCOL,NROWrNLAY) RETURN END 5-75 List Variable Range BOT Package cc Global CR Global cv Global DELC Global DELR Global HD HNEW Module Global HY Package I I BOUND Module Global IOUT J K KB KITER KPER KSTP Global Module Module Module Global Global Global KT LAYCON Module Package NCOL NLAY NROW THCK TOP Global Global Global Module Package TRPY Package of Variables for Module SBCFlH Definition DIMENSION (NCOL,NROW,NBOT), Elevation of the bottom of each layer. (NBOT is the number of layers for which LAYCON= 1 or 3.) DIMENSION (NCOL,NROW,NLAY), Conductance in the column direction. CC(J, I ,K) contains conductance between nodes (J,I,K) and (J,I+l,K). This array is used to temporarily hold transmissivity. DIMENSION (NCOL,NROW,NLAY), Conductance in the row direction. CR(J,I,K) contains conductance between nodes (J,I,K) and (J+l,I,K). DIMENSION (NCOL,NROW,NLAY-l), Conductance in the vertical direction. CV(J,I,K) contains conductance between nodes (J,I,K) and (J,I,K+~). DIMENSION (NROW), Cell dimension in the column direction. DELC(1) contains the width of row I. DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column J. Temporary label for an element in HNEW. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head in each cell. HNEWchanges at each iteration. DIMENSION (NCOL,NROW,NBOT), Hydraulic conductivity of the cell. (NBOT is the number of layers where LAYCON = 1 or 3.) Index for rows. DIMENSIoN(NC~L,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Primary unit number for all printed output. IOUT = 6. Index lfor co1 umns. Index for layers. Index for bottom of layers. Reset at the start of each time step. Iteration counter. Stress period counter. Reset at the start of each stress Time step counter. period. Index for tops of layers. DIMENSION(80), Layer type code: confined. 0 - Layer strictly unconfined. 1 - Layer strictly is (transm issivity 2- Layer confined/unconfined constant) (transm issivity 3- Layer confined/unconfined varies). Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Saturated thickness. DIMENsIoN(NC~L,NR~W,NT~P), Elevation 0f top 0f layers. (NTOP is number of layers for which LAYCON= 2 or 3.) DIMENSION (NLAY), Ratio of transmissivity in the column direction to transmissivity in the row direction. 5-76 Narrative for Module SBCFlC The module SBCFlC calculates horizontal-branch conductances for a layer from transmissivity and cell dimensions. It is called by submodules SBCFlN and SBCFlH. Recall that the branch conductances between two nodes can be expressed by c= However, + C&g(Cl $9. CI and C2 can be represented by Cl = TIW/(LI/2) C2 = T2W/(L2/2). Thus, C = 2TIT2W/(TIL2 + T2LI)+ This equation is used to calculate conductances along rows and columns. When calculating conductance along rows, LI and L2 are DELR(J) and DELR(J+l), When calculating conductance along columns, respectively, and W is DELC(I). LI and L2 are DELC( I) and DELC( I+l), respectively, and W is DELR(J). Conductance along columns is also multiplied by TRPY(K), the ratio of conductivity in the column direction to conductivity in the row direction in layer K. 1. Process cells one at a time calculating branch to the one on the right and the one in front. that cell equal If the transmissivity is equal 2. to zero and skip to the next cell. cell If the transmissivity 3. to the right, calculate 4. in front, 5. to zero, conductances set the branch from conductance of the cell is not zero and if there is a the branch conductance (CR) along the row. If the transmissivity of the cell is not zero calculate the conductance along the column. and there is a cell RETURN. Note: Transmissivity, which when conductances are calculated. CR(J,I,K) contains was temporarily the conductance node J+l,I,K. 5-77 ai,j+l/z,k stored in CC, will be lost between node J,I,K and Flow Chart for Module SBCFlC FOR EACH CELL 1 CALCULATE BRANCH CONDUCTANCE DOWN COLUMN YES I 5-78 SUBROUTINE SBCFlC(CR,CC,TRPY,DELR,DELC,K,NCOL,NROW,NLAY) c C C-----VERSION 1334 22AUG1987 SBCFlC **************~*************************************************** C C COMPUTEBRANCH CONDUCTANCEUSING HARMONIC MEAN OF BLOCK C CONDUCTANCES-- BLOCK TRANSMISSIVITY IS IN CC UPON ENTRY ***********************************~****************************** C C C SPECIFICATIONS: DIMENSION CR(NCOL,NROW,NLAY)r CC(NCOL,NROW,NLAY) 2 C C , TRPYtNLAY), DELR(NCOL)r DELCtNROW) -----------------------------------------------------------------YX=TRPY(K)*2. C Cl--Cl---- FOR EACH CELL CALCULATE BRANCH CONDUCTANCESFROM THAT CELL TO THE ONE ON THE RIGHT AND THE ONE IN FRONT. DO 40 I=l,NROW DO 40 J=l,NCOL Tl=CC(J,I,K) C c2---- IF T=O THEN SET CONDUCTANCEEQUAL TO 0. GO ON TO NEXT CELL. IF(Tl.NE.0.) GO TO 10 CR(J,I,K)=O. GO TO 40 C C3-----IF THIS IS NOT THE LAST COLUMNtRIGHTMOST)THEN CALCULATE c3 ------BRANCH CONDUCTANCEIN THE ROWDIRECTION (CR) TO THE RIGHT. 10 IF(J.EQ.NCOL) GO TO 30 T2=CC(J+lrIrK) CR(J,I,K)=2.*T2*Tl*DELC(I)/(Tl*DELR(J+l~+T2*DELR~J~~ C c4 ------IF THIS IS NOT THE LAST ROWtFRONTMOST)THEN CALCULATE c4 ------BRANCH CONDUCTANCEIN THE COLUMNDIRECTION (CC) TO THE FRONT. 30 IF(I.EQ.NROW) GO TO 40 T2=CC(J,I+lrK) CC(J,I,K)=YX*T2*Tl*DELR(J)/(Tl*DELC(I+l~+T2*DELC~I~~ 40 CONTINUE C c5 ------RETURN RETURN END 5-79 List Variable cc of Variables Module SBCFlC for Definition Range Global DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,Itl,K). This array is used to temporarily hold transmissivity. a3 Global DIMENSION (NCOL,NROW,NLAY), Conductance in the row CR(J,I,K) contains conductance between direction. nodes (J,I,K) and (Jtl,I,K). DELC Global DIMENSION (NROW), Cell dimension in the column DELC( I) contains the width of row I. direction. DELR Global DIMENSION (NCOL), Cell dimension in the row direction. DELR( J) contains the width of column J. I Module Index for rows. 3 Module Index for columns. K Module Index for NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the grid. TRPY Package DIMENSION (NLAY), layers. in the grid. in the column direction direction. grid. Ratio of transmissivity in the to transmissivity in the row Tl Module Temporary field for CC(J,I,K). T2 Module Temporary field for CC(Jkl,I,K). YX Module TRPY(K)*2. 5-80 Narrative This module calculates BCFlBD when the user its tasks 1. gathered 2. the right face 4. Clear front 6. Call 7. Clear gathered 8. the lower 9. 10. utility the calculate buffer Call flow is called by module It performs terms. flow terms are and store flow it in the row direction through in the buffer. (BUFF) in which the contents of the buffer. cell-by-cell flow terms in the column direction are are calculated. utility calculate the flow and store it through in the buffer. module UBUDSV to write the buffer (BUFF) in which the contents cell-by-cell flow of the buffer. terms are are calculated. For each cell, face the module UBUDSV to write of the cell as they cell -by-cell It are calculated. For each cell, face faces. (BUFF) in whi ch cell-by-cell of the cell as they cell order: buffer For each cell, Call 5. the as they 3. gathered the Module SBCFlB across has requested in the following Clear flow for calculate of the cell utility the flow and store it 5-81 vertical direction through in the buffer. module UBUDSV to write RETURN. in the the contents of the buffer. Flow Chart for Module SBCFlB BUFFER: the buffer is an array with one element for each It is cell in the grid. used to store the results of cell-by-cell calculations until all cells have been The contents processed. of the buffer are then recorded as a unit. THRU THE RIGHT SIDE AND STORE IN 3 , WRITE THE CONTENTS OF THE BUFFER I I I 4 FOR EACH CELL CALCULATE THE FLOW THRU THE FRONT SIDE AND STORE IN THE BUFFER 4 OF THE BUFFER FOR EACH CELL CALCULATE THE FLOW THRU THE BOTTOM SIDE AND STORE IN THE BUFFER WRITE THE CONTENTS OF THE BUFFER I pETURN 5-82 SUBROUTINE SBCFlBtHNEW, IBOUND,CR,CC,CV,TOP,NCOL,NROW, NLAY, KSTP, KPER, IBCFCB, BUFF, IOUT) 1 C C-----VERSION 1548 12MAY1987 SBCFlB C C C C C C C *******+****t***************************************************** COMPUTE FLOWACROSS EACH CELL WALL *************************************~**************************** SPECIFICATIONS: -_--------_------------------------------------------------------CHARACTER*4 TEXT DOUBLE PRECISION HNEW,HD C DIMENSION HNEWtNCOLrNROWrNLAY), IBOUND(NCOL,NROW,NLAY)r 1 CR(NCOL,NROW,NLAY)r CC(NCOL,NROW,NLAY), 2 3 CV(NCOL,NRCM,NLAY)r TOP(NCOL,NR(TW,NLAY), BUFF(NCOL,NROW,NLAY) ’ c COMMON/FLWCOM/LAYCON(80) C DIMENSION TEXT(12) C l DATA TEXT(l),TEXT(Z)rTEXT(3),TEXT(4),TEXT(5),~~(6),~~(7), 1 TEXT(8)r'TEXT(9)rTEXT(lO),~~(ll),~~~l2~ 2 /‘FLOW’,’ RIG','HT F’r’ACE ‘, LOW’r’ER F’r’ACE ‘FLOW’,’ FRO’r’NT F’,‘ACE ‘,‘FLoW’,’ 2 ------------------------------------------------------------------ C C ‘/ NCMl=NCOL-1 IF(NCMl.LT.1) GOTO 405 C Cl-----CLEAR THE BUFFER DO 310 K=lrNLAY DO 310 I=lrNROW DO 310 J=lrNCOL C BUFF(J,I,K)=O. 310 CONTINUE c2--- C DO400 I=lrNRCW DO 400 J=lrNCMl IF((IBOUND(J,I,K).LE.O) .AND. (IBOUND(J+lrI,K).LE.0)) GOTO 400 HDIFF=HNEW(J,I,KbHNEW(J+l,I,K) BUFF(J,I,K)=HDIFF*CR(J,I,K) 400 CONTINUE C3----- C FOR EACH CELL CALCULATE FLOW THRU RIGHT’FACE & STORE IN BUFFER DO 400 K=lrNLAY RECORDCONTENTS OF BUFFER CALL UBUDSV(KSTP, KPER,TEXT( 11, IBCFCB, BUFF, NCOL,NROW,NLAY, IOUT) 5-83 THE BUFFER al -----CLEAR 405 NRMl=NROW-1 IF(NRMl.LT.1) GO TO 505 DO 410 K=lrNLAY DO 410 I=lrNROW DO 410 J=l,NCOL n BUFF(J,I,K)=O. 410 CONTINUE -----FOR EACH CELL CALCULATE FLOW THRU FRONT FACE 8 STORE IN BUFFER E5 DO 500 K=lrNLAY DO 500 I=lrNRMl DO 500 J=lrNCOL C IF((IBOUND(J,I,K).LE.O) .AND. (IBOLlND(J,I+lrK).LE.O)) GOTO500 HDIFF=HNEW(J,I,K)-HNEW(J,I+lrK) BUFF(J,I,K)=HDIFF*CC(JIIIK) 500 CONTINUE C&-- RECORDCONTENTS OF BUFFER. CALL UBUDSV(KSTP,KPER,TEXT(5)rIBCFCB,BUFF,N~L,NR~,NLAY,IOUT) 505 NLMl=NLAY-1 C C7----- IF(NLMl.LT.1) GOTO 1000 CLEAR THE BUFFER DO 510 K=lrNLAY DO510 I=lrNROW DO510 J=l,NCOL BUFF(J,I,K)=O. 510 CONTINUE a c8-----FOR EACH CELL CALCULATE FLOW THRU LOWERFACE 8 STORE IN BUFFER KT=O DO 600 K=l,NLMl IF(LAYCON(K1.EQ.3 .OR. LAYCON(K1.EQ.Z) KT=KTtl DO 600 I=lrNROW DO 600 J=l, NCOL IF((IBOUND(J,I,K).LE.O) .AND. (IBDUND(J,I,K+l).LE.O)) GOTO 600 HD=HNEW(J,I,K+l) C IF(LAYCON(K+l).NE.S .AND. LAYCON(Kt11.NE.2) GOTO580 TMF=HD IF(TMP.LT.TOP(J,I,KTtT+1)) HD=TOP(J,IpKT+l) 580 HDIFF=HNEW(J,I,K)-HD BUFF(J,I,K)=HDIFF*CV(J,I,K) 600 CONTINUE c9 -----RECORD CONTENTS OF BUFFER. CALL UBUDSV(KSTP,KPER,TEXT(9) ,IBCFCB,BUFF,NCOL,NROW,NLAY, C ClO----RETURN 1000 RETURN END 5-84 IOUT) List Variable BUFF l Global obal CR obal cv obal HD HDIFF HNEW Module Module Global &FCB Module Package I BOUND Global IOUT KPER KSTP Global Module Module Global Global KT LAYCON Module Package NCMl NCOL NLAY NLMl NRMl NROW TEXT Module Global Global Module Module Global Module Module Package i JMP TOP for Range cc .m of Variables Module SBCFlB Definition DIMENSION (NC~L,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DIMENSION (NCOL,NROW,NLAY), Conductance in the column direction. CC(J,I,K) contains conductance between nodes (J,I,K) and (J,I+l,K). DIMENSION (NCOL,NROW,NLAY), Conductance in the row direction. Cft(J,I,K) contains conductance between nodes (J,I,K) and (J+~,I,K). DIMENSION (NCOL,NROW,NLAY-I), Conductance in the vertical direction. CV(J,I,K) contains conductance between nodes (J,I,K) and (J,I,K+I). Temporary field for head. Head difference between two adjacent nodes. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head in each cell. HNEWchanges at each iteration. Index for rows. Flag and a unit number. > 0, unit number on which the cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will be not be printed or recorded < 0, flow from each constant-head cell will be printed whenever I CBCFL is set. DIMENSION (NC~L,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IOUT = 6. Primary unit number for all printed output. Index for columns. Index for layers. Stress period counter. Reset at the start of each stress Time step counter. period. Index for tops of layers. DIMENSION( 80), Layer type code: 0 - Layer strictly confined. - Layer strictly unconfined. (transmissivity is : - Layer confined/unconfined constant) (transmissivity varies). 3- Layer confined/unconfined NCOL-1. Number of columns in the grid. Number of layers in the grid. NLAY-1. NROW-1. Number of rows in the grid. Label to be printed or recorded with array data. Temporary field for head. DIMENSION (NC~L,NR~W,NT~P), Elevation of top of layers. (NTOP is number of layers for which LAYCON = 2 or 3.) 5-85 Narrative This module calculates accumulated field by sign for accumulated utility into volumetric flow budget. The flows (CHOUT), the The flows are flow are also from each constant-head Module SBCFlF is called basis. cells. (CHIN) and out of to get the total cell on a by module BCFlBD and calls module UBUDSV. Module SBCFlF performs 1. flow from constant-head in the overall by cell cell-by-cell flow to get flow inclusion Module SBCFlF for Clear field, fields they flow will For each cell, 3. will cell-by-cell (BUFF) in which functions in the following CHIN and CHOUT in which respectively, If 2. the its flow order: into and out of the be accumulated. terms be stored calculate will be recorded, as they the flow clear the buffer are calculated. to and from constant-head cells. DO STEPS 4-12. If 4. the cell and go on to the Clear 5. the flows face 7. to the next the cell, skip further processing cell. six fields corresponding to the six the flow faces through which be calculated. For each face 6. that will is not a constant-head of the cell, calculate out of the cell through (STEPS 7-11). If there next face. is not a variable-head 5-86 cell which shares the face, go on 8. Calculate 9. Test adjacent the the sign variable-head of the adjacent flow through of the flow cell the face to see if from the variable-head cell into it the adjacent is positive (into cell) or negative constant-head into cell. the constant-head the cell). (out GO TO EITHER STEP 10 OR 11. 10. the flow If the flow If the sign is positive, Add together six 13. the 14. faces negative, If the user flows If 15. into Put, labels 17. flow add the flow rate to CHOUT (flow add the flow rate to CHIN (flow If specified and store x2, out of out of x4, number for cell into are to be recorded, them in the terms xs, x5, xs) corresponding RATE. a negative terms cell-by-cell buffer until IBCFCB, and ICBCFL $ 0, the aquifer. add the all cells are to be recorded, call six flow rates are finished. utility module them. Put flow for (x1, (RATE) from the constant-head the the terms in the field the cell-by-cell UBUDSV to record 16. the and leave out of the cell cells, is domain). 12. print sign domain). 11. to the the rates, into VBVL array those budget for and out of the flow inclusion terms into domain from constant-head in the overall VBNM. RETURN. 5-87 volumetric budget. Flow Chart for Module SBCFlF CHIN is a field in which flows, into the flow domain from constanthead cells, will be accumulated. CHOUT is a field in which flows, out of the flow domain to constanthead cells, will be accumulated. CLEAR THE SUFFER (BUFF) m EACH CELL BUFF is a buffer in which cell-by-cell flow terms will be stored as they are calculated prior to recording them on disk. CLEAR FIELDS IN WHICH SIX FLOWS WILL SE CALCULATED FC,R EACH FACE c 6 INTERNAL CELLS are those in They which head varies. are in opposition to EXTERNAL CELLS (inactive or constant head) which are on or outside of a boundary. SUM FLOWS THROUGH SIX FACES IF CELL-BY-CELL FLOW TERMS ARE NEEDED, RECORD BUFF 5-88 B SUBROUTINE SBCFlF (VBNM, VBVL, MSUM,HNEW,IBOUND, CR, CC, CV, 1 TOP, DELT,NCCL, NRCM,NLAY,KSTP,KPER, IBD, IBCFCB, ICBCFLr BUFF, IOUT) 2 C-----VERSION 1549 12MAY1987 SBCFlF C *****************************************~************************ C C COMPUTE FLckl FROM CONSTANT HEAD NODES ******Ytt**tt****t***~******~~****~*********~*******~******~~**~~* C C C SPECIFICATIONS: -----------------------------------------------------------------C CHARACTER*4 VBNM,TEXT DOUBLE PRECISION HNE’WIHD C DIMENSIONHNEW(NCOLrNRC%V,NLAY)r IBOUND(NCOL~NROWINLAY)~ 1 CR(NCOLrNRUf,NLAY)r CC(NCOLrNR(XJ,NLAY)r CV(NCOLrNROW,NLAY)r VBNM(4r20)r VBVL(4r20)r TOP(NCOL,NRC&V,NLAY)rBUFF(NCOL,NR~,NLAY) C COMMON/FLWCOM/LAYCON(80) C DIMENSION TEXT(4) C C’,‘ONST’,‘ANT ‘,‘HEAD’/ DATA TEXT(l),TEXT(2)rTEXT(3)rTEXT(4) /’ ------_----------------------------------------------------------E BUDGET ACCUMULATORS Cl ------CLEAR CHIN=O. CHOUT=O. C c2--- CLEAR BUFFER IF CELL-BY-CELL FLOW TERM FLAGiIBD) IS SET IF(IBD.EQ.0) GOTO 8 DO 5 K=lrNLAY DO 5 I=l,NRW DO5 J=lrNCOL BUFF(J,I,K)=O. 5 CONTINUE C C3---- FOR EACH CELL Q-----FACES. 8 KT=O DO 200 K=lrNLAY LC=LAYCON(K) IF IT IS CONSTANT HEAD COMPUTE FLOW ACROSS 6 IF(LC.EQ.3 .OR. LC.EQ.2) KT=KT+l DO200 I=l,NRCM DO 200 J=lrNCOL E4-----IF CELL IS NOT CONSTANT HEAD SKIP IT 8 GO ON TO NEXT CELL. IF (IBOUND(J,I,K).GE.O)GOTO 200 FIELDS FOR SIX FLOW RATES. :5 -----CLEAR x1=0. x2=0. x3=0. x4=0. x5=0. X6=0. EACH FACE OF THE CELL CALCULATE FLOW THROUGH THAT FACE c6-----FOR OF THE CONSTANT HEAD CELL AND INTO THE FLOW DOMAIN. c6 -----OUT COMMENTS 7-11 APPEAR ONLY IN THE SECTIONHEADED BY COMMENT 6A c6 -----BUT THEY APPLY IN A SIMILAR MANNER TO THE SECTIONS HEADED C(j--BY COMMENTS 6&6F. C (-3--- D 5-89 C6A----CALCULATE FLOW THROUGH THE LEFT FACE C C7----- IF THERE IS NOT A VARIABLE HEAD CELL ON THE OTHER SIDE OF THIS C7----- FACE THEN GO ON TO THE NEXT FACE. IF(J.EQ.l) GOTO 30 IF(IBOUND(J-l,I,K).LE.O)GO TO 30 HDIFF=HNEW(J,IrK)-HNEW(J-lrI,K) C C&--- CALCULATE FLOW THROUGH THIS FACEINTO THE ADJACENT CELL. Xl=HDIFF"CR(J-lrIrK1 n -----TEST TO SEE IF FLOW IS POSITIVEOR NEGATIVE E9 IF (Xl) 10,30,20 C ClD---- IF NEGATIVE ADD TO CHOUTtFLOW OUT OF DOMAIN TO CONSTANT HEAD). 10 CHOUT=CHCUT-Xl GO TO 30 C Cll---- IF POSITIVEADD TO CHINtFLOWINTO DOMAINFROM CONSTANT HEAD). 20 CHIN=CHIN+Xl n b C6&--- CALCULATE FLUV THROUGH THE RIGHT FACE 30 IF(J.EQ.NCOL) GOTO 60 IF(IBOUND(J+lrI,K) .LE.O) GO TO 60 HDIFF=HNEW(JrIrK)-HNEW(J+lrIrK) X2=HDIFF*CR(J,I,K) IF(X2140r60rSO 40 CHOLIT=CHOUT-X2 GO TO 60 50 CHIN=CHIN+X2 C C6C----CALCULATE 60 IF(I.EQ.l) FLU+’ THROUGH THE BACK FACE. GOTO 90 IF (IBOUND(JrI-lrK1.LE.O) HDIFF=HNEW(J,I,KbHNEW(JII-lrK) G0 TO 90 X3=HDIFFi%C(J,I-1,K) IF(X3) 70r90r80 70 CHOUT=CHOUT-X3 GO TO 90 80 CHIN=CHIN+X3 n END----CALCULATE FLOW THROUGH THE FRONT FACE. 90 IF(I.EQ.NRCW) GO TO 120 IF(IBDUND(J,I+l,K).LE.O) GDTO 120 HDIFF=HNEW(J,IrKbHNEW(J,I+lrK) X4=HDIFF%C(J,I,K) IF (X4) 100.120r110 100 CHOUT=CHOUT-X4 GO TO 120 110 CHIN=CHIN+X4 C6E---120 CALCULATE FLOW THRWGH THE UPPER FACE IF(K.EQ.l) GOTO 150 IF (IBOUNDtJrIrK-11.LE.O) GOTO 150 HD=HNEW(J,I,K) IF(LC.NE.3 .AND. LC.NE.21 TMF= HD GO TO 122 IF(TMP.LT.TOP(JrIrKT)) HD=TOP(JrI,KT) 122 HDIFF=HD-HNEWtJrIrK-1) XS=HDIFFFV(J,IrK-1) IF(X5) 130,150,140 130 CHOUT=CHOUT-X5 GO TO 150 140 CHIN=CHIN+X5 5-90 ----CALCULATE FLOW THROUGH THE LOWER FACE. 150 IF(K.EQ.NLAY) GO TO 180 IF(IBOUND(J,I,K+1) .LE.O) GO TO 180 HD=HNEW(JrIrK+l) IF(LAYCON(Kt11.NE.3 .AND. LAYCCN(K+l).NE.2) TMP=HD IF(TMP.LT.TOP(J,I,KT+l)) 152 HDIFF=HNEW(JrI,K)-HD X6=HDIFF+'CV(JrIrK) IF(X6) 160,180,170 GD TO 152 HD=TOP(JrIrKT+l) 160 CHDUT=CHOUT-X6 GO TO 180 170 CHIN=CHIN+X6 C c12--180 SUM UP FLOWS THROUGH SIX RATE=Xl+X2+X3+X4+X5+X6 SIDES OF CONSTANT HEAD CELL. C Cl3-----PRINT THE INDIVIDUALRATES IF REQUESTED(IBCFCB<O). IF(IBCFCB.LT.O.AND.ICBCFL.NE.0)WRITE(IOUT,900) (TEXT(N),t+lr4), 1 KPER,KSTP,K,IrJrRATE LAYER’, 13, 900 FOF&lAT(lHO,4A4,' PERIOD',I3,' STEP'rI3,' 1' ROW’rI4,’ RATE ‘rG15.7) CDL’rI4,’ C c14---- IF CELL-BY-CELL FLAG SET STORE SUM OF FLOWS FOR CELL IF(IBD.EQ.l) BUFF(J,I,K)=RATE IN BUFFER C 200 CONTINUE C c15---- IF CELL-BY-CELL FLAG SET THEN RECORD CONTENTS OF BUFFER IF(IBD.EQ.l) CALL UBUDSV(KSTP,KPER,TEXT(l)r 1 IBCFCB,BUFF, NCDL, NRW, NLAY, IOUT) C C C16---- SAVE TOTAL CONSTANT HEAD FLOWS AND VOLUMES IN VBVL TABLE Cl6 ----FOR INCLUSIONIN BUDGET. PUT LABELS IN VBNM TABLE. VBVL(lrMSUM)=VBVL(lrMSUM)+CHIN*DELT VBVL(2rMSUM)=VBVL(2rMSUM)+CHOUT*DELT VBVL(3rMSUM)=CHIN VBVL(4rMSUM)=CHOUT C C ---SETUP VDLUMETRIC BUM;ET NAMES VBNM(lrMSUM)=TEXT(l) VBNM(P,MSUM)=TEXT(2) VBNM(3rMSUM)=TEXT(3) VBNM(4rMSUM)=TEXT(4) C MSUM=MSUM+l C C Cl7 ----RETURN RETURN END 5-91 List Variable Global cc Global CHIN Module CHOUT Module CR Global cv Global DELT HD HNEW Global Module Module Global I I BCFCB Module Package IBD Package I BOUND Global I CBCFL Global IOUT Global Module Module Global Global J K KPER KSTP for Module SBCFlF Definition Range BUFF HDIFF of Variables DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,I+l,K). Accumulator for flow into the model area from constant heads. Accumulator for flow out of the model area to constant heads. DIMENSION (NCOL,NROW,NLAY), Conductance in the row CR(J,I,K) contains conductance between direction. nodes (J,I,K) and (J+l,I,K). DIMENSION (NCOL,NROW,NLAY-l), Conductance in the vertical CV(J, I ,K) contains conductance between direction. nodes (J,I,K) and (J,I,K+~). Length of the current time step. Temporary field containing a value from HNEW. Head difference between one node and the adjacent node. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head HNEWchanges at each iteration. in each cell. Index for rows. Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, flow from each constant-head cell will be printed whenever ICBCFL is set. Flag. = 0, cell-by-cell flow terms for this package will not be recorded. f 0, cell-by-cell flow terms for this package will be recorded. DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell x 0, variable-head cell Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. f 0, cell-by-cell flow terms (flow to constant heads) will be either printed or recorded for the current time step. Primary unit number for all printed output. IOUT = 6. Index for columns. Index for layers. Stress period counter. Reset at the start of each stress Time step counter. period. 5-92 List Variable for Module SBCFlF (Continued) Range KT LAYCON Module Package LC MSUM NCOL NLAY NROW RATE Module Global Global Global Global Module TEXT TMP TOP Module Module Package VBNM Global VBVL Global Xl Module Module Module Module Module Module ii x4 X5 X6 of Variables Definition Index for tops of layers. DIMENSION(80), Layer type code: 0 - Layer strictly confined. 1 - Layer strictly unconfined. (transmissivity is 2 - Layer confined/unconfined constant). 3 - Layer confined/unconfined (transmissivity varies). Temporary label for an element of LAYCON. Counter for budget entries and labels in VBVL and VBNM. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. Flow from the constant-head cell into the aquifer. (Reverse the sign to get the flow from the aquifer into the constant-head cell.) Label to be printed or recorded with array data. Temporary field for head. DIMENSION (NCOL,NROW,NTOP), Elevation of top of layers. (NTOP is the number of layers for which LAYCON = 2 or 3.) DIMENSION (4,20), Labels for entries in the volumetric budget. DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (Z,N), Rate for the current time step out of the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. Flow through the left face. Flow through the right face. Flow through the back face. Flow through the front face. Flow through the upper face. Flow through the lower face. 5-93 Chapter 6 RIVER PACKAGE Conceptualization Rivers water and streams from it effects regime. of flow To accomplish features contribute depending ground-water on the between this, Figure contained between each reach water of a stream this simple system conductance of figure 33 is helpful stream-aquifer no discrete techniques of simulation interpretation Figure of figure which 33-b, as it surface (26)) for developed to represent on the crosses that in which layer situations, terms an individual open of the simulation that, cell. The of figure the that streambed The length of in many is present. and parameters as a The system occurs. provided idealized of represented the conceptualization view of the 6-1 is must be recognized these the system by a layer flow streambed various reach. and describing through is seepage is simulated interconnection it each reach 33-b shows an idealization one-dimensional however, 34 shows an isolated contains Figure low-permeability is placed the systems. (equation so that from the ground-water in conceptualizing be applied reaches 33-a shows a situation material. interaction; instances, 33 can still that the stream-aquifer through equation Stream aquifer cell. of figure in which flow into and the model cell streambed and the and ground-water seepage to or from the divided is separated low permeability stream or drain seepage. in a single The cross-section system Package is to simulate features ground-water 32 shows a stream completely ground-water between the of the River representing by the to the head gradient surface-water terms affected water The purpose must be added to the each cell and Implementation proper are used. conductance of the 12 . 8 Figure 32.-Discretization of a stream into reaches. reaches are ignored. 6-2 Some small Land Low Permeability a . . Cell Boundary Impermeable Walls Head in Cell , . . . . . . * . . , Low Permeability -Yap-, Material . . , * , . . . . . . ~ . a *-: . . . * , , , , . . . . - . . , . . . . Cell Boundary Figure 33.-(a) Cross section of an aquifer containing a stream and (b) Conceptual representation of stream-aquifer interconnection in simulation. 6-3 . of Thickness of Riverbed M \ / v W Width of River Streambed Conductance= KLW/M Figure 34.~Idealization of streambed conductance individual cell. 6-4 in an conductance block node; the width taken is taken is taken as the as the thickness, tivity of the that measurable to those icant head loss width, layer underlying layer; and the K. stream is, saturated--that tions, and the ground-water stream streambed is no signif- and the that layer. point its the water Under these system QRIV = K ML W (HRIV - h. 1 ,Lk is made assumed that is, of the between the layer conduc- are limited there It is further does not drop below the bottom flow that the is hydraulic The assumption of the streambed fully crosses of flow and the aquifer itself--that model node. remains L, as it W; the distance is designated between the streambed model cell of the stream, streambed between the bottom by the underlying stream material head losses the length M, of the streambed across represented as the level assump- is given by ) (63-a) or QRIV = CRIV (HRIV - hi,j,k) where QRIV is the positive if it flow between the stream is directed CRIV is the hydraulic stream; interconnection (KLW/M), cell the underlying If across into the a discrete straightforward. to situations is streambed conductance which head losses these cases, which can be used in the task layer, that of the as stream-aquifer head at the all node in the significant the application streambed restricted to relate a single 6-5 of equations layer to those flow head loss equations however, is to formulate (63-b) taken HRIV is the head in the is the satisfied no discrete are not aquifer, reach. More frequently, in which and the aquifer; and hi,j,k stream assumption the (63-b) across (63) is (63) must be applied can be identified, such a layer. conductance between occurs the term, stream or in In CRIV, and the depth represented is by node i,j,k in general single a three-dimensional conductance field wise, they of stream guide during the sectional as the value choice area of flow product assumed distance the streambed this series in formulating should be recognized account exercise, cases, and that interaction however, be visualized the layer aquifer. bottom of flow should should that water stream levels to the concept bottom described 35-b, water can be recognized as conductances term to inherently layer, leaving aquifer of stream- In most point, aquifer. This streambed layer. (63); water and flow between the it required. below a certain layer, an unsaturated 6-6 always head values. by equations in an empirical approximation of a discrete in the between conductance fall of the streambed level interval is almost aquifer the cell; however, range of aquifer in the to In general, an acceptable to the head difference of the streambed is calibration provide within be treated process and of magnitude vertical layers of a single during a certain length conductance. flow situation is above the In figure normally Other- the assumed cross- ceases to depend on head in the by returning is proportional distinct formulation normally over if if are arbitrarily be of the same order reach a reliable can be formulated not exceed the an equivalent If conductance. For example, flow through head difference rules and stream and, these 35-a shows the aquifer width adjustment (63) seepage from the Figure normally a three-dimensional Equations aquifer should interval, for of conductance. and node i,j,k; within approximate. an effective Certain This representation must be chosen more or less of channel the and its seepage and associated model calibration. initial head difference. be more than may be used to calculate a conductance adjusted process, term can never measurements available, to the corresponding stream has fallen interval can level in through that and the below the beneath that Water Table I Flow through Streambed I . . . . . . . . . . . . . . . . . Head at the bottom of the streambed is equal to head in the cell. . . . A I Flow through Streambed . Water Table I ... ...... ......... .... . Head at the bottom of the streambed is equal to elevation of bottom of streambed layer. . I B Figure 35.-Cross sections showing the relation between head at the bottom of the streambed layer and head in the cell. Head in the cell is equal to the water-table elevation. 6-7 layer; if it is assumed that the head at its elevation base will the streambed simply is designated layer itself be the elevation RBOT, the flow through remains at that saturated, point. the streambed If layer this is given QRI~ = CRIV (HRIv - RBOT) where QRIV, CRIV, and HRIV are as defined further declines streambed tion utilizes in head below RBOT produce layer; (64), the as long these for flow simply retains as head remains concepts flow between a stream tion set equation the and a node i,j,k a function of the head, zero when hi,j,k, higher values lower values positive is equal of hi,j,k, according hi,j,k flow flow increases the A relationship generally prevails streambed layer linearly flow is present. must become independent that and cell equations is, is, into into decreases, interaction equa- i,j,k 65. as Flow is HRIV., For the stream; the until (65) for aquifer. hi,j,k This reaches whether seepage from the even before 6-8 and figure once a break of head in the aquifer. is established to the (65) in the stream, of equations For example, and the aquifer, is, constant. to that in stream-aquifer using that as hi,j,k remains similar between the stream independence is positive, herein 5 RBOT level is negative, by equa- > RBOT between the stream to the water given the interaction--that is simulated as calculated flow of hi,j,k, RBOT; thereafter this hi,j,k, value through The model described QRIV = CRIV (HRIV - RBOT), hi,j,k 36 shows a graph of flow Obviously, in flow constant stream-aquifer QRIV = CRIV (HRIV - hi,j,k), Figure (63-b). no increase below RBOT. in simulating (64) or not a discrete in saturation stream to the In most cases, a break (36) in saturation occurs aquifer moreover, occurs. QRIV Positive QRIV Indicates Flow into Aquifer 0 Negative QRIV Indicates Flow into Stream I I HRIV RBOT Figure 36.-Plot of flow, QRIV, from a stream into a cell as a function of head, h, in the cell where RBOT is the elevation of the bottom of the streambed and HRIV is the head in the stream. 6-9 Figure 37 shows a situation in which levels enough below a stream so that only between the streambed and the regional 37 will show that approximately will not increase figure and that this of head in the aquifer, as the limiting condition elevation hl, hydraulic gradient tions mately length A value beneath be obtained to hl. stream as it stream of limiting by substituting into cell conductance cell term, the i,j,k the stream, complex In all become to decline. will reach tre table reaches an vertical is given and again CRIV, consistent selected (64) aF#proxi- conductivity and W is stream QRIV in equation an one under the ccndi- hydraulic i,j,k, seepage and with KLW for itself stream. Because the vertical column beneath crosses 37 is but will is approximately in of further must at some point declines, KLW, where K is the in the saturated the 37 when the water equal the stream independent involve table to that seepage from a stream elevation in figure water similar head continues that 37, seepage from the of the value table be taken of the stream-aquifer estimated CRIV. water as that indicate illustrated by the product of the material the local RBOT should of figure beneath seepage from the stream conditions is may often material of figure must be regional shown in figure which and unsaturated independent increase of the far exists connection once a condition conditions, however, hydrologic Examination lowering Thus, situations, If table. saturated The situation of field of saturated connection seepage from the stream in the aquifer. overimplification patters further have fallen saturated water in the gradient. 37 is established, head decline a narrow the head gradient unity, in the aquifer value L. is width. with this of RBOT can and solving f'or This yields CRIV = KLW HRIV-RBOT 6-10 (66) - --- Line of Equal Head Figure 37.-Limiting seepage from a stream at unit hydraulic gradient 6-l 1 hi,j,k In summary, follow if the limiting the model of figure elevation at which the transition (65) should the stream-aquifer interaction. this within the that the cell, is and constant of flow the over period-- for banks, or that such events Input layer, each consists of six needed to calculate conductance of the elevation," or level attained significantly over assumption implies during the does not go dry or overflow its duration as to have no effect are entries for by the containing the limiting for reach, stress specifying the and the three or stage (CRIV), value each reach, level interconnection the user each river seepage--stream stream-aquifer at which specified (HRIV), and the of stream .:he "bot.:om seepage is (RBOT). At the start added to the flow choice river row, and column of the cell parameters do not vary are of such short reach is uniform The latter the stream here assumes of the stream in the stream to interaction. Data describing period. that utilized location technique approximation period. each stress example, interaction of water in the stream stress on stream-aquifer level seepage can be expected, a reasonable of the to table The model simulation (66). provide independent and that conditions limiting model of stream-aquifer interaction reach, to this then seepage is expected be chosen as the water from equation based on equations The simplified of stream 37, RBOT should and CRIV may be calculated that condition of which of each iteration, equation river is made by comparing for terms each cell seepage equation the most recent representing containing to use, value 6-12 river a river equation seepage 'are reach. The 63 or equation of head at the cell to the 64, ,value of RBOT for iteration, the Since this the most current previous iteration. use lags behind is selected, Thus, value process the check for If -CRIV is equation is done at the start of head (HNEW) is the the seepage calculations the term is added to RHS. is reach. which river 64 is selected, added to the term RHS. 6-13 from the seepage equation by one iteration. added to the term value of each If equation HCOF and the term the term to 63 -CRIV*HRIV -CRIV (HRIV - RBOT) River Input IUNIT(4). to the River (RIV) Package Input Package is read from the unit specifiecl in FOR EACH SIMULATION RIVlAL MXRIVR 110 1. Data: Format: IRIVCB 110 FOR EACH STRESS PERIOD RIVlRP 2. Data: Format: ITMP 110 3. Data: Format: Layer 110 (Input reach. Row 110 Column 110 of Fields Used in Instructions MXRIVR--is the maximum number of river IRIVCB--is a flag Row--is and a unit reaches active at one time. number. If IRIVCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. If IRIVCB = 0, cell-by-cell recorded. If IRIVCB < 0, river leakage for ICBCFL is set. a flag ITMP < 0, river If ITMP 10, the the flow terms will not be printed each reach will be printed or whenever and a counter. If Layer--is Rbot FlO.0 item 3 normally consists of one record for each river If ITMP is negative or zero, item 3 is not read.) Explanation Input ITMP--is Cond F10.0 Stage F10.0 layer data from the last stress period ITMP will be the number of reaches current stress period. number of the cell row number of the cell containing containing 6-14 the the river will active river be reused. during reach. reach. the Column--is Stage--is the column number of the cell the head in the Cond--is the riverbed Rbot--is the elevation containing river. hydraulic conductance. of the bottom of the 6-15 riverbed. the river reach. 6-16 Module Documentation The River called Package (RIVl) consists by the MAIN program. RIVlAL Allocates contain entry cell RIVlRP are: space for a list will of the riverbed. the the riverbed, reach, all (RIVR) which of which are will reach. location Each of the riverhead, conductance of the.bottom reach, the reach, riverhead, and elevation location of the conductance of the bottom of riverbed. Adds, for each river to the accumulators RIVlBD modules, and the elevation each river containing Package each river of the the riverbed, of the for consist containing River of four an entry Reads, for the The modules of the cell RIVlFM for Calculates the leakage into rates reach, the appropriate HCOF and RHS. and accumulated and out of the flow 6-17 terms volume of river system. Narrative This module allocates for Module RIVlAL’ space in the X array to store the list o,f river reaches. 1. of river 2. Print a message identifying Read and print indicating list 4. for 5. saving cell-by-cell Set LCRIVR, which will cell-by-cell element Calculate point to the first element pointing in the r!ver to the first the amount of space needed for the river riverhead, column, layer, and add it the number of elements riverbed list (six conductance, values and to ISUM. in the X array Package. 6. flow terms or a flag in the X array. bottom elevation) Print reaches:) and flow terms should be printed). equal to ISUM, which is currently each reach--row, riverbed MXRIVR (the maximum number of river number for whether (RIVR), unallocated NRI'IIER (number reaches). IRIVCB (the unit 3. the package and initialize RETURN. 6-18 used by the Riv,er B Flow Chart l for Module RIVlAL NRIVER is the number of river reaches being simulated at any given time. pi--) MXRIVR is the maximum number of river reaches simulated. IRIVCB is a flag and a unit number. If IRIVCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see RIVlBD module) is set. If IRIVCB = 0, cell -by-cell terms will not be printed flow or recorded. If IRIVCB < 0, river leakage for each reach will be printed whenever ICBCFL is set. LCRIVR is the location of the list of river PACKAGE AND INITIALIZE NUMBER OF REACHES (NRIVER) READ AND PRINT MXRIVR AND in the X array data (RIVR). l CALCULATE AMOUNT OF SPACENEEDED PRINT AMOUNT OF SPACE USED BY THE RIVER 6-19 SUBROUTINE RIVlAL(ISUM,LENX, LCRIVR, MXRIVR,NRIVER,IN,IOUT, IRIVCB) 1 1554 lZMAY1987 RIVlAL **C+*****+*****************************~*********************~~***** ALLOCATE ARRAY STORAGE FOR RIVERS ************************* 3**********************************~~***** SPECIFICATIONS: ----1---1-1-------------------------------------------------,-----------------------------------------------------------------,------ -----VERSION C C C C C C C C Cl--- C c2---- IDENTIFYPACKAGE AND INITIALIZE NRIVER. WRITE(IOUT,l)IN 1, 9/l/87', 1 FORMAT(lHO,'RIVl-- RIVERPACKAGE, VERSION 1' INPUTREAD FROM UNIT',131 NRIVER=O READ 8, PRINTMXRIVR 8 IRIVCB(UNITOR FLAG READ(IN,2)MXRIVR,IRIVCB 2 FORMAT(2110) WRITE(IOUT,3)MXRIVR 3 FORMATtlH , ‘MAXIMUM OF’, 15,' RIVERNODES’1 IF(IRIVCB.GT.0) WRITE(IOUT,9)IRIVCB FOR C-B-C FLOWS) FLOWS WILL BE RECORDEDON UNIT',131 IF(IRIVCB.LT.0) WRITE(IOUT,8) 8 FORMAT(lX,‘CELL-BY-CELL FLOWS WILL BE PRINTED') C C3------ SET LCRIVREQUALTO ADDRESS OF FIRSTUNUSED SPACE IN X. LCRIVR=ISUM , C c4------CALCULATE AMOUNTOF SPACE USED BY RIVERLIST. ISP=6*MXRIVR IsuM=IsuMtIsP 9 FORMATtlX, ‘CELL-BY-CELL :5 ------PRINT AMOUNTOF SPACE USED BY RIVERPACKAGE. WRITE(IOUT,4)ISP 4 FORMATtlX, 18,' ELEMENTS IN X ARRAY ARE USED FOR RIVERS' 1 ISUMl=ISUM-1 WRITE(IOUT,S)ISUMlrLENX 5 FORMAT(lX,I8,’ ELEMENTS OF X ARRAY USED OUT OF’,181 IF(ISUMl.GT.LENX)WRITE(IOUT,6) ***X ARRAY MUST BE DIMENSIONED LARGER***‘) 6 FORMATtlX,’ C c7-----mJ'URN RETURN END 8-20 List Variable of Variables Module RIVlAL for Ranae Definition IN Package Primary will unit number from which be read. IOUT Global Primary unit IRIVCB Package flag ISP Module Number of words ISUM Global Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. ISUMl Module ISUM-1. LCRIVR Package Location RIVR. LENX Global Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. MXRIVR Package Maximum number of river reaches NRIVER Package Number of river period. active number for all input printed for this output. package IOUT = 6. and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see RIVlBD module) is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, river leakage for each reach will be printed whenever ICBCFL is set. in the in the X array reaches 6-21 X array of the allocated first active during by this element module. of array at any one time. the current stress Narrative This river the reaches Test 2. last ITMP is If period for river list. the previous ITMP is will the the number of river specified ITMP. stress Module RIVlRP reads data to build Read ITMP. 1. that module for less than stress zero, Print be reused. reaches or a flag period the river indicating should data a message to that be reused. read for effect and RETURN. 3. If reaches for ITMP is this in the current 4. period If stress stress Compare the to the NRIVER is than greater or equal period equal number of river than to zero, Set the period. number specified Print 5. greater it is the number of river number of reaches (NRIVER) to ITMP. reaches (NRIVER) in the current as the maximum for the simulation stress (MXRIVR). MXRIVR, STOP. the number of river reaches in the current stress period ' (NRIVER). 6. in the 7. See if current there stress Read and print and the elevation 8. are any river period the reaches. (NRIVER = 0), layer, of the bottom row, of the If bypass column, riverbed RETURN. 6-22 there are no river further riverhead, for river processing. riverbed each reach. reaches conductance, Flow Chart for Module RIVlRP ITMP is both a flag and a counter. If it is greater than or equal to zero, it is the number of reaches to be simulated during the current stress period. If it is less than zero, it indicates that the reaches simulated in the last stress period should be simulated in the current stress period. I MXRIVR is the maximum number of reaches to be simulated. 1 NO I OF REACHES YES READ ONE DATA RECORD FORREEEH 6-23 SUBROUTINE RIVlRPtRIVR,NRIVER, MXRIVR, IN, IOUT) c C C-----VERSION 1319 25AUG1982RIVlRP *+**+*t*****+t*t****~~~*~***~**~~~~~~~***~*~**~***~*~****~~***~~~* C READ RIVERHEAD, CONDUCTANCE AND BOTTOM ELEVATION C C *********************************************************~******** : SPECIFICATIONS: -------------------_----------------------_---------------------DIMENSION RIVR(6rMXRIVR) ------------------------------------------------------------------ C C C C Cl-.-- READ ITMPtNUMBER OF RIVER REACHES OR FLAG TO REUSE DATA) READ(IN,8)ITMP 8 FORMATtIlO) L c2--- TEST ITMP. IF(ITMP.GE.O)GOTO 50 n :2 A-----IF ITMP (0 THEN REUSE DATA FROM LAST STRESS PERIOD. WRITE (IOUT, 7 1 7 FORMAT(lHO,‘REUSING RIVER REACHES FROM LAST STRESS PERIOD’) GO TO 260 :3 ------IF ITMP=>ZERO 50 NRIVER=ITMP THEN IT IS THE NUMBER OF RIVER REACHES C c4------IF NRIVERBMXRIVR THEN STOP. IF(NRIVER.LE.MXRIVR)GO TO 100 WRITE(IOUT,99)NRIVER,MXRIVR 99 FORMAT(lHOr'NRIVER(',I4,') IS GREATER THANMXRIVR('rI4,')') C f-&+-- ABNORMAL STOP. STOP C C5------ PRINT NUMBER OF RIVER REACHES 100 WRITE(IOUT,l)NRIVER 1 FORMAT(lHO,//lX,I5,' RIVER IN THIS STRESS PERIOD. REACHES’) ------IF THERE ARE NO RIVER REACHES THEN RETURN. IF(NRIVER.EQ.0) GO TO 260 C C7------ READ AND PRINT DATA FOR EACH RIVER REACH. WRITE(IOUT,3) 3 FORMATt lHO,15X,‘LAYER’ ,5X, ‘ROW’ ~5x1 ‘CQL ’ 1, ’ STAGE CONDUCTANCE BOTTOM ELEVATION RIVER REACH’ 2/1X,15X,80(‘-‘)) DO 250 II=lrNRIVER C READ(IN,4)K,I,JrRIVR(4rII),RIVR(5rII)rRIVR(6rII) 4 FORMAT(3110,3FlO.O) WRITE~IOUT,5~K,I,J,RIVR~4,II~rRIVR~5rII~,RIVR~6,II~,II 5 F0RMAT(1X,15X,14r19,18,G13.4,G14.4,G19.4,110) RIVR(lrII)=K RIVR(Z,II)=I RIVR(3,II)=J 250 CONTINUE C8------RETURN 260 RETURN END 6-24 List Variable of Variables for Module RIVlRP Definition Range I Module Row number. II Module Index IN Package Primary will unit number from which be read. IOUT Global Primary unit ITMP Module Flag or number of rivers. > 0, number of rivers active during the current stress period. < 0, same rivers active during the last stress period will be active during the current stress period. 3 Module Column number. K Module Layer MXRIVR Package Maximum number of river time. reaches NRIVER Package Number of river reaches stress period. active RIVR Package DIMENSION (6,MXRIVR), For each reach: layer, column, river head, riverbed conductance elevation of bottom of riverbed. for river reach. number for all input printed for this output. package IOUT = 6. number. 6-25 active during at any one the current row, and Narrative This module adds terms for Module RIVlFM representing river to the accumulators leakage HCOF and RHS. If 1. period, NRIVER is there less are no river 2. For each reach 3. Determine 4. If on this of the of the 7. of the If 8. is of the the row (IR), and layer (IL). bypass processing reach. and elevation head in the stress DO STEPS 3-8. get the aquifer river of the data bottom (riverhead of the riveriled). (HNEW) to the elevation of the (RBOT). head in the aquifer conductance; If next internal, riverbed in the current (IBOUND(IC, IR, IL) 5 0), external riverbed RHS and the term add the term 9. cell riverbed the bottom accumulator riverbed the Compare the 6. (IC), to zero, RETURN. in the RIVR list, column is or equal reaches. and go on to the Since conductance bottom the cell reach 5. the than (HNEW) is greater (RBOT), add the term -CRIV to the accumulator than the elevation -CRIV*HRIV HCOF. to the (CRIV is the HRIV is the riverhead.) head in the aquifer -CRIV*(HRIV (HNEW) is less - RBOT) to the accumulator RETURN. 6-26 than RHS. or equal to :?BOT, Flow Chart for Module RIVlFM RHS is an accumulator in which the right hand side of the equation is formulated. HCOF is an accumulator which the coefficient head in the cell is formulated. in of NO 2 FOR EACH REACH DETERMINE ROW, COLUMN, AND LAYER I I ADD TERMS THocRoH~%D THIS CELL I 6-27 GET RIVER HEAD. BOTTOM ELEVATION AND RIVERBED CONDUCTANCE ADD TERM TO RHS FOR THIS CELL I 1 SUBROUTINE RIVlFMt NRIVER,MXRIVR,RIVR, HNEW,HCOF,RHS,IBOUND, NCOL,NROW,NLAY) C C-----VERSION 0915 27AUG1982 RIVlFM *****t***********~******************************************~~***** C C ADD RIVER TERMS TO RHS AND HCOF ************************************************************~~***** C C C SPECIFICATIONS: ------------------------------------------------------------~----C C DOUBLE PRECISION HNEW DIMENSION RIVR(6rMXRIVR),HNEW(NCOL,NLAY)r 1 HCOF(NCOL,NROW,NLAY)rRHS(NCOL,NROW,NLAY), 2 IBOUNDt NCOL,NROW,NLAY1 ------------------------------------------------------------~----C C C Cl--IF NRIVER<=O THERE ARE NO RIVERS. RETURN. IF(NRIVER.LE.O)RETURN C c2--PROCESS EACH CELL IN THE RIVER LIST. DO 100 L=lr NRIVER C C3------ GET COLUMN, ROW, AND LAYER OF CELL CONTAINING REACH IL=RIVR(lrL) IR=RIVR(Zr L) IC=RIVR(3,L) C c4 ------IF THE CELL IS EXTERNAL SKIP IT. IF(IBOUND(IC,IR,IL).LE.OYGO TO 100 C C5------ SINCE THE CELL IS INTERNAL GET THE RIVER DATA. HRIV=RIVR(4, L) CRIV=RIVR(5rL) RBOT=RIVR(6rL) HHNEW=HNEW (IC, IR, IL 1 C C6---COMPAREAAUIFER HEAD TO BOTTOM OF STREAM BED. IF(HHNEW.LE.RBOT)GO TO 96 C c7 ------SINCE HEAD>BOTTOMADD TERMS TO RHS AND HCOF. RHS(IC,IR,IL)=RHS(IC,IR,IL)-CRIV*HRIV HCOF(IC,IR,IL)=HCOF(IC,IR,IL)-CRIV GO TO 100 a a k3 ------SINCE HEAD<BOTTOMADD TERM ONLY TO RHS. 96 RHS(IC,IR,IL)=RHS(IC,IR,IL)-CRIV+(HRIV-RBOT) 100 CONTINUE -----~)-lJRN RETURN END a 6-28 List Variable of Variables for Module RIVlFM Ranae Definition CRIV Module Riverbed HCOF Global DIMENSION (NCOL,NROW,NLAY), Coefficient of head in the cell (J,I,K) in the finite-difference equation. HHNEW Module HNEW (J,I,K), HNEW Global DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head in each cell. HNEW changes at each iteration. HRIV Module Head in the I BOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Column number of the cell IL Module Layer IR Module Row number of the cell L Module Index for MXRIVR Package Maximum number of river NCOL Global Number of columns NLAY Global Number of layers NRIVER Package Number of river period. NROW Global Number of rows in the grid. RBOT Module Temporary RHS Global DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. RIVR Package DIMENSION (G,MXRIVR), For each reach: layer, row, column, riverhead, riverbed conductance and elevation of bottom of riverbed. conductance. Single precision. river. number of the cell river of each cell. containing the containing containing the the river river river reach. reach. reach. reaches. in the in the reaches field: 6-29 elevation reaches active at any one time. grid. grid. active j during of the river the current stress bottom. Narrative This module calculates for rates Module RIVlBD and volumes transferred between the aquifer and rivers. Initialize 1. accumulators put zeros 3. disk. terms If there the Test to see if budget terms is not the accumulated for flag (IBD) and the skip down to step rate proper flow terms step r ivers will terms are to be saved on the of the following (ICBCFL = 0) or during this be saved for (IBD) and clear flag flow either time 17 and rivers. the cell-by-cell are not to be saved for flow-term (NRIVER 2 0), not be saved if cell-by-cell cell flow-term are no reaches into They will (1) This cell-by-cell (RATIN and RATOUT). If 2. the the hold: (2) ce 11-by-cell simulation this buffer conditions (IRIVCB .L 0). package, in which flow set they will the cell-by- be (BUFF). 4. For each reach, 5. Determine 6. If do steps 5-15 accumulating flows from or into the river. the row, column, and layer of the cell containinlg the reach. of this of the the cell is external (IBOUND( 1,J ,K) 5 0), bypass further- processing reach. 7. Get the 8. Check to see if bottom river of the parameters from the the head in the riverbed. 6-30 river cell is list. greater than the e*evation 9. bottom times the of the the 10. the If riverbed, riverhead If of the the riverhead set RATE equal than riverbed, is the elevation to the conductance less minus the elevation or equal to the conductance of the bottom of the of the of riverbed riverbed - RBOT)). the cell-by-cell flow terms are to be printed, 12. If the cell-by-cell flow terms are to be saved, print RATE. add the RATE to (BUFF). 13. Check to see whether the 14. If add it to RATOUT. 15. If RATE is positive, add it to RATIN. 16. See if RATE is negative, the cell-by-cell If they are, call flow flow module UBUDSV to in VBVL for to VBNM for printing is into terms record Move RATIN and RATOUT into Add RATIN and RATOUT multiplied accumulators - HNEW)). to the elevation If 17. riverbed (RATE = CRIV*(HRIV than set RATE equal of the of the 11. buffer labels greater minus the head in the cell (RATE = CRIV*(HRIV the is the head in the cell bottom times head in the cell the are to be saved the buffer VBVL array by the time-step printing or out of the aquifer. by BASlOT. (BUFF) onto for printing length to the Move the by BASlOT. 18. Increment the budget-term counter (MSUM). 19. RETURN. 6-31 (IBD = river 1). the disk. by BASlOT. volume budget term Flow Chart for Module RIVlBD c IBD is a flag which, if set, causes cell-by-cell flow terms for river leakage to be recorded. EXTERNAL: a cell is said to be external if it is either no flow or constant head (i.e., an equation is not formulated for the cell). RATE is the leakage rate into the aquifer from the river in a cell. ‘R EACH REACH BUFFER is an array in which values are stored as they are being gathered for printing or recording. RATOUT is an accumulator to which all flows out of the aquifer are added. RATIN is an accumulator which all flows into aquifer are added. IRIVCB is number. a flag PARAMETERS FROM RIVER to the and a unit If IRIVCB > 0, it is the unit number on which cell-by-cell flow terms for rivers will be recorded whenever ICBCFL is set. 12 IF CELL-BY-CELL FLOW TERMS ARE TO BE RECORDED ADD RATE TO BUFFER r-l If IRIVCB = 0, cell-by-cell flow terms for rivers will not be printed or recorded. If IRIVCB < 0, river leakage for each reach will be printed whenever ICBCFL is set. ICBCFL is a flag. If ICBCFL f 0, cell-by-cell flow terms will be printed or recorded (depending on IRIVCB) for the current time step. 6-32 SUBROUTINE RIVlBD(NRIVER,MXRIVR,RIVR,IBOUND, HNEW, NCOL,NROW,NLAY, DELT, VBVL, VBNM,MSUM,KSTP, KPER, IRIVCB, 2 ICBCFL,BUFF, IOUT) 1 C-----VERSION 1556 12MAY1987RIVlBD ***~************************************************************** CALCULATE VOLUMETRIC BUDGET FOR RIVERS ************************~***************************************** SPECIFICATIONS: --_----------------------------------- ---------------------------- CHARACTER*4 VBNM,TEXT DOUBLE PRECISION HNEW DIMENSION RIVR(6,MXRIVR),IBOUND(NCOL,NROW,NLAY), HNEW(NCOL,NROW,NLAY),VBVL(4r20)rVBNM[4rZO~, 1 2 BUFF(NCOL,NROW,NLAY) DIMENSION TEXT(4) R’r’IVER’r’ DATA TEXT(l)rTEXT(Z),TEXT(3),TEXT(4) /’ ------------------------------------------------------------------ INITIALIZE CELL-BY-CELL FLOW TERM FLAG (IBD) ACCUMULATORS(RATIN AND RATOUT). Cl--- Cl--- LEA’r’KAGE’/ AND IBD=O RATIN=O. RATOUT=O. C l c2--- IF NO REACHES KEEP ZEROES IF(NRIVER.EQ.O)GO TO 200 C C3-----C C3A----- IN ACCUMULATORS. TEST TO SEE IF CELL-BY-CELL FLOW TERMS ARE NEEDED. .OR. IRIVCB. LE.0 1 GO TO 10 IF(ICBCFL.EQ.0 CELL-BY-CELL FLOW TERMS ARE NEEDED SET IBD=l DO 5 IL=lrNLAY DO 5 IR=l,NROW DO 5 IC=lrNCOL IBD AND CLEAR BUFFER. BUFFtIC, IR, IL)=O. 5 CONTINUE C c4 ------FOR EACH RIVER REACH ACCUMULATERIVER FLOW (STEPS 5-15) 10 DO 100 L=lr NRIVER C C5------ GET LAYER, ROW& COLUMNOF CELL CONTAINING REACH. C (3j--- C C7------ D IL=RIVR(l,L) IR=RIVR(Z,L) IC=RIVR(3rL) IF CELL IS EXTERNAL MOVE ON TO NEXT REACH. IF(IBOUND(IC,IR,IL) .LE.O)GO TO 100 GET RIVER PARAMETERSFROM RIVER LIST. HRIV=RIVR(4rL) 6-33 a CRIV=RIVR(5,L) RBOT=RIVR(6, L) HHNEW=HNEW(IC,IR,IL) C C8------COMPARE C c9 ------AQUIFER HEAD IN AQUIFER TO BOTTOMOF RIVERBED. HEAD > BOTTOM THENRATE=CRIV*(HRIV-HNEW). IF(HHNEW.GT.RBOT)RATE=CRIV*(HRIV-HHNEW) C cl+-- AQUIFER HEAD C BOTTOM THENRATE=CRIV*(HRIV-RBOT) IF(HHNEW.LE.RBOT)RATE=CRIV*tHRIV-RBOT) C Cl1 -----PRINT THE INDIVIDUAL RATESIF REQUESTED(IRIVCE<O). IF(IRIVCB.LT.O.AND.ICBCFL.NE.0) WRITE(IOUT,900) (TEXT(N)rN=lr4), 1 KPER, KSTP, L, IL, IR, IC, RATE 900 FORMAT(lHO,4A4,’ PERIOD’ ,13, ’ STEP’rI3,’ REACH',I4, 1' LAYER',I3,' ROW’,I4,’ COL’,I4,’ RATE’rG15.7) C c12--- IF C-B-C FLOW TERMS ARE TO BE SAVED THEN ADD RATE TO BUFFEI?. IF(IBD.EQ.l) BUFF(IC,IR,IL)=BUFF(IC,IR,IL)+RATE C Cl3----- SEE IF FLOW IS INTO AQUIFER OR INTO RIVER. IF(RATE)94,100,96 C Cl4 -----AQUIFER IS DISCHARGING TO RIVER SUBTRACT RATE FROM RATOUT. 94 RATOUT=RATOUT-RATE GO TO 100 C Cl5----- AQUIFERIS RECHARGEDFROM RIVER ADD RATE TO RATIN. 96 RATIN=RATIN+RATE a 100 CONTINUE El6 -----IF C-B-C FLW TERMS WILL BE SAVED CALL UBUDSV TO RECORDTHEM. IF( IBD. EQ. 1) CALL UBUDSVtKSTP, KPER, TEXT,IRIVCB, BUFF, NCOL, NROW., 1 NLAY, IOUT) C Cl7 -----MOVE RATESsVOLUMES8, LABELS INTO ARRAYSFORPRINTING. 200 VBVL(3,MSUM)=RATIN VBVL(I,MSUM)=RATOUT VBVL(l,MSUM)=VBVL(lrMSUM)+RATIN*DELT VBVL(2,MSUM)=VBVL(2,MSUM)+RATOUT*DELT VBNM(lrMSUM)=TEXT(l) VBNM(2,MSUM)=TEXT(2) VBNM(3,MSUM)=TEXT(3) VBNM(4rMSUM)=TEXT(4) C Cl+-- INCREMENT BUDGET TERM COUNTER MSUM=MSUM+l C C19-----RETURN RETURN END a 6-34 List Variable of Variables Range for RIVlBD Definition BUFF Global DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. CRIV Module Conductance DELT Global Length HHNEW Module HNEW (J,I,K), HNEW Global DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEW changes at each iteration. head in each cell. HRIV Module Head in the IBD Module Flag. = 0, cell-by-cell flow not be recorded. f 0, cell-by-cell flow be recorded. of the bed of the of the current Single time river reach. step. precision. river. terms for this package will terms for this package will IBOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index for ICBCFL Global Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. f 0, cell-by-cell flow terms will be either printed or recorded (depending on IRIVCB) for the current time step. IL Module Index I OUT Global Primary IR Module Index for IRIVCB Package Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, river leakage for each reach will be printed whenever ICBCFL is set. KPER Global Stress for 0f each cell. columns. layers. unit number for all printed output. IOUT = 6. rows. period counter. 6-35 List Variable of Variables for Module RIVlBD Range (Continued) Definition KSTP Global Time step period. counter. L Module Index river MSUM Global Counter MXRIVR Package Maximum number of river NCOL Global Number of columns NLAY Global Number of layers NRIVER Package Number of river period. NROW Global Number of rows in the RATE Module Flow from the river into get the flow into the RATIN Module Accumulator rivers. for the total flow into RATOUT Module Accumulator rivers. for the total flow out of flow RBOT Module Elevation of the bottom RIVR Package DIMENSION (6,MXRIVR), For each reach: layer, row, riverhead, riverbed conductance, and elevation bottom of the riverbed. TEXT Module Label VBNM Global DIMENSION (4,20), VBVL Global DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (2,N), Rate for the current time step out of the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. for for Reset at the start of each stress reaches. budget entries reaches in the in the reaches to be printed 6-36 and labels in VBVL and VBNM. active at any one time. grid. grid. active during the current stress grid. the cell. river.) of the or recorded Labels for budget. (Reverse the the field flow field sign to from into riverbed. with entries the array column, of the data. in the volumetric CHAPTER 7 RECHARGEPACKAGE Conc_e_etualization The Recharge (RCH) Package is designed recharge to the a result of precipitation Recharge applied ground-water that (i,j) recharge flux DELRj*DELCi, within allow the for vertical its recharge expressed (in units vertical occur in model layer system may vary with rises of length column of cells per unit natural that receives occurs for the to a single ccl 1 j). There is no need to at multiple depths in the same the ground-water system of the ground-water system will vertical position and with specifying recharge is the to the map area, app lied is enters location and Ii,j applicable at (i the top the time; cell time at of the top of the as the water-table the cell in each vertical have been implemented as described below. The RCH Package can potentially be used to simulate recharge from sources other example, recharge. If ability to apply is required, specified than then precipitation recharge the Well at any model cell, as system. to the model at horizontal time) located situation, options ground-water QRi,j, recharge 1; however, Three and falls. recharge (67) applied simultaneously horizontal distributed as The recharge, simplest area1 volume per unit column of cells column because In the rate as a fluid to occur areally *DELRj*DELCi flow of the cell. recharge top. to the to the model is defined is the location percolates = Ii,j to simulate Most commonly, system. QRi,j where QRi,j and Implementation -- -- for to more than Package, one cell which can be used. 7-1 allows artificial in a vertical recharge the column of cells or discharge to be In the package described herein, a two dimensional an option is exercised to use recharge period). These values of recharge flux DELRjDELCi, to obtain horizontal cell maintained in the RECH array. recharge is applied which the code, NRCHOP, and optional of the cell recharge in the dimensional array active head cell above it to receive option, cells and there the if there it units used to In the location, value for k, that of RHSi,j,k all cells independent that cell application is assumed that in units a given is determind (equation receive of aquifer by the application recharge there to any 1 and 2, if is added. no recharge to the a cell designated Under the column of is applied would that in two is no constant in a vertical the cell recharge or (29)). nothing (1) provided equations, recharge. head, option to be intercepted are read into with the by the length and model parameters. horizontal (26) are numbers contained are consistent other recharge recharge values by column to include: any recharge flux that all then stre:;s which of the head cell above, of the matrix with by layer (unless multiplied of the no recharge Recharge previous the The options are period each vertical Under options then Ii,j, of QRi,j, through column, is a constant represent formation associated QRi,js no-flow, head source. model must be expressed time vertical is no active column because constant in the is values and (3) application in the column. recharge third this cell from the within IRCH. 1; (2) flux, are immediately column as specified IRCHi,j; uppermost fluxes is specified to model layer vertical RECHi,j, The cell array of recharge at each stress read into areas, array, values This recharge location option is added to the 7-2 (i,j) rate, and ve-tical is subtracted from the is done at each iteration Because recharge HCOFi,j,k. flow as defined coefficient is of head, Land Surface River Estimated Water Table River Vertical Cross-Section Showing Field Situation With Ftnite Difference Grid Superimposed a . .. .. . 1.1.. .*.*.a Iti cl Variable Ei Constant fgj Inactive Head Head liiiiiiiiiiiiiiiiiivl Status of Cells at End of Srmulation b II 11 Cells Whrch Receive Recharge 11 I”’ El Cell Which Receives Recharge El Cell Which Receives Recharge la Inactive Cell Specified by User to Receive Recharge 1 Under Optron 1 C Cells Which Recerve Recharge Heavy Line Encloses Cells User Thought Would Receive Recharge Based on Estrmated Water Table Under Option 2 d xxxxxxxxx I I I I I I I I I I I I I I I I I I 1-l Cells Which Receive Recharge El Cell Whtch Receives Recharge Under Option 3 e Figure 38.-Hypothetical problem showing which cells receive recharge under the three options available in the Recharge Package. 7-3 Careful consideration to the other the three options employed recharge For example, should options figure described table conditions, of active, option the horizontal constant simulated head and no-flow 38-C illustrates the layer vertical columns simulate the utilized, simulation slightly cells inactive of the model. beneath given those (figure 38-a). assuming that on the basis the cells cells is the the water shut under water column fall final distribution 38-b. is permitted table layer, only shape has been recharge This off. during to the model -if recharge in the top seepage Using the p*ovision truncated distribution option model recharge, formulation yields of situation. sectional shown in figure Thus once, the recharge distribution user specifies recharge of an estimated finally the user condition recharge which in each vertical process stud:1 and clearly to the fails to system. 38-d illustrates from that which involving cells Under this by the use of no flow Figure problem cells This table. 1 above is utilized. to the top deciding a cross conductance active under in a given in which a stream uppermost at the water Figure before the model mesh has been progressively so that approximately 5 for problem above to utilize a hypothetical and seepage into to the simulation 38 shows a situation in Chapter simulation in its listed has been used to simulate from a stream, be given obtained had designated and thus receive water in the simulation as recharge no recharge. 7-4 table cells if cells option prior position, process. 2 is to the which differs Four of the have converted to an Figure turns this 38-e illustrates the Simulation out to be the one best option, column, recharge except streams. enters suited the where constant Thus, a continuous for under the third this uppermost head cells particular active situation of recharge of recharge to use. determining which the program automatically determines 1, however, can be useful in situations through no-flow in layer the designated The model user is the highest no-flow cells should cells because they not pass into be used in this situation the cells. impermeable least effort may be useful to the rater the table is layer. option 3 uses slightly for specified Other active cell this 1. factors 2. layer should data. memory than than options options 1 and 2. ! specified tha , will y, for still at result option 2 are IS and when through when choosing may be rat ! is zero Similar 1 have outcrop not penetrate to consider option Option not pass 3 could option recharge the of input should Any recharg the select co umn because some cell Of course that should time 3 is the simu ation. For example, layer 2 uses more computer more computer throughout are impermeable. than layers option in a vertical where recharge specification other from precipitation does not have to be conce ned about by specifying The user when layers to the to a lower are that in each vertical have been used to t-e Iresent distribution the easiest recharge Under . For the typical in the which situation. cell simulated. those option, no-flow th ! best cells option 1 an I 3, and option Recharge Package Input Input to the Recharge (RCH) Package is read from the unit in specified IUNIT(8). FOR EACH SIMULATION RCHlAL 1. Data: Format: NRCHOP 110 IR CHCB 110 FOR EACH STRESS PERIOD RCHlRP 2. Data: Format: INRECH 110 INIRCH 110 3. Data: Module: RECH(NCOL,NROW) U2DREL IF THE RECHARGEOPTION IS EQUAL TO 2 4. IRCH(NCOL,NROW) Data: Module : UZDINT Explanation Input of Fields Used in Instructions Recharge fluxes are defined in a twoNRCHOP--is the recharge option code. dimensional array, RECH, with one value for each vertical column. recharge is applied to one cell in each vertical column, Accordingly, and the option code determines which cell in the column is selected for recharge. l- Recharge 2- Vertical distribution array IR CH. 3- Recharge vertical recharge is only to the top grid of ‘recharge layer. is specified in is applied to the highest active cell in each A constant-head node intercepts column. and prevents deeper infiltration. 7-6 IRCHCB--is a flag and a unit number. If IRCHCB > 0, it If IRCHCB 2 0, cell-by-cell is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. flow terms will not be printed or recorded. INRECH--is the RECH read flag. If INRECH10, If INRECH < 0, recharge used. rates the IRCH read flag. When NRCHOPis two, If INIRCH 2 0, an array of layer If INIRCH < 0, the array INIRCH--is an array period Note: of recharge is (Lt-I). RECH, is from the preceding read. stress numbers (IRCH) is period read. (IRCH) used in the preceding stress reused. When NRCHOPis one or three, RECH--is the recharge flux or equal to zero. fluxes, INIRCH is ignored. Read only if INRECH is greater than IRCH--is the layer number array that defines the layer in each vertical Read only if NRCHOP is two and column where recharge is applied. if INIRCH is greater than or equal to zero. 7-7 are m *-I**** 00000* . . . ****** . . . NNNOmC-7 . . . . **.-I*** . . (YNNONc.3 . . . . *****#-I . . NCY**** -l*.-l*** Module Documentation The Recharge are called for Package (RCHl) consists by the MAIN program. RCHlAL Allocates the flux recharge modules, all of which are: recharge flow 2 is specified, (in (if flow option per unit rate the layer- area) and 2 is specified). recharge flux by cell recharge flow rate in which Calculates Package (IRCH). array Multiplies Subtract option array indicator RCHlBD if Reads recharge lator of four space to contain indicator RCHlFM Recharge lhe modules (RECH) and, RCHlRP the area. from the accumu- RHS is formulated. the rate into the and accumulated flow 7-9 system. volume of Narrative This areally for module allocates distributed Print 2. Read and print flow See if (not 1, 2, or 3), If NRCHOP is 5. If cell-by-cell number where they (ISUM) of the the array 7. for to If by the 9. legal, relating first first (NRCHOP) and the unit (NRCHOP) is legal. a message saying print flow to nunber the If NRCHOPis option is illegal. NRCHOP. terms are to be recorded, print the unit be recorded. space for element the recharge array (RECH). of RECH (LCRECH) equal unused element in the X array Space is allocated to the location and adding the size of ISUM. the recharge a layer-indicator 8. data STOP. will Allocate indicator option print storage. the to store (IRCHCR). recharge 4. by setting X array the package. the option terms the Do not allocate 6. space in,$the a message identifying cell-by-cell illegal Module RCHlAL recharge. 1. 3. for Calculate Recharge option array and print (NRCHOP) is equal to two, allocate space (IRCH). the number of elements Package. RETURN. 7-10 in the X array used Flow Chart NRCHOP is the 1 - Recharge recharge for Module RCHlAL option. is to the top layer. 2 - Recharge is to the layer specified by the user in the indicator array (IRCH). 3 - Recharge is to the uppermost active cell. IRCHCB is the unit number on which cell-by-cell flow terms for recharge will be written. RECH is an array which contains a recharge rate for each horizontal cell location. SHOWING OPTION IRCH is an array which contains the layer number to which recharge is applied for each horizontal location. It is used only if option 2 has been specified. ALLOCATE SPACE FORRECHARRAY PRINT AMOUNT OF SPACE USED BY THE RCH PACKAGE f-l 7-11 0 1 SUBROUTINE RCHlAL(ISUM,LENX,LCIRCH,LCRECH,NRCHOP, NCOLrNROW,INrIOUT,IRCHCB) 1559 12MAY1987 RCHlAL : -----VERSION ****************************************************************** C C ALLOCATE ARRAY STORAGE FOR RECHARGE **************************************~*************************** C n c” SPECIFICATIONS: E Cl---- IDENTIFY PACKAGE. WRITE(IOUT,l)IN 1 FORMAT(lHOr’RCH1 -- RECHARGEPACKAGE, VERSION 1, 9/l/87', 1' INPUT READ FROM UNIT',131 ~~------READ NRCHOPAND IRCHCB. READ(IN,Z)NRCHOP,IRCHCB 2 FORMAT(2110) TO SEE THAT OPTION IS LEGAL. c3 ------CHECK IF(NRCHOP.GE.l.AND.NRCHOP.LE.3)GO TO 200 C C3A--w-m IF ILLEGAL PRINT A MESSAGE AND ABORT SIMULATION WRITE(IOUT,8) 8 FORMAT(lX,‘ILLEGAL STOP OPTIONCODE. SIMULATION ABORTING’) C c4 ------IF OPTION IS LEGAL PRINTOPTIONCODE. 200 IRK=ISUM IF(NRCHOP.EQ.l)WRITE(IOUT,POl) 201 FORMATtlXr'OPTION 1 -- RECHARGETO TOP LAYER’) IF(NRCHOP.EQ.2) WRITE(IOUT,202) 202 FORMAT(lX,'OPTION 2 --.RECHARGE TO ONE SPECIFIED NODE IN EACH’, 1 ’ VERTICAL COLUMN’) IF(NRCHOP.EQ.3) WRITE(IOUT,203) 203 FORMAT(lX,‘OPTION 3 -- RECHARGETO HIGHEST ACTIVE NODE IN EACH’, 1 ’ VERTICAL COLUMN’) :5 ------IF CELL-BY-CELL FLOW TERMS TO BE SAVED THEN PRINT UNIT # IF(IRCHCB.GT.0)WRITE(IOUT,204)IRCHCB 204 FORMAT(lX,‘CELL-BY-CELL FLOW TERMS WILL BE RECORDEDON UNIT',131 & ------ALLOCATE SPACE FOR THE RECHARGEARRAYtRECH). LCRECH=ISUM C ISUM=ISUM+NCOL*NROW C7------ IF OPTION2 THEN ALLOCATE SPACE FOR INDICATOR ARRAYtIRCH) LCIRCH=ISUM IF(NRCHOP.NE.2)GO TO 300 ISUM=ISUM+NCOL*NROW :8 ------CALCULATE AND PRINT AMOUNT OF SPACE USED BY RECHARGE. 300 IRK=ISUM-IRK WRITE(IOUT,4)IRK 4 FORMAT(lX,IBr' ELEMENTS OF X ARRAY USED FOR RECHARGE’) ISUMl=ISUM-1 WRITE(IOUT,S)ISUMl,LENX 5 FORMAT(lX,IB,' ELEMENTS OF X ARRAY USED OUT OF’,181 IF(ISUMl.GT.LENX)WRITE(IOUT,6) 6 FORMAT(1X,' ***X ARRAY MUST BE MADE LARGER***‘) C c9 -----~J-(JRN RETURN END 7-12 List Variable of Variables for Definition Range IN Package IOUT I RCHCB Global Package IRK Module ISUM Global ISUMl LCIRCH Module Package Module RCHlAL Primary unit number from which input for this package will be read. Primary unit number for all printed output. IOUT = 6. Flag. IRCHCB -< 0, cell-by-cell flow terms will not be printed or recorded. IRCHCB > 0 and ICBCFL f 0, cell-by-cell flow terms for the RCHl Package will be recorded on UNIT = IRCHCB. Before this module allocates space, IRK is set equal to ISUM. After allocation, IRK is subtracted from ISUM to get the amount of space in the X array allocated by this module. Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. ISUM-1. Location in the X array of the first element of array of the first element of array IRCH. LCRECH Package Location in the X array RECH. LENX Global Length of the X array NCOL NRCHOP Global Package NROW Global in words. This should always be equal to the dimension of X specified in the MAIN program. Number of columns in the grid. Recharge option: = 1, recharge is to the top grid layer. = 2, recharge is to the grid layer specified in array IRCH. = 3, recharge is to the highest variable-head cell which is not below a constant-head cell. Number of rows in the grid. 7-13 Narrative This module areally distributed 1. 2. INRECH is period will effect. 4. stress zero, If represent indicate the last whether stress the data period #2re period. the in this INRECH is greater rate recharge flux (RECH) is coming recharge rate used in the stress period. Print last from. stress a message to that array Multiply the specified If the recharge If stress to that 7. period recharge option CALL UZDREL to read the flux rates by the cell will (NRCHOP) is not equal than zero, the data be used in this areas to get to two, a layer-indicator stress in IRCH left period. Print over from the a message GO TO STEP 8. INIRCH is greater than or equal IRCH array. 8. to zero, GO TO STEP 8. INIRCH is less effect. If or equal rate. is not needed. 6. than (RECH). volumetric-recharge 5. the which GO TO STEP 5. recharge last than be used again 3. the current INRECH to see where the less the terms RECH and IRCH used during the Test used to calculate INRECH and INIRCH which values in arrays to be used for Module RCHlRP recharge. Read the contained If reads data for RETURN. 7-14 to zero, CALL UZDINT to read Flow Chart for Module RCHlRP INRECH is a flag which, when set, indicates that recharge rates it (RECH) should be read for If the current stress period. is clear (< 0), recharge rates from the last stress period should be reused. INIRCH is a flag similar to INRECH used for the layer indicator array IRCH. 2A RECH is an array containing recharge rate for every horizontal cell location. a PRINT A MESSAGE. “REUSE RECH” - IRCH is an array containing a recharge indicator for each horizontal cell location. For each horizontal cell location, it indicates the layer number of the cell at that location which gets recharge. It is used only if the recharge option (NRCHOP) is equal to two. 3 CALL MODULE UPDREL TO READ RECH 4 MULTIPLY RR’;‘;;“;~’ CELL AREA I 7-15 CALL MODULE U2DINT to READ IRCH I SUBROUTINE RCHlRPt NRCHOP,IRCH,RECH,DELR, DELC, NROW,NCOL, IN,IOUT) 1 C C-----VERSION 1634 24JlJL1987 RCHlRP ****************+**********~*******~***********~************~~***** READ RECHARGERATES ************************************************************~~***** C C C a SPECIFICATIONS: --------------------____l__l____________----- : C CHARACTER*4 ANAK DIMENSION IRCH(NCOL,NROW),RECH(NCOL,NROW), ANAME(6rZ)rDELR(NCOL)rDELC(NROW) 1 C DATA ANAME~1,1~,ANAME~2,1~,ANAME~3,1~,ANAME~4,1~,ANAME~5,1~, ‘,‘RECH’r’ARGE’r’ LAY’r’ER I'r'NDEX'/ 1 ANAME(6rl)/' DATA ANAME(l,Z)rANAME(2,2),ANA~(3,2),ANAME(4r2)rANAME(5,2)r ‘,‘RECH’r’ARGE’/ 1,' 1,' ',' ------------------------------------------------------------,------ 1 ANAME(6,2)/' C C Cl---- READ FLAGS SHOWINGWHETHERDATA READ(IN,4)INRECH,INIRCH IS TO BE REUSED. 4 FORMAT(2110) C TEST INRECH TO SEE WHERE RECH IS COMING FROM. IF(INRECH.GE.O)GO TO 32 c2--- INRECHKO THEN REUSE RECHARGEARRAY FROM LAST STRESS PERIOD WRITE(IOUT,3) FORMAT(lHD,‘REUSING RECH FROM LAST STRESS PERIOD') GOTO55 :2A -----IF 3 a C c3------IF INRECH=>O THEN CALL U2DREL TO READ RECHARGERATE. U2DREL(RECH,ANAME(1,2)rNROW,NCOL,O,IN,IOUT~ C c4------MULTIPLY RECHARGERATE BY CELL AREA TO GET VOLUMETRIC RATE.. DO 50 IR=l,NROW DO50 IC=l,NCOL RECH(IC,IR)=RECH(IC,IR)*DELR(IC)+DELC(IR~ 50 CONTINUE 32 CALL :5 ------IF 55 IF NRCHOI-2 THEN A LAYER INDICATOR ARRAY IS NEEDED. (NRCHOP.NE.2)GO TO 60 C C&--- IF INIRCHCO THEN REUSE LAYER INDICATOR ARRAY. IF(INIRCH.GE.O)GO TO.58 WRITE(IOUT,2) 2 FORMAT(lHO,‘REUSING IRCH FROM LAST STRESS PERIOD’) GO TO 60 C C7-----IF 58 CALL INIRCH=>O CALL U2DINT TO READ LAYER IND ARRAYtIRCH) U2DINT(IRCH,ANAME(lrl)rNROW,NCOL,O,IN,IOUT~ C c8---EJ-URN 60 RETURN END 7-16 c List B Variable of Variables for Module RCHlRP Definition Range ANAME Module Label DELC Global DIMENSION (NROW), Cell dimension in the DELC(1) contains the width of row I. DELR Global DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column J. IC Module Index for IN Package Primary will INIRCH Module Flag. -> 0, IRCH array for < 0, INRECH Module l printout of the input array. column direction. columns. unit number from which be read. will will number for this package in memory from the last be used. be read. < 0, RECH array already stress period will unit for be read. IRCH array already stress period will Flag. -> 0, RECH array input all in memory from the be used. printed output. last IOUT Global Primary IOUT = 6. IR Module Index for IRCH Package DIMENSION (NCOL,NROW), Layer number for each horizontal cell location to which recharge will be applied if the recharge option (NRCHOP) is equal to 2. NCOL Global Number of columns NRCHOP Package Recharge option: = 1, recharge is = 2, recharge is array IRCH. = 3, recharge is which is not rows. in the grid. to the top grid layer. to the grid layer specified to the highest variable-head below a constant-head cell. NROW Global Number of rows in the RECH Package DIMENSION (NCOL,NROW), Recharge flow rate. flux is read into RECH and than multiplied area to obtain recharge flow rate. 7-17 in cell grid. Recharge by cell Narrative This module adds terms accumulators 1. If the top in which the for representing the terms recharge (a) If areally distributed option (NRCHOP) is equal location, to one, recharge DO STEPS (a) is externa 1 (IB~~ND(~,~,K) the cell recharge to the HCOF and RHS are formulated. For each horizontal layer. Module RCHlFM is to AND (b). 5 0), ignore it. SKIP STEP (b). (b) If 2. in the the recharge (a) Get the (b) If (c) Subtract If the the option array cell the recharge cell cell on to the (b) If the (c) Subtract next horizontal flow is three, RHS accumulator. is only to the cells specified is rate it. recharge array (IRCH). SKIP STEP (c). from the head, there cell no flow, recharge cell layer-indicator is RHS accumulator. in the uppermost internal location: horizontal the from the recharge ignore is constant cell rate from the is external, For each horizontal the is two, index option If flow (IRCH). layer Move on to the next 4. recharge recharge (a) it. the layer-indicator 3. cell. Subtract will location. RETURN 7-18 below and go back to (a). location. move down a cell flow be no recharge rate from the RHS accumulator. Move Flow Chart for Module RCHlFM RHS is the right hand side of the finite-difference It includes all equation. terms that are independent of head at the end of the time step. (2 ENTER RCHIFM IRCH is an array which contains the layer number to which recharge is applied for each horizontal location. It is used only if option 2 has been specified. NRCHOPis the 1 - Recharge layer. recharge option. is to the top r 2A 2 - Recharge is to the layer specified by the user in the indicator array GET LAYER FROM THE INDEX IRCH L3 & (IRCH). 3 - Recharge is to the uppermost active cell. R EACH LAYER 7-19 SUBROUTINE RCHlFM(NRCHOP,IRCHrRECH,RHS,IBOUND,NCOLr NRW,NLAY) 1 C RCHlFM C-----VERSION 1404 12MAY1987 C **********t***********************~*******************~~~**~~***** C SUBTRACT RECHARGEFROM RFS ******************+*******************~*************************** C C C SPECIFICATIONS: ” DIMENSION IRCH(NCOLrNRW),RECH(NCDL,NRW)r RHS(NCOLrNRW,NLAY)rIBOUND(NCOL,NRW,NLAY) 1 E Cl---- IF NRCHOP IS 1 RECHARGEIS IN TOP LAYER. LAYER INDEX IS 1. IF(NRCHOP.NE.l)GOTO 15 C DO 10 IR=lrNRCM DO 10 IC=l,NCOL C Cl&---- IF CELL IS EXTERNAL THERE IS NO RECHARGEINTO IT. IF(IBWND(IC,IR,l).LE.O)GO TO 10 C ClB----- SUBTRACT RECHARGE RATE FROM RIGHT-HAND-SIDE. RH.S(IC,IR,1)=RHS(IC,IR,1)-RECH(IC,IR) 10 CONTINUE GO TO 100 C c2---IF OPTION IS 2 THEN RECHARGEIS INTO LAYER IN INDICATOR ARRAY C 15 IF(NRCHOP.NE.P)GO TO 25 DO 20 IR=l,NRW DO 20 IC=lrNCOL i-3’+---- LAYER INDEXIS IN INDICATOR ARRAY. IL=IRCH(IC,IR) C C2&---- IF THE CELL IS EXTERNAL THERE IS NO RECHARGEINTO IT. IF(IBOUND(IC,IR,IL).LE.O)GOTO 20 C QC---- SUBTRACT RECHARGEFROM RIGHT-HAND-SIDE. RHS(IC,IR,IL)=RHS(IC,IR,IL)-RECH(IC,IR) 20 CONTINUE GO TO 100 C C3------ IF OPTIONIS 3 RECHARGEIS INTOHIGHESTINTERNAL CELL. 25 IF(NRCHOP.NE.3)GO TO 100 CANNOT PASS TliRCUGH CONSTANT HEAD NODE C DO 30 IR=lrNRW DO 30 IC=lrNCOL DO 28 IL=lrNLAY C C3A----- IF CELL IS CONSTANT HEAD MOVE ON TO NEXT HORIZONTAL LOCATION. IF(IBWND(IC,IR,IL) .LT.O) GO TO 30 C c35---- IF CELL IS INACTIVEMOVE DOWNA LAYER. IF (IBOUND(IC~IR,IL).EQ,O)GO TO 28 C C3C----- SUBTRACT RECHARGE FROM RIGHT-HAND-SIDE. RHS(IC,IR,IL)=RHS(IC,IR,IL)-RECH(IC,IR) GO TO 30 28 CONTINUE 30 CONTINUE 100 CONTINUE C c4------RETURN RETURN END 7-20 List D Variable of Variables for Module RCHlFM Definition Range I BOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index for columns. IL Module Index for layers. IOUT Global Primary IR Module Index for IRCH Package DIMENSION (NCOL,NROW), Layer number for each horizontal cell location to which recharge will be applied if the recharge option (NRCHOP) is equal to 2. NCOL Global Number of columns NLAY Global Number of layers NRCHOP Package Recharge option: = 1, recharge = 2, recharge IR CH. = 3, recharge which is unit number for all of each cell. printed output. IOUT = 6. rows. in the grid. in the grid. is to the top grid layer. is to the grid layer specified is to the highest variable-head not below a constant-head cell. in array cell NROW Global Number of rows in the RECH Package DIMENSION (NCOL,NROW), Recharge RHS Global DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. 7-21 grid. flow rate. Narrative This areally module calculates distributed 1. Clear 2. If in which If 3. Process the the rates Module RCHlBD and volumes added to the aquifer by recharge. the rate accumulators cell-by-cell they for will the flow RATIN and RATOUT. terms will be saved, clear the buffer (BUFF) be accumulated. recharge horizontal option is locations cell one, the recharge goes into the top layer. one at a time. (a) If the is external, (b) If cell-by-cell flow (c) If the is do not calculate terms will be saved, budget. add recharge to buffer. recharge positive, add it to RATIN; otherwise, add it to RATOUT. 4. If in indicator the the array recharge (IRCH). cell option is two, Process (a) Get the (b) If the (c) If cell-by-cell flow (d) If the is cell layer the recharge goes into horizontal locations from indicator is external, array do not calculate terms will be saved, the layer specified one at a time. (IRCH). budget. add the recharge to buffer. recharge positive, to RATOUT. 7-22 add it to RATIN; otherwise, add it If 5. the variable-head Process recharge cell option provided the horizontal is three, there the recharge goes into is not a constant-head locations one at a time. Start cell with the top above it. the top cell and work down. (a) If move down to the (b) horizontal the cell next If is there is no recharge into that is constant, there is no recharge at this cell; one. the cell location; inactive, move on to the next horizontal (c) If cell-by-cell flow terms (d) If the recharge is positive, cell-by-cell flow location. are to be saved, add the recharge to the buffer. add it to RATIN; otherwise, add it to RATOUT. 6. write If the buffer terms be saved, call module UBUDSV to the VBVL array for printing length to the (BUFF) onto disk. 7. Move RATIN and RATOUT into 8. Add RATOUT multiplied accumulators will in VBVL for 9. Move the 10. Increment 11. RETURN. printing recharge the by the time-step volume by BASIOT. budget-term budget-term by BASlOT. labels counter 7-23 to VBNM for (MSUM). printing by BASlOT. Flow Chart RATIN is an accumulator which all flows into aquifer are added. for Module RCHlBD to the ENTER RCHIED 182 52 RATOUT is an accumulator to which all flows out of the aquifer are added. BUFFER is an array in which values are stored as they are being gathered for printing or recording. NRCHOP is the option. 1 - Recharge CLEAR RATIN AN;WTFUT NEEDED, SUFFER FOR EACH HORIZONTAL CELL LOCATION 3E:.3C ,1 ADD RECHARGE 10 RATIN OR RATOUT STORE RECHAROE IN BUFFER recharge is to the top layer. FOR EACH HORIZONTAL 4C ,4D 2 - Recharge is to the layer specified by the user in the indicator array (IRCH). 3 - Recharge uppermost cell. is to the active FOR EACH HORIZONTAL CELL LOCATION FOR EACH LAYER I IRCH is an array containing a recharge indicator for each horizontal It is used only cell. if the recharge option (NRCHOP) is equal to two. RATlN OR RATOU’I STORE RECHARGE VBVL is a table of budget entries calculated by component-of-flow packages for use in calculating the volumetric budget. VBNM is a table of labels for budget terms. MOVE RATIN AND RATOUT TO “BVL AND LABELS TO “BNM EXTERNAL: a cell is external if it is either no flow (inactive) or constant head. 7-24 I SUBROUTINE RCH~BD(NRCHOPIIRCH,RECH,IBOUNDINROWINCOL~NLAYI DELT,VBVL~VBNM,MSUM,KSTPIKPERIIRCHCBIICBCFL,BUFFIIOUT) 1 -----VERSION 1602 12MAY1987 RCHlBD ****************************************************************** : CALCULATE VOLUM3RIC BUDGET FOR RECHARGE : C ****************************************************************** : SPECIFICATIONS: ----_------------------------------------------------------------- C C C Cl--- CHARACTER*4 VBNM,TEXT DIMENSION IRCH(NCOLrNROW)rRECH(NCOLrNROW)r 1 IBOL~ND(NCOL,NROW,NLAY)~BUFF(NCOLINROWINLAY)~ 2 VBVL(4rZO)rVBNM(4,20) DIMENSION TEXT(4) ‘,‘RECH’r’ARGE’/ DATA TEXT(l),TEXT(Z)rrr~CT(3)rTEXT(4) /’ ‘,’ -----_-“_--__-------____________________--------------------------CLEAR THE RATE ACCUMULATORS. RATIN=O. RATOUT=O. C c2--- IF CELL-BY-CELL FLOW TERMS WILL BE SAVED THEN CLEAR THE BUFFER. IBD=O IF(ICBCFL.EQ.0 .OR. IRCHCB.LE.0)GOTO 5 IBD=l DO2 IL=l,NLAY DO 2 IR=lrNRW DO2 Ic=l,NcOL BUFF(IC,IR,IL)=O. 2 CONTINUE :3 ------IF NRCHOP=l RECH GOES INTO LAYER 1. PROCESS EACH HORIZONTAL c3 ------CELL LOCATION. 5 IF(NRCHOP.NE.l) GO TO 15 C ---RECHARGE IS APPLIED TO TOP LAYER C DO 10 IR=lrNRW DO10 Ic=lrNcOL CELL IS EXTERNAL THEN DO NOT DO BUDGET FOR IT. IF(IBOUND(IC,IR,l).LE.O)GO TO 10 Q=RECH(IC,IR) :3A -----IF :3E+ ----IF CELL-BY-CELL FLOW TERMS WILL BE SAVED THEN ADD RECH TO BUFF IF(IBD.EQ.l) BUFF(IC,IR,l)=Q C (-J3C----- IF RECH POSITIVEADD IT TO RATIN ELSE ADD IT TO RATOUT. IF(Q) 8r10,7 7 RATIN=RATIN+Q GO TO 10 8 RATOUT=RATOUT-Q 10 CONTINUE GO TO 100 C c4------IF NRCHOP=Z RECH IS IN LAYER SHOWNIN INDICATOR ARRAYtIRCH). c4------PROCESS HORIZONTAL CELL LOCATIONS ONE AT A TIRE. 15 IF(NRCHOP.NE.P)GO TO 25 DO 20 IR=l,NRW DO 20 IC=l,NCOL C ()$A--- GETLAYER INDEXFROM INDICATOR ARRAYtIRCH). IL=IRCH(IC,IR) C cJ&--- IF CELL IS EXTERNAL DO NOT CALCULATE BUDGET FOR IT. IF(IBOUND(IC,IR,IL) .LE.O)GO TO 20 7-25 Q=RECH(ICI IR) C (-JjC---- IF C-8-C FLOW TERM WILL BE SAVED THEN ADD RECHARGETO BUFFER. BUFF(IC,IR,IL)=Q IF(IBD.EQ.l) ti4D-----IF RECHARGEIS POSITIVEADD TO RATINELSE ADD IT TO RATOUT. IF(Q) 18rZOr17 17 RATIN=RATIN+Q GOTO 20 18 RATOUT=RATOUT-Q 20 CONTINUE GO TO 100 C C5------ IF OPTION=3 RECHARGEIS INTO HIGHEST INTERNAL CELL. IT WILL NOT C5------ PASS THROUGHA CONSTANT HEAD CELL. PROCESS HORIZONTAL CELL ONE AT A TIRE. c5 ------LOCATIONS 25 IF(NRCHOP.NE.3)GO TO 100 DO 30 IR=lrNRCW DO 30 IC=l,NCOL DO &A 28 IL=l,NLAY -----IF CELL IS CONSTANT HEAD MOVE ON TO NEXT HORIZONTAL LOCATION. IF(IBOUND(IC,IR,IL).LT.O) GOTO 30 ----IF CELL IS INACTIVEMOVE DOWNTO NEXT CELL. (IBOLIND(IC,IR,IL).EQ.O)GO TO 28 Q=RECH(IC,IR) IF -----IF C-&C FLOW TEFU.6 TO BE SAVED THEN ADD RECHARGETO BUFFER. IF(IBD.EQ.l) BUFF(IC,IR,IL)=Q h &D -----IF RECH IS POSITIVE ADD IT TO RATIN ELSE ADD IT TO RATOUT. IF(Q) 27r30r26 26 RATIN=RATIN+Q GO TO 30 27 RATOUT=RATOUT-Q GO TO 30 28 CONTINUE 30 CONTINUE C 100 CONTINUE C C-B-C c6 ------IF C FLOW TERMS TO BE SAVED CALL UBUDSV TO WRITE THEM. IF(IBD.EQ.l) CALL UBUDSV(KSTP,KPER,TEXT,IRCHCB,BUFFrNCOL,NRCWr 1 NLAY, IOUT) C7------ MOVE TOTAL RECHARGERATE VBVL(4rMSUM)=RATOUT VBVL(3rMSUM)=RATIN INTO VBVL FOR PRINTINGBY BASlOT. RECHARGEFOR TIRE STEP TO RECHARGEACCUMULATORIN VBVL. ii3 ------ADD VBVL(P,MSUM)=VBVL(2rMSUM)+RATOUT*DELT VBVL(lrMSUM)=VBVL(l,MSUM)+RATIN*DELT C BUDGET TERM LABELS TO VBNM FOR PRINT BY MODULE BAS-OT. c9 ------MOVE VBNM(l,MSUM)=TEXT(l) VBNM(P,MSUM)=TEXT(Z) VBNM(3rMSUM)=TEXT(3) VBNM(4rMSUM)=TEXT(4) C Cl&--- INCREMENT BUDGET TERM COUNTER. MSUM=MSUM+l El1 -----RETURN RETURN END 7-26 List Variable of Variables for Module RCHlBD Definition Range BUFF Global DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DELT Global Length IBD Module Flag. = 0, cell-by-cell flow not be recorded. f 0, cell-by-cell flow be recorded. IBOUND Global of the current time terms for this package will terms for this package will DIMENSION (NC~L,NROW,NLAY), Status < 0, constant-head = 0, inactive cell > 0, variable-head l step. IC Module Index for I CBCFL Global Flag. = 0, cell-by-cell or printed z 0, cell-by-cell the current of each cell. cell cell columns. flow terms will not be recorded the current time step. flow terms will be recorded for time step. for IL Module Index IOUT Global Primary IR Module Index IRCH Package DIMENSION (NCOL,NROW), Layer number for each horizontal cell location to which recharge will be applied if the recharge option (NRCHOP) is equal to 2. IRCHCB Package Flag. IRCHCB 5 0, cell-by-cell flow terms recorded or printed. for layers. unit for number for all printed output. rows. IRCHCB > 0 and ICBCFL f 0, cell-by-cell for the RCHl Package will on UNIT = IRCHCB. B IOUT = 6. KPER Global Stress period KSTP Global Time step period. MSUM Global Counter NCOL Global Number of columns for will not be flow terms be recorded counter. counter. budget 7-27 Reset entries in the at the start and labels grid. of each stress in VBVL and VBNM. List of Variables for Module RCHlBD (Continued) Variable Range Definition NLAY Global Number of layers NRCHOP Package Recharge option: = 1, recharge is = 2, recharge is array IRCH. = 3, recharge is which is not in the grid. to the top grid layer. to the grid layer specified to the highest variable-helad below a constant-head cell. NROW Global Number of rows in the Q Module Flow from recharge into a cell. get flow out of the cell.) RATIN Module Accumulator recharge. for the total flow into RATOUT Module Accumulator for to recharge. the total flow out of the RECH Package DIMENSION (NCOL,NROW), Recharge flow rate. TEXT Module Label with the VBNM Global DIMENSION(4,20), to be printed in cell grid. (Reverse or recorded Labels for entries the the flow sign field flow field array data. in the to from volumetric budget. VBVL Global DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (2,N), Rate for the current time step out 07 the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. 7-28 CHAPTER8 WELL PACKAGE Conceptualization The Well Package is designed which withdraw rate the during cell wells, water from the a given stress area and the developed on the either from it, for well beginning stress formulated, well in the rate to it) is at a specified independent The discussion in this to be simulated of both section is are actually Well Package by specifying adds water period to the aquifer of the simulation. discharge, while of each stress each well--the that one well where the the features well each stress the we11 is located, (equation (or add water such as wells the or removes water Negative positive rate, values values of Q of Q indicate a well. At the during features or recharging. is handled are used to indicate values that each individual recharging aquifer head in the cell. discharging during to simulate period, assumption Well discharge Q, at which and Implementation period. falls within as the RHS term for a single for the discharge associated summed within the program or recharge each well the cell cell, that the calculation cell is assembled. with each individual the total well, four in which Q, of the well as the matrix containing 8-1 rate, is subtracted that to obtain WELlRP module'reads number of the cell At each iteration, of Q for or (29)) the row, column and layer and the d ischarge the value (26) period, equations are from the RHS value well. is Where more than repeated Thus the user and these discharge for each specifies are in effect from the cell. The Well wells which well of this Package, as it are open to more than type an individual approach is used, or apportioned model program. discharge layers stress period, transmissivity of all equation (68), be implemented well, and for This of single between penetrated or some other by the user each stress externally to the cular in that well stress the Again, i .e. in a given period, Tl is the sum of the transmissivities it's important the to the program for to note that discharge, must each multi-layer period. a multi-layer wells, fails various layers provided to take into by the well well account well effects 8-2 is represented the itself, A package which problem. of multi-layer externally (68) method of apportioning in which of the ties 1 to a parti by the well. If this must be divided layers, transmissivi QI TI -- = -Qw XT 1 and ET represents and each is to div ide the well this discharge layer approximation individual a wells, period. well layer from layer Qw is the well approach, representation of the multi-layer to the However, well, each stress A common method of doing of layer layers for in some way among the where Ql is the discharge of the model. by the multi-layer Q term specified in proportion does not accommodate as a group of single-layer tapped the discharge formulated, one layer can be represented each open to one of the having is presently as a gr,oup interconnection and is thus will provide is under development. an inclomplete an improved Well Input IUNIT(2). for the Well Packaae Inout (WEL) Package is read from the unit specified in FOR EACH SIMULATION WELlAL 1. Data: Format: MXWELL IWELCB 110 110 FOR EACH STRESS PERIOD WELlRP 2. Data: Format: ITMP 110 3. Data: Format: Layer Row Column Q 110 110 110 F1O.O (Input item 3 normally consists of one record for If ITMP is negative or zero, item 3 is not read.) Explanation Input of Fields Used in Instructions MXWELL--is the maximum number of wells IWELCB--is a flag ITMP--is used at any time. number. If IWELCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. If IWELCB = 0, cell-by-cell If IWELCB < 0, well a flag flow recharge will terms will Column--is the from the last period ITMP -> 0, ITMP will be the number of wells current stress period. layer data stress If Row--is whenever or recorded. ICBCFL is set. and a counter. ITMP < 0, well the not be printed be printed If Layer--is --is and a unit each well. number of the model cell row number of the model cell that the column number of the model cell A positive the volumetric recharge rate. and a negative value indicates discharge. 8-3 that will active contains contains that value be reused. during the the well. the well. contains indicates the well. recharge . i 8-4 Module Documentation The Well Package (WELl) by the MAIN program. consists The modules WELlAL Allocates WELlRP Reads location rate) the Package modules, all of which are called are: the list and Q value all of wells (WELL). (discharge or recharge wells. Q is entered discharge Well of four space for for Note: for as a negative and as a positive number for number for well well recharge. WELlFM WELlBD Subtracts Q values from the term containing pumping wells. Calculates the recharge rates and accumulated to or discharge by pumping wells. 8-5 RHS for from the flow each cell volume of system Narrative This module allocates The X array tables, lists, 1. cell-by-cell list flow unallocated 4. equal should in the the each cell--row, Print 5. the list of wells. space is allocated the package and initialize for NWELLS (a maximum number of wells) flow terms or a flag and IWELBD indicating that be printed). will point to ISUM, which Calculate the MXWELL (the cell-by-cell terms element for to store number of wells). Set LCWELL, which (WELL), values the number for 3. X array of memory space from which Read and print unit space in the a message identifying containing 2. Module WELlAL and arrays. Print counter (the is a pool for to the first is currently element pointing in the well to the first X array. amount of space needed for column, layer, number of elements the well and rate) in the list and add it X array (four to ISUM. used by the Well Package. If 6. (ISUM) is warning the greater that 7. pointer the than X array to the lowest the length will unallocated of the X array have to be enlarged. RETURN. 8-8 element (LENX), in the X array print a message Flow Chart for Module WELlAL MXWELL is the maximum number of wells that will be active at any one time during the simulation. IWELCB is a flag number. and a unit If IWELCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. IDENTIFYING If IWELCB = 0, cell-by-cell flow terms will not be printed or recorded. 2 READ MXWELL AND IWELCB If IWELCB < 0, well recharge will be printed whenever ICBCFL is set. LCWELL is a location pointer the first storage location occupied by the well list. to SET LCWELL EOUAL TO ISUM ISUM is the location of the lowest unallocated storage location in the X array. ADD THE AMOUNT OF SPACE NEEDED FOR WELLS TO ISUM X array is the pool of memory space allocated for storing specific tables, arrays, and lists. LENX is the size of the X array. PRINT MESSAGES SHOWING HOW MUCH OF THE X ARRAY HAS BEEN ALLOCATED IF ISUM IS LARGER THAN LENX, PRINT A WARNING MESSAGE 8-7 SUBROUTINE WELlAL (ISUM,LENX, LCWELL,MXWELL,NWELLS,IN, IWELCB) 1 IOUT, C C-----VERSION 1538 12MAY1987 WELlAL C C C ********************~*****************************~**********~~**** ALLOCATE ARRAY STORAGE FOR WELL PACKAGE *******~******************************************~*****~****~~~*** : C C C Cl---- SPECIFICATIONS: --------------------------------------------------------------,-----------------------------------------------------------------,---- IDENTIFY PACKAGE AND. INITIALIZE NWELLS WRITE(IOUT,l)IN 1 FORMAT(lHO,‘WELl -- WELL PACKAGE, VERSION1, 9/l/87', 1' INPUT READ FROM',131 NWELLS=O C c2--(32--- READ MAX NUlvBER OF WELLS AND UNIT OR FLAG FOR CELL-BY-CELL FLOW TERMS. READtIN, MXWELL,IWELCB 2 FORMAT(2110) WRITE(IOUT,31 MXWELL 3 FORMAT(lH r ‘MAXIMUM OF’ rI5,’ WELLS’ 1 IF(IWELCB.GT.0) WRITE(IOUT,9) IWELCB 9 FORMATtlX, ‘CELL-BY-CELL FLOWS WILL BE RECORDEDON UNIT' ,131 IF(IWELCB.LT.0) WRITE(IOUTt8) 8 FORMAT(lX,‘CELL-BY-CELL :3 ------SET FLOWS WILL BE PRINTED WHEN ICBCFL NOT 0’) LCWELL EQUAL TO LOCATION OF WELL LIST IN X ARRAY. LCWELL=ISUM C c4 ------ADD AMOUNTOF SPACE USED BY WELL LIST TO ISUM. ISP=4*MXWELL IsuM=IsuM+IsP :5 ------PRINT NUM3ER OF SPACES IN X ARRAY USED BY WELL PACKAGE. WRITE(IOUT,4) ISP 4 FORMATtlX, 18,' ELEMENTS IN X ARRAY ARE USED FOR WELLS’ 1 ISUMl=ISUM-1 WRITE(IOUT,S) ISUMl,LENX 5 FORMAT(lX,I8,' ELEMENTS OF X ARRAY USED OUT OF’,181 C (3-w-- IF THERE ISN’T ENOUGHSPACE IN THE X ARRAY THEN PRINT WARNING MESSAGE. c6 ------A IF(ISUMl.GT.LENX) WRITE(IOUT,6) ***X ARRAY MUST BE DIMENSIONED LARGER***‘) 6 FORMATt1X, ’ C7------RETURN RETURN END 8-8 List Variable of Variables for Module WELlAL Definition Range IN Package Primary will unit number from which be read. I OUT Global Primary unit ISP Module Number of words in the I SUM Global Index number of the lowest ISUMl Module ISUM-1. I WELCB Package Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, well recharge will be printed whenever ICBCFL is set. LCWELL Package Location in the WELL. LENX Global Length of the X array in words. This should alwaysbe equal to the dimension of X specified in the MAIN program. MXWELL Package Maximum number of wells NWELLS Package Number of wells number for all input printed X array for this IOUT = 6. output. allocated package by this module. element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. X array active 8-9 of the first active during element of array at any one time. the current stress period. Narrative This 1. If the than the less than be reused. If number of wells If ITMP is will (b) greater the WELL list. Read ITMP. period 2. Module WELlRP module reads data to build (a) stress for ITMP is zero, Print greater the well a message to that than or equal read for effect to zero, (NWELLS) in the current number of wells (NWELLS) in the number specified data stress it the last and RETURN. is equal to the period. current as the maximum for the stress period simulation is (MXWELL), STOP. 3. Print 4. If bypass 5. recharge 6. the there further well number of wells are no wells in the in the current current stress stress period period (NWELLS). (NWELLS), processing. For each well, read and print the rate. RETURN. 8-10 layer, row, column, and well Flow Chart for Module WELlRP ITMP is a flag and/or the number of wells. If it is less than zero, it is a flag which indicates that the well data from the last stress period will be reused. If it is greater than or equal to zero, it is the number of wells active during the current stress period. NWELLS is the number of wells active during the current stress period. MXWELL is the maximum number of wells which will be active at any one time during the simulation. FOR EACH WELL 5 I 8-l 1 a SUBROUTINE WELlRP(WELL,NWELLS,MXWELL,IN,IOUT) C C C-----VERSION 1544 22DEC1982WELlRF’ *************************~************************************~~*** C READ NEW WELL LOCATIONS AND STRESS RATES C **********************~***************************************~~*** C C SPECIFICATIONS: C ” DIMENSIONWELL(4,MXWELL) --------------------------------------------------------------.---- C C Cl--- READ ITMPfNUMBER OF WELLS OR FLAG SAYING REUSE WELL DATA) READ(IN,11 ITMP 1 FORMATtIlO) IF(ITMP.GE.0) GO TO 50 C ClA--- IF ITMP LESS THAN ZERO REUSE DATA. PRINT MESSAGE AND RETURN. WRITE(IOUT,6) 6 FORMAT(lHO,'REUSING WELLS FROM LAST STRESS PERIOD’) RETURN n Zilb ----ITMP=>O. SET NWELLS EQUAL TO ITMP. 50 NWELLS=ITMP IF(NWELLS.LE.MXWELL) GO TO 100 C c2--- NWELLS>MXWELL. PRINT MESSAGE. STOP. WRITE(IOLJT,991NWELLSIMXWELL 99 FORMAT(lHO,'NWELLS('rI4,'1 IS GREATER THAN MXWELL(‘rI4,‘)‘) STOP C NUMBER OF WELLS IN CURRENT STRESS PERIOD. c3 ------PRINT NWELLS 100 WRITE (IOUT, 2 FORMAT(lHO,lOX,I4,' WELLS’) C c4 ------IF THERE ARE NO ACTIVE WELLS IN THIS STRESS PERIOD THEN RETURN IF(NWELLS.EQ.0) GO TO 260 C C5-----READ AND PRINT LAYER,ROW,COLUMN AND RECHARGE RATE. a WRITE(IOUT,3) 3 FORMATf1H ,47X, ‘LAYER 1,48X,45(‘-‘)) DO 250 II=lrNWELLS READ (IN,41 K,I,J,Q ROW COL STRESS RATE WELL NO. ‘I’ 4 FORMAT(3110,FlO.O) WRITE (IOUT, K,I,J,Q,II 5 FORMAT(48X,I3,18,17,G16.5,18) WELL(lrII)=K WELL(2,111=1 WELL(3rII)=J WELL(4rII)=Q 250 CONTINUE C c6 ------RETURN 260 RETURN END a 8-12 List Variable of Variables for Module WELlRP Definition Range I Module Row number of cell II . Module Index IN Package Primary will unit number from which be read. I OUT Global Primary unit ITMP Module Flag or number of wells. > 0, number of wells active during the current stress period. < 0, same wells active during the last stress will be active during the current stress for containing well. wells. number for all input printed this output. package IOUT = 6. 3 Module Column number of cell K Module Layer MXWELL Package Maximum number of wells NWELLS Package Number of wells the current stress 9 Module Rate at which the well adds water (negative for discharging well). to the aquifer WELL Package DIMENSION (4,MXWELL), For each well: and recharge rate of the well. number of cell active 8-13 containing for containing active during period period. well. well. at any one time. layer, period. row, column, Narrative This in which 1. period, module adds terms If NWELLS is less are no wells. For each well (a) 5 0), representing well recharge to the accumulator If (b) If the cell the cell of 0 from the accumulator than or equal to zero in the current stress RETURN. in the WELL list: bypass processing 3. Module WELlFM the term RHS is formulated. there 2. for containing on this the well well containing RHS for and go on to the the well that RETURN. 8-14 is external cell. is active, (IBOUND (IC,IR,IL) next well. subtract the value B 1 SUBROUTINE WELlFMt NWELLS,MXWELL,RHS, WELL, IBOUND, NCOL,NRw,NLAY) C C-----VERSION : C C C 1233 12MAY1987 WELlFM ***********************************************************~****** SUBTRACT Q FROM RHS ****************************************************************** SPECIFICATIONS: -----------------------------------------------------------------DIMENSION FtiS(NCOL,NROW,NLAY)rWELL(4,MXWELL), 1 IBCXJND(NCOL,NROW,NLAY) El ------IF NUlrlBER OF WELLS <= 0 THEN RETURN. IF(MJELLS.LE.0) RETURN l :2 ------PROCESS EACH WELL IN THE WELL LIST. DO 100 L=lrNWELLS IR=WELL(2rL) IC=WELL(3rL) IL=WELL(l,L) G=WELL(4rL) C C2A---IF THE CELL IS INACTIVE THEN BYPASS PROCESSING. IF(IBOUND(IC, IR,IL) .LE.O) GO TO 100 :2E+ ----IF THE CELL IS VARIABLE HEAD THEN SUBTRACTQ FROM C THE RHS ACCUMULATOR. RHStIC, IR, IL)=f?HS(IC, IR, IL14 100 CONTINUE C C3------RETURN RETURN END 8-15 List Variable of Variables for Module WELlFM Definition Range IB OUND Global DIMENSION (Nc~L,NROW,NLAY), < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index for columns. IL Module Index for layers. IOUT Global Primary IR Module Index for rows. L Module Index wells. MXWELL Package Maximum number of wells NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the NWELLS Package Number of wells current stress Q Module Rate at which the well adds water to the (negative for discharging wells). aquifer RHS Global DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. WELL Package DIMENSION (4,MXWELL), For each well: and recharge rate of the well. unit for number for all in the 8-18 of printed active in the active Status each cell, output. IOlJT = 6. at any one time. grid. grid. grid. during the layer, row, period. column, Narrative This module calculates aquifer and wells. which 1. Clear indicates 2. If for rates Module WELlBD and volumes transferred between the the rate accumulators RATIN and RATOUT and the flag (IBD) that cell-by-cell flow terms should be recorded on a disk. there are no wells, skip down to step 7. flow terms for wells will be written 3. Determine if the cell-by-cell on a disk. They will be if (1) this is the proper time step (ICBCFL is not equal to zero), (2) if the channel for well-budget terms (IWELCB) is greater than zero, and (3) if the number of wells (NWELLS) is greater than zero. the on a disk, 4. If budget terms are to be written buffer (BUFF) in which they will be accumulated. 5. not equal set If the number of wells in the current stress period to zero, then for each cell in the well list: (a) bypass further If the cell processing containing the well of the cell. is external (b) If the user has requested that cell-by-cell (IWELCB < 0 and ICBCFL + 0), print the rate (0). rate (c) If the budget terms (Q) to the buffer (BUFF). If Q is positive, add it to RATIN. (e) If Q is negative, add it to RATOUT. rates Move RATIN and RATOUT into the VBVL array for Move the well budget 10. Increment budget-term 11. RETURN. the term labels counter 8-17 to VBNM for printing (MSUM). length printing 2 0), be printed add the flow flow terms are to be recorded, call of buffer (BUFF) onto the disk. 8. Add RATIN and RATOUT multiplied by the time-step accumulators in the VBVL array for printing by BASlOT. 9. (NWELLS) is (IBOUND(I,J,K) are to be saved on a disk, (d) If the cell-by-cell 6. UBUDSV to write the contents 7. IBD = 1 and clear module by BASlOT. to the volume by BASlOT. Flow Chart for Module WELl BD RATIN is an accumulator to which all flows into the aquifer are added. RATOUT is an accumulator to which all flows out of the aquifer are added. IBD is a flag which, if set, causes cell-by-cell flow terms for well flow to be recorded. BUFFER is an array in which values are stored as they are being gathered for printing or recording. EXTERNAL: a cell is said to be external if it is either no flow or constant head (i.e., an equation is not formulated for the cell). Q is the rate at which the well recharges the aquifer. A discharging well is represented by a negative rate. IWELCB is a flag and a unit number. If IWELCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell be printed or recorded. If IWELCB flow terms will not If IWELCB < 0, well recharge rate will be printed whenever ICBCFL is set. ICBCFL is a flag. If ICBCFL # 0, cell-by-cell flow terms will be either printed or recorded (depending on IWELCB) for the current time step. MOVE LABELS FOR BUDGET 8-18 1 SUBROUTINE WELlBD( NWELLS,MXWELL,VBNM,VBVL, MSUM,WELL, IBOUND, DELT, NCOL,NROW,NLAY,KSTP, KPER, IWELCB, ICBCFL,BUFF, IOUT) C C-----VERSION 1509 12MAY1987 WELlBD ******************************************~*************~********* CALCULATE VOLUMETRIC BUDGET FOR WELLS ~******~***~**********~*~*******~**~*~~*~********~*****~****~***** C C C C C SPECIFICATIONS: ----------_------------------------------------------------------- C CHARACTER*4 VBNM,TEXT DIMENSION VBNM(4,MSUM),VBVL(4,MSUM),WELL(4,MXWELL), 1 IBOUND(NCOL,NROW,NLAY)rBUFF(NCOL,NROW,NLAY~ DIMENSION TEXT(4) C DATA TEXT(l)rTEXT(2)rTE>CT(3)rTE>CT(4) /’ -----------------------------------------------------------------C C Cl ------CLEAR RATIN AND RATOUT ACCUMULATORS. ‘,’ ‘,’ W’r’ELLS’/ RATIN=O. RATOUT=O. C IBD=O c2---- l IF THERE ARE NO WELLS DO NOT ACCUMULATEFLOW IF(NWELLS.EQ.0) GO TO 200 C c3------TEST TO SEE IF CELL-BY-CELL FLOW TERMS WILL BE IF(ICBCFL.EQ.0.OR. IWELCB.LE.0)GOTO 60 C c4 ------IF CELL-BY-CELL FLOWS WILL BE SAVED THEN CLEAR THE BUFFER. IBD=l DO50 IL=l,NLAY DO50 IR=l,NROW DO 50 IC=l,NCOL BUFF(IC,IR,IL)=O. 50 CONTINUE :5 ------PROCESS WELLS ONE AT A TIME. 60 DO 100 L=l,NWELLS IR=WELL(2,L) IC=WELL(3rL) IL=WELL(lrL) Q=WELL(4rL) C C5A-m-wIF RECORDED. THE CELL IS EXTERNAL IGNORE IT. 8-19 IF(IBOUND(IC,IR,IL).LE.O)GOTO 100 C c5B----- PRINTTHE INDIVIDUALRATES IF REQUESTED(IWELCB<O). IF(IWELCB.LT.O.AND.ICBCFL.NE.0) WRITE(IOUT,900)(TEXT(N),N=1:~4), 1 KPER, KSTF’, L, IL I IR, ICI Q WELL’ rI4r PERIOD'rI3,' STEP',I3,' 900 FORMAT(lHOs4A4,’ RATE',G15.7) CQL’rI4,’ 1' LAYER'rI3,' ROW ‘rI4r’ :5c -----IF CELL-BY-CELL FLOWS ARE TO BE SAVED THEN ADD THEM TO BUFFER. IF(IBD.EQ.l) BUFF(IC,IR,IL)=BUFF(IC,IR,IL)+Q IF(Q) 90,100,80 C C5D-w-w-WMPINGRATE IS POSITIVEtRECHARGE). ADD IT 80 RATIN=RATIN+Q TO RATIN. GO TO 100 C C5E----- PUMPING RATEIS NEGATIVEtDISCHARGE). ADDIT TO RATOUT. 90 RATOUT=RATOUT-Q 100 CONTINUE E6------IF CELL-BY-CELL FLOWS WILL BE SAVED CALL UBUDSV TO RECORD THEM IF(IBD.EQ.l) CALL UBUDSV(KSTP,KPER,TEXT,IWELCB,BUFF,NCQL,NROW~ 1 NLAY,IOUT) C C7------ MOVE RATES INTOVBVL FOR PRINTINGBY MODULEBASlOT. 200 VBVL(3,MSUM)=RATIN VBVL(4rMSUM)=RATOUT C c8 ------MOVE RATES TIMESTIME STEPLENGTH INTO VBVL ACCUMULATORS. VBVL(l,MSUM)=VBVL(lrMSUM)+RATIN*DELT VBVL(2rMSUM)=VBVL(2rMSUM)+RATOUT*DELT C c9 ------MOVE BUDGET TERM LABELS INTO VBNM FOR PRINTING. VBNM(lrMSUM)=TEXT(l) VBNM(2rMSUM)=TEXT(2) VBNM(3,MSUM)=TEXT(3) VBNM(4,MSUM)=TEXT(4) C Cl()--- INCREMENT BUDGET TERM COUNTERtMSUM). MSUM=MSUMtl C Cll-----RETURN RETURN END 8-20 List D D Variable of Variables Module WELlBD for Definition Range BUFF Global DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. DELT Global Length IBD Module Flag. = 0, cell-by-cell flow not be recorded. z 0, cell-by-cell flow be recorded. of the current time step. terms for this package will terms for this package will IBOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index ICBCFL Global Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. f 0, cell-by-cell flow terms wil-1 be either printed or recorded (depending on IWELCB) for the current time step . IL Module Index IOUT Global Primary IR Module Index I WELCB Package Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, well recharge rate will be printed whenever ICBCFL is set. KPER Global Stress KSTP Global Time step period. counter. L Module Index wells. MSUM Global Counter MXWELL Package Maximum number of wells for columns. for layers. unit for number for a 11 printed output. IOUT = 6. rows. period for of each cell. for counter. budget 8-21 Reset entries at the start and labels active of each stress in VBVL and VBNM. at any one time. List Variable of Variables for Module WELlBD (Continued) Definition Range NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the grid. NWELLS Package Number of wells current stress Q Module Rate at which the well adds water to the (negative for discharging wells). aquifer RATIN Module Accumulator wells. for the total flow into RATOUT Module Accumulator wells. for the total flow out TEXT Module Label VBNM Global DIMENSION (4,20), budget. VBVL Global DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N) ,"&,for the current time step into the flow WELL Package in the grid. in the active to be printed grid. during the or recorded Labels for the current with entries time the flow of the the field flow field array data. in the from into volumetric (2,N) l?;-t;dtor . (3,N) (4,N) Voluml into the flow field during simulation. Volume out of the flow field during simulation. DIMENSION (4,MXWELL), For each well: and recharge rate of the well. 8-22 step period. out of the layer, flow row, column, CHAPTER9 DRAIN PACKAGE Conceptualization The Drain Package is designed as agricultural portional drains, head or elevation, this are actually the run only partially normally drain full, so that (h i,j,k) di,j,k characterize the Prevails head hi,j,k vertical plane, as the drain pattern forms component that pro- and some fixed elevation, The discussion the features in to be simulated there exists one part a radial conductivity used for i,j,k--because in that of the for within region differs presence 9-l The does not area in which flow pattern steeper flow An additional vicinity of the drain from the average of foreign in the head gradients converging hi,j,k-di,j,k. immediate and is itself. and the this by the model the cell, the drain--it or semiradial of the head difference the hydraulic is approximately by progressively in the concepts is assumed to from the drain within The head loss may occur value Between the drain characterized is approached. The drain the drain an average locally, illustrating The head computed at some distance only a cell, di,j,k. as a whole. normally through head within is actually of head loss cell at a rate is above that level. in the model. elevation, prevails cell section of drains assumed to prevail head, below that such drains. simulation i,j,k of features from the aquifer on the assumption to the median drain cell the effects head in the aquifer head falls 39 shows a cross underlying remove water as the if agricultural Figure for so long is phrased to simulate between the head in the aquifer have no effect section equal which to the difference but which and Implementation material value around if Drain Pipe - - - - -’ \ \ --4 0 0 Line of Equal Head ----- Figure 39.-Cross section through cell i,j,k illustrating head loss in convergent flow into drain. 9-2 di,j,k the drain pipe, or channel-bed Finally, 40). upon the which head losses number and size those openings material occur of the in the case of an open drain through the wall openings may be blocked in the by chemical of a drain pipe, pipe, (figure depending and the degree precipitates, to plant roots, etc. The three flow through drain, material and flow which that processes discussed of different through conductivity the wall the discharge losses,occur as proportional i,j,k the total to QD. head loss in the Drain Package. function is described by the equation ' ai,j4k(h'i,j,k conductance of cell describing i,j,k in which That is, it as well the system-- Because these may also has been assumed that head be taken CDi,j,k of equation (69) all of the head loss the head hi,j,k drain for hi,j,k > di,j,k (64) for hi,j,k 5 di,j,k (70) is a lumped (or equivalent) between the drain and the can be the assumed to prevail. of the convergent as on the character the pair - di,j,k) depends on the characteristics drain, head losses QD, through hi,j,k-di,j,k QDi,j,k = 0 The coefficient around the generate the drain. the drain, This has been done in the method of simulation embodied QDi,j,k into toward immediately to the discharge, from cell in series, flow of the drain--each may be assumed proportional is, above--convergent flow pattern of the dra in itself istics toward and its region it the immediate environment. One could equations for the equivalent attempt to calculate conductance series for values the three conductance. flow for CD by developing processes, The conductance 9-3 for and then approximate calculate each process would be (4 / Drain Pipe Open Drain (W . . . . . . . . . . . . . . . . . Figure 40.-Factors affecting head loss immediately around a drain: (a) buried drain pipe in backfilled ditch and (b) open drain. 9-4 based on the vary formulation significantly so no general depending formulation most situations that the material, of the drain hydraulic pipe h-d is calibration (69) and the not accurately known, the (figure excluded, and positive values flow the drain. Package could in fact and the it as defined to that for that flow flow of QD have been taken With proper selection be utilized to perform adjusted is more equation during model of QD to model calculated hi,j,k 36) except of number and size In practice, CD is usually is similar distribution of QD and h-d using to match measured values function around materials, materials. in information material, the amount of clogging CD from measured values Also, head distribution of fill of the clogging simulated, here. detailed conductivity aquifer into require hydraulic 41 shows a graph of QD vs. and (70); stream would such as detailed openings, being CD is presented formulation The formulations system near the drain, in order Figure drain conductivity common to calculate If equation. hydraulic conductivity (6%. flow specific calculating available, aquifer fill on the for a specific is not usually the drain, of a one-dimensional into by equations between the a surface aquifer is as corresponding of coefficients, the values. functions to the River of the Drain Package. Because QDi,j,k i,j,k, it cell affected must be subtracted elevation. whether to in equation by a drain, This HCOFi,j,k as the matrix provided drain (equation equations has been taken from the is accomplished head exceeds (69) (26)) left side of equation the head hi,j,k in the Drain elevation, and if and adding are assembled. 9-5 as a flow (24) for each is above the drain Package by testing so, by adding the term out of cell -CDi,j,kdi,j,k to determine the term -ai,j,k to RHSi,j,k, d Figure 41.-Plot of flow, QD, into a drain as a function of head, h, in a cell where the elevation of the drain is d and the conductance is CD. 9-6 Drain Input IUNIT(3). to the Drain Package Input (DRN) Package is read from the unit specified in FOR EACH SIMULATION DRNlAL MXDRN 110 Data: Format: 1. IDRNCB I10 FOR EACH STRESS PERIOD DRNlRP 2. Data: Format: ITMP 110 3. Data: Format: Layer 110 co1 110 Row 110 Cond F10.0 Elevation F10.0 (Input item 3 normally consists of one record for each drain. If ITMP is negative or zero, item 3 will not be read.) Explanation Input MXDRN--is the maximum number of drain IDRNCB--is ITMP--is of Fields Used in Instructions a flag and a unit cells active at one time. number. If IDRNCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. If IDRNCB = 0, cell-by-cell recorded. If IDRNCB < 0, drain leakage for ICBCFL is set. a flag flow terms will each cell not be printed will be printed or whenever and a counter. If ITMP c 0, drain If ITMP 10, data from the ITMP will be the stress period. last stress number of drains 9-7 period active will be reused. during the current Layer--is Row--is the the Column--is Elevation--is layer number of the cell row number of the cell the containing column number of the cell elevation Condo-is the hydraulic and the drain. containing the drain. the drain. containing the drain. of the drain. conductance of the interface 9-8 between the aquifer 9-9 Module Documentation The Drain called Package (DRNl) by the MAIN program. DRNlAL DRNlRP consists drain list Package modules, all of which are: an array that contains (DRAI). Reads location, Adds the terms Drain of four space for conductance DRNlFM the The modules Allocates the for drain elevation, of each cell -CDi,j,k the accumulators and drain containing a drain. and -CDi,j,kdi,j,k HCOFi,j,k to and RHSi,j,k, respectively. DRNlBD Calculates drainage the rates from the 9-10 and accumulated flow system. volume of are Narrative This module allocates Print 1. for Module DRNlAL space in the a message identifying the X array to store package the list and initialize of drains. NDRAIN (number of drains). Read and print 2. (the file that cell-by-cell saving flow equal to ISUM (which maximum number of drains) cell-by-cell terms Set LCDRAI (which 3. list) number for MXDRAN (the should will terms or a flag indicating be printed). point points flow and IDRNCB to the first to the first element unallocated in the drain element in the X array. 4. values Calculate for the amount of space needed for each drain--row, column, layer, drain the drain elevation, list (five and drain conductance). 5. Print the number of elements in the X array Package. 6. RETURN. 9-11 used by the Drain Flow Chart for Module DRNlAL (TiiC) -L NDRAIN is the number of drains being simulated at any given time. MXDRN is drains IDRNCB is the maximum number of simulated. a flag and a unit number. 1 If IDRNCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. If IDRNCB = 0, cell-by-cell terms will not be printed recorded. 1 IDENTIFY PACKAGE ANC i INITIALIZE NUMBER OF DRAINS (NDRAIN) I flow or If IDRNCB < 0, drain leakage for each drain will be printed whenever ICBCFL is set. LCDRAI is the location, in the X array, of the list of drain data (DRAI). FIRST ELEMENIOF DRAIN LIST 9-12 SUBROUTINE DRNl AL (ISUM,LENX, LCDRAI, NDRAIN, MXDRN,IN, 1 IDRNCB) IOUT, C C-----VERSION 1604 12MAY1987 DRNlAL c” C C C C C C Cl----- **********************************************~******************* ALLOCATE ARRAY STORAGE FOR DRAINPACKAGE *****************************~************************************ SPECIFICATIONS: ---------------------~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-----------~---------~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ IDENTIFY PACKAGE AND INITIALIZE NDRAIN. WRITE(IOUT,l)IN 1 FORMAT(lHO,‘DRNl -- DRAIN PACKAGE, VERSION1, 9/l/87', 1' INPUT READ FROM UNIT',131 NDRAIN=O C c2--- READ 8, PRINT MXDRN 8 IDRNCBtUNIT8 FLAG FOR CELL-BY-CELL FLOW) READtIN, MXDRN,IDRNCB 2 FORMAT(2110) WRITE(IOUT,3) MXDRN 3 FORMATtlH r'MAXIMUMOF'rI5,' DRAINS') IF(IDRNCB.GT.0) WRITE(IOUT,9) IDRNCB 9 FORMAT(lX,‘CELL-BY-CELL FLOWSWILL BE RECORDEDON UNIT',131 IF(IDRNCB.LT.0) WRITE(IOUT,8) 8 FORMAT(lX,‘CELL-BY-CELL FLOWS WILL BE PRINTEDWHEN ICBCFL NOT 0’) C C3------ SET LCDRAIEQUAL TO ADDRESS OF FIRST UNUSED SPACE IN X. LCDRAI= ISUM C c4------CALCULATE AMOUNTOF SPACE USED BY THE DRAIN PACKAGE. ISP=5*MXDRN IsuM=IsuMtIsP :5 ------PRINT AMOUNTOF SPACE USED BY DRAIN PACKAGE. WRITE(IOUT,4) ISP 4 FORMAT(lXII8,’ ELEMENTS IN X ARRAY ARE USED FOR DRAINS') ISUMl=ISUM-1 WRITE(IOUT,5) ISUM1,LENX 5 FORMATt1X, 18,' ELEMENTS OF X ARRAY USED OUT OF’, 18) IF(ISUMl.GT.LENX) WRITE(IOUT,6) ***X ARRAY MUST BE DIMiNSIONEDLARGER***‘) 6 FORMATt1X, ’ C C6------RETURN RETURN END 9-13 List Variable IDRNCB of Variables for Module DRNlAL Definition Range Package Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will be neither printed nor recorded. < 0, leakage for each drain will be printed. IN Package Primary will unit number from which be read. IOUT Global Primary unit ISP Module Number of words module. ISUM Global Index number of the lowest element in the X array number for all input printed in the X array for this output. allocated package IOUT = 6. by this which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. 1. ISUMl Module ISUM - LCDRAI Package Location in the DRAI. LENX Global Length X array of the X array of the first element of arra.y in words. This should always of X specified in the be equal to the dimension MAIN Program. MXDRN Package Maximum number of drains NDRAIN Package Number of drains period. 9-14 active active during at any one ti'me. the current stress Narrative for Module DRNlRP This module reads data to build Read ITMP. 1. that drain 2. the last stress list. ITMP is the number of drains data from the previous Test ITMP. the drain If period stress period be reused. Print indicating should be reused. ITMP is less than zero, will or a flag the drain data read for a message to that effect and RETURN. 3. If ITMP is greater drains for this current stress 4. stress period NDRAIN is greater 5. Print 6. See if period 7. period. is the number of (NDRAIN) in the equal to ITMP. (NDRAIN) in the current as the maximum for the simulation stress period (MXDRN). If than MXDRN, STOP. the number of drains there in the current are any drains. If there (NDRAIN = 0), bypass further Read and print the layer, drain stress RETURN. 9-15 period are no drains (NDRAIN). in the current processing. row, column, elevation, each drain. 8. it Set the number of drains Compare the number of drains to the number specified stress than or equal to zero, and conductance for Flow Chart for Module DRNlRP ITMP is both a flag and a counter. If it is greater than or equal to zero, it is the number of drains to be simulated during the current stress period. If it is less than zero, it indicates that the drains simulated in the last stress period should be simulated in the current stress period. MXDRN is the maximum number of drains to be simulated. STOP DATA RECORD 9-16 SUBROUTINE DRN1RP(DRAI,NDRAIN,MXDRN,IN,IOUT) C C C-----VERSION 1603 25APR1983 DRNlRF’ ****************************************************************** READ DRAIN LOCATIONS,ELEVATIONS, AND CONDUCTANCES ****************************************************************** C C E C SPECIFICATIONS: ” DIMENSION DRAI(5,MXDRN) ------------------------------------------------------------------ C ITMPtNUMBER OF DRAIN CELLS OR FLAG TO REUSE DATA) El ------READ READtIN, ITMP 8 FORMATtIlO) ITMP IF(ITMP.GE.0) GOTO 50 :2------TEST C (32/J---- IF ITMP<OTHEN REUSE DATA FROM LAST STRESS PERIOD. WRITE(IOUT,7) 7 FORMAT(lHO,‘REUSING DRAINS FROM LAST STRESS PERIOD') RETURN C C3------ IF ITMF=>O THEN IT IS THE NUMBEROF DRAINS. 50 NDRAIN=ITMP IF(NDRAIN.LE.MXDRN) GO TO 100 C NDRAIN>MXDRNTHEN STOP c4 ------IF WRITE(IOUT,99) NDRAIN,MXDRN 99 FORMAT(lHOr’NDRAIN(‘rI4,‘) IS GREATER THAN MXDRN(‘rI4,‘)‘) STOP C c5 ------PRINT NUMBEROF DRAINSIN THIS STRESS PERIOD. 100 WRITE(IOUT,l) NDRAIN 1 FORMAT(lHO,//lX,I5,' DRAINS') E6------IF THERE ARE NO DRAINS THEN RETURN. IF(NDRAIN.EQ.0) GO TO 260 AND PRINT DATA FOR EACH DRAIN, :7 ------READ WRITE(IOUT,S) 3 FORMATtlHD,15X, ‘LAYER’ ,5X, ‘ROW’ ,5X 1,‘COL ELEVATION CONDUCTANCE DRAIN NO. ‘/1X,15X,60( DO 250 II=lrNDRAIN READ (IN,41 K,I,J,DRAI(4,II)rDRAI(5rII) 4 FORMAT(3110,2FlO.O) WRITE (IOUT, K,I,J,DRAI(4rII)rDRAI(5rII)rII 5 F0RMAT(1X,15X,14,19,18,G13.4,G14.4,18) DRAI(l,II)=K DRAI(2,11)=1 DRAI(3,II)=J 250 CONTINUE C c8------RETURN 260 RETURN C END 9-17 I-‘) 1 List of Variables for Module DRNlRP Definition Variable Range DRAI Package DIMENSION (S,MXDRN), For each drain: layer, row, head in drain, and conductance into drain. I Module Index II Module Index for IN Package Primary will unit number from which be read. IOUT Global Primary unit I TMP Module Flag for colulmn, rows. drains. number for all input printed for output. this,package IOUT = 6. or number of drains. during the current -> 0, number of drains active stress period. < 0, same drains active during the last stress period will be active during the current stresis period. J Module Index K Module Index for MXDRN Package Maximum number of drains NDRAIN Package Number of drains for columns. layers. 9-18 active active during at any one time. the current str'lass period. Narrative This module adds terms for represent Module DRNlFM ing dra in leakage to the accumulators HCOF and RHS. If 1. there 'For Determine 4. If the drain than in the drain the column cell or equal (IC), is external If the cell 6. If the head in the aquifer 7. drain accumulator 8. there is is internal, no drain (IBOUND(IC, (EL), in the current stress period, add the term RHS and the term DO STEPS 3-7. and layer IR, (IL). IL) 5 0), bypass processing drain. get the drain leakage. If the head in the aquifer list, row (IR), and go on to the next 5. drain, to zero RETURN. each drain 3. on this the less are no drains. 2. the NDRAIN is (HHNEW) is data (elevation and conductance). greater than the elevation of greater than the elevation of RETURN. (HHNEW) is -C*EL (C is the drain conductance) -C to the accumulator HCOF. RETURN. 9-19 to the Flow Chart RHS is an accumulator in which the right hand side of the equation is formulated. HCOF is an accumulator which the coefficient head in the cell is forrmlated. for Module DRNlFM pi--) in of YES FOR EACH DRAIN GET DRAIN ELEVATION AND CONDUCTANCE YES ADD TERMS TO RHS AND HCOF FOR THIS SUBROUTINE DRNlFMt NDRAIN, MXDRN,DRAI,HNEW,HCOF,RHS, IBOUND, NCOL,NROW,NLAY) 1 C 1030 lOAPR1985 DRNlFM C-----VERSION C **************************,**************************************** C ADD DRAINFLOW TO SOURCETERM C ****************************************************************** C C C SPECIFICATIONS: -----_----_------------------------------------------------------DOUBLE FRECI SIONHNEW C C DIMENSION DRAI(5rMXDRN)rHNEW(NCOL,NRW,NLAY)r 1 RHS(NCOL,NROW,NLAY)rIBOUND(NCOLINROWINLAY), 1 HCOF(NCOL,NROW,NLAY) C C Cl---- C C2---- ------------------------------------------------------------------ IF NDRAIN<=O THERE ARE NO DRAINS. IF(NDRAIN.LE.0)RETURN RETURN PROCESS EACHCELLIN THEDRAINLIST DO 100 L=l,NDRAIN :3 ------GET COLUMN, ROWAND LAYER OF CELL CONTAINING DRAIN. IL=DRAI(lrL) IR=DRAI(ZrL) IC=DRAI(3rL) C c4-------IF THE CELL IS EXTERNAL SKIP IT. IF(IBOUND(IC,IR,IL).LE.O) GO TO 100 :5 -------IF THECELLIS INTERNAL GETTHEDRAINDATA. EL=DRAI(4rL) C C6--- HHNEW=HNEW(IC,IR,IL) IF HEAD IS LOWERTHANDRAINTHEN IF(HHNEW.LE.EL) GO TO 100 SKIP THIS CELL. IS HIGHERTHANDRAIN.ADD TERMS TO C=DRAI(5rL) HCOF(IC,IR,IL)=HCOF(IC,IR,IL)-C RHS(IC,IR,IL)=RHS(IC,IR,ILbC*EL 100 CONTINUE &----+JJ~ :7 ------HEAD RETURN END 9-21 RHS AND HCOF. List Variable of Variables for Module DRNlFM Definition Range C Module Conductance into the drain. DRAI Package DIMENSION (S,MXDRN), For each drain: head in the drain layer, row, column, into the drain. and conductance EL Module Elevation of the drain HCOF Global DIMENSION (NCOL,NROW,NLAY), Coefficient cell (J,I,K) in the finite-difference HHNEW Module Head in the HNEW Global DIMENSION (NCOL,NROW,NLAY), Most recent estima,te HNEW changes at each iteration. in each cell. IBOUND Global DIbiENsION (NC~L,NR~W,NLAY), cell (head in the containing c 0, constant-head = 0, inactive cell > 0, variable-head the drain). of head in the equation. drain. Status of head 0f each cell. cell cell IC Module Index for columns. IL Module Index for layers. IOUT Global Primary IR Module Index for MXDRN Package Maximum number of drains active NCOL Global Number of columns grid. NDRAIN Package Number of drains active during NLAY Global Number of layers in the grid. NROW Global Number of rows in the RHS Global DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. unit number for all printed output. IOUT = 6. rows. 9-22 in the at any one time'. the current stress period. grid. Narrative This module calculates for Module DRNlBD rates and volumes cell-by-cell flow-term transferred between the aquifer and drains. Initialize 1. accumulator zeros are no drains the budget Test They will is there into 3. to see if proper time are not needed for terms (IBD) terms will and clear for (IBD) and the rate step drains 4. For each drain, 5. Determine 6. If the flow down to step 12 and put are to be saved on disk. of the following this do steps conditions simulation they will and layer flow (IDRNCB 2 0). (1) this terms If cell-by-cell flow-term be accumulated 3-11 accumulating column, hold: (2) cell-by-cell set the cell-by-cell drains, in which row, terms (ICBCFL = 0) or during buffer skip drains. either be saved for the (NDRAIN 5 0), cell-by-cell not be saved if not the flow flag (RATOUT). If 2. the flows of the cell flag (BUFF). into drains. containing the drain. processing the cell of this is external Get the drain a. If further ,K), 2 0), bypass further drain. 7. bypass (IBOUND(I,J parameters the head in the cell processing of this from the is less drain. 9-23 drain than list. the elevation of the drain, If 9. drain, the head in the cell set "Q" equal elevation is greater to the conductance (EL) minus the head in the Add Q to the accumulator than the elevation of the drain cell of the (C) times (HHNEW) (Q = C*(EL RATOUT to get the total flow the drain - HHNEW!). from the aquifer into drains. 10. If the ICBCFL # 0), 11. If print the to the buffer 12. they are, 13. cell-by-cell print printing terms are to be printed flow terms for (IDRNCB < 0 and Q. cell-by-cell drains are to be saved, add Q (BUFF). See if call the cell-by-cell module UBUDSV to Move RATOUT into RATOUT multiplied for flow terms record the the VBVL array by the time-step by BASlOT. flow Move the drain buffer for length are to be saved (BUFF) onto printing to the (IBD = 1). disk. by BASlOT. volume accumulator budget-term labels Add in VBVL to VBNM fol* by BASlOT. 14. the Basic 15. Increment the Package for budget-term a detailed counter explanation RETURN. 9-24 (MSUM). See the If section in of VBVL, VBNM, and MSUM. flow Chart for Module DRNlBD IBD is a flag which, if set, causes cell-by-cell flow terms for drains to be recorded. ACCUMULATORS EXTERNAL: a cell is said to be external if it is either no flow or constant head (i.e., an equation is not formulated for the cell). BUFFER is an array in which values are stored as they are being gathered for printing or recording. RATOUT is an accumulator to which all flows out of the aquifer are added. Q is the negative to a drain. EL is the elevation drain. IDRNCB is a flag number. of discharge GET DRAIN PARAMETERS FROM DRAIN LIST of the and a unit c,=C (EL-HHNEW, If IDRNCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. 11 IF CELL-BY-CELL FLOW TERMS ARE TO BE RECOR;;FF;;D 0 TO If IDRNCB = 0, cell-by-cell flow terms will not be printed or recorded. r- If IDRNCB < 0, drain leakage for each drain will be printed whenever ICBCFL is set. ICBCFL is a flag. If I CBCFL f 0, ccl l-by-cell flow terms will be either printed or recorde d for the current time step. 9-25 1 SUBROUTINE DRNlBD(NDRAIN,MXDRN,VBNM,VBVL,MSUM,DRAI,DELT,HNEW, NCOL,NROW,NLAY,IBOUND,KSTP,KPER,IDRNCB,ICBCFL,BUFF,IOUT~ 1338 22AUG1987 DRNlBD : -----VERSION C ****************************************************************** C CALCULATE VOLUMETRIC BUDGET FOR DRAINS C **t*************************************************************** C C C SPECIFICATIONS: ----------------------------------------------------------------,-C CHARACTER*4 VBNM,TEXT DOUBLE PRECISIONHNEW C DIMENSION VBNM(4rMSUM),VBVL(4,MSUM)rDRAI(5,MXDRN), 1 HNEW(NCOL,NROW,NLAY)rIBOUND(NCOL,NROW,NLAY~, 2 BUFF(NCOL,NROW,NLAY) DIMENSIONTEXT(4) C C C Cl---Cl---- DATA TEXT(l)rTEXT(Z),TEXT(3)rTEXT(4) /’ ----------------------------------------------------------------,-INITIALIZE CELL-BY-CELL FLOW TERM FLAG ACCUMULATORS(RATIN AND RATOUT). RATOUT=O. 1,’ ‘,’ DR’r’AINS’/ (IBD) AND IBD=O C Q---- IF THERE ARE NO DRAINS THEN DO NOT ACCUMULATEDRAIN FLOW IF(NDRAIN.LE.0) GOTO 200 C C3-----C c3 B----- TEST TO SEE IF CELL-BY-CELL FLOW TERMS ARE NEEDED. IF(ICBCFL.EQ.0 .OR. IDRNCB.LE.0) GO TO 60 CELL-BY-CELL FLOW TERMS ARE NEEDED SET IBD=l DO 50 IL=lrNLAY IBD AND CLEAR BUFFER. DO 50 IR=lrNROW DO 50 IC=lrNCOL BUFF(IC,IR,IL)=O. 50 CONTINUE C c%------FOR EACH DRAIN ACCUMULATEDRAIN FLOW 60 DO 100 L=lrNDRAIN C C5------ GET LAYER, ROW& COLUMN OF CELL CONTAININGREACH. IL=DRAI(l,L) IR=DRAI(Z,L) 9-26 IC=DRAI(3,L) C (-3j-em-- IF CELL IS EXTERNAL IGNORE IT. IF(IBOUND(IC,IR,IL).LE.O) GO TO C 100 c7 ------GET DRAIN PARAMETERSFROM DRAINLIST. EL=DRAI(4,L) C=DRAI(5rL) HHNEW=HNEW(IC,IR,IL) C C&----- IF HEAD LOWERTHAN DRAIN THEN FORGET THIS CELL. IF(HHNEW.LE.EL) GO TO 100 C c9 ------HEAD HIGHER THAN DRAIN. CALCULATE Q=C*(EL-HHNEW). c9 ------SUBTRACT Q FROM RATOUT. Q=C*(EL-HHNEW1 RATOUT=RATOUT-Q C Cl&---PRINT THE INDIVIDUAL RATES IF REQUESTED(IDRNCB<O). IF(IDRNCB.LT.O.AND.ICBCFL.NE.0) WRITE(IOUT,900) (TEXT(N)rN=lr4), 1 KPER,KSTP,L,IL,IR,IC,Q 900 FORMAT(lH0,4A4, ’ STEP’rI3,’ PERIOD'rI3,' DRAIN'rI4, 1 ' LAYER'rI3,' RATE’,G15.7) ROW’,I4,’ COL’rI4,’ C Cll---IF C-EC FLOW TERMS ARE TO BE SAVED THEN ADD Q TO BUFFER. l IF(IBD.EQ.l) 100 CONTINUE BUFF(IC,IR,IL)=BUFF(IC,IR,IL)+Q C c12---- IF C-EC IF(IBD.EQ.l) FLOW TERMS WILL BE SAVED CALL UBUDSV TO RECORDTHEM. CALL UBUDSV(KSTP,KPER,TEXT,IDRNCB,BUFF,NCOL,NROW, NLAY, IOUT) 1 C Cl3----MOVE RATESsVOLUMES8, LABELS INTO ARRAYS FOR PRINTING. 200 VBVL(3rMSUM)=O. VBVL(4rMSUM)=RATOUT VBVL(2rMSUM)=VBVL(2,MSUM)+RATOUT*DELT VBNM(lrMSUM)=TEXT(l) VBNM(2rMSUM)=TEXT(2) VBNM(3,MSUM)=TEXT(3) VBNM(4,MSUM)=TEXT(4) C Cl4----INCREMENT BUDGET TERM COUNTER MSUM=MSUMtl C Cl5 -----RETURN RETURN END l 9-27 List Variable of Variables for Module DRNlBD Definition Range BUFF Global DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording 4t. C Module Conductance DELT Global Length DRAI Package DIMENSION (5,MXDRN), head in the drain EL Module Elevation HHNEW Module Head in the cell HNEW Global DIMENSION (NCOL,NROW,NLAY), Most recent estimate HNEW changes at each iteration. in each cell. IBD Package Flag. = 0, cell-by-cell flow not be recorded. # 0, cell-by-cell flow be recorded. into drains. of the current time step. For each drain: and conductance of the drain (head in the containing the for this package will terms for this package will DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index I CBCFL Global Flag. = 0, cell-by-cell or printed f 0, cell-by-cell the current Package of head terms Global IDRNCB drain). drain. IBOUND for layer, row, column, into the drain. of each cell. columns. flow terms will not be recorded the current time step. flow terms will be recorded for time step. for Flag. > 0 and if ICBCFL f 0, cell-by-cell flow for the DRNl Package will be recorded UNIT = IDRNCB. IL Module Index IOUT Global Primary IR Module Index KPER Global Stress for layers. unit for terms on number for rows. period counter. Q-28 all printed output. IOUT = 6. List Variable of Variables for Module DRNlBD (Continued) Definition Range Reset at the start of each stress KSTP Global Time step period. counter. L Module Index drains. MSUM Global Counter MXDRN Package Maximum number of drains NCOL Global Number of columns NDRAIN Package Number of drains period. active during NLAY Global Number of layers in the grid. NROW Global Number of rows in the Q Module Flow from a drain into a cell. get the flow into the drain.) RATOUT Module Accumulator for the total into the drains. TEXT Module Label VBNM Global DIMENSION (4,20), budget. VBVL Global DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N) Rate for the current time step into the flow field. (2,N) Rate for the current time step out of the flow field. (3,N) Volume into the flow field during simulation. (4,N) Volume out of the flow field during simulation. for for budget entries active in VBVL and VBNM. at any one time. in the grid. to be printed 9-29 and labels the current stress grid. flow out of the or recorded Labels for (Reverse with entries the the sign flow array in the to field data. volumetric CHAPTER 10 EVAPOTRANSPIRATION PACKAGE Conceptualization The Evapotranspiration transpiration "ET surface" evaporation The approach regime. (1) when the water occurs (ET) Package simulates and direct ground water table in this table termed the piration specified depth" from the water transpiration table from the water This water can be expressed elevation or "cutoff ceases; table of plant from the is based on the following depth" varies in equation termed from the water a specified in this linearly with of the interval, report, between these the table (2) when the depth exceeds and (3) saturated assumptions: elevation, loss by the user; ET surface "extinction in removing evapotranspiration report, below the the effects is at or above a specified at a maximum rate water and Implementation evapotrans- limits, water evapo- table elevation. form as RETi,j = RETMi,j hi,j,k > hsi,j (71) RETi,j = 0 hi,j,k < hsi,j'di,j (72) RETi,j = RETMi , j{ hi,j,k - (hsi,j -----------------------) di,j - di,j) (h si,j-di,j) _< hi,j,k 2 (73) hsi,j where RETi,j is the rate the map area DELRjDELCi; the cell from which possible value of RETi,j; elevation at which occurs; and di,j per unit in volume of water evapotranspiration, table of loss hi,j,k per unit is the head, the evapotranspiration hsi,j this is the cutoff surface is the area of water area per unit or water occurs; ET surface maximum value or extinction 10-l table time, due to within elevation in REmi,j is the maximum elevation, or the water of evapotranspiration depth, table such that loss when the distance between hsi,j In implementing and hi,j,k the finite exceeds difference evapotranspiration loss from a given the product of the loss rate DELRjDELCi, of the cell from which QETi,j through the is designated of volumetric rate is given and the horizontal surface required. occurs, loss volumetric This is area, the ceases. of as area, i.e. = RETi,j*DELRj*DELCi in volume of water equations QEmi,j, discharge (74) If the maximum Value the area DELRjDELCi. to REMi,j) terms per unit evapotranspiration approach cell is the evapotranspiration, where QETi,j di,j of per unit (corresponding QETi,j (71)-(73) time, can be expressed in as QETi,j = QElM,j hi,j,k > hsi,j (75) QETi,j = D hi,j,k < hsi,j-di,j (75) QETi,j = hi,j,k QE~i,j{---------,7-~----------} - (hsi,j - di,j) (hsi,j-di,j) 2 hi,j,l( 5 (77) , hsi,j Figure in cell with 42 shows a graph of evapotranspiration i,j,k the river similar, except based on equations or drain that functions the linear both ends by constant values, Evapotranspiration beneath layer, portion rather k) using drawn from the specifies evapotranspiration the than only cell, within the is to be taken. at the layer of the model; vertical In either IO-2 first vs head ET funlction are mathematically lower in the designates Under the of the ET function one cell the user uppermost the three of the is drawn from only one of two options. QETi,j, Comparison shows that the map area DELRj*DELCi; is always user (75)-(77). loss, the option, is bounded at end. vertical cell (i.e. the evapotranspiration under the column at i,j, column second, the from whici case the computed the evapotrans- QET Maximum evapotranspiration - h Figure 42.-Plot of volumetric evapotranspiration, QET, as a function of head, h, in a cell where d is the cutoff depth and h, is the ET surface elevation. 10-B piration has no influence a no-flow cell or a constant For each cell stress period reads per unit time) multiplied rate (i, an option values an array then to the EVTR array area, in the values consists the model, maximum volumetric of RETMi,j Values of hsi,j, evapotranspiration array SURF by the depth are read into must be subtracted expressions package 1) ET surface ET package; has been defined left side HCOF and RHS of equation rates per un!t calculation carried (or water appear input as depth EXDP. of equation this table elevation at the two dimension31 or extincti Because the term QETi,j as an outflow (26), Thus, the Lst-l. of the cutoff array area maximum volumetric EVTR array are read into the two-dimensonal from the in the elevation values ET per unit EVTR array. In the dimensions is maximum), (75)-(77) in the the entries having the which of equations however, the the maximum volumetric QETM; these Lt-'. values) each are immediately of maximum evapotranspiration rates, is either and for loss These rates to obtain from each cell, the cell plane, to use prior EVTR. and as such must have dimensions out within horizontal is exercised DELRj*DELCi, areas, replace j), labelled of evapotranspiration rates the designated of REm (maximum evapotranspiration into by cell if head cell. location, (unless package on the simulation (24). from the aquifer In terms is accomplished it of the in tha ET as follows: if hi,j,k or RHS for 2) if hi,j,k 3) if (hsi,j,k HCOFi ,j ,k < (hsi,j,k cell no changes are made in the terms HCOF i,j,k; > hsi,j, - di,j) and - di,j) ‘QETMi QEMi,j 5 hi,j,k ,j is added to RHSi,j; 5 hsi,j,ks h. .-d.. { -Z~Z!----I~~} di,j 10-4 and -QEmi,j/di,j is added to is added to RHS i,j,k. The value piration of hs,i,j, the water is maximum, should elevation table normally be taken in the map area DELRjDELCi; is then frequently surface (although considerable the cutoff the presence distance from land surface variation of deep-rooted at which as the assumed to be on the order factors, care must be exercised in choosing various parameters average of six table land surface feet the (70), below land Where the extensively in implementing di,j, by climatic or so on). varies of equation depth, to eight can be introduced to the water evapotrans- or extinction phreatophytes, area of a cell, the elevation within the ET package and or misleading results may be obtained. The options provide also for selection some flexibility require similar in adapting some care to that of the discussed for the using the provision table conditions inactive for (Chapter and figure (no flow) Under option uppermost cells model, layer in this Figure use of option 5). cells 43-c), of the model; deletes 43-d shows the situation 2, assuming distribution that the but a cross the water formulation table, under water situation of variable head and in the simulation. evapotranspiration from the to represent which could simulation 10-5 is drawn only shown, the presence evapotranspiration fails in which 43-a shows the hydrologic in the problem the simulation situations, to follow conductance Figure obtained ET is to be drawn 43 shows a situation package, truncated 43-b the final 1 (figure layer so that horizontal Figure recharge model has been progressively from which the package to special in implementation. sectional under study, layer field right of no flow half of the conditions. be achieved was carried from the out through in the stages and Land Surface River Buried Drain \ Vertical Cross Section Showing Hypothetical Field Situation and Finite Difference Grid Water Table a III Variable Head Cell q Constant Head Cell iiii$ Inactive Cell El Status of Cells at End of Simulated Period b clx . . . . . . . . . . . -. I I . . . . I I I I Cell from Which ET Is Abstracted I I I I Ii Cells from Which ET Is Abstracted Option 1 C Under Layer Indicators Specifield in the IEVT Array 111111112223333444- qX Cells from Which ET Is Abstracted Option 2 Cell from Which ET Is Abstracted Under d Figure 43.-Hypothetical problem showing cells from which ET will be abstracted under the two options available in the ET Package. 10-6 that the user from which interacted evapotranspiration with the simulation process, designating was to be drawn as the truncation developed. 10-7 the cells of the mesh Evapotranspiration Input to the Evapotranspiration specified in IUNIT (5). Package Input (EVT) Package is read from the unit FOR EACH SIMULATION EVTlAL 1. Data: Format: NEVTOP 110 IEVTCB 110 FOR EACH STRESS PERIOD EVTlRP 7-. Data: Format: I NSURF 110 3. Data: Module: SURF U2DREL 4. Data: Module: EVTR U2DREL 5. Data: Module: EXDP U2DREL I NEVTR 110 I NEXDP 110 INIEVT 110 IF THE ET OPTION IS EQUAL TO TWO 6. Data: Module: IEVT U2DINT Explanation Input of Fields Used in Instructions NEVTOP--is the evapotranspiration (ET) option code. ET parameters (ET surface, maximum ET rate, and extinction depth) are specified in two-dimensional arrays, SURF, EVTR, and EXDP, with one value for each vertical column. Accordingly, ET is calculated for one cell in each vertical column. The option codes determine for which cell in the column ET will be calculated. 1 - ET is calculated only for 2 - The cell for each vertical user in array IEVT. 10-8 cells in the top column is grid specified layer. by the IEVTCB--is a flag and a unit number. If IEVTCB > 0, it If IEVTCB 2 0, cell-by-cell is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. flow terms will not be printed or recorded. INSURF--is the ET surface If (SURF) read flag. INSURF L 0, an array containing the ET surface elevation will be read. If INSURF < 0, the ET surface from the preceding stress period will be reused. the maximum ET rate INEVTR--is (EVTR) read flag. If INEVTR 2 0, an array If INEVTR < 0, the maximum ET rate will be reused. INEXDP--is the extinct If ion depth INEXDP 2 0, an array containing the maximum ET rate from the preceding will be read. stress period (EXDP) read flag. containing the extinction depth (EXDP) will be read. depth INEXDP < 0, the extinction will be reused. If INIEVT--is the option layer indicator (IEVT) read flag. (NEVTOP) is equal to two. If INIEVT L 0, an array be read. If INIEVT < 0, layer containing indicators be reused. will SURF--is the elevation EVTR--is the maximum ET rate EXDP--is the ET extinction IEVT--is from the preceding the stress It is used only layer used during indicators the period if the ET (IEVT) will preceding stress period of the ET surface. (volume of water per unit area (Lt-I)). depth. the layer indicator array. indicates the layer from which the ET option is equal to two. For each horizontal It ET is removed. 10-9 location, it is needed only if m N(VN0P-lC.l . . . . .-lrl4l-l.-il-l . . NhlhlO(Yt-7 . . . l-ll-lrlrlrlrl . . . Module Documentation for The Evapotranspiration of which the Evapotranspiration Package (EVTl) are called by the MAIN program. EVTl AL Allocates space for ET rate (EVTR), extinction EVTlRP Reads arrays (in terms and, surface if option area to get the out of the flow If there to location, is if rate. which there ET, add the HCOF and RHS. and accumulated system. 10-11 2 Maximum ET Determines cell. rates 2 (IEVT). area), each horizontal terms the option indicator. by cell is at the surface. Calculates if each node as a volumetric for appropriate maximum (SURF), indicator depth, the layer is ET from that EVTlBD and, all the maximum ET rate extinction maximum ET for cell layer are multiplied Determines, to contain of a volume per unit is specified, EVTlFM (EXDP), modules, are: elevation containing elevation, rates surface the of four The modules arrays depth is specified, consists Package volume of ET Narrative This module allocates for Module EVTlAL space in the X array to store data relating to evapotranspiration. for 1. Print a message identifying 7-. Read and print cell-by-cell 3. (not flow See if 1 or Z), allocate 5. If terms depth 7. If 8. the flow will space for (EXDP), the option If NEVTOP is is illegal. illeg'al Do not array Calculate NEVTOP. terms are to be recorded, print the unit be recorded. ET-surface (NEVTOP) is array equal array (EVTR), the extinction- (SURF). to two, allocate space for a (IEVT). and print the number of elements ET package. 9. legal. the maximum ET-rate and the the ET option layer-indicator (NEVTOP) is print cell-by-cell Allocate array number (IEVTCB). legal, number (IEVTCB) where they 6. (NEVTOP) and the unit STOP. NEVTOP is the package. indicator a message saying storage. 4. 'If the option the ET option print the RETURN. 10-12 in the X array used by Flow Chart B for NEVTOP is the ET option. If NEVTOP = 1, ET is top layer. Module EVTlAL (2 ENTER EVTlAL from the If NEVTOP = 2, ET is from the layer specified by the user in the indicator array (IEVT). 1 PRINT MESSAGE I Dp6;;;<FAYd;G cl IEVTCB is the unit number on which cell-by-cell flow terms for ET will be written. EVTR is an array which maximum ET rate for cell location. contains the each horizontal SURF is an array which contains elevation of the ET surface. the EXDP is an array which contains extinction depth for ET. the IEVT is an array which contains the layer number from which ET is taken for each horizontal location. It is used only if option 2 has been specified. PRINT IEVTCB I ALLOCATE SPACE FOR EVTR, SURF, AND EXDP ARRAYS ALLOCATE SPACE FOR IEVT ARRAY I PRINT AMOUNT OF SPACE USED BLR~~:T 1 1 SUBROUTINE EVT~AL(ISUMILENXILCIEVT,LCEVTRILCEXDP,LCSURF, NCQLINROW,NEVTOP,IN,IOUT,IEVTCB) C C-----VERSION 1607 12MAY1987 EVTlAL ****************************************************************** C ALLOCATE ARRAY STORAGE FOREVAPOTRANSPIRATION ****************************************************************** C c C C SPECIFICATIONS: C C Cl--- C c2--- ------------------------------------------------------------------ IDENTIFYPACKAGE. WRITE(IOUT,l)IN 1 FORMAT(lHDr'EVT1 -- EVAF'OTRANSPIRATION PACKAGE, VERSION l,', 1 ' 9/l/87',' INPUTREAD FROM UNIT',131 READNEVTOP ANDIEVTCB. READ(IN,3)NEVTOP,IEVTCB 3 FORMAT(2110) C C3------ CHECK TO SEETHATET OPTIONIS LEGAL. IF(NEVTOP.GE.l.AND.NEVTOP.LE.P)GO TO200 C C3A-m-s-IF ILLEGALPRINTA MESSAGE i%ABORTSIMULATION. WRITE(IOUT,B) 8 FORMAT(lX,'ILLEGAL ET OPTION CODE. SIMULATION ABORTING') STOP C C4------IF THEOPTIONIS LEGAL THEN PRINT THE OPTIONCODE. 200 IF(NEVTOP.EQ.l)WRITE(IOUT,ZOl) 201 FORMAT(lX,'OPTION 1 -- EVAPOTRANSPIRATION FROM TOP LAYER’) IF(NEVTOP.EQ.2) WRITE(IOUT,POZ) 202 FOlU4AT(lX,'OPTION 2 -- EVAPOTRANSPIRATION FROM ONESPECIFIED', 1 ’ NODE IN EACH VERTICAL COLUMN’) IRK=ISUM ------IF CELL-BY-CELL TEfW TO BE SAVED THEN PRINT UNIT NUMBER. IF(IEVTCB.GT.0) WRITE(IOUT,203) IEVTCB C 203 FORMAT(lX,'CELL-BY-CELL FLOWTERNSWILL BE SAVEDONUNIT'rI3) c6 ------ALLOCATESPACE FORTHEARRAYS EVTR,EXDPANDSURF. LCEVTR=ISUM ISUM=ISUM+NCOL*NROW LCEXDP=ISUM ISUM=ISUM+NCOL*NROW LCSURF=ISUM ISUM=ISUM+NCOL*NROW C C7------ IF OPTION2 THEN ALLOCATE SPACE FOR THE INDICATOR ARRAYfIEVT) LCIEVT=ISUM IF(NEVTOP.NE.P)GO TO300 ISUM=ISUM+NCOL*NROW C C&-----CALCULATE 8 PRINT AMOUNT OF SPACE USED BY ET PACKAGE. 300 IRK=ISUM-IRK WRITE(IOUT,4)IRK 4 FOl%!AT(lX,I8,' ELEMENTS OF X ARRAY USED FOR EVAPOTRANSPIRATION') ISUM1=ISUM-1 WRITE(IOUT,5)ISUMl,LENX 5 FORMAT(lX,IBr'ELEMENTS OFX ARRAYUSEDOUTOF',181 IF(ISUMl.GT.LENX)WRITE(IOUT,6) 6 FORMAT(1X,' ***X ARRAY MUST BE MADE LARGER***‘) C c9 ------RETURN. RETURN END 10-14 List Variable of Variables for Definition Range I EVTCB Package IN Package IOUT IRK Global Module I SUM Global ISUMl Module LCEVTR Package LCEXDP Package LCIEVT Package LCSURF Package LENX Global NCOL NEVTOP Global Package NRDW Global Module EVTlAL Flag. If IEVTCB > 0 and ICBCFL f 0, cell-by-cell flow terms for the EVTl Package will be recorded on UNIT = IEVTCB. Primary unit number from which input for this package will be read. Primary unit number for all printed output. IOUT = 6. Before this module allocates space, IRK is set equal IRK is subtracted from to ISUM. After allocation, ISUM to get the amount of space in the X array allocated by this module. Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. Index number of the last element of the X array allocated by this module. Location in the X array of the first element of array EVTR. Location in the X array of the first element of array EXDP. Location in the X array of the first element of array IEVT. Location in the X array of the first element of array SURF. Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. Number of columns in the grid. ET option: = 1, ET is from the top layer. = 2, ET at each horizontal-cell location is from the layer specified by the user in the layerindicator array (IEVT). Number of rows in the grid. 10-15 Narrative This module evapotranspiration. reads data for Module EVTlRP used to calculate the terms which represent 1. Read the values INSURF, INEXDP, INEVTR, and INIEVT which indicate whether the data contained in arrays SURF, EXDP, EVTR, and IEVT, respectively, used during the last stress period, are to be used for the current stress period. 2. Test INSURF to see where the ET-surface array (SURF) is coming from,, If INSURF is less than zero, the ET-surface elevation used in the last stress period will be used again in this stress period. Print a message to that effect and GO TO 4. INSURF is 3. greater than or equal to zero. CALL UEDREL to read SURF. 4. Test INEVTR to see where the maximum ET rate (EVTR) is coming from. If INEVTR is less than zero, the maximum ET rate used in the last stress period will be used again in this stress period. Print a message to that effect and GO TO 7. maxim:; INEVTR is greater ET rate (EVTR). 6. Multiply than or equal the maximum ET rate to zero. by the be used again in this stress period. read the area to get a volumetric 7. Test INEXDP to see where the extinction INEXDP is less than zero, the extinction depth will CALL U2DREL to Print rate is coming used in the last a message to rate from. stresrs that If per iod ef rect and GO TO 9. 8. If extinction 9. If INEXDP is depth. greater the ET option than or equal (NEVTOP) is equal to zero, to two, CALL U2DREL to read the a layer-indicator array is needed. Test INIEVT to see where the layer indicator is coming from. If INIEVT is less than zero, the indicator array used in the last stress period Print a message to that effect will be used again in this stress period. and GO TO 12. 10. 11. If IEVT array. 12. INIEVT is greater than or equal RETURN. lo-16 to zero, CALL UEDINT to read the Flow Chart for JNEVTR is a flag which, when set, indicates that the maximum ET rate EVTR should be read for the current If it is clear stress period. (less than zero), maximum ET rates from the last stress period should be reused. INIEVT, INSURF, and INEXDP are flags similar to INEVTR used for the layer indicator array (IEVT), the ET surface array (SURF), and the extinction depth array (EXDP), respectively. Module EVTlRP INEXDP. INEVTR, “REUSE SURF” CALL MODULE UPDREL TO READ SURF EVTR is an array containing the maximum ET rate for every horizontal cell location. SURF is an array containing the ET surface elevation for each horizontal cell location. EXDP is an array containing depth for each horizontal location. the extinction cell IEVT is an array containing a layer indicator for each horizontal cell For each horizontal cell location. location, it indicates the layer number of the cell at that location It is used from which ET is taken. only if the ET option (NEVTOP) is equal to two. NEVTOP is CELL AREA 7A “REUSE EXDP” CALL MODULE UZDREL TO _ READ EXDP the ET option. If NEVTOP = 1, ET is from the top layer. If NEVTOP = 2, ET is from the layer specified by the user in the indicator array (IEVT). 1OA CALL 10-17 MODULE 1 SUBROUTINE EVTlRP(NEVTCP,IEVT,EVTR,EXDPtSURF,DELR,DELC, NCOL,NROWIIN,IOUT) --VERSION 1635 24JULl987 EVTlM= READ EVAPOTRANSPIRATION DATA SPECIFICATIONS: ------------_----------------------------------------------------CHARACTER*4 ANAME DIMENSION IEVT(NCOL,NROW),EVTR(NCOL1NROH)rEXDP(NCO). 1 SURF(NCOL,NROW).ANAM(6,4),DELR(NCOL),DELC(NROW) C DATA ANAME~l,l~,ANAME~2rl~,ANAME~3,l~,ANAFL~4rl~,ANAM~5.l~, ANAME(611) /’ 1,’ 1,’ ET’,’ LAY’,‘ER I’,‘NDEX’/ DATA ANAME(l,Z),ANAME(2,2),ANAME(3,2),ANAME(4,2),ANAME(5,2), 1 ANAME(6.2) /’ 1,’ I,’ I,’ ET’,’ SUR’,‘FACE’/ DATA ANAME(1,3l,ANAME(2,3),~~(3,3),~~(4,3),~~(5,3), 1 ANAK(6.3) /’ EVA’r’POTR’,‘ANSP’.‘IRAT’,‘ION ‘,‘RATE’/ DATA ANAME(1,4),AN~(2,4),ANAME(3,4),ANAME(4,4),ANAM(5,4), 1 ANAK(6.4) /’ 1.1 ‘,‘EXTI’r’NCTI’,‘ON D’.‘EPTH’/ -----------------------------------------------------------------1 C C Cl------READ FLAGS SHOWING WHETHER DATA IS TO BE REUSED. READ(INr6)INSURF,INEVTR.INEXDPtINIEVT 6 FDRMAT(4110) C CP-----TEST INSURF TO SEE WHERE SURFACE ELEVATION COKS FROM. IF(INSURF.GE.O)GC TO 32 C C2A------IF INSURF< THEN REUSE SURFACE ARRAY FROM LAST STRESS PERIOD WRITE(IOUT,3) 3 FOF&tAT(1HO,‘REUSING SURF FROM LAST STRESS PERIOD’) GO TO 35 i3 -------IF INSURF=>O THEN CALL MODULE U2DREL TO READ SURFACE. 32 CALL U2DREL(SURF.ANAME(lr2)rNRaJ.KOL.O.IN,IOUT) C C4------TEST INEVTR TO SEE WHERE MAX ET RATE COMES FROM. 35 IF(INEVTR.GE.O)GO TO 37 C CQA-----IF INEVTR<O THEN REUSE MAX ET RATE. WRITE(IOUT,4) 4 FOfU4AT(lHD.‘REUSIffi EVTR FROM LAST STRESS PERIOD’) GO TO 45 C (%------IF INEVTR=>D CALL MODULE U2DREL TO READ MAX ET RATE. 37 CALL U2DREL(EVTR,ANAME(lr3)tNROWtNC0L,OrIN,IOUT) C C6------MULTIPLY MAX ET RATE BY CELL AREA TO GET VOLUVETRIC RATE DO 40 IR=l,NROW DO 40 IC=ltNCOL EVTR(IC.IR)=EVTR(IC,IR)*DELR(IC)*DELC(IR) 40 CONTINUE C C7------TEST INEXDP TO SEE WHERE EXTINCTION DEPTH COMES FRCM 45 IF(INEXDP.GE.O)GO TO 47 C C‘IA------IF INEXDPCO REUSE EXTINCTION DEPTH FROM LAST STRESS PERIOD WRITE(IOUT,5) 5 FOPMAT(lHUt ‘REUSING EXDP FROM LAST STRESS PERIOD’ 7 GO TO 48 -------IF INEXDP=>O CALL MODULE U2DREL TO READ EXTINCTION DEPTH 47 CALL U2DREL~EXDP.ANANE(1,4),N~,KXlLrOrIN,IOUT) C C9------IF OPTION(NEVTCP) IS 2 THEN WE NEED AN INDICATOR ARRAY. 48 IF(NEVTOP.NE.L)GO TO 50 -----IF INIEVTCO THEN REUSE LAYER INDICATOR ARRAY. XF(INIEVT.GE.O%O TO 49 WRITE(IOUT,2) 2 FOF@tAT(1HOt’REUSING IEVT FROM LAST STRESS PERIOD’) GO TO 50 ------IF INIEVT=>O THEN CALL MODULE UPDINT TO READ INDICATOR ARRAY. 49 CALL U2DINT(IEVT,ANAME(1.1)rNR~rNCGLrOrIN,IOUT) C c12-----RETURN 50 RETURN END lo-18 List Variable Module Global DELR Global EVTR EXDP IC IEVT Package Package Module Package IN Package INEVTR Module Module l INIEVT I NSURF for Module EVTlRP Definition Range ANAME DELC I NEXDP of Variables Module Module Label for printout of the input array. DIMENSION (NROW), Cell dimension in the column DELC( I) contains the width of row I. direction. DIMENSION (NCOL), Cell dimension in the row direction. DELR(J) contains the width of column 3. DIMENSION (NCOL,NROW), Maximum ET rate. DIMENSION (NCOL,NROW), Extinction depth. Index for columns. DIMENSION (NCOL,NROW), Layer number for each horizontal cell location from which ET will be taken if the ET option (NEVTOP) is equal to two. Primary unit number from which input for this package will be read. Flag. be read. -> 0, EVTR array will < 0, EVTR array already in memory from the stress period will be used. Flag. > 0, EXDP array will be read. last < 0, EXDP array already in memory from the stress period will be used. Flag. be read. -> 0, IEVT array will last < 0, IEVT array already in memory from the stress period will be used. Flag. > 0, SURF array will be read. last < 0, SURF array already stress period will IDUT IR NCOL NEVTOP NROW SURF Global Module Global Package Global Package in memory from the be used. Primary unit number for all printed Index for rows. Number of columns in the grid. ET option. = 1, ET is from the top layer. = 2, ET at each horizontal-cell the layer specified in the array (IEVT). Number of rows in the grid. DIMENSION (NCOL,NROW), Elevation of 10-19 output. last IOUT = 6. location is from layer-indicator the ET surface. Narrative This 1. module adds terms 2. Set the 3. If ET to the location, determine appropriate terms to the equation layer equal to one. option index 2 was invoked, get the finite-difference layer which for index equations. layer ET comes the cell. from the DO STEPS 1-7. indicator (IEVT). 4. If 5. surface the If is external, move on to the the head in the aquifer elevation, location. 6. cell next horizontal-cell SKIP STEPS 5-7. location. cell Module EVTlFM representing For each horizontal-cell from and add the array for If (ET surface is greater than or equal add EVTR to RHS and move on to the next to the ET- horizontal- SKIP STEPS 6 AND 7. the head in the aquifer minus extinction finite-difference equation. depth), is less no terms Move on to the than the extinction need to be added to the next horizontal-cell SKIP STEP 7. 7. Add the term -EVTR/EXDP to HCOF and subtract -EVTR(EXDP - SURF)/EXDP from RHS. 8. RETURN. 10-20 elevation the term location. Flow Chart IEVT is an array containing a layer indicator for each horizontal cell location. For each horizontal cell location, it indicates the layer number of the cell at that location from It is which ET is taken. used only if the ET option (NEVTOP) is equal to two. for Module EVTlFM FOR EACH HORIZONTAL CELL LOCATION SET LAYER INDEX EQUAL TO 1 SURF is an array containing the maximum ET rate for every horizontal cell location. IF OPTION 2 IS SPECIFIED, GET LAYER INDEX FROM IEVT EVTR is an array containing the maximum ET rate for every horizontal cell location. RHS is an accumulator in which the right hand side of the finite-difference equation is formulated. HCOF is an accumulator which a coefficient head in the finitedifference equation formulated. in of is NEVTOP is the ET option. If NEVTOP = 1, ET is the top layer. from If NEVTOP = 2, ET is from the layer specified by the user in the indicator array (IEVT). ADD ET TERMS TO HCOF AND RHS 10-21 1 SUBROUTINE EVTlFM( NEVTOP,IEVT, EVTR, EXDP, SURF, RHS, HCOF, IBOUND, HNEW,NCOL,NROW,NLAY) C C-----VERSION 1031 lOAPR1985 EVTlFM **********************~**************************************~~**** C C ADD EVAPOTRANSPIRATION TO RHSANDHCOF *************************************************************~~**** C C C C SPECIFICATIONS: -----------------------------------------------------------------DOUBLE PRECISIONHNEW DIMENSIONIEVT(NCOL,NROW)rEVTR(NCOLINROW1,EXDP~NCOL,NROW~, 1 SURF(NCOL,NROW),RHS(NCOL,NROW,NLAY)r 2 HCOF(NCOL,NROW,NLAY),IBOUND(NCOLINROWINLAY~, 3 HNEW( NCOL, NROW , NLAY1 ------------------------------------------------------------------ I c” Cl ------PROCESS EACH HORIZONTAL CELL LOCATION DO 10 IR=lrNROW DO 10 IC=lrNCOL C C&.-- SET THE LAYER INDEX EQUAL TO 1 IL=1 C C3------ IF OPTION2 IS SPECIFIEDTHEN GET LAYER INDEX FROM IEVT ARRAY IF(NEVTOP.EQ.2)IL=IEVT(IC,IR) C c4 ------IF THE CELL IS EXTERNAL IGNOREIT. IF(IBOUND(IC, IR, IL) .LE.O)GO TO 10 C=EVlR(IC, IR) S=SURF(IC,IR) H=HNEW(IC,IR,IL) C C5------ IF AQUIFER HEAD IS GREATER THAN OR EQUAL TO SURF, ET IS CONSTANT 1FtH.LT.S) :5A -----SUBTRACT C C+--- GO TO 5 -EVTR FROM RHS RHS(IC,IR,IL)=RHS(IC,IR,IL) GO TO 10 + C IF DEPTH TO WATER>=EXTINCTION DEPTH THEN ET IS 0 5 D=S-H X=EXDP(IC,IR) IF(D.G!t.X)GO TO 10 C c7------LINEAR RANGE. ADD ET TERMS TO BOTH FU-ISAND HCOF. RHS(IC,IR,IL)=RHS(IC,IR,IL)+C-C*S/X HCOF(IC, IR, IL)=HCOF(IC, IR, IL)-C/X 10 CONTINUE C C8------RETURN RETURN END 1o-22 List Variable Range C D EVTR EXDP H HCOF Module Module Package Package Module Global HNEW Global BOUND Global IC IEVT Module Package IL I OUT IR NCOL NEVTOP Module Global Module Global Package NLAY NROW RHS Global Global Global s SURF X Module Package Module of Variables for Module EVTlFM Definition Maximum ET rate. Depth to water. DIMENSION (NCOL,NRDW), Maximum ET rate. DIMENSION (NCOL,NROW), Extinction depth. Head in the cell. DIMENSION (NCOL,NROW,NLAY), Coefficient of head in the cell (J,I,K) in the finite-difference equation. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Index for columns. DIMENSION (NCOL,NROW), Layer number, for each horizontalcell location, from which ET will be taken if the ET option (NEVTOP) is equal to two. Index for layers. Primary unit number for all printed output. IOUT = 6. Index for rows. Number of columns in the grid. ET option. = 1, ET is from the top layer. = 2, ET at each horizontal cell location is from the layer specified in the layer-indicator array (IEVT). Number of layers in the grid. Number of rows in the grid. DIMENSION (NCOL,NROW,NLAY), Right hand side of finiteRHS is an accumulation of difference equation. terms from several different packages. ET surface elevation for a cell. DIMENSION (NCOL,NROW), Elevation of the ET surface. Extinction depth for a cell. lo-23 Narrative This module calculates evapotranspiration. 1. Clear the 2. If budget terms be accumulated. rate for rates and volumes accumulator will Module EVTlBD be saved, clear will flow Process each horizontal-cell location t"i evapotranspiration (STEPS 4-11). Set the layer (IL) index equal If option 2 is in effect, array (IEVT). indiczior 6. If the cell 8. If the depth to the water further 9. 10. Calculate Subtract If the to tii'buffer 12. to write 13. processing the the of this ET flow into ET flow cell-by-cell (BUFF). layer is greater cell equal calculating bypass from the layer- processing of the the model using accumulator the extinction depth, linear approximaition. (RATOUT). are to be saved, add the If the cell-by-cell flow terms the buffer (BUFF) onto a disk. are to be saved, call the 14. Add RATOUT multiplied ulators in VBVL for printing 15. Move the 16. Increment 17. RETURN. VBVL array for ET budget-term the budget-term labels counter lo-24 length to VBNM for (MSUM). ET rate module UBUDSV by BASlOT. printing by the time-step by BASlOT. cell. than the elevation of the to the maximum ET rate. terms Move RATOUT into flow index is greater than the cell. SKIP STEP 9. from the (BUFF) in which one at a time (IBOUND 5 0), 7. If the head in the aquifer ET surface, set the ET rate for the SKIP STEPS 8 AND 9. bypass the buffer to one. get the is external by RATOUT. they 4. removed from the aquifer to the printing volume accumby BASlOT. Flow Chart RATOUT is an accumulator all flows out of the are added. for to which aquifer BUFFER is an array in which values are stored as they are being gathered for printing or recording. IEVT is an array containing a layer indicator for each horizontal cell location. For each horizontal cell location, it indicates the layer number of the cell at that location from which ET is taken. It is used only if NEVTOP is equal to two. SURF is an array containing the ET surface elevation for each horizontal cell location. Q is the flow individual to ET from an cell. VBVL is a table of budget entries calculated by component-of-flow packages for use in calculating the volumetric budget. VBNM is a table of labels budget terms. for 10-25 Module EVTlBD SUBROUTINE EVTlBDt NEVTOP,IEVT, EVTR, EXDP, SURF, IBOUND, HNEW, 1 NCOL, NROW,NLAY, DELI, VBVL, VBNM,MSUM,KSTP, KPER, 2 IEVTCB, ICBCFL, BUFF, IOUT) C-----VERSION 1608 12MAY1987 EVTlBD ****************************************************************** : CALCULATE VOLUMETRIC BUDGET FOR EVAPOTRANSPIRATION ****************************************************************** C : C SPECIFICATIONS: --------_--------------------------------------------------------CHARACTER*4 VBNM,TEXT DOUBLE PRECISION HNEW DIKNSION IEVT(NCOL,NROW)rEVTR(NCOL,NROW)rEXDP(NCO), 1 SURF(NCOL,NROW)rIBOUND(NCOL,NROW,NLAY)r 2 VBVL(4,20)rVBNM(4,20)rHNEW(NCOL,NR~,NLAY~, BUFF(NCOL,NROW,NLAY) 3 DIMENSION TEXT(4) DATA TEXT(l)rTEXT(Z)rTEXT(3),~~(4) /’ ‘,’ ‘,’ ‘,’ ET’/ 5 Cl ------CLEAR ME RATE ACCUMULATOR. RATOUT=O C c2---.IF CELL-BY-CELL FLOW TERMS WILL BE SAVED THEN CLEAR THE BUFFER. IBD=O IF(IEVTCB.LE.0 .OR. ICBCFL.EQ.0) GO TO 5 IBD=l DO 4 IL=lrNLAY DO 4 IR=lrNROW DO 4 IC=lrNCOL BUFF(IC,IR,IL)=O. 4 CONTINUE C c3 ------PROCESS EACH HORIZONTAL CELL LOCATION 5 DO 10 IR=lrNROW DO 10 IC=l,NCOL C c4 ------SET THE LAYER INDEX EQUAL TO 1 IL=1 C C5------ IF OPTION 2 IS SPECIFIED THEN GET LAYER INDEX FROM IEVT ARRAY ~F(NEVTOP.EQ.Z)IL=IEVT(IC,IR) C (36--IF CELL IS EXTERNAL THEN IGNORE IT. IF(IBOUND(IC,IR,IL) .LE.O)GO TO 10 C=EVTR(IC, IR) S=SURF(IC, IR) 1O-26 H=HNEW(IC,IR,IL) C C7------ IF AQUIFER HEAD => SURF,SET Q=MAX ET RATE 1FtH.LT.S) GOTO 7 El-F0 9 C DEFTH=>EXTINCTION DEPTH, ET IS 0 c8------IF 7 X=EXDP(IC,IR) D=!3-H IF(D.GE.X)GO TO 10 & ------LINEAR RANGE . O.=-EVTR(H-EXEL)/EXDP Q=C*D/X-C C Cl()--ACCUMULATETOTAL FLOW RATE 9 RATOUT=RATOUT-Q C Cll--IF CELL-BY-CELL FLOW TERMS TO BE SAVED THE ADD Q TO BUFFER. IF(IBD.EQ.l) BUFF(IC,IR,IL)=Q 10 CONTINUE C C12---IF C-B-C TO BE SAVED CALL MODULEUBUDSV TO RECORDTHEM. IF(IBD.EQ.11 CALL UBUDSV(KSTP,KPER,TEXT,IEVTCB,BUFF,NCGL,NRW, NLAY, IOUT) 1 C Cl3----- C Cl4----- C Cl5-..--- MOVE TOTAL ET RATE INTO VBVL FOR PRINTINGBY BASlOT. VBVL(3,MSUM)=O. VBVL(4,MSUM)=RATOUT ADD ET(ET-RATE TIMES STEP LENGTH) TO VBVL VBVL(l,MSUM)=O. VBVL(2,MSUM)=VBVL(2rMSUM)tRATOUT*DELT MOVE BUDGET TERM LABELS TO VBNM FOR PRINT BY MODULEBASlOT VBNM(lrMSUM)=TEXT(l) VBNM(2rMSUM)=TEXT(2) VBNM(3rMSUM)=TEXT(3) VBNM(4rMSUM)=TEXT(4) C Cl&--- INCREMENT BUDGET TERM COUNTER MSUM=MSUM+l C Cl7 -----RETURN RETURN END 1O-27 List Variable of Variables Global C D DELT EVTR EXDP H HNEW Module Module Global Package Package Module Global IBD Module I BOUND Global IC ICBCFL Module Global I EVT Package IEVTCB Package IL I OUT IR KPER KSTP Module Global Module Global Global MSUM NCOL NEVTOP Global Global Package NLAY NROW Global Global Module Module EVTlBD Definition Range BUFF DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. Maximum ET rate at a cell. Depth to water below the ET surface. Length of the current time step. DIMENSION (NCOL,NROW), Maximum ET rate. DIMENSION (NCOL,NROW), Extinction depth. Head in the cell. DIMENSION (NCOL,NROW,NLAY), Most recent estimz.te of HNEWchanges at each iteration,, head in each cell. Flag. = 0, cell-by-cell flow terms for this package will not be recorded. f 0, cell-by-cell flow terms for this package will be recorded. DIr4ENsION (NC~L,NR~W,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Index for columns. Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. + 0, cell-by-cell flow terms will be recorc!ed for the Q for current time step. DIMENSION (NCOL,NROW), Layer number for each rorizontalcell location from which ET will be taken if the El option (NEVTOP) is equal to two. Flag. If IEVTCB > 0 and ICBCFL f 0, cell-by-cell flow terms for the EVTl Package will be recordec on UNIT = I EVTCB. Index for layers. Primary unit number for all printed output. IOUT = 6,, Index for rows. Stress period counter. Reset at the start of each stress Time step counter. period. Counter for budget entries and labels in VBVL and VBNM. Number of columns in the grid. ET option. = 1, ET is from the top layer. = 2, ET at each horizontal-cell location is from the layer specified in the layer-indicator array (IEvT). Number of layers in the grid. Number of rows in the grid. Flow from ET into the cell. (Reverse the sign to get the flow to ET.) lo-28 a a List Variable of Variables for Module EVTlBD (Continued) Definition Range RATOUT Module S SURF TEXT VBNM Module Package Module Global VBVL Global X Module Accumulator for the total flow out of the flow field to ET. Elevation of the ET surface for a cell. DIMENSION (NCOL,NROW), Elevation of the ET surface. Label to be printed or recorded with the array data. DIMENSION (4,20), Labels for entries in the volumetric budget. DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (2,N), Rate for the current time step out of the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. Extinction depth for a cell. 10-29 CHAPTER 11 GENERAL-HEAD BOUNDARYPACKAGE Conceptualization The function cally similar of the General-Head to that into or out of a cell tion to the difference assigned of the River, i,j,k, flow into the cell where Qbi , j ,k iS the flow into i,j,k between in figure right level hb regardless i,j,k is rises source Cell cell in figure of porous flow i.e. is the holds hbi,j,k is the head in cell source the is cbi,j,k i,j,k; source the link 44 shows no mechanism to limit head relationship source; and the external 44, which by the block and the (78) and cell and hi,j,k factors; in propor- is established, from the The constant-head 44. of other represented i,j,k hi,j,k, flow - hi,j,k) source source; in that is provided Thus a linear (hbi,j,k The relationship figure hbi,j,k. between the external on the and ET Packages, = Cbi,j,k to the external apparatus (GHB) Package is mathemati- and head in the cell head assigned schematically Drain from an external source, Qbi,j,k the conductance Boundary between the head in the cell, to the external between and Implementation is is shown represented source between the i,j,k. by the head at the source and cell material Cbi,j,k. Note that in either direction as hi,j,k or falls. A graph of Qbi,j,k versus hi,j,k as given In contrast to the River, Drain figure 45. provides no limiting value of flow direction; and as the head difference increases, flow into by equation and ET Packages, to bound the linear between cell or out of the cell 11-l (78) continues i,j,k the GHB Package function in either and the to increase is shown in source without 0 hbiJ,k T Cell i,j,k Conductance, Cbi,j,k between source and cell i,j,k Figure 44.-Schematic diagram illustrating principle of general-head boundary package. 11-2 Constant-head Source Positive Qb Indicates Flow into Aquifer 0 Negative Qb indicates Flow into Boundary Source Figure 45.-Plot of flow, Qb, from a general-head boundary source into a cell as a function of head, h, in the cell where hb is the source head. 11-3 limit. Care must accordingly insure that during the unrealistic course Because it flows Qbi,j,k of equation left HCOF and RHS of equation subtracting Cbi,j,khbi,j,k into the GHB Package to or out of the system do not develop of simulation. must be added to the sions be used in utilizing the term cbi,j,k from RHSi,j,k (78) side of equation (26), from is defined this HaFi,j,k as the matrix 11-4 as an inflow (24). In terms is accomplished and subtracting equations to the aquifer of the expres- in the model by the term are assembled. General-Head Boundary Package Input Input for the General-Head specified in IUNIT(7). Boundary (GHB) Package is read from the unit FOR EACH SIMULATION GHBlAL 1. Data: Format: IGHBCB 110 MXBND 110 FOR EACH STRESS PERIOD GHBlRP 2. Data: Format: ITMP I10 3. Data: Format: Layer Row Column I10 110 110 Boundary Head F10.0 (Input item 3 normally consists of one record for ITMP is negative or zero, item 3 is not read.) Cond F10.0 each GHB. If Explanation Input MXBND--is of Fields Used in Instructions the maximum number of general-head IGHBCB--is a flag and a unit boundary cells at one time. number. If IGHBCB > 0, it If IGHBCB = 0, cell-by-cell is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL (see Output Control) is set. flow terms will not be printed or recorded. If IGHBCB < 0, boundary whenever ITMP--is a flag leakage for each cell ICBCFL is set. will be printed and a counter. If ITMP < 0, GHB data from the preceding If ITMP 2 0, ITMP is the number of general-head current stress period. 11-5 stress period will boundaries be reused. during the Layer--is the layer boundary. number of the cell Row--is the Column--is the column number of the boundary. Boundary row number of the cell head--is the head on the Cond--is the hydraulic conductance cell and the boundary. affected affected cell by the head-dependent by the head-dependent affected boundary. by the head-dependent boundary. of the 11-6 interface between the aquifer I . . -3 -3 3030 I aOaao” . . 11-7 Module Documentation The General-Head which are called GHBlAL Boundary the Package Allocates Calculates flow boundary boundary boundary Adds the terms HCoFi,j,k an array the of four that rates list head, (BNDS). and boundary containing m. accumulators respectively. and accumulated to and from general-head 11-8 modulI?s, contains -Cm and -CmHBm to the and RHSi,j,k, Package are: (Cm) of each cell general-head GHBlBD The modules general-head Reads location, Boundary (GHBl) consists space for conductance GHBlFM General-Head by the MAIN program. the GHBlRP for volume of boundaries. all of Narrative This module allocates head boundaries Print 1. MXBND (the unit indicating cell-by-cell that number for in the flow and initialize cell-by-cell point should flow of general- NBOUND to the first is currently terms boundaries) or a flag be printed). element pointing the amount of space needed for for each boundary--row, add it to ISUM so that in list maximum number of general-head terms to ISUM which values element the in the boundary to the first unallocated X array. Calculate 4. to store the package saving Set LCBNDS, which will (BNDS), equal element X array boundaries). and IGHBCB (the list space in the a message identifying Read and print 3. Module GHBlAL (GHB). (number of general-head 2. for it column, continues the boundary layer, head, to point to the list and conductance) first (five and unallocated X. 5. Print the 6. RETURN. number of elements in the X array 11-9 used by the GHB Package. Flow Chart for Module GHBlAL NBOUNOis the number of general-head boundaries being simulated at any given time. MXBNO is the maximum number of general-head boundaries simulated. IGHBCB is a flag and a unit number. If IGHBCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. If IGHBCB = 0, cell-by-cell terms will not be printed If IGHBCB < 0, the for each cell will whenever ICBCFL is 1 flow or recorded. boundary leakage be printed set. READ AND PRINT MXBND AND LCBNOS is the location in the X array of the list of general-head boundaries data (BNDS). BNDS is a table containing general-head boundaries. data for SET LCBNDS EQUAL TO LOCATIOI(I OF FIRST ELEMENT OF BNDS LIST I I CALCULATE AMOUNT OF SPACENEEDED FOR BNDS LIST PRINT AMOUNT OF SPACE USED BY THE GHB 11-10 4 B SUBROUTINE GHBl AL(ISUM,LENX, LCBNDS,NBOUND,MXBND,IN, 1 IOUT, IGHBCB) C C-----VERSION 1610 12MAY1987GHBlAL ****************************~************************************* C C ALLOCATE ARRAY STORAGE FOR HEAD-DEPENDENTBOUNDARIES ****************************************************************** C C C SPECIFICATIONS: ----------------------------------------------------------------------------------------------------------------------------------c" El ------IDENTIFY PACKAGE AND INITIALIZE # OF GENERAL HEAD BOUNDS WRITE(IOUT,l)IN 1 FORMAT(lHO,‘GHBl -- GHB PACKAGE, VERSION 1, 9/l/87’ # 1' INPUT READ FROM UNIT',131 NBOUND=O C C2--- Cg.-- READ AND PRINT MXBND AND IGHBCB(MAX # OF BOUNDS AND UNIT FOR CELL-BY-CELL FLOW TERMS FOR GHB) READtIN, MXBND,IGHBCB 2 FORMAT(2110) WRITE(IOUT,3) MXBND 3 FORMATtlH r’MAXIMUM OF’,I5,’ HEAD-DEPENDENTBOUNDARYNODES’) IF(IGHBCB.GT.0) WRITE(IOUT,9) IGHBCB 9 FORMAT(lX,‘CELL-BY-CELL FLOW WILL BE RECORDEDON UNIT',131 IF(IGHBCB.LT.0) WRITE(IOUT,8) 8 FORMATtlX, ‘CELL-BY-CELL FLOW WILL BE PRINTED WHEN ICBCFL NOT 0’ 1 C C3------ SET LCBNDS EQUAL TO ADDRESS OF FIRST UNUSED SPACE IN X. LCBNDS=ISUM C c4------CALCULATE AMOUNTOF SPACE USED BY THE GENERAL HEAD LIST. ISP=S*MXBND IsuM=IsuMtIsP C c5------PRINT AMOUNTOF SPACE USED BY THE GHB PACKAGE WRITE(IOUT,4) ISP 4 FORMATtlX, 18,' ELEMENTS IN X ARRAY ARE USED FOR HEAD’, 1 ‘-DEPENDENT BOUNDARIES’ 1 ISUMl=ISUM-1 WRITE(IOUT,5) ISUMlrLENX 5 FORMATtlX,18,’ ELEMENTS OF X ARRAY USED OUT OF’ ,181 IF(ISUMl.GT.LENX) WRITE(IOUT,6) ***X ARRAY MUST BE DIMENSIONED LARGER***‘) 6 FORMATt1X, ’ C C6------RETURN RETURN END l 11-11 List Variable of Variables for Range Module GHBlAL Definition IGHBCB Package Flag and a unit number. > 0, unit number on which the cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, boundary leakage for each cell will be printed whenever IGHBFL is set. IN Package Primary will unit number from which be read. IOUT Global Primary unit ISP Module Number of words in the ISUM Global Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. I SUM1 Module ISUM-1. LCBNDS Package Location in the X array BNDS. LENX Global Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. MXBND Package Maximum number of head boundaries time. NBOUND Package Number of head boundaries stress period. number for 11-12 all input printed X array of the active for by this element active during package IOUT = 6. output. allocated first this module. of array at any one the current Narrative This 1. flag module reads data to build Read ITMP. indicating that Test ITMP. 2. data read for that effect the last (MXBND). the general-head ITMP is stress boundary number of general-head from the previous greater less period stress than zero, will the list. boundaries or a should be reused. period general-head be reused. or equal this stress period If NBOUNDis the to zero, period. stress number of general-head stress Print for than (NBOUND) in the current Compare the current period If boundaries head boundaries 5. data ITMP is general-head 4. ITMP is the Module GHBlRP Print boundary a message to and RETURN. If 3. for to the than is the number of Set the period number of general- equal boundaries number specified greater it to ITMP. (NBOUND) in the as the maximum for the simulation MXBND, STOP. number of general-head boundaries in the current stress (NB~UND). 6. See if in the current there stress are any general-head period (NBOUND = 0), boundaries. bypass If further there boundary are none processing (SKIP STEP 7). 7. Read and print each general-head 8. the layer, row, column, boundary. RETURN. 11-13 head, and conductance for Flow Chart for Module GHBlRP ITMP is both a flag and a counter. If it is greater than or equal to zero, it is the number of general-head boundaries to be simulated during the stress period. If it is less than zero, it indicates that the boundaries simulated in the last stress period should be simulated in the current stress period. 2A PRINT A MESSAGE SAYING THAT OLD DATA WILL BE REUSED MXBND is the maximum number of general-head boundaries to be simulated. SET NUMBER OF BOUNDARIES~ EQUAL TO ITMP OF GENERALHEAD BOUNDARIES t SUBROUTINE C GHB1RP(BNDS,NBOUND,MXBND,INrIOUT) E-----VERSION 1651 02FEB1983 GHBlRf’ ****************************************************************** C C C C READ DATA FOR GHB ****************************************************************** E SPECIFICATIONS: -----------------------------------------------------------------DIMENSION BNDStSrMXBND) ------------------------------------------------------------------ : Cl---- C READ ITMP(# OF GENERAL HEAD BOUNDS OR FLAG TO REUSE DATA.) READtIN, ITMP 8 FORMATtIlO) C2------TEST ITMP IF(ITMP.GE.0) C (-3.A---- GO TO 50 IF ITMP<OTHEN WRITE(IOUTs7) 7 FORMAT(lHO,‘REUSING 1 ' PERIOD') GO TO 260 REUSE DATA FROM LAST STRESS PERIOD HEAD-DEPENDENT BOUNDS FROM LAST STRESS’, C C3------ IF ITMF'=>OTHEN IT IS THEI OF GENERAL HEAD BOUNDS. 50 NBOUND=ITMP C c4------IF MAXNUMBER OF BOUNDS IS EXCEEDED THEN STOP IF(NBOUND.LE.MXBND) GOTO 100 C WRITE(IOUT,99) NBOLJNDrMXBND 99 FORMAT(lHOr’NBOUND(‘,I4,‘) IS GREATER C4A-----ABNORMAL STOP C c5 ------PRINT # THANMXBND('rI4,')') STOP OF GENERAL HEADBOUNDS THIS STRESSPERIOD 100 WRITE(IOUT,l) NBOUND 1 FORMAT(lHO,//lX,I5,' HEAD-DEPENDENT BOUNDARY NODES’) C C&--- IF THERE ARE NO GENERAL HEAD BOUNDS THEN RETURN. IF(NBOUND.EQ.0) GO TO 260 :7 ------READ a PRINT WRITE(IOUT,3) DATA FOR EACH GENERAL HEAD BOUNDARY. 3 FORMAT(lHOrl5X,‘LAYER’r5X,‘ROW’,5X 1r'COL ELEVATION CONDUCTANCE C BOUND NO.‘/lX,15X,60(‘-‘1) DO250 II=lrNBOUND READ (IN,41 K,I,J,BNDS(4rII),BNDS(5,11) 4 FORMAT(3110,2FlO.O) WRITE(IOUT, K,I,J,BNDS(4,II)rBNDS(SrII)rII 5 F0RMAT(1X,15X,14,19,18,G13.4,G14.4,18) BNDS(l,II)=K BNDS(2,II)=I BNDS(3,II)=J 250 CONTINUE C8------RETURN 260 RETURN END 11-15 List of Variables for Module GHBlRP Definition Variable Range BNDS Package DIMENSION (5,MXBND), Layer, row, column, head and conductance from boundary for each generalhead boundary. I Module Row number. II Module Index IN Package Primary will unit number from which be read. IOUT Global Primary unit I TMP Module Flag or number of boundaries. 2 0, number of bounds active during the current stress period. < 0, same bounds active during the last stress period will be active during the current stress period. J Module Column number. K Module Layer MXBND Package Maximum number of head boundaries time. NBOUND Package Number of head boundaries stress period. for general-head boundaries. number for all input printed for this output. package IOUT = 6,, number. Ii-16 active active during at an,y one the current Narrative This ulators module adds terms for Module GHBlFM representing riverhead boundaries to zero in the current to the accum- HCOF and RHS. 1. period, If there NBOUNDis less For each boundary 3. Determine 4. If the cell boundary row (IR), (IC), is external (IBOUND(IC, and go on to the next If the cell 6. Add the to the accumulator boundaries. in the BNDS list, the column 5. 7. or equal are no general-head 2. on this than is internal, -C*HB term RETURN. DO STEPS 3-6. and layer IR, (IL). IL) 2 0), bypass processing one. get the boundary (C is the conductance RHS and the term stress data and HB is the boundary -C to the accumulator RETURN. 11-17 (head and conductance). HCOF. head) Flow Chart for RHS is an accumulator in which the right hand side of the equation is formulated. HCOF is an accumulator which the coefficient head in the cell is formulated. Module GHBlFM (iG---) 1 in of DETERMINE ROW. COLUMN, LAYER CONDUCTANCE 1 ADD TERMS TO RHS AND HCOF FOR THIS CELL 11-18 6 B SUBROUTINE GHBlFM( NBOUND,MXBND,BNDS, HCOF,R-6, 1 IBOUND, NCOL,NRW, NLAY1 C GHBlFM C-----VERSION 1037 lOAPR1985 ***********************~****************************************** C ADD GHB TERMS TO RHS AND HCOF C ***+************t************************************************* C C SPECIFICATIONS: C ----------_------------------------------------------------------DIMENSION BNDS(5rMXBND),HCOF(NCOL,NLAY), C 1 C C Cl--- C c2---.. RHS(NCOL,NRW,NLAY)rIBOUND(NCOL,NRCW,NLAY1 ------------------------------------------------------------------ IF NBOUND<=OTHEN THERE ARE NO GENERAL HEAD BOUNDS. IF(NBOUND.LE.0) RETURN RETURN. PROCESS EACH ENTRY IN THE GENERAL HEAD BOUND LIST (BNDS) DO 100 L=l,NBOUND C C3------ GET COLUMN, ROW AND LAYER OF CELL CONTAINING BOUNDARY IL=BNDS(l,L) IR=BNDS(ZrL) IC=BNDS(3,L) C c4------IF THE CELL IS EXTERNAL THEN SKIP IT. IF(IBOUND(IC,IR,IL).LE.O) GO TO 100 C C5------ SINCETHE CELL IS HB=BNDS(4rL) INTERNAL GET THE BOUNDARYDATA. C=BNDS(5rL) C @j-m-- C ADD TERMS TO RHS AND HCOF HCOF(IC,IR,IL)=HCOF(IC,IR,IL)-C RHS(IC,IR,IL)=RHS(IC,IR,IL)-C*HB 100 CONTINUE C7------RETURN RETURN END l 11-19 List of Variables for Module GHBlFM Definition Variable Range BNDS Package DIMENSION (S,MXBND), Layer, row, column, head and conductance from boundary for each generalhead boundary. C Module Conductance HB Module Head on boundary. HCOF Global DIMENSION (NCOL,NROW,NLAY), Coefficient the cell (J,I,K) in the finite-difference IBOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell IC Module Index for columns. IL Module Index for layers. IOUT Global Primary IR Module Index for rows. L Module Index for boundaries. MXBND Package Maximum from the external unit number for number of all head boundary. of each cell. printed boundaries of head in equation. output. active 113UT= 6. at an!! one time. NBOUND Package Number of head boundaries stress period. NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the RHS Global DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. 11-20 in the in the active during the current grid. grid. grid. Narrative This module calculates and general-head accumulator 2. to step 3. the If there 13 and put zeros Test flag into to see if transferred flow-term flag time cell-by-cell between the aquifer (IBD) and the will terms terms flow (NBOUND = 0), for terms rate (ICBCFL = 0) or boundaries will be accumulated general-head conditions down boundaries. hold: (2) cell-by-cell during be saved for skip are to be saved on disk. of the following general-head flow they either step boundaries the budget cell-by-cell not be saved if not the proper in which cell-by-cell are no general-head are not needed for If and volumes (RATOUT). They will is rates Module GHBIBD boundaries. Initialize 1. for this this (1) this flow terms simulation package, clear (IGHBCB 2 0). the (BUFF) and set the cell-by-cell buffer flow-term (IBD). 4. For each general-head from or into 5. of this general-head Determine general-head 6. the If the boundary, DO STEPS 5-13 accumulating flows boundary. row, column, and layer of the cell containing the boundary. the cell is external (IBOUND(I,J,K) 5 0), bypass further boundary list (BNDS). boundary. 7. Get the 8. Set RATE equal head minus the boundary parameters from the to the boundary head in the cell conductance times (RATE = C*(HB - HHNEW)). 11-21 the boundary processing 9. If ICBCFL # 0), 10. If RATE to the cell-by-cell flow print RATE. budget terms buffer (BUFF). terms for individual cells Check to see whether flow 12. If RATE is negative, add it to RATOUT. 13. If RATE is add it to RATIN. 14. See if saved cell-by-cell (IBD = 1). flow If they are, is into are to be saved, 11. positive, terms call (IGHBCB < 0 and are to be printed add the or out of the aquifer. for individual cells module UBUDSV to record are to be the buffer (BUFF) onto disk. 15. Move RATIN and RATOUT into Add RATIN and RATOUT multiplied accumulators budget-term 16. Basic in VBVL for labels Increment Package for 17. by the time-step printing to VBNM for by BASlOT. printing the budget-term a detailed the VBVL array RETURN. 11-22 length Move the printing to the by BASlOT. volume general-head boundary by BASlOT. counter explanation for (MSUM). See the section of VBVL, VBNM, and MSUM. in the Flow Chart for IBD is a flag which, if set, causes cell-by-cell flow terms for generalhead boundary to be recorded. Module GHBlBD (iii-) 1 lNlTlALlZE FLAG (IBD) AND RATE ACC”MULATORS l--l I I EXTERNAL: a cell is said to be external if it is either no flow or constant an equation is not head (i.e., formulated for the cell). RATE is the leakage rate into the aquifer from the boundary in a cell. BUFFER is an array in which values are stored as they are being gathered for printing or recording. RATOUT is an accumulator to which all flows out of the aquifer are added. RATIN is an accumulator flows into the aquifer ROW. LAYER. AND COLUMN to which all are added. YES C is the conductance between the boundary and the cell. HB is the boundary HHNEW is the GET BOUNDARY PARAMETERS FROM GENERALHEAD ~~s;NDARY head. head in the 6 c CALCULATE RATE=C’(HB-HHNEW cell. 9 IGHBCB is a flag and a unit IF IGHBCBCO AND ICBCFLIO. PRINT RATE number. If IGHBCB > 0, it is the unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. If IGHBCB = 0, cell-by-cell terms will not be printed flow or recorded. If IGHBCB < 0, boundary leakage for each cell will be printed whenever ICBCFL is set. ICBCFL is a flag. If ICBCFL f 0, cell-by-cell flow terms will be either recorded or printed depending on IGHBCB for the current time step. 11-23 10 IF CELL-BY-CELL TERMS TO BE RECORDED (IBDtO) ADD RATE TO BVFFER 1 SUBROUTINE GHBlBDt NBOUND,MXBND,VBNM,VBVL, MSUM,BNDS, DELT, HNEW, NCOL,NROW,NLAY, IBOUND,KSTP,KPER, IGHBCB,ICBCFL,BUFFI IOUT) C C-----VERSION 1612 lZMAY1987 GHBlBD ***************************~**~**~****~**************~*******~**** CALCULATE VOLUMETRIC BUDGET FOR GHB *****************************************************~*******~**** C C C C C SPECIFICATIONS: -------------------I---------------------------------~------------ C CHARACTER*4 VBNM,TEXT DOUBLE PRECISION HNEW DIMENSIONVBNM(4,MSUM)rVBVL(4rMSUM),BNDS(5rMXBND)r 1 HNEW(NCOL,NROW,NLAY)rIBOUND(NCOL,NROW,NLAY~, 2 BUFF(NCOL,NROW,NLAY) DIMENSIONTEXT(4) DATA TEXT(l),TEXT(Z)rTEXT(3)rTEXT(4) /’ HEA’r’D ------_--__------------------------------------------~------------ C C Cl---Cl--- INITIALIZE CELL-BY-CELL FLOW TERM FLAG ACCUMULATORS(RATIN AND RATOUT) IBD=O RATOUT=O. DE’r’P BO’r’UNDS’/ (IBD) AND RATIN=O. C c2----- IF NO BOUNDARIES THEN KEEP ZEROES IN ACCUMULATORS. IF(NBOUND.EQ.0)GOTO 200 C C3------ TEST TO SEE IF CELL-BY-CELL FLOW TERMS ARE NEEDED. IF(ICBCFL.EQ.0 .OR. IGHBCB.LE.0) GOTO 10 :3A -----SINCE CELL-BY-CELL FLOW TERMS ARE NEEDED CLEAR BUFFER 8, SET C3A-m--mTHE FLAG IBD. IBD=l DO 5 IL=l,NLAY DO5 IR=lrNROW DO5 IDlrNCOL BUFF(IC,IR,IL)=O. 5 CONTINUE C c4------FOR EACH GENERAL HEAD BOUND ACCUMULATEFLOW INTO AQUIFER 10 DO 100 L=lrNBOUND C C5------ GET LAYER, ROW AND COLUMNOF EACH GENERAL HEAD BOUNDARY. IL=BNDS( 1, L) C (3j--- IR=BNDS(ZrL) IC=BNDS(3,L) IF CELL IS EXTERNAL THEN IGNOREIT. IF(IBOUND(IC,IR,IL).LE.O) GOTO 100 11-24 C C7------ GET PARAMETERSFROM BOUNDARYLIST. HHNEW=HNEW(IC,IR,IL) HB=BNDS(4rL) C=BNDS(5rL) C C+--- CALCULATE THE FOW RATE INTO THE CELL RATE=C*( HB-HHNEW1 C c9 ------PRINT THE INDIVIDUALRATES IF REQUESTED(IGHBCB<O). IF(IGHBC3.LT.O.AND.ICBCFL.NE.O) WRITE(IOUT,900)(TEXT(N)rN=1,4), 1 KPER, KSTP, L, IL, IR, IC, RATE BOUNDARY’,14, 900 FORMAT(lHD,4A4,' PERIOD'rI3,' STEP’rI3,’ RATE’ rG15.7) COL’rI4,’ LAYER',I3r' ROW’rI4,’ 1' C (-Jl()--- C Cll--C IF CELL-BY-CELL TERMS ARE TO BE SAVED THEN PUT RATE IN IF(IBD.EQ.l) BUFF(IC,IR,IL)=BUFF(IC,IR,IL)+RATE BUFFER SEE IF FLOW IS INTOAaUIFEROR OUT OF AQUIFER. IF(RATE)94,100,96 FLOW IS OUT OF AQUIFER SUBTRACT RATE FROMRATOUT 94 RATOUT=RATOUT-RATE GO TO 100 c12--- C Cl3----- FLOW IS INTOAQIFERADD RATE TO 96 RATIN=RATINtRATE RATIN 100 CONTINUE C Cl4----- IF CELL-BY-CELL TERMS ARE TO BE SAVED THEN CALL Cl4----- UTILITY MODULEUBUDSV IF( IBD. EQ. 1) CALL UBUDSV(KSTP,KPERrTEXT, IGtBCB,BUFF, NCOL,NRW, NLAY,IOUT) 1 El5-----MOVE RATES, VOLUMESAND LABELS INTO ARRAYS FOR PRINTING 200 VBVL(3rMSUM)=RATIN VBVL(lrMSUM)=VBVL(lrMSUM)+RATIN*DELT VBVL(4,MSUM)=RATOUT VBVL(2,MSUM)=VBVL(2,MSUM)+RATOUT*DELT VBNM(l,MSUM)=TEXT(l) VBNM(2,MSUM)=TEXT(2) VBNM(3,MSUM)=TEXT(3) VBNM(4,MSUM)=TEXT(4) C16--- INCREMENT THE BUDGET TERM COUNTER MSUM=MSUMtl C Cl7 -----RETURN RETURN END 11-25 List Variable Range BNDS Package BUFF Global C DELT HB HHNEW HNEW Module Global Module Module Global IBD Package IBOUND Global XC I GHBCB Module Package ICBCFL Global IL IOUT IR KPER KSTP Module Global Module Global Global L MSUM MXBND NBOUND Module Global Package Package NCOL NLAY NROW Global Global Global of Variables for Module GHBlBD Definition DIMENSION (5,MXBND), Layer, row, column, head and conductance from the boundary for each generalhead boundary. DIMENSION (NcOL,NR~W,NLAY), Buffer used to accumulate information before printing or recording it. Conductance from the external boundary. Length of the current time step. Head on boundary. HNEW (J,I,K), Single precision. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEW changes at each iteration. head in each cell. Flag. = 0, cell-by-cell flow terms for this package will not be recorded. # 0, cell-by-cell flow terms for this package will be recorded. DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Index for columns. Flag and a unit number. > 0, unit number on which cell-by-cell flow terms will be recorded whenever ICBCFL is set. = 0, cell-by-cell flow terms will not be printed or recorded. < 0, boundary leakage for each cell will be printed whenever ICBCFL is set. Flag. = 0, cell-by-cell flow terms will not be recorded or printed for the current time step. f 0, cell-by-cell flow terms will be either printed or recorded (depending on IGHBCB) for ::he currlent time step. Index for layers. Primary unit number for all printed output. IOUT = 6. Index for rows. Stress period counter. Reset at the start of each stress Time step counter. period. Index for general-head boundaries. Counter for budget entries and labels in VBVL and VBNM. Maximum number of head boundaries active at any one time. Number of head boundaries active during the current stress period. Number of columns in the grid. Number of layers in the grid. Number of rows in the grid. 11-26 List Variable of Variables for Module GHBlBD (Continued) Range RATE Module RATIN Module RATOUT Module TEXT VBNM Module Global VBVL Global Definition Flow from a bound into a cell. (Reverse the sign to get flow into the bound.) Accumulator for the total flow into the flow field out of the bounds. Accumulator for the total flow out of the flow field into the bounds. Label to be printed or recorded with the array data. DIMENSION (4,20), Labels for entries in the volumetric budget. DIMENSION (4,20), Entries for the volumetric budget. For flow component N, the values in VBVL are: (l,N), Rate for the current time step into the flow field. (2,N), Rate for the current time step out of the flow field. (3,N), Volume into the flow field during simulation. (4,N), Volume out of the flow field during simulation. 11-27 CHAPTER 12 STRONGLY IMPLICIT PROCEDUREPACKAGE Conceptualization and Implementation General The discussion here uti lizes analysis noted of the Strongly certain In addition provide equations cell, i,j,k, t CRi,j+l/E,khi,j+l,k t cvi ,j,ktl/2hi One equation expressing each of the six equation the relationship grid, for for itself here. linear a single + CRi,j-1/2,khi,j-1, - Cvi ,j,k+1/2 + HCOPi,j,k)hi,j,k (7% for each cell the equations for the entire grid consists the end of the step. 12-1 step. of head, changes from one equation The solution in the finite-difference among the heads at node i,j,k, up to seven unknown values the node, presented of simultaneous nodes at the end of a time of unknown head values step. Procedure three - CRi,j-1/2,k form is written set at each time Implicit these = RHSi ,j,k* adjacent may involve material, t CCitl/2,j,khi+l,j,k ,j,ktl of this those 2 to be of the form - CCi-1/2,j,k - CCi+l/2,j,k including equation + CCi-1/2,j,khi-l,j,k + (-Cvi,j,k-l/2 - CRi , j+1/2,k system difference .I was shown in Chapter Cvi,j,k-1/2hi,j,k-1 grid, a large presented and numerical reference, the discussion The finite by iteration. algebra background of the Strongly solving (SIP) (1977) or Remson, Hornberger Crichlow to supplement SIP is a method for of matrix to general descriptions may be consulted Procedure in any standard by Peaceman (1977), earlier references Implicit concepts which may be reviewed and Molz (1971). which general Theory Because each and because the to the must be solved of one value and at next through simultaneously of head for each The discussion notation of the notation, equation + hi,j,khi+l,j,k The coefficients in equation they of equation equation (79); (80) with is equivalent + Ei,j,khi,j,k + Si,j,khi,j,k+l = Qi,j,k* all with are labelled the equation is equivalent to for (430) the Thus (79); + HCOFi,j,k) of out in Chapter 2, the in matrix entire set of equations of the form form as (‘31) CA1{hj = id is the matrix head values, (80) two vectors that and (q} Figure l [A] that equation Zi,j,k right-hand of the rows, are all of equations node i,j,k, for elements (h) that located terms coefficient four columns there on just is a vector of of equation matrix and of t1ie and two layers. are very Notice few nonzero seven diagonals, as 47. of equation cLi,j,k-l/2 for these of head, of the is sparse--i.e., in figure Examination (80) is a vector a mesh of three the matrix indicated of coefficients 46 shows the for elements--and Ei,j,k and so on. can be summarized where [A] i,j,k - cci-l/2,j,k (-cvi,j,k-1/2 - CVi,j,k+1/2 index node i,j,k. Of equation cLi,j,k-l/2 to the eXpreSSiOn - CCi+l/2,j,k - CPi,j+1/2k As pointed (80) (80) (80) - CPi,j-1/2k of are associated Of equation z{,j,k of SIP. the developers + Di,j,khi,j-1,k + Fi,j,khi,j+l,k to show that here is based on the (79) may be written. + Bi,j,khi-l,j,k Zi,j,khi,j,k-l- presented Stone and Kwan (1969)) of Weinstein, Using their SIP procedure (79) (79) and (80) appears both and as the coefficient node i,j,k-1, that will show that as the coefficient S in the the term Z in equation corresponding is (;32) = Si,j,k-1 12-2 :: 2 ooooooooooo~oooooooxoo,w 2 24 a, 0 0 0 0 0 0 0 0 0 0 u-j-0 0 0 0 0 0 0 x-o 0 0 0 0 0 $0 0 0 0 0 0 0 fo 0 : oooooo$-ooooooo~ooLLW-nOOmo u co 5 m b w :: l-7 P uTtic.iOo 0~~?0000000000 - 0 24 0 0 m ;: 2 m M & (D :: ul : P c: F.3 a 000~0000000000UrWr000m0000 ~~(I)m~~~~~ooooo~w~oomooooo 0 “0 oooo~~ooooooofooo~~oomooo ul ? m 2 2 ooooo~ooooooo~OGu.Jn-oomoo w M & (D 0 M M $ oooooooocfjmoooooooIooownoo 0 u 2 ooooooooov)‘oooooooIooGwoo 0 0 E ul z m000000 f Tr cn~OOOOOOOOOOOwrnOOmOOOOOOO 2 OOOOOOO~*OO~~WOOOOOOOOOOON 0 0 0 0 0 0 x-0 0 u z LLi-0 0 - ;: r! 0 0 9 0 0 0 0 0 0 0 a 0 I-0 0 U!!,$O 0 0 & OOOO~OOOwm~OOOOOOOOOONOOO 0 c: M ooooox*o00tin~0000000000~00 0 N 0 N &o 0 0 0 0 0 0 $0 0 0 0 0 m ooPoo~~w~n~oo~oooooooN'ooooo co z 0 I”0 0 LmW*&O 0 UI 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 hi0 0 0 0 0 0 0 0 fOOOWmn~OOmmOOOOOOONSOOOOOOO * oou*LJooom*oooooooN-00000000 0 ufuW”dO 0 L&.-W”O”O W-n”0 0 0 Ii”0 0 0 0 0 0 0 0 0 0 0 0 0 COd 0 0 0 0 0 N-O 0 a”0 m*O 0 N 0 z I I 12-3 NCOL * NROW N / NCOL \ / 1 - s - 1 \ / NCOL NCOL iNROW Brackets indicate horizontal spacing, in matrix columns, between nonzero diagonals (e.g., diagonals E and F are adjacent). Figure 47.-Structure of coefficient matrix showing nonzero diagonals. 12-4 Similarly, and Bi,j,k = Hi-l,j,k (83) IIi,j,k = Fi,j-l,k* (84) Replacing with each Z, B, and D coefficient the equivalent yields S, H, or F element, the matrix of Figure Thus the coefficient matrix sparse. A system of equations methods if [L*] in lower is [A] 48, which [A] triangular while are equal into form [U*] CL*] and [U*] r el at ive to [A] has been accomplished, substitution" arises generally even though needed to calculate off errors [U], for [A] of their nonzero sum matrix (1) [A + B] is "close" (2) [L] form, is in lower and all form elements such that are on or below the (all nonzero of Once this factoring and forward However, matrix, of computer elements on the main diagonal [A]. a difficulty CL*] and [U*] are memory and time elements. easily into and [U] meet the following In addition, may be round- a matrix [B] two matrices such that CL] and conditions: to [A]; triangular entries by direct the characteristics seeks to find [A + B] can be factored CL], elements as large. Procedure where [A + B], - (84), as well and [U*], the solution. deal Implicit [L*] known as "backward is a sparse (82) symmetric can be solved illustrates and a great all is a 3 x 3 matrix may become unacceptably The Strongly the (49) a technique not sparse, (81) and all can be used to complete in that, (81) nonzero 46 seen to be symmetric. two matrices (all of Figure by equations readily is in upper triagular Figure to one. is of equation are on or above the main diagonal), [U*] as defined of the form of can be factored main diagonal), in the matrix along form while is in upper triangular the main diagonal of [UJ are equal to unity; 12-5 [U] of 0 0 0 -. 7 c/Y 0 0 f c -. 0 “. N. r r ur u? 0 0 n! N 2 “! Z: 0: 0 0 cc 0 0 0 0 IL- J 0 0 f --. T. c/i- 0 N. --. 0 0 0 Y N. r c. w’ G 0 f6 o 4 $ o o o o o 0 0 0 0 co” 0 0 0 0 r r co” 0 0 0 cl? 0 0 0 0 0 0 0 0 0 0 0 f 0 3 UY f 0 0 r r ll.Y -. c. IL- 0 7. 2 N. _ IL- w- 0 2 f 0 0 *fj -. 2 2 r c. r ‘. 7 r w- Ii- 0 f Liti 0 x -. m -. 7. F;- 0 f 0 0 0 -. 7 co’ 0 12-6 .-P .-c cp E u” . Id [I 1 1 2 -1 0 [ -3 3 Figure 49.-Decomposition of a coefficient matrix into lowerand upper triangular matrices. 12-7 (3) CL1and GUIare (4) both [L] and [U] Suppose a matrix conditions; both sparse; have just [B] the term [B] and four nonzero is constructed {h} diagonals. in an attempt to satisfy can be added to each side these of equation (81) to give CA + Bl{h) A solution for vector equation (81). equation (85) approach to the preceding is, {h) + CBl( h} equation (85) The presence presents is utilized where {ha) is a vector of head values used postulated and [U], above, appropriate matrix of the matrices is subtracted If [B]. from each side CA + Bl {ha} (86) [B] {h"-1) were to the into and backward is equivalent That is actually known, solution properties the sparse matrices substitution. to that the a vector solution The term Thus of finding is pursued an in [A + B] {hg-I} (86) to yield = {q) or = {q) right. R, and {ha-I} easily CL] and [U]. - [A + B] {ha-l} CA + B] {hg - ha-I} of h from the on the (86), according however, [A + B], of an iterative (86) matrix be factored In practice, [A], of {ha-I} the for equation sides if values from iteration the use of forward of solving Z), In equation {ha}. [A + B] could allowing + [B] a-1. be straightforward; the problem terms to on both vector in the form = {q} iteration (h} head vector of head values as an approximation of (86) would [L] from be a solution however, (chapter may be expressed [A + B] {hfi) must also difficulty; may be used in the (85) (85) of the vector an immediate solution iteration equation for = {q) -[A] {ha-I) 12-8 - [A] {ha-l} (87) In order that the conditions B] may be satisified, were not present additional for relationship [U] is in [A], diagonals following elements [U], new terms which of these into the equation to i,j,k. of [A + B] and the elements The of [L] where as indicated equations, to elements of [U] above the main diagonal, and [A + diagonals effect heads at nodes not adjacent 50 and 51, a, b, c, and d, refer to elements [L], nonzero 50; the is to introduce between the elements in the six as shown in figure involving as given above for [A + B] must contain nonzero node i,j,k, specified of CL], e, f, and capital in figures and g, refer letters refer to of [A + B]. z'i,j,k = ai,j,k (89-a) A'i,j,k = ai,j,kei,j,k-1 (89-b) T'i,j,k = ai,j,kfi,j,k-l (89-c) B'i,j,k = bi,j,k (89-d) c'i,j,k = ei-l,j,kbi,j,k (89-e) D'i,j,k = ci,j,k (89-f) E'i,j,k = ai,j,kgi,j,k-1 + bi,j,kfi-l,j,k (89-g) + ei,j-l,kci,j,k+di,j,k If and (89-h) F'i,j,k = di,j,kei,j,k G'i,j,k = fi ,j-l,kci H'i,j,k = fi,j,kdi,j,k (89-j) U'i,j,k = bi,j,kgi-l,j,k (89-k) R'i,j,k = gi,j-l,kci,j,k (89-1) s'i,j,k = gi,j,kdi,j,k (89-m) the subscript outside of the The 13 equations of an element grid boundary, contain (89-i) ,j,k in equations the element 20 unknown values, 12-9 (89-a...m) places the element is assumed to be equal the elements of [L], to zero. [U], and NCOL * NROW * / NCOL / A \ 1 - / \ NCOL * 1 - * Marks Diagonals Which Are Not in Matrix x \ 1 L - - 1 Brackets indicate horizontal spacing, in matrix columns, between nonzero diagonals (e.g., diagonals E and D are adjacent); asterisks mark nonzero diagonals which are not present in matrix [A]. \ / / NCOL f NCOL * NROW Figure 50.-Structure of matrix [A+B] showing nonzero diagonals. 12-10 1 \ NCOL \ - 1 / Brackets indicate vertical spacing, in matrix rows, between nonzero diagonals (e.g., diagonals d and e are adjacent). Figure 51 .-Structure, showing nonzero diagonals, of the lower triangular factor [L] and the upper triangular factor [U] of matrix [A+B]. 12-11 [At B]. This added to [A] matrices indicates so that of the must be "close" that the are many matrices sum can be factored form of [L] to [A], there into or equivalently which can be upper and lower However, the and [U]. [B] requirement triangular that [I\ + B] that (90) CA+ Bl {h) = CA1{h) has not yet been used. associated with an individual Z'i,j,khi,j,k-1 of the elements node, t U’i,j,khi-l,j,ktl t S'i,j,khi,j,ktl fj z,j,khi,j,k-1 + U'i,j,khi,j-1,k t R’i,j,khi,j-l,k+l t Fi,j,khi,j+l,k ’ Hi,j,khitl,j,k (91) ,k+l (91) can be rearranged not present in [A] so that are all is made up of differences corresponding elements (zi ,j ,k-z' i,j,k)hi,j,k-l on the between of matrix the terms right elements [A + B], t (Fi,j,k-F'i,j,k)hi,jtl,k t (Hi,j,k-H'i,j,k)hi+l,j,k t (Si,j,k-S’i,j,k)hi,j,ktl n A’i,j,khi,j+l,k-1 t C’i,j,khi-l,jtl,k t U'i,j,khi-1,jktl The terms side, six nonzero while the [A] and of matrix t G’i,j,khi+l,j-1,k (92) t B'i,j,khi,j-1,ktl on the right side of [A t B] not appearing involve the left. t (Bi,j,k-B'i,j,k)hi-l,j,k t (Ei,j,k-E'i,j,k)hi,j,k + T'i,j,khitl,j,k-1 from the i.e. + (Di , j ,k-D' i,j,k)hi,j-1,k B, and all that t Bi,j,khi-l,j,k + Ei,j,khi,j,k t si,j,khi,j diagonals implies {h) t G’i,j,khi+l,j-1,k + H'i,j,khitl,j,k diagonals (90) and [$I t T'i,j,khi+l,j,k-1 t F’i,j,khi,jtl,k + Di,j,khi,j-1,k of [A + B] {h) equation t C’i,j,khi-l,jtl,k t E'i,j,khi,j,k Equation i,j,k, t A'i,j,khi,jtl,k-1 + B'i,j,khi-l,j,k side In terms of (92), in [A], corresponding are all heads at nodes not adjacent 12-12 to the derived to node, six nonzero from the matrix i,j,k; by contrast, the terms involve on the left side of (92) are derived the heads at i,j,k and the six To reduce the effect of the terms to i,j,k, three zero and one, are introduced side of equation ((85) or (86)) iteration is implemented, They are brought parameters. (zi , j,k-Z' i,j,k)hi,j,k-1 of the terms solution multipliers into on the on the equation right role equations of (92) as follows: + (Bi,j,k-B'i,j,k)hi-l,j,k t (Ei,j,k-E’i,j,k)hi,j,k + (Fi,j,k-F'i,j,k)hi,j+l,k + (Hi,j,k-h'i,j,k)hi+l,j,k + (Si,j,k-S’i,j,k)hi,j,k+l (J d’i,j,khi,j+l,k-1 + fiT’i,j,khi+l,j,k-1 + $‘i,j,khi-l,j+l,k + YG’i,j,khi+l,j-1, k + BU’i,j,khi-1,jktl (93) ,j,khi-l,k+l Next the heads on right adjacent to i,j,k, adjacent to i,j,k. jtl, lies which and chosen between of the matrix take + (Ui,j,k-U'i,j,k)hi,j-1,k + d’i and [B], to nodes not adjacent a, B and y, and all as the these [A] nodes. corresponding as multipliers Ultimately, (92). adjacent here termed parameters, from both k-l are: interpolation side are expressed This i,j+l,k; illustrated (93), in terms is done by noting at the corner i,j,k-1; of corresponding of heads at nodes which that, of a rectangle, and i,j,k. in figure to nodes not for example, the other Thus using 52, hi,j+l,k-1 by three the node i, corners rules is given are of in approximately = hi,j+l,k + hi,j,k-1 - hi,j,k* (94-a) hi+l,j,k-l = hi,j,k-l + hi+l,j,k - hi,j,k (94-b) hi-l,j+l,k = hi-l,j,k + hi,j+l,k - hi,j,k (94-c) hi,j+l,k-1 Similarly, 12-13 Suppose the Functionf 1 Is Known at 2,3 and 4. 2 By interpolation the Function at the Center Can be Approximated f,(c) by * f (2) +f (3) 2 and f*(c) - f (1) +f (4) 2 Suppose f, @I -f* (cl Then f (2) +f (3) =f 2 3 (1) +f (4) 2 4 Therefore f (1) -f (2) +f (3) -f (4) Figure 52.-Estimation of a function at one corner of a rectangle in terms of the values of the function at the other three corners. 12-14 hi+l,j-l,k = hi+l,j,k + hi,j-l,k - hi,j,k (94-d) hi-l,j,k+l = hi,j,k+l + hi-l,j,k - hi,j,k (94-e) hi,j-l,k+l = hi,j,k+l + hi,j-l,k - hi,j,k* (94-f) Substituting equations (94-a... - zi,j,k + d'i,j,k (z'i,j,k + BT'i,j,k) (93) + @J'i,j,k) hi-l,j,k + (U'i,j,k - Ui,j,k + s'i,j,k + d'i,j,k) hi,j-l,k + (E'i,j,k - Ei,j,k - d'i,j,k - BT'i,j,k - $'i,j,k - BU'i,j,k - d'i,j,k) - Fi,j,k + d'i,j,k + "C'i,j,k) + (H'i,j,k - Hi,j,k + BT'i,j,k + *'i,j,k)hi+l,j,k + (S'i,j,k - Si,j,k + BU'i,j,k + d'i,j,k)hi,j,k+l approximately in equation equal to zero. gives hi,j,k + (F'i,j,k expressed and reorganizing hi,j,k-1 + $'i,j,k hi,j+l,k (95) can be satisfied Setting these (95) m0 coefficients if each coefficient equal to zero the equations z'i,j,k - zi,j,k + d'i,j,k + BT'i,j,k = 0 (96-a) B'i,j,k - Bi,j,k + $'i,j,k + BU'i,j,k = 0 (96-b) U'i,j,k - Ui,j,k + fi'i,j,k + d'i,j,k = 0 (96-c) E'i,j,k - Ei,j,k - d'i,j,k - BT'i,j,k - $'i,j,k - *'i,j,k - Bu'i,j,k - &'i,j,k = 0 (96-d) F'i,j,k - Fi,j,k + d'i,j,k + $'i,j,k = 0 (96-e) H'i,j,k - Hi,j,k + BT'i,j,k + $'i,j,k = 0 (96-f) S'i,j,k - si,j,k + 8U'i,j,k + d'i,j,k = 0 (96-d Equations (96-a...g) and (89-a... unknowns which when solved, [U] equation - Bi,j,k The relation yields into + (B'i,j,k - YG'i,j,k is f) such that [A + B] is will "close" m) form a system yield the entries to [A], 12-15 of 20 equations of [A t B], and can be readily in 20 [L] factored and into [L] lower and [U], where [L] triangular equations and [U] are both sparse and upper triangular (89-a, -b, and -c) into forms. equation and have the For example, (96-a) required substituting and rearranging yields = zi,j,k/(l + *i,j,k-1 + @fi,j,k-I)* (97-a) bi,j,k = Bi,j,k/(l + Vei-l,j,k + @i-l,j,k) (97-b) ci,j,k = Di,j,k/(l + Yfi,j-1,k + agi,j-1,k) (97-c) ai,j,k Similarly, A'i,j,k = ai,j,kei,j,k-1 (97-d) c'i,j,k = ei-l,j,kbi,j,k (97-e) G'i,j,k = fi, j-l,kci R'i,j,k = gi,j-l,kci,j,k (97-g) T'i,j,k = ai,j,kfi,j,k-1 (97-h) U'i,j,k = bi,j,kgi-l,j,k (97-i ) di,j,k = Ei,j,k (97-f) , j,k + d'i,j,k + *'i,j,k + BT'i,j,k + @'i,j,k + @J'i,j,k + d'i,j,k-ai,j,kgi,j,k-l-bi,j,kfi-l,j,k (97-j 1 - ei,j-l,kci,j,k ei,j,k = (Fi,j,k-d'i,j,k-$'i,j,k)/di,j,k (97-k) f*l,j,k = (Hi,j,k-BT'i,j,k-$'i,j,k)/di,j,k (97-l) gi,j,k = (Si,j,k-d'i,j,k'BU'i,j,k)/di,j,k (97-m) Using these relations be replaced with [LJ[UJ where again to provide the product {ha-ha-l} [L][U] = {q) - [A] the superscript t-1 to the preceding the elements iteration in of [L] and [U], [A + B] may (88) to yield (98) {ha-l) R refers level. to the current We next 12-16 define iteration the level, vector and {RESR} by {RE$} = {q} Using this - [A] notation the {v) D-1 {v) {hR-hRB1} in the equation {hg-ha-l}. {hR-hR-l} In earlier The vector substitution to solve 53-a. used to calculate 53-b. to solve the coefficients were identified the elements in this for way is then the vector linear by the indices the process using elements equation of the equations of the vector sequentially Because all first determined (102) To illustrate renumber the equations in [L] {v), a single of the cells, of forward it and hence the substitution, is convenient index, by matrix to as shown in above the main diagonal represented as equation are (101) d1v1 = RESla In equation (97-j), the is (103) (103), the term dl and RESIR has been calculated vector for = {v) discussions, shown in figure {v) of back substitution of the matrices the forward and backward (101) in a process zero, involves of forward = {REg) ultilized figure by a process in the equation = [U] elements (100) step where {v) [U] can be written can now be solved The first vector (98) = {RE$) (100) substitution. (99) equation [L][U]{hR-hg-I} Equation {hE-l} (RES'); The second equation thus (103) represented has been determined through can be solved by matrix c2v1 + d2v2 = RES2' through equation (99) immediately for equation (101) equation as an element the value of of vl. is (104) 12-17 Layer 1 Layer 2 (a) Cell Numbering With 3 Indices 3ow 1 2 . Layer 1 Layer 2 (b) Cell Numbering Figure 53.-Cell With 1 Index numbering schemes for a grid using three indices and using one index. 12-18 Again, c2 and d2 are known from equations equation (104) (99); using the can be solved The general for value (97), of VI from the and RESZR is known from solution of equation (103), v2. equation for an element of {v) has the form (105) Vn = (RESnR-anVn-NRC-bnVn-NCOL'CnVn-l)/dn where NRC is the number of cells columns in the model, through equations The terms (97) This of {v) triangular The process that, calculation it through of {v} determined equation determined substitution, is possible CL]--i.e., is next (99). [L] of back substitution is {h a-1} vector the [U] When the reversed. corresponding of {v), has only in the lower zeros the elements solving to that to {hg-ha-I} to obtain {hg), of the equation of forward is upper triangular, vector to iteration problem thus is similar because the matrix In summary, the (102). substitution order of has been calculated, the vector of head R. of solving the equation CAl{h~ = {s) (106) has thus been converted matrices [L] IRESt} the and the elements because of the because ((103) earlier in which used to calculate from the elements is added to the values and dn are all of the main diagonal. {h R -h a-1} except number of and second eqations elements in sequence, Back substitution vector first of forward form of the matrix right NCOL is the an,bn,cn the involves procedure are determined layer, and RESnR is determined an and bn are zero for sequence. the the coefficeints and each equation (104)); in the and [U] is calculated preceding iteration; into an iterative are determined using (3) the vector equation process using equations {q), (100) 12-19 in which: the matrix is then (97); [A] solved (1) the (2) the vector and heads from using forward and backward vector substitution {h"-l} However, aspects to obtain is added to the while these the vector are the essential steps the coefficient seven nonzero diagonals. Rather SIP Package, only of the matrix, only CC, CR, and CV. and the the matrix 2. The latest Output lower vector {hi}. of the SIP procedure, diagonals matrix passing The main diagonal is formed HCOF described {q), estimate in HNEW replacing several from SIP consists Procedure to the matrix arrays: 2. lower only to the diagonals arrays hand side RHS described (ha-l), are conductance The right array estimates. in Ctapter corresponds by SIP, Thus input they of to the are to SIP CC, CR, CV, RHS, HCOF, and HNEW. of a new HNEWarray. inside with and because of symmetry of head are calculated the previous may be modified the entire from the three of the head distribution is sparse, to the conductance in Chapter corresponds of the following is and the three correspond array [A] are needed; diagonals HNEW. As new estimates arrays than the main diagonal equation, the Formulate input the nonzero The three needed. consists the of Arrays previously, stored to obtain and (4) the of the method remain to be discussed. As noted array {hg-he-l}; {hfi-ha-l} Transfer arrays vector the iteration at each iteration. 12-20 As explained loop; in Chapter, therefore, the 3, Order of Calculation Experience solved has shown that in two different iterations needed to converge in the discussion, the first order, to this ascending proceed in ascending order. 51, equations on alternate the last column order, to equations = zi ,j,k/(l+* bi,j,k = Bi,j,k/(l+Yei+l,j,k+@i+l,j,k) ci,j,k = Di ,j,kl(l+Yf i,j,k+l+Bfi,j,k+l) = ai,j,kei,j,k+l C'i,j,k = G’i,j,k = fi ,j-1,kci R'i,j,k = gi,j-l,kci,j,k T'i,j,k = ai,j,kfi U'i,j,k = di,j,k assumed column, column An alternative layer, is and to and descending names used in figure can be developed. They are (107-a) (107-b) i,j-l,k+@i,j-1,k) (107-c) (107-d) (107-e) ei+l,j,kbi,j,k (107-f) ,j,k (107-g) (107-h) ,j,k+l (107-i ) bi,j,kgi+l,j,k = Ei,j,k last row order, of diagonal The order in ascending order. are number of at the first row, and the (g7-a...m) ai,j,k A'i,j,k layer descending the reduced. and to proceed Using the same ordering similar is has been to begin and ascending column, equations iterations, to a solution layer, row order, at the first the finite-difference point, row, and the first to start layer orders if + aA'i,j,k+@T'i,j,k +YC'i,j,k+fi'i,j,k +BU'i,j,k t~‘i,j,k-ai,j,k9i,j,k+l’bi,j,kfi+l,j,k (107-j) -ei,j-l,kci,j,k 12-21 ei,j,k = (Fi,j,k-d'i,j,k-s'i,j,k)/di,j,k (1107-k) f. l,j,k = (Hi,j,k-BT'i,j,k-fi'i,j,k)/di,j,k (307-l) gi,j,k = (%,j,k-a'i,j,k-BU'i,j,k)/di,j,k (107-m) In the model described (97-a . ..m) are in effect The model program variables (107) indices. actually achieved to the cell through in these n; the equations, each been replaced Note that section. the equation n. This as the for equation of these one additi nrl onal vn, the element of the can be added inasmuch [L] of values general in which of (97) assigned equations, calculated, the but in the are defined a, w as explained equation iterations. of equations parameters parameter and equation!; The ordering and ncl iteration nth rows of the matrices equations layer indices by a single set indices. the sequence list the (107-a...m) in successive uses one general in the previous and column as cell equations alternately by single In the following refers Also, invoked are identified is then herein, or 01' to the index nil same row analogously. B and y have ,in the following has been added to the vector the {v) corresponding as Vn can be calculated and [U] have been calculated. list-to cell as soon The are an = Zn/(l + den11 + fnll)) :108-a) bn = Bn/(l + den,1 + Snr1)) :108-b) Cn = Dn/(l + dfncl + gncl >I (108-c) A'n ( 108-d ) = anenll C'n = bnenrl (108-e) G'n = cnfncl (108-f) R'n = Cngncl (108-g) T'n (108-h) = anfnll (108-i ) U'n = bngnrl 12-22 dn = En t @(A‘, - angnll t T'n t C'n t G'n + U'n + R'n) - bnfnrl (108-j ) - cnencl en = (Fn - w(A’n + C’n))/dn ( 108-k ) fn = (Hn - w(T’n + G’n))/dn (108-l) Sn = (Sn - o(R’n (108-m) + U’n))/dn Vn = (RESn - anvnll Since the backward - bnvnrl - CnVncl 11% substitution requires all vn, space is allocated in the SIP Package for values. arrays the Each of these (108-n) values four has as many elements of en, fn, arrays gn, and to store as there those are cells in grid. Iteration While in their theoretical parameter, however, development, o must be cycled satisfactory rates iteration a single a series of values of convergence. calculated determining to the sequence The value and WSEED is the rules outlined in turn P29 and p3 are calculated for between that neighbors, and its by a single side of the equation; in successive iterations herein, to be used; x is an index is the corresponding iteration below, wu parameter and used as a basis "seed", for of w values. of WSEED is cell in practice. In the model described from 1 to NPARM; w(x) value; according parameters x=1,2. . ..NPARM number of u values values parameter right iteration value (93) are replaced = l-(WSEED)(x-l)/(NPARM-1) on integral three from the expression where NPARM is the total taking utilize each term on the through of w are calculated w(x) they a, 8 and y of equation W, which multiplies to achieve values Stone and Kwan (1969) define Weinstein, Thus the terms Parameters developed each cell as follows. in the mesh using as follows 12-23 The terms ~1, the conductances where CCmax for cci+l/& j,k, CRmax is the smaller, ccmax + cvmax p1 = ------------CRmin (110) CRmax + CVmax p2 = ---w-----m--CCmin (111) CRmax + ccmax P3 = ------------CVmin (112) a given CCmin is the larger of CRi,j-l/2,k .2 -------------2(NCOL)2(l+pl) columns for the cell cell WSEED value each time produces well values in the value grid, set for each of these IT2 ---------..---2(NLAY)2(:.+P3) NCOL is the number of three WSEED, is then parameters, w(X), 12-24 as average of from t.he iterations, recycling sequence Stone and Kwan points the is taken generated the same range and that First, number each NPARM iterations). calculating several terms taken in successive used by Weinstein, selection. while number of rows and NLAY is the from that However, CRmin is the cvi,j,k+l/2, where again above for parameter while and has been used (i.e., are in the and similarly the terms described that and cci-l/2,j,k values; and CVi,j,k-1/2 used sequentially in many problems. iteration of these values, The iteration the entire slightly Of The seed term, are then of and CRi,j+l/2,k, NROWis the seeds. The process differs each cell seed. larger n2 -------------2(NROW)2(l+p2) and the minimun to be the smaller larger ' in the model, of layers; is the Using these smaller. are computed i,j,k, while and CVmax iS the CVmin is the all cell, appear should process be of w values (1969), but to function made regarc!ing is essentially empirical, and there better is than convergence the final little understanding another. Second, but (assuming solution. convergence is extremely This multiplier which the ACCL is simply Weinstein user. As a genera 1 rule, values cycled, in the rate Experience always produce required iteration is consistently of this on the of influence rate of from o. functions type as a is not to similar 1977, a single be given should If parameter, be pursued problems value a value of this by the of one, through with to page 130) do not employ a parameter initially below. it Parameters is assigned should and adjustment convergence persist, one can be tried. setting seed value convergence from the optimum occur not performs iteration program, of one. the acceleration/relaxation calculated optimum convergence--that large, parameters of SIP (Peaceman, of convergence the deviate oscillations it has shown that to achieve change is too a value but rather than (ACCL) to 1 and using rate should to distinguish ACCL in the versions as explained of ACCL other the an additional parameter , Stone and Kwan (1969) ACCL is not of the seed term, for where a parameter assigned We. improvement of the provides is designated ACCL have been used in various although is achieved) influence acceleration of {RESR1; thus be used, chosen affect convergence herein to here as the parameter, parameters of parameters significant. The model described referred the that Third, of why one sequence if is, by the either the computed too small value Convergence does not as the head change repeatedly rates will of head change in each or too head overshoots 12-25 program the number of iterations is not minimum. the absolute parameter large. When the head the correct reverses value, and to compensate for the overshoot. overshoot the Severe overshoot simply opposite slows problem monotonically, satisfied down convergence. occurs; but very at each iteration slowly. points, even though from the correct values. budget will imbalance Weinstein, with single time one iteration this iteration step. either this trend overall of the test) sign) that is often far small, on the other trend. For proper run for a number of iterations for evaluation convergence the some variation in the convergence. later the trial before 12-26 this. but head continue; it convergence; that is iterations (reversals *in however, computed Head changes which by a very to 4 or 5 times occurs in which indicating are indicated equal parameters, trend during of a in head change from Some oscillations of the trend, or chosen iterations as iterations most evident optimal and error can be done b:y of iteration on an overall here. hand, This for is a sign of overshoot, great a trial of head change per iteration, head change are normal are too unless is volumetric by the program is observed or decrease is of interest head changes are too that The trend superimposed (which oscillation parameters, convergence heads are still of seed. due to the cycling to increase of the computed repeated ACCL=l. number, next is often change tends for value head changes a significant suggest the choice There is normally to the variation the computed the seed calculated and using increasing the criterion and Kwan (1969) run using from experience, the small, occur. Stone, an initial moderatsa the correct situations, In such situations, method can be used to improve making to approach In severe that while When head change is too head tends may be so small at all causes divergence, flat should the overal'! generally be number of iteration Fo llowing two and ten divided too if initial trial, head changes the in the seed is multiplied initial by a number between two and ten small. tion the If the trend or division made using of the the level is again trial to see if converged, examined. the if they The trial is usually division remain satisfactory for example, additional to carry be noted the more strongly the main diagonal, norma lly changes modifications if procedure be. seepage, tend of such terms refine runs have required for is based on the choice or divided too far; developed Thus, which However, by this in boundary it or procedure conditions problems arise can be repeated. source affect to make the choice terms only It matrix, or after should the less such as coefficients of seed less to a mode1 seldom necessitates 12-27 by multiplication the coefficient seed. of in the model are introduced-- convergence diagonal of seed will or stream of the both initial 2 is seldom warranted. seed value and error evapotranspiration addition than However, the trial and the less stresses, in the model mesh. the choice If iteration of the of the procedure. the process even though such changes, important those comparison be multiplied a satisfactory will that to further will seed by factors In most cases, a second run is iteration's. numbers at each step not worthwhile of the changes in the final the and multiplica- of head change vs. has improved. great, appear to be either In any case, to converge, seed value smaller is unclear are compared with runs can be continued progressively head changes is based on the number of iterations have failed the those and the trend of convergence observed in general appear to be too trial The results comparison the head changes seed; rate initial trial seed may be tried. new seed value, the convergence; in the if by a number between on critical; modification For each iteration, IAh&] refers iteration value the entire each stress of these steps which fall value, of each entry Output evaluations the IAhpJmax values in the the acceleration increases in the can be used for ACCL should rate where time step, indicating time Module !iIPlAP IAhg[miix node at which whether assumption of the or for to the of the of a In addition indices step option, for of convergence case as well; be attempted is sometimes necessary cells convergence of iterations, that time (See Narrative of the parameter, from of head overshoot optimal under the last each iteration can be used in the ACCL. in head change. this never to prevent result for every the the change was head change trend that the behavior of behavior of head change can also be obtained Increases head change at each iteration, cause decreases order JAhglmax, at the user's D.) representative adjusting It for shdws the table above, is of the mesh. Improvements will output; and a sign This described throughout JAhgJmax values in Appendix in the table or negative. value For the intervals. maximum change was recorded, positive iteration. may be printed at specified and Sample Problem the of the head change computed during in the program values stores and [Ahg lmax is the maximum such absolute node, a table is printed table value mesh in that period, step program absolute 9. at a given for time to the the but does not involve cannot rather The trial however in the to slow the procedure process be considered in the head overshoot. 12-28 smallest The procedure in ACCL z.bove seed and in runs. of convergence condition In these convergence cause described in the to the no-flow an iteration. convergence decreases same set of trial converting during in ACCL will while changes by in as a situations, in the minimum rumber number of iterations of examining head l change per iteration to determine when this and adjusting condition iteration parameters is being met, seed or ACCL terms. 12-29 can again and to develop the be used required Strongly Implicit Procedure Input to the Strongly the unit Implicit in IUNIT(9). specified Package Input (SIP) Package is read from Procedure FOR EACH SIMULATION SIPlAL 1. Data: Format: MXITER 110 NPARM 110 SIPlRP 2. Data: Format: ACCL HCLOSE F10.0 F10.0 Explanation Input I PCALC 110 IPRSIP 110 WSEED F10.0 of Fields Used in Instructions MXITER--is the maximum number of times through the iteration loop in one time step in an attempt to solve the system of finite-differerxe Fifty iterations are generally sufficient. equations. NPARM--is the number of iteration are generally sufficient. parameters to be used. Five parameters It must be greater than zero and is ACCL--is the acceleration parameter. If a zero is entered, it is changed to one. generally equal to one. HCLOSE--is the head change criterion for convergence. When the maximum absolute value of head change from all nodes during an iteration is less than or equal to HCLOSE, iteration stops. IPCALC--is a flag 0 - the indicating seed will 1 - the seed will problem where the be entered iteration parameter seed will come from. by the user. be calculated at the start of the simulation from parameters. It WSEED--is the seed for calculating iteration specified if IPCALC is equal to zero. parameters. IPRSIP--is IPRSIP is equal change (positive step whenever the also occurs at of IPRSIP. the printout interval for SIP. If The maximum head is changed to 999. printed for each iteration of a time This printout even multiple of IPRSIP, stress period regardless of the value 12-30 is only to zero, it or negative) is time step is an the end of each 12-31 Module Documentation for The Stongly Procedure modules Implicit the and two submodules. Strongly Implicit Package (SIPl) SIPlAL Allocates of three SIPlRP Reads control Modules space for SIP work arrays. information needed by the Package and calculates iteration the seed is specified Performs consists Package They are: Primary SIPlAP Procedure SIP parameters if by the user. one iteration of the strongly implicit procedure. Submodules SSIPlP Prints the SSIPlI Calculates largest head change for iteration is calculated parameters by the 12-32 program. each iteration. when the seed primary Narrative Module SIPlAL arrays, allocates space in the EL, FL, GL, and V hold Each of these process. Additionally, three that iterations holds allowed iteration iteration 1. Print 2. Read and print 3. Allocate 4. Calculate used by SIP is is 5. for HDCG holds the cell and is specified One element its location the at in HDCG is MXITER, and by the user. in W is used for Array each of the W NPARM by the user.) functions in the following order: the SIP Package. MXITER and NPARM. required space in the (ISUM) is saved in variable space required far step a message identifying the the solution each model cell. and LRCH holds (NPARM is specified performs The four MXITER, where MXITER is the maximum number of in a time parameters. during The number of elements parameters. Module SIPlAL pointer times for SIP arrays. HDCG, LRCH, and W are required. the maximum occurred. in LRCH is three for results one element maximum head change each iteration which X array intermediate contains arrays, Module SIPlAL for ISOLD prior SIP can be calculated and print ISUM - ISOLD. X array. in step to allocation ISUM - 1. RETURN. 12-33 location so that the 4. the space used in the The total The X-array X array. space allocated by all The space packages so ' Flow Chart for Module SIPlAL X array is the pool of memory space from which space is allocated for arrays used by various packages. r c 1 PRINT A MESSAGE IDENTIFYING SIP PACKAGE READ AND PRINT MAXIMUM # OF ITERATIOI’JS AND # OF ITERATION PARAMETERS 12-34 1 SUBROUTINE SIPlAL(ISUM,LENX,LCEL,LCFL,LCGL,LCV,LCHDCG,LCLRCH, LCWIMXITERINPARMINCOL,NRC~V,NLAY,IN,IOUT) C C-----VERSION C C C ****************************************************************** ALLOCATE STORAGE IN THE X ARRAY FOR SIP ARRAYS *************************************************************~**** C C E C C Cl--- 1110 31DEC1986 SIPlAL SPECIFICATIONS: ----------------------------------------------------------------------------------------------------------------------------------PRINT A MESSAGE IDENTIFYING SIP PACKAGE WRITE ( IOUT, 1) IN 1 FORMAT(lHO,'SIPl -- STRONGLY IMPLICIT PROCEDURESOLUTIONPACKAGE’ I,', VERSION 1, 9/l/87',' INPUT READ FROM UNIT',131 C C2--- READ AND PRINT MXITERANDNPARM READtIN, MXITER,NPARM 2 FORMAT(21101 WRITE( IOUT, MXITER,NPARM 3 FORMATt1X, ‘MAXIMUM OF’ ,14, ’ ITERATIONS ALLOWED FOR CLOSURE’/ 1 1X,12,' ITERATION PARAMETERS’) C C3------ ALLOCATE SPACE FOR THE SIP ARRAYS ISOLD=ISUM NRC=NROW*NCOL ISIZ=NRC*NLAY LCEL=ISUM IsuM=IsuM+IsIz LCFL=ISUM IsuM=IsuM+IsIz LCGL=ISUM IsuM=IsuM+IsIz LCV= ISUM IsuM=IsuM+IsIz LCHDCG=ISUM ISUM=ISU~JI+MXITER LCLRCH=ISUM ISUM=ISUMt3*MXITER LCW=ISUM ISUM=ISUM+NPARM C c4------CALCULATE AND PRINT THE SPACE USED IN THE X ARRAY ISP=ISUM-ISOLD WRITE(IOUTa4) ISP 4 FORMAT(lX,I8,’ ELEMENTS IN X ARRAY ARE USED BY SIP') ISUMl=ISUM-1 WRITE(IOUT,S) ISUMlr LENX 5 FORMAT(lX,I8,' ELEMENTS OF X ARRAY USED OUT OF’,181 IF(ISUMl.GT.LENX) WRITE(IOUT,6) 6 FORMATt1X, ’ C CS------RETURN RETURN END : ***X ARRAY MUST BE DIMENSIONED LARGER***‘) 12-35 List Variable Module SIPlAL for Definition Range IN Package IOUT ISIZ I SOLD Global Module Package ISP ISUM Module Global ISUMl LCEL Module Package LCFL Package LCGL Package LCHDCG Package LCLRCH Package LCV LCW LENX Package Package Global MXITER NCOL NLAY NPARM NRC NROW of Variables Package Global Global Package Module Global Primary unit number from which input for this package will be read. Primary unit number for all printed output. 1OUT = 6,) Number of cells in the grid. Before this module allocates space, ISOLD is c;et equal ISOLD is subtracted to ISUM. After allocation, from ISUM to get ISP, the amount of space in the X array allocated by this module. Number of words in the X array allocated by this module. Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISIJM. ISUM-1. Location EL. Location FL. Location GL. Location HDCG. Location LRCH. Location Location Length of in the X array of the first element of array in the X array of the first element of array in the X array of the first element of array in the X array of the first element of array in the X array of the first element of array of the first of the first element element of array of array in the X array in the X array the X array in words. This equal to the dimension of X specified program. Maximum number of iterations. Number of columns in the grid. Number of layers in the grid. Number of iteration parameters. Number of cells in a layer. Number of rows in the grid. 12-36 should always in the MAIN V. W. be Narrative Module SIPlRP reads data parameter (ACCL), the seed (WSEED), a flag by the user If for closure 1. and the iteration less The defaults steps. 2. Print the data 3. Check IPCALC which (a) and the Print If Print iteration If is in the WSEED as the following substitute order: of 1.0. a default an interval (IPRSIP). If of 999 time to the user. 1. a flag that iteration not zero, indicates submodule parameters of this IPCALC is zero, parameter = 1 - (wsEED) the source of the (Ii) SSIPlI at the start will of the calculate first a seed iteration. option. use WSEED to calculate is given NPARM-l. the parameters. 4. using as a convenience i-l Ii are calculated substitute to zero, read in step TPCALC is a message telling The i-th head change or specified seed (WSEED). resulting (b) printing functions are provided iteration-parameter for parameters than or equal iteration-parameter WSEED is to be calculated interval its the acceleration (HCLOSE), the If ACCL is zero, Read the data. IPRSlP is the SIP package: whether Module SIPlRP performs seed. Module SIPlRP criterion indicating (IPCALC), IPCALC is zero, for RETURN. 12-37 iteration by the expression parameters. Flow Chart for ,Module SIPlRP ACCL is a rmltiplier of calculated head change which is used to control the convergence rate. HCLOSE is the head change When closure criterion. head change in all model cells is less than or equal to HCLOSE, iteration stops. WSEED is the seed, specified by the user, on which the calculation'of iteration parameters is based if IPCALC is zero. IPRSIP is the time step interval for printing the maximum head change for each iteration of a time Head change is step. printed every IPRSIP time step. Head change is printed at the end of a stress period regardless of the interval. READ AND PRINT ACCL. HCLOSE. WSEED, IPCALC. AND IPRSlP 3A PRINT MESSAGE EXPLAINING THAT ITERATION PARAMETERS WILL BE CALCULATED FROM MODEL $;;ULATED 1 IPCALC is a flag. If it is set equal to one, iteration parameters will be calculated from a seed calculated within the program. If it is clear (equal to zero), iteration parameters will be calculated from a seed provided by the user. 12-38 1 SUBROUTINE SIP1RF’(NPARM,MXITER,ACCL,HCLOSE,W,IN,IPCALC,IF’RSIP, IOUT) C C-----VERSION 0925 16DEC1982 SIPlRP ********+********************************************************* READ DATA FOR SIP +***************************************************************** E C C C C C SPECIFICATIONS: -----------------------------------------------------------------DIMENSION W(NPARM) ------------------------------------------------------------------ : Cl----- READ ACCLrHCLOSE,WSEEDrIPCALC,IPRSIP READ(IN,l) ACCLrHCLOSErIF’CALC,WSEED,IPRSIP 1 F0RMAT(2F10.0,110,F10.0,110~ IF(ACCL.EQ.O.1 ACCL-1. C C2------PRINT DATA VALUES JUST READ WRITE(IOUT,lOO) 100 FO~AT(lHO,///57X,‘SOLUTION BY THE STRONGLY IMPLICIT PROCEDURE’ 1/57x,43 ( ‘- ’ 1) WRITE(IOUT,1151 MXITER 115 FORMAT(lH0,47X,‘MAXIMUM ITERATIONS ALLOWED FOR CLOSURE =‘,I91 WRITE(IOUT,120) ACCL 120 FORMATtlH r63Xn’ACCELERATION PARAMETER =‘rG15.5) WRITE(IOUT,125) HCLOSE 125 FORMATt1H ,52X, ‘HEAD CHANGE CRITERIONFOR CLOSURE =’ rE15.5) IF(IPRSIP.LE.O)IF’RSIP=999 WRITE(IOUT,130) IPRSIP 130 FORMATflH r52X,‘SIP HEAD CHANGE PRINTOUT INTERVAL =‘,I91 C C3-----CHECK IF SPECIFIED VALUE OF WSEED SHOULD BE USED OR IF C3-----SEED SHOULD BE CALCULATED IF(IPCALC.EQ.0) GO TO 150 C C3 A---- -CALCULATE SEED 8 ITERATION PARAMETERS PRIOR TO 1ST ITERATION WRITE(IOUT,140) 140 FORMAT(lHO,52X,‘CALCULATE ITERATION PARAMETERS FROM MODEL’, 1’ CALCULATED WSEED’) GO TO 1000 l SPECIFIED VALUE OF WSEED :3Ek ----USE c35 ----CALCULATE AND PRINT ITERATION PARAMETERS 150 Pl=-1. P2=NPARM-1 DO 160 I=lrNPARM Pl=Pl+l. 160 W(I)=l.-WSEED**(Pl/P2) WRITE(IOUT,161) NPARMrWSEED,(W(JlrJ=l,NPARM) 161 FORMAT(lHO,/,IS,’ ITERATION PARAMETERS CALCULATED FROM’, 1 ’ SPECIFIED WSEED =‘rF11.8,’ :‘//(lOX,6E15.7)) C c4 ------RETURN 1000 RETURN END 12-39 List of Variables for Module SIPlRP Definition Variable Range ACCL Package Acceleration HCLOSE Package Closure I Module Index IN Package Primary will unit number from which be read. IOUT Global Primary unit I PCALC Package Flag. parameter. criterion for iteration for the procedure. parameters. number for + 0, seed for program. = 0, seed will iterative all iteration input printed will be specified ,Tor this output. be calculated package IOUT = 6. in the by the user. IPRSIP Package Frequency (in time steps) with which the maximum head changes for each iteration will be printed. J Module Index MXITER Package Maximum number of iterations. NPARM Package Number of iteration Pl Module I - 1. P2 Module NPARM - 1. W Package DIMENSION (NPARM), Iteration WSEED Module Seed for for iteration calculating 12-40 parameters. parameters. iteration parameters. parameters. Narrative Module SIPlAP performs (SIP) algorithm time, all indexes for arrays used to access time is achieved computational identical if requires Checks are made to detect Double to allow Improvement of the geometry Procedure normally in computational is used to increase are not repeated FORTRAN addressing for routines were used. partly the same calculations This uses the same computer are calculated and column indexes be done by internal the equations. Implicit The one-dimensional and because calculations subscripts that row, Strongly To save computational dimensions. module is somewhat complex, of ordering that equation. layer, in three as would three-dimensional process from the efficiency, of the one dimensional. because knowledge indices This the flow are declared the arrays Module SIPlAP one iteration solving are calculated for be performed is implemented statements which because the SIP solution two methods by a generalized to handle ordering with both ordering scheme is used, algorithm schemes. and array indexes accordingly. precision accurate is used for answers to be calculated Mixed precision arithmetic variables equal to single-precision precision variables where necessary most calculations has been avoided to generate by doing the values fully reverse expressions. 12-41 for in this a wide by setting and then double-precision to generate fully module in order range of problems. double-precision using the double- expressions, single and precision In the explanations use of an assignment amount of text care should this no attempt below, statement would to change precision, However, require. be used to maintain as mixed precision has been made to discuss expressions expressions because of the when changing that this have unmixed can cause erroneous results each large module, precision, with some compilers. Module SIPlAP performs its functions If the user has specified 1. should be calculated in the following (IPCALC f 0) that by the program, order: iteration SSIPlI CALL submodule parameters to calculate both the seed and the parameters. 2. Assign values 3. Initialize to fields the that variables are constant that track during an iteration. maximum head change c.uring an iteration. 4. Clear 5. Determine (IDIR) SIP work the accordingly. Calculate indexes of neighboring substitution. therefore, diagonals ponding ordering This flag alternates and set the ordering between IDNRC and IDNCOL which the matrix The elements they [U] flag 1 and -1 each iteration,, are used when calculating and intermediate in matrix are not saved. in the matrix field of equations locations cells. Calculate 6. arrays. In the [L] names in the program are used as they explanation [U] were designated "e," are EL (e lower 12-42 vector of "f," {V) using are calculated; SIP concepts, and "g." case), forward FL (f the The correslower case), and GL (g lower I,,,,, Ilb," llc,l, Similarly, case). and I'd" in the explanation in the program. The codes for are the same in the program. explanation are followed explanation is ZP (Z prime) in the explanation (a) the equation reverse this cell indexes which "CL," and "DL" "BL," in matrix [A] diagonals in the program. in are in the explanation [A+B] in the Hence, Z' in the The intermediate vector {V) "V" in the program. II, indexes, JJ, KK. is the same as the order loop "AL," [LJ array of the For normal loop I and K are inverted indexes to produce ordering, I,J,K. For the proper of cells. (b) If The codes for in the by a "P" in the program. Set current order are the diagonals is the array ordering, sequence the diagonals cell Calculate the one-dimensional is constant head or no flow, subscript skip of the current calculations for cell. this cell and go on to the next. (c) Calculate the one-dimensional subscripts for the six neighboring (d) Calculate the one-dimensional subscripts for conductance cells. each of the six assigned stores neighboring to array elements conductance cells. at specific between cells conductance subscripts neighboring cells on equation ordering. Since as calculated cells I,J,K are not simply (for the cell 6(c). between cells example, and I,J+l,K), in step 12-43 conductances Also, are CR(I,J,K) the four locations to or five of the six the subscripts depend (e) substitution cell Calculate and involve is outside (f) matrices of the [U] This is one row back. (2) Neighboring cell is one row ahead. (3) Neighboring cell is one column back. (4) Neighboring cell is one column ahead. (5) Neighboring cell is one layer back. (6) Neighboring cell is one layer ahead. and CL], 7. of that If this and go to the are set residual so that forward to zero. of the upper and lower are the factors calculations of matrix {RES}. [A+BJ. The calculation the calculation triangular will of HNW times HCOF have precision made in the formulation modules, all of precision. Calculate the intermediate vector the forward-substitution the cells Set current used for cell the precision Step through (b) which Calculate completes (a) variables the components for Whenever a neighboring cell use single step cells. are required (1) Neighboring to similar (h) neighboring that the is done in single comparable variables grid, Calculate (g) which or assign forward cell process solving indexes substitution for JJ, KK. (step 6(a)). the one-dimensional is constant head or no flow, 12-44 which for is stored subscript skip back substitution. The ordering is the of the current calculations in array one cell. head change using II, Calculate next. {V}, for this cell. cell reverse V. (c) cells the Calculate behind current (relative Back substitute, V in place up of storage this Save the (f) 8. and its step Also, to get a new estimate cell If the step; location neighboring ordering) values of vector of additional location in arrays the Print head change {V). This computer storage. value where this doubling is largest head of the head change. iteration to head from the previous value HDCG and LRCH. step. is greatest iteration is complete, print the this These may be printed Set the convergence is met. flag iteration in to one if number of iterations for RETURN. the maximum head change and cell period Store of head. criterion the SIP printout 11. the three back-substitution head change. the head change whose absolute otherwise, of a stress value Add the head change this Store for save the cell and the absolute the convergence 10. for of head change whose absolute 10 at the end of the time 9. of the intermediate value iteration. change occurred iteration of the solving is used to save the cost (e) during to the direction subscripts cell. (d) in array the one-dimensional interval (IPRSIP) regardless is reached. of the interval. RETURN. 12-45 location each iteration Printout occurs if at the end Flow Chart for If it is set IPCALC is a flag. equal to one, the program calculates a seed from which iteration parameters are It may be set calculated. by the user at the beginning It is of the simulation. cleared during the first SSIPlI will iterations. never be called more than If IPCALC is not set once. equal to zero, the user specifies the seed for the iteration parameters. Module SIPlAP SET, CALL SSlPl I. CLEAR IPCALC IDIR indicates whether the ordering of equations is (-1). normal (1) or reverse INDICATE NORMAL FOR EACH CELL SSIPlI is a submodule calculates iteration parameters. which DIAGONALS IN MATRIX U AND INTERMEDIATE VECTOR V CHANGE 12-46 FOR THIS c 1 EXPANSION “‘6 ~N~cfs A3E ON THE NEXT PAGE Flow Chart for Module SIPlAP (Continued) Sing1 e Cell Index: In this module, a single index is used to identify This is in opposition each cell. to the three indices (I,J,K) used in most other modules. LJ SET UP TtWC;LL (i) CALCULATE SINGLE CELL r- I A SET UP THREE CELL INDICES CALCULATE SINGLE CELL INDICES OF THE SIX ADJACENT CELLS 0 CALCULATE SINGLE CELL INDEX CALCULATE INDICES .--- .- . FOR _ON-D~CTA&~~ TO SIXC;WtCENT CALCULATE SINGLE CELL INDEX FOR NEIGHBORING D BACK SUBSTITUTE FOR HEAD CHANGE ST;E~M&N L I ELEMENTS INLANDU FOR THIS CELL I CHANGE IF IT IS THE MAXIMUM . G 1 I CALCULATE THE RESIDUAL I CALCULATE THE ELEMENT IN V FOR THIS ELEMENT I 12-47 ADD HEAD CHANGE TO HEAD AT START OF INTERATION TO GET HEAD AT END OF ITERATION SUBROUTINESIP~AP(HNEW,IBOUND,CR,CC,CV.HCCF,RHSIEL.FL,GL,V. w, cocci, LRCH,NPAR~KITER, HaosE, Aca, ICNVG, Km, KPER, 2 IPCALC, IFRSIPIMXITER, NSTP,NCCL,NRCW,NLAY, NODES,IOUT) C-----VERSION 1656 24JUL1987 SIPlAP 1 C **********I**************~********************~*****~*******u*~*** SOLUTIONBY THE STRONGLYIMPLICIT PROCEDURE-- 1 ITERATION ***t*******P**~*****~~***~**~~**********~~**************~**~*****~* E C i SPECIFICATIONS: DOUBLEPRECISION HNEW,DITPAR,AC, HHCCF,RR-IS,XI, DZERO.DONE,RES DOUBLE PRECISIONZ,B,D,E,F,HtS,AP,TP,CPtGP,UP.RP DOUBLE PRECISIONZHNEW,BHNEW,DHNEW,FHNEW,HHNEW,SHNEW DOUBLE PRECISION AL,BL,CL,DL,ELNCLrFLNCL,GLNCL DOUBLE PRECISIONELNRrFLNRLtGLNRLrELNLLtFLNLL,GLNLL DOUBLE PRECISION VNRIVNCL,VNLL~ELXI,FLXI,GLXI,VN,HCFHNW C 1 2 C DIMNSION HNEW(NODES1, IBDUND(NOCES1, CR(NODESlr CC(NODESlr CV(NODES1, HCCF(NOCES1, RHS(NODES1, EL(NODESlr FL(NODES)r GLLNODES), V(NODESlr WLNPARM), HDCGLMXITER), LRCHL3,MXITERl ----------------------------------------------------------------- El ------CALCULATE ITERATION PARAMETERSIF FLAG IS SET. THEN Cl------CLEAR THE FLAG SO THAT CALCULATION IS DONE ONLY ONCE. IF(IPCALC.NE.0) 1 CALL SSIPlI(CR,CC,CV,IBOUND,NPARMtW,NCDLrNRCW.NLAY,ICUT1 IPCALOO ------ASSIGN VALUES TO FIELDS THAT ARE CONSTANTDURING AN ITERATION DZERO=O. DONE=l. AC=ACU NRC=NROW*NCOL NTH=MOD(KITER-lrNF’ARM)t1 DITPAR=W(NTHl C Q------INITIALIZE VARIABLE THAT TRACKS MAXIbUMHEAD CHARGEDURING C3------THE ITERATION BIGOO. $------CLEAR SIP WORKARRAYS. DO 100 I=l,NOCES EL(I)=O. FL(I)=O. GL(Il=O. 100 V(I)=O. C B------SET NOFUML/REVERSEEQUATION OROERINGFLAG (1 OR -11 AND CS------CALCULATE INDEXESDEPENDENTON ORDERING IDIR=l IFMOD(KITER,2).EQ.O)IDIR=-1 IDNRC=IDIR*NRC IDNCOL-IDIR'NCOL C C&-----STEP THROUGHCELLS CALCULATING INTEWEDIATE VECTORV c6 ------USING FORMRD SUBSTITUTION DO 150 K=l,NLAY DO 150 I=l,NRCW DO 150 J=l,NCOL UP CURRENTCELL LOCATION INDEXES. THESE ARE DEPENDENT THE DIRECTION QF EQUATION ORDERIt&. IF(IDIR.LE.O)GO TO 120 CSA-----ON II=1 JJ=J KK=K GO TO 122 120 II=NRW-I+1 JJ=J KK-NLAY-Ktl 12-48 c’ (%&----CALCULATE 1 DIMENSIONAL SUBSCIW’T OF CURRENTCELL AND W&----SKIP CALCULATIONS IF CELL IS NOFLOWOR CONSTANTHEAD 122 N=JJ+(II-l)*NCOL+(KK-l)*NRC IF(IBOUND(N).LE.O)GO TO 150 Fix -----CALCULATE 1 DIMENSIONAL SUBSCRIPTS FOR LOCATING THE 6 ‘XC-----SURROUNDING CELLS NRN=N+IDNCOL NF(L=N-IDNCOL NCN=N+l NU=N-1 NLN=N+IDNRC NLL-N-IDNRC n :6D- ----CALCULATE 1 DIKNSIONAL SUBSCRIPTS FOR CONWCTANCETO THE 6 C6D-----SURROUNDING CELLS. THESE DEPENDON ORDERINGOF EQUATIONS. IF(IDIR.LE.O)GO TO 124 NCF=N NCD=NCL NW=NR NR-I-N NLS=N NLZ=NLL GO TO 126 124 NCF=N NCD=NCL NB=N NRi=NRN NLS=NLN NLZ=N C @E--ASSIGN VARIABLES IN MATRICES A 6 U INVOLVING ADJACENTCELLS C6El ----NEIGHBOR IS 1 ROWBACK 126 B=DZERO ELNRL=DZERO FLNR=DZERO GLNRL=DZERO BHNEW=DZERO VNRL=DZERO IF(I.EQ.l) GO TO 128 B=CC(NRB) ELNRL=EL(NRL) FLNRL=FL(NR) GLNF(L=GL(NRL) BHNEW=B+HNEW (NR 1 VNRL=V(NRL) c C6E2----NEIGHBOR IS 1 RCWAHEAD 128 H=DZERO HHNEW=DZERO IF(I.EQ.NRW) GO TO 130 H=CC(NRH) HHNEW=H*HNEW (NRN) C C6E3----NEIGHBOR IS 1 COLUMI BACK 130 D=DZERO ELNCL=DZERO FLNU=DZERO GLNa=DZERO DHNEW=DZERO VNCL=DZERO IF(J.EQ.l) GO TO 132 D=CR(NCD) ELNCL=EL(NU) FLNCL=FL(NcL) GLNa=GL( NCL1 DHNEW=D*HNEW(NCL) VNa=V(NU) 12-49 C6E4----NEIGHBOR IS 1 COLUMNAHEAD 132 F=DZERO FHNEW=DZERO IF(J.EQ.NCOL) GO TO 134 F=CR(NCF) FHNEW=F*HNEW(NCN) C C6E5----NEIGHBOR IS 1 LAYER BEHIND 134 Z=DZERO ELNLL=DZERO FLNLL=DZERO GLNLL=DZERO ZHNEW=DZERO VNLL=DZERO IF(K.EQ.1) GO TO 136 Z=CV(NLZ) ELNLL=EL (NLL) FLNLL=FL(NLL) GLNLL=GL(NLL) ZHNEW=Z*HNEW(NLL) VNLL=V(NLL) C C6E6----NEIGHBOR IS 1 LAYER AHEAD 136 S=DZERO SHNEW=DZERO IF(K.EQ.NLAY) GO TO 138 S=CV(NLS) SHNEW=S*HNEW(NLN) i&E7 ----CALCULATE THE NEGATIVE SUM OF ALL CONWCTANCESTO NEIGRBORING C6E7----CELLS 138 E=-Z-B-D-F-H-S C C6F-----CALCULATE COMPONENTS OF THE UPPER AND LUVER MATRICES, WHICH C6F-----ARE THE FACTORSOF MATRIX (A+B) AL=Z/(DONE+DITPAR*(ELNLL+FLNLL) 1 BL=B/(DONE+DITPAR*(ELNRL+GLNRL)) a=D/(DONE+DITPAR*(FLNCL+GLNa)) AP=AL*ELNLL CPBLYLNRL GP=CL*FLNU RP=a*GLNCL TF=AL*FLNLL UP=BL’GLNR HHCOF=HCOF(N) DL=E+HHCOF+DITPAR*(AP+TP+CP+GPtUPURP)-ALBLNLL-BL*FLNR-CL*ELNU EL(N)=(F-DITPAR*(AP+CP))/DL FL(N)=(H-DITPAR*(TPtGP))/M GL(N)=(S-DITPAR+(RP+UP))/DL C C6G----CALCULATE THE RESIDUAL RRHS=RiS(N) HNW=HNEW (N) HCFHMd=HNW*HCQF(N) RES=RRHS-ZHNEW-BHNEW-DHNEW-E~NEW(N)-HCMNW-FHNOII-HHNEW-SHNM C C6t!-----CALCULATE THE INTERMEDIATE VECTORV V(N)=(AC*RES-AL*VNLL-BL+VNR-CL*VNU)/DL C 150 CONTINUE C C7------STEP THROUGHEACH CELL AND SOLVE FOR HEAD CHANGEBY BACK C7------SUBSTITUTION DO 160 K=lrNLAY DO 160 I=lrNRW DO 160 J=l,NCOL c 1240 C7A-----SET UP CURRENTCELL LOCATION INDEXES. THESE ARE DEPENDENT C7Am.--- ON THE DIRECTION OF EQUATION ORDERING. IF(IDIR.LT.0) GO TO 152 KK=NLAY-K+l II=NR@V-I+1 JJ=NCOL-J+l GO TO 154 152 KK=K II=1 JJ=NCOL-J+l C7&----CALCULATE 1 DIMENSIONAL SUBSCRIPT OF CURRENTCELL AND C7B---- SKIP CALCULATIONS IF CELL IS NOFLW OR CONSTANTHEAD 154 N=JJ+(II-l)‘NCOL+(KK-l)“NRC IF(IBOUND(N).LE.O)GO TO 160 C7C-----CALCULATE 1 DIMENSIONAL SUBSCRIPTS FOR THE 3 NEIGHBORINGCELLS C7C--BEHIND (RELATIVE TO THE DIRECTION OF THE BACK SUBSTITUTION C7C-----ORDERING) THE CURRRENTCELL. NC=N+l NF+N+IDNCOL NL=N+IDNRC C7D-----BACK SUBSTITUTE, STORING HEAD CHANGEIN ARRAY V IN PLACE OF C7D-----INTEMDIATE FORWARDSUBSTITUTION VALUES. ELXI=DZERO FLXX=DZERO GLXI=DZERO IF(JJ.NE.NCOL) ELXI=EL(N)*V(NC) IF(X.NE.l) FLXI=FL(N)*V(NR) IF(K.NE.l) GLXI=GL(N)*V(NL) W=‘/(N) V( N)=VN-ELXI-FLXI-GLXI C C7E-----GET THE ABSOCUTEHEAD CHANGE. IF IT IS MAX OVER GRID SO FAR. C7E-----THEN SAVE IT ALONGWITH CELL INDICES AND HEAD CHANGE. TCHK=ABS(V(N) 1 IF ITCHK.LE.BIGG) GO TO 155 BIGG=TCHK BIG=V(N) IB=II 38555 KB=KK C C7F-----ADD HEAD CHANGETHIS ITERATION TO HEAD FROMTHE PREVIOUS C7F-----ITERATION TO GET A NEW ESTIMATE OF HEAD. 155 XI=V(N) HNEW(N)=HNEW(N)+XI C 160 CONTINUE C CS------STORE THE LARGEST ABSOLUTEHEAD CHANGE (THIS ITERATION) AND CS------AND ITS LOCATION. HDCG(KITER)=BIG LRCH(lrKITER)=KB LRCH(2rKITER)=IB LRCH(3rKITER)=JB ICNVG=O IF(BIGG.LE.HCLOSE) ICNVG=l ------IF END OF TIME STEP, PRINT I OF ITERATIONS THIS STEP IF(ICNVG.EQ.0 .AND. KITER.NE.MXITER) GD TO 600 IF(KSTP.EQ.l) WRITE(IOLIT,500) 500 FORMAT(lt0) WRITE(IOUT,SOl) KITER,KSTP,KPER 501 FORMAT(lX,I5,’ ITERATIONS FOR TIME STEP’rI4,’ IN STRESS PERIOD’, 1 13) ClO-----PRINT HEAD CHANGEEACH ITERATION IF PRINTOUT INTERVAL IS REACHED IF(ICNVG.EQ.0 .OR. KSTP.EQ.NSTP .OR. MOD(KSTP,IPRSIP).EQ.O) 1 CALL SSIP1P(HDCG,LRCH,KITERtMXITERtIOUT) ~~-----RETLIRN 600 RETURN C END 12-51 List Variable Range AC ACCL AL Module Package Module AP Module B Module BHNEW BIG BIGG BL Module Module Module Module cc Global CL Module CP Module CR Global cv Global D Module DHNEW DITPAR DL Module Module Module DONE DZERO Module Module Module EL Module ELNCL ELNLL ELNRL F Module Module Module Module Module FHNEW FL Module Module FLNCL FLNLL FLNRL Module Module Module ELXI of Variables for Module SIPlAP Definition Double-precision acceleration parameter (ACCL). Acceleration parameter. Diagonal from the lower factor. (AL stands for A-lower case.) Diagonal element in the modified coefficient matrix. (AP stands for A-prime.) Diagonal label in the coefficient matrix--conduc:tance from the adjacent node which is in the last row. Head in the adjacent cell which is in the last row. Largest head change for an iteration. Largest absolute value of head change for an iteration. (BL stands for Diagonal from the lower factor. B-lower case.) DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. and (J,I+l,K). nodes (J,I,K) (CL stands for Diagonal from the lower factor. C-lower case.) Diagonal element in the modified coefficient matrix. (CP stands for C-prime.) DIMENSION (NCOL,NROW,NLAY), Conductance in the row CR(J, I ,K) contains conductance between direction. and (J+l,I,K) nodes (J,I,K) DIMENSION (NCOL,NROW,NLAY-l), Conductance in the vertical CV(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,I,K+l). Diagonal label in the coefficient matrix. Conductance from the adjacent node which is in the last c.olumn. Head in the adjacent cell which is in the last column. Double-precision iteration parameter. Diagonal from the lower factor. (DL stands for D-lower case.) Double-precision field containing a one. Double-precision field containing a zero. Main diagonal in the coefficient matrix. DIMENSION (NODES), Diagonal from the upper factor. (EL stands for E-lower case.) EL (E-lower case) from the cell in the last column. EL (E-lower case) from the cell in the last layer. EL (E-lower case) from the cell in the last row. Intermediate result. Diagonal label in the coefficient matrix--conductance from the adjacent node which is in the next column. Head in the adjacent cell which is in the next column. DIMENSION (NODES), Diagonal from the upper factor. (FL stands for F-lower case.) FL (F-lower case) from the cell in the last column. FL (F-lower case) from the cell in the last layer. FL (F-lower case) from the cell in the last row. 12-52 . 8 List l 0 Variable Range FLXI GL Module Module GLNCL GLNLL GLNRL GLXI GP Module Module Module Module Module H Module HCFHNW HCLOSE HCOF Module Package Global HDCG HHCOF HHNEW HNEW Package Module Module Global HNW I IB IBOUND Module Module Module Global ICNVG Global IDIR Module I DNCOL I DNRC II IOUT I PCALC Module Module Module Global Package IPRSIP Package 3 JB JJ K KB KITER Module Module Module Module Module Global of Variables for Module SIPlAP (Continued) Definition Intermediate result. DIMENSION (NODES), Diagonal from the upper factor. (GL stands for G-lower case.) GL (G-lower case) from the cell in the last column. GL (G-lower case) from the cell in the last layer. GL (G-lower case) from the cell in the last row. Intermediate result. Diagonal element in the modified coefficient matrix. (GP stands for G-prime.) Diagonal label in the coefficient matrix. Conductance from the adjacent node which is in the next row. Product of head and HCOF for a cell. Closure criterion for the iterative procedure. DIMENSION (NCOL,NROW,NLAY), Coefficient of head in the cell (J,I,K) in the finite-difference equation. DIMENSION (MXITER), Maximum head change for each iteration. Double-precision HCOF. Head in the adjacent cell which is in the next row. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of head HNEWchanges at each iteration. in each cell. Temporary field for HNEW(N). Index for nodes and rows. Row number of the cell having the largest head change. DIMENSION (NCOL,NROW,NLAY), Status of each cell. c 0, constant-head cell = 0, inactive cell > 0, variable-head cell Flag is set equal to one when the iteration procedure has converged. Indicator for direction of solution algorithm. +l - forward -1 - reverse Intermediate result used to calculate indices. Intermediate result used to calculate indices. Row number. Primary unit number for all printed output. IOUT = 6. Flag. = 0, iteration parameter seed (WSEED) is entered by the user. = 1, seed is calculated in the program. Frequency (in time steps) with which the maximum head changes for each iteration will be printed. Index for columns. Column number of the cell having the largest head change. Column index. Index for layers. Layer of the cell having the largest head change. Reset at the start of each time Iteration counter. step. 12-53 List Variable of Variables Module Global Global LRCH Package MXITER N NC NCD Package Module Module Module NCF Module NCL Module NCN Module NCOL NL NLAY NLL Global Module Global Module NLN Module NLS Module NLZ Module NODES NPARM NR NRB Global Package Module Module NRC NRH Module Module NRL Module NRN Module NROW NSTP NTH RES RHS Global Global Module Module Global Module SIPlAP (Continued1 a Definition Range KK KPER KSTP for Layer index. Stress period counter. Reset at the start of each stress Time step counter. period. DIMENSION (MXITER), Layer, row, and column of the cell containing the maximum head change (HDCG) for each iteration. Maximum number of iterations. Cell index. Index for the adjacent cell in the last column. One-dimensional subscript of conductance to the adjacent cell which is in the last column. One-dimensional subscript of conductance to the adjacent cell which is in the next column. One-dimensional subscript of the cell index of the adjacent cell which is in the last column. One-dimensional subscript of the cell index of the adjacent cell which is in the next column. Number of columns in the grid. Index for the adjacent cell in the last layer. Number of layers in the grid. One-dimensional subscript of the cell index of the adjacent cell which is in the last layer. One-dimensional subscript of the cell index of the adjacent cell which is in the next layer. One-dimensional subscript of conductance to the adjacent cell which is in the next layer. One-dimensional subscript of conductance to the adjacent cell which is in the last layer. Number of cells (nodes) in the finite-difference grid. Number of iteration parameters. Index for the adjacent cell in the last row. One-dimensional subscript of conductance to the adjacent cell which is in the last row. Number of cells in the layer. One-dimensional subscript of conductance to the! adjacent cell which is in the next row. One-dimensional subscript of the cell index of the adjacent cell which is in the last row. One-dimensional subscript of the cell index of the adjacent cell which is in the next row. Number of rows in the grid. Number of time steps in the current stress period. Index for iteration parameters. Residual. DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. 12-54 a List Variable Range RP Module RRHS S Module Module SHNEW TCHK TP Module Module Module UP Module V VN VNCL Package Module Module VNLL Module VNRL Module W XI Z Package Module Module ZHNEW Module of Variables for Module SIPlAP (Continued) Definition Diagonal element in the modified coefficient matrix. (RP stands for R-prime.) Double-precision right hand side of the equation. Diagonal label in the coefficient matrix--conductance from the adjacent node which is in the next layer. Head in the adjacent cell which is in the next layer. Absolute value-of head change for a sing le cell. Diagonal element in the modified coeffic ient matr ix. (TP stands for T-prime.) Diagonal element in the modified coeffic ient matr ix. (UP stands for U-prime.) DIMENSION (NODES), Intermediate result. Temporary double-precision V(N). Element in the intermediate vector for the cell in the last column. Element in the intermediate vector for the cell in the last layer. Element in the intermediate vector for the cell in the last row. DIMENSION (NPARM), Iteration parameters. Double-precision V(N). Diagonal label in the coefficient matrix--conductance from the adjacent node which is in the last layer. Head in the adjacent cell which is in the last layer. 12-55 Narrative Submodule SSIPlP prints all cells location for each iteration the for Module SSIPlP largest of a time (LRCH) where the change value step. occurs. no numbered comments are used and no flow 12-56 of head change Also printed The submodule chart is (HDCG) out of is the cell is so short provided. that SUBROUTINE SSIPlP(HDCG,LRCH,KITER,MXITER,IOUT) C C C-----VERSION 1636 24JUL1987 SSIPlP C C C C C C C C C *****f***~~**f**+*+*~*~~**~*~~~***~~*********~***~*~*********~**** PRINT MAXIMUM HEAD CHANGE FOR EACH ITERATIONDURINGA TIME STEP ****************************************************************** SPECIFICATIONS: -----------------------------------------------------------------DIMENSIONHDCGtMXITER),LRCH(3rMXITER) -----------------------------------------------------------------WRITE(IOUT,S) 5 FORMATtlHOr'MAXIMUM HEADCHANGEFOREACHITERATION:'/ 1 lHO,S(" HEAD CHANGE LAYER,ROW,COL’)/lX,132(‘-‘1) WRITE (IOUT,lO) (HDCG(J),(LRCH(I,J),I=lr3),J=lrKITER) 10 FORMAT((lX,S(G12.4,’ ~‘,13,‘,‘,13,‘,‘,13,‘~‘~~~ WRITE(IOUT,ll) 11 FORMATt1HO1 C RETURN C END l 12-57 List of Variables for Module SSIPlP Definition Variable Range HDCG Package DIMENSION (MXITER), iteration. I Module Index IOUT Global Primary Module Index KITER Global Iteration step. LRCH Package DIMENSION (MXITER), Layer, row, and column of the cell containing the maximum head change (HDCG) for each iteration. MXITER Package Maximum number of iterations. for cell unit for Maximum head change for each location. number for all printed output. IOUT = 6. iterations. counter. 12-58 Reset at the start of each time Narrative Submodule SSIPlI conductance values calculates and grid the method of calculation for each active Finally, all the seed is also printed. Submodule SSIPlI the average performs constants cell seed, These are initialized seed. Since 1.0. this The three a*/Z(NCOL)2, 3-. seed, value all grid functions in the following variables. than one, and n2/2(NLAY)2, grid order: In order to calculate seeds) and are required. the smallest it is CCOL, CROW, and CLAY are set cells, This a seed is calculated) be less is selected. seed. AVGSUM (sum of the cell which required, The minimum cell WMINMN is used to store coefficients, Loop through the its must always r2/2(NROW)2, to give parameters. to zero. seed is seeds be calculated iteration for model- the minimum of the three, and initialize cells a single the accumulators NODES (sum of the active seed using three-directional seeds are averaged used to calculate Calculate that Then a cell cell Although dimensions. seed is then 1. an iteration-parameter requires cell. Module SSIPlI for cell initialized equal to to respectively. calculating a cell seed for each active cell. (a) cells. Conductance (b) direction vertical that Find Find the conductances across from the cell the grid boundary a neighbor is set equal (ZSMX, ZSMN). is no flow), If in the (BHMX, BHMN), and in the the minimum is set the minimum equal 12-59 adjacent to zero. the maximum and minimum of the two conductances (DFMX, DFMN), in the column direction direction to each of the six zero (which indicates to the maximum. row (c) Calculate three-directional seeds (WCOL, WROW, WLAY) u:;ing the relations WCOL = CCOL/(l. + (BHMX + ZSMX)/DFMN); WROW= CROW/(l. + (DFMX + ZSMX)/BHMN); and WLAY = If cLAY/(l. the minimum conductance are zero), cell any valid with the be less (d) Select it is the Accumulate the the (that to 1.0. minimum-directional seed will If so that is zero set the seed equal seed (the seed. + (DFMX + BHMx)/ZSMN). 3. Calculate the minimum 4. Calculate This seed) than both the minimum and the maximum value smallest of all the is selected cell grid seed used so far, seeds and the total cell seed (the average cell and print iteration parameters .x-a where i-th NPARM is the .. 5 Z(d) bec:ause seeds as the cell store it in WMINMN. number of active seeds can be calculated = 1 - (SEED) NPARM - 1 is the in step when the 1.0. i-l Ii be ignored seed) in step cells 3. and print it along seed. relation Ii will the minimum of the three-directional sum of the cell average is, iteration parameter, number of iteration and parameters. RETURN. 12-60 using the grid seed with Flow Chart for Module SSIPlI Seed: the "grid seed" is the single parameter used to calculate the iteration To calculate parameters. the grid seed, several intermediate variables, called "cell seeds," are For each cell, used. three "directional seeds" are calculated. The minimum directional seed for a cell is the "cell seed." The "grid seed" is the average of the cell seeds. AVGSUMis an accumulator to which each cell seed is It is then divided added. by the number of cells to obtain the average cell seed which is used as the grid seed. .AND MINIMUM OF THE TWO CONDUCTANCES IN EACH PRINCIPAL COORDINATE DIRECTION CALCULATE THE THREE i;I;;TlONAL A 2D IF THIS IS THE MINIMUM CELL SEED SO FAR, SAVE IT I CALCULATE THE AVERAGE CELL SEED AND PRINT THE AVERAGE AND MINIMUM SEEDS + 4 CALCULATE AND PRINT ITERATION PARAMETERS USING THE AVERAGE CELL SEED I 12-61 SUBROUTINE SSIPlI (CR,CC,CV, 1 IBOUND,NPARM,WINCOL,NROW,NLAY, IOUT) C C-----VERSION 1417 12MAY1987SSIPl I *****************************************************~********~*** C C CALCULATE AN ITERATIONPARAMETERSEED AND USE IT TO CALCULATE SIP C ITERATION PARAMETERS C C C C a *****************************************************~************ SPECIFICATIONS: -------------i----,-,,,,,,,,,,,,,,,,,,,,--------~-------------,---DIMENSIONCR(NCOL,NROW,NLAY)rCC(NCOLINROn’rNLAY) 1 rCV(NCOL,NROW,NLAY)rIBOUND(NCOL,NROW,NLAY~,W~NPARM~ C DOUBLE PRECISIONDWMIN,AVGSUM --------------------------------------------------------------.---c” Cl----- CALCULATE CONSTANTS AND INITIALIZE VARIABLES PIEPIE=9.869604 R=NROW C=NCOL ZL=NLAY CCOL=PIEPIE/(Z.+WC) CRW=PIEPIE/(Z.*R*R) CLAY=PIEPIE/(Z.*ZL*ZL) WMINMN=l. AVGSUM=O. NODES=0 C (-32----c2----- LOOP THROUGHALL CELLS, CALCULATING A SEED FOR EACH CELL THAT IS ACTIVE DO 100 K=lrNLAY DO 100 I=lrNROW DO 100 J=lrNCOL IF(IBOUND(J,I,K).LE.O) GOTO 100 C C2A----C2/+-..-- CONDUCTANCEFROM THIS CELL TO EACH OF THE 6 ADJACENT CELLS D=O. IF(J.NE.l) D=CR(J-lrI,K) F=O. IF(J.NE.NCOL) F=CR(J,I,K) B=O. IF(I.NE.l) B=CC(J,I-1rK) H=o. IF(I.NE.NROW) H=CC(JrIrK) z=o. IF(K.NE.l) Z=CV(J,IrK-1) s=o. IF(K.NE.NLAY) S=CV(J,I,K) C c2B----- FIND THE MAXIMUM ANDMINIMUMOF THE 2 CONDUCTANCECOEFFICIENTS C2&---- IN EACHPRINCIPALCOORDINATE DIRECTION 12-62 a DFMX=AMAXl(D,F) BHMX=AMAXl(B, H) ZSMX=AMAXl( Z, S) DFMN=AMINl(D,F) BHMN=AMINl(B,H) ZSMN=AMINl(Z,S) IFtDFMN.EQ.0.) DFMN=DFMX IF(BHMN.EQ.0.) BHMN=BHMX IF(ZSMN.EQ.0.)ZSMN=ZSMX C (yJc--- CALCULATE A SEED IN EACH PRINCIPAL COORDINATE DIRECTION WCOL=l. IF(DFMN.NE.0.) WCOL=CCOL/(l.+(BHMX+ZSMX)/DFMN) WROW=l. IF(BHMN.NE.0.) WLAY=l. WROW=CROW/(l.+(DFMX+ZSMX)/BHMN) IF(ZSMN.NE.0.)WLAY=CLAY/(l.+(DFMX+BHMX)/ZSMN) C C2’)--C2D--- C SELECT THE CELL SEED, WHICH IS THE MINIMUM SEED OF THE 3. SELECT THE MINIMUM SEED OVER THE WHOLEGRID. WMIN=AMINl(WCOL,WROW,WLAY) WMINMN=AMINl(WMINMN,WMIN) C2E-w-vQE--- C ADD THE CELL SEED TO THE ACCUMULATORAVGSUMFOR USE IN GETTING THE AVERAGE SEED. DWMIN=WMIN AVGSUM=AVGSUM+DWMIN NODES=NODES+l 100 CONTINUE ------CALCULATE THE AVERAGE SEED OF THE CELL SEEDS, AND PRINT C3------ THE AVERAGE AND MINIMUM SEEDS. TMP=NODES AVGMIN=AVGSUM AVGMIN=AVGMIN/TMP WRITE(IOUT,lOl)AVGMIN,WMINMN 101 FORMAT(lHO,‘AVERAGE SEED =‘rF11.8/1X,‘MINIMUM SEED =‘rF11.8) C ANDPRINTITERATION PARAMETERSFROM THE AVERAGE SEED c4 ------CALCULATE Pl=-1. P2= NPARM-1 DO 50 I=lrNPARM Pl=Pl+l . 50 W(I)=l.-AVGMIN**(Pl/P2) WRITE(IOUT,150)NPARM,(W(J)rJ=lrNPARM) 150 FORMAT(lHO,/rIS,' ITERATION PARAMETERSCALCULATED FROM’, 1 ’ AVERAGE SEED:‘//(lOX,6E15.7)) l C C5------RETURN RETURN END 12-63 List Variable of Variables for Module SSIPlI Definition Range AVGMIN Module Mean WMIN. AVGSUM Module Sum of all B Module Conductance BHMN Module Minimum of B and H (if maximum). BHMX Module Maximum of B and H. C Module Number of columns. cc Global DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,I+~,K). CCOL Module Intermediate factor. CLAY Module Intermediate factor. CR Global DIMENSION (NCOL,NROW,NLAY), Conductance in the CR(J,I,K) contains conductance direction. between nodes (J,I,K) and (J+l,I,K). CROW Module Intermediate cv Global DIMENSION (NCOL,NROW,NLAY-l), Conductance CV(J,I,K) contains vertical direction. between nodes (J,I,K) and (J,I,K+l). D Module Conductance DFMN Module Minimum of D and F (if maximum). DFMX Module Maximum of D and F. DWMIN Module Double F Module Conductance between this node and the one to the right. H Module Conductance between this node and the one to the front. I Module Index IBOUND Global DIMENSION (NCOL,NROW,NLAY), Status < 0, constant-head cell = 0, inactive cell > 0, variable-head cell of WMIN’s. between this one to the the minimum is 0, it rear. is the row factor. between this precision for node and the node and the the minimum is in the conductance one to the 0, it left. is the WMIN. rows. 12-64 of each cell. List Variable of Variables Module SSIPlI for Range (Continued) Definition IOUT Global Primary J Module Index for columns. K Module Index for layers. NCOL Global Number of columns NLAY Global Number of layers NODES Module Number of variable-head NPARM Package Number of iteration NROW Global Number of rows in the PIEPIE Module PI squared. Pl Module Index P2 Module NPARM-1. R Module Number of rows. S Module Conductance TMP Module Temporary W Package DIMENSION (NPARM), Iteration parameters. WCOL Module Seed in the column direction for WLAY Module Seed in the WMIN Module Minimum of (WCOL, WLAY, WROW). WMIl@lN Module Minimum WMIN. WROW Module Seed in the row direction Z Module Conductance between this ZL Module Number of layers. ZSMN Module Minimum of Z and S (if ZSMX Module Maximum of Z and S. unit for number for the all in the printed output. IOUT = 6. grid. in the grid. (IBOUND > 0) cells in the grid. parameters. grid. number of parameters. between this field for layer node and the one below. nodes. direction 12-65 for for a cell. a cell. a cell. node and the one above. minimum is 0, it is the maximum). CHAPTER 13 SLICE-SUCCESSIVE OVERRELAXATION PACKAGE Conceptualization Successive of linear overrelaxation equations model discussed Package. is another method for herein through material the Slice on the in many standard by Peaceman (1977), Successive successive references, Crichlow (1977) solving large It is implemented by means of iteration. Background can be found and Implementation in the Overrelaxation overrelaxation including systems those (SSOR) approach already and Remson, Hornberger noted and Molz (1971). The successive Package by dividing shown in figure overrelaxation the finite values they successive iterations. The set adjacent slices as known quantities computed values of head for equations for multiplied the results the slice the slice into for (that processed). in this Gaussian SSOR "slices," discrete these as sets, sets of in a new set of estimated each slice slices elimination parameter, values 13-1 W, generally slice the terms for the most recently as "known" The values head between to the treating inserting head are processed, corresponding is, the adjacent final vertical iteration, elimination, being as the in the of the change in computed by Gaussian by an acceleration are taken node equations of equations solved implemented into In every in terms is then computed for directly grid As the equations expressed is resulting in turn, each slice. are first the to a slice. are processed for difference 54, and grouping each set corresponding equations technique values in the of head change process taken are then between of head change in that each 1 and 2; iteration Slice 4 Full Grid Figure 54.-Division of the three-dimensional model array into vertical slices for processing in the SSOR package. 13-2 for They are added to the the slice. preceding for iteration that until thus to obtain This slice. all completing in successive a single It should equations for not direct values values continue flow through for below with have been processed, sequence until is then a direct is less than method of solution each iteration to process the overall solution Each direct solution produces as successive of solution consideration cell, the addition repeated, the differences iterations slice, to change until an individual iteration, in sequence slices closure is described the procedure only is interim of head change based on the most recently slices; The process detail is used within but iterative. heads in adjacent array of slices, even though each individual or estimates each slice the nodes in the mesh. be noted that elimination) for computed in successive from the of head for The entire the series at all (Gaussian estimates repeated iteration. between the head values criterion is head values in the three-dimensional passes through the closure the final procedure of the slices respective computed are processed, the computed achieved. above can be illustrated in more of the node equations. The equation as developed 2, is in chapter of a second superscript of reproduced to indicate iteration level md w + GRi,j-1/2,khi,j-1,k + Gci-1/2,j,khi-l,j,k GVi,j,k-l/ZhY$,k-I + (- GVi,j,k-l/2 - GGi-l/E,j,k - GRi,j-1/2,k - GRi,j+l/E,k m, II - Gvi,j,k+l/2 - GGi+l/2,j,k w + CCi+l/2,j,khi+l,j,k + HGGFi,j,k)hi,j,k w + GRi,j+l/2,khi,j+l,k m, fi + CVi,j,k+l/Ehi,j,k+l 13-3 = RH%,j,k (113) In equation (113), the superscript of (113) side R refers is written of equation equation, the superscript the to the for iteration the following (113) result m refers is then level. If iteration subtracted can be written to the time step, an equation a+l, level, from each side while of the form and the of the left new as +CCi-l/*,j,k(hTI~~~,k-h~~~,j,k) CVi ,j,k-1/2,(h~:gf:-l-h::g.k-l) m, a+1 + (- CVi,j,k-l/2 + CRi,j-1/2,k(hi,j-I,k-hl:ja_l,k) - CRi,j+l/2,k - CRi ,j-1/2,k m,R+l m,a + HCOFi ,j,k)(hi,j,k-hi,j,k) t CCi+l/2,j,k(h~~~rj,k-h~~~,j,k) w - CVi,j,k-1/2hi,j,k-1 RHSi,j,k w - CRi,j-1/2,khi,j-l,k - CVi,j,k+l/E t CRi ,j+l/2,k(hT:~~~,k-h~~~tl,k) + cvi , j ,k+l/z(hi m, a+1 , j ,k+l-h~:~,k+l) m, 11 - CCi-l/E,j,k - CRi,j-1/2,k - cvi , j , k+1/2 + HCOFi,j,k)hy:Q,k w m,a w - CRi ,j+l/2,khi,j+l,k = - cci-1/2,j,khi-l,j,k - (- CVi,j,k-l/2 - CCi+l/2,j,k - CRi , j+1/2,k - CCi+l/E,j,k - CCi-1/2,j,k - CCi+l/2,j,khi+l,j,k - Cvi ,j,k+I/2hi ,j,k+l (114) In equation (114) the & and iteration head between iteration Note that of (114) when the consists conductance head already terms unknown terms Gh iterat entirely assembled obtained during are taken QtI--for as the changes m,a+l ion has been completed, of known terms--it in the formulation iteration R. 13-4 (hi,j,k example, the includes process, right in computed - h!/:ja,k). hand side the RHS and and estimate:; of Now suppose that rows, the we divide as shown in figure 54, and isolate nodes of an individual which is taken equation retain along (114), if slice--for values. Thus the terms m, a+1 side (hi+l,j,k and hTit,j,k - CCi+l/2,j,k - CVi,j,k+l/2 m,R - CRi,j-l/E,k to row i, as unknown terms, side slices we but to be known and of equation two expressions that of the terms (114), are to the right and in hy':,j,k - CRi,j+l/2,k + HCOFi,j,k)(hyIE:-hl:t,k) = m, Et1 - cc-i-1/2,j,khi-l,j,k - (- CVi,j,k-l/2 - CCitl/2,j,k - CRi,j+l/2,khi,jtl,k In terms + Cvi,j,ktI/2(h~:jaf:tI-h!i~~,ktI) - CVi,j,k-I/Eh;:Q,k-I - CRi , jt1/2,k we find 54, leaving - CCi-1/2,j,k - CRi,j-I/2,khl:Q-l,k left along with 4 of figure array. slice taken associated corresponding If we move these and rearrange, + CRi,jtI/2,k(hY:tZ:,k-hYIftI,k) RHSi,j,k i, this on the - hy;f,j,k). drop out, t (- CVi,j,k-l/2 slices at nodes in the two adjacent m, a+1 - hyl:,j,k) cci-1/2,j,k (hi-l,j,k as known quantities. of the equation slice dimensional slice at nodes within the head changes treated example, we are processing consider vertical the equations row 4 of the three the head changes CCi+l/Z,j,k the mesh into - CCi-1/2,j,k - CVi,j,ktl/2 - CRi,j-1/2,k t HCOFi,j,k)h!i:;,k m, at1 - CCitl/2,j,khitl,j,k w - CVi,j,ktl/2hi,j,ktl (115) 13-5 Now suppose the slices number, i; then iteration a Value Of initiated available. calculations side value slice in the processing TO circumvent preceding for in the i-l will order of increasing be completed row in each It follows that before calculations for slice i are initiated. m,a+l will be available when the processing of slice i is hi-l,j,k m, 11+1 in iteration a+l, whereas a value of hi+I,j,k will not be m,Q+I directly Thus the term CCi-I/2,j,khi-l,j,k can be incorporated as a known term cannot. are processed difficulty, mall hi+I,j,k, iteration, of (115). this (Thus in effect of head for of slice i, the value is substituted for we are using each adjacent m,Q+l but the term CCi+I/2,j,khi+I,,j,k slice.) from the of hy+I,j,k m, Q+l hi+I,j,k on the the most recently The resulting equation tight calculated is -f"', Q+l CVi , j ,k-l/2 + CRi,j-1/2,k(hi,j-l,k-hT:Q_l.k) (G:gf:-l-hy:q,k-l) t (- CVi,j,k-l/2 - CCi-1/2,j,k - CRi,j-1/2,k + HCOFi,j,k)(hT:K:-hyzJ,k) - CCi +1/2, j ,k - Cvi,j,ktl/2 41, Q+l t cvi ,j,ktl/2(hi,j,ktl-h'~~~,ktl) t CRi,jt1/2,k(~:9=:,k-h~:g+l,k) RHSi,j,k - cvi,j,k-l/2hy:Q,k-l m,Q - CRi ,j-1/2,khi,j-1,k - CRi , jt1/2,k m,Q = m, Q+l - cci-1/2,j,khi-l,j,k - (- CVi,j,k-l/2 - CCitl/2,j,k - CRi,jtl/2,khi,jtl,k - CRi,jtl/2,k - CCi-1/2,j,k - Cvi , j ,k+1/2 m, 11 - CCitl/2,j,khitl,j,k - CRi,j-1/2,k m,Q t HCOFi,j,k)hi,j,k m,a. - CVi,j,ktl/$i,j,ktl (ll6) In equation terms in slice (116), the i at iteration notation atl. K has been introduced The purpose 13-6 of this for notation the head will become clear as the solution slice is the process at each node. and an equation Thus a system established. Gaussian elimination the entire three-dimensional of equations in matrix CAli {AK}i where [AJi slice (116) is formulated in NC*NL unknowns is is usually small, the total enough so that direct solution approach (note the larger set that by such a procedure of equations associated model array.) associated with an individual slice, i, can be form as = {R)i (117) between iteration "constant" slice for is the coefficient -in,R+l m,Q , for hi,j,k-hi,j,k estimates, small is an efficient not be feasible The set the is generally in the model and NL form of of NC*NL equations generally written of the Because the number of layers number of equations with The number of nodes in the NC*NL, where NC is the number of columns number of layers; would is described. terms, matrix for slice i; {bF;}i is a vector of the change in computed head at each node in R and iteration representing the right g+l; side and {R}i of equation is the vector (116), of for i. The Gaussian (117) yields slice. elimination one value These terms head from iteration acceleration m,R+l m,a. hi,j,k = hi,j,k applied estimates a. tl. W, and each result iteration R+1; that to the matrix ~,a+1 m,R (hi,j,k-hi,j,k) as first R to iteration parameter, iteration of the term are taken head from the preceding head for procedure to obtain for for equations each node in the the change in computed Each is multiplied by the is added to the corresponding the final estimate of is, + w(hy:;f:-h;:;,k) (118) 13-7 m,R+l have been computed for Of hi,j,kl When values slice i, slice, the procedure itl. of calculation When all and calculations slices is initiated for have been processed are initiated for the each node (j,k) next the in the succeeding iteration iteration is conplete, unless closure has been achieved. As illustrated equation equal only (117) to the the figure is symmetric triangular in the program 55-b, with of the SSOR to achieve optimal to the trial adjustment of the the matrix and banded, with acceleration and error SIP "seed" parameter of convergence. procedure value storage as illustrated In this For this described NL=NC=3. necessary purpose, in Chapter is in example, is frequently can be applied. 13-8 of of the matrix, this array, NL*NC and NL+l. [A]i a maximum half-bandwidth has to be stored; in a two-dimensional rates of coefficients Because of the symmetry portion dimensions Adjustment similar 55-a, number of layers. lower provided in figure in methods 12, for 1 a11 a 12 1 a12 I I a14 a22 a23 a 23 a33 a14 a25 I I I I I I a25 a36 a 44 a45 a 45 a55 a47 a56 (a) Coefficient matrix for an individual slice (b) Two dimensional Figure 55.-Coefficient corresponding array for storage of matrix elements matrix for slice equations and computer storage array. 13-9 Slice-Successive Input the unit to the Overrelaxation Slice-Successive specified Package Input Overrelaxation (SOR) Package is read from in IUNIT(11). FOR EACH SIMULATION SORlAL 1. Data: Format: MXITER 110 SORlRP 2. Data: Format: HCLOSE IPRSOR F10.0 110 ACCL F10.0 Explanation Input MXITER--is ACCL--is of Fields Used in Instructions the maximum number of iterations the HCLOSE--is acceleration the head absolute is IPRSOR--is less parameter, change value than the printout for or equal is printed for SOR. When the nodes during is an even multiple at the end of each stress of IPRSOR. period 13-10 an iteration IF IPRSOR is equal of a time maximum stops. The maximum head change each iteration step. 1.0 and 2.0. convergence. to HCLOSE, iteration interval in a time between of head change from all is changed to 999. step usually criterion it for allowed step This regardless to zero, (positive whenever printout of the or negative) the also value time occurs of I:PRSOR. Module Documentation The Slice-Successive primary modules for the Slice-Successive Overrelaxation and one submodule. Allocates SORlRP Reads control Package (SORl) consists They are: Primary SORlAL Overrelaxation Modules space for arrays. information needed by the SORl Package. SORlAP Performs one iteration of slice-successive overrelaxation. Submodule SSORlB Solves a system of linear 13-11 equations. Package of three Narrative Module SORlAL allocates arrays the for Module SORlAL space in the X array are A, RES, IEQPNT, HDCG, and LRCH. lower diagonals RES holds the IEQPNT holds HDCG holds location of the residual symmetric vector a sequential of the cell (row, column, 1. Print 2. Read and print 3. Allocate the (ISUM) is space required for an array, is incremented 5. for a single a single each cell each iteration. and layer) its functions a message identifying the SOR is for slice,, slice. in a slice. LRCH holds which and had the'maximum the head each iteration. Module SORlAL performs 4. matrix number for The SOR the main diagonal hand sides) identification the maximum head change for change for pointer right SOR arrays. "A" holds coefficient (the for the Calculate required order: SOR Package. space in the variable required and print variable X array. The X-array ISOLD prior SOR can be calculated array-location by the following the maximum number of iterations. saved in the for the in the to allocation in step is location set equal 4. so that To allocate to ISUM. space Then ISUM number of elements. the space used in the ISUM - ISOLD. RETURN 13-12 X array, The space used by Flow Chart for Module SORlAL ,X array is the pool of memory space from which space is allocated for arrays used by various packages. PRINT A MESSAGE IDENTIFYING THE SORPACKAGE READ AND PRINT THE MAXIMUM NUMBER OF ITERATIONS ALLOCATE SPACE FOR SOR ARRAYS CALCULATE AND PRINT THE AMOUNT OF SPACE IN THE X ARRAY USED BY 13-13 SUBROUTINE SORlAL (ISUM,LENX, LCA, LCRES, LCHDCG,LCLRCH, LCIEQP, 1 MXITER,NCOL,NLAY,NSLICE,bf3W,IN,IOUT) : -----VERSION 1638 24JUL1987 SORlAL ********************************~*~*****************~************* ALLOCATE STORAGE FOR SOR ARRAYS ************************~***************************~*******~~***** C C C C C C SPECIFICATIONS: --------------------____________________------------.-------------- ----------------------------------------------------~------------- C ------PRINT A MiSSAGE IDENTIFYINGSOR PACKAGE WRITE(IOUT,l)IN 1 FORMAT(lHO,‘SORl -- SLICE-SUCCESSIVE OVERRELAXATION PACKAGE’ I,', VERSION1, 9/l/87 INPUT READ FROM UNIT’,131 C (-J&--- READ AND PRINT MXITER (MAXIMUM # OF ITERATIONS) READtIN, MXITER 2 FORMATtIlO) WRITE(IOUT,3) MXITER 3 FORMATt1X, 15, ' ITERATIONSALLOWED FOR SOR CLOSURE’1 ------ALLOCATE SPACE FOR THE SOR ARRAYS ISOLD=ISUM NSLICE=NCOL*NLAY MBW=NLAY+l LCA=ISUM ISUM=ISUMtNSLIC~*MBW LCRES=ISUM ISUM=ISUM+NSLICE LCIEQP=ISUM ISUM=ISUMtNSLICE LCHDCG=ISUM ISUM=ISUM+MXITER LCLRCH=ISUM ISUM=ISUM+3*MXITER ISF+=ISUM-ISOLD i C c4------CALCULATE AND PRINT THE SPACE USED IN THE X ARRAY WRITE(IOUT,4) ISP 4 FORMAT(lX,I8,' ELEMENTS IN X ARRAY ARE USED BY SOR’) ISUMl=ISUt+l WRITE(IOUT,5) ISUMlrLENX 5 FORMAT(lX,I8,' ELEMENTS OF X ARRAY USED OUT OF’,181 IF(ISUMl.GT.LENX) WRITE(IOUT,6) 6 FORMATt1X, ’ ***X ARRAY MUSTBE DIMENSIONED LARGER***‘) C c5 ..---+EJ-U~ RETURN END 13-14 List Variable of Variables for Module SORlAL Definition Range IN Package Primary will unit number from which be read. IOUT Global Primary unit ISOLD Package Before this module allocates space, ISOLD is set equal to ISUM. After allocation, ISOLD is subtracted from ISUM to get ISP, the amount of space in the X array allocated by this module. ISP Module Number of words in the ISUM Global Index number of the lowest element in the X array which has not yet been allocated. When space is allocated for an array, the size of the array is added to ISUM. ISUMl Module Index number of the by this module. LCA Package Location in the X array of the first element of array LCHDCG Package Location in the HDCG. X array of the first element of array LCIEQP Package Location in the I EQPNT. X array of the first element of array LCLRCH Package Location in the X array LRCH. of the first element of array LCRES Package Location RES. of the first element of array LENX Global Length of the X array in words. This should always be equal to the dimension of X specified in the MAIN program. FBW Package Maximum bandwidth MXITER Package Maximum number of iterations. NCOL Global Number of columns NLAY Global Number of layers NSLICE Package Number of cells number for in the all X array printed X array last input of the of the coefficient in the grid. in a slice. 13-15 this output. allocated element in the grid. for package IOUT = 6. by this X array matrix +l. module. allocated A. Narrative Module SORlRP reads data (ACCL), also called and the time-step the following 1. Read the zero, substitute equal to 999. parameter the Module SORlRP SOR package: factor; (IPRSOR) for closure printing criterion its parameter (HCLOSE); head change. Module SORlRP performs chart. Print acceleration interval a default parameter for printing value of 1.0. (ACCL), This module functions (ACCL), the closure criterion RETURN. 13-16 the closure head change If the maximum number of iterations (IPRSOR). 3. the the acceleration in the order: (HCLOSE), and the 2. relaxation interval does not have a flow for for criterion (IPRSOR), IPRSOR is less (MXITER), (HCLOSE), and the If than the ACCL is one, set it acceleration head-change interval SUBROUTINE SORlRPlMXITER, ACCL, HCLOSE,IN, IPRSOR,IOUT) C C C-----VERSION 1005 16MAR1983 SORlRP **************************************************************~*** READ PARAMETERSFOR SOR **t***~**~**t******+********~*~*****~******~*****~*****~~**~***~** C C c” C SPECIFICATIONS: -----------------------------------------------------------------C -----------------------------------------------------------------C C Cl----- READ THE ACCELERATION PARAMETER/RELAXATION FACTOR (ACCL) THE Cl---CLOSURE CRITERION (HCLOSE) AND THE NUMBEROF TIME STEPS Cl--BETWEENPRINTOUTS OF MAXIMUM HEAD CHANGES (IPRSOR). READtIN, 1 ACCL,HCLOSE,IPRSOR FORMAT(2F10.0,110) IF(ACCL.EQ.0.) ACCL=l. IF(IPRSOR.LT.l) IPRSOR=999 :2------PRINT A~CL, HCLOSE, IPRSOR WRITE(IOUT,lOO) 100 FORMAT(lHO,///57X,‘SOLUTION BY SLICE-SUCCESSIVE OVERRELAXATION' 1/57X,43('-')) WRITE(IOUT,llS) MXITER 115 FORMAT(lHO,47X,'MAXIMUM ITERATIONSALLOWED FORCLOSURE =',I91 WRITE (IOUT, ACCL 120 FORMATtlH ,63X, 'ACCELERATION PARAMETER ='rG15.5) WRITE(IOUT,125) HCLOSE FORMATtlH,52X,'HEAD CHANGE CRITERIONFORCLOSURE ='rE15.5) WRITE(IOUT,130) IPRSOR 130 FORMATtlH ,52X,‘SOR HEAD CHANGEPRINTOUT INTERVAL=',I91 125 C C3------RETURN RETURN END 13-17 List of Variables for Module SORlRP Definition Variable Range ACCL Package Acceleration HCLOSE Package Closure criterion IN Package Primary will unit number from which be read. IOUT Global Primary unit IPRSOR Package Frequency (in time steps) with which the maximum head changes for each iteration will be printed. MXITER Package Maximum number of iterations. parameter. for the number for 13-18 all iterative input printed procedure,, for output. this package IOUT = 6,, Narrative Module SORlAP performs relaxation (SSOR) algorithm equations. are combined, [A] and the single vector slice. which {RES) on the are calculated by slice), right Sn the array SSORlB which solves head changes which of the matrix [A] the current the matrix are compared to the closure criterion matrix equation vector equation by the the iteration. The final iteration. procedure and banded, and the changes are added to the heads from the preceding heads for HCOF for a only As heads are calculated, is then multiplied head changes for coefficient is symmetric HNEW. The matrix terms by the formulation hand side are saved. Over- of finite-difference to form the and NLAY subdiagonals to get the final Slice-Successive the system matrix passed to a submodule factor solving Since the coefficient are stored of approximate of the CC, CR, and CV and the composite row by row (slice main diagonals they for (27)) Module SORlAP one iteration The conductances and RHS (see equation for The final iteration the a vector relaxation head to get the head changes for to see if for {RES) are the iterative iteration procedure has closed. Module SORlAP performs 1. matrix Calculate the its functions number of elements in the following in the compressed order: coefficient [A]. 2. Process 3. Clear 4. Assign (remember that the slices (rows) one at a time (DO STEPS 3-7). the A array. integers sequentially finite-difference to the active equations 13-19 cells are formulated in the slice only for active cells). 5. the Calculate residual If the elements vector the cell the main diagonal will consist will be formed Process {RES). is inactive, of the coefficient of HCOF plus in an accumulator zero, the Determine cell (b) is (c) If the equation EE and subtract (d) there from EE, and subtract is is active, matrix [A]. Remember that to the left in step (e) If EE and subtract (f) 5(c) there there from EE and subtract adjacent cells. They of EE multiplied from an head from the times left, NEQ is to HCOF and RHS, last iteration. subtract the conductance from HNEWfrom R. right, times the coefficient did If cell. EE and R equal a node to the subtract the conductance HNEW from R; and, into matrix the if compressed is symmetric the cell coefficient so the conduc:tance not have to be stored. is a node to the the conductance If next move the conductance right six in of hi,j,k) number (NED) of the cell. the conductance to the multipliers and at a time. The elements (HNEW) are subtracted is a node to the the conductance If cell. [A] one cell The contents Move on to the HNEWcontains there matrix residual. inactive. Note: (the EE. iteration Set the accumulators respectively. next to the called coefficient in the slice matrix conductances (R) to form the (a) the cells move on to the by the head from the previous accumulator in the compressed times rear, 13-20 the conductance from HNEWfrom R. is a node to the front, the conductance subtract times subtract HNEW from R. the conductance Remember that the form of the SSOR equations rows on the left (g) and subtract If active, there If there Move EE into If there the times there is only residual it into "full" in the vector subtract {RES). conductance from EE if below residual for solve If there this it slice, iteration) this the first EE times and leave the next slice. result in are two or more equations, of head change for (a) Subtract go on to the directly (first in the slice, row in A corresponds vector. for For each cell the cell matrix. the system of equations 7. the The first row of A. SSORlB to solve estimate from EE A. coefficient are no equations one equation, the conductance HNEWfrom R; and, the first in the HNEW from R and store If head in adjacent HNEWfrom R. is a node below, move the conductance to the main diagonal 6. times the conductance (i) subtract is a node above, the conductance and subtract containing hand side. (h) is does not have terms the calculate slice leaving in the call the vector the head for submodule results {RES). the current iteration. by the Multiply relaxation factor estimate to get the final of head change for estimate this iteration of head change for this iteration. (b) the last Add the final iteration head change for to get the head for 13-21 this this iteration iteration. to the head from (c) other If cell, 8. store Save the be printed 9. largest Compare the If (ICNVG) equal biggest HCLOSE is 12. If the time for the iteration that for any cell. so that it can than (BIGG) to the BIGG, set the closure convergence criterion flag and you have not exceeded the maximum number of iterations. interval each iteration 13. of the than RETURN. convergence step location greater step. head change greater is to one. number of iterations, Print cell head change from this If you have not converged 11. this the head change and the at the end of the time (HCLOSE). 10. the head change for failed, specified in this time or this is the by the user, step. RETURN. 13-22 last print time step, or this is the maximum head change 8 Flow Chart for Module SORlAP A is a compressed coefficient matrix for a slice. It contains the main diagonal of the full matrix and the NLAY diagonals below it. (NLAY is the number of layers.) Sequence Number is a number used to identify the internal (variable-head) cells in a slice and also the equations for each internal cell. FOR IN RES is a vector containing the residuals for a slice. It consists of RHS (from the basic finite-difference equation) plus all of those terms which are moved to the right hand side to get the equations ready for solution in residual form. First estimates of head change: these are the head changes calculated by simultaneously solving the equations for a They will be multislice. plied by the relaxation factor to get final estimates of head change. Final estimates of head change: these are the head changes calculated by multiplying first estimates by the relaxation factor. They are added to the heads from the previous iteration to get head for the current iteration. ICNVG is the convergence flag. It is set in the approximator and returned to the MAIN Program so that the iteration loop can be terminated. 13-23 SUBROUTINE SORlAP(HNEW, IBOUND,CRrCC,CVr HCOF, RHS, A, RES, IEQPNT, HDCG,LRCH,KITER,HCLOSE,ACCL,ICNVG,KSTP,KPER, 1 2 IPRSOR,MXITERINSTPINCOL,NROW,NLAYINSLICE,M~W,IOUT) -----VERSION 0936 09MAY1983 SORlAP ***************************************************~************** SOLUTION BY SLICE-SUCCESSIVE OVERRELAXATION -- 1 ITERATION *******************************************~************~~********* : C C C SPECIFICATIONS: ---------------------------------------------------------.--------DOUBLE PRECISION HNEW, DIFF,DP, EE, R,HCFHNWr HHCOF C DIMENSION HNEW(NCOL,NROW,NLAY)r IBOUND(NCOLrNROW,NLAY)r CR(NCOL,NROW,NLAY)r CC(NCOLrNRCW,NLAY)r CV(NCOLrNROW,NLAY)r HCOF(NCOLrNROW,NLAY)r RHS(NCOLrNROW,NLAY)r HDCGtMXITER), LRCH(~~MXITER)~A~J~BW,NSLICE)~RES(NSLICE), 3’ IEQPNT(NLAY,NCOL) --------------------------------------------------------~--------- 1 1 C C # OF ELEMENTS IN COMPRESSED MATRIX A Cl ------CALCULATE Cl--INITIALIZE FIELDS TO SAVE LARGEST HEAD CHANGE. NA=MBW*NSLICE BIG=O. ABSBIG=O. IB=O JB=O AND KB=O C c2--- C PROCESS EACH SLICE DO 500 I=lrNROW Q------CLEAR A DO 110 J=lrNSLICE DO 110 K=l,MBW 110 A(K,J)=O. E4------ASSIGN A SEQUENCE # TO EACH VARIABLE HEAD CELL. NEQT=O DO 200 J=l,NCOL DO 200 K=l,NLAY IEQPNT(K,J)=O IF(IBOUND(J,I,K) .LE.O) GO TO 200 NEQT=NEQT+ 1 IEQPNT(K,J)=NEQT 200 CONTINUE C c5------FOR EACH CELL LOAD MATRIX A AND VECTOR RES DO 300 J=lrNCOL DO 300 K=lrNLAY &A -----IF SEQUENCE # NEQ=IEQPNT(K, J) IS 0 (CELL IF(NEQ.EQ.0) GOTO 300 C C5&---- INITIALIZE ACCUMULATORS IS EXTERNAL) EE AND R EE=O. C R=RHS(J,I,K) 13-24 GO ON TO NEXT CELL clj(-+--- IF NODE TO LEFT SUBTRACT TERMS FROM EE AND R IF(J.EQ.l) GO TO 120 DP=CR(J-lrI,K) R=R-DP*HNEW(J-1rIrK) EE=EE-DP C C5D-w-n IF NODE TO RIGHT SUBTRACT TERMS FROM EE 8 R, MOVE COND TO A 120 IF(J.EQ.NCOL) GO TO 125 SF’=CR(J,I,K) DP= SP R=R-DP*HNEW(J+lrIrK) EE=EE-DP NXT=IEQPNT(K,J+l) IF(NXT.GT.0) A(l+NXT-NEQ,NEQ)=SP C ME--IF NODE TO REAR SUBTRACT TERMS FROM EE AND R 125 IF(I.EQ.l) GO TO 130 DP=CC(J,I-1rK) gR;y;HpNEW’J,I-1rK) = C pj F---IF NODE TO FRONT SUBTRACT TERMS FROM EE AND R 130 IF(I.EQ.NROW) GO TO 132 DP=CC(J,I,K) ;;R;$P;HpNEW(J,I+lrK) = . C IF NODE ABOVE SUBTRACT TERMS FROM EE AND R CSG---132 IF(K.EQ.l) GO TO 134 DP=CV(J,I,K-1) R-R-DP*HNEW(JrI,K-1) EE=EE-DP C C5 H----s IF NODE BELOW SUBTRACT TERMS FROM EE 8 R AND MOVE CDND TO A 134 IF(K.EQ.NLAY) GO TO 136 SF=CV(J,I,K) DP=SP R=R-DP*HNEW(JrIrK+l) EE=EE-DP IF(IEQPNT(K+lrJ).GT.O) A(2rNEQ)=SP -----MOVE EE INTO A, SUBTRACT EE TIMS 136 HHCOF=HCOF(J,I,K) A(l,NEQ)=EE+HHCQF HNW=HNEW(JrIrK) HCFHNW=HNW*HCOF(J, 1,Kl RES(NEQ)=R-EE*HNEW(J,I,KbHCFHNW 300 CONTINUE LAST HEAD FROM R TO GET RES NO EQUATIONS GO TO NEXT SLICE, IF ONE EQUATION SOLVE is6 ------IF IF 2 EQUATIONS CALL SSORlB TO SOLVE FOR FIRST c6 ------DIRECTLY, (3j--ESTIMATE OF HEAD CHANGE FOR THIS ITERATION. IF(NEQT.LT.l) GO TO 500 C C7------ IF(NEQT.EQ.l) RES(l)=RES(l)/A(lrl) IF(NEQT.GE.2) CALL SSORlB(A,RES,NEQT,NA,MBW) FOR EACH CELL IN SLICE CALCULATE FINAL DO 400 J=lrNCOL DO 400 K=l,NLAY NEQ=IEQF’NT(K, J 1 IF(NEQ.EQ.0) GO TO 400 C 13-25 HEAD CHANGE THEN HEAD. C7A-es-- MULTIPLY FIRST ESTIMATE OF HEAD CHANGEBY RELAX FACTORTO ’ C7A----- GET FINAL ESTIMATE OF HEAD CHANGEFOR THIS ITERATION, DH=RES(NEQ)*ACCL DIFF=DH C C7&---- ADD FINAL ESTIMATE TO HEAD FROMLAST ITERATIONTO GET HEAD c7B----- FOR THIS ITERATION. HNEW(J,I,K)=HNEW(J,IIK)+DIFF FINAL HEAD CHANGEIF IT IS THE LARGEST ABSDH=ABS(DH) IF(ABSDH.LE.ABSBIG) GO TO 400 :7c -----SAVE ABSBIG=ABSDH BIG=DH IB=I JB=J KB=K 400 CONTINUE : 500 CONTINUE" Ei3------SAVE LARGEST HEAD CHANGEFOR THIS ITERATION HDCG(KITER)=BIG LRCH(lrKITER)=KB LRCH(i?rKITER)=IB LRCH(3rKITER)=JB k ------IF LARGEST HEAD CHANGEIS SMALLER THAN CLOSURETHEN SET c9 ------CONVERGE FLAG (ICNVG) EQUAL TO 1. ICNVGO IF(ABSBIG.LE.HCLOSE) ICNVGl C ClO----- IF NOT CONVERGEDAND NOT EXCEDEDITERATIONS THEN RETURN IF(ICNVG.EQ.0 IF(KSTP.EQ.l) 600 FORMATt1HO) .AND. KITER.NE.MXITER) WRITE(IOUT,6001 RETURN C Cll--- PRINT NU1YBEROF ITERATIONS WRITE(IOUT,601)KITER,KSTP,KPER 601 FORMAT(lX,I5,' ITERATIONSFORTIME STEP'rI4r' IN STRESSPERIOD', 1 13) FAILED TO CONVERGEOR LAST TIME STEP OR PRINTOUT INTERVAL SPECIFIEDBY USER IS HERE THEN PRINT MAXIMUM HEAD CHANGESFOR EACH ITERATION. IF(ICNVG.NE.0 .AND. KSTP.NE.NSTP .AND. MOD(KSTP,IPRSORl.NE.O) 1 GO TO 700 El2-----IF c12--c12--- WRITE(IOUT,5) 5 FORMAT(1HOr’MAXIMUMHEAD CHANGEFOR EACH ITERATION: '/ 1 lHO,4(’ HEAD CHANGE LAYER,ROW,COL')/lX,120('-'1) WRITE(IOUT, (HDCG(J)r(LRCH(I,J)rI=lr3)rJ=lrKITER) 10 FORMAT((lX,4(4X,G12.4,' (',13,',',13,',',13,')I))) WRITE(IOUT,ll) 11 FORMATtlHD) C Cl3 -----RETURN 700 RETURN C END 13-26 List Variable Range A Package ABSDIG ABSDH Module Module ACCL cc Package Global CR Global cv Global DH DIFF DP EE HCLOSE HCOF Module Module Module Module Package Global HDCG Package HNEW Global I IB Module Module IBOUND Global ICNVG Global IEQPNT Global IOUT I PRSOR Global Package J JB Module Module K KB Module Module KITER Global KPER Global of Variables for Module SORlAP Definition DIMENSION (MBW,NSLICE), Compressed coefficient matrix for a slice. Largest ABSDH for this iteration. Absolute value of head change in a cell for the current iteration. Acceleration parameter. DIMENSION (NCOL,NROW,NLAY), Conductance in the column CC(J,I,K) contains conductance between direction. nodes (J,I,K) and (J,I+~,K). DIMENSION (NCOL,NROW,NLAY), Conductance in the row CR(J,I,K) contains conductance between direction. and (J+l,I,K). nodes (J,I,K) DIMENSION (NCOL,NROW,NLAY-l), Conductance in the CV(J,I,K) contains conductance vertical direction. and (J,I,K+l). between nodes (J,I,K) Change in head in a cell during one iteration. Double-precision change in head (DH). Double-precision temporary field. Main diagonal term in the finite-difference equation. Closure criterion for the iterative procedure. DIMENSION (NCOL,NROW,NLAY), Coefficient of head in the cell (J,I,K) in the finite-difference equation. DIMENSION (MXITER), Maximum head change for each iteration. DIMENSION (NCOL,NROW,NLAY), Most recent estimate of HNEWchanges at each iteration. head in each cell. .. Index for rows. Row number of the cell containing the largest head change. . DIMENSION (NCOL,NROW,NLAY), Status of each cell. < 0, constant-head cell = 0, inactive cell > 0, variable-head cell Flag is set equal to one when the iteration procedure has converged. DIMENSION (NLAY,NCOL), Sequence numbers for variablehead cells in a slice. Primary unit number for all printed output. IOUT = 6. Frequency (in time steps) with which the maximum head changes for each iteration will be printed. Index for columns. Column number of the cell containing the largest head change. Index for layers. Layer number of the cell containing the largest head change. Reset at the start of each time Iteration counter. step. Stress period counter. 13-27 List Variable of Variables for Module SORlAP (Continued) Definition Range KSTP Global LRCH Package MBW MXITER NA Package Package Package NCOL NEQ NEQT NLAY NROW NSLICE NSTP NXT R Global Module Package Global Global Package Global Module Module RES RHS Package Global SP Module Reset at the start of each stress Time step counter. period. DIMENSION (MXITER), Layer, row, and column of the cell containing the maximum head change (HDCG) for each iteration. Maximum bandwidth of the coefficient matrix +l. Maximum number of iterations. Number of elements in the compressed coefficient matrix (A). Number of columns in the grid. Index for equations (variable-head cells) in a slice. Number of equations (variable-head cells) in a slice. Number of layers in the grid. Number of rows in the grid. Number of cells in a slice. Number of time steps in the current stress period. Sequence number of the cell to the right. Right hand side of the finite-difference equation as modified (terms for the adjacent rows moved to the right) for solution by the slice-successive overrelaxation. DIMENSION (NSLICE), Residual. DIMENSION (NCOL,NROW,NLAY), Right hand side of the finite-difference equation. RHS is an accumulation of terms from several different packages. Single-precision temporary field. 13-28 Narrative for Module SSORlB uses Gaussian of the form [A]{X)={B). "N. " It is stored single the space reserved The indices organization. format index for (B). vector the the first Modify inverse to aT,T which matrix as it is calculated, are those index. rank 55 and uses a is stored for used in the program in standard matrix are based on the Module SSORlB performs N-l rows using each one, of the main diagonal its functions in sequence, as are indexed element---aT,T. (The element of column I in the row I so that the terms corresponding is the first each of the rows after are eliminated. MBW-1 equations Since the by 'IL." coefficient matrix is banded, (where MBW is the maximum half-bandwidth one) where the term to be eliminated equation and banded with shown in figure chart equation [A].) term are only 4. is symmetric format actually a matrix order: Calculate to the pivot equation to solve row (row I). compressed there {X), and a single (ID) points 3. The vector Work through the pivot 2. [A] used in the module flow in the following 1. The matrix The indices compressed elimination in the compressed subscript. Module SSORlBs (The equation is not already corresponding equal to zero. to row "L" is plus The rows referred to as "L.") Calculate the coefficient and subtracted C which when multiplied from equation 13-29 L will eliminate by the pivot a term in equation L. (The index IB points of symmetry, 5. is equal Calculate to the right matrix is banded, pivot. Therefore, 6. 7. side which for to the coefficient of the coefficient there at most, C times Subtract L. is being MBW-1 coefficients the right (The index L for because each of the terms eliminated. MBW-1 nontero terms Because the to the right of the have to be calculated. in the in equation which, to be eliminated.) a coefficient C times equation in equation that are only coefficient of equation in the pivot the new coefficients Subtract corresponding to a coefficient pivot equation from the L. side LB points of the pivot to the equation coefficient from the in equation right L must be calculated.) 8. Solve equation 9. Work backward N for X(N) putting from equation N-l the result solving in B(N). each equation (equation X(L). 10. Set the 11. Multiply equation accumulator "SUM" equal the coefficient L) by the corresponding 12. Calculate the 13. RETURN. value to zero. to the value of X(L) right of the main diagonal of X and add it and store 13-30 it to the in B(L). sum. (in L) Flow Chart for Module SSORlB MBW is the maximum half bandwidth of the coefficient matrix plus one. FOR EACH ROW I (I=l... , N-l) CALCULATE Cl, THE INVERSE OF THE PIVOT Cl+$j -----A FOR EACH ROW J 3 (J=l.. ., MEW-l) 4 CALCULATE C=al,l+J’Cl FOR E&ZH COLUMN I+K K=J...., MBW-1 I SUBTRACT C’B(I) FROM B(I+J) L + FOR EACH EQUATION L 8 9 (L=N-1, N-2,..., 1) 10 I CLEAR THE ACCUMULATOR I ADD_ZH_E TERM aLIL+J?~aTO SUM I h FOR EACH TERM L+J’ J=l I..., MBW-1 CALCULATE X(L)=(B(L)SUM)/A(L.L) 13-31 SUBROUTINE SSORlBt A, B, N, NA,MBW) C C C-----VERSION 1359 31MAR1983 SSORlB ****************************************************************** C C SOLVE A SYMMETRIC SET OF EQUATIONS C A IS COEFFICIENTMATRIXIN COMPRESSEDFORM C B IS RIGHTHAND SIDE AND IS REPLACED BY SOLUTION C N IS NUMBEROF EQUATIONS TO BE SOLVED C MBWIS BANDWIDTH OF A C NA IS ONE-DIMENSION SIZE OF A ******+*********************************************************** C C C C SPECIFICATIONS: -----------------------------------------------------------------DIMENSIONA(NA)rB(N) ------------------------------------------------------------------ C C NMl=N-1 MBWl=MBW-1 ID=l-M5W C Cl--- SEQUENTIALLY USE EACH OF THE FIRST N-l Cl ------THE PIVOT ROW. ROWSAS DO20 I=lrNMl C C2------CALCULATE THE INVERSEOF THE PIVOT. ID=IDtMBW Cl=l./A(ID) LD=ID L=I :3 ------FOR EACH ROWAFTER THE PIVOT ROW (THE TARGET ROW) C3------ ELIMINATE THE COLUMNCORRESPONDING TO THE PIVOT. Do 15 J=lrMBWl L=L+l 1FtL.GT.N) GO TO 20 IB=ID+J C THE FACTOR NEEDED TO ------CALCULATE Y4------TARGET ROW. @A(IB)*Cl LD=LD+MBW 13-32 ELIMINATEA TERM IN THE l LB=LD-1 L C5------ MODIFYTHE REST OF THE TERMS IN THE TARGET ROW. DO 10 K=J,b8Wl C C&---SUBTRACT THE FACTOR TIMES A TERM IN THE PIVOT ROW (3j-w--w FROM THE CORRESPONDINGCOLUMNIN THE TARGET ROW. LB=LB+1 A(LB)=A(LB)-C*A(IDtK) 10 CONTINUE :7 ------MODIFY THE RIGHT SIDE OF THE EQUATIONCORRESPONDING C7------ TO THE TARGETROW. B(I+J)=B(ItJ)-C*B(I) 15 CONTINUE 20 CONTINUE ID=IDtMBW n &------SOLVE THE LAST EQUATION. B(N)=B(N)/A(ID) ------WORKING BACKWARDSSOLVE THE REST OF THE EQUATIONS. DO70 I=lrNMl ID=ID-MBW C Cl(-j--- C Cll--- C CLEAR THE ACCUMULATORSUM. suM=o.o L=N-I MBWlM=MINO(MBWl,I) ADD THE KNOWNTERMS IN EQUATION L TO SUM. DO 60 J=l,MBWlM SUM=SUMtA(IDtJ)*B(L+J) 60 CONTINUE cyJ--- SOLVEFORTHE ONEUNKNOWN IN EQUATIONL. B(L)=(B(L)-SUM)/A(ID) 70 CONTINUE C C13-----RETURN RETURN END 13-33 List Variable of Variables for Module SSORlB Definition Range A Package DIMENSION (MBW,NSLICE), for a slice. B Package DIMENSION (N), C Module Factor Cl Module Inverse of pivot. I Module Index IB Module Index for elements ID Module Index of pivots. J Module Index for columns. K Module Index for columns. L Module Index for equations. LB Module Index for elements the Compressed Right-hand-side needed to eliminate for rows in the matrix vector. a term in the target SSOR matrix to the coefficient right (not of the in the target row. the grid). pivot. row to the right of main diagonal. LD Module Index of the main diagonal MBW Package Maximum bandwidth of the coefficient matrix MBWl Module Maximum bandwidth of the coefficient matrix. MBWlM Module Maximum possible number of the nonzero the right of the main diagonal. N Package Number of equations NA Package One-dimension NM1 Module N-l. SUM Module In back substitution--in equation the right of the main diagonal size 13-34 elements in the target rows. +l. elements to to be solved. of compressed matrix "A." L, sum of terms term (L,L). to CHAPTER 14 UTILITY Utility to several modules different of a "U" followed are those packages. MODULES submodules which perform The name of a utility by a five-character mnemonic. general tasks module always There are eight common consists utility modules: UBUDSV Writes an unformatted record consisting of an array with one real number for each cell in the grid. ULASAV Writes an unformatted record consisting of an array with one real number for each cell in a layer. ULAPRS and ULAPRW Prints one two-dimensional array which contains one real number for each cell in a layer. ULAPRS prints, in strip form, the first N columns (where N is the number of values that can fit on one print line) of each row and then the next N columns, etc., until all columns of each row are printed (fig. 56). ULAPRWprints, in wrap form, all of row 1, all of row 2, and all of row 3, etc. The format for printing arrays is shown in table 2. UCOLNO Prints column numbers at the top of each page of data printed by ULAPRS and ULAPRW. UZDREL Reads a two-dimensional array of real U2DINT Reads a two-dimensional array of integers. UlDREL Reads a one-dimensional array of real 14-1 numbers. numbers. 1: 122 13” 14” 155 16 6 177 8 9 10 1 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 2 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 3 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 4 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 5 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 6 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 7 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 WRAP FORM 1 2 3 4 5 6 7 8 9 10 1 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 2 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 3 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 4 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 5 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 6 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 7 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 11 12 13 14 15 16 17 1 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 2 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 3 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 4 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 5 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 6 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 7 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 1325.79 STRIP FORM Figure 56.~Illustration of wrap and strip forms of printed for a layer containing 7 rows and 17 columns. 14-2 output l codes for 2 .--Print-format ULAPRS and ULAPRW. Table utility modules IPRN FORMAT 1 11610.3 2 9613.6 3 15F7.1 4 15F7.2 5 15F7.3 6 15F7.4 7 2OF5.0 8 20F5.1 9 20F5.2 10 20F5.3 11 20F5.4 12 10611.4 14-3 Input Instructions For Array Reading Utility Modules The real two-dimensiohal array reader (UZDREL), t&&integer two-dimensional array reader (U2DINT), and the real one-dimensional array reader (UlDREL) read one array-control record and, optionally, a data array in a format specified on the array-control record. The control record is read from the input unit number specified for the major option For example, the Recharge Package uses that is requesting the array. The input unit for the recharge option is U2DREL to read the RECH array.' contained in IUNIT (8), and accordingly, the RECH array control record is read on this input unit. FDR REAL ARRAY READER (U2DREL or UlDREL) Data: Format: LOCAT CNSTNT FMTIN IPRN 110 F10.0 5A4 110 FMTIN 5A4 IPRN 110 FOR INTEGERARRAYREADER(U2DINT) Data: Format: LOCAT ICONST 110 110 Explanation of Fields Used in Input Instructions LOCAT--indicates If the location of the data which LOCAT < 0, the sign is reversed which an unformatted will be put to give the record will If LOCAT = 0, every element in the array will value CNSTNT/ICONST. in the array. unit number from be read. be set equal to the If LOCAT > 0, it is the unit read in the array-control CNSTNT/ICONST--is a constant. number from which data values will be format specified in the third field of the record (FMTIN). Its use depends on the value of LOCAT. If LOCAT = 0, every element in the array is set equal to CNSTNT/ICONST. If LOCAT f 0, and if CNSTNT/ICONST f 0, every element in the array is multiplied by CNSTNT/ICONST. FMTIN--is the format of records containing the array values. It is used only if the first field in the array-control record (LOCAT) contains The format must be enclosed in parentheses; for a positive number. example, (15F5.0) for real data and (1515) for integer data. 14-4 IPRN--is a flag indicating that the array being read should be printed and a code for indicating the format that should be used. It is used only if LOCAT is not equal to zero. The format codes are different for each of the three modules. IPRN is set to zero when the specified value exceeds those defined in the chart below. If IPRN is less than zero, the array will not be printed. IPRN UZDREL U2DINT UlDREL 10612.5 0 10611.4 10111 1 11610.3 6011 2 9613.6 4012 3 15F7.1 3013 4 15F7.2 2514 5 15F7.3 2015 6 15F7.4 7 2OF5.0 8 20F5.1 9 20F5.2 10 20F5.3 11 20F5.4 12 10611.4 14-5 Narrative Utility dimensioned module UBUDSV writes (NCOL, NROW, NLAY). by an unformatted information consists record Module UBUDSV an unformatted The record containing record containing identifying consisting the array information. of an array is preceded The identifying of: KSTP current time KPER current stress TEXT label character NCOL number of columns integer 1 word NROW number of rows integer 1 word NLAY number of layers integer 1 word Documentation a list for of this step period module consists of variables. 14-6 only integer 1 word integer 1 word string of comments in the 4 words program and l BUFF, NCOL,NROW,NLAY, IOUT) SUBROUTINE UBUDSV(KSTP, KPER, TEXT, IBDCHN, C C C-----VERSION 1637 12MAY1987 UBUDSV ************************************************~***************** RECORDCELL-BY-CELL FLOW TERMS FOR ONE COMPONENTOF FLOW. ****~************************************************************~ C C C SPECIFICATIONS: --------------_--------------------------------------------------- : C CHARACTER*4 TEXT DIMENSION TEXT(4) rBUFF(NCOL, NROW,NLAY) -----_---c_------------------------------------------------------- C C Cl ------WRITE AN UNFORMATTEDRECORDCONTAINING IDENTIFYING Cl--- C INFORMATION. 1) TEXT, IBDCHN, KSTP,KPER WRITEtIOUT, 1 FORMAT(lX,‘“‘,4A4,‘” BUDGET VALUES WILL BE SAVED ON UNIT',I3, 1 ' AT END OF TIME STEP',I3,', STRESS PERIOD',131 C c2---(-&L--c2--- C C3------ WRITE(IBDCHN)KSTP, KPER, TEXT, NCOL,NROW,NLAY WRITE AN UNFORMATTEDRECORDCONTAINING VALUES FOR EACH CELL IN THEGRID. THE ARRAY IS DIMENSIONED (NCOL,NROW,NLAY) WRITE(IBDCHN)BUFF RETURN RETURN END 14-7 List Variation of Variables for Module UBUDSV Definition Range BUFF Global DIMENSION (NCOL,NROW,NLAY), Buffer used to accumulate information before printing or recording it. IBDCHN Module Unit IOUT Global Primary KPER Global Stress KSTP Global Time step period. NCOL Global Number of columns NLAY Global Number of layers NROW Global Number of rows in the TEXT Module Label number on which the array unit number for period counter. all will printed Reset at the counter. in the in the to be printed 14-8 be recorded. output; start IOUT = 6. of each stress grid. grid. grid. or recorded with the array data. Narrative Utility array module ULASAV writes dimensioned by an unformatted information for consists (NCOL, NROW). record Module ULASAV an unformatted The record containing record containing identifying consisting the information. array of an is preceded The identifying of: integer 1 word integer 1 word elapsed time in the current stress period real 1 word TOTIM elapsed time simulation real 1 word TEXT label character NCOL number of columns integer 1 word NROW number of rows integer 1 word ILAY layer integer 1 word KSTP current time KPER current stress PERTIM step period in the number 14-9 string 4 words SUBROUTINE ULASAV( BUF, TEXT, KSTP, KPER, PERTIM, TOTIM, NCOL, NROW,ILAY,ICHN) 1 C C-----VERSION C C C C C C C C Cl---- Cl--C c2--c2---- C 1642 12MAY1987 ULASAV ***t************************************************************** SAVE 1 LAYER ARRAY ON DISK ****************************************************************** SPECIFICATIONS: -----------------------------------------------------------------CHARACTER*4 TEXT DIMENSION BUF(NCOL,NROW)rTEXT(4) ------------------------------------------------------------------ WRITEAN UNFORMATTEDRECORDCONTAINING IDENTIFYING INFORMATION. WRITEt ICHN) KSTP,KPER, PERTIM,TOTIM,TEXT, NCOL,NROW,ILAY WRITE AN UNFORMATTEDRECORDCONTAINING ARRAY VALUES THE ARRAY IS DIMENSIONED (NCOL,NROW) WRITEtICHN)((BUF(IC,IR)rIC=lrNCOL),IR=lrNROW) C3------RETURN RETURN END 14-10 l List Variable l of Variables for Module ULASAV Definition Range BUF Module Buffer containing IC Module Index ICHN Module Unit I LAY Module Layer number. IR Module Index for KPER Global Stress KSTP Global Time step period. NCOL Global Number of columns NROW Global Number of rows in the PERTIM Package Elapsed TEXT Module Label TOTIM Package Elapsed for data to be printed or recorded. columns. number on which the array is to be recorded. rows. period counter. counter. time during to be printed time Reset at the in the of each stress grid. grid. the current or recorded in the simulation. 14-11 start stress with period. the array data. Narrative Module ULAPRS prints using one of twelve the following set it equal 2. Use the Calculate and the format If code (IP). form its (fig. 56) tasks in it is less than 1 or greater than 12, default). format code (IP) the to determine number of spaces Initialize (NSTRIP). last column Loop through 5. Calculate 6. Print 7. Call 8. Loop through 9. in strip Module ULAPRS performs FORTRAN formats. 4. appropriate array the number of values (NCAP) on one line. number of strips (Jl) a two-dimensional to 12 (the to be printed 3. Module ULAPRS order: Get the 1. for (52) the the first a title for strips (Jl) the each value fields (NCPF) and the to store the column for this first column each strip. (DO STEPS 5-8). and last (52) strip. on each strip. module UCOLNOto print format used for the rows printing the column numbers above each strip. columns (IP). RETURN. 14-12 Jl through 52 using the Flow Chart for Module ULAPRS (x-y) IPRN is a code indicating the format to be used in printing array values. If it is not between 1 and 12, it is set equal to 12. GET THE FORMAT CODE - - - IPRN I DETERMINE THE NUMBER OF VALUES TO BE PRINTED IN ONE LINE I CALCULATE THE NUMBER OF STRIPS NEEDED I FOR EACH STRIP 4 CALCULATE THE FIRST AND LAST COLUMN FOR THIS 6 I PRINT A TITLE AT THE TOP OF THE STRIP , I PRINT THE VALUES IN THE ROW THAT BELONG IN THIS STRIP ACCORDING TO THE FOsRyh;lpARTSPECIFIED I’ 14-13 SUBROUTINE ULAPRStBUF,TEXT,KSTP,KPER, NCOL,NROW,ILAY, IPRN, IOUT) C 1640 12MAY1987 ULAPRS : -----VERSION ****************************************************************** C PRINT A 1 LAYER ARRAY IN STRIPS ****************************************************************** : C SPECIFICATIONS: C -----------------------------------------------------------------C CHARACTER*4 TEXT DIMENSIONBUF(NCOLrNR@iW) rTEXT(4) -----------------------------------------------------------------: Cl---MAKE SURE THE FORMATCODE (IP OR IPRN) IS BETWEEN1 Cl------AND 12. C c2--- C C3------ IP=IPRN IF(IP.LT.l .OR. IP.GT.12) IP=12 DETERMINE THE NUb8ER OF VALUES (NCAP) PRINTED ON ONE LINE. IF(IP.EQ.l) NCAP=ll IF(IP.EQ.2) NCAP=9 IF(IP.GT.2 .AND. IP.LT.7) NCAP=lS IF(IP.GT.6 .AND. IP.LT.12) NCAP=20 IF(IP.EQ.12) NCAP=lO CALCULATE ME NUMBEROF STRIPS(NSTRIP). NCPF=129/NCAP ISP=O IF(NCAP.GT.12) ISP=3 NSTRIP=(NCOL-l)/NCAP + 1 Jl=l-NCAP J2=0 C THE STRIPS. c-4------LOOP THROUGH DO 2000 N=lr NSTRIP :5 ------CALCULATE THE FIRST(J1) 8 THE LAST(J2) Jl=Jl+NCAP J2=JZ+NCAP IF(J2.GT.NCOL) J2=NCOL COLUMNSFOR THIS STRIP ii5-------PRINT TITLE ON EACH STRIP WRITE(IOUT,l) TEXT,ILAY,KSTP,KPER 1 FORMAT(lHlrlOX,4A4,' IN LAYER’rI3,’ AT END OF TIME STEP’rI3, 1 ' IN STRESS PERIOD'rI3/11Xr71('-'1) C c7 ------PRINT COLUMNNUMBERSABOVE THE STRIP CALL UCOLNO(Jl,J2rISP,NCAPINCPFIIOUT) C C&-aLOOP THROUGHTHE ROWSPRINTING COLS Jl THRU 52 WITH FORMAT IP DO 1000 I=lrNROW GOT0(10,20,30,40,50,60r70r80r90r10011101120~, IP C 10610.3 C------------FORMAT 10 WRITE(IOUT,ll) I,(BUF(J,I),J=Jl,J2) 11 FORMAT(1HO,I3r2X,1PGlO.3,lO~lX,GlO.3)) GO TO 1000 C C------------FORMAT 8613.6 14-14 20 WRITE(IOUT,El) I,(BUF(J,I)rJ=JlrJ2) 21 FORMAT(1HO,I3r2X,1PG13.6,8~lX,Gl3.61~ GO TO 1000 ~------------FORMAT 15F7.1 30 WRITE(IOUT,31) I,(BUF(J,I)rJ=JlrJ2) 31 FORMAT(1HO,I3,lX,15(lX,F7.1)) GO TO 1000 C C------------FORMAT 15F7.2 I,(BUF(J,I)rJ=JlrJ2) 41 FORMAT(lHO,I3,lX,15(lX,F7.2)) GO TO 1000 40 WRITE(IOUT,41) C 15F7.3 C------------FORMAT 50 WRITE(IOUT,Sl) I,(BUF(J,I)rJ=JlrJ2) 51 FORMAT(1HO,I3rlX,15(lX,F7.3)) GO TO 1000 n L----------FORMAT 15F7.4 60 WRITE(IOUT,61) I,(BUF(J,I)rJ=JlrJ2) 61 FORMAT(1HO,I3rlX,15(lX,F7.4)) GOTO 1000 C 2OF5.0 C------------FORMAT 70 WRITE(IOUT,71) I,(BUF(J,I)rJ=JlrJ2) 71 FORMAT(1HO,I3rlX,20(lX,F5.0)) GO TO 1000 C 20F5.1 C------------FORMAT 80 WRITE(IOUT,81) I,(BUF(J,I),J=JlrJ2) 81 FORMAT(1HO,I3rlX,20(lX,F5.l)) GO TO 1000 C------------FORMAT 20F5.2 90 WRITE(IOUT,91) I,(BUF(J,I)rJ=JlrJ2) 91 FORMAT(1HO,I3rlX,20(lX,F5.2)) GOTO 1000 ~------------FORMAT 20~5.3 100 WRITE(IOUT,lOl) I,(BUF(J,I)rJ=JlrJ2) 101 FORMAT(1HOrI3rlX,20(1X,F5.3)) GO TO 1000 L-----------FORMAT 20~5.4 110 WRITE(IOUT,lll) I,(BUF(J,I)rJ=JlrJ2) 111 FORMAT(1HO,I3rlX,20(lX,F5.4)) GO TO 1000 C 9611.4 C------------FORMAT 120 WRITE(IOUT,121) I,(BUF(J,I)rJ=JlrJ2) 121 FORMAT(1HO,I3r2X,1PGll.4r9(1XIG11.4)) C 1000 CONTINUE 2000 CONTINUE C c9------RETURN RETURN END 14-15 List Variable of Variables for Module ULAPRS Definition Range BUF Module Buffer containing I Module Index for ILAY Module Layer number. IPUT Global Primary unit IP Module Format code. IPRN Module Code for to be printed ISP Module Number of spaces. J Module Index for Jl Module First column 52 Module Last KPER Global Stress KSTP Global Time step period. counter. N Module Index strips. NCAP Module Number of columns on a line. NCOL Global Number of columns in the NCPF Module Number of columns per field. NROW Global Number of rows in the NSTRIP Module Number of strips. TEXT Module Label or recorded. rows. the number for format all printed output. to be used when printing IOUT = 6. arrays. columns. column period for data in a strip. in a strip. counter. Reset at the to be printed 14-16 start of each stress grid. grid. or recorded with the array data. Narrative Module ULAPRW prints using the than one of twelve following 2. Set the in wrap form Module ULAPRW performs its (fig. 56) tasks in it a header. equal format Call 4. Loop through If code (IP). to 12 (the 3. 5. array order: Print the appropriate Module ULAPRW a two-dimensional FORTRAN formats. 1. 12, set for format is less than 1 or greater default). the module UCOLNOto print the it rows printing code. RETURN. 14-17 column numbers. each one in its entirety using Flow Chart for Module ULAPRW IPRN is a code indicating the format to be used in printing If it is not array values. between 1 and 12, it is set equal to 12. CODE - - IPRN PRINT COLUMN FOR EACH ROW PRINT THE ARRAY VALUES ACCORDING TO FORMAT IPRN 14-18 SUBROUTINE ULAPRW(BUF,TEXT, KSTP, KPER, NCOL,NROW,ILAY, IPRN, IOUT) C C C-----VERSION C C C C C 1642 12MAY1987ULAPRW ****************************~**********~***********~************** PRINT 1 LAYER ARRAY ****************************************************************** SPECIFICATIONS: ” C CHARACTER*4 TEXT DIMENSIONBUF(NCOL,NRCW)rTEXT(4) -----------_------------------------------------------------------ h------PRINT A HEADER IF(ILAY.LE.0) GO TO 5 WRITE(IOUT,l) TEXT,ILAY,KSTP,KPER 1 FORMAT(lHl,lOX,4A4,' IN LAYER',I3,' AT END OF TIME STEP',I3, 1 ' IN STRESS PERIOD',I3/llX,71('-'1) C C2---- MAKE SURE THE FORMATCODE (IP OR IPRN) IS C2---- BETWEEN1 AND 12. 5 IP=IPRN IF(IP.LT.l .OR. IP.GT.12) IF'=12 THE UTILITY MODULEUCOLNOTO PRINT COLUMNNUMBERS. IF(IP.EQ.l) CALL UCOLNO(lrNCOL,O,llrll,IOUT) IF(IP.EQ.2) CALL UCOLNO(1,NCOL,O,9,14rIOUT) IF(IP.GT.2 .AND. IP.LT.7) CALL UCOLNO(lrNCOL,3,15r8rIOUT) IF(IP.GT.6 .AND. IP.LT.12) CALL UCOLN0(1,NCOL,3,20,6,10UT) IF(IP.EQ.12) CALL UCOLNO(lrNCOL,O,10,12rIOUT) :3 ------CALL E4------LOOP THROUGHTHE ROWSPRINTINGEACH ONEIN ITS ENTIRETY. DO 1000 I=lrNROW GO T0(10,20,30,40,50,60,70,80,90,100,110,120~, IP :------------ FORMAT 11610.3 10 WRITE(IOUT,ll) I,(BUF(J,I)rJ=l,NCCL) 11 FORMAT~1HO,I3r2X,1PGlO.3,lO~lX,GlO.3~/~5X,ll~lX,GlO.3~~~ GO TO 1000 :------------ FORMAT9613.6 20 WRITE(IOUT,21) I,(BUF(J,I),J=l,NCOL) 21 FORMAT~1HO,I3,2X,1ffi13.6,8~1X,Gl3.6~/~5X,9~lX,Gl3.6~~~ GO TO 1000 C C-----------FORMAT 15F7.1 30 WRITE(IOUT,31) I,(BUF(J,I)rJ=l,NCOL) 31 F0RMAT(1H0,13,1X,15(1X,F7.1)/0X,15~1X,F7.1~~~ GO TO 1000 14-19 C C-----------FORMAT 15F7.2 40 WRITE(IOUT,41) I,(BUF(J,I)rJ=l,NCOL) 41 FORMAT(1HO,I3,1X,15(lX,F7.2)/(5X,l5~lX,F7.2~~~ GO TO 1000 C------------ FORMAT 15F7.3 50 WRITE(IOUT,Sl) I,(BUF(J,I),J=lrNCOL) 51 FORMAT(1HO,I3,1X,15(lX,F7.3)/(5X,l5~lX,F7.3~~~ GO TO 1000 C C-----------FORMAT 15F7.4 60 WRITE(IOUT,61) I,(BUF(J,I)rJ=l,NCOL) 61 FORMAT(1HO,I3rlX,15(1X,F7.4)/(5X,l5~lX,F7.4~~~ GO TO 1000 :------------ FORMAT2OF5.0 70 WRITE(IOUT,71) I,(BUF(J,I),J=lrNCOL) 71 F0RMAT(1H0,13,1X,20(1X,F5.0)/0X,20~1X,F5.0~~~ GO TO 1000 C C-----------FORMAT 20F5.1 80 WRITE(IOUT,81) I,(BUF(J,I)rJ=lrNCOL) 81 FORMAT(1HO,I3,1X,20(lX,F5.1)/(5X,2O~lX,F5.l~~~ GO TO 1000 C------------ FORMAT 20F5.2 90 WRITE(IOUT,91) I,(BUF(J,I)rJ=lrNCOL) 91 FORMAT(1HO,I3rlX~20(lX,F5.2)/(5X,2O~lX,F5.2~~~ GO TO 1000 C C-----------FORMAT20F5.3 100 WRITE(IOUT,lOl) I,(BUF(J,I),J=l,NCOL) 101 FORMAT(1HO,I3rlX,20(lX,F5.3)/(5X,2O~lX,F5.3~~~ GO TO 1000 C FORMAT20F5.4 C-----------110 WRITE(IOUT,lll) I,(BUF(J,I)rJ=l,NCOL) 111 FORMAT(1HO,I3,1X,20(1X,F5.4)/(5X120(1XIF5.4~~~ GO TO 1000 :-----------FORMAT 10611.4 120 WRITE(IOUT,121) I,(BUF(J,I)rJ=l,NCOL) 121 FORMAT~1HO,I3r2X,1PGll.4r9~lX,Gll.4~/~5X,lO~lX,Gll.4~~~ C 1000 CONTINUE C c5------RETURN RETURN END 14-20 List Variable of Variables for Module ULAPRW Definition Range BUF Module Buffer containing data to be printed I Module Index for ILAY Module Layer number. IOUT Global Primary unit IP Module Format code. IPRN Module Code for J Module Index KPER Global Stress KSTP Global Time step period. NCOL Global Number of columns NROW Global Number of rows in the TEXT Module Label or recorded. rows. the for number for format all printed output. to be used when printing IOUT = 6. arrays. columns. period counter. Reset at the start counter. in the to be printed 14-21 of each stress grid. grid. or recorded with the array data. Narrative for Module UCOLNO prints column It performs numbers are printed. 1. Calculate of a line the Module UCOLNO numbers at the top its functions number of columns (NTOT), and the in the number of lines Jl the line. and print 3. Clear the 4. Determine current line each line buffer the first (NLBL), the width all of the and 52 which contain (DO STEPS 3-6). (BF) in which (Jl) order: needed to print numbers (NWRAP). Initialize the fields ., first and last column number on each print Build following to be printed column 2. of a page when arrays and last the (52) line is column built. number for the line. 5. Put the from the array tens digit, column numbers in the The indices DG. and hundreds 6. Print the 7. Print a line 8. RETURN. digit, line buffer. 11, 12, and I3 point respectively. line. of dots. 14-22 They are selected to the units digit, of Flow Chart for Module UCOLNO CALCULATE THE NUMBER OF LINES NEEDED TO PRINT ALL O;J;tiEC;LUMN F( CLEAR THE BUFFER IN WHICH THE LINE IS ASSEMBLED DETERMINE THE RANGE OF COLUMN NUMBERS WHICH GO IN THE LINE THE CONTENTS OF THE BUFFER 14-23 SUBRWTINE lJCOLNO(NLBL1,NLBL2,NSPACEtNCPLrNDIGtIOUT) -VERSION 1638 12MAY1987 UCOLNO ***********~**C****************************~~******~************** OUTPUT COLUMN NlJmERS ABOVE A MATRIX PRINTOUT NLBLl IS THE START COLUMN LABEL (NlJb8ER) NLBLZ IS THE STOP COLUMN LABEL (NlJb8ER) NSPACE IS NUMBER OF BLANK SPACES TO LEAVE AT START OF LINE NCPL IS NlJb8ER OF COLUMN NUb8ERS PER LINE NDIG IS NUb8ER OF CHARACTERS IN EACH COLUMN FIELD IOUT IS OUTPUT CHANNEL C c SPECIFICATIONS: -----------------------------------------------------------------CHARACTER*4 DOT. SPACE, DG, BF DIMENSION BF(130),DG(lO) C 1 2 DATA ffi(l)rDG(2),ffi(3)rffi(4),DG(S),ffi(6).DG(7~,ffi~8~,ffi~9~,ffi~lO~/ ‘0 ‘,‘l ‘1’3 ‘,‘4 ‘r’5 ‘*‘2 ‘7 ‘r’8 ‘,‘9 ‘/ DATA DOT,SPACE/‘. I,’ ‘/ ‘,‘6 ‘, -----------------------------------------------------------------Cl------CALCULATE # OF COLUMNS TO BE PRINTED (NLBL), Cl------OF A LINE (NTOT), NlJmER OF LINES (NWRAP). WRITE(IOUT.l) 1 FORMAT NLBL=NLBLZ-NLBLl+l N=NLBL IF(NLBL.GT.NCPL) N=NCF’L NTOT=NSPACE+N*NDIG IF(NTOT.GT.130) GO TO 50 MdRAP=(NLBL-l)/NCPL t 1 Jl=NLBLl-NCPL J2=NLBLl-1 C C2------BUILD AND PRINT EACH LINE DO 40 ti=l,tWRAP WIDTH :3 ------CLEAR THE BUFFER (8F). DO 20 1=1.130 BF(I)=SPACE 20 CONTINUE NBF=NSPACE C C4------DETERMINE FIRST (Jl) AND LAST (52) COLUMN I FOR THIS LINE. Jl=Jl+NCPL J2= JZ+NWL IF(J2.GT.NLBL2) J2=NLBL2 (Z------LOAD THE COLUMN I’S INTO THE BUFFER, DO 30 J=Jl,JZ NBF=NBFtNDIG 12=J/lO Il=J-12*10+1 BF(MF)=DG(Il) IF(12.EQ.0) GO TO 30 13=12/10 12=12-13+10+1 BF(hBF-l)=OG(I2) IF(13.EQ.0) GO TO 30 BF(F8F-2)=DG(I3+1) 30 CONTINUE C C6------PRINT THE CONTENTS OF THE BUFFER (I.E. PRINT THE LINE). WRITE(IOUT,31) (BF(I),I=l,NBF) 31 FOF&fAT(lX,130Al) C 40 CONTINUE :7 ------PRINT A LINE OF DOTS (FOR ESTHETIC PUF(POSES ONLY). 50 NTOT=NTOTt5 IF(NTOT.GT.130) NTOT=130 WRITE(IOUT,51) (DOT,I=l,NTOT) 51 FORMAT( 1X, 130Al) C CI------RETURN RETURN END 14-24 List Variable of Variables for Module UCOLNO Definition Range BF Module DIMENSION (130), Buffer in which DG Module DIMENSION (lo), DOT Module Field containing 1 Module Index for IOUT Global Primary 11 Module Index for DG (units 12 Module Index for DG (tens 13 Module Index for DG (hundreds J Module Index for Jl Module First 52 Module Last N Module Number of column NBF Module Index NCPL Module Number of column numbers per line. NDIG Module Number of characters NLBL Module Number of column numbers to be printed. NLBLl Module Start NLBL2 Module Stop column NSPACE Module Number of blank NTOT Module Total NWRAP Module Number of lines SPACE Module Field Digits a line 0 through is assembled. 9. a period. BF. unit number for all output. IOUT = 6. digit). digit). digit). column numbers. column number on the column number on the for printed current current line. line. numbers. BF. in each column number field. column number. number. spaces at start number of characters containing of line. on a line. needed in wrap format. blanks. 14-25 Narrative for Module UZDREL Module UEDREL reads values for a two-dimensional real array. First it Then, based on the contents of the arrayreads an "array-control record." The array-control record contains control record, it may read array values. four fields: location (LOCAT), constant (CNSTNT), format (FMTIN), and The LOCAT field determines where array values printout indicator (IPRN). it is the unit number from which If LOCAT is positive, will come from. array values will be read in the format specified in FMTIN. If LOCAT is negative, the sign is reversed to give the unit number from which an unformatted record containing the array values will be read. (Before the array record is read, a record will be read and ignored. Thus output from the module ULASAV can be read.) If LOCAT is zero, all of the array values will be set equal to CNSTNT. When LOCAT is not zero and CNSTNT is not zero, the array values will be multiplied by the value of CNSTNT. The field IPRN contains a code number for a FORTRAN format to be used when printing the array. Module UZDREL performs 1. its Read the array-control 2. Use LOCAT to determine GO TO STEPS 3, 4, OR 5. 3. If LOCAT equals a message to that effect, 4. format then tasks in the record If LOCAT is greater than in FMTIN: GO TO STEP 6. order: (LOCAT, CNSTNT, FMTIN, and IPRN). where the zero , set all and RETURN. following array array values values zero , read array are coming from. equal values to CNSTNT, print according to the dummy record and 5. If LOCAT is less than zero, read an unformatted read an unformatted record containing the array values. GO TO STEP 6. 6. 7. to print 8. If CNSTNT is not equal to zero, multiply If IPRN is greater than or equal to zero, the array values using IPRN as the format RETURN. 14-26 array values call utility code. by CNSTNT. module ULAPRW Flow Chart for Module UZDREL- Array Control Record controls the input of array values. It contains four fields: LOCAT, CNSTNT, FMTIN, and IPRN. LOCAT is a code shawing where array values will come from. READ THE ARRAY CONTROL RECORD If LOCAT < 0, array values will be read from an unformatted record from a unit number equal to -LOCAT. If LOCAT = 0, array values will be set equal to CNSTNT. LOCAT >O If LOCAT > 0, array values will be read from the unit number equal to LOCAT in the format specified in FMTIN. a CNSTNT is the constant to which all array values are set if LOCAT is equal to zero, and it is the constant by which all array values are rmltiplied if LOCAT is not equal to zero. FMTIN is the format in which array values are read if LOCAT is greater than zero. READ AN UNFORMATTED DUMMY RECORD FROM UNIT= -LOCAT READ ARRAY VALUES IN FORMAT FMTIN FROM UNIT= LOCAT READ AN UNFORMATTED RECORD OF ARRAY VALUES FROM UNIT= -LOCAT IF CNSTNT IS NOT ZERO, MULTIPLY ARRAY VALUES BY CNSTNT ‘b I IPRN is a code showing the format to be used if array values are to be printed. 14-27 SET ALL ARF&Vf+$ES CNSTNT PRINT A MESSAGE TO THAT EFFECT 1 SUBROUTINE U2DREL(A,ANAME,II,JJ,KtIN,IOUT) C C C-----VERSION 1648 12MAY1987 U2DREL **********+*************************************************~***** c ROUTINE TO INPUT 2-D REAL DATA MATRICES C A IS ARRAY TO INPUT c C ANAME IS 24 CHARACTER DESCRIPTIONOF A II IS NO. OF RCWS JJ IS NO. OF CDLS K IS LAYER NO. (USED WITH NAFE TO TITLE C c IN IS INPUT UNIT IOUT IS OUTPUT UNIT ******************************************************~*********** c PRINTOUT UNLESS K IS 0) SPECIFICATIONS: ------_---------------------------------------------------------CHARACTER*4 ANM CHARACTER*20 FMTIN DIMENSION A(JJ,II).ANAME(6) -----------------------------------------------------------------: Cl------READ ARRAYCONTROL RECORD. READ (IN,l) LOCAT,CNSTNT,FMTIN,IPRN 1 FORMAT(IlO,F10.0,A20rI10) LOCAT TO SEE WHERE ARRAY VALUES CDME FROM. :2 ------USE IFtLCCAT) 200,50,90 C C3------IF LOCAT=O MEN SET ML ARRAY VALUES EQUAL TO CNSTNT. RETURN 50 DO 80 I=lrII DO 80 .l=l.JJ 80 A(J,I)=CNSTNT IF(K.GT.0) WRITE(IOUT,2) ANM,CNSTNT,K 2 FORMAT(lH0,52X,6A4,’ =‘,G15.7.’ FOR LAYER’,I3) IF(K.LE.0) WRITE(IOUT,3) ANAMEsCNSTNT 3 FORMAT(lHD.52X,6A4,’ =‘,G15.7) RETURN c C4------IF LOCAT>O THEN READ FORMATTED RECORDS USING FOMAT FMTIN. 90 IF(K.GT.0) WRITE(IOUT,4) ANM,K,LCCAT,FMTIN 4 FORMAT(lHO,///30X,6A4,’ FOR LAYER’,13,’ WILL BE READ ON UNIT’, 1 13,’ USING FOMAT: ‘,A20/3OX,96(‘-‘1) IF(K.LE.0) WRITE(IOUT,S) ANM,LOCAT,FMTIN 5 FORMAT(lm),///30X,6A4,’ WILL BE READ ON UNIT’, 1 13.’ USING FOFMAT: ‘rAZ0/30X,83(‘-‘)I DO 100 I=l,II READ (LOCAT,FMTIN) (A(J,I),J=l,JJ) 100 CONTINUE GO TO 300 C5------LOCAT<O THEN READ UNFORMATTED RECORD CONTAINING ARRAYVALUES 200 LOCAT=-LOCAT IF(K.GT.0) WRITE(IOUT,201) ANM,K.LOCAT 201 FORMAT(lHD,///30X,6A4,‘, LAYER’,I3, 1 ’ WILL BE READ UNFORMATTED ON UNIT’rI3/30X,73(‘-‘1) IF(K.LE.0) WRITE(IOUT,ZOP) ANM,LCCAT 202 FORMT(ll-!Gr///30X. 1 ’ WILL BE READ UNFORMATTED ON UNIT’,I3/30X,60(‘-‘1) :5A ------READ AN UNFORMATTED DUMMY RECORD FIRST. READ( LOCAT) READ( LOCAT) A CNSTNT NOT ZERO THEN MULTIPLY .ARRAY VALUES BY CNSTNT. :6 ------IF 300 IF(CNSTNT.EQ.0.) GO TO 320 DO 310 I=lrII DO 310 J=l.JJ A(J,I)=A(j;IPCNSTNT 3 10 CONTINUE :7 ------IF PRINT CODE (IPRN) =>O THEN PRINT ARRAY VALUES. 320 IF(IFRN.LT.0) RETURN CALL ULAPRW(A,ANAtk,O,O,JJ,II,O,IPRN,IOUT) RETURN c C&-----RETURN END 14-28 List Variable of Variables for Module UEDREL Definition Range A Module DIMENSION (JJ,II), Input ANAME Module Label of the CNSTNT Module Constant to which all array values are set if LOCAT is equal to zero or by which all array values are multiplied if LOCAT is not equal to zero. FMTIN Module Format under which I Module Index II Module Number of rows. IN Module Unit IOUT Global Primary IPRN Module Code for J Module Index for JJ Module Number of columns. K Module Layer LOCAT Module Location of values to fill in the array. < 0, read an unformatted record containing the array values. = 0, set all the array values equal to constant (CNSTNT). > 0, read the formatted records containing the array values. for for printout array array. input values array. will be read. rows. number from which be read. unit number for format the array all control printed record output. to be used when printing will IOUT = 6. the arrays. columns. number. 14-29 Narrative for Module UZDINT Module U2DINT reads values for a two-dimensional integer array. First Then, based on the contents of the arrayit reads an "array-control record." The array-control record contains control record, it may read array values. four fields: location (LOCAT), constant (ICONST), format (FMTIN), and The LOCAT field determines where array values printout indicator (IPRN). it is the unit number from which If LOCAT is positive, will come from. array values will be read in the format specified in FMTIN. If LOCAT is negative, the sign is reversed to give the unit number from which an (Before the unformatted record containing the array values will be read. be read and ignored. Thus output from array record is read, a record will the module ULASAV can be read.) If LOCAT is zero, all of the array values will be set equal to ICONST. When LOCAT is not zero and ICONST is not zero, the array values will be multiplied by the value of ICONST. The field IPRN (table 1) contains a code number for a FORTRAN format to‘be used when printing the array. Module U2DINT performs 1. its tasks Read the array-control in the record 2. Use LOCAT to determine 3, 4, OR 5. If 4. then in LOCAT is greater FMTIN. than zero, values read array equal values to CNSTNT, print according to the GO TO STEP 6. If ICONST is not equal to zero, 7. If IPRN is greater than IPRN as the format code. 8. the array GO TO STEPS is coming from. 5. If LOCAT is less than zero, read an unformatted dummy record and read an unformatted record containing the array values. GO TO STEP 6. 6. using order: (LOCAT, ICONST, FMTIN, and IPRN). where the array 3. If LOCAT equals zero, set all message to that effect, and RETURN. format fo llowing Call utility or equal Print each row in the array. 10. Select 11. RETURN. the to zero, module UCOLNOto print page. 9. multiply format for printing. 14-30 array print values by ICONST. the array values column numbers at the top of a Flow Chart for Module U2DINT Array Control Record controls the input of array values. It contains four fields: LOCAT, ICONST, FMTIN, and IPRN. LOCAT is a code showing where array values will come from. READ THE ARRAY CONTROL RECORD If LOCAT < 0, array values will be read from an unformatted record from a unit number equal to -LOCAT. If LOCAT = 0, array values will be set equal to ICONST. If LOCAT > 0, array values will be read from the unit number equal to LOCAT in the format specified in FMTIN. ICONST is the constant to which all array values are set if LOCAT is equal to zero, and it is the constant by which all array values are multiplied if LOCAT is not equal to zero. FMTIN is the format in which array values are read if LOCAT is greater than zero. READ AN UNFORMATTED DUMMY RECORD FROM UNIT= -LOCAT \ READ ARRAY VALUES IN FORMAT FMTIN FROM UNIT= LOCAT 6 5A READ AN UNFORMATTED RECORD OF ARRAY VALUES FROM UNIT= -LOCAT IF ICONST IS NOT ZERO, MULTIPLY ARRAY VALUES BY ICONST I IPRN is a code showing the format to be used if array values are to be printed. IF IPRN=X. PRINT ARRAY VALUES 14-31 1 3A PRINT A MESSAGE TO THAT EFFECT SUBROUTINE U2DINT(IA,ANAME,II,JJrK,IN,IOUT) C : -----VERSION 1645 12MAY1987UZDINT ****************************************************************** ROUTINE TO INPUT Z-D INTEGER DATA MATRICES : IA IS ARRAY TO INPUT C ANAME IS 24 CHARACTERDESCRIPTION OF IA II IS NO; OF RC#iS : JJ IS NO. OF COLS C K IS LAYER NO. (USED WITH NAME TO TITLE PRINTOUT UNLESS K IS 0) C IN IS INPUT UNIT IOUT IS OUTPUT UNIT : ****************************************~************************* C E SPECIFICATIONS: ” CHARACTER*4 ANAME CHARACTER”20 FMTIN DIMENSION IA(JJ,II),ANAME(6) --------------------------------------------------------------- E Cl--C READ ARRAY CONTROL RECORD. READ (IN,11 LOCAT,ICONSTIFMTINIIF'RN 1 F0RMAT(110,110,A20,110) c2---- USE LOCAT TO SEE WHEREARRAY VALUES COME FROM. IFtLOCAT) 200,50,90 LOCAT=O THEN SET ALL ARRAY VALUES EQUAL TO ICONST. RETURN :3 ------IF 50 DO 80 I=lrII DO80 J=lrJJ 80 IA(J,I)=ICONST IF(K.GT.0) WRITE(IOUT,2)ANAME,ICONST,K 2 FORMAT(lHO,52X,6A4r' ='rIlSr' FOR LAYER'rI3) IF(K.LE.0) WRITE(IOUT,3)ANAMEIICONST 3 FORMAT(lH0,52X,6A4,’ RETURN =‘,I151 C LOCAT>O THEN READ FORMATTEDRECORDSUSING FORMAT FMTIN. c4 ------IF 90 IF(K.GT.0) WRITE(IOUT,4)ANAMErK,LOCAT,FMTIN 4 FORMAT(lHOr///3OXr6A4,’ FOR LAYER’rI3,’ WILL BE READ ON UNIT’, 13,' USING FORMAT:'rA20/3OXr96('-'1) 1 IF(K.LE.0) WRITE(IOUT,5) ANAME,LOCAT,FMTIN 5 FORMAT(lHOr///3OXr6A4,’ WILL BE READ ON UNIT', 13,' USINGFORMAT: ‘rA20/30X,83(‘-‘1) 1 DO 100 I=lrII READ (LOCAT,FMTIN) (IA(J,I)rJ=lrJJ) 100 CONTINUE GOTO 300 C c5 ------LOCAT< THEN READ UNFORMATTEDRECORDCONTAINING ARRAY VALUES 200 LOCAT=-LOCAT IF(K.GT.0) WRITE(IOUT,201) ANAME,K,LOCAT 201 FORMAT(lHOr///3OXt6A4r'r LAYER'rI3, ' WILL BE READ UNFORMATTEDON UNIT'rI3/30X,73('-'1) 1 IF(K.LE.0) WRITE(IOUT,202) ANAMEILOCAT 202 FORMAT(lHO,///30X,6A4, 1 ’ WILL BE READ UNFORMATTEDON UNIT’rI3/30X,60( C 14-32 ‘-‘I 1 pjA--- READ AN UNFORMATTEDDUMMYRECORDFIRST. READtLOCAT) READtLOCAT) IA C C6--IF ICONST NOT ZERO THEN MULTIPLY ARRAY VALUES BY ICONST. 300 IF(ICONST.EQ.0) GO TO 320 DO 310 I=l,II DO310 J=lrJJ IA(J,I)=IA(J,I)*ICONST 310 CONTINUE C C7------ IF PRINT CODE (IFRN) =>O MEN PRINT ARRAY VALUES. 320 IF(IPRN.LT.0) RETURN IF(IPRN.GT.5) IPRN=O IPRN=IF'RN+l C c8------PRINT COLUMNNUMBERSAT TOP OF PAGE. IF(IPRN.EQ.l) CALL UCOLNO(1,JJ,O,1O,12rIOUT) NL=125/IPRN/5*5 IF(IPRN.GT.1) CALL UCOLNO(1,JJr4,NLrIPRN,IOUT) L-----P~~INT EACH ROWIN THE ARRAY. DO110 I=l,II Lo- ----SELECT THE FORMAT GO T0(101,102,103,104,105,106), C C----------------FORMAT IF’RN 10111 101 WRITE(IOUT,lOOl) I,(IA(J,I)rJ=lrJJ) 1001 FORMAT(1HO,I3,2X,Illr9(1X,I11)/(5X,1O(1X,I11))) GO TO 110 C 6011 C----------------FOFAT 102 WRITE(IOUT,1002)I,(IA(J,I)rJ=l,JJ) 1002 FORMAT(1HO,I3rlX,60(lX,Il)/(5X,6O~lX,Il)~~ GOTO 110 C 4012 C----------------FORMAT 103 WRITE(IOUT,1003)I,(IA(J,I)rJ=lrJJ) 1003 FORMAT(1HO,I3rlX,40(1X,I2)/(5X,4O~lX,I2)~~ GOTO 110 C C----------------FORMAT 104 WRITE(IOUT,1004) 3013 I,(IA(J,I),J=l,JJ) 1004 FORMAT(1HQrI3,lX,30(1X,I3)/(5X,30(1X,I3))) GOTO 110 C 2514 C----------------FORMAT 105 WRITE(IOUT,1005)I,(IA(J,I),J=lrJJ) 1005 FORMAT(1HOrI3rlX,25(1X,I4)/(5X,25(1X,I4))) GO TO 110 C 2015 C----------------FORMAT 106 WRITE(IOUT,1006)I,(IA(J,I),J=lrJJ) 1006 F0RMAT(1HO,13,1X,20(1X,15)/(5X,20(1X,15))1 110 CONTINUE RETURN C Cll-----RETURN END 14-33 List Variable of Variables for Module UZDINT Definition Range ANAME Module Label for the printout of input FMTIN Module Format I Module Index for IA Module DIMENSION (JJ,II), ICONST Module Constant to which all array values are set if LOCAT is equal to zero or by which all array values are multiplied if LOCAT is not equal to zero. II Module Number of rows. IN Module Unit IOUT Global Primary IPRN Module Code for 3 Module Index 35 Module Number of columns. K Module Layer LOCAT Module Location of values to fill in the array. < 0, read an unformatted record containing the array values. = 0, set all the array values equal to constant (CNSTNT). > 0, read formatted records containing the array values. NL Module Number under which the array array. values will be read. rows. Input number from which be read. unit for number for format array. the all array-control printed record output. to be used when printing will IOUT = 6. arrays. columns. number. of columns 14-34 per line. Narrative Module UlDREL reads reads an "array-control control four record, fields: printout will it values zero, all for a one-dimensional If values. of the array values value of CNSTNT. a FORTRAN format The field is the to CNSTNT. IPRN (table its tasks values values number from which be set equal the array contains and where array unit it of the array- (FMTIN), in FMTIN. to be used when printing Module UlDREL performs determines First record specified is not zero and CNSTNT is not zero, the it format will contents (CNSTNT), format LOCAT is positive, array. The array-control The LOCAT field be read in the real based on the (LOCAT), constant (IPRN). will Module UlDREL Then, may read array indicator array values record." location come from. for will 2) contains If If LOCAT is LOCAT be multiplied by a code number for the array. in the following 1. Read the array-control record 2. Use LOCAT to determine where the array 3. If order: (LOCAT, CNSTNT, FMTIN, and IPRN). is coming from (DO STEPS 3 OR 4). print LOCAT equals a message to that 4. format If zero, set effect. LOCAT is greater all array values equal to CNSTNT and RETURN. than zero, read array values according to the in FMTIN. 5. If CNSTNT is 6. If IPRN is 7. RETURN. not equal greater than to zero, or equal 14-35 multiply to zero, the array print values the array by CNSTNT. values. Flow Chart for Module UlDREL Array Control Record controls the input of array values. It contains four fields: LOCAT, CNSTNT, FMTIN, and IPRN. LOCAT is a code showing where array values will come from. t READ THE ARRAY CONTROL RECORD If LOCAT = 0, array values will be set equal to CNSTNT. If LOCAT > 0, array values will be read from the unit number equal to LOCAT in the format specified in FMTIN. LOCAT >O CNSTNT is the constant to which all array values are set if LOCAT is equal to zero, and it is the constant by which all array values are multiplied if LOCAT is not equal to zero. 4 READ ARRAY VALUES IN FORMAT FMTIN FRW\lT= SET ALL ARRAY VALUES EcQNusA:NTp FMTIN is the format in which array values are read if LOCAT is greater than zero. 3A IPRN is a code showing the format to be used if array values are to be printed. IF CNSTNT MULTIPLY IS ARRAY IF IPRN=X, PRINT ARRAYVALUES 14-36 PRINT A MESSAGE TO THAT EFFECT SUBROUTINE UlDREL(A,ANAME,JJ,IN,IOUT) C C C-----VERSION 1643 12MAY1987UlDREL ******************~*********************************************** C C ROUTINE TO INPUT 1-D REAL DATA MATRICES C A IS ARRAY TO INPUT C ANAME IS 24 CHARACTERDESCRIPTION OF A C JJ IS NO. OF ELEMENTS C IN IS INPUT UNIT C IOUT IS OUTPUT UNIT ***************************************************************~** C C C SPECIFICATIONS: CHARACTER*4 ANAME CHARACTER*20 FMTIN DIMENSIONA(JJ),ANAME(6) -----------_--------_____________L______-------------------------C C Cl---READ ARRAY CONTROL RECORD. READ (IN, 1) LOCAT,CNSTNT, FMTIN,IPRN 1 FORMAT(I10,F10.O,A20,IlO) C c2---- USE LOCAT TO SEE WHERE ARRAY VALUES COME FROM. IF(LOCAT.GT.0) GOTO 90 C C3..----- IF LOCAT=O THEN SET ALL ARRAY VALUES EQUAL TO CNSTNT. RETURN DO 80 J=lrJJ 80 A( J )=CNSTNT WRITE(IOUT,3) ANAME,CNSTNT 3 FORMAT(lH0,52X,6A4,’ RETURN C c4 ------IF =‘rG15.7) LOCAT>O THEN READ FORMATTEDRECORDSUSING FORMAT FMTIN. 90 WRITE(IOUT,5) ANAME,LOCAT,FMTIN 5 FORMAT(lHO,///30X,6A4,' WILL BE READ ON UNIT'rI3, 1 ’ USING FORMAT: ‘rA20/30X,79(‘-‘)/I READ (LOCAT,FMTIN) (A(J),J=l,JJ) C C5------ IF CNSTNT NOT ZERO THEN MULTIPLYARRAY VALUES BY CNSTNT. IF(CNSTNT.EQ.0.) GOTO 120 DO 100 J=l,JJ 100 A(J)=A(J)*CNSTNT C Cfj---IF PRINT CODE (IPRN) =>O THEN PRINT ARRAY VALUES. 120 IF(IPRN.LT.0) RETURN WRITE(IOUT,lOOl) (A(J)rJ=l,JJ) 1001 FORMAT((lX,lPG12.5,9(1XIG12.5))) RETURN C C7------CONTINUE END 14-37 List Variable of Variables for Module UlDREL Definition Range A Module DIMENSION (JJ), ANAME Module Label CNSTNT Module Constant to which all array values are set if LOCAT is equal to zero or by which all array values are multiplied if LOCAT is not equal to zero. FiTIN Module Format IN Module Unit IOUT Global Primary IPRN Module Code for the arrays. J Module Array 33 Module Number of elements LOCAT Module Location of values to fill in the array. < 0, read an unformatted record containing the array values. = 0, set all the array values equal to constant (CNSTNT). > 0, read the formatted records containing the array values. for Input printout under which array. of the the array number from which the be read. unit number for format input all array. values array will control printed be read. record output. to be used when printing will IOUT = 6. the index. 14-38 in the array. REFERENCES Collins, R. E., 1961, Flow of fluids through Reinhold Publishing Corp., 270 p. porous Crichlow, Henry B., 1977, Modern reservoir engineering Englewood Cliffs, N.J., Prentice Hall approach; materials; New York, - A simulation Inc., 354 p. McDonald, M.G., and Harbaugh, A.W., 1984, A modular three-dimensional finite-difference ground-water flow model: U.S. Geological Survey Open-File Report 83-875 , 528 p. reservoir Peaceman, Donald W., 1977, Fundamentals of numerical New York, Elsevier Scientific Publishing Company, 176 p. Remson, Irwin, Hornberger, methods in subsurface simulation; George M. and Molz, Fred J., 1971, Numerical hydrology; New York, Wiley-Interscience, 389 p. flow-numerical Rushton, K. R., Redshaw S. C., 1979, Seepage and groundwater analysis by analog and digital methods; New York, John Wiley and Sons Trescott, Peter C., 1975, Documentation of finite-difference model for simulation of three-dimensional ground-water flow: U.S. Geological Survey Open-File Report 75-438, 32 p. Trescott, Peter C. and Larson, S. P., 1976, Supplement to Open-File Report 75-438, Documentation of finite-difference model of three-dimensional ground-water flow; U.S. Geological Survey Open-File Report 76-591, 21 p. Trescott, P. C., Pinder, G. F., and Larson, S. P., 1976, Finitedifference model for aquifer simulation in two dimensions with results of numerical experiments: U.S. Geological Survey Techniques of Water-Resources Investigations, Book 7, Chapter Cl, 116 p. Weinstein, H. C., Stone, H. L., and Kwan, T. V., 1969, Iterative procedure for solution of systems of parabolic and elliptic equations in three dimensions: Indus. Engineering Chemistry Fundamentals, v. 8, no. 2, p. 281-287. 14-39 APPENDIX A PROGRAMPORTABILITY Introduction One of the major design requirements for the model program was that it should be portable. A portable program is one that can be run with a minimum of modification on most computers that are physically capable of running a program of its type. The goal of portability for the model program has been attained as evidenced by the fact that it has run successfully in either its present form or the earlier form (McDonald and Harbaugh, 1984) on computers manufactured by many companies including mainframe computers, minicomputers, and microcomputers. The following discussion explains in more detail the concept of portability, what was done to maximize portability of the model programs and circumstances that might require that the program be changed in order to run successfully on a particular computer. The Impact of the Programming Language on Portability The programming language is the most important factor that determines program portability. There are a variety of programming languages available, and for each language, there are numerous versions which have resulted from the desire of vendors to improve the power of the language and to take The most advantage of the hardware features of their particular computers. commonly available language suitable to use for the model program is FORTRAN. There are two versions defined by the American National Standards Institute (ANSI) on which most commercial versions are based, ANSI X3.9-1966 and ANSI X3.9-1978.l These versions are commonly referred to as FORTRAN66 and FORTRAN77, respectively. FORTRAN66 was selected for the original version of the model because, at the time, it was far more widely supported than was FORTRAN 77. Now that the FORTRAN77 standard is more widely supported, the program has been converted to this standard. The program in this report is nearly identical to the original program except for the changes required to make it comply with the FORTRAN77 standard. These changes are minor and are described by McDonald and Harbaugh The conversion was done solely for the purpose of making the (1984, p. 505). program comply with the FORTRAN77 standard; many of the features that make FORTRAN77 more powerful than FORTRAN66 were not used. An effort to make more extensive FORTRAN77 revisions to the program is judged to be uneconomical. Such an effort would not result in significant improvements in program clarity or efficiency. I American National Standards Institute, Standards Institute, X3.9-1966, 36 p. American American National National Standards Standards Institute, Institute, 1966, FORTRAN: American 1978, Programming language X3.9-1978, chs. 1-18. A-l National FORTRAN: Most commercial versions of FORTRAN77 compilers include some extended features not defined as part of the FORTRAN 77 standard. Such features vary The widely among computer vendors and were not used in the model program. program contains only one exception to complete compliance to the FORTRAN77 This exception , which is explained in standard that the authors are aware of. a following section (see The Impact of Allocating Array Storage In a Single is commonly allowed on computers and should not be a Array on Portability), Because the program closely follows the major restriction to portability. FORTRAN77 standard, the program should work on any computer supporting this language provided that the computer has adequate computational power. It is recognized that some users may want the program converted back into the FORTRAN66 language because they have access only to older compilers. Only a few changes are required to convert the program back to FORTRAN66. Information about how to convert is provided in a following section (see Conversion to FORTRAN66). The Impact of Computational Precision on Portability Variation of precision among computers causes some problems with program portability. Computational precision refers to the accuracy at which numbers are calculated and stored in the computer. To prevent the imposition of constraints on the computers on which FORTRAN is implemented, the computational precision was not defined as part of the standards. The accuracy of model results are dependent on the computational precision, so precision must be considered when moving the model program among computers. The model program was developed on computers using 32 binary bits to represent single precision real numbers. This gives from 6 to 7 decimal digits of precision and includes values that range in magnitude from approximately lo**-39 to 10**38. Double precision real numbers are represented by 64 binary bits and range in magnltude from approximately lo**-10000 to 10**10000 with 14 to 15 decimal digits of precision. The head array? HNEW, and some variables in the solvers are stored as double precision, and accordingly many calculations in the solvers are double precision. This was necessary for accuracy under some conditions. The model program should perform adequately for most problems on computers that use 32 bits for single precision and 64 bits for double precision. However, the required precision depends on the problem being simulated. Thus, the user must ultimately determine if adequate precision is being used for solving a particular problem. There are some situations for which there is a need to modify the program to make all real number calculations in double precision. If using a computer that represents single precision real numbers with less than 32 bits, then double precision is probably necessary for all real numbers and calculations. Even on computers that represent single precision numbers with 32 bits, certain problems are difficult to solve without making all real numbers and calculations double precision. it is difficult to predict if a Unfortunately, specific problem requires all double precision. Simulations with very large numbers of cells, for example more than 50000, are more likely to have precision problems than are smaller simulations. Simulations in which there are areas having significant ground-water flow and yet the heads in the adjacent model cells in these areas are equal within .Ol percent or less are A-2 also more likely to have precision problems. In addition, precision problems depend on the preciseness of the attempted solution. In general, the symptoms of inadequate precision are either a poor volumetric flow balance or lack of convergence by the solver. However, these same symptoms are more commonly caused by bad input data or improper adjustment of parameters that control iteration. Because precision problems are in general fairly unlikely and use of all double precision results in increased memory and computer time usages conversion to double precision should probably be done as a last resort in order to solve convergence problems. If the program is converted to all double precision, almost twice the computer memory is required for model data. To convert all real numbers and calculations to double precision, do the following: 1. Declare all single precision real arrays and variables as DOUBLE PRECISION in the main program and in every subroutine. This can be done by adding the statement IMPLICIT DOUBLE PRECISION (A-H,O-Z) to the beginning of the specifications section of every subroutine and the Alternately main program. , some compilers have a special command that will accomplish this without the need to modify the program itself. 2. In’ the Basic statement Package Allocate module (subroutine BASlAL) change the I SUM=ISUM+2*NRCL to ISUM=ISUM+NRCL 3. Change the real intrinsic functions Specifically, precision equivalents. DMAXl, and AMINl to DMINl. in subroutine change all SSIPlI to their double occurrences of AMAXl to If using a computer on which significantly more than 32 bits are used to use of double represent single precision real numbers, then the partial precision data and calculations as included in the present model program may be unnecessary. The program should still work on such computers without modification, but computational time and memory would be saved if double The program was designed so that changing to all precision were eliminated. single precision would 'be easy. For this reason* the use of double precision intrinsic functions and constants is avoided, and all conversions between real and double precision are done by implied type changes in assignment statements. If it is determined that the use of all single precision is acceptable, make the following changes to the program: 1. Delete all 2. In the Basic statement DOUBLE PRECISION specification Package Allocate module ISUM=ISUMt2*NRCL to ISUM=ISUMtNRCL A-3 Statements. (subroutine BASlAL) change the The model program was developed on computers that use 32 bits for integer This is more than adequate to represent the range numbers and calculations. of integer numbers that are used in the program under any conditions. The largest integer that the computer must be able to represent is the dimensioned size of the X array in the main program. Many FORTRAN compilers allow one to specify that integers be represented by 16 bits, which does not provide enough precision for larger model simulations. That is, a 16 bit integer in a typical computer can represent numbers in the range -32768 to 32767, and an X array dimension of 32767 is adequate only for simulations that have 2200 to 3000 cells, depending on what options are used. The Impact of Allocating Array Storage in a Single Array on Portability Because almost all model data are stored in the X arrayI which is dimensioned in the main program , this array can be quite large. It is generally 10 to 15 times the size of the number of model cells. Some computers require that special compiler options be used when an array exceeds a specified size. Users are cautioned to be aware of this and use the appropriate options as needed. The result of using the incorrect option can sometimes be that the program will execute without producing error messages# but answers will be incorrect. All computers limit the amount of array space that a program can use. If a user's simulation exceeds this limit, the only options may be to use a different computer or make the simulation smaller. However, some computers make a distinction between total amount of memory used for all arrays and the total used by a single array. That is, some computers might allow 4 arrays each having 32000 elements, but not allow a single array consisting of 128000 elements. On such a computer, it is quite possible that one could exceed the size limit for a single array without exceeding the total array size limit because nearly all model data are stored in the single X array. If this situation occurs, it is possible to break the X array into smaller pieces. Although this can be done by modifying only the main program* the modification is fairly complex. Such modification requires a knowledgeable programmer who has a clear understanding of how model data are stored within the X array. Before making such a modification, it would be prudent to assess how long the desired simulation might take to execute. Generally, computer execution speed is more of a constraint on maximum problem size than is array size. The only known exception to the use of the FORTRAN 77 standard in the model program is that the da?a type of actual subroutine arguments does not always match the type of the corresponding dummy arguments. The standard requires the data type of actual and dummy arguments to match. This only happens in the main program where it calls subroutines using actual arguments that are elements from the X array. The X array itself is data type real, and several model arrays stored withi X are either integer (arrays IOFLG, IBOUND, IRCH, IEVT, and LRCH) or double precision (array HNEW). For example, actual argument X(LCIRCH) in the main program is passed to dummy argument IRCH in subroutine RCHlRP. X(LCIRCH) is of type real, and IRCH is of type integer. This practice has not been a problem in the past. Should this become a problem on future computers, required changes will be fairly minor, affecting only the main program and some of the Allocate modules. A-4 The Impact on Portability of Preconnected File Units FORTRAN77 provides 2 ways for a file unit to become connected to (associated with) a file -- preconnection and the OPEN statement. The model program use preconnection. This means that the computer's operating system provides the connection between files and file units prior to program execution. Often the user must issue commands to the system, which connect the necessary files and file units, prior to running the program. The Generally, specific method for doing this varies among.computers. preconnection is adequate, but it may be inconvenient on some computers. Modification of the main program to use OPEN statements is a simple task for a programmer. Conversion to FORTRAN66 Because the model program uses only one feature of FORTRAN 77 that is not part of FORTRAN66, few changes are needed in order to make the program comply with the FORTRAN66 standard. All of the required changes are a result of differences in the way character (alphanumeric) data are handled by the two versions of FORTRAN. Any variables or arrays holding character data must be declared to be the character data type in a FORTRAN77 program; in a FORTRAN The 66 program, character data are stored in numeric variables or arrays. specific changes that are required to make the model program comply with the It is assumed that at least four FORTRAN66 standard are shown below. characters can be stored in a single precision real variable or array element. 1. Delete all program. 2. In each of the array change the statement CHARACTER*4 statements reading throughout utility modules all subroutines (UlDREL, and the main U2DREL, and U2DINT1, CHARACTER*20 FMTIN to DIMENSION FMTIN(5) 3. In each of the array reading utility modules (UlDREL, U2DREL, and change all occurrences of W20V1 to 115A411. For example, change 1 ' USING FORMAT: ',A20/3OX,79('-')/I in subroutine 1 4. U2DINT)r UlDREL to ' USING FORMAT: ',5A4/30X,79('-')/I To make the program strictly comply with the FORTRAN66 standard, it is necessary to change character constants in DATA statements to Hollerith constants. However, most FORTRAN66 compilers accept character constants specified using FORTRAN77 notation (using apostrophes). Thus, it is unlikely that this change will be required. A-5 APPENDIX B SPACE REQUIREMENTS IN THE X ARRAY The outline The formulas given the X-array can be used to calculate.the However, problem. program and let as part below gives it it calculate the NODES is defined I. the size. The total even if X array is approximately on the options each package. X array for a run the model space required is printed is dimensioned too small. 10 to 15 times the number In the selected. outline number of nodes in the model. BAS Package A. 8*NODES + (NLAY - l)*NCOL*NROW + NROW+ NCOL + 4*NLAY B. Additionally, add NODES if start BUFF is separate head is saved (ISTRT is not 0), from RHS (IAPART is not 0) BCF Package A. NLAY B. If c. For each layer where LAYCON is one or three, add 2*NCOL*NROW D. For each layer where LAYCON is two or three, add NCOL*NROW E. If a transient simulation a transient simulation LAYCON is two or three, III. for of the to simply the X array as NCOL*NROW*NLAY, the and add NODES if II. size easier of nodes in the model depending below, exact is generally of the model printout As a rough estimate, space requirements WEL Package -- (ISS is 0), (ISS is 0), add NODES for add NCOL*NROW 4*MXWELL 6-i each layer where IV. DRN Package -- 5*MXDRAN V. RIV Package -- 6*MXRIVR VI. EVT Package A. Option 1 -- 3*NCOL*NROW B. Option 2 -- 4*NCOL*NROW GHB Package -- VII. VIII. 5*MXBND RCH Package IX. x. A. Options B. Option 2 -- SIP Package --- SOR Package Generally, close to the hand, it is is selected. a factor 1 and 3 -- it NCOL*NROW 2*NCOL*NROW 4*NODES + 4*MXITER + NPARM (NLAY + 4)*NCOL*NLAY is advisable to have the X-array amount of space needed for inconvenient Several of two should to redimension load + 4WXITER modules with be adequate. B-2 a specific problem. the X array the size dimension every of the relatively On the time X array other a new option differing by APPENDIX C CONTINUATION OF A PREVIOUS RUN There is often value model runs. This continue simulation. the allows not have a special to continue disk file, subroutine generated option that reads disk files the not the total budget for that file starting of all a series simulation time output budget are always for runs, it C-l report does is quite simple on a heads for the the next need for run. of reading The model- reformatting. set to zero at the start only but total that runs. If the totals the model program runs can be calculated of each run. or not to is to be continued runs is desired, model runs, short of the of continuation Similarly, single in this on a model run represents of continuation only whether heads (UZDREL) is capable terms several of one run as input run that as starting runs in a series of continuation times the of saved heads without printed runs, making continuation run can be added externally. simulation between into the model program heads from the budget a series for by using and specify Because volumetric model run, Although save the long simulations one to decide, a simulation Simply next. in breaking one run, a total from each keeps track simulation externally of a time by adding of for the APPENDIX D SAMPLE PROBLEM This sample problem is intended to illustrate input and output from as shown in the accompanying There are three simulated layers, the program. illustration, which are separated from each other by confining layers. Each layer is a square 75,000 feet on a side and is divided by a grid into 15 rows and 15 columns which form squares 5,000 feet on a side. Flow within the confining layers is not simulated, but the effects of the confining layers on flow between the active layers are incorporated in the Flow into the system is infiltration vertical leakance (Vcont) terms. flow out of the system is to buried drain tubes, from precipitation; discharging wells, and a lake which is represented by a constant-head boundary. I Recharge to Layer 1 1234567 LAYER 1 UNCONFINE LAYER 2 CONFINED LAYER 3 CONFINED Between layers 1 and 2 vertical hydraulic conductiwty diwded by thickness = 2X10-~ Between layers 2 and 3 vertical hydraulic conductivity divided by thickness = 1X10-% D-l q 3X104 ft/s Setting starting heads equal to 0.0, the program was run to get a steady-state solution. The Strongly Implicit Procedure was used to solve the system of difference equations: the error criterion was set at 0.001 feet, the acceleration parameter was set to 1.0, and the maximum number of iterations was set equal to 50. A seed of 0.001 was specified for use in calculating the iteration parameters; 31 iterations were needed to close. List Q = 5 ft3/s Layer of Wells List for Conductance Row each well Column Layer Row of Drains = 1 ftz/s Column Elevation 3 5 11 1 8 2 0.0 2 4 6 1 8 3 0.0 2 6 12 1 8 4 10.0 1 9 8 1 8 5 20.0 1 9 10 1 8 6 30.0 1 9 12 1 8 7 50.0 1 9 14 1 8 8 70.0 1 11 8 1 8 9 90.0 1 11 10 1 8 10 100.0 1 11 12 1 11 14 1 13 8 1 13 10 1 13 12 1 13 14 D-2 Input Data for Sample Problem Note that input item names are included in many of the data records shown below. These are Included for Identification purposes. These names are ignored by the model program when it reads the data because they are placed columns beyond those used to hold model data. in Input for FORTRAN unit 1 -- Basic Package: SAMPLE---- 3 LAYERS, 15 ROWS, 15 COLUMNS; STEADY STATE; CONSTANT HEADS COLUMN1, LAYERS 1 AND 2; RECHARGE,.WELLS AND DRAINS 1 15 15 1 3 11 12 13 0 0 0 0 18 19 0 0 00 0 0 IAPART, ISTRT IBOUND3 1 l(1513) 1 1 1 1 1 1 -1 1 1 1 10 1111 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 : 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 : 1 1 1 1 3 IBOUND1 l(1513) -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 : : : 1 1 1 1 1 1 1 : 1 : 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 IBOUND0 1 999.99 HEAD-l 0. 0 HEAD-Z 0. 0 HEAD-3 0. 0 PERLEN,NSTP,TSMULT 1 1. 86400. D-3 Input for 1 FORTRAN unit 0 11 -- Block-Centered ISS, IBCFBD Flow Package: 100 0 0 0 0 0 0 0 : Input for cLc, Input Input 1 1 0 1. 5000. 5000. .OOl -150. 2.E-8 .Ol l,E-8 .02 FORTRAN unft 0 18 -- Recharge Package: NRCHOP,IRCHBD INRECH RECH-1 3.E-8 for FORTRAN unit 50 5 1. .OOl Implicit 19 -- Strongly MXITER, NPARM 0 .OOl for 13 -- Drain Package: MXDRAI, IDRNBD NDRAIN 2 0. 3 0. 4 10. 5 20. 6 30. 7 50. 8 70. 9 90. 10 100. 9 9 1 1 1 1 1 1 1 1 1 Input TRPY DELR DELC HY-1 BOT-1 VHY/THICK-1 T-2 T-3 VHY/THICK-2 FORTRAN unit 0 for 15 15 3 8. 8 8 8 8 8 8 8 8 FORTRAN unit 0 5 12 -- Well Package: MXWELL,IWELBD ITMP (NWELLS) 11 -5. f 1 : 9 1; 8 1;: -5. : 1 1 1 1 1 1 1 1 1 ii 9 11 11 11 11 13 13 13 13 :; 14 8 10 12 14 8 10 12 14 1;: -5. -5. -5. -5. -5. -5. -5. -5. -5. D-4 Procedure Package: 1 ACCLrERR, IPCALC, WSEED l.EOO l.EOO l.EOO l.EOO l.EOO l.EOO l.EOO l.EOO i.EOO Sample Problem Output Note that it should not be expected that the outputs from running the same problem on different computers will exactly match. Small variations in output can be caused by differences in the way real numbers are stored and calculated. Storage and calculation of real numbers depend on the specific computer hardware , the FORTRANcompiler , and the math library that is loaded with the compiled program. Output variations among computers also depend on the size of the problem, the number of iterations required for solution, and the precision used when printing results. In this sample problem, most values should not vary from one computer to another. Those few values that vary should generally vary only in the least significant digit; however, the budget term llIN-OUT1lr because it is the difference of two nearly identical numbers, may vary by as much as a factor of 3 from one computer to another. U.S. GEOLOGICAL SURVEY MOWLAR FINITE-DIFFERENCE 15 CCLU~S; STEADY STATE; SAMPLE----3 LAYERS, 15 REM, 15 Rws 15 alLUrnS 7 I AYERS 1 STRESS FERIODt&IN SIMJLATION MODEL TIME UNIT IS SECONDS _ _...-.._ I/O UNITS: ELEMENT OF I/O IUNIT: UNIT: GROUND-WATER MODEL PACKAGE, VERSION 1. 9/l/87 INPUT READ FROM UNIT ARRAYS RHS AND BUFF WILL SHARE MEMORY. START HEAD WILL NOT BE SAVED -- DRAWCCWN CANNOT BE CALCULATED 5892 ELEMENTS IN X ARRAY ARE USED BY BAS 30000 5892 ELEMENTS OF X ARRAY USED CUT OF BCFl -- BLOCK-CENTERED FLOW PACKAGE, STEADY-STATE SIMULATION LAYER AGUIFER TYPE ----------_-_------ WELl 1 AND 2; VERSION 1, 9/l/67 INWT 1 READ FRCM UNIT 11 1 0 : 3 LAYERS 1 2 3 4 5 6 7 6 9 10 11 12 13 14 15 16 17 16 19 20 21 22 23 24 11 12 13 0 0 0 0 18 19 0 0 0 0 0 0 0 0 0 D 0 0 0 0 0 BASl -- BASICMDDEL 453 6345 1, CONSTANT HEADS WLUMV 0 ELEMENTS IN X ARRAY ARE USED BY BCF 30000 ELEMENTS OF X ARRAY USED CUT OF WELL PACKAGE, VERSION 1. 9/l/87 INPUTREADFROM 12 15 WELLS 60 ELEMENTS IN X ARRAY ARE USED FOR WELLS 30000 6405 ELEMENTS OF X ARRAY USED OUT OF - MAX1t.MOF PACKAGE, VERSION 1, 9/l/67 INPUTREAD FROM 9 DRAINS 45 ELEFENTS IN X ARRAY ARE USED FOR DRAINS 30000 6450 ELEtSZNTS OF X ARRAY USED OUT OF DRNl -- DRAIN MAXIWMOF Ktil -- RECHARGE PACKAGE, VERSION OPTION1 -- RECHARGE TO TOP LAYER 225 6675 1, 9/l/67 INPUTREAD UNIT 13 FROM UNIT 16 ELEMENTS OF X ARRAY USED FOR RECHARGE 30000 ELEMENTS OF X ARRAY USED OUT OF SIP1 -- STRONGLY IMPLICIT FRMTDURE SaLUTION PACKAGE, MAXIMUM OF 50 ITERATIONS ALLCWED FOR CLOSURE 5 ITERATIONPARAMETERS 2905 ELEMENTS IN X ARRAY ARE USED BY SIP 30000 9580 ELEMENTS OF X ARRAY USED CUT OF VERSION 1. D-5 9/l/87 INPUT READ FROM UNIT 19 RECHARGE, WELLS AND DRAINS S/WI&---3 LAYERS. 15 RCWS. 15 COLUMNSJ STEADY STATE; CONSTANT HEADS COLUM.4 1, LAYERS 1 AND 2; RECHARGE, WELLS AND DRAINS BCUNDARYARRAY FOR LAYER 1 WILL BE READ ON UNIT 1 USING FOIMAT: (1513) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ..................................................................... 1 -1 11111111111111 2 -1 11111111111111 3 -1 11111111111111 4 -1 11111111111111 5 -1 11111111111111 6 -1 11111111111111 7 -1 1 B -1 11111111111111 1 1 1 1 1 1 1 I 1 1 1 1 1 9 -1 11111111111111 10 -1 I 1 I 1 1 1 1 1 1 1 1 1 1 1 11 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 -1 1 1 1 1 1 1 11111111 13 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 -1 11111111111111 BOUNDARYARRAY FOR LAYER 2 WILL BE READ ON UNIT ----__---------------------------------------------------------------------------------------- 1 234567 8 9 10 11 12 13 14 15 ..................................................................... 1 -1 11111111111111 2 -1 11111111111111 3 -1 11111111111111 4 -1 11111111111111 5 -1 11111111111111 6 -1 11111111111111 7 -1 11111111111111 8 -1 11111111111111 9 -1 11111111111111 10 -1 1 1 1 11 -1 1 1 1 12 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 D-6 1 USING FOMT: (1513) BOUNDARY ARRAY = AQUIFER HEAD WILL BE SET TO 999.99 AT ML NO-FLW ME FoLLWIffi UJTFUT COMES AT ME HEAD = READ = 0.0000000Et00 FOR LAYER 2 HEAD = O.DDDOOOOEtOO FOR LAYER 3 END OF EACH STRESS PERIOD: ANISOTROPY DELR = 5000.000 DELC = 5000 .OOO VERT HYD CCND /THICKNESS TRANSMIS. VERT HYD CCND /THICKNESS SCUTION = ALONG RCWS = TRANSMIS. l.OOODOO = BOTTOM = = ALONG RCW = 0.9999999E-03 FOR LAYER 1 -150.0000 FOR LAYER 1 0.2OOOOOOE-07 FOR LAYER 1 0.1000000E-01 FOR LAYER 2 0.1000000E-07 FOR LAYER 2 0.2ODOOOOE-01 FOR LAYER 3 BY THE STRONGLY IMPLICIT MAXIfdJM ITERATIONS ALLWED FOR CLOSURE ACCELERATION PARMTER HEAD CHANGE CRITERION FOR CLOSURE SIP HEAD CHANGE PRINTOUT INTERVAL 0.0000DD0Et0D CALCULATED D.B22172OE+OD FROM SPECIFIED 0.9683772EtOO 1 INITIAL HYD. COND. ALONG ROWS = PARMETERS FOR LAYER 0.0000000E+00 INITIAL CCLUMY TO RW 5 ITERATION 3 NODES (IBWNO=O). INITIAL DEFAULT OUTPUT WNTRaL -TOTAL VCLLMETRIC BUDGE1 HEAD 1 FOR LAYER WEED = D.DDlOODOO 0.9943766EtOO D-7 : D.9990000EtOO = = = = PROCEDURE 50 1 .OODO O.lOOOOE-02 1 STRESS PERIoo No. 1s LENGrn = _-_____-I------_----------------NlmERoFT1LE MILTIFLIER INITIAL TIM STEPS = 66400.00 1 FOR DELT = 1.000 STEP SUE = 06400.00 15 WELLS 3 : STRESSRATE WELLNO. -------------------11 -5 .oooo 1 2 6 9 9 12 6 0 10 -5 .oooo -5.0000 -5 .oooo -5 .oooo : 4 5 09 ii 14 8 -i .oooo -5.0000 -5 .oooo -5 .oooo -5.0000 -5 .oooo -5 .oooo -5 .owo -5 .oooo -5.0000 ii7 0 9 LAYER Ran 1 1 : : ca. :: : :: 1 : :i 14 8 :i 1 :3 :z 14 :: :: :: 9 DRAINS LAYER RCU mw--m---m-m-. cu. --- REVATIOW -1-------s 8 2 o.wow+oo 1 o.oowE+w 1 10.00 x 8 : 1 : x DRAIN NO. 1.060 1 i.ow 1.000 I.000 l.OW 1.000 1.000 1.000 1.000 20.66 30.00 50.00 10.00 90.00 x 8 : -MX loo.0 RECHRGE- 0.3000000E-07 31 ITERATIONS FORTILL STEP 1 IN STRESS FERIOO 1 UWMJMHEADCHANGE FOREMY ITERATIONI HEAD CW'JdGELAYER,RCM,COL HEADCIMGE ----______---___----Iu--l----------12.48 -22.41 ( 3, 5, 11) 2.482 ( 1, 9, 14) 1.430 0.5503 ( 3. 8, 7) 0.4821 LAVERRCU,OOL HEMOE ( 1, ( ( 1, 15) 3, 10, 13) 2, 6, 9) 13.39 6.214 0.4711 LAYER,R(W,COL HEADCMNGE LAYER.R(W,!XL HEADCHANGE LAYER,RW,CDL _----_--------------____I_______________--------------( 3, 1, 14) 48.21 ( 1, 1, 15) 35.90 ( 3, 1, 13) ( 1, 12, 14) 7.411 ( 3, 11, 14) 13.66 ( 1. 15. 15) f 3, 5, 10) 2.019 ( 1, 11, 14) 2.302 ( 3. 5, 13) ( 1, 14. 14) 0.3141 ( 3, 13, 14) 0.3321 ( 1, 15, 15) ( 3, llr 10) 0.7911E-01 ( 1, 14, 14) 0.85OOE-01 ( 3, 7, 14) 0.1108 ( O.%SE-02 0.4169E-02 0.2426E-03 ( ( 1. 13, 12) 0.7059E-01 ( 3, 12, 11) 0.2819 1, 13, 12) 0.15&E-01 ( 2, 11s 11) 0.1777E-01 1, 13. 141 0.2555E-02 ( 3, 14, 15) 0.9771E-02 ( ( I, 13. 12) D-8 1. 14. 14) O.l082E-01 ( 3. 13. 14) O.l03OE-01 ( 1. 15. 15) MAD IN LAYER 1 AT END OF TIHE STEP 1 IN STRESS PERIOD 1 4 6 7 1 3 5 8 9 10 11 14 13 13 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 1 2 O.OOOOEtOO 117.4 24.94 121.3 59.26 126.4 11.02 121.4 82.52 91.91 100.0 106.9 112.6 43.10 122.7 57.98 124.9 70.17 80.57 90.12 98.40 105.3 111.0 55.43 122.1 66.78 123.4 76.21 86.51 95.20 102.2 107.6 0.00OOEt00 115.7 119.6 O.OOOOEtOO 112.0 23.45 116.1 41.30 O.OOOOEtOO 21.92 110.7 38.61 114.9 51.75 81.34 90.75 91.64 102.5 117.9 61.79 119.4 68.03 106.1 5 0.0oo0Et00 91.29 19.73 103.1 34.92 108.8 41.32 112.5 57.69 114.3 66.74 11.09 85.76 92.22 96.15 6 O.OOOOEtOO 93.03 16.51 94.23 29.50 40.90 166.4 51.30 108.4 61.21 71.19 79.85 86.41 90.82 102.1 0.0000Et00 68.60 21.10 96.43 31.21 99.02 41.40 51.84 63.08 72.68 19.95 84.92 91.66 3.483 85.00 6.832 89.21 16.25 91.12 26.30 94.33 36.97 52.59 64.31 72.52 77.25 O.OOOOEtOO 73.93 10.54 13.79 19.11 28.12 80.17 36.92 86.49 45.21 52.95 55.36 65.15 66.07 80.84 O.OOOOEtOO 70.39 14.62 12.44 25.86 76.72 35.38 78.26 43.49 50.11 54.93 57.55 62.95 65.55 O.OOOOEtOO 66.43 17.11 29.96 72.22 40.01 71.04 47.78 77.62 53.24 55.81 53.33 60.27 59.29 65.45 12 0.00O0Et00 67.12 18.68 68.50 32.56 12.29 43.01 73.46 50.81 76.85 55.92 58.33 58.47 61.93 63.18 13 o.ooooEtoo 67.22 19.67 34.24 53.01 76.48 59.91 56.75 62.59 60.91 71.90 45.14 70.35 58.04 65.75 20.27 73.18 35.21 75.84 46.48 77.03 54.61 79.09 60.08 63.17 64.52 67.25 60.79 20.56 16.22 35.78 78.22 47.16 79.66 55.48 80.82 61.26 65.02 67.52 69.94 72.01 3 4 7 8 O.OOOOEtOO 81.99 9 10 11 14 O.OOOOEtOO 71.64 15 O.OOOOEtOO 14.29 24.45 44.01 124.3 11.55 119.6 126.1 101.8 81.79 D-9 HEAD IN LAYER 2 AT END OF TIE ----------------------------------------------------------------------- STEP 1 IN STRESS PERIOD 1 6 7 10 5 0 9 1 2 3 15 11 12 13 1: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 1 O.OOOOE+OO 117.2 2 O.OOOOE+OO 115.5 43.73 124.1 59.02 71.61 127.3 82.32 91.72 99.06 106.7 112.5 126.2 42.83 122.6 57.74 124.8 69.95 80.36 89.93 98.22 105.1 110.8 119.4 24.66 121.1 24.17 125.9 3 0.0000Et00 111.8 23.17 116.0 41.03 119.5 55.19 121.9 66.53 123.2 75.77 86.29 95.02 102.0 107.4 4 O.OOOOE+OO 105.4 21.65 110.4 38.34 114.8 51.50 117.7 61.35 119.2 60.17 80.90 90.55 97.45 102.3 5 O.OOOOEtOO 91.09 19.48 102.1 34.65 108.6 47.07 112.4 57.44 114.2 66.30 76.85 85.57 92.00 95.41 6 O,OOOOE+OO 92.06 16.27 29.24 101.7 40.65 106.2 51.07 108.3 60.98 70.98 79.65 86.28 90.54 86.23 11.38 91.24 20.95 96.22 31.05 99.65 41.25 101.6 51.70 62.90 72.48 79.16 84.73 8.330 17.58 91.59 27.58 94.17 38.25 52.94 64.19 72.34 77.12 7 O.OOOOE+OO 88.35 8 9 10 O.OOOOE+OO 81.81 O.OOOOE+OO 73.61 0.0000Et00 70.24 11 O.OOOOE+OO 12 O.OOOOE+OO 13 66.37 66.98 O.OOOOE+OO 67.16 14 0.0000Et00 15 O.OOOOEtOO 71.48 74.11 4.209 84.86 89.10 74.40 80.77 18.96 27.98 60.84 36.79 86.38 45.16 52.66 56.13 65.08 66.79 14.40 25.61 76.57 35.15 78.20 43.27 81.64 49.91 54.76 57.48 62.79 65.49 66.18 29.70 72.16 39.78 71.75 41.56 77.51 53.05 55.68 54.09 60.20 60.04 18.43 68.44 32.31 72.15 42.85 50.60 76.69 55.13 58.16 58.41 61.78 63.12 13.40 19.42 66.48 33.98 71.84 44.91 71.06 52.80 76.37 57.85 59.78 57.50 62.53 61.65 20.02 73.06 35.02 75.68 46.26 76.91 54.41 78.93 59.88 62.99 64.39 67.08 68.66 20.30 76.04 35.52 78.04 46.94 79.49 55.28 80.65 61.07 64.84 67.34 69.76 71.04 10.38 72.37 16.87 D-10 HEAD IN LAYER 3 AT END OF TIRE STEP 1 Itj STRESS PERIOD 1 2 12 1 11 3 13 . . . . . . ..*.................................. 1 2 3 4 5 82.06 91.40 99.63 106.5 112.3 69.66 125.7 00.07 09.60 97.99 104.9 110.6 54.07 121.7 66.20 75.28 05.90 94.77 101.7 107.2 37.90 114.5 51.17 117.5 60.05 62.69 00.41 90.20 97.19 101.9 19.10 100.7 34.30 100.2 46.75 57.10 114.0 65.80 76.54 85.30 91.67 94.17 112.1 1.176 15.99 50.76 60.67 70.70 79.30 06.01 90.12 88.55 20.91 101.2 40.33 90.60 106.0 100.0 0.0273 07.90 11.21 90.77 20.79 95.94 30.88 41.09 101.4 51.55 62.67 72.22 79.50 04.46 99.41 0.4331 81.58 5.131 10.19 00.00 19.27 91.44 29.19 93.95 39.04 53.40 64.07 72.11 76.95 04.60 0.7543 73.01 10.22 75.31 10.02 27.04 52.70 57.03 65.02 67.64 01.64 36.66 86.24 45.06 80.72 14.13 72.33 25.29 76.39 34.05 78.15 42.99 49.65 54.54 57.44 62.61 65.44 81.43 47.28 77.30 52.79 55.53 55.01 60.16 60.94 55.47 57.94 50.37 61.60 63.00 1.000 117.0 24.34 43.36 50.70 71.33 120.9 123.9 126.0 127.1 1.764 115.3 23.85 42.46 122.4 57.42 124.6 1.691 111.5 22.86 115.7 40.67 119.3 1.570 104.1 21.35 110.0 1.415 77.46 6 7 0 9 10 1.039 70.05 11 12 13 14 119.2 123.0 119.0 1.224 16.59 29.37 39.47 66.33 67.06 72.13 72.60 1.341 66.80 18.15 60.41 31.97 71.97 42.54 73.36 50.32 1.415 67.12 19.14 33.65 71.80 44.61 59.63 50.39 62.40 62.54 71.90 52.53 76.24 57.60 67.35 19.73 72.91 34.60 75.47 45.96 76.77 54.13 70.71 59.63 62.76 64.24 66.87 68.52 20.01 35.18 77.01 46.63 55.00 00.42 60.01 64.59 67.11 69.52 71.61 1.460 71.27 15 6 9 7 0 10 4 14 1: .................................................................................. 1.401 73.07 75.02 79.27 76.49 D-11 VOLIJKTRIC BUDGET FOR ENTIRE MODEL AT END OF TIK --_------___________--------------------------------------------------------CUMULATIVE ------------------ VCCWS STEP LB*3 1 IN STRESS PERIOD RATES FOR MIS ------------------------ IN: --- TOTAL = = = = = IN = OUT: ---STORAGE CONSTANT HEAD WELLS DRAINS RECHARGE O.OOODOE+OD O.OODCJOE+OO 0.00000E+00 0.00000E+00 O.l3608E+OB STORAGE CONSTANT HEAD WELLS DRAINS RECHARGE O.l3608E+08 TOTAL = = = = = IN = L”9/7 0.00D00Et00 0.43265E+07 0.648OOEt07 0.28DllEtO7 0.00000Et00 STORAGE CONSTANT HEAD WELLS DRAINS RECHARBE TOTAL OUT = 0.13608EtO8 TOTAL CUT = IN - UJT = PERCENT DISCREPANCY 184.00 = 0.00 PERCENT DISCREPANCY SUNMARY AT END OF TINE STEP 1 IN STRESS PERIOD 1 SECONDS MINUTES HOURS --------------------------------------------------------------------------86400.0 86400.0 86400.0 0 .OOOOOEtOO O.OOOOOEtOO 0 .OOOOOEtOO 0.00000Et00 157.50 157.50 OUT: ---= = = = = IN - CUT = TIE STEP LENGTH STRESS PERIOD TIME TOTAL SIWLATION TIME STEP IN: --- STORAGE CONSTANT HEAD WELLS DRAINS RECHARGE TIE TIHE 1 1440.00 1440.00 1440.00 24 .OOOO 24.0000 24.0000 D-12 DAYS YEARS 1 .ooooo 1 .ooooo 1 .ooooo 0.273785E-02 0.273785E-02 0.273785E-02 = = = = = = 0.00000Et00 50.075 75 .ooo 32.420 O.OOOOOEtOO 157.49 O.ZlZlOE-02 0.00 APPENDIX E ABBREVIATED INPUT INSTRUCTIONS These input instructions are intended as a quick reference for the experienced user. Most explanations that are contained in the complete input instructions given in package documentation have been omitted. The format of input fields is given only for those records that contain fields that are not 10 characters wide. Each input item, for which format is not given, is identified as either a record or an array. For records, the fields contained in the record are named. For arrays, only the array name is given. Input fields which contain codes or flags are described. All other field and array descriptions have been dropped. Array Input The real two-dimensional array reader (UZDREL), the integer two-dimensional array reader (UZDINT), and the real one-dimensional array reader (UlDREL) read one array-control record and, optionally, a data array in a format specified on the array-control record. FOR REAL ARRAY READER (UZDREL or UlDREL) LOCAT CNSTNT Data: F10.0 110 Format: FOR INTEGER ARRAY READER (U2DINT) LOCAT ICONST Data: 110 110 Format: FMTIN 5A4 IPRN FMTIN IPRN 5A4 110 110 IPRN--is a flag indicating that the array being read should be printed and a code for indicating the format that should be used. It is used only if LOCAT is not equal to zero. The format codes are different for each of the three modules. IPRN is set to zero when the specified value If IPRN is less than zero, exceeds those defined in the chart below. the array will not be printed. IPRN 0 U2DREL : 3 4 z 7 8 9 10 11 12 LOCAT--indicates If LOCAT If LOCAT If LOCAT the < 0, = 0, > 0, U2DINT 10611.4 10111 11610.3 9613.6 15F7.1 15F7.2 15F7.3 15F7.4 2OF5.0 20F5.1 20F5.2 20F5.3 20F5.4 10611.4 6011 4012 3013 2514 2015 UlDREL 10612.5 location of the data which will be put in the array. unit number for unformatted records. all elements are set equal to CNSTNT or ICONST. unit number for formatted records. E-l Basic Package Input Input for the Basic (BAS) Package except for output control the in the main program. If necessary, unit 1 as specified for BAS input can be changed to meet the requirements of a Input for the output control option is read from computer. specified in IUNIT(12). FOR EACH SIMULATION 1. Record: 2. Record: 3. Record: 4. Data: Format: (BCF HEADNG(32) HEADNG (continued) NROW NPER ITMUNI NCOL NLAY IUNIT(24) 2413 WEL DRN RIV EVT xxx GHB RCH SIP xxx SIR 1 5. 6. Record: Array: 7. 8. Record: Array: FOR EACH STRESS PERIOD 9. Data: is read from unit number particular the unit number 2 3 4 5 6 7 IAPART I STRT IBOUND(NCOL,NROW) (One array for each layer HNOFLO Shead(NCOL,NROW) (One array for each layer PERLEN 8 9 10 in the grid) in the grid) oc) 11 12 NSTP TSMULT ITMUNI--is the time unit of model data. 3 - hours 0 - undefined 4 - days 1 - seconds 5 - years 2 - minutes Consistent length and time units must be used for The user may choose one length unit and one time all unit model data. to be used to specify all input data. IUNIT--is a 24-element table of input units for use by all major options. IAPART--indicates whether array BUFF is separate from array RHS. If IAPART = 0, the arrays BUFF and RHS occupy the same space. This This option should be used option conserves space. unless some other package explicitly says otherwise. If IAPART f 0, the arrays BUFF and RHS occupy different space. ISTRT--indicates whether starting heads are to be saved. heads are not saved. If ISTRT = 0, starting If ISTRT f 0, starting heads are saved. IBOUND--is the boundary array. If IBOUND(I,J,K) < 0, cell 1,J ,K has a constant head. If IBOUND(I ,J ,K) = 0, cell I,J,K is inactive. If IBOUND(I,J,K) ) 0, cell I,J,K is active. HNOFLO--is the value of head to be assigned to all inactive cells. m-is head at the start of the simulation. PERLEN--is the length of a stress period. NSTP--is the number of time steps in a stress period. fSMULT--is the multiplier for the length of successive time steps. E-2 Output Control Input Input to Output Control is read from the unit specified in IUNIT(12). All printer output goes to unit 6 as specified in the main program. If necessary, the unit number for printer output can be changed to meet the requirements of a particular computer. FOR EACH SIMULATION 1. Record: FOR EACH TIME STEP 2. Record: IHEDFM : (Record 3 is IHEDFM--is IDDNFM--is re,"d Ci:eiprodr IDDNFM I HEDUN INCODE IHDDFL IBUDFL ICBCFL Hdpr Ddpr NLAY times, dependHy:i on ~~~"value a code for a code for I DDNUN of INCODE.) the format in which heads will be printed. the format in which drawdowns will be printed. 7 - (2DF5.0) 0 - (10611.4) 8 - (20F5.1) 1 - (11610.3) 9 - (20F5.2) 2 - (9613.6) positive--wrap 10 - (20F5.3) 3 - (15F7.1) 4 - (15F7.2) 11 - (20F5.4) negative--strip 12 - (10611.4) 5 - (15F7.3) 6 - (15F7.4) IHEDUN--is the unit number on which heads will be saved. IDDNUN--is the unit number on which drawdowns will be saved. m--is the head/drawdown ouput code. If INCODE < 0, layer-by-layer specifications from the last time steps Input item 3 is not read. are used. If INCODE = 0, all layers are treated the same way. Input item 3 will consist of one record. IOFLG array will be read. If INCODE > 0, input item 3 will consist of one record for each layer. IHDDFL--is a head and drawdown output flag. heads nor drawdowns will be printed or saved. If IHDDFL = 0, neither If IHDDFL f 0, heads and drawdowns will be printed or saved. IBUDFL--is a budget print flag. volumetric budget will not be printed. If IBUDFL = 0, overall If IBUDFL # 0, overall volumetric budget will be printed. ICBCFL--is a cell-by-cell flow-term flag. flow terms are not saved or printed. If ICBCFL = 0, cell-by-cell If ICBCFL # 0, cell-by-cell flow terms are printed or recorded on disk depending on flags set in the component of flow packages, . IWELCB, IRCHCB, etc. Hdpr--is the output flab';;; head printout. If Hdpr = 0, head is not printed for the corresponding layer. If Hdpr f 0, head is printed for the corresponding layer. Ddpr--is the output flag for drawdown printout. for the corresponding layer. If Ddpr = 0, drawdown is not printed If Ddpr f 0, drawdown is printed for the corresponding layer. Hdsv--is the output flag for head save. layer. If Hdsv = 0, head is not saved for the corresponding If Hdsv f 0, head is saved for the corresponding layer. Ddsv--is the output flag for drawdown save. layer. If Ddsv = 0, drawdown is not saved for the corresponding If Ddsv # 0, drawdown is saved for the corresponding layer. E-3 Block-Centered Input for the BCF Package is Flow Packaae Inout read from the unit specified in IUNIT(1). FOR EACH SIMULATION IBCFCB 1. Record: ISS LAYCON(NLAY) (maximum of 80 layers) Data: 2. Format: 4012 (If there are 40 or fewer layers, use one record.) 3. 4. 5. Array: Array: Array: All of the arrays (items arrays for layer 2, etc. TRPY(NLAY) DELR(NCOL) DELC(NROW) 6-12) for layer 1 are read first; then all of the IF THE SIMULATION IS TRANSIENT sfl(NCOL NROW) Array: IF THE LAYER %PE CODE (LAYCON) Ii ZERO OR TWO Tran(NCOL NROW) Array: IF THE LAYER GPE CODE (LAYCON) IS’ONE 0~ THREE HY(NCOL,NROW) 8. Array: 9. Array: BOT(NCOL,NROW) IF THIS IS NOT THE BOTTOMLAYER 10. Array: Vcont(NCOL,NROW) IF THE SIMULATION IS TRANSIENT AND THE LAYER TYPE CODE (LAYCON) is TWO OR THREE sfZ(NCOL,NROW) 11. Array: IF THE LAYER TYPE CODE IS TWO OR THREE 12. Array: TOP(NCOL,NROW) ISS--is If the steady-state flag. ISS f 0, the simulation ISS = 0, the simulation is steady state. is transient. IBCFCB--is a flag and a unit number. If IBCFCB > 0, cell-by-cell flow terms will be recorded if ICBCFL (see Output Control) is set. If IBCFCB = 0, cell-by-cell flow terms will not be printed or recorded. If IBCFCB < 0, print flow for constant-head cells if ICBCFL is set. LAYCON--is the layer type table: 0 - confined, 1 - unconfined, (T constant), and 3 - confined/unconfined. 2- confined/unconfined TRPY--is an anisotropy factor for each layer: T or K along a column to T or K along a row. DELR--is the cell width along rows. DELC--is the cell width along columns. sfl--is the primary storage factor. En--is the transmissivity along rows. ms the hydraulic conductivity along rows. m--is the elevation of the aquifer bottom. Gnt--is the vertical hydraulic conductivity divided by the thickness from a layer to the layer beneath it. sf2--is the secondary storage factor. m--is the elevation of the aquifer top. If E-4 River Input IUNIT(4). to the River (RIV) Package Input Package is read from the unit specified in FOR EACH SIMULATION I Record: MXRIVR IRIVCB FOR EACH STRE& PERIOD 2. Record: ITMP Rbot 3. Record: Layer Row Cond Column Stage (Input item 3 normally consists of one record for each river reach. If ITMP is negative or zero, item 3 is not read.) IRIVCB--is a flag and a unit number. If IRIVCB > 0, cell-by-cell flow terms will be recorded. If IRIVCB = 0, cell-by-cell flow terms will not be printed or recorded. If IRIVCB < 0, river leakage will be printed if ICBCFL is set. ITMP--is a flag and a counter. If ITMP < 0, river data from the last stress period will be reused. If ITMP 2 0, ITMP will be the number of reaches active during the current stress period. Recharge Input to the Recharge IUNIT(8). Package Input (RCH) Package is read from the unit specified in FOR EACH SIMULATION Record: NRCHOP IRCHCB FOR EACH STRE;J; PERIOD 2. Record: INRECH INIRCH Array: RECH(NCOL NROW) IF THE RECHAR;; OPTION IS EQUAL TO'2 4. Array: IRCH(NCOL,NROW) NRCHOP--is the 1 2 3 IRCHCB--is If If INRECH--is If If INIRCH--is recharge option code. Recharge is only to the top grid layer. Vertical distribution of recharge is specified in Recharge is applied to the highest active cell in vertical column. a flag and a unit number. IRCHCB > 0, unit number for cell-by-cell flow terms. IRCHCB 2 0, cell-by-cell flow terms will not be printed recorded. the RECH read flag. INRECH < 0, recharge fluxes from the preceding stress used. INRECH L 0, an array of recharge fluxes, RECH (Lt-l), similar to INRECH. E-5 array each IRCH. or period is read. are Well Input for the Well Package Input (WEL) Package is read from the unit specified in IUMIT(2). FOR EACH SIMULATION 1. Record: FOR EACH STRESS PERIOD 2. Record: 3. Record: (Input well. MXWELL IWELCB ITMP Row Column Layer item 3 normally consists of one reco:d If ITMP is negative or zero, item 3 is for each not read.) MXWELL--is IWELCB--is the maximum number of wells used at any time. a flag and a unit number. If IWELCB > 0, unit number for cell-by-cell flow terms. flow terms will not be printed or If IWELCB = 0, cell-by-cell recorded. If IWELCB < 0, well recharge will be printed whenever ICBCFL is set. ITMP--is a flag and a counter. If ITMP < 0, well data from the last stress period will be reused. If ITMP 2 0, ITMP will be the number of wells active during the current stress period. Drain Input IUNIT( 3). to the Drain Package Input (DRN) Package is read from the unit specified in FOR EACH SIMULATION IDRNCB MXDRN 1. Record: FOR EACH STRESS PERIOD 2. Record: ITMP Cond Elevation 3. Record: Layer Row co1 (Input item 3 normally consists of one record for each drain. If ITMP is negative or zero, item 3 will not be read.) MXDRN--is the maximum IDRNCB--is a flag and If IDRNCB > 0, If IDRNCB = 0, number of drain cells active at one time. a unit number. unit number for cell-by-cell flow terms. cell-by-cell flow terms will not be printed or recorded. If IDRNCB < 0, drain leakage for each cell will be printed whenever ICBCFL is set. ITMP--is a flag and a counter. If ITMP < 0, drain data from the last stress period will be reused. If ITMP 10, ITMP will be the number of drains active during the current stress period. E-6 Evapotranspiration Input to the Evapotranspiration specified in IUNIT (EVT) Package is read from the unit (5). FOR EACH SIMULATION NEVTOP 1. Record: FOR EACH STRESS 2. Record: 3. Array: 4. Array: 5. Array: Package Input PERIOD I NSURF SURF EVTR EXDP IEVTCB I NEXDP I NEVTR INIEVT IF THE ET OPTION IS EQUAL TO TWO 6. Array: IEVT NEVTOP--is the evapotranspiration (ET) option code. 1 - ET is calculated only for cells in the top grid layer. column is specified by the 2 - The cell for each vertical user in array IEVT. IEVTCB--is If If INSURF--is If If a flag and a unit number. number for cell-by-cell IEVTCB 5 0, cell-by-cell flow terms will recorded. IEVTCB > 0, unit flow terms. not be printed or the ET surface (SURF) read flag. INSURF 10, an array containing the ET surface elevation will be read. INSURF < 0, the ET surface from the preceding stress period will be reused. INEVTR--is similar to INSURF. INEXDP--is similar to INIEVT--is similar to INSURF. INSURF. E-7 General-Head Input for specified the General-Head in IUNIT(7). Boundary Boundary Package Input (GHB) Package is read from the unit FOR EACH SIMULATION IGHBCB MXBND 1. Record: FOR EACH STRESS PERIOD Boundary Record: ITMP 2. Cond Head Column Row 3. Record: Layer (Input item 3 normally consists of one record for each GHB. If ITMP is negative or zero, item 3 is not read.) MXBND--is the maximum IGHBCB--is a flag and If IGHBCB > 0, If IGHBCB = 0, number of general-head boundary cells at one time. a unit number. unit number for cell-by-cell flow terms. cell-by-cell flow terms will not be printed or recorded. If IGHBCB < 0, boundary leakage for each cell will be printed whenever ICBCFL is set. ITMP--is a flag and a counter. If ITMP < 0, GHB data from the preceding stress period will be reused. ‘If ITMP 2 0, ITMP is the number of general-head boundaries during the current stress period. Strongly Implicit Input to the Strongly Implicit unit specified in IUNIT(9). FOR EACH SIMULATION MXITER 1. Record: ACCL 2. Record: Procedure (SIP) Procedure NPARM HCLOSE Package Input Package is I PCALC read from the WSEED IPRSIP IPCALC--is a flag indicating where the iteration parameter seed will come from. 0 - the seed will be entered by the user. at the start of the simulation from l- the seed will be calculated problem parameters. IPRSIP--is the printout interval for SIP. Slice-Successive Overrelaxation Input to the Slice-Successive Overrelaxation the unit specified in IUNIT(11). FOR EACH SIMULATION 1. Record: 2. Record: MXITER ACCL HCLOSE IPRSOR--is interval for the printout SOR. E-8 Q U.S. GOVERNMENT PRINTING OFFICE: 1988-2 0 1 -9 8 5 ! 8 3 9 6 1 Package Input (SOR) Package is I PRSOR read from