Skip to content

Commit

Permalink
deploy: 8fa48b6
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Mar 1, 2024
1 parent ff83ac0 commit 0ac1a29
Show file tree
Hide file tree
Showing 9 changed files with 943 additions and 890 deletions.
362 changes: 181 additions & 181 deletions build/index.html

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions core/allocation.html
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ <h1 data-number="5"><span class="header-section-number">5</span> Solving the all
<section id="example" class="level2" data-number="5.1">
<h2 data-number="5.1" class="anchored" data-anchor-id="example"><span class="header-section-number">5.1</span> Example</h2>
<p>The following is an example of an optimization problem for the example shown <a href="../python/examples.html#model-with-allocation">here</a>:</p>
<div id="074dac79" class="cell" data-execution_count="1">
<div id="dcecef74" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Ribasim</span></span>
Expand All @@ -648,45 +648,45 @@ <h2 data-number="5.1" class="anchored" data-anchor-id="example"><span class="hea
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a><span class="fu">println</span>(p.allocation.allocation_models[<span class="fl">1</span>].problem)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Min F_abs_user_demand[UserDemand #6] + F_abs_user_demand[UserDemand #3] + F_abs_user_demand[UserDemand #13] + F_abs_basin[Basin #5] + F_abs_basin[Basin #2] + F_abs_basin[Basin #12]
<pre><code>Min F_abs_user_demand[UserDemand #6] + F_abs_user_demand[UserDemand #3] + F_abs_user_demand[UserDemand #13] + F_abs_basin[Basin #12] + F_abs_basin[Basin #2] + F_abs_basin[Basin #5]
Subject to
flow_conservation[Basin #5] : F[(Basin #5, TabulatedRatingCurve #7)] + F[(Basin #5, UserDemand #6)] - F[(Basin #2, Basin #5)] + F[(Basin #5, Basin #2)] + F_basin_in[Basin #5] - F_basin_out[Basin #5] = 0
flow_conservation[Basin #2] : F[(Basin #2, UserDemand #3)] + F[(Basin #2, Basin #5)] - F[(FlowBoundary #1, Basin #2)] - F[(Basin #5, Basin #2)] + F_basin_in[Basin #2] - F_basin_out[Basin #2] = 0
flow_conservation[Basin #12] : -F[(TabulatedRatingCurve #7, Basin #12)] + F[(Basin #12, UserDemand #13)] + F_basin_in[Basin #12] - F_basin_out[Basin #12] = 0
F[(FlowBoundary #1, Basin #2)] ≥ 0
F[(Basin #2, UserDemand #3)] ≥ 0
F[(UserDemand #13, Terminal #10)] ≥ 0
F[(Basin #5, Basin #2)] ≥ 0
F[(Basin #2, Basin #5)] ≥ 0
F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
F[(TabulatedRatingCurve #7, Basin #12)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(Basin #12, UserDemand #13)] ≥ 0
F[(TabulatedRatingCurve #7, Terminal #10)] ≥ 0
F_basin_in[Basin #12] ≥ 0
F_basin_in[Basin #2] ≥ 0
F_basin_in[Basin #5] ≥ 0
F_basin_out[Basin #12] ≥ 0
F_basin_out[Basin #2] ≥ 0
F_basin_out[Basin #5] ≥ 0
abs_positive_user_demand[UserDemand #6] : -F[(Basin #5, UserDemand #6)] + F_abs_user_demand[UserDemand #6] ≥ -1.5
abs_positive_user_demand[UserDemand #3] : -F[(Basin #2, UserDemand #3)] + F_abs_user_demand[UserDemand #3] ≥ 0
abs_positive_user_demand[UserDemand #13] : -F[(Basin #12, UserDemand #13)] + F_abs_user_demand[UserDemand #13] ≥ 0
abs_negative_user_demand[UserDemand #6] : F[(Basin #5, UserDemand #6)] + F_abs_user_demand[UserDemand #6] ≥ 1.5
abs_negative_user_demand[UserDemand #3] : F[(Basin #2, UserDemand #3)] + F_abs_user_demand[UserDemand #3] ≥ 0
abs_negative_user_demand[UserDemand #13] : F[(Basin #12, UserDemand #13)] + F_abs_user_demand[UserDemand #13] ≥ 0
abs_positive_basin[Basin #5] : -F_basin_in[Basin #5] + F_abs_basin[Basin #5] ≥ 0
abs_positive_basin[Basin #2] : -F_basin_in[Basin #2] + F_abs_basin[Basin #2] ≥ 0
abs_positive_basin[Basin #12] : -F_basin_in[Basin #12] + F_abs_basin[Basin #12] ≥ 0
abs_negative_basin[Basin #5] : F_basin_in[Basin #5] + F_abs_basin[Basin #5] ≥ 0
abs_negative_basin[Basin #2] : F_basin_in[Basin #2] + F_abs_basin[Basin #2] ≥ 0
abs_positive_basin[Basin #2] : -F_basin_in[Basin #2] + F_abs_basin[Basin #2] ≥ 0
abs_positive_basin[Basin #5] : -F_basin_in[Basin #5] + F_abs_basin[Basin #5] ≥ 0
abs_negative_basin[Basin #12] : F_basin_in[Basin #12] + F_abs_basin[Basin #12] ≥ 0
abs_negative_basin[Basin #2] : F_basin_in[Basin #2] + F_abs_basin[Basin #2] ≥ 0
abs_negative_basin[Basin #5] : F_basin_in[Basin #5] + F_abs_basin[Basin #5] ≥ 0
flow_conservation[Basin #12] : -F[(TabulatedRatingCurve #7, Basin #12)] + F[(Basin #12, UserDemand #13)] + F_basin_in[Basin #12] - F_basin_out[Basin #12] = 0
flow_conservation[Basin #2] : -F[(FlowBoundary #1, Basin #2)] + F[(Basin #2, UserDemand #3)] - F[(Basin #5, Basin #2)] + F[(Basin #2, Basin #5)] + F_basin_in[Basin #2] - F_basin_out[Basin #2] = 0
flow_conservation[Basin #5] : F[(Basin #5, Basin #2)] - F[(Basin #2, Basin #5)] + F[(Basin #5, TabulatedRatingCurve #7)] + F[(Basin #5, UserDemand #6)] + F_basin_in[Basin #5] - F_basin_out[Basin #5] = 0
source[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 1
return_flow[UserDemand #13] : F[(UserDemand #13, Terminal #10)] ≤ 0
fractional_flow[(TabulatedRatingCurve #7, Basin #12)] : -0.4 F[(Basin #5, TabulatedRatingCurve #7)] + F[(TabulatedRatingCurve #7, Basin #12)] ≤ 0
basin_outflow[Basin #5] : F_basin_out[Basin #5] ≤ 0
basin_outflow[Basin #2] : F_basin_out[Basin #2] ≤ 0
basin_outflow[Basin #12] : F_basin_out[Basin #12] ≤ 0
F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
F[(TabulatedRatingCurve #7, Terminal #10)] ≥ 0
F[(TabulatedRatingCurve #7, Basin #12)] ≥ 0
F[(Basin #2, UserDemand #3)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(Basin #12, UserDemand #13)] ≥ 0
F[(Basin #2, Basin #5)] ≥ 0
F[(FlowBoundary #1, Basin #2)] ≥ 0
F[(Basin #5, Basin #2)] ≥ 0
F[(UserDemand #13, Terminal #10)] ≥ 0
F_basin_in[Basin #5] ≥ 0
F_basin_in[Basin #2] ≥ 0
F_basin_in[Basin #12] ≥ 0
F_basin_out[Basin #5] ≥ 0
F_basin_out[Basin #2] ≥ 0
F_basin_out[Basin #12] ≥ 0
basin_outflow[Basin #2] : F_basin_out[Basin #2] ≤ 0
basin_outflow[Basin #5] : F_basin_out[Basin #5] ≤ 0
</code></pre>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/equations.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ <h2 data-number="2.1" class="anchored" data-anchor-id="sec-reduction_factor"><sp
\end{cases}
\end{align}\]</span></p>
<p>Here <span class="math inline">\(p &gt; 0\)</span> is the threshold value which determines the interval <span class="math inline">\([0,p]\)</span> of the smooth transition between <span class="math inline">\(0\)</span> and <span class="math inline">\(1\)</span>, see the plot below.</p>
<div id="e462f3b2" class="cell" data-execution_count="1">
<div id="2717a5cb" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> numpy <span class="im">as</span> np</span>
Expand Down
55 changes: 47 additions & 8 deletions core/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ <h2 id="toc-title">On this page</h2>
<li><a href="#basin-time" id="toc-basin-time" class="nav-link" data-scroll-target="#basin-time"><span class="header-section-number">5.1</span> Basin / time</a></li>
<li><a href="#basin-state" id="toc-basin-state" class="nav-link" data-scroll-target="#basin-state"><span class="header-section-number">5.2</span> Basin / state</a></li>
<li><a href="#basin-profile" id="toc-basin-profile" class="nav-link" data-scroll-target="#basin-profile"><span class="header-section-number">5.3</span> Basin / profile</a></li>
<li><a href="#basin-subgrid" id="toc-basin-subgrid" class="nav-link" data-scroll-target="#basin-subgrid"><span class="header-section-number">5.4</span> Basin / subgrid</a></li>
<li><a href="#basin-area" id="toc-basin-area" class="nav-link" data-scroll-target="#basin-area"><span class="header-section-number">5.4</span> Basin / area</a></li>
<li><a href="#basin-subgrid" id="toc-basin-subgrid" class="nav-link" data-scroll-target="#basin-subgrid"><span class="header-section-number">5.5</span> Basin / subgrid</a></li>
</ul></li>
<li><a href="#sec-fractional-flow" id="toc-sec-fractional-flow" class="nav-link" data-scroll-target="#sec-fractional-flow"><span class="header-section-number">6</span> FractionalFlow</a></li>
<li><a href="#sec-tabulated-rating-curve" id="toc-sec-tabulated-rating-curve" class="nav-link" data-scroll-target="#sec-tabulated-rating-curve"><span class="header-section-number">7</span> TabulatedRatingCurve</a>
Expand Down Expand Up @@ -877,8 +878,33 @@ <h2 data-number="5.3" class="anchored" data-anchor-id="basin-profile"><span clas
</table>
<p>We use the symbol <span class="math inline">\(A\)</span> for area, <span class="math inline">\(h\)</span> for level and <span class="math inline">\(S\)</span> for storage. The profile provides a function <span class="math inline">\(A(h)\)</span> for each basin. Internally this get converted to two functions, <span class="math inline">\(A(S)\)</span> and <span class="math inline">\(h(S)\)</span>, by integrating over the function, setting the storage to zero for the bottom of the profile. The minimum area cannot be zero to avoid numerical issues. The maximum area is used to convert the precipitation flux into an inflow.</p>
</section>
<section id="basin-subgrid" class="level2" data-number="5.4">
<h2 data-number="5.4" class="anchored" data-anchor-id="basin-subgrid"><span class="header-section-number">5.4</span> Basin / subgrid</h2>
<section id="basin-area" class="level2" data-number="5.4">
<h2 data-number="5.4" class="anchored" data-anchor-id="basin-area"><span class="header-section-number">5.4</span> Basin / area</h2>
<p>The optional area table is not used during computation, but provides a place to associate areas in the form of polygons to Basins. Using this makes it easier to recognize which water or land surfaces are represented by Basins.</p>
<table class="table">
<thead>
<tr class="header">
<th>column</th>
<th>type</th>
<th>restriction</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>node_id</td>
<td>Int</td>
<td>sorted</td>
</tr>
<tr class="even">
<td>geom</td>
<td>Polygon or MultiPolygon</td>
<td>(optional)</td>
</tr>
</tbody>
</table>
</section>
<section id="basin-subgrid" class="level2" data-number="5.5">
<h2 data-number="5.5" class="anchored" data-anchor-id="basin-subgrid"><span class="header-section-number">5.5</span> Basin / subgrid</h2>
<p>The subgrid_level table defines a piecewise linear interpolation from a basin water level to a subgrid element water level. Many subgrid elements may be associated with a single basin, each with distinct interpolation functions. This functionality can be used to translate a single lumped basin level to a more spatially detailed representation (e.g comparable to the output of a hydrodynamic simulation).</p>
<table class="table">
<thead>
Expand Down Expand Up @@ -1762,15 +1788,28 @@ <h2 data-number="17.1" class="anchored" data-anchor-id="discretecontrol-conditio
</section>
<section id="discretecontrol-logic" class="level2" data-number="17.2">
<h2 data-number="17.2" class="anchored" data-anchor-id="discretecontrol-logic"><span class="header-section-number">17.2</span> DiscreteControl / logic</h2>
<p>The logic schema defines which control states are triggered based on the truth of the conditions a discrete_control node listens to. DiscreteControl is applied in the Julia core as follows:</p>
<p>The logic schema defines which control states are triggered based on the truth of the conditions a DiscreteControl node listens to. DiscreteControl is applied in the Julia core as follows:</p>
<ul>
<li>During the simulation it is checked whether the truth of any of the conditions changes.</li>
<li>When a condition changes, the corresponding discrete_control node id is retrieved (node_id in the condition schema above).</li>
<li>The truth value of all the conditions this discrete_control node listens to are retrieved, in the order as they are specified in the condition schema. This is then converted into a string of “T” for true and “F” for false. This string we call the truth state.*</li>
<li>The table below determines for the given discrete_control node ID and truth state what the corresponding control state is.</li>
<li>For all the nodes this discrete_control node affects (as given by the “control” edges in <a href="../core/usage.html#edge">Edges / static</a>), their parameters are set to those parameters in <code>NodeType / static</code> corresponding to the determined control state.</li>
<li>When a condition changes, the corresponding DiscreteControl node ID is retrieved (node_id in the condition schema above).</li>
<li>The truth value of all the conditions this DiscreteControl node listens to are retrieved, <strong>in the sorted order as specified in the condition schema</strong>. This is then converted into a string of “T” for true and “F” for false. This string we call the truth state.*</li>
<li>The table below determines for the given DiscreteControl node ID and truth state what the corresponding control state is.</li>
<li>For all the nodes this DiscreteControl node affects (as given by the “control” edges in <a href="../core/usage.html#edge">Edges / static</a>), their parameters are set to those parameters in <code>NodeType / static</code> corresponding to the determined control state.</li>
</ul>
<p>*. There is also a second truth state created in which for the last condition that changed it is specified whether it was an upcrossing (“U”) or downcrossing (“D”) of the threshold (greater than) value. If a control state is specified for a truth state that is crossing-specific, this takes precedence over the control state for the truth state that contains only “T” and “F”.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>When creating truth states, it is important to not use the order of the condition table as you provide it, but the order as it is written to the file. Users can provide tables in any order, but when writing the model it gets sorted in the required order as specified in the schema.</p>
</div>
</div>
<table class="table">
<colgroup>
<col style="width: 37%">
Expand Down
4 changes: 2 additions & 2 deletions core/validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ <h1 class="title">Validation</h1>
<section id="connectivity" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Connectivity</h1>
<p>In the table below, each column shows which node types are allowed to be downstream (or ‘down-control’) of the node type at the top of the column.</p>
<div id="745a8ff7" class="cell" data-execution_count="1">
<div id="31965fd9" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Ribasim</span></span>
Expand Down Expand Up @@ -546,7 +546,7 @@ <h1 data-number="1"><span class="header-section-number">1</span> Connectivity</h
<section id="neighbor-amounts" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Neighbor amounts</h1>
<p>The table below shows for each node type between which bounds the amount of in- and outneighbors must be, for both flow and control edges.</p>
<div id="85fb885b" class="cell" data-execution_count="2">
<div id="2b464328" class="cell" data-execution_count="2">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>flow_in_min <span class="op">=</span> <span class="fu">Vector</span><span class="dt">{String}</span>()</span>
Expand Down
Loading

0 comments on commit 0ac1a29

Please sign in to comment.