3. The Modified Differential Equation¶
3.1. The Truncation Error¶
- The truncation error is the difference between the numerical scheme and the differential equation.
\[\epsilon_T = {\Delta t \over 2} \left . {\partial^2 u \over \partial t^2} \right \vert_i^n +
c {\Delta x^2 \over 6} \left . {\partial^3 u \over \partial x^3} \right \vert_i^n +
O(\Delta t^2) + O(\Delta x^4)\]
- NOTE: The exact solution of the numerical scheme satisfies a MODIFIED differential equation
3.2. Modified Differential Equation¶
- Consider exact solution of the discretised equation \(\rightarrow \bar{u}_i^n\):
\[{{\bar{u}_i^{n+1} - \bar{u}_i^n} \over {\Delta t}} + {c \over {2 \Delta x}} {(\bar{u}_{i+1}^n - \bar{u}_{i-1}^n)} \equiv 0\]
- From before, with \(u = \bar{u}\)
\[{{\bar{u}_i^{n+1} - \bar{u}_i^n} \over {\Delta t}} + {c \over {2 \Delta x}} {{(\bar{u}_{i+1}^n - \bar{u}_{i-1}^n)} } -
\left ( \left . {\partial \bar{u} \over \partial t} \right \vert_i^n +
\left . {{c}} {\partial \bar{u} \over \partial x} \right \vert_i^n \right ) =
\left .{{\Delta t} \over 2} {\partial^2 \bar{u} \over \partial t^2} \right \vert_i^n +
O(\Delta t^2) + O(\Delta x^2)\]
- The above implies that for the exact solution:
(1)\[\left . {\partial \bar{u} \over \partial t} \right \vert_i^n +
\left . c {\partial \bar{u} \over \partial x} \right \vert_i^n =
-{\Delta t \over 2} \left . {\partial^2 \bar{u} \over \partial t^2} \right \vert_i^n -
O(\Delta t^2) - O(\Delta x^2)\]
- Hence:
\[\left . {\partial \bar{u} \over \partial t} \right \vert_i^n = -
\left . c {\partial \bar{u} \over \partial x} \right \vert_i^n - O(\Delta t) - O(\Delta x^2)\]
- Take \(\partial \over {\partial t}\):
\[\left . {\partial^2 \bar{u} \over \partial t^2} \right \vert_i^n = -
\left . c {\partial^2 \bar{u} \over \partial x \partial t} \right \vert_i^n - O(\Delta t) - O(\Delta x^2)\]
- Or:
\[\left . {\partial^2 \bar{u} \over \partial t^2} \right \vert_i^n = -
\left . c {{\partial \over \partial x}{\left (\partial \bar{u} \over \partial t \right) }} \right \vert_i^n - O(\Delta t) - O(\Delta x^2)\]
- i.e.
(2)\[\left . {\partial^2 \bar{u} \over \partial t^2} \right \vert_i^n =
\left . c^2 {{\left (\partial^2 \bar{u} \over \partial x^2 \right) }} \right \vert_i^n - O(\Delta t) - O(\Delta x^2)\]
- Substitute Equation (2) into Equation (1). The exact solution to the numerical scheme \(\bar{u}\) satisfies the following differential equation - called the Modified Differential Equation
\[\left . {\partial \bar{u} \over \partial t} \right \vert_i^n +
\left . c {\partial \bar{u} \over \partial x} \right \vert_i^n = -
\left . {{c^2 \Delta t} \over 2} {{\left (\partial^2 \bar{u} \over \partial x^2 \right) }} \right \vert_i^n -
O(\Delta t) - O(\Delta x^2)\]
- Observations: The Modified Differential Equation is NOT a convection equation, it is a convection-diffusion equation, with a numerical diffusion coefficient equal to:
\[{-c^2 \Delta t} \over 2\]
- This is negative diffusion - a process of explosion
- This shows why the scheme is UNSTABLE - it will amplify any disturbance exponentially
- The Modified Differential Equation and the Truncation Error provide essential information about the scheme
3.2.1. Summary of the Method for obtaining the Modified DE¶
- Denote \(D(u)=0\) the mathematical model we are to solve numerically (the Differential Equation)
- And \(N(u_i^n)=0\) the numerical scheme (the Numerical Scheme)
How to obtain the Modified Differential Equation?
- Perform consistency analysis, using Taylor series and obtain the truncation error \(\epsilon_T\)
\[N(u_i^n)-D(u)=\epsilon_T\]
- Consider the exact solution of the numerical scheme \(\bar{u}_i^n\) defined by
\[N(\bar{u}_i^n)\equiv 0\]
leaning to the differential equation \(D(\bar(u)_i^n)=-\epsilon_T\)
- Replace lowest time derivative by space derivatives in \(\epsilon_T\) by applying Differential Equation from 2)
- The Modified Differential Equation is defined as an equation obtained after replacement step 3), restricted to the lowest order terms (contains only space derivatives)
3.3. Example: Convection with 1st order Upwind (BD in space, FD in time)¶
- Introduce the Taylor expansions as before
- Follow steps just listed
The Modified Differential Equation looks like this:
\[\left . {\partial \bar{u} \over \partial t} \right \vert_i^n +
\left . c {\partial \bar{u} \over \partial x} \right \vert_i^n =
\left . {{c \Delta x} \over 2} \left ( 1-{{c \Delta t} \over {\Delta x}} \right )
{{\partial^2 \bar{u} \over \partial x^2 }} \right \vert_i^n\]
The Diffusion Term is:
\[{{c \Delta x} \over 2} \left ( 1-{{c \Delta t} \over {\Delta x}} \right )\]
3.4. CFL Condition¶
The CFL Condition is to ensure stability of the scheme:
\[\text {For } c \gt 0\]\[\sigma = {{c \Delta t} \over {\Delta x}} \lt 1\]
\(\sigma\) is called the CFL number, the Courant-Friedrichs-Lewy number
- CFL has a deep physical significance
- For a constant value of \(\sigma \lt 1\) this scheme has numerical diffusion of \(O(\Delta x)\) which is generally excessive (the scheme has poor accuracy)