Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

A comparison of 2-D and 3-D pre- and post-

processing techniques in flow

modeling S.A. Sorby, A.S. Mayer, .G. Tallman, J.G. Johnson

Department of Civil and Environmental Engineering, Michigan Technological University, Houghton, Michigan, USA

Abstract

In the past, the use of 3-D groundwater models has been hindered by the lack of adequate pre- and post-processors for entering data and interpreting results. In order to overcome these difficulties, an interface between I-DEAS solid modeling software and MODFLOW has been developed. The pre-processing capabilities of the software interface allow the user to build a geologic model from field data, discretize the model into a finite-differencegri d and define boundary conditions and material properties on the grid. Simulation is accomplished by the execution of MODFLOW within the framework. The results of the simulation can then be visualized with 3-D color images. This paper describes the development and application of the software interface with full 3-D capabilities. The software interface is demonstrated with an example problem. The same problem is analyzed by "traditional" 2-D methods using popular 2-D pre- and post-processors. A comparison is made between these two types of analysis.

1 Introduction Groundwater modeling is an increasingly important area in environmental engineering, in response to the deterioration of groundwater quality. For most problems encountered in groundwater modeling, numerical methods have become widely recognized and accepted means of solution. One of the disadvantages of groundwater modeling methods is the vast amount of data required to solve and interpret problems. One of the most widely accepted

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

226 Computer Techniques in Environmental Studies

finite-difference codes for groundwater modeling is MODFLOW (McDonald and Harbaugh, 1988), which was developed by the USGS. While this model is a powerful analysis tool, use of this and other public domain codes is limited by a lack of an adequate, graphical pre- and post-processor. This deficiency makes the groundwater modeling task cumbersome, and results are often difficult to interpret. The lack of an adequate pre- and post-processor for three-dimensional groundwater flow analysis has serious implications, because several simulations often are required for an effective characterization of a groundwater flow problem. Multiple simulations are needed because it is often the case that the input data is uncertain and/or incomplete. Thus, there is often a need to perform a series of simulations to test the sensitivity of the results as a function of the possible range of data values. An additional limiting factor is the ability to visualize the output results, that is, the patterns of groundwater flow as functions of space and time. A typical model simulation results in the output of hundreds to tens of thousands of numerical values. The objective of this project, is to develop a software interface between a groundwater modeling code (MODFLOW) and a fully interactive, graphical pre- and post-processor in order to enhance the groundwater modeling visualization capabilities and increase the productivity of current groundwater modeling efforts.

The most widely-used groundwater flow model in the U.S. is MODFLOW (McDonald and Harbaugh, 1988). The MODFLOW model is based on a three- dimensional, finite difference solution to the groundwater flow equation. The model can be used to simulate flow in unconfined and confined and provides for flows associated with external stresses such as wells, areal recharge, evapotranspiration, drains and . The model source code is written in FORTRAN. The MODFLOW model was originally written in 1984, but has been updated as progress has been made in thefiel do f groundwater flow modeling. Application of the MODFLOW model involves the superposition of a finite difference grid over the groundwater of interest. The aquifer is thus subdivided into a series of rectangular or cubic cells, defined by nodes at the center of the cell or at each corner. The unknown of interest, i.e., groundwater pressure head, is solved for at each nodal location. For groundwater flow solutions, the following parameters must be defined at each node or cell: hydraulic conductivities for each coordinate dimension, aquifer thickness, aquifer storage coefficients and withdrawal or injection rates. In addition, boundary and initial conditions must be defined as needed. I-DEAS (Integrated Design Engineering Analysis Software) was developed

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

Computer Techniques in Environmental Studies 227 by the Structural Dynamics Research Corporation (SDRC, 1992) in the early

1980s as a geometric modeler and mesh generator forfinite-elemen tanalysis . The geometric database manager in I-DEAS enables a user to create a file translator for use with virtually any other external finite element or finite difference program. Datafile sfo r external solvers can be written from I-DEAS and converted to their required format for execution. If the source code is available, the external solver can also be modified to output a file which contains the results of the numerical analysis in standard I-DEAS format. In this way, the user can take full advantage of the meshing and post-processing capabilities of I-DEAS while still using the solver which is most suited to his or her needs.

2 Framework Development

In this project, a framework has been developed to link the MODFLOW code with I-DEAS software. The framework has been developed in the following steps. First, programs were written using the I-DEAS programming language for automation of I-DEAS pre-processing capabilities including the creation of a geologic model from raw site data, application of a three-dimensional finite- difference grid to this model and designation of all boundary and initial conditions, external stresses, and material properties. Second, additional programs were developed to write data from I-DEAS into the format needed for input to MODFLOW. These programs are written in the C programming language and they can be executed directly from within I-DEAS. Third, the source code for MODFLOW was modified so that the results of the groundwater analysis can be output to I-DEAS readable files in addition to the standard MODFLOW output files. Finally, a program was created to run within

I-DEAS to read in the results of the numerical analysis and automate some of the I-DEAS post-processing commands.

