From b2f546892a08c9ea5d65a25d54562aa476636285 Mon Sep 17 00:00:00 2001 From: SouthEndMusic Date: Tue, 3 Dec 2024 15:33:15 +0000 Subject: [PATCH] deploy: 5b5e99f1cf07e978c0d1ff892e920a64323e57a7 --- changelog.html | 35 +- concept/allocation.html | 28 +- dev/callstacks.html | 24 +- .../figure-html/cell-3-output-1.svg | 17186 ++++++++-------- .../figure-html/cell-4-output-1.svg | 2056 +- .../figure-html/cell-5-output-1.svg | 6087 +++--- .../figure-html/cell-6-output-1.svg | 5442 ++--- .../figure-html/cell-7-output-1.svg | 1045 +- .../figure-html/cell-8-output-1.svg | 2000 +- guide/delwaq.html | 166 +- guide/examples.html | 4 +- .../figure-html/cell-56-output-1.png | Bin 124281 -> 124250 bytes .../figure-html/cell-57-output-2.png | Bin 56341 -> 56319 bytes .../figure-html/cell-68-output-1.png | Bin 45327 -> 45327 bytes reference/node/basin.html | 14 +- reference/node/discrete-control.html | 2 +- reference/node/manning-resistance.html | 2 +- reference/node/tabulated-rating-curve.html | 2 +- reference/python/EdgeTable.html | 23 +- reference/test-models.html | 2 +- reference/usage.html | 5 - reference/validation.html | 4 +- search.json | 27 +- tutorial/irrigation-demand.html | 4 +- tutorial/reservoir.html | 4 +- 25 files changed, 17280 insertions(+), 16882 deletions(-) diff --git a/changelog.html b/changelog.html index 392392ebb..161f6ae3b 100644 --- a/changelog.html +++ b/changelog.html @@ -189,30 +189,33 @@

On this page

-
-

1.2.2 Changed

+
+

1.2.2 Changed

  • Refactor of the core to ensure smaller water balance errors. #1819
  • Make node_id globally unique. #1717
  • @@ -301,8 +310,8 @@

    #1653

-
-

1.3.2 Changed

+
+

1.3.2 Changed

  • Require QGIS 3.34 (LTR) or newer for Ribasim QGIS plugin.
@@ -332,8 +341,8 @@

#1479

-
-

1.4.2 Changed

+
+

1.4.2 Changed

  • Optimized performance.
  • Documentation has been overhauled to be more user-friendly.
  • @@ -359,8 +368,8 @@

    #1440

-
-

1.5.2 Changed

+
+

