imod.mf6 - Create Modflow 6 model

Create a structured Modflow 6 model.

class imod.mf6.ConstantHead(head, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

Constant-Head package. Any number of CHD Packages can be specified for a single groundwater flow model; however, an error will occur if a CHD Package attempts to make a GWF cell a constant-head cell when that cell has already been designated as a constant-head cell either within the present CHD Package or within another CHD Package. In previous MODFLOW versions, it was not possible to convert a constant-head cell to an active cell. Once a cell was designated as a constant-head cell, it remained a constant-head cell until the end of the end of the simulation. In MODFLOW 6 a constant-head cell will become active again if it is not included as a constant-head cell in subsequent stress periods. Previous MODFLOW versions allowed specification of SHEAD and EHEAD, which were the starting and ending prescribed heads for a stress period. Linear interpolation was used to calculate a value for each time step. In MODFLOW 6 only a single head value can be specified for any constant-head cell in any stress period. The time-series functionality must be used in order to interpolate values to individual time steps.

Parameters
  • head (array of floats (xr.DataArray)) – Is the head at the boundary.

  • print_input (({True, False}, optional)) – keyword to indicate that the list of constant head information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of constant head flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT”is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that constant head flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

head
observations
print_flows
print_input
save_flows
class imod.mf6.Drainage(elevation, conductance, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

The Drain package is used to simulate head-dependent flux boundaries. https://water.usgs.gov/ogw/modflow/mf6io.pdf#page=67

Parameters
  • elevation (array of floats (xr.DataArray)) – elevation of the drain. (elev)

  • conductance (array of floats (xr.DataArray)) – is the conductance of the drain. (cond)

  • print_input (({True, False}, optional)) – keyword to indicate that the list of drain information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of drain flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT” is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that drain flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

conductance
elevation
observations
print_flows
print_input
save_flows
class imod.mf6.Evapotranspiration(surface, rate, depth, proportion_rate, proportion_depth, fixed_cell=False, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

Evapotranspiration (EVT) Package. Any number of EVT Packages can be specified for a single groundwater flow model. All single-valued variables are free format. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=86

Parameters
  • surface (array of floats (xr.DataArray)) – is the elevation of the ET surface (L). A time-series name may be specified.

  • rate (array of floats (xr.DataArray)) – is the maximum ET flux rate (LT −1). A time-series name may be specified.

  • depth (array of floats (xr.DataArray)) – is the ET extinction depth (L). A time-series name may be specified.

  • proportion_rate (array of floats (xr.DataArray)) – is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). A time-series name may be specified. (petm)

  • proportion_depth (array of floats (xr.DataArray)) – is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). A timeseries name may be specified. (pxdp)

  • fixed_cell (array of floats (xr.DataArray)) – indicates that evapotranspiration will not be reassigned to a cell underlying the cell specified in the list if the specified cell is inactive.

  • print_input (({True, False}, optional)) – keyword to indicate that the list of evapotranspiration information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of evapotranspiration flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT”is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that evapotranspiration flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

depth
fixed_cell
observations
print_flows
print_input
proportion_depth
proportion_rate
rate
save_flows
surface
class imod.mf6.GeneralHeadBoundary(head, conductance, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

The General-Head Boundary package is used to simulate head-dependent flux boundaries. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=75

Parameters
  • head (array of floats (xr.DataArray)) – is the boundary head. (bhead)

  • conductance (array of floats (xr.DataArray)) – is the hydraulic conductance of the interface between the aquifer cell and the boundary.(cond)

  • print_input (({True, False}, optional)) – keyword to indicate that the list of general head boundary information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of general head boundary flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT”is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that general head boundary flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

conductance
head
observations
print_flows
print_input
save_flows
class imod.mf6.GroundwaterFlowModel(newton=False, under_relaxation=False)[source]

Bases: imod.mf6.model.Model

Contains data and writes consistent model input files

render(modeldirectory)[source]

Render model namefile

write(modelname, globaltimes)[source]

Write model namefile Write packages

class imod.mf6.InitialConditions(head)[source]

Bases: imod.mf6.pkgbase.Package

Initial Conditions (IC) Package information is read from the file that is specified by “IC6” as the file type. Only one IC Package can be specified for a GWF model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=46

Parameters

head (array of floats (xr.DataArray)) – is the initial (starting) head—that is, head at the beginning of the GWF Model simulation. STRT must be specified for all simulations, including steady-state simulations. One value is read for every model cell. For simulations in which the first stress period is steady state, the values used for STRT generally do not affect the simulation (exceptions may occur if cells go dry and (or) rewet). The execution time, however, will be less if STRT includes hydraulic heads that are close to the steadystate solution. A head value lower than the cell bottom can be provided if a cell should start as dry. (strt)

head
render(directory, pkgname, *args, **kwargs)[source]
class imod.mf6.Modflow6Simulation(name)[source]

Bases: collections.UserDict

render()[source]

Renders simulation namefile

time_discretization(times)[source]

Collect all unique times

update([E, ]**F) → None. Update D from mapping/iterable E and F.[source]

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

write(directory='.')[source]
class imod.mf6.NodePropertyFlow(icelltype, k, rewet=False, rewet_layer=None, rewet_factor=None, rewet_iterations=None, rewet_method=None, k22=None, k33=None, angle1=None, angle2=None, angle3=None, cell_averaging='harmonic', save_flows=False, starting_head_as_confined_thickness=False, variable_vertical_conductance=False, dewatered=False, perched=False, save_specific_discharge=False)[source]

Bases: imod.mf6.pkgbase.Package

Node Property Flow package. In this package the hydraulic conductivity and rewetting in the model is specified. A single NPF Package is required for each GWF model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=51

Parameters
  • icelltype (array of int (xr.DataArray)) – flag for each cell that specifies how saturated thickness is treated. 0 means saturated thickness is held constant; >0 means saturated thickness varies with computed head when head is below the cell top; <0 means saturated thickness varies with computed head unless the starting_head_as_confined_thickness option is in effect. When starting_head_as_confined_thickness is in effect, a negative value of icelltype indicates that saturated thickness will be computed as strt-bot and held constant.

  • k (array of floats (xr.DataArray)) – is the hydraulic conductivity. For the common case in which the user would like to specify the horizontal hydraulic conductivity and the vertical hydraulic conductivity, then K should be assigned as the horizontal hydraulic conductivity, K33 should be assigned as the vertical hydraulic conductivity, and K22 and the three rotation angles should not be specified. When more sophisticated anisotropy is required, then K corresponds to the K11 hydraulic conductivity axis. All included cells (idomain > 0) must have a K value greater than zero

  • rewet (({True, False}, optional)) – activates model rewetting. Default is False.

  • rewet_layer (float) – is a combination of the wetting threshold and a flag to indicate which neighboring cells can cause a cell to become wet. If rewet_layer < 0, only a cell below a dry cell can cause the cell to become wet. If rewet_layer > 0, the cell below a dry cell and horizontally adjacent cells can cause a cell to become wet. If rewet_layer is 0, the cell cannot be wetted. The absolute value of rewet_layer is the wetting threshold. When the sum of BOT and the absolute value of rewet_layer at a dry cell is equaled or exceeded by the head at an adjacent cell, the cell is wetted. rewet_layer must be specified if “rewet” is specified in the OPTIONS block. If “rewet” is not specified in the options block, then rewet_layer can be entered, and memory will be allocated for it, even though it is not used. (WETDRY) Default is None.

  • rewet_factor – is a keyword and factor that is included in the calculation of the head that is initially established at a cell when that cell is converted from dry to wet. (WETFCT) Default is None.

  • rewet_iterations – is a keyword and iteration interval for attempting to wet cells. Wetting is attempted every rewet_iterations iteration. This applies to outer iterations and not inner iterations. If rewet_iterations is specified as zero or less, then the value is changed to 1. (IWETIT) Default is None.

  • rewet_method – is a keyword and integer flag that determines which equation is used to define the initial head at cells that become wet. If rewet_method is 0, h = BOT + rewet_factor (hm - BOT). If rewet_method is not 0, h = BOT + rewet_factor (THRESH). (IHDWET) Default is None.

  • k22 (array of floats (xr.DataArray)) – is the hydraulic conductivity of the second ellipsoid axis; for an unrotated case this is the hydraulic conductivity in the y direction. If K22 is not included, then K22 is set equal to K. For a regular MODFLOW grid (DIS Package is used) in which no rotation angles are specified, K22 is the hydraulic conductivity along columns in the y direction. For an unstructured DISU grid, the user must assign principal x and y axes and provide the angle for each cell face relative to the assigned x direction. All included cells (idomain > 0) must have a K22 value greater than zero. Default is None.

  • k33 (array of floats (xr.DataArray)) – is the hydraulic conductivity of the third ellipsoid axis; for an unrotated case, this is the vertical hydraulic conductivity. When anisotropy is applied, K33 corresponds to the K33 tensor component. All included cells (idomain > 0) must have a K33 value greater than zero. Default is None.

  • angle1 (float) – is a rotation angle of the hydraulic conductivity tensor in degrees. The angle represents the first of three sequential rotations of the hydraulic conductivity ellipsoid. With the K11, K22, and K33 axes of the ellipsoid initially aligned with the x, y, and z coordinate axes, respectively, angle1 rotates the ellipsoid about its K33 axis (within the x - y plane). A positive value represents counter-clockwise rotation when viewed from any point on the positive K33 axis, looking toward the center of the ellipsoid. A value of zero indicates that the K11 axis lies within the x - z plane. If angle1 is not specified, default values of zero are assigned to angle1, angle2, and angle3, in which case the K11, K22, and K33 axes are aligned with the x, y, and z axes, respectively. Default is None.

  • angle2 (float) – is a rotation angle of the hydraulic conductivity tensor in degrees. The angle represents the second of three sequential rotations of the hydraulic conductivity ellipsoid. Following the rotation by angle1 described above, angle2 rotates the ellipsoid about its K22 axis (out of the x - y plane). An array can be specified for angle2 only if angle1 is also specified. A positive value of angle2 represents clockwise rotation when viewed from any point on the positive K22 axis, looking toward the center of the ellipsoid. A value of zero indicates that the K11 axis lies within the x - y plane. If angle2 is not specified, default values of zero are assigned to angle2 and angle3; connections that are not user-designated as vertical are assumed to be strictly horizontal (that is, to have no z component to their orientation); and connection lengths are based on horizontal distances. Default is None.

  • angle3 (float) – is a rotation angle of the hydraulic conductivity tensor in degrees. The angle represents the third of three sequential rotations of the hydraulic conductivity ellipsoid. Following the rotations by angle1 and angle2 described above, angle3 rotates the ellipsoid about its K11 axis. An array can be specified for angle3 only if angle1 and angle2 are also specified. An array must be specified for angle3 if angle2 is specified. A positive value of angle3 represents clockwise rotation when viewed from any point on the positive K11 axis, looking toward the center of the ellipsoid. A value of zero indicates that the K22 axis lies within the x - y plane. Default is None.

  • cell_averaging (str) – Method calculating horizontal cell connection conductance. Options: {“harmonic”, “logarithmic”, “mean-log_k”, “mean-mean_k”} Default: “harmonic”

  • save_flows (({True, False}, optional)) – keyword to indicate that cell-by-cell flow terms will be written to the file specified with “budget save file” in Output Control. Default is False.

  • starting_head_as_confined_thickness (({True, False}, optional)) – indicates that cells having a negative icelltype are confined, and their cell thickness for conductance calculations will be computed as strt-bot rather than top-bot. (THICKSTRT) Default is False.

  • variable_vertical_conductance (({True, False}, optional)) – keyword to indicate that the vertical conductance will be calculated using the saturated thickness and properties of the overlying cell and the thickness and properties of the underlying cell. if the dewatered keyword is also specified, then the vertical conductance is calculated using only the saturated thickness and properties of the overlying cell if the head in the underlying cell is below its top. if these keywords are not specified, then the default condition is to calculate the vertical conductance at the start of the simulation using the initial head and the cell properties. the vertical conductance remains constant for the entire simulation. (VARIABLECV) Default is False.

  • dewatered (({True, False}, optional)) – If the dewatered keyword is specified, then the vertical conductance is calculated using only the saturated thickness and properties of the overlying cell if the head in the underlying cell is below its top. Default is False.

  • perched (({True, False}, optional)) – keyword to indicate that when a cell is overlying a dewatered convertible cell, the head difference used in Darcy’s Law is equal to the head in the overlying cell minus the bottom elevation of the overlying cell. If not specified, then the default is to use the head difference between the two cells. Default is False.

  • save_specific_discharge (({True, False}, optional)) – keyword to indicate that x, y, and z components of specific discharge will be calculated at cell centers and written to the cell-by-cell flow file, which is specified with“budget save file” in Output Control. If this option is activated, then additional information may be required in the discretization packages and the GWF Exchange package (if GWF models are coupled). Specifically, angldegx must be specified in the connectiondata block of the disu package; angldegx must also be specified for the GWF Exchange as an auxiliary variable. disu package has not been implemented yet. Default is False.

angle1
angle2
angle3
cell_averaging
dewatered
icelltype
k
k22
k33
perched
render(directory, pkgname, *args, **kwargs)[source]
rewet
rewet_factor
rewet_iterations
rewet_layer
rewet_method
save_flows
save_specific_discharge
starting_head_as_confined_thickness
variable_vertical_conductance
class imod.mf6.OutputControl(save_head, save_budget)[source]

Bases: imod.mf6.pkgbase.Package

The Output Control Option determines how and when heads are printed to the listing file and/or written to a separate binary output file. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=47

Parameters
  • save_head (bool, or xr.DataArray of bools) – Bool per stress period.

  • save_budget (bool, or xr.DataArray of bools) – Bool per stress period.

render(directory, pkgname, globaltimes)[source]
save_budget
save_head
class imod.mf6.Recharge(rate, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

Recharge Package. Any number of RCH Packages can be specified for a single groundwater flow model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=79

Parameters
  • rate (array of floats (xr.DataArray)) – is the recharge flux rate (LT −1). This rate is multiplied inside the program by the surface area of the cell to calculate the volumetric recharge rate. A time-series name may be specified.

  • print_input (({True, False}, optional)) – keyword to indicate that the list of recharge information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of recharge flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT”is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that recharge flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

observations
print_flows
print_input
rate
save_flows
class imod.mf6.River(stage, conductance, bottom_elevation, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

River package. Any number of RIV Packages can be specified for a single groundwater flow model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=71

Parameters
  • stage (array of floats (xr.DataArray)) – is the head in the river.

  • conductance (array of floats (xr.DataArray)) – is the riverbed hydraulic conductance.

  • bottom_elevation (array of floats (xr.DataArray)) – is the elevation of the bottom of the riverbed.

  • print_input (({True, False}, optional)) – keyword to indicate that the list of drain information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of drain flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT” is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that drain flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

bottom_elevation
conductance
observations
print_flows
print_input
save_flows
stage
class imod.mf6.Solution(outer_hclose, outer_maximum, inner_maximum, inner_hclose, inner_rclose, linear_acceleration, outer_rclosebnd=None, under_relaxation=None, under_relaxation_theta=None, under_relaxation_kappa=None, under_relaxation_gamma=None, under_relaxation_momentum=None, backtracking_number=None, backtracking_tolerance=None, backtracking_reduction_factor=None, backtracking_residual_limit=None, rclose_option=None, relaxation_factor=None, preconditioner_levels=None, preconditioner_drop_tolerance=None, number_orthogonalizations=None, scaling_method=None, reordering_method=None, print_option='summary', csv_output=False, no_ptc=False)[source]

Bases: imod.mf6.pkgbase.Package

Iterative Model Solution. The model solution will solve all of the models that are added to it, as specified in the simulation name file, and will include Numerical Exchanges, if they are present. The iterative model solution requires specification of both nonlinear and linear settings. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=147

Three predifined solutions settings are available: SolutionPresetSimple, SolutionPresetModerate and SolutionPresetComplex. When using one of the predefined solutions only the print_option, csv_output, and no_ptc have to be defined. The default values for each are described below.

Parameters
  • outer_hclose (float) – real value defining 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 outer_hclose, iteration stops. Commonly, outer_hclose equals 0.01. SolutionPresetSimple: 0.001 SolutionPresetModerate: 0.01 SolutionPresetComplex: 0.1

  • outer_maximum (int) – integer value defining the maximum number of outer (nonlinear) iterations – that is, calls to the solution routine. For a linear problem outer_maximum should be 1. SolutionPresetSimple: 25 SolutionPresetModerate: 50 SolutionPresetComplex: 100

  • inner_maximum (int) – integer value defining the maximum number of inner (linear) iterations. The number typically depends on the characteristics of the matrix solution scheme being used. For nonlinear problems, inner_maximum usually ranges from 60 to 600; a value of 100 will be sufficient for most linear problems. SolutionPresetSimple: 50 SolutionPresetModerate: 100 SolutionPresetComplex: 500

  • inner_hclose (float) – real value defining 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 inner_hclose, the matrix solver assumes convergence. Commonly, inner_hclose is set an order of magnitude less than the outer_hclose value. SolutionPresetSimple: 0.001 SolutionPresetModerate: 0.01 SolutionPresetComplex: 0.1

  • inner_rclose (float) – real value that defines the flow residual tolerance for convergence of the IMS linear solver and specific flow residual criteria used. 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 6 length and time units. Usually a value of 1.0 × 10−1 is sufficient for the flow-residual criteria when meters and seconds are the defined MODFLOW 6 length and time. SolutionPresetSimple: 0.1 SolutionPresetModerate: 0.1 SolutionPresetComplex: 0.1

  • linear_acceleration (str) – options: {“cg”, “bicgstab”} a keyword that defines the linear acceleration method used by the default IMS linear solvers. CG - preconditioned conjugate gradient method. BICGSTAB - preconditioned bi-conjugate gradient stabilized method. SolutionPresetSimple: “cg” SolutionPresetModerate: “bicgstab” SolutionPresetComplex: “bicgstab”

  • outer_rclosebnd (float, optional) – real value defining the residual tolerance for convergence of model packages that solve a separate equation not solved by the IMS linear solver. This value represents the maximum allowable residual between successive outer iterations at any single model package element. An example of a model package that would use OUTER RCLOSEBND to evaluate convergence is the SFR package which solves a continuity equation for each reach. Default value: None SolutionPresetSimple: 0.1 SolutionPresetModerate: 0.1 SolutionPresetComplex: 0.1

  • under_relaxation (str, optional) – options: {“None”, “simple”, “cooley”, “bdb”} is an optional keyword that defines the nonlinear relative_rclose schemes used. By default under_relaxation is not used. None - relative_rclose is not used. simple - Simple relative_rclose scheme with a fixed relaxation factor is used. cooley - Cooley relative_rclose scheme is used. dbd - delta-bar-delta relative_rclose is used. Note that the relative_rclose schemes are used in conjunction with problems that use the Newton-Raphson formulation, however, experience has indicated that the Cooley relative_rclose and damping work well also for the Picard scheme with the wet/dry options of MODFLOW 6. Default value: None SolutionPresetSimple: None SolutionPresetModerate: “dbd” SolutionPresetComplex: “dbd”

  • under_relaxation_theta (float, optional) – real value defining the reduction factor for the learning rate (underrelaxation term) of the delta-bar-delta algorithm. The value of under relaxation theta is between zero and one. If the change in the variable (head) is of opposite sign to that of the previous iteration, the relative_rclose term is reduced by a factor of under relaxation theta. The value usually ranges from 0.3 to 0.9; a value of 0.7 works well for most problems. under relaxation theta only needs to be specified if under relaxation is dbd. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.9 SolutionPresetComplex: 0.8

  • under_relaxation_kappa (float, optional) – real value defining the increment for the learning rate (relative_rclose term) of the delta-bar-delta algorithm. The value of under relaxation kappa is between zero and one. If the change in the variable (head) is of the same sign to that of the previous iteration, the relative_rclose term is increased by an increment of under_relaxation_kappa. The value usually ranges from 0.03 to 0.3; a value of 0.1 works well for most problems. under relaxation kappa only needs to be specified if under relaxation is dbd. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0001 SolutionPresetComplex: 0.0001

  • under_relaxation_gamma (float, optional) – real value defining the history or memory term factor of the delta-bardelta algorithm. under relaxation gamma is between zero and 1 but cannot be equal to one. When under relaxation gamma is zero, only the most recent history (previous iteration value) is maintained. As under relaxation 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 nonconvergence. The value usually ranges from 0.1 to 0.3; a value of 0.2 works well for most problems. under relaxation gamma only needs to be specified if under relaxation is not none. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 0.0

  • under_relaxation_momentum (float, optional) – real value defining the fraction of past history changes that is added as a momentum term to the step change for a nonlinear iteration. The value of under relaxation momentum 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. under relaxation momentum only needs to be specified if under relaxation is dbd. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 0.0

  • backtracking_number (int, optional) – integer value defining the maximum number of backtracking iterations allowed for residual reduction computations. If backtracking number = 0 then the backtracking iterations are omitted. The value usually ranges from 2 to 20; a value of 10 works well for most problems. Default value: None SolutionPresetSimple: 0 SolutionPresetModerate: 0 SolutionPresetComplex: 20

  • backtracking_tolerance (float, optional) – real value defining the tolerance for residual change that is allowed for residual reduction computations. backtracking tolerance 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 106; a value of 104 works well for most problems but lower values like 1.1 may be required for harder problems. backtracking tolerance only needs to be specified if backtracking_number is greater than zero. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 1.05

  • backtracking_reduction_factor (float, optional) – real value defining the reduction in step size used for residual reduction computations. The value of backtracking reduction factor is between 142 MODFLOW 6 – Description of Input and Output zero and one. The value usually ranges from 0.1 to 0.3; a value of 0.2 works well for most problems. backtracking_reduction_factor only needs to be specified if backtracking number is greater than zero. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 0.1

  • backtracking_residual_limit (float, optional) – real value defining the limit to which the residual is reduced with backtracking. If the residual is smaller than backtracking_residual_limit, 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. backtracking residual limit only needs to be specified if backtracking_number is greater than zero. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 0.002

  • rclose_option (str, optional) – options: {“strict”, “l2norm_rclose”, “relative_rclose”} an optional keyword that defines the specific flow residual criterion used. strict– an optional keyword that is used to specify that inner rclose represents a infinity-norm (absolute convergence criteria) and that the head and flow convergence criteria must be met on the first inner iteration (this criteria is equivalent to the criteria used by the MODFLOW-2005 PCG package (Hill, 1990)). l2norm_rclose – an optionalkeyword that is used to specify that inner rclose represents a l-2 norm closure criteria instead of a infinity-norm (absolute convergence criteria). When l2norm_rclose is specified, a reasonable initial inner rclose value is 0.1 times the number of active cells when meters and seconds are the defined MODFLOW 6 length and time. relative_rclose – an optional keyword that is used to specify that inner_rclose represents a relative L-2 Norm reduction closure criteria instead of a infinity-Norm (absolute convergence criteria). When relative_rclose is specified, a reasonable initial inner_rclose value is 1.0 × 10−4 and convergence is achieved for a given inner (linear) iteration when ∆h ≤ inner_hclose and the current L-2 Norm is ≤ the product of the relativ_rclose and the initial L-2 Norm for the current inner (linear) iteration. If rclose_option is not specified, an absolute residual (infinity-norm) criterion is used. Default value: None SolutionPresetSimple: “strict” SolutionPresetModerate: “strict” SolutionPresetComplex: “strict”

  • relaxation_factor (float, optional) – optional real value that defines the relaxation factor used by the incomplete LU factorization preconditioners (MILU(0) and MILUT). relaxation_factor is unitless and should be greater than or equal to 0.0 and less than or equal to 1.0. relaxation_factor Iterative Model Solution 143 values of about 1.0 are commonly used, and experience suggests that convergence can be optimized in some cases with relax values of 0.97. A relaxation_factor value of 0.0 will result in either ILU(0) or ILUT preconditioning (depending on the value specified for preconditioner_levels and/or preconditioner_drop_tolerance). By default, relaxation_factor is zero. Default value: None SolutionPresetSimple: 0.0 SolutionPresetModerate: 0 SolutionPresetComplex: 0.0

  • preconditioner_levels (int, optional) – optional integer value defining the level of fill for ILU decomposition used in the ILUT and MILUT preconditioners. 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 a drop tolerance. Specification of a preconditioner_levels value greater than zero results in use of the ILUT preconditioner. By default, preconditioner_levels is zero and the zero-fill incomplete LU factorization preconditioners (ILU(0) and MILU(0)) are used. Default value: None SolutionPresetSimple: 0 SolutionPresetModerate: 0 SolutionPresetComplex: 5

  • preconditioner_drop_tolerance (float, optional) – optional real value that defines the drop tolerance used to drop preconditioner terms based on the magnitude of matrix entries in the ILUT and MILUT preconditioners. A value of 10−4 works well for most problems. By default, preconditioner_drop_tolerance is zero and the zero-fill incomplete LU factorization preconditioners (ILU(0) and MILU(0)) are used. Default value: None SolutionPresetSimple: 0 SolutionPresetModerate: 0.0 SolutionPresetComplex: 0.0001

  • number_orthogonalizations (int, optional) – optional integer value defining the interval used to explicitly recalculate the residual of the flow equation using the solver coefficient matrix, the latest head estimates, and the right hand side. For problems that benefit from explicit recalculation of the residual, a number between 4 and 10 is appropriate. By default, number_orthogonalizations is zero. Default value: None SolutionPresetSimple: 0 SolutionPresetModerate: 0 SolutionPresetComplex: 2

  • scaling_method (str) – options: {“None”, “diagonal”, “l2norm”} an optional keyword that defines the matrix scaling approach used. By default, matrix scaling is not applied. None - no matrix scaling applied. diagonal - symmetric matrix scaling using the POLCG preconditioner scaling method in Hill (1992). l2norm - symmetric matrix scaling using the L2 norm. Default value: None SolutionPresetSimple: None SolutionPresetModerate: None SolutionPresetComplex: None

  • reordering_method (str) – options: {“None”, “rcm”, “md”} an optional keyword that defines the matrix reordering approach used. By default, matrix reordering is not applied. None - original ordering. rcm - reverse Cuthill McKee ordering. md - minimum degree ordering Default value: None SolutionPresetSimple: None SolutionPresetModerate: None SolutionPresetComplex: None

  • print_option (str) – options: {“None”, “summary”, “all”} is a flag that controls printing of convergence information from the solver. None - means print nothing. summary - means print only the total number of iterations and nonlinear residual reduction summaries. all - means print linear matrix solver convergence information to the solution listing file and model specific linear matrix solver convergence information to each model listing file in addition to SUMMARY information. Default value: “summary” SolutionPresetSimple: No Default SolutionPresetModerate: No Default SolutionPresetComplex: No Default

  • csv_output (str, optional) – False if no csv is to be written for the output, enter str of filename if csv is to be written. Default value: False SolutionPresetSimple: No Default SolutionPresetModerate: No Default SolutionPresetComplex: No Default

  • no_ptc (({True, False}, optional)) – is a flag that is used to disable pseudo-transient continuation (PTC). Option only applies to steady-state stress periods for models using the Newton-Raphson formulation. For many problems, PTC can significantly improve convergence behavior for steady-state simulations, and for this reason it is active by default. In some cases, however, PTC can worsen the convergence behavior, especially when the initial conditions are similar to the solution. When the initial conditions are similar to, or exactly the same as, the solution and convergence is slow, then this NO PTC option should be used to deactivate PTC. This NO PTC option should also be used in order to compare convergence behavior with other MODFLOW versions, as PTC is only available in MODFLOW 6. Default value: False SolutionPresetSimple: No Default SolutionPresetModerate: No Default SolutionPresetComplex: No Default

backtracking_number
backtracking_reduction_factor
backtracking_residual_limit
backtracking_tolerance
csv_output
inner_hclose
inner_maximum
inner_rclose
linear_acceleration
no_ptc
number_orthogonalizations
outer_hclose
outer_maximum
outer_rclosebnd
preconditioner_drop_tolerance
preconditioner_levels
print_option
rclose_option
relaxation_factor
reordering_method
scaling_method
under_relaxation
under_relaxation_gamma
under_relaxation_kappa
under_relaxation_momentum
under_relaxation_theta
imod.mf6.SolutionPresetComplex(print_option, csv_output, no_ptc)[source]
imod.mf6.SolutionPresetModerate(print_option, csv_output, no_ptc)[source]
imod.mf6.SolutionPresetSimple(print_option, csv_output, no_ptc)[source]
class imod.mf6.Storage(specific_storage, specific_yield, transient, convertible)[source]

Bases: imod.mf6.pkgbase.Package

Storage Package. If the STO Package is not included for a model, then storage changes will not be calculated, and thus, the model will be steady state. Only one STO Package can be specified for a GWF model. The option to use a keyword to indicate that the SS array is read as storage coefficient rather than specific storage has not been implemented yet. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=57

Parameters
  • specific_storage (array of floats (xr.DataArray)) – Is specific storage. Specific storage values must be greater than or equal to 0. (ss)

  • specific_yield (array of floats (xr.DataArray)) – Is specific yield. Specific yield values must be greater than or equal to 0. Specific yield does not have to be specified if there are no convertible cells (convertible=0 in every cell). (sy)

  • convertible (array of int (xr.DataArray)) – Is a flag for each cell that specifies whether or not a cell is convertible for the storage calculation. 0 indicates confined storage is used. >0 indicates confined storage is used when head is above cell top and a mixed formulation of unconfined and confined storage is used when head is below cell top. (iconvert)

  • transient (({True, False})) – Boolean to indicate if the model is transient or steady-state.

convertible
render(directory, pkgname, globaltimes)[source]
specific_storage
specific_yield
transient
class imod.mf6.StructuredDiscretization(top, bottom, idomain)[source]

Bases: imod.mf6.pkgbase.Package

Discretization information for structered grids is specified using the file. (DIS6) Only one discretization input file (DISU6, DISV6 or DIS6) can be specified for a model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=35

Parameters
  • top (array of floats (xr.DataArray)) – is the top elevation for each cell in the top model layer.

  • bottom (array of floats (xr.DataArray)) – is the bottom elevation for each cell.

  • idomain (array of integers (xr.DataArray)) – Indicates the existence status of a cell. Horizontal discretization information will be derived from the x and y coordinates of the DataArray. If the idomain value for a cell is 0, the cell does not exist in the simulation. Input and output values will be read and written for the cell, but internal to the program, the cell is excluded from the solution. If the idomain value for a cell is 1, the cell exists in the simulation. if the idomain value for a cell is -1, the cell does not exist in the simulation. Furthermore, the first existing cell above will be connected to the first existing cell below. This type of cell is referred to as a “vertical pass through”cell.

bottom
idomain
render(directory, pkgname, *args, **kwargs)[source]
top
class imod.mf6.TimeDiscretization(timestep_duration, n_timesteps=1, timestep_multiplier=1.0)[source]

Bases: imod.mf6.pkgbase.Package

Timing for all models of the simulation is controlled by the Temporal Discretization (TDIS) Package. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=17

timestep_duration: float

is the length of a stress period. (PERLEN)

n_timesteps: int, optional

is the number of time steps in a stress period (nstp). Default value: 1

timestep_multiplier: float, optional

is the multiplier for the length of successive time steps. The length of a time step is calculated by multiplying the length of the previous time step by timestep_multiplier (TSMULT). Default value: 1.0

n_timesteps
render()[source]
timestep_duration
timestep_multiplier
write(directory, name)[source]
class imod.mf6.Well(layer, row, column, rate, print_input=False, print_flows=False, save_flows=False, observations=None)[source]

Bases: imod.mf6.pkgbase.BoundaryCondition

WEL package. Any number of WEL Packages can be specified for a single groundwater flow model. https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.0.4.pdf#page=63

Parameters
  • layer (int or list of int) – Modellayer in which the well is located.

  • row (int or list of int) – Row in which the well is located.

  • column (int or list of int) – Column in which the well is located.

  • rate (float or list of floats) – is the volumetric well rate. A positive value indicates well (injection) and a negative value indicates discharge (extraction) (q).

  • print_input (({True, False}, optional)) – keyword to indicate that the list of well information will be written to the listing file immediately after it is read. Default is False.

  • print_flows (({True, False}, optional)) – Indicates that the list of well flow rates will be printed to the listing file for every stress period time step in which “BUDGET PRINT”is specified in Output Control. If there is no Output Control option and PRINT FLOWS is specified, then flow rates are printed for the last time step of each stress period. Default is False.

  • save_flows (({True, False}, optional)) – Indicates that well flow terms will be written to the file specified with “BUDGET FILEOUT” in Output Control. Default is False.

  • observations ([Not yet supported.]) – Default is None.

column
layer
observations
print_flows
print_input
rate
row
save_flows
to_sparse(arrlist, *args, **kwargs)[source]

Convert from dense arrays to list based input

imod.mf6.open_hds(hds_path, grb_path, dry_nan=False)[source]

Open head data