Numerical Methods & Scientific Computing

Method of Lines PDE Solver

See how a PDE becomes a large system of ordinary differential equations. The method-of-lines solver applies second-order central differences to uₓₓ and advances the resulting semi-discrete heat equation with vector RK4.

Method of lines

Heat equation → ODE system → RK4

Second-order central differences discretize space; classical RK4 advances the resulting semi-discrete ODE system in time.

How this tool works

Spatial discretization gives duᵢ/dt=α(uᵢ₋₁−2uᵢ+uᵢ₊₁)/Δx². Classical RK4 is then applied to that coupled ODE system as a whole.

Example

Use a sine initial profile and compare the result with the direct FTCS heat solver. Both discretize the same spatial operator but use different time integration methods.

Common questions

Why is this called the method of lines?

Space is discretized first while time remains continuous, producing a finite ODE system whose solution traces lines through time at the grid nodes.

Can RK4 still have a stability limit?

Yes. The semi-discrete Laplacian has increasingly large negative eigenvalues as Δx shrinks. Explicit RK4 must keep those eigenvalues times Δt inside its stability region.