flopy.modflow.mfnwt Module¶
mfnwt module. Contains the ModflowNwt class. Note that the user can access the ModflowNwt class as flopy.modflow.ModflowNwt.
Additional information for this MODFLOW package can be found at the Online MODFLOW Guide.

class
flopy.modflow.mfnwt.
ModflowNwt
(model, headtol=0.01, fluxtol=500, maxiterout=100, thickfact=1e05, linmeth=1, iprnwt=0, ibotav=0, options='COMPLEX', Continue=False, dbdtheta=0.4, dbdkappa=1e05, dbdgamma=0.0, momfact=0.1, backflag=1, maxbackiter=50, backtol=1.1, backreduce=0.7, maxitinner=50, ilumethod=2, levfill=5, stoptol=1e10, msdr=15, iacl=2, norder=1, level=5, north=7, iredsys=0, rrctols=0.0, idroptol=1, epsrn=0.0001, hclosexmd=0.0001, mxiterxmd=50, extension='nwt', unitnumber=None, filenames=None)¶ MODFLOW Nwt Package Class.
Parameters: model : model object
The model object (of type
flopy.modflow.mf.Modflow
) to which this package will be added.headtol : float
is the maximum head change between outer iterations for solution of the nonlinear problem. (default is 1e4).
fluxtol : float
is the maximum l2 norm for solution of the nonlinear problem. (default is 500).
maxiterout : int
is the maximum number of iterations to be allowed for solution of the outer (nonlinear) problem. (default is 100).
thickfact : float
is the portion of the cell thickness (length) used for smoothly adjusting storage and conductance coefficients to zero. (default is 1e5).
linmeth : int
is a flag that determines which matrix solver will be used. A value of 1 indicates GMRES will be used A value of 2 indicates XMD will be used. (default is 1).
iprnwt : int
is a flag that indicates whether additional information about solver convergence will be printed to the main listing file. (default is 0).
ibotavg : int
is a flag that indicates whether corrections will be made to groundwater head relative to the cellbottom altitude if the cell is surrounded by dewatered cells (integer). A value of 1 indicates that a correction will be made and a value of 0 indicates no correction will be made. (default is 0).
options : string
SPECIFIED indicates that the optional solver input values listed for items 1 and 2 will be specified in the NWT input file by the user. SIMPLE indicates that default solver input values will be defined that work well for nearly linear models. This would be used for models that do not include nonlinear stress packages, and models that are either confined or consist of a single unconfined layer that is thick enough to contain the water table within a single layer. MODERATE indicates that default solver input values will be defined that work well for moderately nonlinear models. This would be used for models that include nonlinear stress packages, and models that consist of one or more unconfined layers. The MODERATE option should be used when the SIMPLE option does not result in successful convergence. COMPLEX indicates that default solver input values will be defined that work well for highly nonlinear models. This would be used for models that include nonlinear stress packages, and models that consist of one or more unconfined layers representing complex geology and sw/gw interaction. The COMPLEX option should be used when the MODERATE option does not result in successful convergence. (default is COMPLEX).
Continue : bool
if the model fails to converge during a time step then it will continue to solve the following time step. (default is False). Note the capital C on this option so that it doesn’t conflict with a reserved Python language word.
dbdtheta : float
is a coefficient used to reduce the weight applied to the head change between nonlinear iterations. dbdtheta is used to control oscillations in head. Values range between 0.0 and 1.0, and larger values increase the weight (decrease underrelaxation) applied to the head change. (default is 0.4).
dbdkappa : float
is a coefficient used to increase the weight applied to the head change between nonlinear iterations. dbdkappa is used to control oscillations in head. Values range between 0.0 and 1.0, and larger values increase the weight applied to the head change. (default is 1.e5).
dbdgamma : float
is a factor (used to weight the head change for the previous and current iteration. Values range between 0.0 and 1.0, and greater values apply more weight to the head change calculated during the current iteration. (default is 0.)
momfact : float
is the momentum coefficient and ranges between 0.0 and 1.0. Greater values apply more weight to the head change for the current iteration. (default is 0.1).
backflag : int
is a flag used to specify whether residual control will be used. A value of 1 indicates that residual control is active and a value of 0 indicates residual control is inactive. (default is 1).
maxbackiter : int
is the maximum number of reductions (backtracks) in the head change between nonlinear iterations (integer). A value between 10 and 50 works well. (default is 50).
backtol : float
is the proportional decrease in the rootmeansquared error of the groundwater flow equation used to determine if residual control is required at the end of a nonlinear iteration. (default is 1.1).
backreduce : float
is a reduction factor used for residual control that reduces the head change between nonlinear iterations. Values should be between 0.0 and 1.0, where smaller values result in smaller headchange values. (default 0.7).
maxitinner : int
(GMRES) is the maximum number of iterations for the linear solution. (default is 50).
ilumethod : int
(GMRES) is the index for selection of the method for incomplete factorization (ILU) used as a preconditioner. (default is 2).
ilumethod = 1 is ILU with drop tolerance and fill limit. Fillin terms less than drop tolerance times the diagonal are discarded. The number of fillin terms in each row of L and U is limited to the fill limit. The filllimit largest elements are kept in the L and U factors.
ilumethod=2 is ILU(k) order k incomplete LU factorization. Fillin terms of higher order than k in the factorization are discarded.
levfill : int
(GMRES) is the fill limit for ILUMETHOD = 1 and is the level of fill for ilumethod = 2. Recommended values: 510 for method 1, 02 for method 2. (default is 5).
stoptol : float
(GMRES) is the tolerance for convergence of the linear solver. This is the residual of the linear equations scaled by the norm of the root mean squared error. Usually 1.e8 to 1.e12 works well. (default is 1.e10).
msdr : int
(GMRES) is the number of iterations between restarts of the GMRES Solver. (default is 15).
iacl : int
(XMD) is a flag for the acceleration method: 0 is conjugate gradient, 1 is ORTHOMIN, 2 is BiCGSTAB. (default is 2).
norder : int
(XMD) is a flag for the scheme of ordering the unknowns: 0 is original ordering, 1 is RCM ordering, 2 is Minimum Degree ordering. (default is 1).
level : int
(XMD) is the level of fill for incomplete LU factorization. (default is 5).
north : int
(XMD) is the number of orthogonalization for the ORTHOMIN acceleration scheme. A number between 4 and 10 is appropriate. Small values require less storage but more iterations may be required. This number should equal 2 for the other acceleration methods. (default is 7).
iredsys : int
(XMD) is a flag for reduced system preconditioning (integer): 0do not apply reduced system preconditioning, 1apply reduced system preconditioning. (default is 0)
rrctols : int
(XMD) is the residual reductionconvergence criteria. (default is 0.).
idroptol : int
(XMD) is a flag for using drop tolerance in the preconditioning: 0don’t use drop tolerance, 1use drop tolerance. (default is 1).
epsrn : float
(XMD) is the drop tolerance for preconditioning. (default is 1.e4).
hclosexmd : float
(XMD) is the head closure criteria for inner (linear) iterations. (default is 1.e4).
mxiterxmd : int
(XMD) is the maximum number of iterations for the linear solution. (default is 50).
extension : list string
Filename extension (default is ‘nwt’)
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.
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> nwt = flopy.modflow.ModflowNwt(m)

static
load
(f, model, ext_unit_dict=None)¶ Load an existing package.
Parameters: f : filename or file handle
File to load.
model : model object
The model object (of type
flopy.modflow.mf.Modflow
) to which this package will be added.ext_unit_dict : dictionary, optional
If the arrays in the file are specified using EXTERNAL, or older style array control records, then f should be a file handle. In this case ext_unit_dict is required, which can be constructed using the function
flopy.utils.mfreadnam.parsenamefile
.Returns: nwt : ModflowNwt object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> nwt = flopy.modflow.ModflowPcg.load('test.nwt', m)

write_file
()¶ Write the package file.
Returns: None

static