Frequently Asked Questions

Top  Previous  Next  Print
hmtoggle_plus1How do I use MODFLOW to open a MODFLOW model so I can edit it.

MODFLOW is a command-line program rather than a graphical-user interface program.  All the input for MODFLOW must be prepared in advance in a text editor or a separate graphical user interface.  When MODFLOW is run, it prompts the user for the name of the Name File and then uses the files listed in the Name File to run the model. The input files for MODFLOW can not be edited by running MODFLOW.

There are a variety of graphical user interfaces for MODFLOW on the market. Many users find the graphical user interfaces make MODFLOW easier to use.

hmtoggle_plus1How do I run MODFLOW on Windows

Prepare the input files for MODFLOW. Then proceed using one of the methods below.

Method 1:

Open a command line window.  On Windows XP, you do this by first clicking the Windows "Start" button in the lower left and selecting "Run..." then type "cmd" and click the OK button.  In the command line window, use the "CD" command to change to the directory to the directory that contains the name file for your model.  If you also have a copy of MODFLOW in the same directory as your input files, type the the name of the MODFLOW executable such as "mf2k" or "mf2005".  If you don't have a copy of MODFLOW in the same directory as your input files, type the full path for MODFLOW such as "C:\Wrdapp\mf2k.1_18\bin\mf2k.exe". (If the full path includes any spaces, be sure to enclose the full path in quotation marks.)  MODFLOW will start and prompt you for the name of the name file. Type the name of the name file and pres the Enter key on the keyboard.

Method 2:

Create a text file in the same directory as the input files for the model. On the first line of the file enter the full path for MODFLOW such as "C:\Wrdapp\mf2k.1_18\bin\mf2k.exe" followed by a space and then the name of the name file.  On the second line write the line "pause".  The file might end up looking something like this.

C:\Wrdapp\mf2k.1_18\bin\mf2k.exe MyModel.nam

pause

Save the file.  Then change the file extension of the file to ".bat".  In Windows Explorer, double-click on the file to start MODFLOW.

hmtoggle_plus1Where can I get MODFLOW?

There are several different versions of MODFLOW available. Check http://water.usgs.gov/nrp/gwsoftware/modflow.html for the version you want.

hmtoggle_plus1Does the USGS provide support for MODFLOW?

This is answered at http://water.usgs.gov/software/.

hmtoggle_plus1What do I need to do to have MODFLOW save heads or drawdowns in ASCII format?
1.In the Name File, set Ftype for the file in which head or drawdown is to be saved to "DATA" instead of "DATA(BINARY).
2.In the Output Control file, use words instead of numeric codes.
3.Specify the Head Save Format or Drawdown Save Format in the Output Control file.
4.[Optional] include the word LABEL after the format to ensure that each array can be easily identified.
hmtoggle_plus1Can the cell-by-cell budget file be saved in ASCII format?

No. It can only be saved in binary format in the USGS version of MODFLOW. Users would have to change the MODFLOW source code and recompile MODFLOW in order to save the cell-by-cell budget file in ASCII format.

However, the some of the cell-by-cell budget terms can be written to the Listing file by setting the budget unit number in the output files to a negative number.  For example, set IDRNCB less than zero in the Drain package.

hmtoggle_plus1How can I read data from the cell-by-cell budget file?

There are at least four USGS programs that can be used to read data from the cell-by-cell budget file.

Note that the cell-by-cell budget file must be an unstructured non-formatted file by the above programs. To generate such files with versions of MODFLOW not distributed by the USGS, openspec.inc in the MODFLOW source code may need to be modified prior to compiling MODFLOW.

hmtoggle_plus1I need the file mpif.h to compile MODFLOW-2000 and it isn't included in the source code.  Where can I get it?

First of all, mpif.h is only needed to compile a parallel version of MODFLOW-2000.  The serial version of MODFLOW-2000 is not compiled with mpif.h.  To compile the serial version of MODFLOW-2000, use the file para-non.f from the source\serial directory.  To compile the parallel version of MODFLOW-2000 use the files from the source\parallel directory.  One of the files in the source\parallel directory (para-mpi.f) requires mpif.h.  You shouldn't use the files from both the source\serial and source\parallel directories; use one or the other but not both.

If you do wish to compile a parallel version of MODFLOW, you will need to get a copy of mpif.h.  Search the web for it.  One place you may be able to get it is http://tell11.utsi.edu/mpich-1.2.5/include/mpif.h.

