Skip to content
Oakfield Operator Calculus Function Reference Site

Crank–Nicolson Integration

For ut=F(u,t)u_t = F(u,t) and timestep Δt\Delta t, the Crank–Nicolson update solves

un+1=un+Δt2(F(un,tn)+F(un+1,tn+1))u^{n+1} = u^{n} + \frac{\Delta t}{2}\Big(F(u^{n}, t_n) + F(u^{n+1}, t_{n+1})\Big)

implicitly for un+1u^{n+1}.

Applies to time-dependent states unu^n in Rm\mathbb{R}^m (or function spaces) with Lipschitz FF. Output un+1u^{n+1} is defined by solving a nonlinear or linear system each step.


Crank–Nicolson is second-order accurate in time for smooth FF. For linear problems it is symmetric (time-reversible) and can preserve qualitative structure better than first-order implicit stepping.

For the linear test equation ut=λuu_t = \lambda u,

un+1=1+12z112zun,z=λΔtu^{n+1} = \frac{1 + \tfrac{1}{2}z}{1 - \tfrac{1}{2}z}\,u^n, \qquad z = \lambda \Delta t

The method is A-stable but not strongly damping for (z)0\Re(z)\ll 0, so very stiff dissipative modes may decay slowly and can exhibit weak oscillations in some settings.

Each step requires a linear or nonlinear solve for un+1u^{n+1}; fixed-point iteration and Newton-type methods are common.


Reduces to the trapezoidal rule for scalar ODEs. For linear F(u,t)=Au+g(t)F(u,t) = Au + g(t), the update solves (IΔt2A)un+1=(I+Δt2A)un+Δt2(gn+gn+1)(I - \tfrac{\Delta t}{2}A)u^{n+1} = (I + \tfrac{\Delta t}{2}A)u^{n} + \tfrac{\Delta t}{2}(g^{n} + g^{n+1}).


Compared with explicit Runge–Kutta methods (e.g., RK4), Crank–Nicolson trades nonlinear solves for unconditional stability on diffusion operators.


Oakfield exposes Crank–Nicolson as an implicit built-in integrator implemented via fixed-point iteration:

  • Integrator name: crank_nicolson (Lua: sim.sim_create_context_integrator(ctx, "crank_nicolson", {...})).
  • Solve strategy: iterates on the implicit midpoint/trapezoid equation using a Picard-style update until the guess/update residual drops below the integrator tolerance (no Jacobians/Newton).
  • Adaptive fallback: when adaptive = true, Oakfield reduces dt across a small number of attempts if convergence is not achieved.
  • Complex + stochastic support: handles complex primary fields and supports optional stochastic increments after the implicit update.

Crank–Nicolson arose from mid-20th-century work on numerically solving diffusion equations with finite differences, combining the trapezoidal rule in time with practical linear solves.

It remains a standard second-order implicit method in PDE time stepping, especially where reduced numerical damping is desirable.


  • Crank, The Mathematics of Diffusion
  • Hairer, Nørsett, Wanner, Solving Ordinary Differential Equations II