1.5.2 Changed

  • If negative storages inadvertently happen, we now throw an error. #1425
  • Users of the QGIS plugin need to remove the old version to avoid two copies due to #1453.
  • diff --git a/concept/allocation.html b/concept/allocation.html index 156914dfb..81a01b9f8 100644 --- a/concept/allocation.html +++ b/concept/allocation.html @@ -377,8 +377,8 @@

    3.1.2 Source flows

    Sources are indicated by a set of edges in the subnetwork \[ -E_S^\text{source} \subset E. -\] That is, if \((i,j) \in E_S^\text{source}\), then the average over the last allocation interval \(\Delta t_{\text{alloc}}\) of the of the flow over this edge \[ +E_S^\text{source} \subset E, +\] which are automatically inferred as all edges that point out of LevelBoundary or FlowBoundary nodes. That is, if \((i,j) \in E_S^\text{source}\), then the average over the last allocation interval \(\Delta t_{\text{alloc}}\) of the of the flow over this edge \[ \frac{1}{\Delta t_{\text{alloc}}}\int_{t - \Delta t_{\text{alloc}}}^tQ_{ij}(t') dt' \] is treated as a source flow in the allocation problem. These edges are either coming from a boundary/source node (e.g. a level or flow boundary) or connect the main network to a subnetwork. For the definition of \(Q_{ij}\) see the formal model description.

@@ -577,7 +577,7 @@

4.4 Example

The following is an example of an optimization problem for the example shown here:

-
+
Code
using Ribasim
@@ -600,25 +600,25 @@ 

Min F[(Basin #5, UserDemand #6)]² + 0.6666666666666666 F[(Basin #2, UserDemand #3)]² - 2 F[(Basin #2, UserDemand #3)] + 1.5
 Subject to
- source[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 0
+ source_boundary[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 0
  source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
  source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
- F[(LinearResistance #4, Basin #5)] ≥ 0
- F[(Basin #5, LinearResistance #4)] ≥ 0
+ F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
+ F[(FlowBoundary #1, Basin #2)] ≥ 0
  F[(Basin #5, UserDemand #6)] ≥ 0
- F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
  F[(UserDemand #6, Basin #5)] ≥ 0
- F[(Basin #2, UserDemand #3)] ≥ 0
  F[(Basin #2, LinearResistance #4)] ≥ 0
  F[(LinearResistance #4, Basin #2)] ≥ 0
- F[(FlowBoundary #1, Basin #2)] ≥ 0
- F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
  F[(UserDemand #3, Basin #2)] ≥ 0
- flow_conservation[LinearResistance #4] : -F[(LinearResistance #4, Basin #5)] + F[(Basin #5, LinearResistance #4)] + F[(Basin #2, LinearResistance #4)] - F[(LinearResistance #4, Basin #2)] = 0
- flow_conservation[Basin #2] : -F[(Basin #2, UserDemand #3)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(FlowBoundary #1, Basin #2)] + F[(UserDemand #3, Basin #2)] = 0
- flow_conservation[TabulatedRatingCurve #7] : F[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 0
+ F[(LinearResistance #4, Basin #5)] ≥ 0
+ F[(Basin #5, LinearResistance #4)] ≥ 0
+ F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
+ F[(Basin #2, UserDemand #3)] ≥ 0
+ flow_conservation[Basin #5] : -F[(Basin #5, UserDemand #6)] + F[(UserDemand #6, Basin #5)] + F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] - F[(Basin #5, TabulatedRatingCurve #7)] = 0
+ flow_conservation[LinearResistance #4] : F[(Basin #2, LinearResistance #4)] - F[(LinearResistance #4, Basin #2)] - F[(LinearResistance #4, Basin #5)] + F[(Basin #5, LinearResistance #4)] = 0
+ flow_conservation[TabulatedRatingCurve #7] : -F[(TabulatedRatingCurve #7, Terminal #8)] + F[(Basin #5, TabulatedRatingCurve #7)] = 0
  flow_conservation[Terminal #8] : F[(TabulatedRatingCurve #7, Terminal #8)] = 0
- flow_conservation[Basin #5] : F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] - F[(Basin #5, UserDemand #6)] - F[(Basin #5, TabulatedRatingCurve #7)] + F[(UserDemand #6, Basin #5)] = 0
+ flow_conservation[Basin #2] : F[(FlowBoundary #1, Basin #2)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, UserDemand #3)] = 0
 

diff --git a/dev/callstacks.html b/dev/callstacks.html index f1563261b..f92ddfd9f 100644 --- a/dev/callstacks.html +++ b/dev/callstacks.html @@ -297,7 +297,7 @@

On this page

1 Call stacks

-
+
Code
using CairoMakie
@@ -319,7 +319,7 @@ 

1 Call stacks

1.1 Parameter initialization

Parameter initialization is the process of reading the parameter values from the input files and storing them in data structures for easy access in the core. Most notable here is the convergence of many paths to load_structvector and parse_static_and_time, as these are needed for parameter initialization for most node types.

-
+
Code
using SQLite
@@ -353,7 +353,7 @@ 

1.2 water_balance!

water_balance! is the right hand side function of the system of ODEs that is solved by the Ribasim core (for more details see here). The various formulate_flow! methods are for flow rates as determined by different node types.

-
+
Code
using OrdinaryDiffEqCore: get_du
@@ -375,19 +375,21 @@ 

1.3 Allocation initialization

In this part of the code the data structures for allocation are set up. Most endpoints in allocation_init.jl set up data structures as defined in JuMP.jl.

-
+
Code
toml_path = normpath(
     @__DIR__,
     "../../generated_testmodels/main_network_with_subnetworks/ribasim.toml",
 )
-config = Ribasim.Config(toml_path; allocation_use_allocation = false)
+config = Ribasim.Config(toml_path)
 db_path = Ribasim.database_path(config)
 db = SQLite.DB(db_path)
 p = Ribasim.Parameters(db, config)
-graph, verts = tracecall((Ribasim,), Ribasim.initialize_allocation!, (p, config))
-plot_graph(graph)
+empty!(p.allocation.subnetwork_ids) +empty!(p.allocation.main_network_connections) +graph, verts = tracecall((Ribasim,), Ribasim.initialize_allocation!, (p, config)) +plot_graph(graph)

@@ -401,7 +403,7 @@

1.4 Allocation run

Running the allocation algorithm consists of running the optimization itself (which is handled in JuMP.jl), and all Ribasim functions around it are used for communicating data between the optimization problem and the physical layer, as well as gathering output data. Fore more information on the allocation algorithm see here.

-
+
Code
model = Ribasim.Model(toml_path)
@@ -420,7 +422,7 @@ 

1.5 Discrete control

Discrete control works by a FunctionCallingCallback, changing parameters when a change in control state is detected (see also here).

-
+
Code
toml_path =
@@ -444,7 +446,7 @@ 

1.6 Writing output

Writing output (currently) happens only after the full simulation is finished. For more information on the different output tables see here.

-
+
Code
toml_path = normpath(@__DIR__, "../../generated_testmodels/basic_transient/ribasim.toml")
@@ -899,7 +901,7 @@ 

-