flopy.modflow.mfswi2 module

mfswi2 module. Contains the ModflowSwi2 class. Note that the user can access the ModflowSwi2 class as flopy.modflow.ModflowSwi2.

Additional information for this MODFLOW package can be found at the Online MODFLOW Guide.

class ModflowSwi2(model, nsrf=1, istrat=1, nobs=0, iswizt=None, ipakcb=None, iswiobs=0, options=None, nsolver=1, iprsol=0, mutsol=3, solver2params={'damp': 1.0, 'dampt': 1.0, 'iter1': 20, 'mxiter': 100, 'nbpol': 2, 'npcond': 1, 'rclose': 0.0001, 'relax': 1.0, 'zclose': 0.001}, toeslope=0.05, tipslope=0.05, alpha=None, beta=0.1, nadptmx=1, nadptmn=1, adptfct=1.0, nu=0.025, zeta=[0.0], ssz=0.25, isource=0, obsnam=None, obslrc=None, npln=None, extension='swi2', unitnumber=None, filenames=None)[source]

Bases: flopy.pakbase.Package

MODFLOW SWI2 Package Class.

Parameters:
  • model (model object) – The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.
  • nsrf (int) – number of active surfaces (interfaces). This equals the number of zones minus one. (default is 1).
  • istrat (int) – flag indicating the density distribution. (default is 1).
  • iswizt (int) – unit number for zeta output. (default is None).
  • ipakcb (int) – A flag that is used to determine if cell-by-cell budget data should be saved. If ipakcb is non-zero cell-by-cell budget data will be saved. (default is None).
  • iswiobs (int) – flag and unit number SWI2 observation output. (default is 0).
  • options (list of strings) – Package options. If ‘adaptive’ is one of the options adaptive SWI2 time steps will be used. (default is None).
  • nsolver (int) – DE4 solver is used if nsolver=1. PCG solver is used if nsolver=2. (default is 1).
  • iprsol (int) – solver print out interval. (default is 0).
  • mutsol (int) – If MUTSOL = 0, tables of maximum head change and residual will be printed each iteration. If MUTSOL = 1, only the total number of iterations will be printed. If MUTSOL = 2, no information will be printed. If MUTSOL = 3, information will only be printed if convergence fails. (default is 3).
  • solver2parameters (dict) –

    only used if nsolver = 2

    mxiter : int
    maximum number of outer iterations. (default is 100)
    iter1 : int
    maximum number of inner iterations. (default is 20)
    npcond : int
    flag used to select the matrix conditioning method. (default is 1). specify NPCOND = 1 for Modified Incomplete Cholesky. specify NPCOND = 2 for Polynomial.
    zclose : float
    is the ZETA change criterion for convergence. (default is 1e-3).
    rclose : float
    is the residual criterion for convergence. (default is 1e-4)
    relax : float
    is the relaxation parameter used with NPCOND = 1. (default is 1.0)
    nbpol : int
    is only used when NPCOND = 2 to indicate whether the estimate of the upper bound on the maximum eigenvalue is 2.0, or whether the estimate will be calculated. NBPOL = 2 is used to specify the value is 2.0; for any other value of NBPOL, the estimate is calculated. Convergence is generally insensitive to this parameter. (default is 2).
    damp : float
    is the steady-state damping factor. (default is 1.)
    dampt : float
    is the transient damping factor. (default is 1.)
  • toeslope (float) – Maximum slope of toe cells. (default is 0.05)
  • tipslope (float) – Maximum slope of tip cells. (default is 0.05)
  • alpha (float) – fraction of threshold used to move the tip and toe to adjacent empty cells when the slope exceeds user-specified TOESLOPE and TIPSLOPE values. (default is None)
  • beta (float) – Fraction of threshold used to move the toe to adjacent non-empty cells when the surface is below a minimum value defined by the user-specified TOESLOPE value. (default is 0.1).
  • nadptmx (int) – only used if adaptive is True. Maximum number of SWI2 time steps per MODFLOW time step. (default is 1).
  • nadptmn (int) – only used if adaptive is True. Minimum number of SWI2 time steps per MODFLOW time step. (default is 1).
  • adptfct (float) – is the factor used to evaluate tip and toe thicknesses and control the number of SWI2 time steps per MODFLOW time step. When the maximum tip or toe thickness exceeds the product of TOESLOPE or TIPSLOPE the cell size and ADPTFCT, the number of SWI2 time steps are increased to a value less than or equal to NADPT. When the maximum tip or toe thickness is less than the product of TOESLOPE or TIPSLOPE the cell size and ADPTFCT, the number of SWI2 time steps is decreased in the next MODFLOW time step to a value greater than or equal to 1. ADPTFCT must be greater than 0.0 and is reset to 1.0 if NADPTMX is equal to NADPTMN. (default is 1.0).
  • nu (array of floats) – if istart = 1, density of each zone (nsrf + 1 values). if istrat = 0, density along top of layer, each surface, and bottom of layer (nsrf + 2 values). (default is 0.025)
  • zeta (list of floats or list of array of floats [(nlay, nrow, ncol),) – (nlay, nrow, ncol)] initial elevations of the active surfaces. The list should contain an entry for each surface and be of size nsrf. (default is [0.])
  • ssz (float or array of floats (nlay, nrow, ncol)) – effective porosity. (default is 0.25)
  • isource (integer or array of integers (nlay, nrow, ncol)) –

    Source type of any external sources or sinks, specified with any outside package (i.e. WEL Package, RCH Package, GHB Package). (default is 0).

    If ISOURCE > 0 sources and sinks have the same fluid density as the zone ISOURCE. If such a zone is not present in the cell, sources and sinks have the same fluid density as the active zone at the top of the aquifer. If ISOURCE = 0 sources and sinks have the same fluid density as the active zone at the top of the aquifer. If ISOURCE < 0 sources have the same fluid density as the zone with a number equal to the absolute value of ISOURCE. Sinks have the same fluid density as the active zone at the top of the aquifer. This option is useful for the modeling of the ocean bottom where infiltrating water is salt, yet exfiltrating water is of the same type as the water at the top of the aquifer.

  • obsnam (list of strings) – names for nobs observations.
  • obslrc (list of lists) – zero-based [layer, row, column] lists for nobs observations.
  • extension (string) – Filename extension (default is ‘swi2’)
  • npln (int) – Deprecated - use nsrf instead.
  • unitnumber (int) – File unit number (default is None).
  • filenames (str or list of str) – Filenames to use for the package and the zeta, cbc, obs output files. If filenames=None the package name will be created using the model name and package extension and the output file names will be created using the model name and output extensions. If a single string is passed the package will be set to the string and output names will be created using the model name and zeta, cbc, and observation extensions. To define the names for all package files (input and output) the length of the list of strings should be 4. Default is None.

Notes

Parameters are supported in Flopy only when reading in existing models. Parameter values are converted to native values in Flopy and the connection to “parameters” is thus nonexistent.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> swi2 = flopy.modflow.ModflowSwi2(m)
classmethod load(f, model, ext_unit_dict=None)[source]

Load an existing package.

Parameters:
  • f (filename or file handle) – File to load.
  • model (model object) – The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.
  • ext_unit_dict (dictionary, optional) – If the arrays in the file are specified using EXTERNAL, or older style array control records, then f should be a file handle. In this case ext_unit_dict is required, which can be constructed using the function flopy.utils.mfreadnam.parsenamefile.
Returns:

swi2

Return type:

ModflowSwi2 object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> swi2 = flopy.modflow.ModflowSwi2.load('test.swi2', m)
write_file(check=True, f=None)[source]

Write the package file.

Parameters:check (boolean) – Check package data for common errors. (default True)
Returns:
Return type:None