Skip to content

Commit 307e58f

Browse files
author
sveinlin
committed
fixed some typos in advec chapter
1 parent be9f9e7 commit 307e58f

4 files changed

Lines changed: 21 additions & 17 deletions

File tree

doc/.src/chapters/advec/advec.do.txt

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ label{advec:1D:pde1:I}
4545
!et
4646
In (ref{advec:1D:pde1:u}), $v$ is a given parameter, typically reflecting
4747
the velocity of transport of a quantity $u$ with a flow.
48-
There is only one boundary condition (ref{advec:1D:pde1:U0}) since
48+
There is only one boundary condition (ref{advec:1D:pde1:I}) since
4949
the spatial derivative is only first order in the PDE (ref{advec:1D:pde1:u}).
5050
The information at $x=0$ and the initial condition get
5151
transported in the positive $x$ direction
@@ -76,9 +76,12 @@ if $x_i=i\Delta x$ and $t_n=n\Delta t$ are points in a uniform mesh.
7676
We see this relation from
7777

7878
!bt
79-
\[ u(i\Delta x, (n+1)\Delta t) = I(i\Delta x - v(n+1)\Delta t) =
80-
I((i-1)\Delta x - vn\Delta t - v\Delta t - \Delta x)
81-
= I((i-1)\Delta x - vn\Delta t) = u((i-1)\Delta x, n\Delta t),\]
79+
\begin{align}
80+
u(i\Delta x, (n+1)\Delta t) &= I(i\Delta x - v(n+1)\Delta t) \nonumber \\
81+
&= I((i-1)\Delta x - vn\Delta t - v\Delta t - \Delta x) \nonumber \\
82+
&= I((i-1)\Delta x - vn\Delta t) \nonumber \\
83+
&= u((i-1)\Delta x, n\Delta t), \nonumber
84+
\end{align}
8285
!et
8386
provided $v = \Delta x/\Delta t$. So, whenever we see a scheme that
8487
collapses to
@@ -94,7 +97,7 @@ analytical solution, and many of the schemes to be presented possess
9497
this nice property!
9598

9699
Finally, we add that a discussion of appropriate boundary conditions
97-
for the advection PDE in multiple dimensions is a challenching topic beyond
100+
for the advection PDE in multiple dimensions is a challenging topic beyond
98101
the scope of this text.
99102

100103
===== Simplest scheme: forward in time, centered in space =====
@@ -191,12 +194,12 @@ and any amplitude $B$. (Since the PDE to be investigated by this method
191194
is homogeneous and linear, $B$ will always cancel out, so we tend to skip
192195
this amplitude, but keep it here in the beginning for completeness.)
193196

194-
A general solution can be thought to be build of a collection of long and
197+
A general solution may be viewed as a collection of long and
195198
short waves with different amplitudes. Algebraically, the work
196199
simplifies if we introduce the complex Fourier component
197200

198201
!bt
199-
\[ u(x,t)=\Aex^n e^{ikx},\]
202+
\[ u(x,t)=\Aex e^{ikx},\]
200203
!et
201204
with
202205

@@ -218,13 +221,13 @@ have implemented, we look at how it treats the Fourier component
218221
Inserting the numerical component in the scheme,
219222

220223
!bt
221-
\[ [D_t^+ A^n e^{ikq\Delta x} + v D_{2x}A^n e^{ikq\Delta x}]^n_i,\]
224+
\[ [D_t^+ A e^{ikq\Delta x} + v D_{2x}A e^{ikq\Delta x} = 0]^n_i,\]
222225
!et
223226
and making use of (ref{form:exp:fd1c:center})
224227
results in
225228

226229
!bt
227-
\[ [e^{ikq\Delta x} (\frac{A-1}{\Delta t} + v\frac{1}{\Delta x}i\sin (k\Delta x))]^n_i,\]
230+
\[ [e^{ikq\Delta x} (\frac{A-1}{\Delta t} + v\frac{1}{\Delta x}i\sin (k\Delta x)) = 0]^n_i,\]
228231
!et
229232
which implies
230233

@@ -254,10 +257,11 @@ time and combine it with central differences in space:
254257
which results in the updating formula
255258

