MODFLOW-HDF5 File I/O Utilities

Norm Jones - BYU Environmental Modeling Research Laboratory
Alan Lemon - Aquaveo, LLC
Mike Kennard - Aquaveo, LLC

Introduction

When dealing with regional groundwater models, it is becoming increasingly common for the MODFLOW input files to require substantial disk storage, in some cases multiple gigabytes may be needed for a single model run. This is partially due to increasing sophistication of GIS and pre-processing tools for managing spatial and temporal data. If automated parameter estimation, sensitivity analyses, or Monte Carlo simulations are applied to the model, disk storage requirements can become prohibitive. To address this problem, we have developed a new file format and a set of tools that make it possible to store MODFLOW input files using a small fraction of the disk storage normally required. The tools are integrated with the MODFLOW code and allow for rapid conversion between the new and original formats.

HDF5 Format

The new format is based on the HDF5 library. HDF5 is a general-purpose library and file format for storing scientific data originally developed by NCSA at the University of Illinois and now managed by the HDF Group. It consists of a low-level API for storing and retrieving data objects to a binary database.  It is cross-platform compatible and supports multiple types and levels of automatic data compression. The native MODFLOW file format allows for most of the input to be stored in text files. Array data (hydraulic conductivity, recharge, etc.) can be stored in either text or binary files. Our strategy involves incorporating a compressed binary format for both array- and list-based data. List-based data include stress packages such as the Well and River packages where the input files contain long lists and each row contains a cell index and a set of associated properties such as conductance or stage. For both array- and list-based data, all of the data stored in the HDF5 format are aggregated into a single binary file.  The original MODFLOW text files are still used, but in the locations containing the array- and list-based data, we substitute a link to the location in the HDF5 file where the data are stored. We have modified the MODFLOW code to include subroutines for reading both types of data.

MODFLOW Executable

In order to provide a simple path for converting MODFLOW files between the standard format and the HDF5 format described above, we have modified the MODFLOW code to include a set of conversion utilities. By launching MODFLOW with an extra command line argument, one can use our modified MODFLOW code to convert a set of input files from the standard format to the HDF5 format. The MODFLOW code is used to read the files and then our conversion utilities parse through the MODFLOW arrays and export a new set of files in the targeted format. A separate utility (gms2mf2k.exe) is used to convert from MODFLOW simulations using HDF5 back to a simulation where all of the inputs are standard ASCII format. This utility reads the MODFLOW files and replaces the references to HDF5 with the data in ASCII format. For example, to convert a set of input files indexed by a name file called namefile.nam from standard to HDF format, one would execute MODFLOW as follows:

mf2k_h5 namefile.nam –exportGmsCompressedH5 covertedfile.nam

To convert a simulation that uses HDF5 to ASCII, one would execute the following command:

gms2mf2k -name namefile.name

In addition to converting MODFLOW input files between the standard and HDF5 formats, the MODFLOW executable (mfk_h5.exe) will read and solve MODFLOW models in the HDF5 format.

The modified MODFLOW executable can be downloaded here (updated 7/20/2012):

mf2k.zip MODFLOW 2000 Version
   
mf2k5.zip MODFLOW 2005 Version

Both 32- and 64-bit versions are included in the downloads. This is the same MODFLOW executable distributed with the GMS software produced by Aquaveo, LLC. This executable does not require a registration code and can be used free of charge. However, it cannot be packaged with and distributed by a commercial software system such as Visual MODFLOW, Groundwater Vistas, etc.

The executables linked above may not be the most recent ones available. You can get access to the most recent versions of the same utilities by downloading the most recent version of GMS from the Aquaveo download site. A GMS license is not required to use the utilities.

Source Code

Updated versions of the MODFLOW HDF5 source code can be downloaded from here:

http://www.modflow.org/aquaveo-modflow