1 Solver
Solver()Defines the numerical solver options.
For more details see https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/#solver_options.
1.1 Attributes
| Name | Type | Description |
|---|---|---|
| algorithm | str | The used numerical time integration algorithm (Optional, defaults to QNDF) |
| saveat | float | Time interval in seconds between saves of output data. 0 saves every timestep, inf only saves at start- and endtime. (Optional, defaults to 86400) |
| dt | float | Timestep of the solver. (Optional, defaults to None which implies adaptive timestepping) |
| dtmin | float | The minimum allowed timestep of the solver (Optional, defaults to 0.0) |
| dtmax | float | The maximum allowed timestep size (Optional, defaults to 0.0 which implies the total length of the simulation) |
| force_dtmin | bool | If a smaller dt than dtmin is needed to meet the set error tolerances, the simulation stops, unless force_dtmin = true (Optional, defaults to False) |
| abstol | float | The absolute tolerance for adaptive timestepping (Optional, defaults to 1e-7) |
| reltol | float | The relative tolerance for adaptive timestepping (Optional, defaults to 1e-7) |
| maxiters | int | The total number of linear iterations over the whole simulation. (Defaults to 1e9, only needs to be increased for extremely long simulations) |
| sparse | bool | Whether a sparse Jacobian matrix is used, which gives a significant speedup for models with >~10 basins. |
| autodiff | bool | Whether automatic differentiation instead of fine difference is used to compute the Jacobian. (Optional, defaults to true) |
| depth_threshold | float | Universal depth at which the low storage factor kicks in |
| level_difference_threshold | float | Universal reduction factor threshold for the level difference of Pump/Outlet and TabulatedRatingCurve nodes |
| evaporate_mass | bool | Whether mass is lost due to evaporation in water quality calculations. (Optional, defaults to true) |
| specialize | bool | Trades initialization speed for simulation speed, useful for long-running simulations. (Optional, defaults to false) |
1.2 Methods
| Name | Description |
|---|---|
| diff | Compare two instances of a BaseModel. |
| model_dump |
1.2.1 diff
Solver.diff(other, ignore_meta=False)Compare two instances of a BaseModel.
** Warning: This method is experimental and is likely to change. **
If they are equal, return None. Otherwise, return a nested dictionary with the differences. When the differences are not a DataFrame (like the toml config), the dict has self and other as key. For DataFrames we return a dict with diff as key, and a datacompy Comparison object.
When ignore_meta is set to True, the meta_* columns in the DataFrames are ignored. Note that in that case the key will still be returned and the value will be None.
1.2.1.1 Examples
>>> nbasic == basic
False
>>> x = nbasic.diff(basic)
{'basin': {'node': {'diff': <datacompy.core.Compare object at 0x16e5a45c0>},
'static': {'diff': <datacompy.core.Compare object at 0x16eb90080>}},
'solver': {'saveat': {'other': 86400.0, 'self': 0.0}}}
>>> x["basin"]["static"]["diff"].report()
DataComPy Comparison
--------------------
...1.2.2 model_dump
Solver.model_dump(**kwargs)