flopy.modflow.mf module

mf module. Contains the ModflowGlobal, ModflowList, and Modflow classes.

class Modflow(modelname='modflowtest', namefile_ext='nam', version='mf2005', exe_name='mf2005.exe', structured=True, listunit=2, model_ws='.', external_path=None, verbose=False, **kwargs)[source]

Bases: flopy.mbase.BaseModel

MODFLOW Model Class.

Parameters:
  • modelname (string, optional) – Name of model. This string will be used to name the MODFLOW input that are created with write_model. (the default is ‘modflowtest’)
  • namefile_ext (string, optional) – Extension for the namefile (the default is ‘nam’)
  • version (string, optional) – Version of MODFLOW to use (the default is ‘mf2005’).
  • exe_name (string, optional) – The name of the executable to use (the default is ‘mf2005’).
  • listunit (integer, optional) – Unit number for the list file (the default is 2).
  • model_ws (string, optional) – model workspace. Directory name to create model data sets. (default is the present working directory).
  • external_path (string) – Location for external files (default is None).
  • verbose (boolean, optional) – Print additional information to the screen (default is False).
  • load (boolean, optional) – (default is True).
  • silent (integer) – (default is 0)

Notes

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
get_ifrefm()[source]
get_nrow_ncol_nlay_nper()[source]
classmethod load(f, version='mf2005', exe_name='mf2005.exe', verbose=False, model_ws='.', load_only=None, forgive=False, check=True)[source]

Load an existing MODFLOW model.

Parameters:
  • f (str) – Path to MODFLOW name file to load.
  • version (str, optional) – MODFLOW version. Default ‘mf2005’, although can be modified on loading packages unique to different MODFLOW versions.
  • exe_name (str, optional) – MODFLOW executable name. Default ‘mf2005.exe’.
  • verbose (bool, optional) – Show messages that can be useful for debugging. Default False.
  • model_ws (str) – Model workspace path. Default ‘.’ or current directory.
  • load_only (list, str or None) – List of case insensitive filetypes to load, e.g. [“bas6”, “lpf”]. One package can also be specified, e.g. “rch”. Default is None, which attempts to load all files. An empty list [] will not load any additional packages than is necessary. At a minimum, “dis” or “disu” is always loaded.
  • forgive (bool, optional) – Option to raise exceptions on package load failure, which can be useful for debugging. Default False.
  • check (boolean, optional) – Check model input for common errors. Default True.
Returns:

ml

Return type:

Modflow object

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load('model.nam')
load_results(**kwargs)[source]
modelgrid
modeltime
ncol
ncpl
nlay
nper
nrow
nrow_ncol_nlay_nper
set_ifrefm(value=True)[source]
set_model_units(iunit0=None)[source]

Write the model name file.

solver_tols
write_name_file()[source]

Write the model name file.

class ModflowGlobal(model, extension='glo')[source]

Bases: flopy.pakbase.Package

ModflowGlobal Package class

write_file()[source]

Every Package needs its own write_file function

class ModflowList(model, extension='list', unitnumber=2)[source]

Bases: flopy.pakbase.Package

ModflowList Package class

write_file()[source]

Every Package needs its own write_file function