The pre-processor allows the user to graphically build a three-dimensional geologic model and designate relevant hydrogeologic properties. The pre- processor was constructed using I-DEAS programming language and is menu- and query-driven. The programs written in this manner are invisible to the user. I-DEAS programmingfile sar e written as a combination of I-DEAS menu picks, menu and input commands (where users are queried for input data) and statements which are similar to typical FORTRAN statements. A portion of an I-DEAS program file is shown in Figure 1.

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

228 Computer Techniques in Environmental Studies

K : #pmod: K : #menu "Parameter to Modify:" choice 0 4 , K : "A-AIl" "L-Stress Period Length" , K : "N-Number of Time Steps" "TSM-Time Step Multiplier" K : #if (Z_INP_STAT eq 0) then goto sp K : #if (ZJNP.STAT eq 1) then goto imod K : #if(Z_INP_STAT ne 3) then goto pmod K : #if (choice eq 1) then #modfl=l; #index=num; #goto len C : ** get a new value for the parameter K : #nv: K : #input "Enter new value:" newv K : #if (Z_INP_STAT eq 0) then goto imod K : #if (Z_INP_STAT eq 1) then goto pmod K : #if (Z_INP_STAT ne 3) then goto nv K : #if (choice eq 2) then #perlen=newv; #goto writ K : #if (choice eq 3) then #nstp=newv; #goto writ K : #tsmult=newv C:** write new data K : tfwrit: K : /MO LAB 1 K:DON K : XF perlcn K : YF nstp K : ZF tsmult

Figure 1: Example I-DEAS Program File

In this program file, lines beginning with C : are comments, and lines beginning with K : are command lines. Command lines which do not start with a # are strings of I-DEAS menu picks. Menu commands insert a menu on the screen which is identical to standard I-DEAS menus from which the user can graphically pick options. Input commands query users at the I-DEAS prompt line and assign a variable name to the user input. I-DEAS program files are written so that there is a main program and several sub-routines. The datafil e format required by the was analyzed and a file translator program was created to be run from within I-DEAS. The file translator draws upon the grid, material property, and other data generated from pre-processing and writes out the data files suitable for direct input to

MODFLOW. This activity is also invisible to the user. The user can then execute MODFLOW from within the framework, without exiting I-DEAS.

A link between the output of the groundwater modeling code and I-DEAS was developed. The link involves the addition of subroutines to the source code of the model such that a universal file is generated as a part of its output. Universalfile sar e ASCIIfile swhic h contain geometric information in a format which is acceptable to I-DEAS. In this way, the results of the groundwater modeling can be read directly into I-DEAS for post-processing. All of the post- processing capabilities are standard I-DEAS options and can be automated with the use of program files if desired.

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

Computer Techniques in Environmental Studies 229

3 Example Problem

In the following section, the MODFLOW/I-DEAS (Mil) framework is applied to an example problem. The example problem is also analyzed with a frequently-utilized two-dimensional (2-D) pre-processor and a 2-D post- processor, to provide a comparison with the M/I framework. The example problem is taken from the MODFLOW manual (McDonald and Harbaugh, 1988). This problem is composed of three layers, with each layer comprising a

75,000 ft. by 75,000 square divided into a 15-row by 15-column grid. Each grid block, or finite-differencecell , forms a square that is 5,000 ft. per side. The flow input is derived from recharge, while the flow outputs consist of drains, extraction wells, and a constant head boundary. The simulation was conducted at steady state. Further details can be found in McDonald and Harbaugh (1988).

The first step in the M/I framework is to construct the geologic model. The geologic model is constructed by entering coordinates corresponding to contacts between different geological materials. Well logs, which are the most likely source for these coordinates, are displayed when the horizontal and vertical coordinates are entered numerically. Figure 2 shows a set of hypothetical well logs corresponding to the example problem and Figure 3 shows the layers corresponding to the well log data. A finite difference grid is overlain onto the geological model. The grid is a subdivision of the problem domain into rows, columns, or layers, resulting in collection of grid blocks.

Figure 4 shows a 3-D view of the finite-differencegri d for the example problem. The dimensions of the grid blocks are set by numerical inputs; the grid can be further refined by graphical selection of additional rows, columns or layers. With the 2-D preprocessor, no provision is made for constructing a geologic model directly from well logs. Instead, the number of layers and their thicknesses must be predetermined and entered numerically in the preprocessor.

The finite-difference grid is constructed by entering the number of rows, number of columns, and the horizontal dimensions of the grid. Figure 5a and 5b shows two of the model layers created by the 2-D preprocessor. Each layer is displayed one at a time in an areal view only. The next step in pre-processing involves assigning the physical properties of the aquifer system. In both the M/I framework and the 2-D pre-processor, the properties may be defined cell-by-cell with numerical inputs or by graphically grouping blocks with identical material properties together and entering the group properties. Boundary and initial conditions are applied in a similar man- ner. External stresses, (e.g. pumped wells or drains) are entered by graphical

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

