Crank Nicolson Simulator All tools
Interactive simulator

Crank Nicolson Simulator

Inspect Crank-Nicolson r value, diffusion length, and amplification behavior as time and space steps change.

Parameters
Diffusivity alpha
m2/s

Input Diffusivity alpha.

Time step dt
s

Input Time step dt.

Space step dx
m

Input Space step dx.

Step count
count

Input Step count.

Real-time diffusion of u(x,t) (Crank-Nicolson time-stepping)
0.00
Time t [s]
0
Step n
r = αΔt/Δx²
Max u_max
Stable
Stability
step 0
Crank-Nicolson (implicit, unconditionally stable) Explicit FTCS (same step) Analytic e^{-α(π/L)²t}sin

Each step solves a tridiagonal system to advance u(x,t). For r≤0.5 it matches the explicit scheme; for r>0.5 the explicit FTCS (red) oscillates and blows up while Crank-Nicolson (cyan) stays smooth and relaxes to steady state.

Results
Dimensionless r
Diffusion length
Simulated time
High-wave damping
Amplification versus wavenumber
r and diffusion-length breakdown
dt-dx r map
Model and equations

$$u_i^{n+1}-\frac{r}{2}\Delta u^{n+1}=u_i^n+\frac{r}{2}\Delta u^n,\quad r=\alpha\Delta t/\Delta x^2$$

This simplified model captures the main relationship only. Boundary conditions, losses, nonlinear effects, and code-specific corrections still need separate checks.

How to read it

Use the main plot to read the controlling trend, including break points that a single result card can hide.

Use the sensitivity view to find input combinations where margin collapses quickly.

For early design, focus on which input controls margin before trusting the absolute value.

Learn Crank Nicolson by dialogue

🙋
When reading Crank Nicolson, where should I look first? Moving Diffusivity alpha changes both the plots and the result cards.
🎓
Start with Dimensionless r, but do not treat the number as the whole answer. Use Amplification versus wavenumber to confirm the assumed state, then read r and diffusion-length breakdown for the distribution or trend. Use the main plot to read the controlling trend, including break points that a single result card can hide.
🙋
I can see why Diffusivity alpha changes Dimensionless r. How should I judge the influence of Time step dt?
🎓
Move Time step dt in small steps and watch Diffusion length. That reveals which term is controlling the result. This simplified model captures the main relationship only. Boundary conditions, losses, nonlinear effects, and code-specific corrections still need separate checks. A single operating point is not enough; sweep the realistic scatter range.
🙋
What is dt-dx r map for? It feels like the ordinary curve already tells the story.
🎓
dt-dx r map is for finding boundaries where the condition becomes risky or margin collapses quickly. Use the sensitivity view to find input combinations where margin collapses quickly. In First-pass comparison of design options before review, the important question is often what happens after a small change, not only the nominal value.
🙋
So if Dimensionless r is within the target, can I accept the condition?
🎓
Treat this as a first-pass review. It helps with Narrowing controlling factors and worst-side conditions before detailed analysis and Teaching or explaining the equation, numbers, and visualization under the same inputs, but final decisions still need standards, measured data, detailed analysis, and vendor limits. For early design, focus on which input controls margin before trusting the absolute value.

Practical use

First-pass comparison of design options before review.

Narrowing controlling factors and worst-side conditions before detailed analysis.

Teaching or explaining the equation, numbers, and visualization under the same inputs.

FAQ

Start with Dimensionless r and Diffusion length. Then use Amplification versus wavenumber to confirm the assumed state and r and diffusion-length breakdown to read distribution or bias. Use the main plot to read the controlling trend, including break points that a single result card can hide
Move Diffusivity alpha alone, then move Time step dt by a comparable amount and compare the change in Dimensionless r. dt-dx r map shows combinations where margin or performance changes quickly.
Use it for First-pass comparison of design options before review. Instead of trusting a single point, widen the input range and check whether Dimensionless r keeps enough margin before moving to detailed analysis.
This simplified model captures the main relationship only. Boundary conditions, losses, nonlinear effects, and code-specific corrections still need separate checks. Final decisions still require standards, measured data, detailed analysis, and vendor limits.

How to Use

  1. Enter thermal diffusivity alpha (m²/s) for your material—use 1.2e-5 for steel, 1.4e-4 for copper
  2. Set time step dt (seconds) and spatial step dx (meters); the simulator calculates dimensionless Fourier number r = alpha·dt/dx²
  3. Specify number of time steps; simulator runs Crank-Nicolson scheme and outputs stability metrics, diffusion length scale, and high-frequency damping ratio

Worked Example

Steel rod (alpha=1.2e-5 m²/s), dx=0.01 m, dt=0.5 s, 100 steps. Computed r = 1.2e-5 × 0.5 / (0.01)² = 0.06. Since r < 0.5, unconditionally stable. Diffusion length = sqrt(4·alpha·t) ≈ 0.039 m after 10 seconds. High-wave damping ≈ 0.89 indicates oscillatory modes decay effectively—Crank-Nicolson absorbs spurious high frequencies better than explicit Euler.

Practical Notes

  1. Keep r below 0.5 for safety margin; r > 1.0 causes oscillations even with implicit schemes
  2. Smaller dx refines spatial resolution but increases computational cost; doubling steps and halving dx multiplies runtime by ~8×
  3. For transient heat diffusion in composite walls, validate against analytical solutions (error-function profiles) when r ≈ 0.1–0.3
  4. Crank-Nicolson incurs minimal phase lag compared to backward-Euler, preserving wave propagation accuracy in coupled multiphysics