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 (Δ⁢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 ϕn of unknowns (i.e. Field values in OOF2) at time tn , and the first order differential equation

d⁢ϕd⁢t=f⁢(ϕ,t)
(6.129)

the Crank-Nicolson estimate for ϕn+1 is

ϕn+1=ϕn+12⁢Δ⁢t⁢[f⁢(ϕn,tn)+f⁢(ϕn+1,tn+1)]
(6.130)

where Δ⁢t=tn+1−tn . The need to solve equation (6.130) for ϕ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.142).

Generalized Euler Methods

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

ϕn+1=ϕn+Δ⁢t⁢[(1−θ)⁢f⁢(ϕn,tn)+θ⁢f⁢(ϕn+1,tn+1)]
(6.131)

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

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

See Also