flopy.mfusg package
Submodules
- flopy.mfusg.cln_dtypes module
- flopy.mfusg.mfusg module
- flopy.mfusg.mfusgbas module
- flopy.mfusg.mfusgbcf module
- flopy.mfusg.mfusgbct module
- flopy.mfusg.mfusgcln module
- flopy.mfusg.mfusgddf module
- flopy.mfusg.mfusgdis module
MfUsgDisMfUsgDis.headingMfUsgDis.check()MfUsgDis.checklayerthickness()MfUsgDis.get_cell_volumes()MfUsgDis.get_final_totim()MfUsgDis.get_kstp_kper_toffset()MfUsgDis.get_layer()MfUsgDis.get_lrc()MfUsgDis.get_node()MfUsgDis.get_node_coordinates()MfUsgDis.get_rc_from_node_coordinates()MfUsgDis.get_totim()MfUsgDis.get_totim_from_kper_toffset()MfUsgDis.getbotm()MfUsgDis.gettop()MfUsgDis.load()MfUsgDis.write_file()MfUsgDis.zcentroids
get_layer()
- flopy.mfusg.mfusgdisu module
- flopy.mfusg.mfusgdpf module
- flopy.mfusg.mfusgdpt module
- flopy.mfusg.mfusgevt module
- flopy.mfusg.mfusggnc module
- flopy.mfusg.mfusglak module
- flopy.mfusg.mfusglpf module
- flopy.mfusg.mfusgmdt module
- flopy.mfusg.mfusgoc module
- flopy.mfusg.mfusgpcb module
- flopy.mfusg.mfusgrch module
- flopy.mfusg.mfusgsms module
- flopy.mfusg.mfusgwel module
Module contents
Initialize MfUsg.
- class MfUsg(modelname='mfusgtest', namefile_ext='nam', version='mfusg', exe_name: str | PathLike = 'mfusg', structured=True, listunit=2, model_ws: str | PathLike = '.', external_path=None, verbose=False, free_format_npl=None, **kwargs)[source]
Bases:
ModflowMODFLOW-USG Model Class.
- Parameters:
modelname (str or PathLike, default "modflowusgtest") – Name of model. This string will be used to name the MODFLOW input that are created with write_model.
namefile_ext (str, default "nam") – Extension for the namefile.
exe_name (str, default "mfusg") – The name of the executable to use.
structured (bool, default True) – Specify if model grid is structured (default) or unstructured.
listunit (int, default 2) – Unit number for the list file.
model_ws (str, default "." (curdir)) – Model workspace. Directory name to create model data sets.
external_path (str, optional) – Location for external files.
verbose (bool, default False) – Print additional information to the screen.
free_format_npl (int, optional) – Number of values per line when writing free-format arrays. When set (e.g.,
free_format_npl=10), arrays are written with that many values per line instead of all values on a single line. This produces block-format output, improving readability for large models. Default is None (all values on one line).
Notes
Examples
>>> import flopy >>> usg = flopy.mfusg.MfUsg()
- classmethod load(f: str, version='mfusg', exe_name: str | PathLike = 'mfusg', verbose=False, model_ws: str | PathLike = '.', load_only=None, forgive=False, check=True)[source]
Load an existing MODFLOW-USG model.
- Parameters:
f (str) – Name of MODFLOW name file to load.
version (str, default "mfusg") – MODFLOW version. Must be “mfusg”.
exe_name (str, default "mfusg") – MODFLOW executable name.
verbose (bool, default False) – Show messages that can be useful for debugging.
model_ws (str or PathLike, default "." (curdir)) – Model workspace path. Default is the current directory.
load_only (list, str or None) – List of case insensitive packages to load, e.g. [“bas6”, “lpf”]. One package can also be specified, e.g. “rch”. Default is None, which attempts to load all files. An empty list [] will not load any additional packages than is necessary. At a minimum, “dis” or “disu” is always loaded.
forgive (bool, optional, default False) – Option to raise exceptions on package load failure, which can be useful for debugging. Default False.
check (boolean, optional) – Check model input for common errors. Default True.
- Return type:
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg.load('model.nam')
- class MfUsgBas(model, ibound=1, strt=1.0, ifrefm=True, ixsec=False, ichflg=False, stoper=None, iprintfv=False, iprinttime=False, structured=True, converge=False, richards=False, double_prec=False, double_out=False, double_io=False, ihm=0, sy_all=False, hnoflo=-999.99, extension='bas', unitnumber=None, filenames=None)[source]
Bases:
PackageMODFLOW Basic Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.ibound (array of ints, optional) – The ibound array (the default is 1).
strt (array of floats, optional) – An array of starting heads (the default is 1.0).
ifrefm (bool, optional) – Indication if data should be read using free format (the default is True).
ixsec (bool, optional) – Indication of whether model is cross sectional or not (the default is False).
ichflg (bool, optional) – Flag indicating that flows between constant head cells should be calculated (the default is False).
richards (bool, optional) – Flag indicating that Richards equation is being solved (the default is False). This is equivalent to using laytyp=5 in the LPF package.
stoper (float) – percent discrepancy that is compared to the budget percent discrepancy continue when the solver convergence criteria are not met. Execution will unless the budget percent discrepancy is greater than stoper (default is None). MODFLOW-2005 only
hnoflo (float) – Head value assigned to inactive cells (default is -999.99).
extension (str, optional) – File extension (default is ‘bas’).
unitnumber (int, optional) – FORTRAN unit number for this package (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 name will be set to the string. Default is None.
Notes
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> bas = flopy.modflow.ModflowBas(m)
- check(f=None, verbose=True, level=1, checktype=None)[source]
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 string 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.
- Return type:
None
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.bas6.check()
- property ifrefm
- classmethod load(f, model, ext_unit_dict=None, check=True, **kwargs)[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 True)
kwargs (dictionary) – Keyword arguments that are passed to load. Possible keyword arguments are nlay, nrow, and ncol. If not provided, then the model must contain a discretization package with correct values for these parameters.
- Returns:
bas – ModflowBas object (of type
flopy.modflow.ModflowBas)- Return type:
ModflowBas object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> bas = flopy.modflow.ModflowBas.load('test.bas', m, nlay=1, nrow=10, >>> ncol=10)
- class MfUsgBcf(model, ipakcb=None, intercellt=0, laycon=3, trpy=1.0, hdry=-1e+30, iwdflg=0, wetfct=0.1, iwetit=1, ihdwet=0, ikvflag=0, ikcflag=0, tabrich=False, nuzones=0, nutabrows=0, bubblept=False, fullydry=False, altsto=False, tran=1.0, hy=1.0, vcont=1.0, kv=1.0, anglex=0.0, ksat=1.0, sf1=1e-05, sf2=0.15, wetdry=-0.01, extension='bcf', unitnumber=None, filenames=None, add_package=True)[source]
Bases:
ModflowBcfBlock Centered Flow (BCF) Package Class for MODFLOW-USG.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
intercellt (int) – Intercell transmissivities, harmonic mean (0), arithmetic mean (1), logarithmic mean (2), combination (3). (default is 0)
laycon (int) – Layer type, confined (0), unconfined (1), constant T, variable S (2), variable T, variable S (default is 3)
trpy (float or array of floats (nlay)) – horizontal anisotropy ratio (default is 1.0)
hdry (float) – head assigned when cell is dry - used as indicator(default is -1E+30)
iwdflg (int) – flag to indicate if wetting is inactive (0) or not (non zero) (default is 0)
wetfct (float) – factor used when cell is converted from dry to wet (default is 0.1)
iwetit (int) – iteration interval in wetting/drying algorithm (default is 1)
ihdwet (int) – flag to indicate how initial head is computed for cells that become wet (default is 0)
ikvflag (int) – flag indicating if vertical hydraulic conductivity is input instead of leakance between two layers.
ikcflag (int) – flag indicating if hydraulic conductivity or transmissivity information is input for each of the nodes or whether this information is directly input for the nodal connections. The easiest input format is to provide the hydraulic conductivity or transmissivity values to the cells using a zero value for IKCFLAG.
anglex (float or array of floats (njag)) – is the angle (in radians) between the horizontal x-axis and the outward normal to the face between a node and its connecting nodes. The angle varies between zero and 6.283185 (two pi being 360 degrees).
tran (float or array of floats (nlay, nrow, ncol), optional) – transmissivity (only read if laycon is 0 or 2) (default is 1.0)
hy (float or array of floats (nlay, nrow, ncol)) – hydraulic conductivity (only read if laycon is 1 or 3) (default is 1.0)
vcont (float or array of floats (nlay-1, nrow, ncol)) – vertical leakance between layers (default is 1.0)
kv (float or array of floats (nlay, nrow, ncol)) – is the vertical hydraulic conductivity of the cell and the leakance is computed for each vertical connection.
sf1 (float or array of floats (nlay, nrow, ncol)) – specific storage (confined) or specific yield (unconfined), read when there is at least one transient stress period. (default is 1e-5)
sf2 (float or array of floats (nlay, nrow, ncol)) – specific yield, only read when laycon is 2 or 3 and there is at least one transient stress period (default is 0.15)
wetdry (float) – a combination of the wetting threshold and a flag to indicate which neighboring cells can cause a cell to become wet (default is -0.01)
ksat (float or array of floats (njag)) – inter-block saturated hydraulic conductivity or transmissivity (if IKCFLAG = 1) or the inter-block conductance (if IKCFLAG = - 1) of the connection between nodes n and m.
extension (string) – Filename extension (default is ‘bcf’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output name will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
add_package (bool) – Flag to add the initialised package object to the parent model object. Default is True.
Notes
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU(model=ml, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> bcf = flopy.mfusg.MfUsgBcf(ml)
- 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:
bcf
- Return type:
MfUsgBcf object
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU( ... model=m, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), ... fahl=[1.0], cl12=[1.0]) >>> bcf = flopy.mfusg.MfUsgBcf.load('test.bcf', m)
- class MfUsgBct(model, itrnsp=1, ipakcb=0, mcomp=1, icbndflg=1, itvd=1, iadsorb=0, ict=0, cinact=-999.0, ciclose=1e-06, idisp=1, ixdisp=0, diffnc=0.0, izod=0, ifod=0, ifmbc=0, iheat=0, imcomp=0, idispcln=0, nseqitr=0, icbund=1, prsity=0.15, bulkd=1.0, anglex=0.0, dl=1.0, dt=0.1, dlx=1.0, dly=1.0, dlz=0.1, dtxy=0.1, dtyz=0.1, dtxz=0.1, conc=0.0, extension=['bct', 'cbt', 'mbegwf', 'mbegwt', 'mbeclnf', 'mbeclnt'], unitnumber=None, filenames=None, add_package=True, **kwargs)[source]
Bases:
PackageBlock Centered Transport (BCT) Package Class for MODFLOW-USG Transport.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.itrnsp (int (0,1,2,3,4,5,-1), (default is 1)) – transport simulation flag
ipakcb (int (0,1,-1), (default is 0)) – a flag and a unit number >0 .
mcomp (int (default is 1)) – number of mobile component species simulated
icbndflg (int (default is 1)) – a flag that determines if active domain for transport the same as for flow
itvd (int (default is 3)) – 0 : upstream weighted scheme is used for simulating the advective term >0 : number of TVD correction iterations used for simulating the advective term
iadsorb (int (default is 0)) – adsorption flag (0: no adsorption, 1: linear isotherm, 2: Freundlich isotherm, 3: Langmuir isotherm)
ict (int (default is 0)) – transport solution scheme (0:water phase concentration, 1:total concentration)
cinact (float (default is -1.0)) – concentration value that will be output at inactive nodes
ciclose (float (default is 1e-6)) – concentration tolerance for convergence of the matrix solver
idisp (int (default is 1)) – flag of dispersion (0: no dispersion, 1: isotropic, 2: anisotropic)
ixdisp (int (default is 0)) – flag of cross-dispersion (0: no cross-dispersion, 1: cross-dispersion)
diffnc (float (default is 0.57024)) – molecular diffusion coefficient
izod (int (default is 0)) – flag of zero-order decay (0: no zero-order decay, 1: in water 2: on soil, 3: on water and soil, 4: on air-water interface)
ifod (int (default is 0)) – flag of first-order decay (0: no first-order decay, 1: in water 2: on soil, 3: on water and soil, 4: on air-water interface)
ifmbc (int (default is 0)) – flag of flux mass balance errors (0: not considered, 1: computed and reported)
iheat (int (default is 0)) – flag of energy balance equation (0: not considered, 1: computed)
imcomp (int (default is 0)) – number of immobile component species simulated
idispcln (int (default is 0)) – index connection between GWF and CLN cells (0: finite difference approximation 1: Thiem solution, 2: Thiem solution with local borehole thermal resistance)
nseqitr (int (default is 0)) – an index or count for performing sequential iterations (0/1: no iterations >1: number of iterations of the transport and reaction modules)
icbund (int or array of ints (nlay, nrow, ncol)) – is the cell-by-cell flag for the transport simulation
prsity (float or array of floats (nlay, nrow, ncol), default is 0.15) – is the porosity of the porous medium
bulkd (float or array of floats (nlay, nrow, ncol), default is 157.0) – is the bulk density of the porous medium
anglex (float or array of floats (njag)) – is the angle (in radians) between the horizontal x-axis and the outward normal to the face between a node and its connecting nodes. The angle varies between zero and 6.283185 (two pi being 360 degrees).
dl (float or array of floats (nlay, nrow, ncol), default is 1.0) – longitudinal dispersivity
dt (float or array of floats (nlay, nrow, ncol), default is 0.1) – transverse dispersivity
dlx (float or array of floats (nlay-1, nrow, ncol), default is 1.0) – x-direction longitudinal dispersivity
dly (float or array of floats (nlay, nrow, ncol), default is 1.0) – y-direction longitudinal dispersivity
dlz (float or array of floats (nlay, nrow, ncol), default is 0.1) – z-direction longitudinal dispersivity
dtxy (float or array of floats (nlay, nrow, ncol), default is 0.1) – xy-direction transverse dispersivity
dtyz (float or array of floats (nlay, nrow, ncol), default is 0.1) – yz-direction transverse dispersivity
dtxz (float or array of floats (nlay, nrow, ncol), default is 0.1) – xz-direction transverse dispersivity
adsorb (float or array of floats (nlay, nrow, ncol), default is none) – adsorption coefficient of a contaminant species
flich (float or array of floats (nlay, nrow, ncol), default is none) – Freundlich adsorption isotherm exponent
zodrw (float or array of floats (nlay, nrow, ncol), default is none) – zero-order decay coefficient in water
zodrs (float or array of floats (nlay, nrow, ncol),default is none) – zero-order decay coefficient on soil
zodraw (float or array of floats (nlay, nrow, ncol), default is none) – zero-order decay coefficient on air-water interface
fodrw (float or array of floats (nlay, nrow, ncol), default is none) – first-order decay coefficient in water
fodrs (float or array of floats (nlay, nrow, ncol), default is none) – first-order decay coefficient on soil
fodraw (float or array of floats (nlay, nrow, ncol), default is none) – first-order decay coefficient on air-water interface
conc (float or array of floats (nlay, nrow, ncol), default is 0.0) – initial concentration of each contaminant species
extension (string) – mbegwunf : flow imbalance information mbegwunt : transport mass imbalance information mbeclnunf : flow imbalance information for CLN domain mbeclnunt : transport mass imbalance information for the CLN domain (default is [‘bct’,’mbegwunf’,’mbegwunt’,’mbeclnunf’,’mbeclnunt’]).
unitnumber (int) – File unit number and the output files. (default is [59, 0, 0, 0, 0, 0, 0] ).
filenames (str or list of str) – Filenames to use for the package and the output files.
add_package (bool, default is True) – Flag to add the initialised package object to the parent model object.
Notes
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg(exe_name='USGs_1.exe') >>> disu = flopy.mfusg.MfUsgDisU(model=ml, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> bct = flopy.mfusg.MfUsgBct(ml)
- check(f=None, verbose=True, level=1, checktype=None)[source]
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 string 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.
- Return type:
None
Notes
Unstructured models not checked for extreme recharge transmissivity ratios.
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.rch.check()
- 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.
- Returns:
bct
- Return type:
MfUsgBct object
Examples
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> dis = flopy.modflow.ModflowDis.load('Test1.dis', ml) >>> bct = flopy.mfusg.MfUsgBct.load('Test1.BTN', ml)
- class MfUsgCln(model, ncln=None, iclnnds=None, nndcln=None, clncon=None, nja_cln=None, iac_cln=None, ja_cln=None, node_prop=None, nclngwc=None, cln_gwc=None, nconduityp=1, cln_circ=None, ibound=1, strt=1.0, transient=False, printiaja=False, nrectyp=0, cln_rect=None, bhe=False, grav=None, visk=None, extension=['cln', 'clncb', 'clnhd', 'clndd', 'clnib', 'clncn', 'clnmb'], unitnumber=None, filenames=None, **kwargs)[source]
Bases:
PackageConnected Linear Network (CLN) Package class for MODFLOW-USG.
- Parameters:
model (flopy.mfusg.MfUsg) – The model object to which this package will be added.
ncln (int, optional) –
A flag or number of CLN segments.
If NCLN = 0, this flag indicates that the CLN domain connectivity is input in a general IA-JA manner as is used for the GWF Process.
If NCLN > 0, linear CLN segments (for instance multi-aquifer wells) or simple CLN networks are simulated and NCLN is the total number of CLN segments in the domain.
iclnnds (int, optional) –
A flag or number of CLN-nodes simulated in the model. Multiple CLN-nodes constitute a segment.
If ICLNNDS < 0, the CLN-nodes are ordered in a sequential manner from the first CLN node to the last CLN node. Therefore, only linear CLN segments are simulated since a CLN segment does not share any of its nodes with another CLN segment.
If ICLNNDS > 0, CLN networks can be simulated and ICLNNDS is the total number of CLN-nodes simulated by the model (NCLNNDS).
CLN nodes can be shared among CLN segments and therefore, the CLN-nodal connectivity for the network is also required as input.
nndcln (int, optional) – The number of CLN-nodes that are associated with each CLN segment. Only read if NCLN > 0. If ICLNNDS < 0, sum of nndcln is the total number of CLN-nodes (NCLNNDS).
clncon (list of list, optional) – The CLN-node numbers associated with each CLN segment. Only read if NCLN > 0 and ICLNNDS > 0. It is read NCLN times, once for each CLN segment. The number of entries for each sublist is the number of CLN cells (NNDCLN) associated with each CLN segment
nja_cln (int, optional) – The total number of connections of the CLN domain. NJA_CLN is used to dimension the sparse matrix in a compressed row storage format.
iac_cln (list of int, optional) – A matrix indicating the number of connections plus 1 for each CLN node to another CLN node. Note that the IAC_CLN array is only supplied for the CLN cells; the IAC_CLN array is internally expanded to include other domains if present in a simulation. sum(IAC)=NJAG
ja_cln (list of list, optional) – A list of CLN cell number (n) followed by its connecting CLN cell numbers (m) for each of the m CLN cells connected to CLN cell n. This list is sequentially provided for the first to the last CLN cell. Note that the cell and its connections are only supplied for the CLN cells and their connections to the other CLN cells using the local CLN cell numbers.
node_prop (matrix, optional) – [IFNO IFTYP IFDIR FLENG FELEV FANGLE IFLIN ICCWADI X1 Y1 Z1 X2 Y2 Z2] A table of the node properties. Total rows equal the total number of CLN-nodes (NCLNNDS). The first 6 fields is required for running model. Rest of fields have default value of 0.
nclngwc (int, optional) – is the number of CLN to porous-medium grid-block connections present in the model. A CLN node need not be connected to any groundwater node. Conversely, a CLN node may be connected to multiple groundwater nodes, or multiple CLN nodes may be connected to the same porous medium mode.
cln_gwc (matrix, optional) –
unstructured: [IFNOD IGWNOD IFCON FSKIN FLENGW FANISO ICGWADI]
structured: [IFNOD IGWLAY IGWROW IGWFCOL IFCON FSKIN FLENGW FANISO ICGWADI]
A table define connections between CLN nodes and groundwater cells. Total rows of the table equals nclngwc.
nconduityp (int, default 1) – The number of circular conduit-geometry types.
cln_circ (optional) – [ICONDUITYP FRAD CONDUITK TCOND TTHK TCFLUID TCONV] A table that defines the circular conduit properties. Total rows of the table equals nconduityp. Last 4 fields only needed for heat transport simulation.
ibound (int or array_like, default 1) – The boundary array for CLN-nodes. Length equal NCLNNDS.
strt (float or array_like, default 1.0) – Initial head at the beginning of the simulation in CLN nodes. Length equal NCLNNDS.
transient (bool, default False) – Specifies if there is transient IBOUND for each stress period.
printiaja (bool, default False) – Whether to print IA_CLN and JA_CLN to listing file.
nrectyp (int, default 0) – The number of rectangular conduit-geometry types.
cln_rect (rectangular fracture properties, optional) – [IRECTYP FLENGTH FHEIGHT CONDUITK TCOND TTHK TCFLUID TCONV] Read for each rectangular conduit. Total rows of the table equals nrectyp. Last 4 fields only needed for heat transport simulation.
bhe (bool, default False) – A flag indicating that bhe details are also included in a heat transport model. Specifically, the thermal conductance and bhe tube thickness are included in transfer of heat between groundwater and CLN cells along with the heat conductivity of the bhe fluid and the convective heat transfer coefficient.
grav (float, optional) – is the gravitational acceleration constant in model simulation units. The value of the constant follows the keyword GRAVITY. Note that the constant value is 9.81 m/s2 in SI units; 32.2 ft/s2 in fps units.
visk (float, optional) – The kinematic viscosity of water in model simulation units [L2/T]. The value of kinematic viscosity follows the keyword VISCOSITY. Note that the constant value is 1.787 x 10-6 m2/s in SI units; 1.924 x 10-5 ft2/s in fps units.
extension (list of str, default ['cln', 'clncb', 'clnhd', 'clndd', 'clnib', 'clncn', 'clnmb']) – List of seven output file extensions.
unitnumber (list of int, optional) – File unit number for the package and the seven output files. Default None uses
[71, 0, 0, 0, 0, 0, 0].filenames (list of str, optional) – Filenames to use for the package and the output files. If filenames is None, the package name will be created using the model name and package extensions.
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> node_prop = [ ... [1, 1, 0, 10.0, -110.0, 1.57, 0, 0], ... [2, 1, 0, 10.0, -130.0, 1.57, 0, 0], ... ] >>> cln_gwc = [ ... [1, 1, 50, 50, 0, 0, 10.0, 1.0, 0], ... [2, 2, 50, 50, 0, 0, 10.0, 1.0, 0], ... ] >>> cln_circ = [[1, 0.5, 3.23e10]] >>> cln = flopy.mfusg.MfUsgCln(ml, ncln=1, iclnnds=-1, nndcln=2, ... nclngwc=2, node_prop=node_prop, cln_gwc=cln_gwc, cln_circ=cln_circ)
- property cln_nodes
Returns the total number of CLN nodes.
- classmethod load(f, model, pak_type='cln', ext_unit_dict=None, **kwargs)[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:
cln
- Return type:
MfUsgCln object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> cln = flopy.mfusg.MfUsgCln.load('test.cln', m)
- class MfUsgClnDtypes[source]
Bases:
objectDefines MfUsgCln dtypes for various CLN geometries.
- static get_clncirc_dtype(bhe=False)[source]
Dtype of CLN node circular conduit type properties.
- Parameters:
bhe (borehole heat exchanger (bhe)) –
- Return type:
dtype
- class MfUsgDdf(model, rhofresh=1000.0, rhostd=1025.0, cstd=35.0, ithickav=1, imphdd=0, extension='ddf', unitnumber=None, filenames=None)[source]
Bases:
PackageMODFLOW-USG Transport Density Driven Flow (DDF) package class.
- Parameters:
model (model object) – the model object (of type
flopy.mfusg.MfUsg) to which this package will be added.rhofresh (density of freshwater) –
rhostd (density of standard solution) –
cstd (concentration of standard solution) –
ithickav (a flag indicating if thickness weighted averaging for density term) – 0 = arithmetic averaging; 1 = thickness weighting averaging
imphdd (a flag of hydraulic head term in the density formulation) – 0 = explicit (on the right-hand side vector) symmetry of the matrix 1 = implicit (on the left-hand side matrix) asymmetric matrix
extension (str, optional) – file extension (default is ‘ddf’).
unitnumber (int, optional) – fortran unit number for this package (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
Examples
>>> import flopy >>> m = flopy.mfusg.mfusg() >>> ddf = flopy.mfusg.mfusgddf(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:
ddf
- Return type:
MfUsgDdf object
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> ddf = flopy.mfusg.MfUsgDdf.load('Henry.ddf', ml)
- class MfUsgDis(model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0, delc=1.0, laycbd=0, top=1, botm=0, perlen=1, nstp=1, tsmult=1, steady=True, Trtoss=False, itmuni=4, lenuni=2, extension='dis', unitnumber=None, filenames=None, xul=None, yul=None, rotation=None, crs=None, prjfile=None, start_datetime=None, **kwargs)[source]
Bases:
PackageMODFLOW Discretization Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.nlay (int) – Number of model layers (the default is 1).
nrow (int) – Number of model rows (the default is 2).
ncol (int) – Number of model columns (the default is 2).
nper (int) – Number of model stress periods (the default is 1).
delr (float or array of floats (ncol), optional) – An array of spacings along a row (the default is 1.0).
delc (float or array of floats (nrow), optional) – An array of spacings along a column (the default is 0.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)
top (float or array of floats (nrow, ncol), optional) – An array of the top elevation of layer 1. For the common 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)
botm (float or array of floats (nlay, nrow, ncol), optional) – An array of the bottom elevation for each model cell (the default is 0.)
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 (bool or array of bool (nper)) – true or False indicating whether or not stress period is steady state (default is True).
itmuni (int) – Time units, default is days (4)
lenuni (int) – Length units, default is meters (2)
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.
xul (float) – x coordinate of upper left corner of the grid, default is None, which means xul will be set to zero.
yul (float) – y coordinate of upper-left corner of the grid, default is None, which means yul will be calculated as the sum of the delc array. This default, combined with the xul and rotation defaults will place the lower-left corner of the grid at (0, 0).
rotation (float) – counter-clockwise rotation (in degrees) of the grid about the lower- left corner. default is 0.0
crs (pyproj.CRS, int, str, optional if prjfile is specified) – Coordinate reference system (CRS) for the model grid (must be projected; geographic CRS are not supported). The value can be anything accepted by
pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:26916”) or a WKT string.prjfile (str or PathLike, optional if crs is specified) – ESRI-style projection file with well-known text defining the CRS for the model grid (must be projected; geographic CRS are not supported).
start_datetime (str) – starting datetime of the simulation. default is ‘1/1/1970’
**kwargs (dict, optional) –
Support deprecated keyword options.
Deprecated since version 3.5:
proj4_strwill be removed for FloPy 3.6, usecrsinstead.
Notes
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> dis = flopy.modflow.ModflowDis(m)
- check(f=None, verbose=True, level=1, checktype=None)[source]
Check dis package data for zero and negative thicknesses.
- Parameters:
f (str or file handle) – String defining file name or file handle for summary file of check method output. If a string 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.
- Return type:
None
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.dis.check()
- get_cell_volumes()[source]
Get an array of cell volumes.
- Returns:
vol
- Return type:
array of floats (nlay, nrow, ncol)
- get_final_totim()[source]
Get the totim at the end of the simulation
- Returns:
totim – maximum simulation totim
- Return type:
- get_kstp_kper_toffset(t=0.0, use_cached_totim=False)[source]
Get the stress period, time step, and time offset from passed time.
- Parameters:
t (float) – totim to return the stress period, time step, and toffset for based on time discretization data. Default is 0.
use_cached_totim (bool) – optional flag to use a cached calculation of totim, vs. dynamically calculating totim. Setting to True significantly speeds up looped operations that call this function (default is False).
- Returns:
kstp (int) – time step in stress period corresponding to passed totim
kper (int) – stress period corresponding to passed totim
toffset (float) – time offset of passed totim from the beginning of kper
- get_layer(i, j, elev)[source]
Return the layer for an elevation at an i, j location.
- Parameters:
i (row index (zero-based)) –
j (column index) –
elev (elevation (in same units as model)) –
- Returns:
k
- Return type:
zero-based layer index
- get_lrc(nodes)[source]
Get zero-based layer, row, column from a list of zero-based MODFLOW node numbers.
- Returns:
v – and column (j) for each node in the input list
- Return type:
list of tuples containing the layer (k), row (i),
- get_node(lrc_list)[source]
Get zero-based node number from a list of zero-based MODFLOW layer, row, column tuples.
- Returns:
v – and column (j) tuple in the input list
- Return type:
list of MODFLOW nodes for each layer (k), row (i),
- get_node_coordinates()[source]
Get y, x, and z cell centroids in local model coordinates.
- Returns:
y (list of cell y-centroids)
x (list of cell x-centroids)
z (array of floats (nlay, nrow, ncol))
- get_rc_from_node_coordinates(x, y, local=True)[source]
Get the row and column of a point or sequence of points in model coordinates.
- Parameters:
- Returns:
r (row or sequence of rows (zero-based))
c (column or sequence of columns (zero-based))
- get_totim(use_cached=False)[source]
Get the totim at the end of each time step
- Parameters:
use_cached (bool) – method to use cached totim values instead of calculating totim dynamically
- Returns:
totim – numpy array with simulation totim at the end of each time step
- Return type:
numpy array
- get_totim_from_kper_toffset(kper=0, toffset=0.0, use_cached_totim=False)[source]
Get totim from a passed kper and time offset from the beginning of a stress period
- Parameters:
kper (int) – stress period. Default is 0
toffset (float) – time offset relative to the beginning of kper
use_cached_totim (bool) – optional flag to use a cached calculation of totim, vs. dynamically calculating totim. Setting to True significantly speeds up looped operations that call this function (default is False).
- Returns:
t – totim to return the stress period, time step, and toffset for based on time discretization data. Default is 0.
- Return type:
- getbotm(k=None)[source]
Get the bottom array.
- Returns:
botm (array of floats (nlay, nrow, ncol), or)
botm (array of floats (nrow, ncol) if k is not none)
- classmethod load(f, model, ext_unit_dict=None, check=True)[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 (bool) – Check package data for common errors. (default True)
- Returns:
dis – ModflowDis object.
- Return type:
ModflowDis object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> dis = flopy.modflow.ModflowDis.load('test.dis', m)
- write_file(check=True)[source]
Write the package file.
- Parameters:
check (bool) – Check package data for common errors. (default True)
- Return type:
None
- property zcentroids
- class MfUsgDisU(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=None)[source]
Bases:
PackageMODFLOW Unstructured Discretization Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.mfusg.MfUsg) 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 array 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 (bool or array of bool (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.
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.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU(m)
- 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=True)[source]
Load an existing package.
- Parameters:
f (filename or file handle) – File to load.
model (model object) – The model object (of type
flopy.mfusg.MfUsg) 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 (bool) – Check package data for common errors. (default False; not setup yet)
- Returns:
dis – MfUsgDisU object.
- Return type:
MfUsgDisU object
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU.load('test.disu', m)
- property ncpl
- property zcentroids
Return an array of size nodes that contains the vertical cell center elevation.
- class MfUsgDpf(model, ipakcb=0, idpfhd=0, idpfdd=0, iboundim=0, hnewim=0.0, phif=0.0, ddftr=0.0, sc1im=0.0, sc2im=0.0, extension='dpf', unitnumber=None, filenames=None, add_package=True)[source]
Bases:
PackageDual Porosity Flow (dpf) Package Class for MODFLOW-USG Transport.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.ipakcb (int (0,1,-1), (default is 0)) – a flag and a unit number >0 for cell-by-cell mass flux terms.
idpfhd (int, (default is 0)) – a flag and a unit number >0 for immobile domain heads.
idpfdd (int, (default is 0)) – a flag and a unit number >0 for immobile domain drawdown.
iuzontabim (int or array of ints, (default is 0)) – soil type index for all groundwater flow nodes in the immobile domain
iboundim (int, (default is 0)) – boundary variable for the immobile domain (<0 constant head, =0 no flow)
hnewim (float or array of floats) – initial (starting) head in the immobile domain
phif (float or array of floats) – porosity of the mobile domain.
ddftr (float or array of floats) – dual domain flow transfer rate
sc1im (float or array of floats) – specific storage of the immobile domain
sc2im (float or array of floats) – specific yield or porosity of the immobile domain
alphaim (float or array of floats) – van Genuchten alpha coefficient of the immobile domain
betaim (float or array of floats) – van Genuchten beta coefficient of the immobile domain
srim (float or array of floats) – van Genuchten sr coefficient of the immobile domain
brookim (float or array of floats) – Brooks-Corey exponent for the relative permeability of the immobile domain
bpim (float or array of floats) – Bubble point or air entry pressure head of the immobile domain
extension (string, (default is 'dpf').) –
unitnumber (int, default is 57.) – File unit number.
filenames (str or list of str) – Filenames to use for the package and the output files.
add_package (bool, default is True) – Flag to add the initialised package object to the parent model object.
Notes
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU(model=ml, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> dpf = flopy.mfusg.MfUsgdpf(ml)
- 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:
dpf
- Return type:
MfUsgdpf object
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> dis = flopy.modflow.ModflowDis.load('Test1.dis', ml) >>> dpf = flopy.mfusg.MfUsgdpf.load('Test1.BTN', ml)
- class MfUsgDpt(model, ipakcb=0, idptcon=0, icbndimflg=1, iadsorbim=0, idispim=0, izodim=0, ifodim=0, frahk=False, mobilesat=False, inputsat=False, icbundim=1, phif=0.4, prsityim=0.4, bulkdim=1.6, dlim=0.5, ddtr=0.5, sim=0.5, htcapsim=0.0, htcondsim=0.0, adsorbim=0.0, flichim=0.0, zodrwim=0.0, zodrsim=0.0, fodrwim=0.0, fodrsim=0.0, concim=0.0, extension='dpt', unitnumber=None, filenames=None, add_package=True)[source]
Bases:
PackageDual Porosity Transport (dpt) Package Class for MODFLOW-USG Transport.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.ipakcb (int (0,1,-1), (default is 0)) – a flag and a unit number >0 for cell-by-cell mass flux terms.
idptcon (int (0,1), (default is 0)) – a flag and a unit number >0 for immobile domain concentrations
icbndimflg (int (0,1), (default is 1)) – a flag active domain for the immobile (matrix) domain the same as that for the mobile (fracture) domain
iadsorbim (int (0,1,2,3), (default is 0)) – a flag for adsorption in the immobile domain(0: no adsorption, 1: linear isotherm, 2: Freundlich isotherm, 3: Langmuir isotherm)
idispim (int (0,1), (default is 0)) – a flag for dispersion in the immobile domain (0: no dispersion, 1: dispersion)
izodim (int (0,1), (default is 0)) – a flag for zero-order decay in the immobile domain (0: no zero-order decay, 1: in water, 2: on soil, 3: on water and soil,4: on air-water interface)
ifodim (int (0,1), (default is 0)) – a flag for first-order decay in the immobile domain (0: no first-order decay 1: in water, 2: on soil, 3: on water and soil,4: on air-water interface)
frahk (bool, (default is False)) – a flag for fractional hydraulic conductivity in the immobile domain
mobilesat (bool, (default is False)) – immobile domain saturation equal to initial mobile domain saturation
inputsat (bool, (default is False)) – a flag of immobile domain saturation input
icbundim (int or array of ints (nlay, nrow, ncol)) – is cell-by-cell flag for transport simulation in immobile domain
phif (float or array of floats (nlay, nrow, ncol)) – fraction of the total space that is occupied by the mobile domain
prsityim (float or array of floats (nlay, nrow, ncol)) – effective transport porosity in the immobile domain
bulkdim (float or array of floats (nlay, nrow, ncol)) – bulk density in the immobile domain
dlim (float or array of floats (nlay, nrow, ncol)) – longitudinal dispersivity coefficient between mobile and immobile domains
ddtr (float or array of floats (nlay, nrow, ncol)) – mass transfer coefficient between mobile and immobile domains
sim (float or array of floats (nlay, nrow, ncol)) – saturation in the immobile domain
htcapsim (float or array of floats (nlay, nrow, ncol)) – heat capacity in the immobile domain
htcondsim (float or array of floats (nlay, nrow, ncol)) – heat conductivity in the immobile domain
adsorbim (float or array of floats (nlay, nrow, ncol)) – adsorption coefficient in the immobile domain
flichim (float or array of floats (nlay, nrow, ncol)) – Freundlich coefficient in the immobile domain
zodrwim (float or array of floats (nlay, nrow, ncol)) – zero-order decay rate in water in the immobile domain
zodrsim (float or array of floats (nlay, nrow, ncol)) – zero-order decay rate on soil in the immobile domain
fodrwim (float or array of floats (nlay, nrow, ncol)) – first-order decay rate in water in the immobile domain
fodrsim (float or array of floats (nlay, nrow, ncol)) – first-order decay rate on soil in the immobile domain
concim (float or array of floats (nlay, nrow, ncol)) – initial concentration in the immobile domain
extension (string, (default is 'dpt').) –
unitnumber (int, default is 58.) – File unit number.
filenames (str or list of str) – Filenames to use for the package and the output files.
add_package (bool, default is True) – Flag to add the initialised package object to the parent model object.
Notes
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU(model=ml, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> dpt = flopy.mfusg.MfUsgdpt(ml)
- 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:
dpt
- Return type:
MfUsgdpt object
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> dis = flopy.mfusg.MfUsgDisU.load('SeqDegEg.dis', ml) >>> dpt = flopy.mfusg.MfUsgdpt.load('SeqDegEg.dpt', ml)
- class MfUsgEvt(model, nevtop=3, ipakcb=None, surf=0.0, evtr=0.001, exdp=1.0, ievt=1, mxetzones=0, ietfactor=0, etfactor=0.0, inznevt=0, iznevt=0, extension='evt', unitnumber=None, filenames=None, external=True)[source]
Bases:
PackageMODFLOW Evapotranspiration Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.mfusg.MfUsgEvt) to which this package will be added.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 0).
nevtop (int) – is the recharge option code. 1: ET is calculated only for cells in the top grid layer 2: ET to layer defined in ievt 3: ET to highest active cell (default is 3).
surf (float or filename or ndarray or dict keyed on kper (zero-based)) – is the ET surface elevation. (default is 0.0, which is used for all stress periods).
evtr (float or filename or ndarray or dict keyed on kper (zero-based)) – is the maximum ET flux (default is 1e-3, which is used for all stress periods).
exdp (float or filename or ndarray or dict keyed on kper (zero-based)) – is the ET extinction depth (default is 1.0, which is used for all stress periods).
ievt (int or filename or ndarray or dict keyed on kper (zero-based)) – is the layer indicator variable (default is 1, which is used for all stress periods).
etfactor (float of array (mcomp) (default is 1.0)) – fraction of mass of the component that leaves with water 0 = chemical component left behind in groundwater 1 = chemical component leaves with water between 0 and 1 = fraction of mass of the component leaves
iznevt (float of array (mcomp) (default is 1.0)) – array of zonal indices for applying a PET time series to zones. This PET input is independent of the stress period input, which is ignored when the zonal time series are provided.
extension (string) – Filename extension (default is ‘evt’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, mfusgtest.cbc), if ipakcbc is a number greater than zero. If a single string is passed the package will be set to the string and cbc output names will be created using the model name and .cbc extension, if ipakcbc is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
Notes
Parameters are not supported in FloPy.
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> evt = flopy.mfusg.MfUsgEvt(m, nevtop=3, evtr=1.2e-4)
- classmethod load(f, model, nper=None, 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.mfusg.mf.MfUsg) 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:
evt – MfUsgEvt object.
- Return type:
MfUsgEvt object
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> evt = flopy.mfusg.mfevt.load('test.evt', m)
- class MfUsgGnc(model, numgnc=0, numalphaj=1, i2kn=0, isymgncn=0, iflalphan=0, gncdata=None, extension='gnc', options=None, unitnumber=None, filenames=None)[source]
Bases:
PackageMODFLOW USG Ghost Node Correction (GNC) Package Class.
- Parameters:
numgnc (integer) – numgnc (integer) is the number of GNC entries.
numalphaj (integer) – numalphaj (integer) is the number of contributing factors.
i2kn (integer) – 0 : second-order correction not applied to unconfined transmissivity. 1 : second-order correction applied to unconfined transmissivity.
isymgncn (integer) – 0 : implicit update on left-hand side matrix for asymmetric systems. 1 : explicit update on right-hand side vector for symmetric systems.
iflalphan (integer) –
0 : AlphaJ is contributing factors from all adjacent contributing nodes. 1 : AlphaJ represent the saturated conductances between the ghost node
location and node j, and the contributing factors are computed internally using the equations for the unconfined conductances.
gncdata ([cellidn, cellidm, cellidsj, alphasj]) –
cellidn ((integer, …)) is the cellid of the cell in which the ghost node is located.
cellidm ((integer, …)) is the cellid of the connecting cell
cellidsj ((integer, …)) is the array of CELLIDS for the contributing j cells. This Item is repeated for each of the numalphaj adjacent contributing cells of the ghost node.
alphasj (double) is the contributing factors for each contributing node in CELLIDSJ. This Item is repeated for each of the numalphaj adjacent contributing cells of the ghost node.
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.extension (str, optional) – File extension (default is ‘gnc’.
unitnumber (int, optional) – FORTRAN unit number for this package (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
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> gnc = flopy.mfusg.MfUsgGnc(m)
- static get_empty(numgnc=0, numalphaj=1, iflalphan=0)[source]
Returns empty GNC recarray of default dtype.
- classmethod load(f, model, pak_type='gnc', ext_unit_dict=None, **kwargs)[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:
gnc
- Return type:
MfUsgGnc object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> gnc = flopy.modflow.ModflowGnc.load('test.gnc', m)
- class MfUsgLak(model, nlakes=1, ipakcb=None, theta=-1.0, nssitr=0, sscncr=0.0, surfdep=0.0, stages=1.0, stage_range=None, clake=None, tab_files=None, tab_units=None, lakarr=None, bdlknc=None, sill_data=None, flux_data=None, transportboundary=False, conc_data=None, extension='lak', unitnumber=None, filenames=None, options=None, lwrt=0, **kwargs)[source]
Bases:
PackageMODFLOW USG Transport Lake Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.mfusg.MfUsg) to which this package will be added.nlakes (int) – NLAKES Number of separate lakes. Sublakes of multiple-lake systems are considered separate lakes for input purposes. The variable NLAKES is used, with certain internal assumptions and approximations, to dimension arrays for the simulation.
ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
lwrt (int or list of ints (one per SP)) – lwrt > 0, suppresses printout from the lake package. Default is 0 (to print budget information)
theta (float) –
Explicit (THETA = 0.0), semi-implicit (0.0 < THETA < 1.0), or implicit (THETA = 1.0) solution for lake stages. SURFDEPTH is read only if THETA is assigned a negative value (the negative value of THETA is then changed to a positive value internally by the code). * A new method of solving for lake stage uses only the time-weighting
factor THETA (Merritt and Konikow, 2000, p. 52) for transient simulations. THETA is automatically set to a value of 1.0 for all steady-state stress periods. For transient stress periods, Explicit (THETA = 0.0), semi-implicit (0.0 < THETA < 1.0), or implicit (THETA = 1.0) solutions can be used to calculate lake stages. The option to specify negative values for THETA is supported to allow specification of additional variables (NSSITER, SSCNCR, SURFDEP) for simulations that only include transient stress periods. If THETA is specified as a negative value, then it is converted to a positive value for calculations of lake stage.
In MODFLOW-2000 and later, ISS is not part of the input. Instead NSSITR or SSCNCR should be included if one or more stress periods is a steady state stress period as defined in Ss/tr in the Discretization file.
SSCNCR and NSSITR can be read for a transient only simulation by placing a negative sign immediately in front of THETA. A negative THETA sets a flag which assumes input values for NSSITR and SSCNCR will follow THETA in the format as described by Merritt and Konikow (p. 52). A negative THETA is automatically reset to a positive value after values of NSSITR and SSCNCR are read.
nssitr (int) –
Maximum number of iterations for Newton’s method of solution for equilibrium lake stages in each MODFLOW iteration for steady-state aquifer head solution. Only read if ISS (option flag input to DIS Package of MODFLOW indicating steady-state solution) is not zero or if THETA is specified as a negative value. * NSSITR and SSCNCR may be omitted for transient solutions (ISS = 0). * In MODFLOW-2000 and later, ISS is not part of the input.
Instead NSSITR or SSCNCR should be included if one or more stress periods is a steady state stress period as defined in Ss/tr in the Discretization file.
SSCNCR and NSSITR can be read for a transient only simulation by placing a negative sign immediately in front of THETA. A negative THETA sets a flag which assumes input values for NSSITR and SSCNCR will follow THETA in the format as described by Merritt and Konikow (p. 52). A negative THETA is automatically reset to a positive value after values of NSSITR and SSCNCR are read.
If NSSITR = 0, a value of 100 will be used instead.
sscncr (float) – Convergence criterion for equilibrium lake stage solution by Newton’s method. Only read if ISS is not zero or if THETA is specified as a negative value. See notes above for nssitr.
surfdepth (float) – The height of small topological variations (undulations) in lake-bottom elevations that can affect groundwater discharge to lakes. SURFDEPTH decreases the lakebed conductance for vertical flow across a horizontal lakebed caused both by a groundwater head that is between the lakebed and the lakebed plus SURFDEPTH and a lake stage that is also between the lakebed and the lakebed plus SURFDEPTH. This method provides a smooth transition from a condition of no groundwater discharge to a lake, when groundwater head is below the lakebed, to a condition of increasing groundwater discharge to a lake as groundwater head becomes greater than the elevation of the dry lakebed. The method also allows for the transition of seepage from a lake to groundwater when the lake stage decreases to the lakebed elevation. Values of SURFDEPTH ranging from 0.01 to 0.5 have been used successfully in test simulations. SURFDEP is read only if THETA is specified as a negative value.
stages (float or list of floats) – The initial stage of each lake at the beginning of the run.
stage_range (list of tuples (ssmn, ssmx) of length nlakes) –
Where ssmn and ssmx are the minimum and maximum stages allowed for each lake in steady-state solution. * SSMN and SSMX are not needed for a transient run and must be
omitted when the solution is transient.
When the first stress period is a steady-state stress period, SSMN is defined in record 3.
For subsequent steady-state stress periods, SSMN is defined in record 9a.
lakarr (array of integers (nlay, nrow, ncol)) –
LKARR A value is read in for every grid cell. If LKARR(I,J,K) = 0, the grid cell is not a lake volume cell. If LKARR(I,J,K) > 0, its value is the identification number of the lake occupying the grid cell. LKARR(I,J,K) must not exceed the value NLAKES. If it does, or if LKARR(I,J,K) < 0, LKARR(I,J,K) is set to zero. Lake cells cannot be overlain by non-lake cells in a higher layer. Lake cells must be inactive cells (IBOUND = 0) and should not be convertible to active cells (WETDRY = 0).
The Lake package can be used when all or some of the model layers containing the lake are confined. The authors recommend using the Layer-Property Flow Package (LPF) for this case, although the BCF and HUF Packages will work too. However, when using the BCF6 package to define aquifer properties, lake/aquifer conductances in the lateral direction are based solely on the lakebed leakance (and not on the lateral transmissivity of the aquifer layer). As before, when the BCF6 package is used, vertical lake/aquifer conductances are based on lakebed conductance and on the vertical hydraulic conductivity of the aquifer layer underlying the lake when the wet/dry option is implemented, and only on the lakebed leakance when the wet/dry option is not implemented.
bdlknc (array of floats (nlay, nrow, ncol)) –
BDLKNC A value is read in for every grid cell. The value is the lakebed leakance that will be assigned to lake/aquifer interfaces that occur in the corresponding grid cell. If the wet-dry option flag (IWDFLG) is not active (cells cannot rewet if they become dry), then the BDLKNC values are assumed to represent the combined leakances of the lakebed material and the aquifer material between the lake and the centers of the underlying grid cells, i. e., the vertical conductance values (CV) will not be used in the computation of conductances across lake/aquifer boundary faces in the vertical direction.
IBOUND and WETDRY should be set to zero for every cell for which LKARR is not equal to zero. IBOUND is defined in the input to the Basic Package of MODFLOW. WETDRY is defined in the input to the BCF or other flow package of MODFLOW if the IWDFLG option is active. When used with the HUF package, the Lake Package has been modified to compute effective lake-aquifer conductance solely on the basis of the user-specified value of lakebed leakance; aquifer hydraulic conductivities are not used in this calculation. An appropriate informational message is now printed after the lakebed conductances are written to the main output file.
sill_data (dict) –
(dataset 8 in documentation) Dict of lists keyed by stress period. Each list has a tuple of dataset 8a, 8b for every multi-lake system, where dataset 8a is another tuple of
- ICint
The number of sublakes
- ISUBlist of ints
The identification numbers of the sublakes in the sublake system being described in this record. The center lake number is listed first.
- And dataset 8b contains
- SILLVTsequence of floats
A sequence of sill elevations for each sublakes that determines whether the center lake is connected with a given sublake. Values are entered for each sublake in the order the sublakes are listed in the previous record.
flux_data (dict) –
(dataset 9a in documentation) Dict of lists keyed by stress period. The list for each stress period is a list of lists, with each list containing the variables PRCPLK EVAPLK RNF WTHDRW [SSMN] [SSMX] from the documentation.
- PRCPLKfloat
The rate of precipitation per unit area at the surface of a lake (L/T).
- EVAPLKfloat
The rate of evaporation per unit area from the surface of a lake (L/T).
- RNFfloat
Overland runoff from an adjacent watershed entering the lake. If RNF > 0, it is specified directly as a volumetric rate, or flux (L3 /T). If RNF < 0, its absolute value is used as a dimensionless multiplier applied to the product of the lake precipitation rate per unit area (PRCPLK) and the surface area of the lake at its full stage (occupying all layer 1 lake cells). When RNF is entered as a dimensionless multiplier (RNF < 0), it is considered to be the product of two proportionality factors. The first is the ratio of the area of the basin contributing runoff to the surface area of the lake when it is at full stage. The second is the fraction of the current rainfall rate that becomes runoff to the lake. This procedure provides a means for the automated computation of runoff rate from a watershed to a lake as a function of varying rainfall rate. For example, if the basin area is 10 times greater than the surface area of the lake, and 20 percent of the precipitation on the basin becomes overland runoff directly into the lake, then set RNF = -2.0.
- WTHDRWfloat
The volumetric rate, or flux (L3 /T), of water removal from a lake by means other than rainfall, evaporation, surface outflow, or groundwater seepage. A negative value indicates augmentation. Normally, this would be used to specify the rate of artificial withdrawal from a lake for human water use, or if negative, artificial augmentation of a lake volume for aesthetic or recreational purposes.
- SSMNfloat
Minimum stage allowed for each lake in steady-state solution. See notes on ssmn and ssmx above.
- SSMXfloat
SSMX Maximum stage allowed for each lake in steady-state solution.
conc_data (dict) –
(dataset 9b in documentation) Dict of lists keyed by stress period. The list for each stress period is a list of lists, with each list containing the variables CPPT CRNF [CAUG] from the documentation.
- CPPTfloat
concentration of solute in precipitation onto the lake surface
- CRNFfloat
concentration of solute in overland runoff directly into the lake
- CAUGfloat
concentration of solute in water used to augment the lake volume
if
options (list of strings) – Package options. (default is None).
extension (string) – Filename extension (default is ‘lak’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output names will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
Notes
Parameters are not supported in FloPy.
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> lak = {} >>> lak[0] = [[2, 3, 4, 15.6, 1050., -4]] #this lake boundary will be >>> #applied to all stress periods >>> lak = flopy.mfusg.MfUsgLak(m, nstress_period_data=strd)
- classmethod load(f, model, nper=None, 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.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:
lak – ModflowLak object.
- Return type:
ModflowLak object
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> lak = flopy.mfusg.MfUsgLak.load('test.lak', m)
- class MfUsgLpf(model, laytyp=0, layavg=0, chani=1.0, layvka=0, laywet=0, ipakcb=None, hdry=-1e+30, iwdflg=0, wetfct=0.1, iwetit=1, ihdwet=0, ikcflag=0, anglex=0, hk=1.0, hani=1.0, vka=1.0, ss=1e-05, sy=0.15, vkcb=0.0, wetdry=-0.01, ksat=1.0, storagecoefficient=False, constantcv=False, thickstrt=False, nocvcorrection=False, novfc=False, bubblept=False, fullydry=False, alpha=1.0, beta=7.0, sr=0.05, brook=6.0, bp=0.0, extension='lpf', unitnumber=None, filenames=None, add_package=True)[source]
Bases:
ModflowLpfMODFLOW Layer Property Flow Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflowusg.mfusg.MfUsg) to which this package will be added.ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
hdry (float) – Is the head that is assigned to cells that are converted to dry during a simulation. Although this value plays no role in the model calculations, it is useful as an indicator when looking at the resulting heads that are output from the model. HDRY is thus similar to HNOFLO in the Basic Package, which is the value assigned to cells that are no-flow cells at the start of a model simulation. (default is -1.e30).
laytyp (int or array of ints (nlay)) – Layer type, contains a flag for each layer that specifies the layer type (default is 0). 0 is confined >0 is convertible <0 is convertible unless the THICKSTRT option is in effect. =4 is convertible, with transmissivity computed using upstream water-table depth. =5 is richards equation for variably saturated flow.
layavg (int or array of ints (nlay)) – Layer average 0 is harmonic mean 1 is logarithmic mean 2 is arithmetic mean of saturated thickness and logarithmic mean of of hydraulic conductivity (default is 0).
chani (float or array of floats (nlay)) – contains a value for each layer that is a flag or the horizontal anisotropy. If CHANI is less than or equal to 0, then variable HANI defines horizontal anisotropy. If CHANI is greater than 0, then CHANI is the horizontal anisotropy for the entire layer, and HANI is not read. If any HANI parameters are used, CHANI for all layers must be less than or equal to 0. Use as many records as needed to enter a value of CHANI for each layer. The horizontal anisotropy is the ratio of the hydraulic conductivity along columns (the Y direction) to the hydraulic conductivity along rows (the X direction). (default is 1).
layvka (int or array of ints (nlay)) – a flag for each layer that indicates whether variable VKA is vertical hydraulic conductivity or the ratio of horizontal to vertical hydraulic conductivity. 0: VKA is vertical hydraulic conductivity not 0: VKA is the ratio of horizontal to vertical hydraulic conductivity (default is 0).
laywet (int or array of ints (nlay)) – contains a flag for each layer that indicates if wetting is active. 0 wetting is inactive not 0 wetting is active (default is 0).
wetfct (float) – is a factor that is included in the calculation of the head that is initially established at a cell when it is converted from dry to wet. (default is 0.1).
iwetit (int) – is the iteration interval for attempting to wet cells. Wetting is attempted every IWETIT iteration. If using the PCG solver (Hill, 1990), this applies to outer iterations, not inner iterations. If IWETIT less than or equal to 0, it is changed to 1. (default is 1).
ihdwet (int) – is a flag that determines which equation is used to define the initial head at cells that become wet. (default is 0)
ikcflag (int) – flag indicating if hydraulic conductivity or transmissivity information is input for each of the nodes or whether this information is directly input for the nodal connections. The easiest input format is to provide the hydraulic conductivity or transmissivity values to the cells using a zero value for IKCFLAG.
anglex (float or array of floats (njag)) – is the angle (in radians) between the horizontal x-axis and the outward normal to the face between a node and its connecting nodes. The angle varies between zero and 6.283185 (two pi being 360 degrees).
hk (float or array of floats (nlay, nrow, ncol)) – is the hydraulic conductivity along rows. HK is multiplied by horizontal anisotropy (see CHANI and HANI) to obtain hydraulic conductivity along columns. (default is 1.0).
hani (float or array of floats (nlay, nrow, ncol)) – is the ratio of hydraulic conductivity along columns to hydraulic conductivity along rows, where HK of item 10 specifies the hydraulic conductivity along rows. Thus, the hydraulic conductivity along columns is the product of the values in HK and HANI. (default is 1.0).
vka (float or array of floats (nlay, nrow, ncol)) – is either vertical hydraulic conductivity or the ratio of horizontal to vertical hydraulic conductivity depending on the value of LAYVKA. (default is 1.0).
ss (float or array of floats (nlay, nrow, ncol)) – is specific storage unless the STORAGECOEFFICIENT option is used. When STORAGECOEFFICIENT is used, Ss is confined storage coefficient. (default is 1.e-5).
sy (float or array of floats (nlay, nrow, ncol)) – is specific yield or the saturated water content if richards is used. (default is 0.15).
vkcb (float or array of floats (nlay, nrow, ncol)) – is the vertical hydraulic conductivity of a Quasi-three-dimensional confining bed below a layer. (default is 0.0). Note that if an array is passed for vkcb it must be of size (nlay, nrow, ncol) even though the information for the bottom layer is not needed.
wetdry (float or array of floats (nlay, nrow, ncol)) – is a combination of the wetting threshold and a flag to indicate which neighboring cells can cause a cell to become wet. (default is -0.01).
ksat (float or array of floats (njag)) – inter-block saturated hydraulic conductivity or transmissivity (if IKCFLAG = 1) or the inter-block conductance (if IKCFLAG = - 1) of the connection between nodes n and m.
storagecoefficient (boolean) – indicates that variable Ss and SS parameters are read as storage coefficient rather than specific storage. (default is False).
constantcv (boolean) – indicates that vertical conductance for an unconfined cell is computed from the cell thickness rather than the saturated thickness. The CONSTANTCV option automatically invokes the NOCVCORRECTION option. (default is False).
thickstrt (boolean) – indicates that layers having a negative LAYTYP are confined, and their cell thickness for conductance calculations will be computed as STRT-BOT rather than TOP-BOT. (default is False).
nocvcorrection (boolean) – indicates that vertical conductance is not corrected when the vertical flow correction is applied. (default is False).
novfc (boolean) – turns off the vertical flow correction under dewatered conditions. This option turns off the vertical flow calculation described on p. 5-8 of USGS Techniques and Methods Report 6-A16 and the vertical conductance correction described on p. 5-18 of that report. (default is False).
bubblept (boolean) – turns on the use of the bubbling point pressure in the unsaturated zone calculation such that gas saturations are represented.
alpha (float or array of floats (nlay, nrow, ncol)) – is the van Genuchten shape parameter alpha
beta (float or array of floats (nlay, nrow, ncol)) – is the van Genuchten shape parameter beta (also called n sometimes)
sr (float or array of floats (nlay, nrow, ncol)) – is the residual saturation (equal to theta_r/theta_s)
brook (float or array of floats (nlay, nrow, ncol)) – is the Brooks-Corey shape parameter for the hydraulic conductivity function
bp (float or array of floats (nlay, nrow, ncol)) – is the bubbling point pressure / air entry head. Requires bubblept to be True. extension : string Filename extension (default is ‘lpf’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output name will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
add_package (bool) – Flag to add the initialised package object to the parent model object. Default is True.
Notes
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU( ... model=m, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), ... fahl=[1.0], cl12=[1.0]) >>> lpf = flopy.mfusg.MfUsgLpf(m)
- classmethod load(f, model, ext_unit_dict=None, check=True)[source]
Load an existing package.
- Parameters:
f (filename or file handle) – File to load.
model (model object) – The model object (of type
flopy.mfusg.MfUsg) 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 True)
- Returns:
lpf – MfUsgLpf object.
- Return type:
MfUsgLpf object
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> disu = flopy.mfusg.MfUsgDisU( ... model=m, nlay=1, nodes=1, iac=[1], njag=1, ... ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> lpf = flopy.mfusg.MfUsgLpf.load('test.lpf', m)
- class MfUsgMdt(model, ipakcb=0, imdtcf=0, mdflag=0, volfracmd=0.0, pormd=0.0, rhobmd=0.0, difflenmd=0.0, tortmd=0.0, kdmd=0.0, decaymd=0.0, yieldmd=0.0, diffmd=0.0, aiold1md=0.0, aiold2md=0.0, frahk=False, fradarcy=False, tshiftmd=0.0, iunitAI2=0, crootname=None, extension='mdt', unitnumber=None, filenames=None, add_package=True)[source]
Bases:
PackageMatrix Diffusion Transport (mdt) Package Class for MODFLOW-USG Transport.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.Modflow) to which this package will be added.ipakcb (int (0,1,-1), (default is 0)) – a flag and a unit number >0 for cell-by-cell mass flux terms.
imdtcf (int (0,1,2,3,4,5,6,7), (default is 0)) – a flag and a unit number >0 for immobile domain concentrations
mdflag (int, (default is 0)) – a flag for the matrix diffusion type
volfracmd (float, (default is 0.0)) – volume fraction of fracture/high permeability domain. SAME AS PHIF IN DPT PACKAGE
pormd (float, (default is 0.0)) – effective transport porosity of the mobile domain
rhobmd (float, (default is 0.0)) – bulk density of the mobile domain
difflenmd (float, (default is 0.0)) – diffusion length for diffusive transport within the matrix domain
tortmd (float, (default is 0.0)) – tortuosity factor for the matrix domain
kdmd (float, (default is 0.0)) – adsorption coefficient (Kd) of a contaminant species in immobile domain
decaymd (float, (default is 0.0)) – first-order decay rate of a contaminant species in the immobile domain
yieldmd (float, (default is 0.0)) – yield coefficient for chain decay
diffmd (float, (default is 0.0)) – diffusion coefficient for the immobile domain
aiold1md (float, (default is 0.0) (MDFLAG = 1, 3, 4, 5, 6, or 7)) – concentration integral (equation 8) of each species
aiold2md (float, (default is 0.0) (MDFLAG = 2, 5, 6, or 7)) – concentration integral (equation 8) of each species
frahk (bool, (default is False)) – True = hydraulic conductivity and storage terms only for mobile domain False = hydraulic conductivity and storage terms for matrix domains
fradarcy (bool, (default is False)) – True = Darcy flux computed only for fracture domain
tshiftmd (float, (default is 0.0)) – time shift for the immobile domain
iunitAI2 (float, (default is 0.0)) – separate binary file of ai2 for the matrix domain
crootname_md (str, (default is None)) – rootname for the concentration output binary file
extension (str, (default is 'mdt').) –
unitnumber (int, (default is 57).) – File unit number and the output files.
filenames (str or list of str) – Filenames to use for the package and the output files.
add_package (bool, default is True) – Flag to add the initialised package object to the parent model object.
Notes
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg(exe_name='USGs_1.exe') >>> disu = flopy.mfusg.MfUsgDisU(model=ml, nlay=1, nodes=1, iac=[1], njag=1,ja=np.array([0]), fahl=[1.0], cl12=[1.0]) >>> mdt = flopy.mfusg.MfUsgmdt(ml)
- 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:
mdt
- Return type:
MfUsgmdt object
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> dis = flopy.mfusg.MfUsgDisU.load('SeqDegEg.dis', ml) >>> mdt = flopy.mfusg.MfUsgmdt.load('SeqDegEg.mdt', ml)
- class MfUsgOc(model, ihedfm=0, iddnfm=0, ispcfm=0, chedfm=None, cddnfm=None, cspcfm=None, cboufm=None, compact=True, stress_period_data={(0, 0): ['save head']}, extension=['oc', 'hds', 'ddn', 'cbc', 'ibo', 'con'], unitnumber=None, filenames=None, label='LABEL', **kwargs)[source]
Bases:
PackageMODFLOW USG Transport Output Control (OC) Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.mfusg.MfUsg) to which this package will be added.ihedfm (int (default is 0)) – is a code for the format in which heads will be printed.
iddnfm (int (default is 0)) – is a code for the format in which drawdown will be printed.
chedfm (string (default is None)) – is a character value that specifies the format for saving heads.
cddnfm (string (default is None)) – is a character value that specifies the format for saving drawdown.
cboufm (string (default is None)) – is a character value that specifies the format for saving ibound.
stress_period_data (dictionary of lists) –
Dictionary key is a tuple with the zero-based period and step (IPEROC, ITSOC) for each print/save option list. If stress_period_data is None, then heads are saved for the last time step of each stress period. (default is None)
- The list can have any valid MFUSG OC print/save option:
PRINT HEAD PRINT DRAWDOWN PRINT BUDGET SAVE HEAD SAVE DRAWDOWN SAVE BUDGET SAVE IBOUND
The lists can also include (1) DDREFERENCE in the list to reset drawdown reference to the period and step and (2) a list of layers for PRINT HEAD, SAVE HEAD, PRINT DRAWDOWN, SAVE DRAWDOWN, and SAVE IBOUND.
stress_period_data = {(0,1):[‘save head’]}) would save the head for the second timestep in the first stress period.
compact (boolean) – Save results in compact budget form. (default is True).
extension (list of strings) – (default is [‘oc’, ‘hds’, ‘ddn’, ‘cbc’, ‘ibo’]).
unitnumber (list of ints) – (default is [14, 51, 52, 53, 0]).
Notes
The “words” method for specifying output control is the only option available. Also, the “compact” budget should normally be used as it produces files that are typically much smaller. The compact budget form is also a requirement for using the MODPATH particle tracking program.
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> spd = {(0, 0): ['print head'], ... (0, 1): [], ... (0, 249): ['print head'], ... (0, 250): [], ... (0, 499): ['print head', 'save ibound'], ... (0, 500): [], ... (0, 749): ['print head', 'ddreference'], ... (0, 750): [], ... (0, 999): ['print head']} >>> oc = flopy.mfusg.MfusgOc(m, stress_period_data=spd, cboufm='(20i5)')
- check(f=None, verbose=True, level=1, checktype=None)[source]
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 string 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.
- Return type:
None
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg.load('model.nam') >>> m.oc.check()
- get_budgetunit()[source]
Get the budget file unit number(s).
- Parameters:
None –
- Returns:
iubud – Unit number or list of cell-by-cell budget output unit numbers. None is returned if ipakcb is less than one for all packages.
- Return type:
integer or list of integers
- static get_ocoutput_units(f, ext_unit_dict=None)[source]
Get head and drawdown units from a OC file.
- Parameters:
f (filename or file handle) – File to load.
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:
ihedun (integer) – Unit number of the head file.
fhead (str) – File name of the head file. Is only defined if ext_unit_dict is passed and the unit number is a valid key. , headfilename, oc : MfUsgOc object MfUsgOc object.
iddnun (integer) – Unit number of the drawdown file.
fddn (str) – File name of the drawdown file. Is only defined if ext_unit_dict is passed and the unit number is a valid key.
Examples
>>> import flopy >>> ihds, hf, iddn, df = flopy.mfusg.MfUsgOc.get_ocoutput_units('test.oc')
- classmethod load(f, model, nper=None, nstp=None, nlay=None, 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.mfusg.MfUsg) 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).
nstp (int or list of ints) – Integer of list of integers containing the number of time steps in each stress period. If nstp is None, then nstp will be obtained from the DIS or DISU packages attached to the model object. The length of nstp must be equal to nper. (default is None).
nlay (int) – The number of model layers. If nlay is None, then nnlay will be obtained from the model object. nlay only needs to be specified if an empty model object is passed in and the oc file being loaded is defined using numeric codes. (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:
oc – MfUsgOc object.
- Return type:
MfUsgOc object
Examples
>>> import flopy >>> m = flopy.mfusg.Mfusg() >>> oc = flopy.mfusg.MfUsgOc.load('test.oc', m)
- reset_budgetunit(budgetunit=None, fname=None)[source]
Reset the cell-by-cell budget unit (ipakcb) for every package that can write cell-by-cell data when SAVE BUDGET is specified in the OC file to the specified budgetunit.
- Parameters:
budgetunit (int, optional) – Unit number for cell-by-cell output data. If budgetunit is None then the next available external unit number is assigned. Default is None
fname (string, optional) – Filename to use for cell-by-cell output file. If fname=None the cell-by-cell output file will be created using the model name and a ‘.cbc’ file extension. Default is None.
- Return type:
None
- class MfUsgPcb(model, ipakcb=None, stress_period_data=None, dtype=None, no_print=False, options=None, extension='pcb', unitnumber=None, filenames=None)[source]
Bases:
PackageMODFLOW USG Transport - Prescribed Concentration Boundary (PCB) Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
stress_period_data (list, recarray, dataframe or dictionary of boundaries.) –
Each pcb cell is defined through definition of layer(int), row(int), column(int), stage(float), conductance(float) 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, iSpec, conc], [lay, row, col, iSpec, conc], [lay, row, col, iSpec, conc], ], 1: [ [lay, row, col, iSpec, conc], [lay, row, col, iSpec, conc], [lay, row, col, iSpec, conc], ], ... kper: [ [lay, row, col, iSpec, conc], [lay, row, col, iSpec, conc], [lay, row, col, iSpec, conc], ] }
Note that if no values are specified for a certain stress period, then the list of boundaries for the previous stress period for which values were defined is used. Full details of all options to specify stress_period_data can be found in the flopy3boundaries Notebook in the basic subdirectory of the examples directory
dtype (dtype definition) – if data type is different from default
options (list of strings) – Package options. (default is None).
extension (string) – Filename extension (default is ‘pcb’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output names will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
Notes
Parameters are not supported in FloPy.
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg() >>> lrcsc = {0:[2, 3, 4, 1, 100.]} #this pcb will be applied to all >>> #stress periods >>> pcb = flopy.mfusg.MfUsgPcb(ml, stress_period_data=lrcsc)
- classmethod load(f, model, nper=None, 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.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.check (boolean) – Check package data for common errors. (default True)
- Returns:
pcb
- Return type:
MfUsgPcb object
Examples
>>> import flopy >>> ml = flopy.mfusg.MfUsg(e) >>> dis = flopy.modflow.ModflowDis.load('Test1.dis', ml) >>> pcb = flopy.mfusg.MfUsgPcb.load('Test1.pcb', ml)
- class MfUsgRch(model, nrchop=3, ipakcb=None, rech=0.001, irch=0, seepelev=0, mxrtzones=0, iconc=0, selev=None, iznrch=None, rchconc=None, unitnumber=None, filenames=None)[source]
Bases:
ModflowRchMFUSG TRANSPORT Recharge Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
nrchop (int) – is the recharge option code. 1: Recharge to top grid layer only 2: Recharge to layer defined in irch 3: Recharge to highest active cell (default is 3).
rech (float or filename or ndarray or dict keyed on kper (zero-based)) – Recharge flux (default is 1.e-3, which is used for all stress periods)
irch (int or filename or ndarray or dict keyed on kper (zero-based)) – Layer (for an unstructured grid) or node (for an unstructured grid) to which recharge is applied in each vertical column (only used when nrchop=2). Default is 0, which is used for all stress periods.
extension (string) – Filename extension (default is ‘rch’)
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output names will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. 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
- classmethod load(f, model, nper=None, ext_unit_dict=None, check=True)[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.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.check (boolean) – Check package data for common errors. (default True)
- Returns:
rch – MfUsgRch object.
- Return type:
MfUsgRch object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> rch = flopy.modflow.MfUsgRch.load('test.rch', m)
- class MfUsgSms(model, hclose=0.0001, hiclose=0.0001, mxiter=100, iter1=20, iprsms=2, nonlinmeth=0, linmeth=2, theta=0.7, akappa=0.1, gamma=0.2, amomentum=0.001, numtrack=20, btol=10000.0, breduc=0.2, reslim=100.0, iacl=2, norder=0, level=7, north=2, iredsys=0, rrctol=0.0, idroptol=0, epsrn=0.001, clin='bcgs', ipc=3, iscl=0, iord=0, rclosepcgu=0.1, relaxpcgu=1.0, extension='sms', options=None, options2=None, unitnumber=None, filenames=None)[source]
Bases:
PackageMODFLOW Sms Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.hclose (float) – is the head change criterion for convergence of the outer (nonlinear) iterations, in units of length. When the maximum absolute value of the head change at all nodes during an iteration is less than or equal to HCLOSE, iteration stops. Commonly, HCLOSE equals 0.01.
hiclose (float) – is the head change criterion for convergence of the inner (linear) iterations, in units of length. When the maximum absolute value of the head change at all nodes during an iteration is less than or equal to HICLOSE, the matrix solver assumes convergence. Commonly, HICLOSE is set an order of magnitude less than HCLOSE.
mxiter (int) – is the maximum number of outer (nonlinear) iterations – that is, calls to the solution routine. For a linear problem MXITER should be 1.
iter1 (int) – is the maximum number of inner (linear) iterations. The number typically depends on the characteristics of the matrix solution scheme being used. For nonlinear problems, ITER1 usually ranges from 60 to 600; a value of 100 will be sufficient for most linear problems.
iprsms (int) – is a flag that controls printing of convergence information from the solver: 0 is print nothing; 1 is print only the total number of iterations and nonlinear residual reduction summaries; 2 is print matrix solver information in addition to above.
nonlinmeth (int) – is a flag that controls the nonlinear solution method and under- relaxation schemes. 0 is Picard iteration scheme is used without any under-relaxation schemes involved. > 0 is Newton-Raphson iteration scheme is used with under-relaxation. Note that the Newton-Raphson linearization scheme is available only for the upstream weighted solution scheme of the BCF and LPF packages. < 0 is Picard iteration scheme is used with under-relaxation. The absolute value of NONLINMETH determines the underrelaxation scheme used. 1 or -1, then Delta-Bar-Delta under-relaxation is used. 2 or -2 then Cooley under-relaxation scheme is used. Note that the under-relaxation schemes are used in conjunction with gradient based methods, however, experience has indicated that the Cooley under-relaxation and damping work well also for the Picard scheme with the wet/dry options of MODFLOW.
linmeth (int) – is a flag that controls the matrix solution method. 1 is the XMD solver of Ibaraki (2005). 2 is the unstructured pre-conditioned conjugate gradient solver of White and Hughes (2011).
theta (float) – is the reduction factor for the learning rate (under-relaxation term) of the delta-bar-delta algorithm. The value of THETA is between zero and one. If the change in the variable (head) is of opposite sign to that of the previous iteration, the under-relaxation term is reduced by a factor of THETA. The value usually ranges from 0.3 to 0.9; a value of 0.7 works well for most problems.
akappa (float) – is the increment for the learning rate (under-relaxation term) of the delta-bar-delta algorithm. The value of AKAPPA is between zero and one. If the change in the variable (head) is of the same sign to that of the previous iteration, the under-relaxation term is increased by an increment of AKAPPA. The value usually ranges from 0.03 to 0.3; a value of 0.1 works well for most problems.
gamma (float) – is the history or memory term factor of the delta-bar-delta algorithm. Gamma is between zero and 1 but cannot be equal to one. When GAMMA is zero, only the most recent history (previous iteration value) is maintained. As GAMMA is increased, past history of iteration changes has greater influence on the memory term. The memory term is maintained as an exponential average of past changes. Retaining some past history can overcome granular behavior in the calculated function surface and therefore helps to overcome cyclic patterns of non-convergence. The value usually ranges from 0.1 to 0.3; a value of 0.2 works well for most problems.
amomentum (float) – is the fraction of past history changes that is added as a momentum term to the step change for a nonlinear iteration. The value of AMOMENTUM is between zero and one. A large momentum term should only be used when small learning rates are expected. Small amounts of the momentum term help convergence. The value usually ranges from 0.0001 to 0.1; a value of 0.001 works well for most problems.
numtrack (int) – is the maximum number of backtracking iterations allowed for residual reduction computations. If NUMTRACK = 0 then the backtracking iterations are omitted. The value usually ranges from 2 to 20; a value of 10 works well for most problems.
numtrack – is the maximum number of backtracking iterations allowed for residual reduction computations. If NUMTRACK = 0 then the backtracking iterations are omitted. The value usually ranges from 2 to 20; a value of 10 works well for most problems.
btol (float) – is the tolerance for residual change that is allowed for residual reduction computations. BTOL should not be less than one to avoid getting stuck in local minima. A large value serves to check for extreme residual increases, while a low value serves to control step size more severely. The value usually ranges from 1.0 to 1e6 ; a value of 1e4 works well for most problems but lower values like 1.1 may be required for harder problems.
breduce (float) – is the reduction in step size used for residual reduction computations. The value of BREDUC is between zero and one. The value usually ranges from 0.1 to 0.3; a value of 0.2 works well for most problems.
reslim (float) – is the limit to which the residual is reduced with backtracking. If the residual is smaller than RESLIM, then further backtracking is not performed. A value of 100 is suitable for large problems and residual reduction to smaller values may only slow down computations.
iacl (int) – is the flag for choosing the acceleration method. 0 is Conjugate Gradient; select this option if the matrix is symmetric. 1 is ORTHOMIN. 2 is BiCGSTAB.
norder (int) – is the flag for choosing the ordering scheme. 0 is original ordering 1 is reverse Cuthill McKee ordering 2 is Minimum degree ordering
level (int) – is the level of fill for ILU decomposition. Higher levels of fill provide more robustness but also require more memory. For optimal performance, it is suggested that a large level of fill be applied (7 or 8) with use of drop tolerance.
north (int) – is the number of orthogonalizations for the ORTHOMIN acceleration scheme. A number between 4 and 10 is appropriate. Small values require less storage but more iteration may be required. This number should equal 2 for the other acceleration methods.
iredsys (int) – is the index for creating a reduced system of equations using the red-black ordering scheme. 0 is do not create reduced system 1 is create reduced system using red-black ordering
rrctol (float) – is a residual tolerance criterion for convergence. The root mean squared residual of the matrix solution is evaluated against this number to determine convergence. The solver assumes convergence if either HICLOSE (the absolute head tolerance value for the solver) or RRCTOL is achieved. Note that a value of zero ignores residual tolerance in favor of the absolute tolerance (HICLOSE) for closure of the matrix solver.
idroptol (int) – is the flag to perform drop tolerance. 0 is do not perform drop tolerance 1 is perform drop tolerance
epsrn (float) – is the drop tolerance value. A value of 1e-3 works well for most problems.
clin (string) – an option keyword that defines the linear acceleration method used by the PCGU solver. CLIN is “CG”, then preconditioned conjugate gradient method. CLIN is “BCGS”, then preconditioned bi-conjugate gradient stabilized method.
ipc (int) – an integer value that defines the preconditioner. IPC = 0, No preconditioning. IPC = 1, Jacobi preconditioning. IPC = 2, ILU(0) preconditioning. IPC = 3, MILU(0) preconditioning (default).
iscl (int) – is the flag for choosing the matrix scaling approach used. 0 is no matrix scaling applied 1 is symmetric matrix scaling using the scaling method by the POLCG preconditioner in Hill (1992). 2 is symmetric matrix scaling using the l2 norm of each row of A (DR) and the l2 norm of each row of DRA.
iord (int) – is the flag for choosing the matrix reordering approach used. 0 = original ordering 1 = reverse Cuthill McKee ordering 2 = minimum degree ordering
rclosepcgu (float) – a real value that defines the flow residual tolerance for convergence of the PCGU linear solver. This value represents the maximum allowable residual at any single node. Value is in units of length cubed per time, and must be consistent with MODFLOW-USG length and time units. Usually a value of 1.0x10-1 is sufficient for the flow-residual criteria when meters and seconds are the defined MODFLOW-USG length and time.
relaxpcgu (float) – a real value that defines the relaxation factor used by the MILU(0) preconditioner. RELAXPCGU is unitless and should be greater than or equal to 0.0 and less than or equal to 1.0. RELAXPCGU values of about 1.0 are commonly used, and experience suggests that convergence can be optimized in some cases with RELAXPCGU values of 0.97. A RELAXPCGU value of 0.0 will result in ILU(0) preconditioning. RELAXPCGU is only specified if IPC=3. If RELAXPCGU is not specified and IPC=3, then a default value of 0.97 will be assigned to RELAXPCGU.
extension (str, optional) – File extension (default is ‘sms’.
unitnumber (int, optional) – FORTRAN unit number for this package (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
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> sms = flopy.mfusg.MfUsgSms(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:
sms
- Return type:
MfUsgSms object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> sms = flopy.modflow.ModflowPcg.load('test.sms', m)
- class MfUsgWel(model, ipakcb=None, stress_period_data=None, cln_stress_period_data=None, dtype=None, cln_dtype=None, extension='wel', options=None, binary=False, unitnumber=None, filenames=None, add_package=True)[source]
Bases:
ModflowWelMODFLOW-USG Well Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.modflow.mf.Modflow) to which this package will be added.ipakcb (int, optional) – Toggles whether cell-by-cell budget data should be saved. If None or zero, budget data will not be saved (default is None).
stress_period_data (list of boundaries, or recarray of boundaries, or) –
dictionary of boundaries For structured grid, each well is defined through definition of layer (int), row (int), column (int), flux (float). 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, flux], [lay, row, col, flux], [lay, row, col, flux] ],
- 1: [
[lay, row, col, flux], [lay, row, col, flux], [lay, row, col, flux] ], …
- kper:
[ [lay, row, col, flux], [lay, row, col, flux], [lay, row, col, flux] ]
}
- For unstructured grid,
stress_period_data = {0: [
[node, flux], [node, flux], [node, flux] ],
- 1: [
[node, flux], [node, flux], [node, flux] ], …
- kper:
[ [node, flux], [node, flux], [node, flux] ]
}
Note that if the number of lists is smaller than the number of stress periods, then the last list of wells 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
cln_stress_period_data (list of boundaries, or recarray of boundaries, or) –
dictionary of boundaries Stress period data of wells simulated as Connected Linear Network (CLN) 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:
cln_stress_period_data = {0: [
[iclnnode, flux], [iclnnode, flux], [iclnnode, flux] ],
- 1: [
[iclnnode, flux], [iclnnode, flux], [iclnnode, flux] ], …
- kper:
[ [iclnnode, flux], [iclnnode, flux], [iclnnode, flux] ]
}
dtype (custom datatype of stress_period_data.) – If None the default well datatype will be applied (default is None).
cln_dtype (custom datatype of cln_stress_period_data.) – If None the default well datatype will be applied (default is None).
extension (string) – Filename extension (default is ‘wel’)
options (list of strings) – Package options (default is None).
unitnumber (int) – File unit number (default is None).
filenames (str or list of str) – Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output name will be created using the model name and .cbc extension (for example, modflowtest.cbc), if ipakcb is a number greater than zero. If a single string is passed the package will be set to the string and cbc output names will be created using the model name and .cbc extension, if ipakcb is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.
add_package (bool) – Flag to add the initialised package object to the parent model object. Default is True.
- mxactw
Maximum number of wells for a stress period. This is calculated automatically by FloPy based on the information in stress_period_data.
- Type:
Notes
Parameters are not supported in FloPy.
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> lrcq = {0:[[2, 3, 4, -100.]], 1:[[2, 3, 4, -100.]]} >>> wel = flopy.mfusg.MfUsgWel(m, stress_period_data=lrcq)