next up previous contents
Next: Errors Up: Components of MHD Numerical Previous: Variable arrangement

Numerical differentiation

To get the time evolution of system variables, we should be able to derive the system values at time step \(t+\Delta t\) according to the system values at time step t. Practical MHD simulation equations provide the possibility of evolving these variables. One thing we need to do now is to find methods to perform numerical differentiation, as there are \(\frac{\partial}{\partial t}\)'s and \(\nabla\)'s in the MHD equations.

The most common way for time differentiation is Euler differentiation.


\begin{displaymath}\frac{\partial f}{\partial t}=\frac{f(t+\Delta t)-f(t)}{\Delta t}+O(\Delta t)
\end{displaymath} (49)

We can see that this way of differentiation on t has an error of order \(\Delta t\). A better way to achieve better accuracy is the leap-frog differentiation


\begin{displaymath}\frac{\partial f}{\partial t}=\frac{f(t+\Delta t)-f(t-\Delta t)}{2\Delta t}+O((\Delta t)^2)
\end{displaymath} (50)

The compensation for the high order accuracy of leap-frog differentiation is that it needs level values from two different time step(t and \(t-\Delta t\)) to get values at the third time step( \(t+\Delta t\)). At any time in the evolution of the system variables, we need to save two contiguous time step values, instead of one for the Euler differentiation. For small programs this extra demand poses no difficulty, but for large programs we have to balance the accuracy and resources to obtain the optimal result.

For the first-order space differentiation, there are three basic types. We will discuss these types for the one-dimensional case.

Forward differentiation:


\begin{displaymath}\frac{\partial f}{\partial x}=\frac{f(x+\Delta x)-f(x)}{\Delta x}+O(\Delta x)
\end{displaymath} (51)

Backward differentiation:

\begin{displaymath}\frac{\partial f}{\partial x}=\frac{f(x)-f(x-\Delta x)}{\Delta x}
+O(\Delta x)
\end{displaymath} (52)

Centered differentiation:

\begin{displaymath}\frac{\partial f}{\partial x}=\frac{f(x+\Delta x)-f(x-\Delta x)}{2\Delta x}
+O((\Delta x)^2)
\end{displaymath} (53)

We can see that centered differentiation has better accuracy, and for this reason it is most commonly used in first-order space differentiation.

For the second order differentiation, \(\frac{\partial^2f(x)}{\partial x^2}\), the most common differentiation method is:


\begin{displaymath}\frac{\partial^2f}{\partial x^2}=\frac{f(x+\Delta x)-2f(x)+f(x-\Delta x)}
{(\Delta x)^2}+o((\Delta x)^2)
\end{displaymath} (54)


next up previous contents
Next: Errors Up: Components of MHD Numerical Previous: Variable arrangement