0% found this document useful (0 votes)
21 views

MODFLOW SaveNativeText

Uploaded by

Husam Baalousha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

MODFLOW SaveNativeText

Uploaded by

Husam Baalousha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

GMS Tutorials MODFLOW – Saving Native Text

v. 10.7

GMS 10.7 Tutorial


MODFLOW – Saving Native Text
Save a MODFLOW Simulation in Native Text Format

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.

Prerequisite Tutorials Required Components Time


 MODFLOW ‒ Grid  GMS Core  25–40 minutes
Approach  MODFLOW Interface
 Text Editor Software

Page 1 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

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.1 Getting Started

Do the following to get started:


1. If necessary, launch GMS.

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.

Page 2 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

2. If GMS is already running, select File | New to ensure that the program settings
are restored to their default state.

2 Importing the Simulation

Start by importing a MODFLOW simulation. This simulation is one of the example files
that ships with the USGS MODFLOW source code.

1. Click Open to bring up the Open dialog.


2. Select “MODFLOW Name Files (*.mfn;*.nam)” from the Files of type drop-
down.
3. Browse to the text\text\mnw1 directory and select “mnw1.nam”.

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).

6. Click OK to initiate the translator. The MODFLOW Translator dialog will


disappear briefly, then reappear to show the progress of the translation.

7. When the file conversion is complete, click Done to close the MODFLOW
Translator dialog.
A MODFLOW model similar to Figure 1 should appear.

Figure 1 Imported MODFLOW model

Page 3 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

2.1 Saving the Project

Now it is possible to save the project as if MODFLOW were going to be run.

1. Select File | Save As… to bring up the Save As dialog.


2. Browse to the text\text directory.
3. Select “Project Files (*.gpr)” from the Save as type drop-down.
4. Enter “mnw1.gpr” as the File name.

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.

2.2 Viewing MODFLOW Files

To quickly view the MODFLOW input files, do the following:

1. Right-click on the “ MODFLOW” item in the Project Explorer and select


Open Containing Folder… to bring up a new window in Windows Explorer.
A file browser showing the directory where the MODFLOW files are stored will appear.
Files similar to those in Figure 2 should be present.

Figure 2 MODFLOW input files saved from GMS

Page 4 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

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).

Figure 3 MODFLOW BCF package file saved from GMS

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.

Figure 4 HDFView of “mnw1.h5”

3
See http://www.hdfgroup.org/products/java/hdf-java-html/hdfview/.

Page 5 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

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.

3. Right-click on the “ MODFLOW” item in the Project Explorer and select


Open Containing Folder… to bring up a new window in Windows Explorer.
4. Browse to the text\text\mnw1 directory.
This is the directory containing the original MODFLOW files. Files similar to those in
Figure 5 should be present.

Figure 5 Original MODFLOW input files

5. Open “mnw1.bcf” in a text editor (Figure 6).

Figure 6 MODFLOW BCF file

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.

Page 6 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

2.3 Exporting Native Text from GMS

Now to export the simulation in MODFLOW native text format:


1. Close the text editor and Windows Explorer windows and return to GMS.

2. Select MODFLOW | Global Options… to bring up the MODFLOW


Global/Basic Package dialog.
3. In the MODFLOW version section, turn on Save native text copy.

4. Click OK to exit the MODFLOW Global/Basic Package dialog.

5. Select File | Save to save the project.


By turning on the Save native text copy option, an additional set of MODFLOW input
files are saved in the native text format.

2.4 Viewing the Native Text Files

The next step is to go look at the BCF package file in the native text files that were just
saved.

1. Right-click on the “ MODFLOW” item in the Project Explorer and select


Open Containing Folder… to bring up a new window in Windows Explorer.
2. Browse to the text\text\mnw1_MODFLOW_text directory to bring up the
MODFLOW native text files (Figure 7).

Figure 7 Native text MODFLOW files saved From GMS

3. Using a text editor, open the “mnw1.bc6” file (Figure 8).

Page 7 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

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.

Figure 9 Online Guide to MODFLOW

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

Page 8 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

3 Importing the Simulation with Parameters

Now it is necessary to import another MODFLOW simulation that has parameters.

1. Select File | New to clear the current project and start a new one.

2. Click Open to bring up the Open dialog.


3. Select “MODFLOW Name Files (*.mfn;*.nam)” from the Files of type drop-
down.
4. Browse to the text\text\etsdrt directory and select “etsdrt.nam”.

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.

Figure 10 MODFLOW model of the etsdrt simulation

8. Select MODFLOW | Parameters… to bring up the Parameters dialog.


Four parameters imported as part of the simulation will be visible (Figure 11).

Page 9 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

Figure 11 MODFLOW parameters

9. Click OK to exit the Parameters dialog.


When exporting the native text files, the parameters will be included in the text files as
well.

3.1 Exporting Native Text from GMS

To save this simulation in native text format, do the following:

1. Select MODFLOW | Global Options… to bring up the MODFLOW


