USGS - science for a changing world

Water Resources of the United States

[Table of Contents] [Previous Section] [Next Section]

A Data Input Program (MFI) for the U.S. Geological Survey Modular Finite-Difference Ground-Water Flow Model
U.S. Geological Survey Water-Resources Investigations Report 94-468

Entering Two-Dimensional Arrays

There are three methods that can be used to define two-dimensional arrays. These correspond to the three methods that MODFLOW and MODPATH use for defining arrays. The first method, referred to as the constant method, is to make the entire array a constant. The second, or package, method is to store individual array elements in the appropriate MODFLOW package file (or MODPATH file) along with other data. When the package method is used, MFI allows the values for individual array elements to be entered or modified by invoking a spreadsheet program. MFI writes the array-element values in the appropriate package file when exited. For an existing dataset, the initial values for a package array are read from the appropriate package file. The third, or separate, method is to specify that the values for individual array elements are in a separate file, meaning a file other than a package file. MFI does not actually read or write the contents of such files, but MFI will incorporate information about these files into the proper locations in the dataset so that MODFLOW and MODPATH will read them. The separate files must be prepared using other software.

All three methods of defining arrays are specified through one screen. Figure 3 shows an example array screen in which a constant array is being defined. In that example, the "CONSTANT" option is indicated by an "X." The other two options, "PACKAGE" and "SEPARATE," can be selected by moving the cursor to the desired option and pressing the space bar, as indicated by the Instruction Window. Figure 4 shows the PACKAGE option, and Figure 5 shows the SEPARATE option. Notice that for each option the other data fields change. For PACKAGE and SEPARATE arrays, a constant is specified that is multiplied times each element of the array to make the final value. Thus, the entire array can be rescaled simply by changing the multiplier.

Figure 3.--Array screen defining a CONSTANT array.

Figure 4.--Array screen defining a PACKAGE array.

Figure 5.--Array screen defining a SEPARATE array.

After an array is first designated as a PACKAGE array, MFI activates the spreadsheet program to allow the array elements to be entered. Once a PACKAGE array has been initially defined, its elements can be examined or modified using the spreadsheet program through the same array screen. However, prior to activating the spreadsheet program to edit an existing PACKAGE array, the user is asked if he or she wants to edit the array or leave the values of each element as they are. If the values are to be edited, then the spreadsheet is activated. The choice to leave the array unedited is offered because there may be no need to change these values. That is, the reason for editing the array may have been only for the purpose of changing the array multiplier.

For SEPARATE arrays, the information that will allow MODFLOW or MODPATH to read the array must be specified. This includes the file name, a format, and a code for which format to use when printing the array after it is read. Remember that MFI does not read SEPARATE arrays, so if there are errors, such as an incorrect format or an invalid file name, they will not be detected by MFI. Such errors will not be detected until MODFLOW or MODPATH is executed.

When a MODPATH array is in a separate file and if that file is first used interactively (rather than as part of an existing dataset), MFI asks if the file will contain only a single array or if the file will contain multiple arrays. If it contains only a single array, then it will be setup as an OPEN/CLOSE file (Pollock, 1994, Appendix A). If the file contains multiple arrays, then it will be setup as an EXTERNAL file (Pollock, 1994, Appendix A). MFI maintains information about each file used, which includes a file type. OPEN/CLOSE files are file type OPEN/CLOSE, and EXTERNAL files are file type DATA. The screen asking whether there will be a single array or multiple arrays in a file only appears when a file is added to the list of files, thus all previous uses of a file must be temporarily ended so the file gets removed from the list of files if there is a need to change a file's type. Then the file can be recreated with a new file type. For example, consider a separate file named por.dat that initially is expected to contain only a single porosity array for MODPATH. It might therefore be given file type OPEN/CLOSE. If the user later decides to incorporate two porosity arrays in por.dat, the file type needs to be changed to DATA. To do this, the prior use of the file must be eliminated. The easiest way to do this is to change the array that was previously read from por.dat to be a constant. Unused files are removed from the list of files only when the Main Menu is entered, so the next step must be to exit the MODPATH Menu. Then the MODPATH Menu can be reentered, and por.dat can be specified as a separate file that will contain multiple arrays.

[Table of Contents] [Previous Section] [Next Section]

MFI page
The URL for this page is
This page is maintained by <>
Last modified: 02 FEB 96
Generated with CERN WebMaker

USGS Home :: Biology :: Geology :: Geography :: Site Map

Accessibility FOIA Privacy Policies and Notices

Take Pride in America logo logo U.S. Department of the Interior | U.S. Geological Survey
Page Contact Information: Water Webserver Team
Page Last Modified: Monday, 12-Dec-2016 15:11:09 EST