flopy.mt3d.mtssm Module

class flopy.mt3d.mtssm.Mt3dSsm(model, crch=None, cevt=None, mxss=None, stress_period_data=None, dtype=None, extension='ssm', unitnumber=None, filenames=None, **kwargs)

MT3DMS Source and Sink Mixing Package Class.


model : model object

The model object (of type flopy.mt3d.mt.Mt3dms) to which this package will be added.

crch : Transient2d, scalar, array of floats, or dictionary

CRCH is the concentration of recharge for species 1. If the recharge flux is positive, it acts as a source whose concentration can be specified as desired. If the recharge flux is negative, it acts as a sink (discharge) whose concentration is always set equal to the concentration of groundwater at the cell where discharge occurs. Note that the location and flow rate of recharge/discharge are obtained from the flow model directly through the unformatted flow-transport link file. crch can be specified as an array, if the array is constant for the entire simulation. If crch changes by stress period, then the user must provide a dictionary, where the key is the stress period number (zero based) and the value is the recharge array. The recharge concentration can be specified for additional species by passing additional arguments to the Mt3dSsm constructor. For example, to specify the recharge concentration for species two one could use crch2={0: 0., 1: 10*np.ones((nlay, nrow, ncol), dtype=np.float)} as and additional keyword argument that is passed to Mt3dSsm when making the ssm object.

cevt : Transient2d, scalar, array of floats, or dictionary

is the concentration of evapotranspiration flux for species 1. Evapotranspiration is the only type of sink whose concentration may be specified externally. Note that the concentration of a sink cannot be greater than that of the aquifer at the sink cell. Thus, if the sink concentration is specified greater than that of the aquifer, it is automatically set equal to the concentration of the aquifer. Also note that the location and flow rate of evapotranspiration are obtained from the flow model directly through the unformatted flow-transport link file. For multi-species simulations, see crch for a description of how to specify additional concentrations arrays for each species.

stress_period_data : dictionary

Keys in the dictionary are stress zero-based stress period numbers; values in the dictionary are recarrays of SSM boundaries. The dtype for the recarray can be obtained using ssm.dtype (after the ssm package has been created). The default dtype for the recarray is np.dtype([(‘k’, np.int), (“i”, np.int), (“j”, np.int), (“css”, np.float32), (“itype”, np.int), ((cssms(n), np.float), n=1, ncomp)]) If there are more than one component species, then additional entries will be added to the dtype as indicated by cssm(n). Note that if the number of dictionary entries is less than the number of stress periods, then the last recarray of boundaries will apply until the end of the simulation. Full details of all options to specify stress_period_data can be found in the flopy3_multi-component_SSM ipython notebook in the Notebook subdirectory of the examples directory. css is the specified source concentration or mass-loading rate, depending on the value of ITYPE, in a single-species simulation, (For a multispecies simulation, CSS is not used, but a dummy value still needs to be entered here.) Note that for most types of sources, CSS is interpreted as the source concentration with the unit of mass per unit volume (ML-3), which, when multiplied by its corresponding flow rate (L3T-1) from the flow model, yields the mass-loading rate (MT-1) of the source. For a special type of sources (ITYPE = 15), CSS is taken directly as the mass-loading rate (MT-1) of the source so that no flow rate is required from the flow model. Furthermore, if the source is specified as a constant-concentration cell (itype = -1), the specified value of CSS is assigned directly as the concentration of the designated cell. If the designated cell is also associated with a sink/source term in the flow model, the flow rate is not used. itype is an integer indicating the type of the point source. An itype dictionary can be retrieved from the ssm object as itype = mt3d.Mt3dSsm.itype_dict() (CSSMS(n), n=1, NCOMP) defines the concentrations of a point source for multispecies simulation with NCOMP>1. In a multispecies simulation, it is necessary to define the concentrations of all species associated with a point source. As an example, if a chemical of a certain species is injected into a multispecies system, the concentration of that species is assigned a value greater than zero while the concentrations of all other species are assigned zero. CSSMS(n) can be entered in free format, separated by a comma or space between values. Several important notes on assigning concentration for the constant-concentration condition (ITYPE = -1) are listed below: The constant-concentration condition defined in this input file takes precedence to that defined in the Basic Transport Package input file. In a multiple stress period simulation, a constant-concentration cell, once defined, will remain a constant- concentration cell in the duration of the simulation, but its concentration value can be specified to vary in different stress periods. In a multispecies simulation, if it is only necessary to define different constant-concentration conditions for selected species at the same cell location, specify the desired concentrations for those species, and assign a negative value for all other species. The negative value is a flag used by MT3DMS to skip assigning the constant-concentration condition for the designated species.

dtype : np.dtype

dtype to use for the recarray of boundaries. If left as None (the default) then the dtype will be automatically constructed.

extension : string

Filename extension (default is ‘ssm’)

unitnumber : int

File unit number (default is None).

filenames : str or list of str

Filenames to use for the package. If filenames=None the package name will be created using the model name and package extension. If a single string is passed the package will be set to the string. Default is None.


>>> import flopy
>>> m = flopy.mt3d.Mt3dms()
>>> itype = mt3d.Mt3dSsm.itype_dict()
>>> ssm_data = {}
>>> ssm_data[0] = [(4, 4, 4, 1.0, itype['GHB'], 1.0, 100.0)]
>>> ssm_data[5] = [(4, 4, 4, 0.5, itype['GHB'], 0.5, 200.0)]
>>> ssm = flopy.mt3d.Mt3dSsm(m, stress_period_data=ssm_data)
check(f=None, verbose=True, level=1)

Check package data for common errors.


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.




>>> import flopy
>>> m = flopy.modflow.Modflow.load('model.nam')
>>> m.dis.check()
from_package(package, ncomp_aux_names)

read the point source and sink info from a package ncomp_aux_names (list): the aux variable names in the package that are the component concentrations

static get_default_dtype(ncomp=1)

Construct a dtype for the recarray containing the list of sources and sinks

static load(f, model, nlay=None, nrow=None, ncol=None, nper=None, ncomp=None, ext_unit_dict=None)

Load an existing package.


f : filename or file handle

File to load.

model : model object

The model object (of type flopy.mt3d.mt.Mt3dms) 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.


ssm : Mt3dSsm object

Mt3dSsm object.


>>> import flopy
>>> mt = flopy.mt3d.Mt3dms()
>>> ssm = flopy.mt3d.Mt3dSsm.load('test.ssm', mt)

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


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


axes : list

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


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


filename : str

Shapefile name to write




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

Write the package file