Merge branch 'master' of masterduck.fspanier.de:fspanier/teaching into master

This commit is contained in:
2022-12-15 10:05:16 +01:00
4 changed files with 297 additions and 6 deletions
+87
View File
@@ -0,0 +1,87 @@
\documentclass[12pt,a4paper]{uebungen}
\usepackage{german}
\usepackage[utf8]{inputenc}
\usepackage{epsfig}
\usepackage[amssymb]{SIunits}
\usepackage{wrapfig}
\usepackage{graphics}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{url}
\usepackage{pgf}
\usepackage{listings}
\lstset{language=[ANSI]C++,basicstyle=\ttfamily,commentstyle=\itshape,
keywordstyle=\bfseries,extendedchars=true,backgroundcolor=\color{gray}}
%------------------------------------------------------------------------------
%\graphicspath{{../../../GALLERY/}}
%------------------------------------------------------------------------------
\setlength{\topmargin}{-2.5cm}
\setlength{\textheight}{26.0cm}
\setlength{\textwidth}{17cm}
\setlength{\oddsidemargin}{-0.5cm}
\setlength{\evensidemargin}{-0.5cm}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}
\pagestyle{empty}
%------------------------------------------------------------------------------
\newcommand{\vt}[1]{\vec{#1}}
\newcommand{\mt}[1]{\underline{\underline{#1}}}
\newcommand{\dt}[1]{\left\vert\underline{\underline{#1}}\right\vert}
\newcommand{\mo}{\!\!\!\!\!-1}
%------------------------------------------------------------------------------
\def\bbbr{{\rm I\!R}}
%------------------------------------------------------------------------------
\begin{document}
%------------------------------------------------------------------------------
\thispagestyle{myheadings}
\begin{center}
{\bf \underline{\Large Exercises in ``Numerical Methods in Plasma Astrophysics''}}\\
%\hfill\\
%{\bf \large }\\
\hfill\\
{\bf \large Winter 2022/23 \hfill Exercise 7}\\
\end{center}
\noindent
%
\section*{\large Exercise 7: Incompressible Navier-Stokes equation}\vspace*{-0.0cm}
%
The motion of incompressible fluids is described by the Navier-Stokes equation
\begin{align}
\partial_t \vec{u} + \vec{u}\cdot\nabla\vec{u} &= \nu\Delta\vec{u}\\
\nabla\cdot\vec{u} &= 0
\end{align}
Following the Helmholtz theorem $\vec u$ can be decomposed into a curl-free and divergence-free part. This leads to the vorticity stream formulation
\begin{align}
\vec \omega &= \nabla\times\vec u\\
\vec u &= \nabla \times \Psi\\
\Rightarrow \Delta \vec \Psi &= - \vec \omega
\end{align}
The advantage of this formulation is that $\vec u$ is automatically divergence-free. Additionally $\vec \Psi$ and $\vec \omega$ become pseudo-scalars for the 2D case.
The Navier-Stokes equation in the vorticity-stream formulation in two dimensions is given by
\begin{align}
\partial_t \omega &= (\omega \nabla)\vec u + \nu \Delta \omega
\end{align}
This can be solved using a pseudospectral method
\begin{align}
\partial_t \tilde\omega &= \widetilde{(\omega \nabla)\vec u} + \nu \Delta \tilde\omega
\end{align}
The nonlinearity has to be solved in real space (which makes it a pseudospectral method).
\bigskip
\textbf{a)} Write a pseudospectral solver for the vorticity-stream formulation. $\omega$ and $\Psi$ are treated as pseudoscalars. The nonlinearity is calculated in realspace and then transformed to Fourier space. In order to avoid aliasing the upper two thirds of the spectrum should be zeroed.
\textbf{b)} Perform simulations using the testcase
$$\omega(x,y) = A\cdot\left(\exp\left[-\alpha((x-x_1)^2+(y-y_1)^2)\right] + \exp\left[-\alpha((x-x_2)^2+(y-y_2)^2)\right] \right)
$$
%\textbf{c)} Calculate the conservation of $u$.
\vfill
Rubber ducks like swimming in incompressible fluids.
\end{document}
%------------------------------------------------------------------------------
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

+210 -6
View File
@@ -4077,16 +4077,115 @@ the Jacobi determinant for each point and determines the eigenvectors.
eigenvectors. This makes the method considerably less eigenvectors. This makes the method considerably less
more time-consuming than other approaches. more time-consuming than other approaches.
\subsection{Multi-dimensional extension}
The multi-dimensional CWENO scheme is best illustrated via the example of the two-dimensional scheme. \subsection{The Two-Dimensional CWENO Scheme}
The only step in the scheme sometimes not easily extended to higher dimensions is the reconstruction
of point values from the cell averages. This, however, will be the issue of the next section. The two dimensional The multi-dimensional CWENO scheme is best illustrated via the example of the two-dimensional scheme. The only step in the scheme sometimes not easily extended to higher dimensions is the reconstruction of point values from the cell averages. This, however, will be the issue of the next section. The two-dimensional scheme will be applied to hyperbolic differential equations of the form:
scheme will be applied to hyperbolic differential equations of the form:
\begin{align} \begin{align}
\partial_t \vec{u} + \partial_x f(\vec{u}) + \partial_y g(\vec u) = 0 \partial_t \vec u + \partial_x f(\vec{u}) + \partial_y g(\vec u) = 0\label{eq:ralph3.2}
\end{align} \end{align}
This equation is examined on a discrete spatial grid with cells given by: This equation is examined on a discrete spatial grid with cells given by:
\begin{align}
\left(x_i -\frac{\Delta x}{2}\dots x_i +\frac{\Delta x}{2} \right) \times \left( y_j -\frac{\Delta y}{2}\dots y_j +\frac{\Delta y}{2} \right)
\end{align}
For these individual cell the scheme will compute the average values of $\vec u$, which will from now on be termed as cell-averages of $\vec u$. Since the scheme has to deal with point values on the cell boundaries, too, these point values are evaluated from the cell averages by the application of a piecewise polynomial reconstruction – that is the spatial variation of $\vec u$ is approximated by a polynomial of the desired order. For the second-order version of the scheme one can, e.g., assume this reconstruction in the cell $C_{i, j}$ at time $t^n$ to be of the form:
\begin{align}
\vec{p}_{i,j}(\vec x, t^n) = \vec{p}_{i,j}^n(x,y) = \vec{u}_{0i,j} + \vec{u}_{xi,j}(x-x_i) + \vec{u}_{yi,j}(y-y_j)
\end{align}
While a cross-term containing both linear parts may also be added, it is not of any importance, because it cancels out due to the evaluation of these polynomials on the middle of the cell faces in the final form of the second order scheme (see below). One has to bear in mind that these polynomials are given for just one cell. Thus, there is an ambiguity at the cell boundaries as to which of these reconstructions is to be used. For this we introduce the notation $p^\pm$, where, e.g., $p^+_{i+1/2,j}$ is the point value at the upper x-boundary
of cell $C_{i, j}$ with the reconstruction stemming from the next cell $C_{i+1, j}$.
From this one obtains the cell-averages via integration as:
\begin{align}
\bar{\vec u}_{i,j} = \frac{1}{\Delta x \Delta y} \int_{y_{j-1/2}}^{y_{j+1/2}}\dd y \int_{x_{i-1/2}}^{x_{i+1/2}}\dd x \vec{p}_{i,j}^n (x,y)
\end{align}
where $x_{i\pm 1/2}$ and $y_{j\pm 1/2}$ signify the cell boundaries in the corresponding directions. For further reference the point values evaluated using such a reconstruction at some specific points are getting labelled:
\begin{align}
\vec{u}_{i,j}:= \vec{p}_{i,j}^n(x_i,y_j), \quad \vec{u}^N_{i,j}:= \vec{p}_{i,j}^n(x_i,y_{j+1/2}), \quad \vec{u}^{NE}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j+1/2}),\\
\vec{u}^{E}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j}),\quad \vec{u}^{SE}_{i,j}:= \vec{p}_{i,j}^n(x_{i+1/2},y_{j-1/2}),\quad \vec{u}^{S}_{i,j}:= \vec{p}_{i,j}^n(x_{i},y_{j-1/2}),\\
\vec{u}^{SW}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j-1/2}),\quad \vec{u}^{W}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j}),\quad \vec{u}^{NW}_{i,j}:= \vec{p}_{i,j}^n(x_{i-1/2},y_{j+1/2}),
\end{align}
With all this in mind the equations are basically solved by a spatial integration of the system in Eq.\eqref{eq:ralph3.2} over each cell and an integration in time from the actual to the next time step. There is, however, a problem inherent in this integration directly connected to the reconstruction. With every cell having in general an individual reconstruction polynomial there may occur a jump in the different polynomial reconstructions from one cell to another. The integration of Eq. \eqref{eq:ralph3.2} over each cell and over one time
step results in:
\begin{align}
\bar{\vec u}_{i,j}^{n+1} = \bar{\vec u}_{i,j}^{n} -\dd x \int_{t^n}^{t^{n+1}} \dd \tau
\left( f(\vec{u}(x_{i+1/2},y_j,\tau) - f(\vec{u}(x_{i-1/2},y_j,\tau) + g(\vec{u}(x_{i},y_{j+1/2},\tau) - g(\vec{u}(x_{i},y_{j-1/2},\tau) \right)
\end{align}
This equation does not look too bad but due to the discontinuities where the fluxes are to be evaluated, one would have to solve a generalised Riemann problem at these positions to obtain the temporal evolutions of the fluxes, which is a numerically very expensive task.
We can, however, make use of the fact that such a jump can only propagate with a finite velocity
depending on the system of equations to be solved with the scheme. In general this maximum propagation velocity will change with space and time. Therefore, when we would like to integrate the system in Eq. \eqref{eq:ralph3.2}) over one cell and over the time-interval $[t^n, t^{n+1}]$ only the data near the cell boundaries as, e.g., illustrated in Fig. \ref{fig:ralph3.1} might be non-smooth at any time between $t^n$ and $t^{n+1}$. Thus, instead of integrating each entire cell we treat the smooth and non-smooth domains individually. This leads to a scheme, which
does not have to utilise Riemann solvers, while still producing high-order results, since we average the non-smooth parts of the solutions over a domain as small as possible. This has to be seen in contrast to the Nessyahu-Tadmor scheme (Nessyahu and Tadmor 1990) where an integration is performed over a complete staggered cell.
\begin{figure}
\begin{center}
\pgfimage[width=.5\textwidth]{fig_chapter5/ralph3.1}
\end{center}
\caption{The area around the cell $x_i, y_j$ with the non-smooth regions hatched.}
\label{fig:ralph3.1}
\end{figure}
To perform the integration over the smooth and the non-smooth regions separately one needs an
estimate for the form of these areas which also has to be able to reflect the order of the scheme. It will, however, become evident that the transfer into the semidiscrete framework simplifies things again. A semidiscrete scheme is one, which was derived utilising the fact that the time step $\dd t$ is small as compared to any characteristic time scale of the system of hyperbolic equations with regard to a single numerical cell. The use of the semidiscrete limit is motivated by the fact that a fully discrete scheme suffers from higher numerical dissipation. This results from an accumulation of excessive dissipation due to the small time steps needed in a fully discrete scheme. The size of these time steps is mainly determined by the CFL condition first introduced in one of the first papers on finite difference methods for partial differential equations by Courant et al. (1928). This is a necessary condition for the stability of a numerical scheme. It essentially states that a numerical method can only be convergent if its numerical domain of dependence contains the true domain of dependence of the actual partial differential equation. With respect to this condition a fully discrete scheme has to fulfil the restricted condition $\Delta t \propto (\Delta x)^2$ for the time step, whereas for the semidiscrete scheme it is possible to use the convective CFL condition see also Kurganov and Levy (2000). Apart from that we enjoy the fact that a semidiscrete scheme is much
simpler than a fully discrete one.
\begin{figure}
\begin{center}
\pgfimage[width=.5\textwidth]{fig_chapter5/ralph3.2}
\end{center}
\caption{High-order approximation for the non-smooth regions in the individual cells for the CWENO scheme}
\label{fig:ralph3.2}
\end{figure}
An example for a high order estimation for the form of those regions of non-smooth data is illustrated in Fig. \ref{fig:ralph3.2}. In this figure we distinguish three types of regions. First there is the smooth region in the inner part of each cell. Secondly the light gray and the dark grey regions indicate regions possibly holding non-smooth data. The dark grey regions can, however, safely be neglected. This is due to the fact that we are using the semidiscrete form of the scheme, which says that we are solving the system of equations in the limit $\dd t \to 0$.
In the semidiscrete limit the size of the dark-grey regions can be estimated to be:
\begin{align}
D_{i+1/2,j+1/2} = (a^+_{i+1/2,j+1/2}+a^-_{i+1/2,j+1/2}+)(b^+_{i+1/2,j+1/2}+b^-_{i+1/2,j+1/2})\dd t^2+\mathcal{O}(\dd t^3)
\end{align}
where $D_{i+1/2,j+1/2}$ indicates the corresponding region in Fig. \ref{fig:ralph3.2}. Additionally, a± are the right- and left-handed maximum propagation velocities for discontinuities for the upper right corner in the x-direction respectively. In the same way b± corresponds to the signal propagation velocities in the y-direction. Like the equations describing the problem under consideration these velocities have to be specified corresponding to the problem. They are obtained from the Jacobian for each direction. The size of this region is of second order in time and can, therefore, safely be neglected in the semidiscrete limit.
As compared to this the light-grey areas can be estimated to have the size
\begin{align}
D_{i+1/2,j} = (a^+_{i+1/2,j+1/2}+a^-_{i+1/2,j+1/2}+)\dd t (\Delta y -(b^+_{i+1/2,j+1/2}+b^-_{i+1/2,j+1/2})\dd t)+\mathcal{O}(\dd t^3)
\end{align}
which is of the order $\dd t$, thus, showing that the dark-grey areas can indeed be neglected as compared to these. So, it is clear that we only have to discuss the light-grey areas and the undisturbed area in the centre of the cell.
As mentioned above, we have to integrate the system over the individual areas separately in order to avoid Riemann-solvers and to obtain the highest possible order. In turn we have to use some procedure to get from this distributed framework back to the original grid. The overall method can be split in three major steps:
\begin{enumerate}
\item Integration of the system over the light-grey and the undisturbed domains indicated in Fig. \ref{fig:ralph3.2} utilising a local polynomial reconstructions to obtain averages for all domains for the next time step.
\item These averages are then used to obtain a reconstruction of all necessary point values at the next time step.
\item This is then projected to the original grid, thus, finally yielding cell averages at time tn+1.
\end{enumerate}
For step 1 the cell averages over the domains indicated in Fig. \ref{fig:ralph3.2} are designated as:
\begin{align}
\int_{D_{i,j}} \longrightarrow \bar{\omega}_{i,j},\quad \int_{D_{i+1/2,j}} \longrightarrow \bar{\omega}_{i+1/2,j},\quad \int_{D_{i,j+1/2}} \longrightarrow \bar{\omega}_{i,j+1/2}
\end{align}
From these cell averages given at time $t^n$ we compute local averages at time $t^{n+1}$. From these local average $\omega^{n+1}$ we compute local piecewise polynomial reconstructions $\tilde{\omega}^{n+1}$. The global pievewise polynomial reconstruction needed for the second step of the above procedure is the written as
\begin{align}
\tilde{\omega}^{n+1} (x,y) = \sum_{i,j}\left(\omega_{i,j}^{n+1} \chi_{i,j} + \tilde{\omega}^{n+1}_{i+1/2,j}\chi_{i+1/2,j} + \tilde{\omega}_{i,j+1/2}\chi_{i,j+1/2} \right)
\end{align}
Here the $\chi$s are the characteristic functions of the corresponding domains $D$.
The third step consists of the projection of this interpolant onto the original grid according to:
\begin{align}
\bar{\vec u}^{n+1} = \frac{1}{\Delta x \Delta y} \int_{y_{j-1/2}}^{y_{j+1/2}}\dd y \int_{x_{i-1/2}}^{x_{i+1/2}}\dd x \tilde{\omega}^{n+1}(x,y)
\end{align}
With these results we find when neglecting terms of order $\mathcal{O}(\dd t^2)$
\begin{align}
\frac{\dd}{\dd t}\bar{u}_{i,j}(t) &= \lim_{\Delta t \to 0} \frac{\bar{\vec{u}}^{n+1}_{i,j}-\bar{\vec{u}}^{n}_{i,j}}{\Delta t}\\
&= \lim_{\Delta t \to 0} \left( \sum_\pm \frac{|D_{i\pm 1/2,j}\cap C_{i,j}|}{\Delta t \Delta x \Delta y} \bar{\omega}^{n+1}_{i\pm 1/2,j} + \sum_\pm \frac{|D_{i,j\pm 1/2}\cap C_{i,j}|}{\Delta t \Delta x \Delta y} \bar{\omega}^{n+1}_{i,j\pm 1/2} + \frac{|D_{i,j}\cap C_{i,j}|}{ \Delta x \Delta y} \bar{\omega}^{n+1}_{i,j} \right)
\end{align}
The terms on the RHS can be calculated
\begin{align}
\frac{|D_{i\pm 1/2,j}\cap C_{i,j}|}{\Delta t \Delta x \Delta y} \bar{\omega}^{n+1}_{i\pm 1/2,j} &= \frac{a_{i\pm 1/2,j}^\pm}{(a_{i\pm 1/2,j}^+ + a_{i\pm 1/2,j}^-)\Delta x} \left(\left( \pm a_{i\pm 1/2,j}^\pm \vec{u}^{W(E)}_{i+1/2,j} \mp a_{i\pm 1/2,j}^\mp \vec{u}^{E(W)}_{i+1/2,j} \right) \nonumber\\ & - \left(\pm f(\vec{u}_{i\pm 1,j}^{W(E)}) \mp f(\vec{u}_{i,j}^{E(W)}) \right) \right)
\end{align}
\chapter{MHD equations} \chapter{MHD equations}
@@ -4276,8 +4375,113 @@ the frozen-in condition. Therefore, any significant violation due
to numerical errors can easily invalidate the results from numerical to numerical errors can easily invalidate the results from numerical
simulations (not only in MHD systems). simulations (not only in MHD systems).
\section{CWENO for Numerical MHD}
Even for the two-fluid system using the CWENO scheme we essentially have to solve the hyperbolic part of the equations. The source terms will be taken into account separately. This is sensible insofar as each aspect of the equations is solved with the most appropriate method. Having to solve only the hyperbolic part of the equations with the CWENO solver means that the system of equations is reduced to the MHD equations for the charged particle fluid and to the hydrodynamic equations for the neutral fluid. Here we discuss the explicit implementation of the MHD equations into the CWENO scheme, since the hydrodynamic equations are basically included therein.
As seen in the discussion of the CWENO scheme it does not need as much adaptation as, e.g., a
Riemann solver. For the former it is not necessary to use different solvers for hydrodynamical or MHD simulations. The only inputs that have to be given are the system of equations to be solved and the formula for the derivation of the maximum of the characteristic speeds at the cell boundaries.
It is shown that the characteristic speeds correspond to the
eigenvalues of the Jacobian of the system for the individual directions.
The resulting characteristic speeds are
\begin{align}
\lambda_1 &= u_x\\
\lambda_{2,3} &= u_x \pm v_{Ax}\\
\lambda_{4,5} &= u_x \pm v_{fx}\\
\lambda_{6,7} &= u_x \pm v_{sx}
\end{align}
for the x-direction. Here the following definitions have been used for the normalised system of equations:
\begin{align}
c_s &= \sqrt{\gamma \frac{p}{\rho}} & \text{speed of sound}\\
v_A &= \frac{B}{\sqrt{4\pi\rho}} & \text{Alfv\'en speed}\\
v_{f_x} &= \frac{1}{\sqrt{2}} \sqrt{c_s^2+v_A^2 + \sqrt{}(c_s^2+v_A^2)^2-(2c_s v_{Ax})^2} & \text{fast magnetosonic} \label{eq:ralph3.44}\\
v_{s_x} &= \frac{1}{\sqrt{2}} \sqrt{c_s^2+v_A^2 - \sqrt{}(c_s^2+v_A^2)^2-(2c_s v_{Ax})^2} & \text{slow magnetosonic}
\end{align}
Thus, we can identify four different wave types: $\lambda_{2,3}$ obviously indicates Alfv\'en waves and $\lambda_{4,5}$ and $\lambda_{6,7}$ represent the propagation of the fast and slow magneto-acoustic modes. Finally $\lambda_{1}$ indicates a wave not propagating in space, which is identified in Kalikhman (1967) as an entropy wave. All in all, the Jacobian has distinct eigenvalues, which are always real. Therefore, the system is strictly hyperbolic, which is a
necessary ingredient for the numerical method.
For the CWENO method we do not have to evaluate all of the characteristic speeds. Rather it is
sufficient to find the maximum possible speeds at the boundaries of the cells. For example the velocities $a^\pm$ needed for the scheme are the highest possible speeds to the left and
to the right, respectively.
For the MHD equations clearly $\lambda_{4,5}$ dominate all other possible speeds. Designating $\lambda_{4}$ as the one with the positive sign, this is usually the highest possible speed. Only for a negative flow velocity $u_x$ greater than the fast magnetosonic speed $v_{fx}$ the corresponding speed has to be set to zero. The highest possible speed to the left on the other hand is $\lambda_{5}$. Therefore, the local speeds $a^\pm$ in the x-direction to be used in the CWENO scheme are
\begin{align}
a^+ &= \text{max}(u_x + v_{fx},0)\\
a^- &= \text{max}(u_x - v_{fx},0)
\end{align}
Initially this might seem as if one has to supply as much information on the system as would be necessary for a Riemann solver. Luckily, however, Eq. \eqref{eq:ralph3.44} can also be applied to strictly hydrodynamical simulations, for which the magnetic induction merely has to be set to zero. Moreover, one has to keep in mind that so far no exact Riemann solver for MHD problems is known, whereas the corresponding velocities necessary for the implementation of the CWENO scheme can very well be found. Finally, a Riemann solver would also have to yield the spatial dependence of all the other variables involved, which is not necessary here.
\section{Solenoidality of the Magnetic Field}
There are various strategies available to ensure the absence of magnetic monopoles for numerical computations as required by the corresponding Maxwell equation
\begin{align}
\nabla\cdot\vec B = 0
\end{align}
This equation has to be fulfilled at all times. Analytically this is guaranteed by the normalised evolutionequation for the magnetic induction
\begin{align}
\diffp{\vec B}{t} = \nabla\times(\vec u \times \vec B) = 0
\end{align}
Therefore, analytically the divergence of the magnetic induction evolves according to:
\begin{align}
\diffp{\nabla \cdot \vec B}{t} = \nabla\cdot(\nabla\times(\vec u \times \vec B)) = 0
\end{align}
Thus, an initially solenoidal magnetic induction will analytically be solenoidal for all times. Numerically, unfortunately, things look a little different. In this case we are using the hyperbolic form of the above equation:
\begin{align}
\diffp{\vec B}{t} = -\nabla\times(\vec u \vec B - \vec u \vec B) = -\nabla\cdot\begin{pmatrix} 0 & u_x B_y - u_y B_x & u_x B_z - u_z B_x\\ u_y B_x - u_x B_y & 0 & u_y B_z - u_z B_y \\ u_z B_x - u_x B_z & u_z B_y - u_y B_z & 0\end{pmatrix}
\end{align}
Analytically the two forms are completely equivalent. Unfortunately, however, this is
not the case anymore when using the discrete version of the equation. Additionally the truncation errors introduced by any numerical computation can accumulate during a numerical simulation. All in all it is necessary to find some method to ensure the solenoidality of the magnetic field. Otherwise numerical monopoles are introduced yielding physically wrong results.
To ensure the solenoidality of the magnetic field also for the numerical simulations at hand there are basically three typical methods available. These methods will here be briefly introduced one by one.
\subsection{Lagrangian Multipliers}
The method of Lagrangian multipliers was first implemented by Assous et al. (1993) for the numerical solution of the Maxwell equations. They introduced a Lagrangian multiplier to couple the divergence constraint to the other evolution equations. This idea was extended to the MHD equations by Dedner et al. (2002). They introduced an additional function $\Psi$, which is integrated together with the MHD equations. Generally this variable is introduced to couple the solenoidality constraint to the other equations. This means that the system is extended to the form:
\begin{align}
\diffp{\vec B}{t} &= -\nabla\times(\vec u \vec B - \vec u \vec B) - \nabla \Psi\\
\mathcal{D}(\Psi) &= - \nabla \cdot \vec{B}
\end{align}
with $\mathcal{D}$ some linear differential operator. Of the different possibilities for this operator:
\begin{align}
\mathcal{D}(\Psi) &= \frac{1}{c_h^2}\diffp{\Psi}{t} + \frac{1}{c_p^2}\Psi
\end{align}
could be shown to be the best choice. This results in an evolution equation of the form:
\begin{align}
\partial_t \Psi = -c_h^2 \nabla\cdot\vec B - \frac{c_h^2}{c_p^2}\Psi
\end{align}
This is generally denoted as the mixed generalised Lagrange multiplier (GLM) formulation. The interesting thing about this choice for the operator $\mathcal{D}$ is that it allows for hyperbolic ($c_h$) and parabolic ($c_p$) corrections at the same time. Especially the hyperbolic part is very interesting since it allows the transport of the divergence out of the numerical domain with the velocity $c_h$. Although this method proved to be very efficient for many numerical problems, it is unfortunately not very interesting for our problem. Due to the periodic boundary conditions it is not possible to transport the non-zero divergence out of the
numerical domain. Moreover, the fact that the turbulence is homogeneous means that there is no place in the numerical domain where we can shift the divergence to.
\subsection{Projection Schemes}
An alternative way to get rid of unphysical magnetic monopoles is based on the works by Chorin. In a series of papers he introduced the so-called projection scheme to guarantee the incompressibility of the numerical solution of the Navier-Stokes equation (see Chorin 1967, 1968, 1969). This scheme was first applied to the MHD equations by Brackbill and Barnes (1980). The idea of these schemes is to evolve the MHD equations by some arbitrary numerical scheme and after each time step to project the resulting magnetic induction to a divergence free field. For doing so the magnetic induction is decomposed into the sum of a solenoidal and a divergence containing field:
\begin{align}
\vec B = \nabla \times \vec A + \nabla \Phi
\end{align}
where the scalar field $\Phi$ is responsible for the divergence of the field. Therefore, the field $\vec A$ can be said to be the physically meaningful part of the magnetic induction. Thus, all that has to be done is to subtract this part from the magnetic induction in order to obtain a solenoidal magnetic field. By taking the divergence of the above equation one easily finds an equation determining the scalar field:
\begin{align}
\nabla^2 \Phi = \nabla\cdot\vec B
\end{align}
The essential step, therefore, is to solve this Poisson equation. After this the divergence free magnetic field is easily obtained by:
\begin{align}
\vec B \rightarrow \vec B - \nabla \Phi
\end{align}
The actual solution of the Poisson equation can be obtained by many different methods quite easily. For this work we used a multi-grid solver or a Fourier solver (the latter was used whenever use of the fftw (see Frigo 2004) library was necessary anyhow ) for the solution of this equation. For both solvers we showed the solenoidality of the magnetic field to be assured up to the round off error. For a numerical solver, however, this can only be achieved for one kind of discretisation i.e. we have to decide for one discretisation of the divergence of the magnetic induction – only for this discretisation we will be able to assure the solenoidality. This is also true for any other method to assure the solenoidality of the magnetic field.
Despite the fact that this method yields divergence-free fields to the round off error it proved to be not acceptable for turbulence simulations. This is due to the fact that the method introduces additional small-scale fluctuations, which produce unphysical fluctuation spectra for the highest wavenumbers. There is an unphysical pile up of fluctuation energy at large
wavenumbers for the former solution. This was also observed by Balsara and Kim (2004). They found
that the excessive fluctuation energy at small scales is connected to the decoupling of even and odd grid points which occurs when using a centred finite difference for the representation of the divergence of the magnetic induction. The main problem, however, seems to be connected to spurious magnetic field structures produced by the projection schemes in general, which Balsara and Kim attribute to the non-locality of the projection schemes. This means that the correction does not take local shock structures into account, thus, yielding solutions not being conform to the shock solution anymore. Balsara and Kim identify the constrained transport schemes to be those best suited for turbulence simulations. Therefore, we also rely on such a scheme for our investigations.
\subsection{Constrained Transport Schemes}
The idea with constrained transport schemes is to formulate the equations in a way that the divergence of the magnetic induction vanishes in the desired discretisation. Originally this method was introduced by Evans and Hawley (1988) where the authors introduce a staggered grid for the magnetic induction to maintain the solenoidality of the scheme for finite difference schemes. For this they write the induction equation explicitly via the curl of the electric field:
%- Finite Differenzen %- Finite Differenzen
%- Finite Volumina %- Finite Volumina
%- Flux-Limiter %- Flux-Limiter