GMS:MODFLOW with HDF5: Difference between revisions
From XMS Wiki
Jump to navigationJump to search
(→Changes to MODFLOW 2000 & 2005 Code: rm big from headers) |
|||
(24 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{MODFLOW Links}} | {{MODFLOW Links}} | ||
The versions of MODFLOW 2000, MODFLOW 2005<ref name="GMS8">Supported starting at GMS version 8.0</ref>, | The versions of MODFLOW 2000, MODFLOW 2005<ref name="GMS8">Supported starting at GMS version 8.0</ref>, SEAWAT<ref name="GMS8">Supported starting at GMS version 8.0</ref>, MODFLOW-NWT<ref name="GMS8.2">Supported starting at GMS version 8.2</ref>, and MODFLOW-LGR<ref name="GMS9.2">Supported starting at GMS version 9.2</ref> that ship with the GMS software have been modified to be able to read input data stored in HDF5 files. GMS saves some MODFLOW data to an HDF5 file that is saved with the other MODFLOW files. Some MODFLOW files will have references to the HDF5 file. | ||
==Advantages to HDF5== | ==Advantages to HDF5== | ||
The HDF5 file format is a cross platform binary format for storing scientific data. One advantage of using HDF5 is that the data is stored in binary format so the disk reads and writes are much faster than with ASCII files | The HDF5 file format is a cross platform binary format for storing scientific data. One advantage of using HDF5 is that the data is stored in binary format so the disk reads and writes are much faster than with ASCII files. View the data stored in an HDF5 file by using [http://hdf.ncsa.uiuc.edu/hdf-java-html/hdfview/index.html HDFView] (or some other available viewer). | ||
Another advantage of using the HDF5 | Another advantage of using the HDF5 library with MODFLOW package data and array data is that HDF5 will compress the data. For example, if there is a transient simulation using the river package the typical line in a river package file would look like this: | ||
'''[K] [I] [J] [STAGE] [CONDUCTANCE] [ELEVATION]''' | '''[K] [I] [J] [STAGE] [CONDUCTANCE] [ELEVATION]''' | ||
Line 19: | Line 19: | ||
In one example a river file that was 437 MB was saved to HDF5 format with a compression level of 1; the resulting file was 14 MB. In another example an HDF5 file that contained drain and general head data was 8 MB while the drain file was 253 MB and the general head 141 MB. Not only do the files compress extremely well but the read/write times for the HDF5 file are much faster than the ASCII files. | In one example a river file that was 437 MB was saved to HDF5 format with a compression level of 1; the resulting file was 14 MB. In another example an HDF5 file that contained drain and general head data was 8 MB while the drain file was 253 MB and the general head 141 MB. Not only do the files compress extremely well but the read/write times for the HDF5 file are much faster than the ASCII files. | ||
==Changes to MODFLOW 2000 & 2005 | ==Changes to MODFLOW 2000 & 2005 Code== | ||
The following subroutines in ult6.f were modified: U2DREL, U2DINT, and ULSTRD. The stream package reading routines were also modified in the str6.f file. | The following subroutines in ult6.f were modified:<ref name="GMS8"/> U2DREL, U2DINT, and ULSTRD. The stream package reading routines were also modified in the str6.f file. | ||
=== | ===ult.f Modifications=== | ||
U2DREL and U2DINT were modified so that if the key word HDF5 was encountered when attempting to read an array then an external procedure is called to read in the data. We have added support for the following: | U2DREL and U2DINT were modified so that if the key word HDF5 was encountered when attempting to read an array then an external procedure is called to read in the data. We have added support for the following: | ||
Line 41: | Line 41: | ||
|- | |- | ||
|'''"pathInFile"''' | |'''"pathInFile"''' | ||
|path to the | |path to the dataset in the HDF5 file | ||
|- | |- | ||
|'''nDim''' | |'''nDim''' | ||
|number of dimensions that the | |number of dimensions that the dataset has (this is 1, 2, 3) | ||
|- | |- | ||
|'''start1''' | |'''start1''' | ||
|the index (NOTE: these are 0 based '''not''' 1) for the starting point to read the | |the index (NOTE: these are 0 based '''not''' 1) for the starting point to read the dataset in the first dimension | ||
|- | |- | ||
|'''nToRead1''' | |'''nToRead1''' | ||
Line 53: | Line 53: | ||
|- | |- | ||
|'''start2''' | |'''start2''' | ||
|the index for the starting point to read the | |the index for the starting point to read the dataset in the second dimension | ||
|- | |- | ||
|'''nToRead2''' | |'''nToRead2''' | ||
Line 59: | Line 59: | ||
|- | |- | ||
|'''start3''' | |'''start3''' | ||
|the index for the starting point to read the | |the index for the starting point to read the dataset in the third dimension | ||
|- | |- | ||
|'''nToRead3''' | |'''nToRead3''' | ||
Line 66: | Line 66: | ||
:''example: "HDF5 1.0 0 "input.h5" "Recharge/07. Property" 3 0 1 0 132 0 1"'' | :''example: "HDF5 1.0 0 "input.h5" "Recharge/07. Property" 3 0 1 0 132 0 1"'' | ||
:This type of formatting will work for any HDF5 | :This type of formatting will work for any HDF5 dataset that has 3 dimensions or less and the dataset can be a 4 byte float or an 8 byte double. The other available format that can be used with the HDF5 key word for the array reading utilities is the following: | ||
:'''HDF5 CONSTANT CNSTNT''' | :'''HDF5 CONSTANT CNSTNT''' | ||
Line 74: | Line 74: | ||
:This type of formating will assign a constant value to the array. This type of formatting may seem unnecessary. However, the constant identifier can be useful when using parameters to define arrays. Parameters will be explained in another section. | :This type of formating will assign a constant value to the array. This type of formatting may seem unnecessary. However, the constant identifier can be useful when using parameters to define arrays. Parameters will be explained in another section. | ||
ULSTRD was also modified to read data from an | ULSTRD was also modified to read data from an HDF5 file. This format is specific to the types of HDF5 files that GMS creates. | ||
:'''GMS_HDF5_01 "FNAME" "pathInFile" SP''' | :'''GMS_HDF5_01 "FNAME" "pathInFile" SP''' | ||
:{| class='wikitable' | :{| class='wikitable' | ||
Line 122: | Line 122: | ||
|} | |} | ||
=== | ===str6.f Modifications=== | ||
Since the STR package does not use the ULSTRD utility the str6.f file had to be modified to read the same data that ULSTRD was modified to read: '''GMS_HDF5_01 "FNAME" "pathInFile" SP'''. | Since the STR package does not use the ULSTRD utility the str6.f file had to be modified to read the same data that ULSTRD was modified to read: '''GMS_HDF5_01 "FNAME" "pathInFile" SP'''. | ||
==Parameters== | ==Parameters== | ||
{{Parameter Support}} | {{Parameter Support}} | ||
===Pilot Points=== | ===Pilot Points=== | ||
In previous versions of GMS, [[GMS:Pilot Points|pilot points]] were supported by using the multiplier arrays in MODFLOW. Beginning with version 6.5 the pilot point interpolation takes place with in our external routine that is called by MODFLOW. For example, if MODFLOW calls our routine to read an HK array and that array has parameter ''key'' values that are associated with a parameter that is defined using pilot points then our routine will perform the pilot point interpolation and substitute the appropriate value. This includes any log interpolation that the user has specified. | In previous versions of GMS, [[GMS:Pilot Points|pilot points]] were supported by using the multiplier arrays in MODFLOW. Beginning with version 6.5 the pilot point interpolation takes place with in our external routine that is called by MODFLOW. For example, if MODFLOW calls our routine to read an HK array and that array has parameter ''key'' values that are associated with a parameter that is defined using pilot points then our routine will perform the pilot point interpolation and substitute the appropriate value. This includes any log interpolation that the user has specified. | ||
==Reading MODFLOW | ==Reading MODFLOW Files which Include HDF5 Data== | ||
When GMS writes out the MODFLOW files for the list based packages, the first item written to the file is #GMS_HDF5_01. When GMS reads these MODFLOW files with this special comment, it does not read any more of the package file and the data from the *.h5 file will be used. | When GMS writes out the MODFLOW files for the list based packages, the first item written to the file is #GMS_HDF5_01. When GMS reads these MODFLOW files with this special comment, it does not read any more of the package file and the data from the *.h5 file will be used. | ||
When GMS saves the RCH or EVT package with parameter that are defined with cluster (and instances). Then a different special comment is written to the top of the file: #GMS_PARAM_CLUSTERS. If GMS is reading a project file that includes a MODFLOW simulation then when this special comment is encountered GMS will not read any more of the package file. However, if a user is reading a MODFLOW model (not a project file) then the rest of this package file will be read and new | When GMS saves the RCH or EVT package with parameter that are defined with cluster (and instances). Then a different special comment is written to the top of the file: #GMS_PARAM_CLUSTERS. If GMS is reading a project file that includes a MODFLOW simulation then when this special comment is encountered GMS will not read any more of the package file. However, if a user is reading a MODFLOW model (not a project file) then the rest of this package file will be read and new datasets will be created on the 3D grid that are used to define the clusters used by the parameters. | ||
==Exporting Native MODFLOW Files== | ==Exporting Native MODFLOW Files== | ||
To export native MODFLOW ASCII files from GMS 6.5 | To export native MODFLOW ASCII files from GMS 6.5 up to GMS 9.2, use the following steps: | ||
# Open a project in GMS (6.5 or later). | # Open a project in GMS (6.5 or later). | ||
# In the 3D Grid Module, select '''''MODFLOW|Export Native MF2K text...''' | # In the 3D Grid Module, select ''MODFLOW'' | '''Export Native MF2K text...''' (GMS 8.3 and below) or ''MODFLOW | Advanced'' | '''Export Native MF2K text...''' (GMS 9.0 and above). | ||
# In the window that appears, double-click the Name file of the MODFLOW model that | # In the window that appears, double-click the Name file of the MODFLOW model that the user wants to convert to ASCII format. | ||
# A DOS prompt will appear. Press the Enter key when the executable is finished. | # A DOS prompt will appear. Press the ''Enter'' key when the executable is finished. | ||
# A folder called | # A folder called "Out_Mf2k" is created in the same folder as the name file the user selected. "Out_Mf2k" contains all the MODFLOW input files in ASCII format. | ||
If the DOS prompt does not appear after selecting the name file, then go to Edit|Preferences... and select Models. Verify that the | If the DOS prompt does not appear after selecting the name file, then go to ''Edit'' | '''Preferences...''' and select ''Models''. Verify that the ''Gms2Mf2k'' executable (the application that converts MODFLOW files from HDF5 to ASCII format) has the correct path next to it. If it doesn't, select '''Browse...''' and locate the executable. It will probably be located at ''C:\Program Files\GMS 8.1\models\mf2k\Gms2Mf2k.exe''. | ||
If not using MODFLOW-USG then to export native MODFLOW ASCII files from GMS 10.0 (or later) use the following steps: | |||
#Open the project in GMS | |||
#Select the ''MODFLOW'' | '''Global Options''' menu command. | |||
#Under the ''MODFLOW version'' section of the dialog turn on the ''Save native text copy'' option. | |||
#Save the project. | |||
When a GMS project is saved with a MODFLOW model there will be a project file (ex: myProject.gpr) and a MODFLOW folder (ex: myProject_MODFLOW). With the ''Save native text copy'' option turned on another folder is created (ex: myProject_MODFLOW_text) that contains the MODFLOW files in native text format. | |||
==Notes== | ==Notes== | ||
{{reflist}} | |||
==External links== | |||
*More information about [https://portal.hdfgroup.org/display/knowledge/What+is+HDF5 HDF5] | |||
{{Navbox GMS}} | |||
[[Category:MODFLOW]] | [[Category:MODFLOW]] | ||
[[Category:SEAWAT]] | [[Category:SEAWAT]] | ||
[[Category:External Links]] |