flopy.modflow.mfdisu module

mfdisu module. Contains the ModflowDisU class. Note that the user can access the ModflowDisU class as flopy.modflow.ModflowDisU.

class ModflowDisU(model, nodes=2, nlay=1, njag=None, ivsd=0, nper=1, itmuni=4, lenuni=2, idsymrd=0, laycbd=0, nodelay=None, top=1, bot=0, area=1.0, iac=None, ja=None, ivc=None, cl1=None, cl2=None, cl12=None, fahl=None, perlen=1, nstp=1, tsmult=1, steady=True, extension='disu', unitnumber=None, filenames=None, start_datetime='1/1/1970')[source]

Bases: flopy.pakbase.Package

MODFLOW Unstructured Discretization Package Class.

Parameters:
  • model (model object) – The model object (of type flopy.modflow.Modflow) to which this package will be added.
  • nodes (int) – Number of nodes in the model grid (default is 2).
  • nlay (int) – Number of layers in the model grid (default is 1).
  • njag (int) – Total number of connections of an unstructured grid. njag is used to dimension the sparse matrix in a compressed row storage format. For symmetric arrays, only the upper triangle of the matrix may be entered. For that case, the symmetric portion (minus the diagonal terms) is dimensioned as njags = (njag - nodes) / 2. (default is None).
  • ivsd (int) – is the vertical sub-discretization index. For purposes of this flag, vertical sub-discretization is defined to occur when all layers are not a stacked representation of each other. If IVSD = 0 there is no sub-discretization of layers within the model domain. That is, grids are not nested in the vertical direction. However, one layer may have a different grid structure from the next due to different sub-gridding structures within each layer. If IVSD = 1 there could be sub-discretization of layers with vertically nested grids (as shown in Figure 5c in the MODFLOW-USG document) within the domain. For this case, the vertical connection index IVC is required to determine the vertical connections of every node. Otherwise, the vertical connections are internally computed and IVC is not read. If IVSD = -1 there is no vertical sub-discretization of layers, and further, the horizontal discretization of all layers is the same. For this case, the cell areas (AREA) are read only for one layer and are computed to be the same for all the stacked layers. A structured finite-difference grid is an example of this condition. (default is 0).
  • nper (int) – Number of model stress periods (the default is 1).
  • itmuni (int) – Time units, default is days (4)
  • lenuni (int) – Length units, default is meters (2)
  • idsymrd (int) – A flag indicating if the finite-volume connectivity information of an unstructured grid is input as a full matrix or as a symmetric matrix in the input file. If idsymrd is 0 the finite-volume connectivity information is provided for the full matrix of the porous matrix grid-block connections of an unstructured grid. The code internally stores only the symmetric portion of this information. This input structure (IDSYMRD=0) is easy to organize but contains unwanted information which is parsed out when the information is stored. If idsymrd is 1 then finite-volume connectivity information is provided only for the upper triangular portion of the porous matrix grid-block connections within the unstructured grid. This input structure (IDSYMRD=1) is compact but is slightly more complicated to organize. Only the non-zero upper triangular items of each row are read in sequence for all symmetric matrices. (default is 0).
  • laycbd (int or array of ints (nlay), optional) – An array of flags indicating whether or not a layer has a Quasi-3D confining bed below it. 0 indicates no confining bed, and not zero indicates a confining bed. LAYCBD for the bottom layer must be 0. (the default is 0)
  • nodelay (int or array of ints (nlay)) – The number of cells in each layer. (the default is None, which means the number of cells in a layer is equal to nodes / nlay).
  • top (float or array of floats (nodes), optional) – An array of the top elevation for every cell. For the situation in which the top layer represents a water-table aquifer, it may be reasonable to set Top equal to land-surface elevation (the default is 1.0)
  • bot (float or array of floats (nodes), optional) – An array of the bottom elevation for each model cell (the default is 0.)
  • area (float or array of floats) – Surface area for model cells. Area is for only one layer if IVSD = -1 to indicate that the grid is vertically stacked. Otherwise, area is required for each layer in the model grid. Note that there may be different number of nodes per layer (ndslay) for an unstructured grid. (default is 1.0)
  • iac (array of integers) – is a vector indicating the number of connections plus 1 for each node. Note that the IAC array is only supplied for the GWF cells; the IAC array is internally expanded to include CLN or GNC nodes if they are present in a simulation. (default is None. iac must be provided).
  • ja (array of integers) – is a list of cell number (n) followed by its connecting cell numbers (m) for each of the m cells connected to cell n. This list is sequentially provided for the first to the last GWF cell. Note that the cell and its connections are only supplied for the GWF cells and their connections to the other GWF cells. This connectivity is internally expanded if CLN or GNC nodes are present in a simulation. Also note that the JA list input may be chopped up to have every node number and its connectivity list on a separate line for ease in readability of the file. To further ease readability of the file, the node number of the cell whose connectivity is subsequently listed, may be expressed as a negative number the sign of which is subsequently corrected by the code. (default is None. ja must be provided).
  • ivc (int or array of integers) – is an index array indicating the direction between a node n and all its m connections. IVC = 0 if the connection between n and m is horizontal. IVC = 1 if the connecting node m is vertically oriented to node n. Note that if the CLN Process is active, the connection between two CLN cells has IVC = 2 and the connection between a CLN cell and a GWF cell has IVC = 3. (default is None. ivc must be provided if ivsd = 1)
  • cl1 (float or array of floats) – is the perpendicular length between the center of a node (node 1) and the interface between the node and its adjoining node (node 2). (default is None. cl1 and cl2 must be specified, or cl12 must be specified)
  • cl2 (float or array of floats) – is the perpendicular length between node 2 and the interface between nodes 1 and 2, and is at the symmetric location of CL1. (default is None. cl1 and cl2 must be specified, or cl12 must be specified)
  • cl12 (float or array of floats) – is the array containing CL1 and CL2 lengths, where CL1 is the perpendicular length between the center of a node (node 1) and the interface between the node and its adjoining node (node 2). CL2, which is the perpendicular length between node 2 and the interface between nodes 1 and 2 is at the symmetric location of CL1. The array CL12 reads both CL1 and CL2 in the upper and lower triangular portions of the matrix respectively. Note that the CL1 and CL2 arrays are only supplied for the GWF cell connections and are internally expanded if CLN or GNC nodes exist in a simulation. (default is None. cl1 and cl2 must be specified, or cl12 must be specified)
  • fahl (float or arry of floats) – Area of the interface Anm between nodes n and m. (default is None. fahl must be specified.)
  • perlen (float or array of floats (nper)) – An array of the stress period lengths.
  • nstp (int or array of ints (nper)) – Number of time steps in each stress period (default is 1).
  • tsmult (float or array of floats (nper)) – Time step multiplier (default is 1.0).
  • steady (boolean or array of boolean (nper)) – true or False indicating whether or not stress period is steady state (default is True).
  • extension (string) – Filename extension (default is ‘dis’)
  • 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.
heading

Text string written to top of package input file.

Type:str

Notes

Now works for multi-layer USG models since u3d was modified to handle multiple u2d instances of different size.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> disu = flopy.modflow.ModflowDisU(m)
checklayerthickness()[source]

Check layer thickness.

get_cell_volumes()[source]

Get an array of cell volumes.

Returns:vol
Return type:array of floats (nodes)
classmethod load(f, model, ext_unit_dict=None, check=False)[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.
  • check (boolean) – Check package data for common errors. (default False; not setup yet)
Returns:

dis – ModflowDisU object.

Return type:

ModflowDisU object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> disu = flopy.modflow.ModflowDisU.load('test.disu', m)
ncpl
thickness

Get a Util2d array of cell thicknesses.

Returns:thickness
Return type:util2d array of floats (nodes,)
write_file()[source]

Write the package file.

Returns:
Return type:None
zcentroids

Return an array of size nodes that contains the vertical cell center elevation.