imod.mf6.AdaptiveTimeStepping#

class imod.mf6.AdaptiveTimeStepping(*_, **__)[source]#

Adaptive Time Stepping (ATS) Package for MODFLOW 6.

This package allows for adaptive time stepping in the simulation, adjusting the time step size based on model convergence and stability criteria.

Parameters:
  • dt_init (xr.DataArray of floats) – Initial time step length, dt0 in MODFLOW 6. If zero, then the final time step from the previous stress period will be used as the initial time step.

  • dt_min (xr.DataArray of floats) – Minimum allowed time length size. This value must be greater than zero and less than dtmax. dtmin must be a small value in order to ensure that simulation times end at the end of stress periods and the end of the simulation. A small value, such as 1.e-5, is recommended.

  • dt_max (xr.DataArray of floats) – Maximum allowed time step length. This value must be greater than dtmin.

  • dt_multiplier (xr.DataArray of floats, default 0.0) – Multiplier for the time step length, dtadj in MODFLOW6. If the number of outer solver iterations are less than the product of the maximum number of outer iterations (outer_maximum) and ats_outer_maximum_fraction (an optional variable in imod.mf6.Solution), then the time step length is multiplied by dt_multiplier. If the number of outer solver iterations are greater than the product of the maximum number of outer iterations and 1.0 minus ats_outer_maximum_fraction, then the time step length is divided by dt_multiplier. dt_multiplier must be zero, one, or greater than one. If dt_multiplier is zero or one, then it has no effect on the simulation. A value between 2.0 and 5.0 can be used as an initial estimate.

  • dt_fail_divisor (xr.DataArray of floats, default 0.0) – Divisor of the time step length when a time step fails to converge. If there is solver failure, then the time step will be tried again with a shorter time step length calculated as the previous time step length divided by dt_fail_divisor. dt_fail_divisor must be zero, one, or greater than one. If dt_fail_divisor is zero or one, then time steps will not be retried with shorter lengths. In this case, the program will terminate with an error, or it will continue of the CONTINUE option is set in the simulation name file. Initial tests with this variable should be set to 5.0 or larger to determine if convergence can be achieved.

  • validate ({True, False}) – Flag to indicate whether the package should be validated upon initialization. Defaults to True.

Examples

Create an Adaptive Time Stepping package with an initial time step of 0.1 days, a minimum time step of 0.1 days, a maximum time step of 10 days, a time step multiplier of 2.0 for all stress periods, and a time step fail divisor of 5.0:

>>> ats = imod.mf6.AdaptiveTimeStepping(
...     dt_init=0.1,
...     dt_min=0.1,
...     dt_max=10.0,
...     dt_multiplier=2.0
...     dt_fail_divisor=5.0,
... )

Assign this to a simulation:

>>> simulation = imod.mf6.Modflow6Simulation()
>>> simulation["ats"] = ats

Create an Adaptive Time Stepping package with different settings for dt_init two times. The time discretization created by imod.mf6.Modflow6Simulation.create_time_discretization() will determine to which stress periods these will be assigned eventually.

>>> dt_init = xr.DataArray(
...     [0.1, 0.5],
...     dims=["time"],
...     coords={"time": [np.datetime64("2024-01-01"), np.datetime64("2024-01-02")]}
... )
>>> simulation["ats"] = imod.mf6.AdaptiveTimeStepping(
...     dt_init=dt_init,
...     dt_min=0.1,
...     dt_max=10.0,
...     dt_multiplier=2.0
...     dt_fail_divisor=5.0,
... )

Use the Adaptive Time Stepping package together with an advection package such as imod.mf6.AdvectionTVD and set the ats_percel argument to adapt the time step based on the maximum fraction of a cell that a solute parcel is allowed to travel:

>>> simulation["transport_model"]["adv"] = imod.mf6.AdvectionTVD(
...     ats_percel=0.95,
... )
__init__(dt_init, dt_min, dt_max, dt_multiplier=0.0, dt_fail_divisor=0.0, validate=True)[source]#

Methods

__init__(dt_init, dt_min, dt_max[, ...])

clip_box([time_min, time_max, layer_min, ...])

Clip a package by a bounding box (time, layer, y, x).

copy()

Copy package into a new package of the same type.

from_file(path, **kwargs)

Loads an imod mf6 package from a file (currently only netcdf and zarr are supported).

get_regrid_methods()

Returns the default regrid methods for this package.

is_empty([ignore_time])

Returns True if the package is empty, that is if it contains only no-data values.

mask(mask)

Mask values outside of domain.

regrid_like(target_grid, regrid_cache[, ...])

Creates a package of the same type as this package, based on another discretization.

to_netcdf(*args[, mdal_compliant, crs])

Write dataset contents to a netCDF file.

write(pkgname, globaltimes, directory[, ...])

Write package to file

Attributes

auxiliary_data_fields

dataset