Skip to content

Commit 8b7eeea

Browse files
committed
deploy: 254933e
1 parent 3d86fb4 commit 8b7eeea

8 files changed

Lines changed: 71 additions & 163 deletions

File tree

.doctrees/3_numerical.doctree

-9.6 KB
Binary file not shown.

.doctrees/5_gui.doctree

108 Bytes
Binary file not shown.

.doctrees/environment.pickle

0 Bytes
Binary file not shown.

3_numerical.html

Lines changed: 34 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -105,106 +105,46 @@
105105
</section>
106106
<section id="time-integration">
107107
<span id="marching"></span><h3>Time Integration<a class="headerlink" href="#time-integration" title="Link to this heading"></a></h3>
108-
<p>Consider the initial-value problem for particle advection in a velocity field</p>
108+
<p>Consider the initialvalue problem for passive tracer advection in a continuous velocity field</p>
109109
<div class="math notranslate nohighlight">
110-
\[\frac{d\mathbf{x}}{dt} = \sigma\,\mathbf{u}(\mathbf{x},t),
111-
\quad \mathbf{x}(t_n) = \mathbf{x}_n,\]</div>
112-
<p>where <span class="math notranslate nohighlight">\(\sigma = \pm 1\)</span> indicates forward/backward advection.</p>
110+
\[\frac{d\mathbf{x}}{dt} = \sigma\,\mathbf{u}(\mathbf{x},t)\,,
111+
\mathbf{x}(t_n)=\mathbf{x}_n\,,\]</div>
112+
<p>where <span class="math notranslate nohighlight">\(\sigma = \pm1\)</span> selects forward or backward integration.</p>
113113
<p><strong>Explicit Euler Method</strong></p>
114-
<p>Given <span class="math notranslate nohighlight">\(\mathbf{x}_n\)</span> at time <span class="math notranslate nohighlight">\(t_n\)</span>, the first-order (Euler) update is</p>
114+
<p>The first‐order explicit Euler scheme advances the position by sampling the velocity at the beginning of the time step:</p>
115115
<div class="math notranslate nohighlight">
116-
\[\mathbf{x}_{n+1} = \mathbf{x}_n + \Delta t\,f(\mathbf{x}_n,t_n)
117-
= \mathbf{x}_n + \sigma\,\Delta t\,\mathbf{u}(\mathbf{x}_n,t_n)\]</div>
118-
<p>Implementation steps:</p>
119-
<blockquote>
120-
<div><ol class="arabic">
121-
<li><p>Evaluate velocity:
122-
.. math:</p>
123-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">u</span><span class="p">}</span><span class="n">_n</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">u</span><span class="p">}(</span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span><span class="p">,</span> <span class="n">t_n</span><span class="p">)</span>
124-
</pre></div>
125-
</div>
126-
</li>
127-
<li><p>Advance position:
128-
.. math:</p>
129-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_</span><span class="p">{</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">}</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span> <span class="o">+</span> \<span class="n">sigma</span>\<span class="p">,</span>\<span class="n">Delta</span> <span class="n">t</span>\<span class="p">,</span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">u</span><span class="p">}</span><span class="n">_n</span>
130-
</pre></div>
131-
</div>
132-
</li>
133-
</ol>
134-
</div></blockquote>
135-
<p>This method is simple but incurs <span class="math notranslate nohighlight">\(O(\Delta t)\)</span> local truncation error.</p>
136-
<p><strong>Second-Order Runge–Kutta (Heun’s Method)</strong></p>
137-
<p>A two-stage explicit scheme with <span class="math notranslate nohighlight">\(O(\Delta t^2)\)</span> accuracy:</p>
116+
\[\begin{split}\mathbf{u}_n = \mathbf{u}(\mathbf{x}_n,t_n),\\
117+
\mathbf{x}_{n+1} = \mathbf{x}_n + \sigma\,\Delta t\,\mathbf{u}_n.\end{split}\]</div>
118+
<p>This method incurs a global error of order <span class="math notranslate nohighlight">\(O(\Delta t)\)</span> and requires only one velocity evaluation per step.</p>
119+
<p><strong>Second‐Order Runge–Kutta (Heun’s Method)</strong></p>
120+
<p>Heun’s method attains second‐order accuracy by combining predictor and corrector slopes:</p>
138121
<div class="math notranslate nohighlight">
139-
\[\begin{split}k_1 &amp;= f(\mathbf{x}_n, t_n),\\
140-
\mathbf{x}^* &amp;= \mathbf{x}_n + \Delta t\,k_1,\\
141-
k_2 &amp;= f(\mathbf{x}^*, t_n + \Delta t),\\
142-
\mathbf{x}_{n+1} &amp;= \mathbf{x}_n + \tfrac{\Delta t}{2}\,(k_1 + k_2).\end{split}\]</div>
143-
<p>Implementation steps:</p>
144-
<blockquote>
145-
<div><ol class="arabic">
146-
<li><p>Compute <span class="math notranslate nohighlight">\(k_1 = \sigma\,\mathbf{u}(\mathbf{x}_n, t_n)\)</span>.</p></li>
147-
<li><p>Predict step:
148-
.. math:</p>
149-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="o">^*</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span> <span class="o">+</span> \<span class="n">sigma</span>\<span class="p">,</span>\<span class="n">Delta</span> <span class="n">t</span>\<span class="p">,</span><span class="n">k_1</span>
150-
</pre></div>
151-
</div>
152-
</li>
153-
<li><p>Compute <span class="math notranslate nohighlight">\(k_2 = \sigma\,\mathbf{u}(\mathbf{x}^*, t_n + \Delta t)\)</span>.</p></li>
154-
<li><p>Update:
155-
.. math:</p>
156-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_</span><span class="p">{</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">}</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span> <span class="o">+</span> \<span class="n">tfrac</span><span class="p">{</span>\<span class="n">sigma</span>\<span class="p">,</span>\<span class="n">Delta</span> <span class="n">t</span><span class="p">}{</span><span class="mi">2</span><span class="p">}</span>\<span class="p">,(</span><span class="n">k_1</span> <span class="o">+</span> <span class="n">k_2</span><span class="p">)</span>
157-
</pre></div>
158-
</div>
159-
</li>
160-
</ol>
161-
</div></blockquote>
162-
<p><strong>Classical Fourth-Order Runge–Kutta (RK4)</strong></p>
163-
<p>A four-stage scheme with <span class="math notranslate nohighlight">\(O(\Delta t^4)\)</span> accuracy:</p>
122+
\[\begin{split}k_1 = \sigma\,\mathbf{u}(\mathbf{x}_n,t_n),\\
123+
\mathbf{x}^* = \mathbf{x}_n + \Delta t\,k_1,\\
124+
k_2 = \sigma\,\mathbf{u}(\mathbf{x}^*,t_n + \Delta t),\\
125+
\mathbf{x}_{n+1} = \mathbf{x}_n + \tfrac{\Delta t}{2}\,(k_1 + k_2).\end{split}\]</div>
126+
<p>This scheme yields a global error of order <span class="math notranslate nohighlight">\(O(\Delta t^2)\)</span> with two velocity evaluations per step.</p>
127+
<p><strong>Classical Fourth‐Order Runge–Kutta (RK4)</strong></p>
128+
<p>The classical RK4 method achieves fourth‐order accuracy via four slope evaluations at intermediate points:</p>
164129
<div class="math notranslate nohighlight">
165-
\[\begin{split}k_1 &amp;= f(\mathbf{x}_n, t_n),\\
166-
k_2 &amp;= f\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{2}k_1,\;t_n + \tfrac{\Delta t}{2}\bigr),\\
167-
k_3 &amp;= f\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{2}k_2,\;t_n + \tfrac{\Delta t}{2}\bigr),\\
168-
k_4 &amp;= f(\mathbf{x}_n + \Delta t\,k_3,\;t_n + \Delta t),\\
169-
\mathbf{x}_{n+1} &amp;= \mathbf{x}_n + \tfrac{\Delta t}{6}\,(k_1 + 2k_2 + 2k_3 + k_4).\end{split}\]</div>
170-
<p>Implementation steps:</p>
171-
<blockquote>
172-
<div><ol class="arabic">
173-
<li><p>Compute <span class="math notranslate nohighlight">\(k_1\)</span> at <span class="math notranslate nohighlight">\(\mathbf{x}_n\)</span>.</p></li>
174-
<li><p>Compute <span class="math notranslate nohighlight">\(k_2\)</span> at <span class="math notranslate nohighlight">\(\mathbf{x}_n + \tfrac{\Delta t}{2}k_1\)</span>.</p></li>
175-
<li><p>Compute <span class="math notranslate nohighlight">\(k_3\)</span> at <span class="math notranslate nohighlight">\(\mathbf{x}_n + \tfrac{\Delta t}{2}k_2\)</span>.</p></li>
176-
<li><p>Compute <span class="math notranslate nohighlight">\(k_4\)</span> at <span class="math notranslate nohighlight">\(\mathbf{x}_n + \Delta t\,k_3\)</span>.</p></li>
177-
<li><p>Combine:
178-
.. math:</p>
179-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_</span><span class="p">{</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">}</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span> <span class="o">+</span> \<span class="n">tfrac</span><span class="p">{</span>\<span class="n">Delta</span> <span class="n">t</span><span class="p">}{</span><span class="mi">6</span><span class="p">}</span>\<span class="p">,(</span><span class="n">k_1</span> <span class="o">+</span> <span class="mi">2</span><span class="n">k_2</span> <span class="o">+</span> <span class="mi">2</span><span class="n">k_3</span> <span class="o">+</span> <span class="n">k_4</span><span class="p">)</span>
180-
</pre></div>
181-
</div>
182-
</li>
183-
</ol>
184-
</div></blockquote>
185-
<p><strong>Sixth-Order Runge–Kutta (RK6)</strong></p>
186-
<p>A six-stage explicit method with <span class="math notranslate nohighlight">\(O(\Delta t^6)\)</span> accuracy. Define:</p>
130+
\[\begin{split}k_1 = \mathbf{u}(\mathbf{x}_n,t_n),\\
131+
k_2 = \mathbf{u}\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{2}k_1,\;t_n + \tfrac{\Delta t}{2}\bigr),\\
132+
k_3 = \mathbf{u}\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{2}k_2,\;t_n + \tfrac{\Delta t}{2}\bigr),\\
133+
k_4 = \mathbf{u}(\mathbf{x}_n + \Delta t\,k_3,\;t_n + \Delta t),\\
134+
\mathbf{x}_{n+1} = \mathbf{x}_n + \tfrac{\Delta t}{6}\,(k_1 + 2k_2 + 2k_3 + k_4).\end{split}\]</div>
135+
<p>This yields a global error of order <span class="math notranslate nohighlight">\(O(\Delta t^4)\)</span> with four velocity evaluations per step.</p>
136+
<p><strong>Sixth‐Order Runge–Kutta (RK6)</strong></p>
137+
<p>The six‐stage scheme uses non‐uniform weights to attain sixth‐order accuracy:</p>
187138
<div class="math notranslate nohighlight">
188-
\[\begin{split}k_1 &amp;= f(\mathbf{x}_n, t_n),\\
189-
k_2 &amp;= f\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{3}k_1,\;t_n + \tfrac{\Delta t}{3}\bigr),\\
190-
k_3 &amp;= f\!\Bigl(\mathbf{x}_n + \Delta t\bigl(\tfrac{1}{6}k_1 + \tfrac{1}{6}k_2\bigr),\;t_n + \tfrac{\Delta t}{3}\Bigr),\\
191-
k_4 &amp;= f\!\Bigl(\mathbf{x}_n + \Delta t\bigl(\tfrac{1}{8}k_1 + \tfrac{3}{8}k_3\bigr),\;t_n + \tfrac{\Delta t}{2}\Bigr),\\
192-
k_5 &amp;= f\!\Bigl(\mathbf{x}_n + \Delta t\bigl(\tfrac{1}{2}k_1 - \tfrac{3}{2}k_3 + 2k_4\bigr),\;t_n + \tfrac{2\Delta t}{3}\Bigr),\\
193-
k_6 &amp;= f\!\Bigl(\mathbf{x}_n + \Delta t\bigl(-\tfrac{3}{2}k_1 + 2k_2 - \tfrac{1}{2}k_3 + k_4\bigr),\;t_n + \Delta t\Bigr),\\
194-
\mathbf{x}_{n+1} &amp;= \mathbf{x}_n + \Delta t\Bigl(\tfrac{1}{20}k_1 + \tfrac{1}{4}k_4 + \tfrac{1}{5}k_5 + \tfrac{1}{2}k_6\Bigr).\end{split}\]</div>
195-
<p>Implementation steps:</p>
196-
<blockquote>
197-
<div><ol class="arabic">
198-
<li><p>Compute each <span class="math notranslate nohighlight">\(k_i = \sigma\,\mathbf{u}(\cdot)\)</span> at its intermediate point.</p></li>
199-
<li><p>Form the weighted sum:
200-
.. math:</p>
201-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_</span><span class="p">{</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">}</span> <span class="o">=</span> \<span class="n">mathbf</span><span class="p">{</span><span class="n">x</span><span class="p">}</span><span class="n">_n</span> <span class="o">+</span> \<span class="n">Delta</span> <span class="n">t</span>\<span class="n">Bigl</span><span class="p">(</span>\<span class="n">tfrac</span><span class="p">{</span><span class="mi">1</span><span class="p">}{</span><span class="mi">20</span><span class="p">}</span><span class="n">k_1</span> <span class="o">+</span> \<span class="n">tfrac</span><span class="p">{</span><span class="mi">1</span><span class="p">}{</span><span class="mi">4</span><span class="p">}</span><span class="n">k_4</span> <span class="o">+</span> \<span class="n">tfrac</span><span class="p">{</span><span class="mi">1</span><span class="p">}{</span><span class="mi">5</span><span class="p">}</span><span class="n">k_5</span> <span class="o">+</span> \<span class="n">tfrac</span><span class="p">{</span><span class="mi">1</span><span class="p">}{</span><span class="mi">2</span><span class="p">}</span><span class="n">k_6</span>\<span class="n">Bigr</span><span class="p">)</span>
202-
</pre></div>
203-
</div>
204-
</li>
205-
</ol>
206-
</div></blockquote>
207-
<p>All methods assume a continuous, differentiable velocity field via tricubic interpolation; replacing <span class="math notranslate nohighlight">\(f\)</span> by the chosen sampler affects only boundary‐condition treatment.</p>
139+
\[\begin{split}k_1 = \mathbf{u}(\mathbf{x}_n,t_n),\\
140+
k_2 = \mathbf{u}\!\bigl(\mathbf{x}_n + \tfrac{\Delta t}{3}k_1,\;t_n + \tfrac{\Delta t}{3}\bigr),\\
141+
k_3 = \mathbf{u}\!\bigl(\mathbf{x}_n + \Delta t(\tfrac{1}{6}k_1 + \tfrac{1}{6}k_2),\;t_n + \tfrac{\Delta t}{3}\bigr),\\
142+
k_4 = \mathbf{u}\!\bigl(\mathbf{x}_n + \Delta t(\tfrac{1}{8}k_1 + \tfrac{3}{8}k_3),\;t_n + \tfrac{\Delta t}{2}\bigr),\\
143+
k_5 = \mathbf{u}\!\bigl(\mathbf{x}_n + \Delta t(\tfrac{1}{2}k_1 - \tfrac{3}{2}k_3 + 2k_4),\;t_n + \tfrac{2\Delta t}{3}\bigr),\\
144+
k_6 = \mathbf{u}\!\bigl(\mathbf{x}_n + \Delta t(-\tfrac{3}{2}k_1 + 2k_2 - \tfrac{1}{2}k_3 + k_4),\;t_n + \Delta t\bigr),\\
145+
\mathbf{x}_{n+1} = \mathbf{x}_n + \Delta t\bigl(\tfrac{1}{20}k_1 + \tfrac{1}{4}k_4 + \tfrac{1}{5}k_5 + \tfrac{1}{2}k_6\bigr).\end{split}\]</div>
146+
<p>This scheme incurs a global error of order <span class="math notranslate nohighlight">\(O(\Delta t^6)\)</span> with six velocity evaluations.</p>
147+
<p>All methods assume a continuous velocity interpolation (e.g., tricubic) to supply <span class="math notranslate nohighlight">\(\mathbf{u}\)</span> at arbitrary particle positions and times.</p>
208148
</section>
209149
</section>
210150
<section id="ftle-computation">

5_gui.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<span id="gui"></span><h1>Graphical User Interface (GUI)<a class="headerlink" href="#graphical-user-interface-gui" title="Link to this heading"></a></h1>
8484
<p>This page describes how to use GUI mode of <code class="docutils literal notranslate"><span class="pre">PyFTLE3D</span></code>, which is friendly for who would like to use the software without command-line operations.
8585
The author holds the opinion that coding should not be a barrier for using scientific analysis tools such as <code class="docutils literal notranslate"><span class="pre">FTLE</span></code>.
86-
For some peers or even experts and professors, coding is absolutely boring.</p>
86+
For some peers or even experts and professors, coding is absolutely boring, especially for GPU tasks on such large dataset scale.</p>
8787
<p>The GUI shares exactly the same functionalities as the command-line mode, but is more difficult to customize, as <code class="docutils literal notranslate"><span class="pre">PyQt</span></code> is used for building it.</p>
8888
</section>
8989

0 commit comments

Comments
 (0)