Skip to content

Commit

Permalink
deploy: 5c08e2f
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Dec 12, 2024
1 parent 07b2841 commit 83f1b31
Show file tree
Hide file tree
Showing 15 changed files with 2,270 additions and 2,270 deletions.
24 changes: 12 additions & 12 deletions concept/allocation.html
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ <h2 data-number="4.3" class="anchored" data-anchor-id="the-optimization-constrai
<section id="example" class="level2" data-number="4.4">
<h2 data-number="4.4" class="anchored" data-anchor-id="example"><span class="header-section-number">4.4</span> Example</h2>
<p>The following is an example of an optimization problem for the example shown <a href="../guide/examples.html#model-with-allocation-user-demand">here</a>:</p>
<div id="563f3c00" class="cell" data-execution_count="1">
<div id="d4015e6a" 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 @@ -598,26 +598,26 @@ <h2 data-number="4.4" class="anchored" data-anchor-id="example"><span class="hea
<span id="cb1-16"><a href="#cb1-16" 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[(Basin #5, UserDemand #6)]² + 0.6666666666666666 F[(Basin #2, UserDemand #3)]² - 2 F[(Basin #2, UserDemand #3)] + 1.5
<pre><code>Min 0.6666666666666666 F[(Basin #2, UserDemand #3)]² + F[(Basin #5, UserDemand #6)]² - 2 F[(Basin #2, UserDemand #3)] + 1.5
Subject to
F[(FlowBoundary #1, Basin #2)] ≥ 0
F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
F[(UserDemand #3, Basin #2)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(UserDemand #6, Basin #5)] ≥ 0
F[(Basin #2, LinearResistance #4)] ≥ 0
F[(LinearResistance #4, Basin #2)] ≥ 0
F[(Basin #2, UserDemand #3)] ≥ 0
F[(UserDemand #3, Basin #2)] ≥ 0
F[(LinearResistance #4, Basin #5)] ≥ 0
F[(Basin #5, LinearResistance #4)] ≥ 0
F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
F[(Basin #2, UserDemand #3)] ≥ 0
F[(UserDemand #6, Basin #5)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
F[(FlowBoundary #1, Basin #2)] ≥ 0
source_boundary[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 0
source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
flow_conservation[Basin #5] : F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] + F[(UserDemand #6, Basin #5)] - F[(Basin #5, UserDemand #6)] - F[(Basin #5, TabulatedRatingCurve #7)] = 0
flow_conservation[Terminal #8] : F[(TabulatedRatingCurve #7, Terminal #8)] = 0
flow_conservation[TabulatedRatingCurve #7] : F[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 0
flow_conservation[Basin #5] : -F[(Basin #5, TabulatedRatingCurve #7)] - F[(Basin #5, UserDemand #6)] + F[(UserDemand #6, Basin #5)] + F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] = 0
flow_conservation[Basin #2] : F[(FlowBoundary #1, Basin #2)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] - F[(Basin #2, UserDemand #3)] = 0
flow_conservation[Basin #2] : -F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, UserDemand #3)] + F[(FlowBoundary #1, Basin #2)] = 0
flow_conservation[TabulatedRatingCurve #7] : -F[(TabulatedRatingCurve #7, Terminal #8)] + 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
</code></pre>
</div>
Expand Down
16 changes: 8 additions & 8 deletions dev/callstacks.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ <h2 id="toc-title">On this page</h2>

<section id="call-stacks" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Call stacks</h1>
<div id="e327d1d1" class="cell" data-execution_count="1">
<div id="d6e1812f" 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">CairoMakie</span></span>
Expand All @@ -319,7 +319,7 @@ <h1 data-number="1"><span class="header-section-number">1</span> Call stacks</h1
<section id="parameter-initialization" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="parameter-initialization"><span class="header-section-number">1.1</span> Parameter initialization</h2>
<p>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 <code>load_structvector</code> and <code>parse_static_and_time</code>, as these are needed for parameter initialization for most node types.</p>
<div id="4b481d3e" class="cell" data-execution_count="2">
<div id="de7f38f1" 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><span class="im">using</span> <span class="bu">SQLite</span></span>
Expand Down Expand Up @@ -353,7 +353,7 @@ <h2 data-number="1.1" class="anchored" data-anchor-id="parameter-initialization"
<section id="water_balance" class="level2" data-number="1.2">
<h2 data-number="1.2" class="anchored" data-anchor-id="water_balance"><span class="header-section-number">1.2</span> <code>water_balance!</code></h2>
<p><code>water_balance!</code> is the right hand side function of the system of ODEs that is solved by the Ribasim core (for more details see <a href="../concept/equations.html#formal-model-description">here</a>). The various <code>formulate_flow!</code> methods are for flow rates as determined by different node types.</p>
<div id="739caf1e" class="cell" data-execution_count="3">
<div id="bda5ecad" class="cell" data-execution_count="3">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">OrdinaryDiffEqCore</span>: get_du</span>
Expand All @@ -375,7 +375,7 @@ <h2 data-number="1.2" class="anchored" data-anchor-id="water_balance"><span clas
<section id="allocation-initialization" class="level2" data-number="1.3">
<h2 data-number="1.3" class="anchored" data-anchor-id="allocation-initialization"><span class="header-section-number">1.3</span> Allocation initialization</h2>
<p>In this part of the code the data structures for allocation are set up. Most endpoints in <code>allocation_init.jl</code> set up data structures as defined in <a href="https://jump.dev/JuMP.jl/stable/">JuMP.jl</a>.</p>
<div id="a4036d4b" class="cell" data-execution_count="4">
<div id="33ab6461" class="cell" data-execution_count="4">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>toml_path <span class="op">=</span> <span class="fu">normpath</span>(</span>
Expand Down Expand Up @@ -403,7 +403,7 @@ <h2 data-number="1.3" class="anchored" data-anchor-id="allocation-initialization
<section id="allocation-run" class="level2" data-number="1.4">
<h2 data-number="1.4" class="anchored" data-anchor-id="allocation-run"><span class="header-section-number">1.4</span> Allocation run</h2>
<p>Running the allocation algorithm consists of running the optimization itself (which is handled in <code>JuMP.jl</code>), 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 <a href="../concept/allocation.html">here</a>.</p>
<div id="ea21e7fb" class="cell" data-execution_count="5">
<div id="abef7442" class="cell" data-execution_count="5">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>model <span class="op">=</span> Ribasim.<span class="fu">Model</span>(toml_path)</span>
Expand All @@ -422,7 +422,7 @@ <h2 data-number="1.4" class="anchored" data-anchor-id="allocation-run"><span cla
<section id="discrete-control" class="level2" data-number="1.5">
<h2 data-number="1.5" class="anchored" data-anchor-id="discrete-control"><span class="header-section-number">1.5</span> Discrete control</h2>
<p>Discrete control works by a <a href="https://docs.sciml.ai/DiffEqCallbacks/stable/output_saving/#DiffEqCallbacks.FunctionCallingCallback"><code>FunctionCallingCallback</code></a>, changing parameters when a change in control state is detected (see also <a href="../reference/node/discrete-control.html">here</a>).</p>
<div id="69fe5ee9" class="cell" data-execution_count="6">
<div id="ef8c613c" class="cell" data-execution_count="6">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>toml_path <span class="op">=</span></span>
Expand All @@ -446,7 +446,7 @@ <h2 data-number="1.5" class="anchored" data-anchor-id="discrete-control"><span c
<section id="writing-output" class="level2" data-number="1.6">
<h2 data-number="1.6" class="anchored" data-anchor-id="writing-output"><span class="header-section-number">1.6</span> Writing output</h2>
<p>Writing output (currently) happens only after the full simulation is finished. For more information on the different output tables see <a href="../reference/usage.html#results">here</a>.</p>
<div id="6b11e269" class="cell" data-execution_count="7">
<div id="079bb17e" class="cell" data-execution_count="7">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>toml_path <span class="op">=</span> <span class="fu">normpath</span>(<span class="pp">@__DIR__</span>, <span class="st">"../../generated_testmodels/basic_transient/ribasim.toml"</span>)</span>
Expand Down Expand Up @@ -901,7 +901,7 @@ <h2 data-number="1.6" class="anchored" data-anchor-id="writing-output"><span cla
</div>
</nav>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"closeEffect":"zoom","openEffect":"zoom","loop":false,"descPosition":"bottom","selector":".lightbox"});
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","loop":false,"closeEffect":"zoom","descPosition":"bottom","openEffect":"zoom"});
(function() {
let previousOnload = window.onload;
window.onload = () => {
Expand Down
Loading

0 comments on commit 83f1b31

Please sign in to comment.