Computing Library › Numerical Methods
Numerical Methods

The Method of Lines

A strategy for PDEs that discretizes space first, turning the problem into a large system of ordinary differential equations in time.

Separating space from time

The method of lines (MOL) solves time-dependent partial differential equations by discretizing only the spatial derivatives, leaving time continuous. This converts the PDE into a large coupled system of ordinary differential equations, one per spatial grid point, which can then be advanced with any standard ODE integrator. The name comes from picturing the solution evolving along lines in the time direction at each spatial node.

Why it is useful

Kronos motion — materials first

MOL cleanly separates two concerns. The spatial discretization (finite differences, finite volumes, finite elements, or spectral methods) determines spatial accuracy and how boundary conditions enter. The time integrator, chosen independently, determines temporal accuracy and stability. This modularity lets developers reuse mature, adaptive ODE solvers with automatic error control and step-size selection rather than hand-coding a monolithic space-time scheme.

python
import numpy as np
from scipy.integrate import solve_ivp

# 1D heat equation u_t = u_xx by method of lines
N = 101; x = np.linspace(0, 1, N); dx = x[1]-x[0]

def rhs(t, u):
    du = np.zeros_like(u)
    du[1:-1] = (u[2:] - 2*u[1:-1] + u[:-2]) / dx**2
    return du  # Dirichlet ends held fixed at 0

u0 = np.sin(np.pi * x)
sol = solve_ivp(rhs, (0, 0.1), u0, method='BDF')

Stiffness and stability

The spatial discretization sets the stiffness of the resulting ODE system. Diffusion operators produce very stiff systems whose eigenvalues span a wide range, demanding implicit integrators or IMEX schemes. Advection operators produce eigenvalues near the imaginary axis, favoring explicit schemes with adequate stability regions. Matching the integrator to the spatial operator is the central design decision.

Limits

MOL is most natural when boundary conditions are simple and time-independent. For problems with shocks it must be paired with a shock-capturing spatial scheme, and for problems where space and time are strongly coupled (some wave problems) a monolithic space-time approach can be more efficient. Still, MOL is the default framework for a large fraction of transport and diffusion solvers.