flopy.mf6.modflow.mfsimulation module

class MFSimulation(sim_name='sim', version='mf6', exe_name: str | PathLike = 'mf6', sim_ws: str | PathLike = '.', verbosity_level=1, write_headers=True, use_pandas=True, lazy_io=False, continue_=None, nocheck=None, memory_print_option=None, maxerrors=None, print_input=None, hpc_data=None)[source]

Bases: MFSimulationBase

MFSimulation is used to load, build, and/or save a MODFLOW 6 simulation. A MFSimulation object must be created before creating any of the MODFLOW 6 model objects.

Parameters:
  • sim_name (str) – Name of the simulation

  • continue (boolean) –

    • continue (boolean) keyword flag to indicate that the simulation should continue even if one or more solutions do not converge.

  • nocheck (boolean) –

    • nocheck (boolean) keyword flag to indicate that the model input check routines should not be called prior to each time step. Checks are performed by default.

  • memory_print_option (string) –

    • memory_print_option (string) is a flag that controls printing of detailed memory manager usage to the end of the simulation list file. NONE means do not print detailed information. SUMMARY means print only the total memory for each simulation component. ALL means print information for each variable stored in the memory manager. NONE is default if MEMORY_PRINT_OPTION is not specified.

  • maxerrors (integer) –

    • maxerrors (integer) maximum number of errors that will be stored and printed.

  • print_input (boolean) –

    • print_input (boolean) keyword to activate printing of simulation input summaries to the simulation list file (mfsim.lst). With this keyword, input summaries will be written for those packages that support newer input data model routines. Not all packages are supported yet by the newer input data model routines.

  • hpc ({varname:data} or hpc_data data) –

    • Contains data for the hpc package. Data can be stored in a dictionary containing data for the hpc package with variable names as keys and package data as values. Data just for the hpc variable is also acceptable. See hpc package documentation for more information.

  • tdis6 (string) –

    • tdis6 (string) is the name of the Temporal Discretization (TDIS) Input File.

  • models ([mtype, mfname, mname]) –

    • mtype (string) is the type of model to add to simulation.

    • mfname (string) is the file name of the model name file.

    • mname (string) is the user-assigned name of the model. The model name cannot exceed 16 characters and must not have blanks within the name. The model name is case insensitive; any lowercase letters are converted and stored as upper case letters.

  • exchanges ([exgtype, exgfile, exgmnamea, exgmnameb]) –

    • exgtype (string) is the exchange type.

    • exgfile (string) is the input file for the exchange.

    • exgmnamea (string) is the name of the first model that is part of this exchange.

    • exgmnameb (string) is the name of the second model that is part of this exchange.

  • mxiter (integer) –

    • mxiter (integer) is the maximum number of outer iterations for this solution group. The default value is 1. If there is only one solution in the solution group, then MXITER must be 1.

  • solutiongroup ([slntype, slnfname, slnmnames]) –

    • slntype (string) is the type of solution. The Integrated Model Solution (IMS6) is the only supported option in this version.

    • slnfname (string) name of file containing solution input.

    • slnmnames (string) is the array of model names to add to this solution. The number of model names is determined by the number of model names the user provides on this line.

load : (sim_name : str, version : string,

exe_name : str or PathLike, sim_ws : str or PathLike, strict : bool, verbosity_level : int, load_only : list, verify_data : bool, write_headers : bool, lazy_io : bool, use_pandas : bool, ) : MFSimulation a class method that loads a simulation from files

classmethod load(sim_name='modflowsim', version='mf6', exe_name: str | PathLike = 'mf6', sim_ws: str | PathLike = '.', strict=True, verbosity_level=1, load_only=None, verify_data=False, write_headers=True, lazy_io=False, use_pandas=True)[source]

Load an existing model. Do not call this method directly. Should only be called by child class.

Parameters:
  • cls_child – cls object of child class calling load

  • sim_name (str) – Name of the simulation.

  • version (str) – MODFLOW version

  • exe_name (str or PathLike) – Path to MODFLOW executable (relative to the simulation workspace or absolute)

  • sim_ws (str or PathLike) – Path to simulation workspace

  • strict (bool) – Strict enforcement of file formatting

  • verbosity_level (int) –

    Verbosity level of standard output

    0: No standard output 1: Standard error/warning messages with some informational

    messages

    2: Verbose mode with full error/warning/informational

    messages. This is ideal for debugging.

  • load_only (list) – List of package abbreviations or package names corresponding to packages that flopy will load. default is None, which loads all packages. the discretization packages will load regardless of this setting. subpackages, like time series and observations, will also load regardless of this setting. example list: [‘ic’, ‘maw’, ‘npf’, ‘oc’, ‘ims’, ‘gwf6-gwf6’]

  • verify_data (bool) – Verify data when it is loaded. this can slow down loading

  • write_headers (bool) – When true flopy writes a header to each package file indicating that it was created by flopy

  • lazy_io (bool) – When true flopy only reads external data when the data is requested and only writes external data if the data has changed. This option automatically overrides the verify_data and auto_set_sizes, turning both off.

  • use_pandas (bool) – Load/save data using pandas dataframes (for supported data)

Returns:

sim

Return type:

MFSimulation object

Examples

>>> s = flopy.mf6.mfsimulation.load('my simulation')