GMS:Importing MODFLOW Files
GMS imports standard MODFLOW 88, 96, 2000, 2005, MODFLOW-NWT, MODFLOW-LGR, and MODFLOW-USG files. GMS supports saving of MODFLOW 2000, 2005, and MODFLOW-NWT so other versions will be converted to MODFLOW 2000, 2005, or NWT. MODFLOW 88 and 96 files will be automatically translated when imported, and will not use the MODFLOW Translator dialog.
If GMS created the MODFLOW simulation then open the corresponding GMS project file (*.gpr). If there is no GMS project file, import the MODFLOW simulation into GMS as described below. GMS will create a new copy of the imported MODFLOW simulation in its own modified MODFLOW file format. See MODFLOW with HDF5 for more information on the modified MODFLOW file format.
Native MODFLOW files (ascii/text) can be exported from GMS. See Exporting Native MODFLOW Files for more information on exporting MODFLOW files.
- 1 How to import a MODFLOW model into GMS
- 2 Determining the MODFLOW version
- 3 Changes in GMS 7.0
- 4 Unsupported Packages
- 5 Files Generated by Other Software
- 6 USGS MODFLOW Documentation
- 7 Notes
How to import a MODFLOW model into GMS
Follow these steps when importing a MODFLOW simulation into GMS.
- Were the MODFLOW files created by GMS?
- If the files were created by GMS, and the user has the GMS project file (.gpr), read that into GMS using the standard File | Open command. If the user doesn't have the *.gpr file, import the MODFLOW model into GMS by opening the "super file" (*.mfs) using the standard File | Open command. The super file is a non-standard file that GMS creates along with the standard MODFLOW files. If the user doesn't have a super file, proceed to step 2 below.
- Proceed to step 2 below.
- Don't know
- If the user has a *.gpr file or a *.mfs file, then it's almost certain that the files were created by GMS. If the user doesn't have these files, proceed to step 2 below.
- Determine whether the model is MODFLOW 88, 96 or 2000. If unsure, refer to the section below entitled Determining the MODFLOW version which describes each one.
- MODFLOW 88
- Read the basic package file into GMS (using the standard File | Open dialog). GMS will attempt to import all the other files.
- MODFLOW 96
- Read the name file.
- MODFLOW 2000
- Read the name file.
- MODFLOW 2005
- Read the name file.
- Read the name file.
- Read the *.lgr file.
- MODFLOW 88
- Read the name file. Note: For GMS to import the native MODFLOW-USG files a *.gsf file (Grid Specification File) or a *.vtu file (VTK unstructured grid file) must exist to define the grid used with the MODFLOW simulation because the native MODFLOW-USG files do not include locations of the grid nodes, unfortunately.
MODFLOW Translator dialog
When importing a MODFLOW file into GMS, the MODFLOW Translator dialog may appear. If the MODFLOW file was not created in GMS 6.5 or later, the file must be translated into a format fully compatible with all of GMS' features and tools. GMS copies the file before performing the translation, so the original file is not changed by this translation process.
Select from the list of MODFLOW version so the translator knows how to interpret the file. The versions currently supported within the dialog are:
- MODFLOW 2000
- MODFLOW 2005
If having trouble reading the files into GMS, first verify that MODFLOW can read the files by launching MODFLOW at a command prompt and giving it the name of the file to read. If MODFLOW can read the files but GMS cannot, it may be because the package is not support by GMS; see MODFLOW Packages Supported in GMS for more information.
Contact tech support for additional help.
Determining the MODFLOW version
To tell if a file is MODFLOW 88 open up the basic package file as a text file. GMS uses *.bas as the extension for this file. The file should appear something like the figure below.
Heading 1 Heading 2 3 23 17 1 4 11 13 14 15 0 0 16 0 0 0 0 10 12 0 0 0 0 0 0 0 0 29 0 0 0 0 1 1 (17I3) 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
For a MODFLOW 88 file the third line of the basic package file will include an IUNIT array with 24 slots. There may also be an IUNIT array with only 12 slots, if so just ok the warning GMS gives. These slots include the unit numbers for packages included in the file. Every number must be unique to its package. If the number does not correspond to a file then the file is an external array which must be matched by the user. If the basic package file includes an IUNIT array as described it is a MODFLOW 88 file.
To import the MODFLOW 88 file locate the *.mfs file. If there is no *.mfs file then select the *.bas file. Then simply use the File | Open command to read the file into GMS.
More about MODFLOW 88 files
MODFLOW 88 files have no name (*.nam or *.mfn) file.
GMS makes a few assumptions when reading in MODFLOW 88 files:
- All files must have the same prefix.
- Example: If the files are named bas.dat, drain.dat, and river.dat they all must be converted to run1.bas, run1.drn, and run1.riv
- All files use the standard GMS suffixes as shown in the table below.
- If these are not the suffixes in use, the user will need to rename the files.
- IUNIT slots must be standard with standard ID #'s according to MODFLOW documentation.
- It is up to the user to know what external arrays go to which MODFLOW files. Otherwise the files will not be properly read in.
- GMS can import external arrays but is unable to import external binary arrays
- MODFLOW 88 files use a fixed format.
|GENERAL HEAD BOUNDARY||*.ghb|
|STRONGLY IMPLICIT PROCEDURE||*.sip|
To tell if model files are in MODFLOW 96 format, open up the basic package file as a text file. For a MODFLOW 96 file the third line of the *.bas file will NOT include an IUNIT array. Instead the third line will say FREE, which means that the data in the file is in free format and each data entry is separated with a space. A 96 file may not contain the FREE line. Instead the line may be blank and the file may be fixed format. This file can be read in just the same using the name file.
Heading 1 Heading 2 3 23 17 1 4 FREE 0 0 INTERNAL 1 (free) 0 "Ibound Layer 1" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
If the basic package file says FREE as described it is a MODFLOW 96 file. A name file (typically with a *.mfn or *.nam extension) should also exist. If one does not it must be created as described below.
To open a MODFLOW 96 file locate the name file and use the File | Open command to read the file into GMS.
More about MODFLOW 96 files
MODFLOW 96 files use a name file to identify the packages files. This replaces the IUNIT array used in MODFLOW 88. The advantage of it is that the files do not need to all have the same prefix in their name. The name file is laid out as shown below. In the first column the card name is given (see MODFLOW documentation for more information). In the second colum the IUNIT number is given. This number must be unique from all other numbers. The third column gives the file name and as stated does not need to have the same prefix for every package.
Sample *.mfn file:
LIST 26 "run1.out" BAS 1 "run1.bas" BCF 11 "run1.bcf" OC 10 "run1.oc" DATA(BINARY) 30 "run1.hed" DATA(BINARY) 40 "run140.ccf" PCG 12 "run1.pcg" RIV 15 "run1.riv" WEL 13 "run1.wel" RCH 20 "run1.rch" MT3D 29 "run1.hff"
Like the MODFLOW 96 files, MODFLOW 2000, 2005 and MODFLOW-NWT use name files rather than an IUNIT array. To know if a file is a MODFLOW 2000, 2005, or MODFLOW-NWT file look for a discretization file (*.dis). If a *.dis file exists then it is a 2000, 2005 or NWT model (though it may not specify), so the File | Open command is used and the name file (*.nam or *.mfn) is selected and read into GMS.
Sample *.mfn file:
# MF2K NAME file # # Output Files GLOBAL 1 "easttex.glo" LIST 2 "easttex.out" DATA(BINARY) 30 "easttex.hed" DATA(BINARY) 40 "easttex.ccf" LMT6 18 "easttex.lmt" # # Obs-Sen-Pes Process Input Files OBS 50 "easttex.obs" DROB 54 "easttex.drob" CHOB 55 "easttex.chob" ASP 71 "easttex.asp" # # Global Input Files DIS 19 "easttex.dis" # # Flow Process Input Files BAS6 3 "easttex.ba6" LPF 4 "easttex.lpf" OC 15 "easttex.oc" RCH 16 "easttex.rch" WEL 9 "easttex.wel" DRN 10 "easttex.drn" CHD 13 "easttex.chd" PCG 14 "easttex.pcg"
Changes in GMS 7.0
When GMS 7.0 or later reads a MODFLOW simulation it checks if the simulation files are in the modified GMS format. MODFLOW files created by GMS 6.5 or a later use this format. If the simulation is not in the GMS format then GMS converts it into this format.
In versions of GMS prior to 7.0, GMS would read the MODFLOW files and do the conversion. Starting with version 7.0, GMS uses a modified version of MODFLOW to read the input files and do the conversion. GMS then reads the converted files. By using MODFLOW to read MODFLOW files and do the conversion, GMS can read whatever MODFLOW can read. Conversely, if GMS cannot read it, MODFLOW probably can't either.
Depending on the version of the model, GMS will perform all or some of the following steps to convert the model into the standard GMS format.
- Convert MODFLOW 88 to MODFLOW 96. If importing a MODFLOW 88 model, GMS creates a MODFLOW 96 Name file by examining the Basic package file or the GMS super file. The name file is put in the same directory where the Basic package file or super file is found. In creating the MODFLOW 96 name file, GMS assumes the unit numbers in the IUNIT array in the Basic package file are ordered according to the standard MODFLOW 88 order (as found in the MODFLOW 88 source code). GMS uses the lowest unit number not used in the IUNIT array for the List file added to the name file. If external arrays are being used, the unit number GMS uses for the List file may be the same as one used for an external array.
- Convert MODFLOW 96 to MODFLOW 2000. After creating the MODFLOW 96 Name file, GMS calls mf96to2k.exe, a USGS program distributed with MODFLOW 2000 which converts MODFLOW 96 models to MODFLOW 2000. This creates some new files in the same directory as the basic package file: name_MF2k.bas, name_MF2K.bcf, and name_MF2K.nam (where "name" is the name of the MODFLOW 96 name file).
- Translate MODFLOW 2000 to GMS H5 Format. GMS then calls the MODFLOW Translator to translate the simulation into GMS H5 format. This creates an H5 file in the temp directory. The user must save the GMS project in order to have a GMS H5 formatted MODFLOW simulation on disk, otherwise the temp file will be discarded.
Some modifications were made to mf96to2k.exe with regards to layer elevations and confining beds so that the program could be run in a non-interactive batch mode.
When mf96to2k.exe converts a MODFLOW 88/96 simulation to a MODFLOW 2000 simulation the program creates a discretization file (DIS). This file defines the layer elevations for the model grid as well as the stress periods. In MODFLOW 88/96 a model could be defined without the need for explicitly defining the top and bottom elevations of the model grid. If the old model has grid elevations defined in the BCF file then those elevations are preserved in the new MODFLOW 2000 DIS file. Where elevations are not defined in the old model then mf96to2k.exe would prompt the user to enter a constant elevation for the particular layer. When mf96to2k.exe is run by GMS these layer values are automatically set. After the model is read into GMS the user may need to edit these values.
Layer Confining Beds (LAYCBD)
When mf96to2k.exe converts a MODFLOW 88/96 model it also asks the user if a layer confining bed exists beneath each of the grid layers. When mf96to2k.exe is run by GMS no confining beds will be defined beneath the model layer. If the user wishes to include confining beds these can be edited in the Global/Basic dialog under the MODFLOW menu.
When a simulation with unsupported package files is imported into GMS the associated package file is copied from the old simulation folder to the new project simulation folder. Once imported into GMS unsupported package files can be edited or removed using the Name File dialog. If there are associated package files that contain package data using the EXTERNAL or OPEN/CLOSE keywords, they will need to be manually copied to the project's MODFLOW folder once the project is saved.
Files Generated by Other Software
Other software such as Groundwater Vistas, Visual MODFLOW, and PM Win use their own file formats. However they do write out native MODFLOW files which GMS can read in. To use them make sure that the other software is saving out the files properly and then follow the steps above for the proper version of MODFLOW files.
To export MODFLOW files from Groundwater Vistas:
- Open the simulation in Groundwater Vistas
- Select File | Open
- Navigate to and select the “*.gwv” file, then select “Open”
- Export the native MODFLOW files from Groundwater Vistas
- Select Model | MODFLOW (or MODFLOW 2000) | Create Datasets
- Import the name file into GMS
- Select File | Open, the Open macro, or just drag and drop the *.nam file in the GMS main screen.
- Select Models | MODFLOW | Run
- Prior to MODFLOW running the model inputs will be generated.
Visual MODFLOW files can not be read into GMS. To use Visual MODFLOW files, the user will need to run MODFLOW from within Visual MODFLOW, and then modify the *.mfi file. See below for details.
- Run MODFLOW from Visual MODFLOW
- Open the Visual MODFLOW project (vmf file if using the latest version of Visual MODFLOW) in Visual MODFLOW
- Select Run in the top menu
- Select Run again from the top menu
- Select MODFLOW 2000 in the Engines to Run dialog, then select Translate & Run
- Select the Close button in the VMEngine window when the model is finished running
- Modify and rename the “*.mfi” file
- Go to the directory where the simulation is saved on the computer
- Create a copy of the “*.mfi” file. Change the extension of the copy to “*.mfn”
- Open the *.mfn file in a text editor
- Comment out packages that are not supported by the USGS release of MODFLOW (for example, the “WHS” and “NDC” lines)^
- If necessary, modify the directory that each MODFLOW file is referencing. This is necessary if the Visual MODFLOW files were not created on the computer being used
- Save the *.mfn file
- Open the *.mfn file in GMS
- Select File | Open, the Open macro, or just drag and drop the *.mfn file in the GMS main screen
- The MODFLOW Translator will most likely appear. Select OK after selecting the appropriate version of MODFLOW
- Select “Done” when the MODFLOW Translator is finished
- A dialog will appear saying that a supported solver was not found in the name file and that the PCG solver has been added. This is because the solver that Visual MODFLOW uses is not compatible with the USGS version of MODFLOW, and so GMS does not use it either. Select OK
- ^Note: to comment out a package, place a pound/number sign in front of a line. See the Online Guide to MODFLOW for packages that the USGS version of MODFLOW supports.
USGS MODFLOW Documentation
Here are some links to MODFLOW documentation that may be helpful.
|MODFLOW 88||MODFLOW 88 (I), MODFLOW 88 (II)|
|MODFLOW 96||MODFLOW 96 (I), MODFLOW 96 (II)|
|MODFLOW 2000||MF2K Flow, MF2K Obs-Sen-Pes, HUF, LMG, LMT, MF2K Calibration|
|MODFLOW 2005||MF2005 Flow Process|
|MODFLOW-NWT||MODFLOW-NWT, A Newton Formulation for MODFLOW-2005|
|MODFLOW-LGR||MODFLOW-LGR, MODFLOW-LGR Multiple Refined Areas, MODFLOW-LGR with SFR|
|MODFLOW-USG||MODFLOW-USG, MODFLOW-USG I/O, ZONBUDUSG|
GMS – Groundwater Modeling System
|Modules:||2D Grid • 2D Mesh • 2D Scatter Point • 3D Grid • 3D Mesh • 3D Scatter Point • Boreholes • GIS • Map • Solid • TINs • UGrids|
|Models:||FEFLOW • FEMWATER • MODAEM • MODFLOW • MODPATH • mod-PATH3DU • MT3DMS • MT3D-USGS • PEST • PHT3D • RT3D • SEAM3D • SEAWAT • SEEP2D • T-PROGS • ZONEBUDGET|