Skip to content

Commit 27f4a0e

Browse files
committed
Refactor Nonlinear, Vibrations, and Truncation chapters
- Fix broken LaTeX subscripts (**{ → _{) in: - nonlin_pde1D.qmd (12 occurrences) - nonlin_split.qmd (3 occurrences) - vib_undamped.qmd (2 occurrences) - trunc.qmd (4 occurrences) - Remove NumPy files from src/nonlin/ (keep Devito implementations) - Delete chapters/nonlin/exer-nonlin/ exercise directory Vibrations chapter (ODE-focused) retains NumPy implementations. All 247 tests pass, PDF builds without errors.
1 parent 7cbc57e commit 27f4a0e

14 files changed

Lines changed: 24 additions & 1549 deletions

chapters/appendices/trunc/trunc.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,12 +1644,12 @@ $[D_xD_x (D_tD_t u)]^n_i$ gives
16441644
16451645
\begin{align*}
16461646
\frac{1}{\Delta t^2}\biggl(
1647-
&\frac{u^{n+1}**{i+1} - 2u^{n}**{i+1} + u^{n-1}_{i+1}}{\Delta x^2} -2\\
1648-
&\frac{u^{n+1}**{i} - 2u^{n}**{i} + u^{n-1}_{i}}{\Delta x^2} +
1649-
&\frac{u^{n+1}**{i-1} - 2u^{n}**{i-1} + u^{n-1}_{i-1}}{\Delta x^2}
1647+
&\frac{u^{n+1}_{i+1} - 2u^{n}_{i+1} + u^{n-1}_{i+1}}{\Delta x^2} -2\\
1648+
&\frac{u^{n+1}_{i} - 2u^{n}_{i} + u^{n-1}_{i}}{\Delta x^2} +
1649+
&\frac{u^{n+1}_{i-1} - 2u^{n}_{i-1} + u^{n-1}_{i-1}}{\Delta x^2}
16501650
\biggr)
16511651
\end{align*}
1652-
Now the unknown values $u^{n+1}**{i+1}$, $u^{n+1}**{i}$,
1652+
Now the unknown values $u^{n+1}_{i+1}$, $u^{n+1}_{i}$,
16531653
and $u^{n+1}_{i-1}$ are *coupled*, and we must solve a tridiagonal
16541654
system to find them. This is in principle straightforward, but it
16551655
results in an implicit finite difference scheme, while we had

chapters/nonlin/exer-nonlin/fu_fem_int.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

chapters/nonlin/exer-nonlin/logistic_p.py

Lines changed: 0 additions & 180 deletions
This file was deleted.

chapters/nonlin/exer-nonlin/product_arith_mean_sympy.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

chapters/nonlin/nonlin_pde1D.qmd

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,12 @@ We must then replace $u_{-1}$ by
523523
With Picard iteration we get
524524
525525
\begin{align*}
526-
\frac{1}{2\Delta x^2}(& -(\dfc(u^-**{-1}) + 2\dfc(u^-**{0})
526+
\frac{1}{2\Delta x^2}(& -(\dfc(u^-_{-1}) + 2\dfc(u^-_{0})
527527
+ \dfc(u^-_{1}))u_1\, +\\
528-
&(\dfc(u^-**{-1}) + 2\dfc(u^-**{0}) + \dfc(u^-_{1}))u_0
528+
&(\dfc(u^-_{-1}) + 2\dfc(u^-_{0}) + \dfc(u^-_{1}))u_0
529529
+ au_0\\
530530
&=f(u^-_0) -
531-
\frac{1}{\dfc(u^-**0)\Delta x}(\dfc(u^-**{-1}) + \dfc(u^-_{0}))C,
531+
\frac{1}{\dfc(u^-_0)\Delta x}(\dfc(u^-_{-1}) + \dfc(u^-_{0}))C,
532532
\end{align*}
533533
where
534534
$$
@@ -540,18 +540,18 @@ condition as a separate equation, (@eq-nonlin-alglevel-1D-fd-2x2-x1)
540540
with Picard iteration becomes
541541
542542
\begin{align*}
543-
\frac{1}{2\Delta x^2}(&-(\dfc(u^-**{0}) + \dfc(u^-**{1}))u_{0}\, + \\
544-
&(\dfc(u^-**{0}) + 2\dfc(u^-**{1}) + \dfc(u^-_{2}))u_1\, -\\
545-
&(\dfc(u^-**{1}) + \dfc(u^-**{2})))u_2 + au_1
543+
\frac{1}{2\Delta x^2}(&-(\dfc(u^-_{0}) + \dfc(u^-_{1}))u_{0}\, + \\
544+
&(\dfc(u^-_{0}) + 2\dfc(u^-_{1}) + \dfc(u^-_{2}))u_1\, -\\
545+
&(\dfc(u^-_{1}) + \dfc(u^-_{2})))u_2 + au_1
546546
=f(u^-_1)\tp
547547
\end{align*}
548548
We must now move the $u_2$ term to the right-hand side and replace all
549549
occurrences of $u_2$ by $D$:
550550
551551
\begin{align*}
552-
\frac{1}{2\Delta x^2}(&-(\dfc(u^-**{0}) + \dfc(u^-**{1}))u_{0}\, +\\
553-
& (\dfc(u^-**{0}) + 2\dfc(u^-**{1}) + \dfc(D)))u_1 + au_1\\
554-
&=f(u^-**1) + \frac{1}{2\Delta x^2}(\dfc(u^-**{1}) + \dfc(D))D\tp
552+
\frac{1}{2\Delta x^2}(&-(\dfc(u^-_{0}) + \dfc(u^-_{1}))u_{0}\, +\\
553+
& (\dfc(u^-_{0}) + 2\dfc(u^-_{1}) + \dfc(D)))u_1 + au_1\\
554+
&=f(u^-_1) + \frac{1}{2\Delta x^2}(\dfc(u^-_{1}) + \dfc(D))D\tp
555555
\end{align*}
556556
557557
The two equations can be written as a $2\times 2$ system:
@@ -573,19 +573,19 @@ $$
573573
where
574574
575575
\begin{align}
576-
B_{0,0} &=\frac{1}{2\Delta x^2}(\dfc(u^-**{-1}) + 2\dfc(u^-**{0}) + \dfc(u^-_{1}))
576+
B_{0,0} &=\frac{1}{2\Delta x^2}(\dfc(u^-_{-1}) + 2\dfc(u^-_{0}) + \dfc(u^-_{1}))
577577
+ a,\\
578578
B_{0,1} &=
579-
-\frac{1}{2\Delta x^2}(\dfc(u^-**{-1}) + 2\dfc(u^-**{0})
579+
-\frac{1}{2\Delta x^2}(\dfc(u^-_{-1}) + 2\dfc(u^-_{0})
580580
+ \dfc(u^-_{1})),\\
581581
B_{1,0} &=
582-
-\frac{1}{2\Delta x^2}(\dfc(u^-**{0}) + \dfc(u^-**{1})),\\
582+
-\frac{1}{2\Delta x^2}(\dfc(u^-_{0}) + \dfc(u^-_{1})),\\
583583
B_{1,1} &=
584-
\frac{1}{2\Delta x^2}(\dfc(u^-**{0}) + 2\dfc(u^-**{1}) + \dfc(D)) + a,\\
584+
\frac{1}{2\Delta x^2}(\dfc(u^-_{0}) + 2\dfc(u^-_{1}) + \dfc(D)) + a,\\
585585
d_0 &=
586586
f(u^-_0) -
587-
\frac{1}{\dfc(u^-**0)\Delta x}(\dfc(u^-**{-1}) + \dfc(u^-_{0}))C,\\
588-
d_1 &= f(u^-**1) + \frac{1}{2\Delta x^2}(\dfc(u^-**{1}) + \dfc(D))D\tp
587+
\frac{1}{\dfc(u^-_0)\Delta x}(\dfc(u^-_{-1}) + \dfc(u^-_{0}))C,\\
588+
d_1 &= f(u^-_1) + \frac{1}{2\Delta x^2}(\dfc(u^-_{1}) + \dfc(D))D\tp
589589
\end{align}
590590
591591
The system with the Dirichlet condition becomes
@@ -611,7 +611,7 @@ with
611611
612612
\begin{align}
613613
B_{1,1} &=
614-
\frac{1}{2\Delta x^2}(\dfc(u^-**{0}) + 2\dfc(u^-**{1}) + \dfc(u_2)) + a,\\
614+
\frac{1}{2\Delta x^2}(\dfc(u^-_{0}) + 2\dfc(u^-_{1}) + \dfc(u_2)) + a,\\
615615
B_{1,2} &= -
616616
\frac{1}{2\Delta x^2}(\dfc(u^-_{1}) + \dfc(u_2))),\\
617617
d_1 &= f(u^-_1)\tp

0 commit comments

Comments
 (0)