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 flopy.modflow.mfswi2.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, 'zclose': 0.001, 'npcond': 1, 'mxiter': 100, 'dampt': 1.0, 'rclose': 0.0001, 'nbpol': 2, 'relax': 1.0, 'iter1': 20}, 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)

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).

napptmx : int

only used if adaptive is True. Maximum number of SWI2 time steps per MODFLOW time step. (default is 1).

napptmn : 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)
check(f=None, verbose=True, level=1)

Check package data for common errors.

Parameters:

f : str or file handle

String defining file name or file handle for summary file of check method output. If a sting is passed a file handle is created. If f is None, check method does not write results to a summary file. (default is None)

verbose : bool

Boolean flag used to determine if check method results are written to the screen

level : int

Check method analysis level. If level=0, summary checks are performed. If level=1, full checks are performed.

Returns:

None

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow.load('model.nam')
>>> m.dis.check()
static load(f, model, ext_unit_dict=None)

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 : ModflowSwi2 object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> swi2 = flopy.modflow.ModflowSwi2.load('test.swi2', m)
plot(**kwargs)

Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data

Parameters:

**kwargs : dict

filename_base
: str

Base file name that will be used to automatically generate file names for output image files. Plots will be exported as image files if file_name_base is not None. (default is None)

file_extension
: str

Valid matplotlib.pyplot file extension for savefig(). Only used if filename_base is not None. (default is ‘png’)

mflay
: int

MODFLOW zero-based layer number to return. If None, then all all layers will be included. (default is None)

kper
: int

MODFLOW zero-based stress period number to return. (default is zero)

key
: str

MfList dictionary key. (default is None)

Returns:

axes : list

Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis are returned.

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.dis.plot()
to_shapefile(filename, **kwargs)

Export 2-D, 3-D, and transient 2-D model data to shapefile (polygons). Adds an attribute for each layer in each data array

Parameters:

filename : str

Shapefile name to write

Returns:

None

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.lpf.to_shapefile('test_hk.shp')
write_file(check=True)

Write the package file.

Parameters:

check : boolean

Check package data for common errors. (default True)

Returns:

None