230 Computer Techniques in Environmental Studies

CS

SSa

cs i SSb

SSa CS CS SSb L SSa cs SSa SSa 1^ SSa SSb SSb

SSb CS

Key: SSa CS-clean sand sSa-silty sand a SSb sSb-silty sand b

Figure 2: Display of well logs in the M/I framework

Figure 3: Model layers constructed from well logs in the M/I framework

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

Computer Techniques in Environmental Studies 231

Figure 4: Finite difference grid devised in M/I framework.

Figure 5a: Finite-difference grid Figure 5b: Finite-difference grid for layer 1 in 2-D pre-processor. for layer 2 in 2-D pre-processor. Shaded squares indicate con- Shaded squares indicate well stant-head boundary conditions. locations.

selection of the stress location and numerical entry of the stress magnitude with both the M/I framework and the 2-D pre-processor. Figure 6 shows the locations of external stress as displayed by the M/I framework.

In the M/I framework, assignment of physical properties, boundary and ini- tial conditions, and external stresses is accomplished using graphical techniques

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

232 Computer Techniques in Environmental Studies

<0>Well

Drain Figure 6. Finite Difference Grid with Applied Boundary Conditions combined with pull-down menus and simple queries. Portions of the graphical display can be magnified or cut away so that small-scale definitions of the grid, material properties, stresses or any other modeling property can be made. Col- ors, gray-scales, or pattern variations are used to distinguish different properties by individual blocks or groups of blocks; symbols are used to designate items such as wells. With the 2-D pre-processor, only entire, individual layers can be displayed, one at a time. Numerical inputs of physical properties is accom- plished in a separate screen where the grid cannot be displayed.

The last task in pre-processing involves numerical entry of the parameters that control the execution of MODFLOW, such as designating a steady-state or transient simulation or designating various output options. When the pre-pro- cessing is completed, a data translation program is executed to create input data sets for MODFLOW. The program createsfile stha t follow the specific format required for input to MODFLOW. However, the M/I framework and 2-D pre- processor follow similar procedures for this task. The M/I framework allows for execution of MODFLOW from within the main menu of the framework, while

MODFLOW must executed outside of the 2-D pre-processor. A numerical outputfil econsistin g of groundwater heads (potentials) and drawdowns (potential losses) is produced by the execution of MODFLOW. This file is post-processed within the M/I framework so that results can be viewed as color-coded, three-dimensional images. These images can be cut away and magnified to view areas of interest. Figure 7 displays the distribution of ground- water heads near a pumped well. The images can be viewed as a shaded image, in which the results are smoothed into a continuum, or as a solid contour image, with each color or shade representing a range of groundwater heads. The user

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

Computer Techniques in Environmental Studies 233 also is able to show only those elements which have a groundwater head greater than or less than a specified value. The post-processing results from different simulation times can be stored and used in an animated sequence, if desired.

Figure 7. 3-D Post-Processing-Contours of Constant Head

A separate software package must be utilized to post-process and view the results if the 2-D pre-processor is utilized and the MODFLOW output must be manipulated in order to be accessed by most 2-D post-processing packages. A typical post-processor displays the heads as contour maps or surfaces that are functions of two dimensions. Individual two-dimensional images must be dis- played one at a time. Figure 8 shows the distribution of groundwater heads for each layer produced by a typical 2-D post-processing software package.

4 Conclusions

In this project, a framework was developed to link MODFLOW with I-DEAS, a graphical pre- and post-processor. The M/I pre-processor allows the user to graphically build the geologic model and grid from field data. Boundary and initial conditions can be input and the data exported to an external finite difference code for processing. Post-processing of the model output can then be achieved within the framework. Application of the M/I framework to an example problem is compared with an application of conventional 2-D pre- and post-processors. The application demonstrates the significant advantages of the

M/I framework: (1) a geologic model can be built from field data, (2) the material properties, external stresses, and boundary conditions can be assigned

Transactions on Ecology and the Environment vol 10, © 1996 WIT Press, www.witpress.com, ISSN 1743-3541

234 Computer Techniques in Environmental Studies

Figure 8: Contours of equal groundwater heads for (a) layer 1, (b) layer

2, (c) layer 3 as displayed by the 2-D post-processor. to the model grid while viewing the grid from any perspective and with portions of the gird cutaway, and (3) the model outputs can be displayed with multiple 3-

D views and a variety of coloring and contouring schemes.

5 Acknowledgment

This work has been supported by the Michigan Research Excellence Fund.

6 References

Structural Dynamics Research Corporation, "I-DEAS User's Guide," Structural Dynamics Research Corporation, Milford, Ohio, 1992

McDonald, M. G. and A. W. Harbaugh, "Techniques of Water-Resources Inves- tigations of the United States Geological Survey: Chapter Al, A Modular Three-Dimensional Finite-Difference Ground-Water Flow Model," U.S. Gov- ernment Printing Office, Washington, D.C., 1988.