NumMeth 22: LeVeque -> LTE

This commit is contained in:
2022-11-17 10:43:10 +01:00
parent 00985fe38b
commit 4dd9f680d3
2 changed files with 336 additions and 11 deletions
+334 -9
View File
@@ -1196,7 +1196,9 @@ Another approach at getting around the pairwise evaluation of interactions is th
The potential of a cell with masses can be written as
\begin{align}
\Phi(\vec r) &= \sum_{l=0}^\inf \sum_{m=-l}^l \frac{M_l^m}{} Y_{lm}(\Theta,\varphi)\\
\Phi(\vec r) &=
\sum_{l=0}^\infty \sum_{m=-l}^l
\frac{M_l^m}{} Y_{lm}(\Theta,\varphi)\\
M_l^m &= \sum_{i=1}^k m_i \rho_i^l Y_{lm}^* (\alpha_i,\beta_i)
\end{align}
where $\rho, \alpha, \beta$ are the positions within the cell.
@@ -1393,7 +1395,7 @@ The restriction is essentially the inversion of this.
A simple two grid v-cycle looks like this
\begin{enumerate}
\item Iterate on $A^h u = b^h$ to reach $u^h$ (say 3 Jacobi or Gauss-Seidel steps).
\item Restrict the residual $r^h = b^h − A^h u^h$ to the coarse grid by $r^{2h} = R^{2h}_h r^h$.
\item Restrict the residual $r^h = b^h -A^h u^h$ to the coarse grid by $r^{2h} = R^{2h}_h r^h$.
\item Solve $A^{2h} e^{2h} = r^{2h}$ (or come close to $e^{2h}$ by 3 iterations from $e = 0$).
\item Interpolate $e^{2h}$ back to $e^h = I^h_{2h} e_{2h}$. Add $e^h$ to $u^h$.
\item Iterate 3 more times on $A^h u = b^h$ starting from the improved $u^h + e^h$
@@ -2917,7 +2919,7 @@ The correct solution is a rarefaction wave (shown in the lower part of Fig. \ref
\pgfimage[width=.8\textwidth]{fig_chapter5/riemann2}
\end{center}
\caption{The case $u_l<u_r$}
\label{fig:riemann1}
\label{fig:riemann2}
\end{figure}
\subsection{Shock speed}
@@ -2940,12 +2942,335 @@ In the scalar case
\end{align}
where $[\cdot]$ is the difference over the shock. When $f$ and $u$ are vectors, $s$ is still a scalar. Jumps are, therefore, only allowed for when $f(u_l) - f(u_r)$ and $u_l-u_r$ are linear dependent.
- Finite Differenzen
- Finite Volumina
- Flux-Limiter
- Positivity
- Fluiddynamik
- MHD
In the real world (more than dimension, more than one quantity) the flux $f(u)$ is a linear system $A u$ where $u$ is $N$-dimensional and $A$ is a $N\times N$ matrix. The characteristics of this system are then the Eigenvalues of the system. Discontinuities are following these characteristics.
\subsection{Manipulation of conservation laws}
When considering the Burgers equation
\begin{align}
\partial_t u + \partial_x(1/2 u^2) = 0
\end{align}
we can perform the following manipulations
\begin{align}
2 u \partial_t u + 2 u^2 \partial_x u & 0\\
\Rightarrow \partial_t (u^2) + \partial_x (2/3 u^3) = 0
\end{align}
This is seemingly a conservation law (for $u^2$) and we have made no grave mathematical mistake. The smooth solutions are even identical. The weak solutions, however, are behaving differently
\begin{align}
s_1 &= \frac{[1/2 u^2]}{[u]} = 1/2 (u_l + u_r)\\
s_2 &= \frac{[2/3 u^3]}{[u^2]} = 2/3 \frac{(u_r^3 - u_l^3)}{u_r^2-u_l^2}
\end{align}
Why is this different (and wrong\dots)? The manipulation is only valid for smooth solutions, where taking the derivative is a safe and well-defined operation.
\subsection{Entropy condition}
Obviously there is some ambiguity in solving the correct equations correctly. How do I figure out which solution is correct? The theoretical considerations from the last sections show that we may use the \emph{vanishing viscosity} ansatz. While this is technically correct, it is completely impractical and complicated.
We may use our knowledge about what happens at the shock: Characteristics shall run \textbf{into} the shock rather than \textbf{out of} the shock. In the latter case the solution is unstable. From this we can conclude an \emph{entropy condition}
Version 1
\begin{align}
f^\prime(u_l) > s > f^\prime(u_r)
\end{align}
Version 2
\begin{align}
\frac{f(u) - f(u_l)}{u - u_l} \geq s \geq \frac{f(u) - f(u_r)}{u - u_r}
\end{align}
Version 3
\begin{align}
\exists E \forall a > 0, t> 0 \quad \frac{u(x+a,t)-u(x,t)}{a} < \frac{E}{t}
\end{align}
%
\subsection{Scalar examples}
\subsubsection{Traffic flow}
Traffic fulfills a continuity equation
\begin{align}
\partial_t \rho + \partial_x(\rho u) = 0
\end{align}
where one can derive the velocity $u$ from the traffic density $\rho$
\begin{align}
u = u(\rho) = u_\text{max}(1-\frac{\rho}{\rho_\text{max}})
\end{align}
This is actually a closure for a complicated system - only one equation earlier than in typical fluid equations
\begin{align}
\partial_t \rho + \partial_x(f(\rho)) = 0,\quad f(\rho) =\rho u_\text{max}(1-\frac{\rho}{\rho_\text{max}})
\end{align}
For some system (here: Lincoln tunnel) other fluxes have been measured $f(\rho) = a \rho \log \rho_\text{max}/\rho$.
The characteristics can be derived for the standard case
\begin{align}
f^\prime(\rho) = u_\text{max}\left( 1 - \frac{2\rho}{\rho_\text{max}} \right)
\end{align}
Bildchen mit Stau/Fahrzeug-Charakteristik
\subsection{Nonlinear systems}
\subsubsection{Euler equation}
The Euler equations describe gas flows
\begin{align}
\partial_t \rho +\partial_x (\rho v ) &= 0\\
\partial_t (\rho v) + \partial_x(\rho v^2 + p) &= 0\\
1/2 \rho v^2 + \rho e &= E \quad \text{(specific inner energy)}\\
\partial_t E +\partial_x(v(E+p)) &= 0
\end{align}
This can be written in vector form
\begin{align}
\partial_t \begin{pmatrix} \rho \\\rho v\\E\end{pmatrix} +\partial_x \begin{pmatrix} \rho v\\ \rho v^2 +p\\ v(E+p) \end{pmatrix}
\end{align}
For the ideal gas we have the following relations
\begin{align}
p &= \rho k_B T/m\\
e &= c_V T \\
\gamma = c_p/c_V
\end{align}
The entropy is known to be
\begin{align}
S &= c_V \log(p/\rho^\gamma)\\
\Rightarrow p &= \kappa \exp(S/c_V)\rho^\gamma\\
\Rightarrow \partial_t S + v\partial_x S &= 0
\end{align}
which leads to the Euler equation for the ideal gas
\begin{align}
\partial_t \rho + \partial_x (\rho v) &= 0\\
\partial_t (\rho v) + \partial_x ) &= 0\\
\partial_t S + v\partial_x S &= 0
\end{align}
\section{Numerical methods}
Let us linear equations of the type
\begin{align}
\partial_t u + A \partial_x u &= 0 \label{eq:leveque10.1}\\
u(x,0) &= u_0 (x)\\
x_j &= j h \\
t^n &= n k \\
x_{j+1/2} &= x_j + h/2
\end{align}
where $A$ is a linear operator.
The finite solution will produce approximations $U_j^n \in \mathbb{R}^m$ to the true solution $u(x_j,t^n)$ which will be denoted $u_j^n = u(x_j, t^n)$. A better approximation is the cell average
\begin{align}
\bar{u}_j^n = \frac{1}{h}\int_{x_{j-1/2}}^{x_{j+1/2}} \dd x\ u(x,t^n)
\end{align}
since $u$ is a conserved quantity and the conservation is given as exactly this integral.
There are a wide variety of finite difference methods that can be used. Many of these
are derived simply by replacing the derivatives occurring in Eq. \eqref{eq:leveque10.1} by appropriate finite differenc eapproximations. For example, replacing $u_t$, by a forward-in-time approximation and $u_x$, by a spatially centered approximation, we obtain the following difference equations for $U^{n+1}$:
\begin{align}
\frac{U_j^{n+1} - U_j^n}{k}+A\left( \frac{U_{j+1}^n-U_{j-1}^n}{2h}\right) = 0
\end{align}
This can be solved to obtain
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{2h}A(U_{j+1}^n - U_{j-1}^n)\label{eq:leveque10.7}
\end{align}
Unfortunately, despite the quite natural derivation of this method, it suffers from severe
stability problems and is useless in practice.
A far more stable method is obtained by evaluating the centered difference approximations to $u_x$ at time $t_{n+1}$ rather than at time $t_n$, giving
\begin{align}
\frac{U_j^{n+1} - U_j^n}{k}+A\left( \frac{U_{j+1}^{n+1}-U_{j-1}^{n+1}}{2h}\right) = 0
\end{align}
or
\begin{align}
U_j^{n+1} = U_j^n-\frac{k}{2h}A(U_{j+1}^{n+1} - U_{j-1}^{n+1})\label{eq:leveque10.9}
\end{align}
Note, however, that in order to determine $U^{n+1}$ from the data $U^n$ in each timestep, we
must view equation \eqref{eq:leveque10.9} as a coupled system of equations over all values of $j$. This would be an infinite system for the Cauchy problem, but in any practical calculation we
would use a bounded interval with $N$ gridpoints and this would be a finite system. In
the scalar case this is an $N\times N$ linear system with a tridiagonal coefficient matrix.When
$ u\in \mathbb{R}^m$, the discrete system is $mN\times mN$.
The method \eqref{eq:leveque10.7} allows us to determine $U^{n+1}$ explicitly, and is called an explicit method, whereas \eqref{eq:leveque10.9} is an implicit method. Implicit methods are rarely used for time-dependent hyperbolic problems, although they are very important for other classes of equations. Although the method \eqref{eq:leveque10.7} is useless due to stability problems, there are other explicit methods which work very satisfactorily with reasonable size timesteps and these are typically more efficient than implicit methods.
If we look at which gridpoints are involved in the computation of $U^{n+1}$ with a given
method, we can obtain a diagram that is known as the stencil of the method. The stencils
for the methods \eqref{eq:leveque10.7} and \eqref{eq:leveque10.9} are given below.
A wide variety of methods can be devised for the linear system \eqref{eq:leveque10.1} by using different finite difference approximations. A few possibilities are listed in the table below along with their stencils. Most of these are based directly on finite difference approximations to
the PDE. An exception is the Lax-Wendroff method, which is based on theTaylor series
expansion
\begin{align}
u(x,t+k) = u(x,t) + k \partial_t u(x,t) + \frac{1}{2} k^2 \partial_t^2 u(x,t) + \dots \label{eq:leveque10.10}
\end{align}
and the observation that from $\partial_t u = - A\partial_x u$, we can compute
\begin{align}
\partial_t^2 = - A \partial_x\partial_t u = - A\partial_t\partial_x u = A^2 \partial_x^2 u
\end{align}
so that Eq. \eqref{eq:leveque10.10} becomes
\begin{align}
u(x,t+k) = u(x,t) -k A \partial_x u(x,t) + \frac{1}{2}k^2 A^2 \partial_x^2 u(x,t)\label{eq:leveque10.12}
\end{align}
The Lax-Wendroff method then results from retaining only the first three terms of \eqref{eq:leveque10.12} and using centered difference approximations for the derivatives appearing there.
With the exception of the Leapfrog method, all of themethods below are 2-level
methods. For time-dependent conservation laws, 2-level methods are almost exclusively
used. Methods involving more than 2 levels have additional difficulties. They require
more storage (a disadvantage primarily in two or three dimensional calculations) and
they require special start up procedures, since initially only one level of data is known.
We will study explicit 2-level methods almost exclusively, and introduce some special
notation for such methods, writing
\begin{align}
U^{n+1} = \mathscript{H}_k(U^n)
\end{align}
Here $U^{n+1}$ represents the vector of approximations $U_j^{n+1}$ at time $t^{n+1}$. The value $U_j^{n+1}$ at a particular point $j$ typically depends on several values from the vector $U^n$ (depending on how large the stencil is), and so we write
\begin{align}
U_j^{n+1} =\mathscript{H}_k(U^n; j)
\end{align}
to signify that $U^{n+1}_j$ depends on the full vector $U^n$. For example, the $\mathscript{H}_k$ operator for method \eqref{eq:leveqie10.7} takes the form
\begin{align}
\mathscript{H}_k(U^n;k) = U_j^n - \frac{k}{2 h}(U_{j+1}^n - U_{j-1}^n)
\end{align}
A list of often used discretizations is given here. This list is not exhaustive, but gives a rough idea of what is used in the wild. The graphics provide an idea of the stencil in space and time.
\begin{description}
\item[Backward Euler]
$$U_j^{n+1} = U_j^n-\frac{k}{2h} A(U_{j+1}^{n+1} - U_{j-1}^{n+1}) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,1) circle (0.1);
\draw (0.2,1) -- (0.8,1);
\fill[black] (1,1) circle (0.1);
\draw (1.2,1) -- (1.8,1);
\fill[black] (2,1) circle (0.1);
\draw(1,0.8) -- (1,0.2);
\fill[black] (1,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[One-sided]
$$U_j^{n+1} = U_j^n-\frac{k}{h} A(U_{j}^n - U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (1,0) circle (0.1);
\draw (0.2,0) -- (0.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1,0.2) -- (1,0.8);
\fill[black] (0,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[One-sided]
$$U_j^{n+1} = U_j^n-\frac{k}{h} A(U_{j+1}^n - U_{j}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (1,0) circle (0.1);
\draw (1.2,0) -- (1.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1,0.2) -- (1,0.8);
\fill[black] (2,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Lax-Friedrichs]
$$U_j^{n+1} = \frac{1}{2}(U_{j-1}^n + U_{j+1}^n)-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,0) circle (0.1);
\draw (0.2,0.2) -- (0.8,0.8);
\fill[black] (1,1) circle (0.1);
\draw (1.8,0.2) -- (1.2,0.8);
\fill[black] (2,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Lax-Wendroff]
$$U_j^{n+1} = U_j^n-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) + \frac{k^2}{2h^2}A^2(U_{j+1}^n - 2U_j^n + U_{j-1}^n) $$
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,0) circle (0.1);
\draw (0.2,0) -- (0.8,0);
\fill[black] (1,1) circle (0.1);
\draw (1.2,0) -- (1.8,0);
\fill[black] (2,0) circle (0.1);
\draw(1,0.8) -- (1,0.2);
\fill[black] (1,0) circle (0.1);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\item[Leapfrog]
$$U_j^{n+1} = U_j^{n-1}-\frac{k}{2h} A(U_{j+1}^n - U_{j-1}^n) $$ \begin{figure}[h!]
\begin{center}
\begin{tikzpicture}
\fill[black] (0,1) circle (0.1);
\draw (0.2,1.2) -- (0.8,1.8);
\fill[black] (1,2) circle (0.1);
\draw (1.2,1.8) -- (1.8,1.2);
\fill[black] (2,1) circle (0.1);
\draw(1.8,0.8) -- (1.2,0.2);
\fill[black] (1,0) circle (0.1);
\draw(0.8,0.2) -- (0.2,0.8);
\end{tikzpicture}
\end{center}
\end{figure}
\vspace{1cm}
\end{description}
\subsection{Local truncation error}
The local truncation error $L_k(x,t)$ is a measure of how well the difference equation models
the differential equation locally. It is defined by replacing the approximate solution $U_j^n$ in
the difference equations by the true solution $u(x_j,t^n)$. Of course this true solution of the
PDE is only an approximate solution of the difference equations, and how well it satisfies
the difference equations gives an indication of how well the exact solution of the difference
equations satisfies the differential equation.
As anexample, consider the Lax-Priedrichs method. This method is similar to the unstable method \eqrefd{eq:leveque10.7} but replaces $U_j^n$ by $1/2(U_{j-1}^n+U_{j+1}^n)$ and is stable
provided $k/h$ is sufficiently small, as we will see later.
We first write this method in the form
\begin{align}
\frac{1}{k}\left( U_j^{n+1} - \frac{1}{2}(U_{j-1}^n + U_{j+1}^n)\right +\frac{1}{2h} A (U_{j+1}^n - U_{j-1}^n) = 0
\end{align}
so that it appears to be a direct discretization of the PDE. If we now replace each $U_j^n$ by
the exact solution at the corresponding point, we will notget zero exactly. What we get
instead is defined to be thelocal truncation error
\begin{align}
L_k(x,t) = \frac{1}{k}\left( u(x,t+k) - \frac{1}{2}(u(x-h,t)+u(x+h,t))\right +\frac{1}{2h} A (u(x+h,t) - u(x-h,t))
\end{align}
In computing the local truncation error we always assume smooth solutions, and so we
can expand each term on the right hand side in a Taylor series about $u(x,t)$.
Doing this and collecting terms gives (with $u=u(x,t)$):
\begin{align}
L_k(x,t) &= \frac{1}{k}\left( (u+k\partial_t u +\frac{1}{2} k^2 \partial_t^2 u+\dots) - (u +\frac{1}{2}h^2 \partial_x^2 u+\dots)\right +\frac{1}{2h} A (2 h \partial_x u +\frac{1}{3}\partial_x^3 u+\dots)\\
&= \partial_t u + A\partial_x u +\frac{1}{2}\left(k\partial_t^2 u -\frac{h^2}{k} \partial_x^2 u \right) + \mathcal{O}(h^2)
\end{align}
Since we assume that $u(x,t)$ is the exact solution $\partial_t u +A\partial_x u =0i$ we find that
\begin{align}
L_k(x,t) &= \frac{1}{2} k \left( A^2 - \frac{h^2}{k^2}I\right) \partial_x^2 u(x,t) + \mathcal{O}(k^2)\\
&= \mathcal{O}(k) \ \text{as} \ k\to 0
\end{align}
\subsection{Stability}
%- Finite Differenzen
%- Finite Volumina
%- Flux-Limiter
%- Positivity
%- Fluiddynamik
%- MHD
\chapter{Hybridcodes}