Skip to content

Commit

Permalink
build based on 16fde73
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Aug 18, 2024
1 parent bb49ab3 commit d87ddd2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-18T10:02:03","documenter_version":"1.5.0"}}
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-18T10:15:48","documenter_version":"1.5.0"}}
23 changes: 14 additions & 9 deletions dev/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,22 @@
for i in 1:segments
UNIT_VECTORS0[:, i] .= [0, 0, 1.0]
SEGMENTS0[:, i] .= POS0[:, i+1] - POS0[:, i]
end</code></pre><p>The first example of such a model is the script <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_04.jl">Tether_04.jl</a> which is derived from the last example.</p><h2 id="Segmented-tether-with-correct-force-distribution"><a class="docs-heading-anchor" href="#Segmented-tether-with-correct-force-distribution">Segmented tether with correct force distribution</a><a id="Segmented-tether-with-correct-force-distribution-1"></a><a class="docs-heading-anchor-permalink" href="#Segmented-tether-with-correct-force-distribution" title="Permalink"></a></h2><p>In the script <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.jl#L61">Tether_05.jl</a>, the spring force is distributed correctly on the two masses attached to the spring as shown here:</p><pre><code class="language-julia hljs"> if i == segments
push!(eqs, total_force[:, i+1] ~ spring_force[:, i])
push!(eqs, acc[:, i+1] ~ G_EARTH + total_force[:, i+1] / (0.5 * mass))
push!(eqs, total_force[:, i] ~ spring_force[:, i-1] - spring_force[:, i])
end</code></pre><p>The first example of such a model is the script <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_04.jl">Tether_04.jl</a> which is derived from the last example.</p><h2 id="Segmented-tether-with-correct-force-distribution"><a class="docs-heading-anchor" href="#Segmented-tether-with-correct-force-distribution">Segmented tether with correct force distribution</a><a id="Segmented-tether-with-correct-force-distribution-1"></a><a class="docs-heading-anchor-permalink" href="#Segmented-tether-with-correct-force-distribution" title="Permalink"></a></h2><p>In the script <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.jl#L61">Tether_05.jl</a>, the spring force is distributed correctly on the two masses attached to the spring as shown here:</p><pre><code class="language-julia hljs"># loop over all tether particles to apply the forces and calculate the accelerations
for i in 1:(segments+1)
global eqs2; local eqs
eqs = []
if i == segments+1
push!(eqs, total_force[:, i] ~ spring_force[:, i-1])
push!(eqs, acc[:, i] ~ G_EARTH + total_force[:, i] / (0.5 * mass))
elseif i == 1
push!(eqs, total_force[:, i] ~ spring_force[:, i])
push!(eqs, acc[:, i+1] ~ G_EARTH + total_force[:, i+1] / mass)
push!(eqs, total_force[:, i] ~ spring_force[:, i])
push!(eqs, acc[:, i] ~ zeros(3))
else
push!(eqs, total_force[:, i] ~ spring_force[:, i-1] - spring_force[:, i])
push!(eqs, acc[:, i+1] ~ G_EARTH + total_force[:, i+1] / mass)
end</code></pre><p>We loop backward over the segments. For the last segment we calculate the force at both of its particles, starting with the last particle, because on the last particle, only one force is acting. On particle <span>$n-1$</span> two spring forces are acting in the opposite direction.</p><p><strong>Julia code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.jl">Tether_05.jl</a></p><p><strong>Python code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.py">Tether_05.py</a></p><p>Finally, in this example, we plot the result dynamically as 2D video. Screenshot:</p><p><img src="../docs/images/Tether2d.png" alt="Tether 2D"/></p><h2 id="Multi-segment-tether-reeling-out"><a class="docs-heading-anchor" href="#Multi-segment-tether-reeling-out">Multi-segment tether reeling out</a><a id="Multi-segment-tether-reeling-out-1"></a><a class="docs-heading-anchor-permalink" href="#Multi-segment-tether-reeling-out" title="Permalink"></a></h2><p>In this example, we assume a constant reel-out speed of <span>$V_{RO}=2m/s$</span>. When reeling out the following values need to be dynamically calculated:</p><ul><li>unstretched length of a tether segment</li><li>mass of the tether segment</li><li>spring constant</li><li>damping constant</li></ul><p>We do this in the following way at <a href="https://github.com/ufechner7/Tethers.jl/blob/87635d9df32f3ded49d0a394b613b412c2c83d55/src/Tether_06.jl#L76C1-L79C59">line 76ff</a>:</p><pre><code class="language-julia hljs">length ~ L0 + V_RO*t
push!(eqs, acc[:, i] ~ G_EARTH + total_force[:, i] / mass)
end
eqs2 = vcat(eqs2, reduce(vcat, eqs))
end</code></pre><p>We loop over the particles. The first and the last particle only one spring force is acting. On the other particles two spring forces are acting in the opposite direction. Because the first particle is fixed we set its acceleration to zero.</p><p><strong>Julia code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.jl">Tether_05.jl</a></p><p><strong>Python code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_05.py">Tether_05.py</a></p><p>Finally, in this example, we plot the result dynamically as 2D video. Screenshot:</p><p><img src="../docs/images/Tether2d.png" alt="Tether 2D"/></p><h2 id="Multi-segment-tether-reeling-out"><a class="docs-heading-anchor" href="#Multi-segment-tether-reeling-out">Multi-segment tether reeling out</a><a id="Multi-segment-tether-reeling-out-1"></a><a class="docs-heading-anchor-permalink" href="#Multi-segment-tether-reeling-out" title="Permalink"></a></h2><p>In this example, we assume a constant reel-out speed of <span>$V_{RO}=2m/s$</span>. When reeling out the following values need to be dynamically calculated:</p><ul><li>unstretched length of a tether segment</li><li>mass of the tether segment</li><li>spring constant</li><li>damping constant</li></ul><p>We do this in the following way at <a href="https://github.com/ufechner7/Tethers.jl/blob/87635d9df32f3ded49d0a394b613b412c2c83d55/src/Tether_06.jl#L76C1-L79C59">line 76ff</a>:</p><pre><code class="language-julia hljs">length ~ L0 + V_RO*t
m_tether_particle ~ mass_per_meter * (length/segments)
c_spring ~ C_SPRING / (length/segments)
damping ~ DAMPING / (length/segments)</code></pre><p>where <code>L0</code> is the unstretched length of the complete tether at <span>$t=0$</span>. </p><p><strong>Julia code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_06.jl">Tether_06.jl</a></p><p>The IDA solver, used for Python has a very high numerical damping. Therefore we had to multiply the damping coefficient with a factor of <span>$0.045$</span> to achieve a more-or-less realistic result.</p><p><strong>Python code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_06.py">Tether_06.py</a></p><h3 id="Refactoring-the-code,-add-a-Settings-struct-and-splitting-it-into-functions"><a class="docs-heading-anchor" href="#Refactoring-the-code,-add-a-Settings-struct-and-splitting-it-into-functions">Refactoring the code, add a Settings struct and splitting it into functions</a><a id="Refactoring-the-code,-add-a-Settings-struct-and-splitting-it-into-functions-1"></a><a class="docs-heading-anchor-permalink" href="#Refactoring-the-code,-add-a-Settings-struct-and-splitting-it-into-functions" title="Permalink"></a></h3><p><strong>Julia code:</strong> <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_06b.jl">Tether_06b.jl</a>.</p><p>If you want to have fast code, that can be reused and tested using unit tests, then it is better to put your code in functions and to avoid global variables. We demonstrate that in this example.</p><p>First, the settings are stored in a <code>struct</code> type:</p><pre><code class="language-julia hljs">@with_kw mutable struct Settings @deftype Float64
Expand Down Expand Up @@ -113,4 +118,4 @@
end
@named sys = ODESystem(eqs, t; continuous_events = cb)</code></pre><h2 id="Segmented-tether-with-aerodynamic-drag"><a class="docs-heading-anchor" href="#Segmented-tether-with-aerodynamic-drag">Segmented tether with aerodynamic drag</a><a id="Segmented-tether-with-aerodynamic-drag-1"></a><a class="docs-heading-anchor-permalink" href="#Segmented-tether-with-aerodynamic-drag" title="Permalink"></a></h2><p>In the script <a href="https://github.com/ufechner7/Tethers.jl/blob/main/src/Tether_07.jl">Tether_07.jl</a>, the tether drag has been added.</p><p>The following lines calculate the tether drag and add half of the drag force to the two particles at the end of each segment:</p><pre><code class="language-julia hljs"> v_app_perp[:, i] ~ v_apparent[:, i] - (v_apparent[:, i] ⋅ unit_vector[:, i]) .* unit_vector[:, i],
norm_v_app[i] ~ norm(v_app_perp[:, i]),
half_drag_force[:, i] .~ 0.25 * se.rho * se.cd_tether * norm_v_app[i] * (norm1[i]*se.d_tether/1000.0)</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../theory/">« Theory</a><a class="docs-footer-nextpage" href="../vscode/">VSCode IDE »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.5.0 on <span class="colophon-date" title="Sunday 18 August 2024 10:02">Sunday 18 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
half_drag_force[:, i] .~ 0.25 * se.rho * se.cd_tether * norm_v_app[i] * (norm1[i]*se.d_tether/1000.0)</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../theory/">« Theory</a><a class="docs-footer-nextpage" href="../vscode/">VSCode IDE »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.5.0 on <span class="colophon-date" title="Sunday 18 August 2024 10:15">Sunday 18 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit d87ddd2

Please sign in to comment.