OOF2: The Manual

Name

Crank-Nicolson (CrankNicolson) — Semi-implicit first order time stepping, theta=0.5.

Synopsis

CrankNicolson()

Details

Description

The Crank-Nicolson method is a method of numerically integrating ordinary differential equations. It is second order in time, meaning that it makes an error only of order \( (\Delta t)^3 \)
  on each step, and is more accurate and more stable than the ForwardEuler method, but it is more expensive to compute.

Given a vector \(\phi_n\) of unknowns (i.e. Field values in OOF2) at time \(t_n\), and the first order differential equation


      \[ \frac{d\phi}{dt} = f(\phi, t) \]
    (6.128)

the Crank-Nicolson estimate for \(\phi_{n+1}\) is

 
      \[ \phi_{n+1} = \phi_n +
      \frac12 \Delta t \left[f(\phi_n, t_n)  + f(\phi_{n+1},t_{n+1})\right]
      \]
    (6.129)

where \( \Delta t = t_{n+1}-t_n
  \). The need to solve equation (6.129) for \(\phi_{n+1}\), which appears on both sides, makes CrankNicolson a semi-implicit method, requiring more CPU time than an explicit method such as ForwardEuler, especially when \(f\) is nonlinear.

CrankNicolson can be applied to equations with second order time derivatives via equation (6.141).

Generalized Euler Methods

CrankNicolson is an example of a Generalized Euler method, which is a combination of the ForwardEuler and BackwardEuler methods:


\[ \phi_{n+1} = \phi_n +
\Delta t \left[ (1-\theta)f(\phi_n,t_n) + \theta f(\phi_{n+1},t_{n+1})
\right]
\]
      (6.130)

where \(\theta\) is a number between 0 and 1. \(\theta=0\) gives the fully explicit ForwardEuler method. \(\theta=1\) gives the fully implicit BackwardEuler method. Intermediate values give semi-implicit methods, such as CrankNicolson (\(\theta=0.5\)).

The error in the generalized Euler methods is of order \( (\Delta t)^2 \)
    , except for CrankNicolson, which is \( (\Delta t)^3 \)
    .