hmtoggle_plus1My model hasn't converged. What can I do?

The convergence criteria such as HCLOSE and RCLOSE in the PCG2 package may be too strict or the number of iterations in the solver may be too small. Adjusting other parameters of the selected solver or changing to a different solver may also be helpful.  For large models, the GMG solver can prove helpful.

If the solver has the capability of printing out additional information about the solution process such as by setting IPRPCG to 1 in the PCG2 package, it can be worthwhile to examine the solution information to gain insight into what is causing the problem.

Use of the wetting capability (first implemented in BCF2 and retained in BCF3, BCF5, LPF and HUF) can result in non-unique solutions because the head in a cell must be higher than some wetting threshold. If a cell starts off wet, it can remain active even if the head drops below the wetting threshold. However, if it starts out dry, it may not be wetted because the head in the neighboring cells may be too low.

Use of the wetting capability can cause serious problems with convergence. You can try to avoid this by several methods.

1.If you know a cell should never become wet, make it an inactive cell rather than a variable head cell.
2.You can adjust the value of the wetting threshold in WETDRY. (Higher is more stable but may be less accurate.)
3.You can decide which neighbors will be checked to decide if a cell should be wetted using WETDRY. Often it is better to allow only the cell beneath the dry cell to rewet it.
4.You can use IHDWET to determine which equation is used to specify the head in newly wetted cells.
5.You can vary the wetting factor WETFCT.
6.In steady-state conditions you can adjust initial conditions to values that are close to your best guess of the final conditions to improve stability.
7.You can choose a different solver. The SIP and PCG2 solvers will work with the wetting capability. The SOR solver doesn't work well with the wetting capability. Note that cells can not change between wet and dry during the inner iterations of the PCG2 solver.
8.When using the PCG2 solver, you can set RELAX in the range of 0.97 to 0.99 to avoid zero divide and non-diagonally dominant matrix errors. (However, this is an infrequent cause of instability. If such an error occurs, PCG2 prints an error message in the output file and aborts the simulation.)
9.When using the PCG2 solver, you can set DAMP to a value between 0 and 1.
10.Unrealistically high conductances on boundary cells can contribute to instability. Check the conductances in the Drain, Drain Return, River, Reservoir, Lake, Stream, Streamflow Routing and General-Head Boundary packages. In the Evapotranspiration and Evapotranspiration Segments packages, check the ET flux and extinction depth which together control the conductance of evapotranspiration cells.
11.Run a steady-state model as transient so that cells go dry in a more orderly fashion. You would obtain the steady-state solution by running the transient simulation for enough time steps to cause the storage budget term to approach 0.

The two most important variables that affect stability are the wetting threshold and which neighboring cells are checked to determine if a cell should be wetted. Both of these are controlled through WETDRY. It is often useful to look at the output file and identify cells that convert repeatedly from wet to dry. Try raising the wetting threshold for those cells. It may also be worthwhile looking at the boundary conditions associated with dry cells.

Sometimes cells will go dry in a way that will completely block flow to a sink or from a source. After that happens, the results are unlikely to be correct. It's always a good idea to look at the flow pattern around cells that have gone dry to see whether the results are reasonable.

If the Lake package is being used, it may be worth checking whether the value of THETA is appropriate.

hmtoggle_plus1How can I read data from a binary file generated by MODFLOW?

Some programs that can read data from binary files generated by MODFLOW include the following.

1.Hydpost (included with MODFLOW-2000)

Note that the binary files must be an unstructured non-formatted file to be read by the above programs. To generate such files with versions of MODFLOW not distributed by the USGS, openspec.inc in the MODFLOW source code may need to be modified prior to compiling MODFLOW.

In addition, Graphical User Interface programs for MODFLOW may be able to read such binary files.

Binary files generated by MODFLOW are of several types.  These include:

Head and Drawdown files (See CHEDFM and CDDNFM in Output Control.)
Cell-by-cell flow files (See ILPFCB in the LPF package and similar variables in other packages.)
Heads and flows interpolated to hydrogeologic units (See IOHUFHEADS and IOHUFFLOWS in the HUF2 package.)
Data related to subsidence or compaction (See the IBS, SUB, and SWT Packages.)
hmtoggle_plus1What do I need to do to have the elapsed time saved in the binary budget file?

Use the COMPACT BUDGET option in the Output Control file.