256259
!bt
257-
\[ u^{n+1}_i = u^{n-1}_i - C^2(u_{i+1}^n-u_{i-1}^n)\tp\]
260+
\[ u^{n+1}_i = u^{n-1}_i - C(u_{i+1}^n-u_{i-1}^n)\tp\]
258261
!et
259262
A special scheme is needed to compute $u^1$, but we leave that problem for
260-
now.
263+
now. Anyway, this special scheme can be found in
264+
"`advec1D.py`": "${src_advec}/advec/advec1D.py".
261265

262266
=== Implementation ===
263267

@@ -272,7 +276,7 @@ u_1 = np.zeros(Nx+1)
272276
u_2 = np.zeros(Nx+1)
273277
...
274278
for n in range(0, Nt):
275-
if scheme == 'UP':
279+
if scheme == 'FE':
276280
for i in range(1, Nx):
277281
u[i] = u_1[i] - 0.5*C*(u_1[i+1] - u_1[i-1])
278282
elif scheme == 'LF':
@@ -302,9 +306,9 @@ FIGURE: [fig-advec/solver_FE_Upw, width=500 frac=0.8] Exact solution obtained by
302306
=== Running more test cases ===
303307

304308
We can run two types of initial conditions for $C=0.8$: one very
305-
smooth with a Gaussian function (Figure ref{advec:1D:UP:fig1:C08}) and
309+
smooth with a Gaussian function (Figure ref{advec:1D:LF:fig1:C08}) and
306310
one with a discontinuity in the first derivative (Figure
307-
ref{advec:1D:UP:fig2:C08}). Unless we have a very fine mesh, as in
311+
ref{advec:1D:LF:fig2:C08}). Unless we have a very fine mesh, as in
308312
the left plots in the figures, we get small ripples behind the main
309313
wave, and this main wave has the amplitude reduced.
310314

@@ -410,13 +414,13 @@ Experiments show, however, that
410414
reducing $\Delta t$ or $\Delta x$, while keeping $C$ reduces the
411415
error.
412416

413-
FIGURE: [fig-advec/gaussian_UP_C08, width=800 frac=1] Advection of a Gaussian function with a forward in time, upwind in space scheme and $C=0.8$, $\Delta t = 0.001$ (left) and $\Delta t=0.01$ (right). label{advec:1D:UP:fig1:C08}
417+
FIGURE: [fig-advec/gaussian_UP_C08, width=800 frac=1] Advection of a Gaussian function with a forward in time, upwind in space scheme and $C=0.8$, $\Delta t = 0.01$ (left) and $\Delta t=0.001$ (right). label{advec:1D:UP:fig1:C08}
414418

415419
MOVIE: [mov-advec/gaussian/UP/C08_dt001/movie.ogg] Forward in time, upwind in space, $C=0.8$, $\Delta t = 0.01$. label{advec:1D:UP:mov1:C08:dt1}
416420

417421
MOVIE: [mov-advec/gaussian/UP/C08_dt001/movie.ogg] Forward in time, upwind in space, $C=0.8$, $\Delta t = 0.005$. label{advec:1D:UP:mov1:C08:dt2}
418422

419-
FIGURE: [fig-advec/cosinehat_UP_08, width=800 frac=1] Advection of half a cosine function with a forward in time, upwind in space scheme and $C=0.8$, $\Delta t = 0.01$ (left) and $\Delta t=0.001$ (right). label{advec:1D:UP:fig2:C08}
423+
FIGURE: [fig-advec/cosinehat_UP_08, width=800 frac=1] Advection of half a cosine function with a forward in time, upwind in space scheme and $C=0.8$, $\Delta t = 0.001$ (left) and $\Delta t=0.01$ (right). label{advec:1D:UP:fig2:C08}
420424

421425
MOVIE: [mov-advec/cosinehat/UP/C08_dt01.ogg] Advection of half a cosine function with a forward in time, upwind in space scheme and $C=0.8$, $\Delta t = 0.01$. label{advec:1D:UP:mov2:C08:dt1}
422426

@@ -867,7 +871,7 @@ amplification factor for the Lax-Wendroff method that equals
867871
!bt
868872
\[ A = 1 - iC\sin p - 2C^2\sin^2 (p/2)\tp\]
869873
!et
870-
This means that $|A|=1$ and also that we have an exact solution of $C=1$!
874+
This means that $|A|=1$ and also that we have an exact solution if $C=1$!
871875

872876

873877
===== Analysis of dispersion relations =====
66 KB
Binary file not shown.
68.5 KB
Binary file not shown.
65.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)