The method of lines and semidiscrete systems
Separate spatial approximation from time integration and measure stability in the appropriate discrete norm.
On this page
The question for today
What you’ll understand
- Derive a semidiscrete heat system including boundary contributions.
- Prove its discrete energy dissipation and identify the grid-dependent eigenvalue scale.
- Distinguish spatial consistency, semidiscrete stability and fully discrete time-step restrictions.
A PDE computation often makes two approximations: representing space with finitely many degrees of freedom and advancing those degrees of freedom through time. The method of lines keeps these steps separate. That separation exposes a common error: a spatial discretization can dissipate energy perfectly in continuous time while an unsuitable time integrator makes the implemented scheme grow.
Discretize space while leaving time continuous
For the heat equation on[0,1] with constant diffusivity kappa>0 and homogeneous Dirichlet boundaries, take equally spaced nodes x_j=jh with h=1/m. Replace the second derivative at each interior node by the centered three-point difference. The unknowns U_j(t) remain functions of continuous time, and the boundary values are fixed at zero. Nonzero prescribed boundaries would enter as forcing terms; treating them as free interior unknowns changes the problem and its energy balance.
The resulting ordinary differential equation is U′=kappa L_h U. For smooth exact solutions, inserting nodal samples into this system leaves a spatial residual of order h squared, provided the fourth spatial derivative is uniformly bounded on the time interval. This is a consistency statement, not yet a global solution-error estimate. A time integrator introduces another error source, whose constants may depend on the grid through the stiffness of L_h. A tolerance or time step appropriate on one grid need not remain appropriate after spatial refinement.
Use the norm associated with the grid representation
Define the grid L2 norm squared as h times the sum of squared interior values. Multiplying each semidiscrete equation by hU_j and summing performs a discrete integration by parts. Boundary terms vanish because the endpoint values are zero, leaving minus kappa over h times the sum of squared adjacent differences. Thus the semidiscrete energy cannot increase. The norm includes h so that it approximates a spatial integral as the grid is refined, rather than artificially growing with the number of degrees of freedom.
The centered Dirichlet Laplacian has sine eigenvectors. The k-th eigenvalue is negative four over h squared times the squared sine of k pi h divided by two. Low fixed modes approximate continuum decay rates, while the largest-magnitude eigenvalues scale like h to the power minus two. This separation makes the system increasingly stiff as h decreases. The energy proof controls the exact semidiscrete flow in the grid norm; it does not authorize arbitrary steps of an explicit ODE method.
Time stepping must respect the whole spatial spectrum
Forward Euler multiplies an eigenmode by one plus time step times its semidiscrete eigenvalue. Stability requires that multiplier to have magnitude at most one for every mode, not just for the smooth initial profile one happens to test. A sufficient heat restriction is kappa times time step divided by h squared at most one half. On a particular finite Dirichlet grid the exact endpoint of the spectrum can permit a slightly larger step, but the familiar restriction is uniform and also gives nonnegative stencil weights.
Implicit methods can remove that explicit stability restriction, but they still need time resolution for accuracy and sufficiently accurate linear solves. Error analysis should identify spatial and temporal norms, boundary assumptions, regularity and the interval of comparison. The worked example deliberately compares a low-mode decay rate with a high-mode explicit instability: a solver may appear accurate on smooth data while hidden high-frequency perturbations are amplified by its time discretization.
Work it through
Stable continuous-time diffusion, unstable explicit stepping
Take kappa=1 and h=1/4, giving three interior Dirichlet unknowns. Find the first and last semidiscrete eigenvalues, and test Forward Euler with time step 0.04.
The first eigenvalue is . It approximates the continuum first-mode rate −pi² but is not equal to it.
The last eigenvalue is . Its magnitude controls explicit Euler stability.
The high-mode multiplier is , whose magnitude exceeds one. The semidiscrete flow dissipates energy, but this fully discrete step is unstable. The uniform sufficient restriction is time step≤h²/2=0.03125.
The spatial operator is dissipative, yet time step 0.04 amplifies a high mode. Checking only the low eigenvalue would miss the instability.
The living notebook
Explore the model
Interactive lab · heat
Exact mode decay as a reference, not a numerical PDE solver
Pause and Reset, then set spatial mode n = 2 and diffusivity kappa = 0.50. One Step advances to t=0.5; predict amplitude e⁻¹≈0.3679 for this periodic exact solution. Reset and set both n = 4 and kappa = 0.50, then Step once: predict e⁻⁴≈0.0183. The instrument evaluates analytic heat modes on[0,2pi], with no grid spacing or Euler step-size control, so it supplies a decay reference rather than testing Dirichlet finite-difference stability.
- Current amplitude
- 1
- Spatial L² norm
- 1.772
- Decay rate · κn²
- 3.6 /s
The exact periodic heat-equation mode is u(x,t) = exp(−κn²t) sin(nx), on [0,2π]. Playback advances physical time. The initial sine is shown separately, and the unnormalized L² norm is √π exp(−κn²t). This analytic instrument does not run a finite-difference solver or test discretization stability. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe continuum damps high frequencies rapidly; a discrete time integrator must still resolve or stabilize the corresponding stiff modes.
Pause & reason
Check your understanding
Your turn
Try it yourself
For kappa=1/2 and h=1/8, give the uniform sufficient Forward Euler time-step restriction. Compute the first semidiscrete decay eigenvalue and compare its sign with the continuum rate.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use kappa times 4/h² times sin²(pi h/2), and keep the minus sign. The uniform stability parameter is kappa times time step divided by h².
Compare with the solution
The sufficient restriction is . The first semidiscrete rate is , while the continuum rate is . Both are negative and represent decay, but their difference is a spatial-discretization error. This low-mode comparison does not relax the need to check every discrete mode when choosing an explicit step. The restriction is sufficient uniformly for the three-point heat stencil, not a universal time-step rule for all PDE discretizations.
Keep the idea
Take it with you
- The method of lines leaves time continuous after spatial approximation.
- Boundary closures and the h-weighted norm determine the semidiscrete energy argument.
- Dissipative spatial eigenvalues can still lie outside an explicit integrator’s stability region.
Read further
Original sources and deeper explanations to follow at your own pace.
- Lloyd N. Trefethen — Finite Difference and Spectral Methods for Ordinary and Partial Differential Equations, chapter 3: finite differences and the method of lines
- Lloyd N. Trefethen — Finite Difference and Spectral Methods for Ordinary and Partial Differential Equations, chapter 4: accuracy, stability and convergence
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.