Global/Basic Package dialog.
2. In the MODFLOW version section, turn on Save native text copy.

3. Click OK to exit the MODFLOW Global/Basic Package dialog.

4. Select File | Save As… to bring up the Save As dialog.


5. Select “Project Files (*.gpr)” from the Save as type drop-down.
6. Browse to the text\text directory.
7. Enter “etsdrt.gpr” as the File name.

8. Click Save to export the files and close the Save As dialog.

3.2 Viewing the Native Text

Now to view the text files to see how the parameters were included in the files:

1. Right-click on the “ MODFLOW” item in the Project Explorer and select


Open Containing Folder… to bring up a new window in Windows Explorer.

Page 10 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

2. Browse to the text\text\etsdrt_MODFLOW_text directory.


The files shown in Figure 12 should be present.

Figure 12 MODFLOW native text 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).

Figure 13 ETS package file

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.

Page 11 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

Figure 14 DRT package file

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.

4 Importing the Simulation with Pilot Points

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.

2. Click Open to bring up the Open dialog.


3. Select “Project Files (*.gpr)” from the Files of type drop-down.
4. Browse to the text\text\pilot directory and select “pilot.gpr”.

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.

Page 12 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

Figure 15 MODFLOW model with pilot points

4.1 Exporting Native Text from GMS

To save this simulation in native text format, do the following:

1. Select MODFLOW | Global Options… to bring up the MODFLOW


Global/Basic Package dialog.
Notice that the Save native text copy option is not available in the MODFLOW version
section. This option will only work when Forward is selected in the Run options section.
Typically, a model calibration would be completed, then a final forward run model
would be completed with the calibrated parameter values. The native text would then be
exported. With the stochastic option, a switch back to a forward run is necessary in order
to save the native text.
2. In the Run options section, select Forward.
3. In the MODFLOW version section, turn on Save native text copy.

4. Click OK to exit the MODFLOW Global/Basic Package dialog.

5. Select File | Save As… to bring up the Save As dialog.


6. Select “Project Files (*.gpr)” from the Save as type drop-down.

Page 13 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

7. Browse to the text\text directory.


8. Enter “pilot.gpr” as the File name.

9. Click Save to export the files and close the Save As dialog.

4.2 Viewing the Native Text

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.

2. Right-click on “ MODFLOW” and select Open Containing Folder… to


bring up a Windows Explorer window.
3. Browse to the text/text/pilot_MODFLOW_text directory.
The files shown in Figure 16 should be present.

Figure 16 MODFLOW native text files

Now to review some of the files that are related to the pilot points, beginning with the
LPF package:

Page 14 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

4. Using a text editor, open the “pilot.lpf” file (Figure 17).

Figure 17 LPF package file

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.

Page 15 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

Figure 18 MLT package file

4.3 Exporting Native Text from GMS with External Arrays

The next step is to save this simulation in native text format again with external arrays.

1. In GMS, select Edit | Preferences… to bring up the Preferences dialog.


2. Select “MODFLOW” from the list on the left and turn on Save copy of
MODFLOW simulation in native text format.
3. Select “Write external arrays to ‘arrays’ folder” from the drop-down and click
OK to exit the Preferences dialog.

4. Select File | Save to export the files.


Return to the Windows Explorer window where the native text files are shown. A new
directory called “arrays” should have been created. First, look at the MLT file again and
then it will possible to examine the arrays that were created in the “arrays” folder.
5. Using a text editor, open the “pilot.mlt” file.
Instead of seeing large amounts of floating point numbers in this file, there are simply
references to external files (Figure 19). This is accomplished through the
“OPEN/CLOSE” statement on each row in the file. Notice the format of the names of the
array files. External arrays are placed in their own text files and are named using the
following pattern: “myProject_array_PACKAGE_VARIABLE_LAYERorSP”.
In this example, the first pilot point multiplier array is named
“pilot_array_MLT_pp1_1.txt”. So “pilot” is the project name. “MLT” is the package.
And “pp1” is the variable (or parameter). Lastly, “1” refers to the pilot point index. Here
are two more examples:

 The ibound array for layer 1 would have the following name:
“myProject_array_BAS_IBOUND_1.txt”.

Page 16 of 17 © Aquaveo 2022


GMS Tutorials MODFLOW – Saving Native Text

 The recharge array for stress period 3 would have the following name:
“myProject_array_RCH_RECH_3.txt”.

Figure 19 MLT package file with external arrays

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:

1. Select Edit | Preferences… to bring up the Preference dialog.


2. Select “MODFLOW” from the list on the left.
3. Turn off Save copy of MODFLOW simulation in native text format.

4. Click OK to exit the Preference dialog.

5 Conclusion

This concludes the “MODFLOW – Saving Native Text” tutorial. The following topics
were discussed and demonstrated:

 HDF5 is a binary, cross-platform file format.

 GMS stores most of the MODFLOW data in an HDF5 file.

 GMS can export native text format MODFLOW files.

 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.

Page 17 of 17 © Aquaveo 2022

You might also like