Skip to content

Commit

Permalink
deploy: 66491af
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Oct 21, 2024
1 parent f0d5358 commit aaf1f28
Show file tree
Hide file tree
Showing 20 changed files with 297 additions and 180 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@
<span class="menu-text">Known Issues</span></a>
</div>
</li>
<li class="sidebar-item">
<span class="menu-text">contact.qmd</span>
</li>
</ul>
</div>
</nav>
Expand Down
22 changes: 11 additions & 11 deletions concept/allocation.html
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,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="e0a5cd70" class="cell" data-execution_count="1">
<div id="8abdc7c2" 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 @@ -602,25 +602,25 @@ <h2 data-number="4.4" class="anchored" data-anchor-id="example"><span class="hea
<div class="cell-output cell-output-stdout">
<pre><code>Min F[(Basin #5, UserDemand #6)]² + F[(Basin #2, UserDemand #3)]²
Subject to
flow_conservation[Basin #5] : F[(UserDemand #6, Basin #5)] - F[(Basin #5, UserDemand #6)] - F[(Basin #5, TabulatedRatingCurve #7)] + F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] = 0
flow_conservation[Terminal #8] : F[(TabulatedRatingCurve #7, Terminal #8)] = 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[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 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[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 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
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, TabulatedRatingCurve #7)] - F[(Basin #5, UserDemand #6)] + F[(UserDemand #6, Basin #5)] = 0
source[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 172800
source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
F[(UserDemand #6, Basin #5)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(FlowBoundary #1, Basin #2)] ≥ 0
F[(Basin #2, LinearResistance #4)] ≥ 0
F[(LinearResistance #4, Basin #2)] ≥ 0
F[(LinearResistance #4, Basin #5)] ≥ 0
F[(Basin #5, LinearResistance #4)] ≥ 0
F[(UserDemand #3, Basin #2)] ≥ 0
F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
F[(Basin #5, UserDemand #6)] ≥ 0
F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
F[(UserDemand #3, Basin #2)] ≥ 0
F[(Basin #2, UserDemand #3)] ≥ 0
F[(FlowBoundary #1, Basin #2)] ≥ 0
F[(LinearResistance #4, Basin #5)] ≥ 0
F[(Basin #5, LinearResistance #4)] ≥ 0
F[(UserDemand #6, Basin #5)] ≥ 0
</code></pre>
</div>
</div>
Expand Down
65 changes: 56 additions & 9 deletions concept/core.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,35 @@
<script src="../site_libs/quarto-diagram/mermaid-init.js"></script>
<link href="../site_libs/quarto-diagram/mermaid.css" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>

<script type="text/javascript">
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
window.Quarto = {
typesetMath
};
</script>

<link rel="stylesheet" href="../assets/styles.css">
</head>
Expand Down Expand Up @@ -220,7 +249,7 @@ <h2 id="toc-title">On this page</h2>
<ul>
<li><a href="#sec-simulationloop" id="toc-sec-simulationloop" class="nav-link active" data-scroll-target="#sec-simulationloop"><span class="header-section-number">1</span> The simulation loop</a></li>
<li><a href="#sec-nested-allocation" id="toc-sec-nested-allocation" class="nav-link" data-scroll-target="#sec-nested-allocation"><span class="header-section-number">2</span> Nested allocation</a></li>
<li><a href="#substance-tracer-concentration-calculations" id="toc-substance-tracer-concentration-calculations" class="nav-link" data-scroll-target="#substance-tracer-concentration-calculations"><span class="header-section-number">3</span> Substance (tracer) concentration calculations</a></li>
<li><a href="#substance-tracer-concentrations" id="toc-substance-tracer-concentrations" class="nav-link" data-scroll-target="#substance-tracer-concentrations"><span class="header-section-number">3</span> Substance (tracer) concentrations</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -368,17 +397,35 @@ <h1 data-number="2"><span class="header-section-number">2</span> Nested allocati
</div>
</div>
</section>
<section id="substance-tracer-concentration-calculations" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Substance (tracer) concentration calculations</h1>
<p>Ribasim can calculate concentrations of conservative tracers (i.e.&nbsp;substances that are non-reactive). It does so by calculating the mass transports by flows for each timestep, in the <code>update_cumulative_flows!</code> callback. Specifically, for each Basin at each timestep we calculate:</p>
<section id="substance-tracer-concentrations" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Substance (tracer) concentrations</h1>
<div class="callout callout-style-default callout-caution 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">
Caution
</div>
</div>
<div class="callout-body-container callout-body">
<p>This is an unsupported experimental feature and is disabled by default. We advise to use the <a href="@sec-waterquality">Delwaq coupling</a> for tracer calculations. If you’re interested in using this experimental feature, please <a href="../contact.qmd">contact us</a>.</p>
</div>
</div>
<p>Ribasim can calculate concentrations of conservative tracers (i.e.&nbsp;substances that are non-reactive). It does so by calculating the mass transports by flows for each timestep, in the <code>update_cumulative_flows!</code> callback. Specifically, for each Basin at each timestep it calculates:</p>
<ul>
<li>all mass inflows (flow * source_concentration) given the edge inflows</li>
<li>update the concentrations in the Basin based on the added storage (previous storage + inflows)</li>
<li>all mass outflows (flow * basin_concentration_state) give the edge outflows</li>
<li>all mass inflows (<span class="math inline">\(flow * source\_concentration\)</span>) given the edge inflows</li>
<li>update the concentrations in the Basin based on the added storage (<span class="math inline">\(previous storage + inflows\)</span>)</li>
<li>all mass outflows (<span class="math inline">\(flow * basin\_concentration\_state\)</span>) give the edge outflows</li>
<li>update the concentrations in the Basin based on the current storage</li>
</ul>
<p>We thus keep track of both mass and concentration of substances for each Basin. Note that we have not added the substance mass to the states, and we assume that concentrations of flows are piecewise constant over a timestep.</p>
<p>By default we calculate concentrations for the following source tracers. - Continuity (mass balance, fraction of all water sources, sum of all other source tracers) - Initial (fraction of initial storages) - LevelBoundary, FlowBoundary, UserDemand, Drainage, Precipitation (fraction of different boundaries)</p>
<p>We thus keep track of both mass and concentration of substances for each Basin. Note that we have not added the substance mass to the states, and we assume that concentrations of flows are piecewise constant over a timestep. This excludes the use of tracer injections.</p>
<p>By default the following source tracers are enabled.</p>
<ul>
<li>Continuity (mass balance, fraction of all water sources, sum of all other source tracers)</li>
<li>Initial (fraction of initial storages)</li>
<li>LevelBoundary, FlowBoundary, UserDemand, Drainage, Precipitation (fraction of different boundaries)</li>
</ul>


</section>
Expand Down
4 changes: 2 additions & 2 deletions guide/coupling.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#imod" id="toc-imod" class="nav-link active" data-scroll-target="#imod"><span class="header-section-number">1</span> iMOD</a></li>
<li><a href="#water-quality" id="toc-water-quality" class="nav-link" data-scroll-target="#water-quality"><span class="header-section-number">2</span> Water quality</a>
<li><a href="#sec-waterquality" id="toc-sec-waterquality" class="nav-link" data-scroll-target="#sec-waterquality"><span class="header-section-number">2</span> Water quality</a>
<ul class="collapse">
<li><a href="#setup" id="toc-setup" class="nav-link" data-scroll-target="#setup"><span class="header-section-number">2.1</span> Setup</a></li>
</ul></li>
Expand Down Expand Up @@ -229,7 +229,7 @@ <h1 class="title">Coupling</h1>
<h1 data-number="1"><span class="header-section-number">1</span> iMOD</h1>
<p>Ribasim can also be (online) coupled to other kernels with the help of iMOD Coupler. The corresponding documentation can be found within the <a href="https://deltares.github.io/iMOD-Documentation/coupler.html">iMOD Suite Documentation</a>.</p>
</section>
<section id="water-quality" class="level1" data-number="2">
<section id="sec-waterquality" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Water quality</h1>
<p>Ribasim can be offline coupled to Delwaq, the Deltares Water Quality model.</p>
<div class="cell" data-layout-align="default">
Expand Down
Loading

0 comments on commit aaf1f28

Please sign in to comment.