flopy.modflow.mfchd Module

mfchd module. Contains the ModflowChd class. Note that the user can access the ModflowChd class as flopy.modflow.ModflowChd.

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

class flopy.modflow.mfchd.ModflowChd(model, stress_period_data=None, dtype=None, options=None, extension='chd', unitnumber=None, filenames=None, **kwargs)

MODFLOW Constant Head Package Class.

Parameters:

model : model object

The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.

stress_period_data : list of boundaries, recarrays, or dictionary of

boundaries.

Each chd cell is defined through definition of layer (int), row (int), column (int), shead (float), ehead (float) shead is the head at the start of the stress period, and ehead is the head at the end of the stress period. The simplest form is a dictionary with a lists of boundaries for each stress period, where each list of boundaries itself is a list of boundaries. Indices of the dictionary are the numbers of the stress period. This gives the form of:

stress_period_data =
{0: [
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead]
    ],
1:  [
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead]
    ], ...
kper:
    [
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead],
    [lay, row, col, shead, ehead]
    ]
}

Note that if the number of lists is smaller than the number of stress periods, then the last list of chds will apply until the end of the simulation. Full details of all options to specify stress_period_data can be found in the flopy3 boundaries Notebook in the basic subdirectory of the examples directory.

extension : string

Filename extension (default is ‘chd’)

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.

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()
>>> lrcd = {0:[[2, 3, 4, 10., 10.1]]}   #this chd will be applied to all
>>>                                     #stress periods
>>> chd = flopy.modflow.ModflowChd(m, stress_period_data=lrcd)

Attributes

mxactc (int) Maximum number of chds for all stress periods. This is calculated automatically by FloPy based on the information in stress_period_data.
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, nper=None, 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.

nper : int

The number of stress periods. If nper is None, then nper will be obtained from the model object. (default is None).

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:

chd : ModflowChd object

ModflowChd object.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> wel = flopy.modflow.ModflowChd.load('test.chd', 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()

Write the package file.

Returns:None