MODFLOW SaveNativeText
MODFLOW SaveNativeText
v. 10.7
Objectives
This tutorial explains how to save MODFLOW simulations in MODFLOW's native text format. GMS
provides functionality that saves native text files which include MODFLOW documentation. These files
are easy to read and clarify the contents of the file.
1 Introduction ......................................................................................................................... 2
1.1 Getting Started ............................................................................................................. 2
2 Importing the Simulation ................................................................................................... 3
2.1 Saving the Project ........................................................................................................ 4
2.2 Viewing MODFLOW Files .......................................................................................... 4
2.3 Exporting Native Text from GMS ................................................................................ 7
2.4 Viewing the Native Text Files ...................................................................................... 7
3 Importing the Simulation with Parameters ...................................................................... 9
3.1 Exporting Native Text from GMS .............................................................................. 10
3.2 Viewing the Native Text ............................................................................................ 10
4 Importing the Simulation with Pilot Points .................................................................... 12
4.1 Exporting Native Text from GMS .............................................................................. 13
4.2 Viewing the Native Text ............................................................................................ 14
4.3 Exporting Native Text from GMS with External Arrays ............................................ 16
5 Conclusion.......................................................................................................................... 17
1 Introduction
GMS uses a modified version of MODFLOW that can read data from HDF51 files. Large
portions of the MODFLOW inputs are stored in an HDF5 file when creating a
MODFLOW model in GMS. Large MODFLOW models are stored more efficiently
using HDF5. Compression ratios of 95% are common when compared to text files. The
read/write times for HDF5 files are also much faster.
Even though using HDF5 files with MODFLOW is extremely efficient, many users
prefer to also save MODFLOW simulations in the native MODFLOW format. This is
particularly true when archiving a completed modeling project.
Native MODFLOW text files can be saved from GMS. Since GMS version 10.0, these
text files contain documentation comments that more clearly identify the contents of
each line in the MODFLOW input file. Parameter definitions are also included in the text
files.2 This tutorial discusses and demonstrates the native text exporting options available
in GMS using various MODFLOW simulations (including one with parameters and one
with pilot points), as well as changing the array saving options before saving the
simulation in native text format.
1
See www. hdfgroup.org. HDF5 is a binary, cross-platform file format for storing data
2
Earlier versions of GMS also exported native text files, but these files only removed references to
the HDF5 file. No documenting comments and parameters were written to the text files.
2. If GMS is already running, select File | New to ensure that the program settings
are restored to their default state.
Start by importing a MODFLOW simulation. This simulation is one of the example files
that ships with the USGS MODFLOW source code.
4. Click Open to close the Open dialog and bring up the MODFLOW Translator
dialog.
This dialog appears when importing MODFLOW native text files. When OK is clicked,
MODFLOW will run and export a new set of files, including an HDF5 file. GMS will
work with these files, preserving the original native text model files. The MODFLOW
translator allows valid MODFLOW simulations to be imported into GMS.
5. Select MODFLOW 2000 (the default option).
7. When the file conversion is complete, click Done to close the MODFLOW
Translator dialog.
A MODFLOW model similar to Figure 1 should appear.
5. Click Save to save the project and close the Save As dialog.
When a project is saved in GMS, a GPR file is created. The GPR file contains GMS
specific data. If a MODFLOW simulation is in the current project, then a folder is
created that has all of the MODFLOW inputs. The new folder name will use the name of
the current project name with “_MODFLOW” added to the end. In this project, a new
folder called “mnw1_MODFLOW” was created.
All of the files in this directory are text files except for the “mnw1.h5” file. The next step
is to examine the contents of the files.
2. Using a text editor, open the “mnw1.bc6” file.
This is the BCF package file. This file contains information on the hydraulic properties
of the grid cells (Figure 3). Notice the lines that begin with “HDF5”. When MODFLOW
reads these lines, it will get data from the “mnw1.h5” file. The lines are arrays that
define the aquifer properties (storage, hydraulic conductivity, and transmissivity).
There are many free viewers available to browse the contents of HDF5 files. Figure 4
shows “mnw1.h5” as seen in HDFView3, an application provided by the developers of
HDF5 which allows viewing and editing of HDF5 files.
3
See http://www.hdfgroup.org/products/java/hdf-java-html/hdfview/.
Now to look at the original MODFLOW files. The original BCF file contains similar
information as in the BC6 file. However, the information is in a different format.
When the two files are compared, notice that the numbers on lines 1 and 2 of the file are
the same. However, in the original files, some text is on the right side of the file.
MODFLOW will ignore this text because it is only expecting to read numbers on those
lines. Also notice that instead of referencing an HDF5 file for the aquifer properties, the
values for these arrays are listed in this file.
The next step is to go look at the BCF package file in the native text files that were just
saved.
Figure 8 MODFLOW BCF file saved in native text format From GMS
Notice that this file is very similar to the original MODFLOW text file. There are some
minor differences such as the format of the numbers. Look at the comments on the right
side of the file. These all begin with the “#” symbol. The number on this line indicates
the MODFLOW input dataset number for the BCF file.
After the number, notice the documented variable name that is read from this line. These
dataset numbers and variable names come straight from the MODFLOW documentation
so they will be those mentioned in the Online Guide to MODFLOW BCF documentation
(Figure 9).4 Notice the dataset numbers and the variable names. These are the items
written in the comments on the right side of the BCF file shown above.
Feel free to view some of the other MODFLOW input files at this point. When finished,
close the text editors and file browser and return to GMS.
4
See http://water.usgs.gov/nrp/gwsoftware/modflow2000/MFDOC/index.html?bcf.htm
1. Select File | New to clear the current project and start a new one.
5. Click Open to close the Open dialog and bring up the MODFLOW Translator
dialog.
6. Select MODFLOW 2005 as the version to use and click OK to initiate the
translator.
7. Once the translator is finished, click Done to close the MODFLOW Translator
dialog.
A MODFLOW model similar to Figure 10 should be visible.
8. Click Save to export the files and close the Save As dialog.
Now to view the text files to see how the parameters were included in the files:
Now to look at some of the files that have parameters defined. The ETS, DRT, RCH, and
LPF packages all have parameters defined. First look at the ETS package.
3. Using a text editor, open the “etsdrt.ets” file (Figure 13).
Notice that the parameter “ETS-MAX” has been included in the file (see lines 3 and 7).
Now to look at the DRT file.
4. Using a text editor, open the “etsdrt.drt” file.
The file should look like the Figure 14.
Notice lines 2, 3b, and 6. These lines define the parameter and its usage in the
simulation. Also notice that the total width of the text in this file is much greater than the
text in other files previously examined. The documentation comments are all aligned on
the right side of the file and a small buffer is placed between the comments and the
MODFLOW inputs. This makes reading the documentation easier than with non-aligned
comments.
Now to read in a MODFLOW simulation that uses pilot points5 with an array parameter:
1. Select File | New to clear the current project and start a new one.
5. Click Open to import the file and close the Open dialog.
A model similar to Figure 15 should appear.
5
Pilot points are used with PEST as part of automated model calibration. To learn more about
pilot points, complete the” MODFLOW – PEST Pilot Points” tutorial.
9. Click Save to export the files and close the Save As dialog.
Now view the text files and see how the parameters were included in the files.
1. Expand the “ 3D Grid Data” folder and the “ grid” item in the Project
Explorer.
Now to review some of the files that are related to the pilot points, beginning with the
LPF package:
Notice that all the lines in the file have the 8 and 9 line numbers. These lines define the
pilot point parameters. The pilot point parameters are named pp#_#, where the first # is
the index of the pilot point set (it is possible to have multiple sets of pilot point
parameters) and the second # is an index for the point number.
The next file to review is the multiplier file. This is where the multiplier arrays related to
each pilot point are written.
5. Using a text editor, open the “pilot.mlt” file (Figure 18).
A multiplier array is created for each pilot point. When MODFLOW runs, the value at
each point is multiplied by its multiplier array, resulting in one array for each pilot point.
All of these arrays are then combined (added together) to create the final value at each
cell. Looking at text files with array data can be difficult since the arrays contain such
large amounts of data.
GMS has exporting options to allow arrays to be external from the MODFLOW package
files. One of these options is demonstrated here.
The next step is to save this simulation in native text format again with external arrays.
The ibound array for layer 1 would have the following name:
“myProject_array_BAS_IBOUND_1.txt”.
The recharge array for stress period 3 would have the following name:
“myProject_array_RCH_RECH_3.txt”.
6. Return to Windows Explorer and open the arrays directory. Notice all of the
external arrays created when the native text files were saved.
To export the arrays, it was necessary to turn on a preference that will remain turned on
in any new GMS project unless it is reset. To reset this preference setting:
5 Conclusion
This concludes the “MODFLOW – Saving Native Text” tutorial. The following topics
were discussed and demonstrated:
Native text format MODFLOW files from GMS also include useful
documentation comments.
It is possible to export native text format MODFLOW files from GMS with
external arrays.