The automatic solution of partial differential equations using a global spectral method

Alex Townsend, Sheehan Olver · DOI

Introduction

Numerical solvers for Partial Differential Equations (PDEs) typically force a compromise: one must choose between a slow, memory-intensive general-purpose solver or a highly optimized, "hand-crafted" solver restricted to a specific equation. In this work, Alex Townsend and Sheehan Olver introduce a method that bridges this gap. By integrating the ultraspherical spectral method with automatic differentiation, they have developed a solver that is both general-purpose and exceptionally fast, capable of resolving solutions with over a million degrees of freedom in under a minute.

The Challenge of Traditional Spectral Methods

Spectral methods represent solutions as sums of polynomials and are renowned for their "exponential accuracy" on smooth problems. However, they traditionally face three significant hurdles:

  1. Complexity: Standard collocation methods often result in dense, ill-conditioned linear systems that scale poorly ($O(N^3)$).
  2. Manual Setup: Users must typically select the number of basis functions ($N$) and manually implement boundary conditions for each problem.
  3. Stability: High-order methods can become numerically unstable due to the construction of differentiation matrices.

The Algorithmic Framework

The authors' approach overcomes these hurdles by combining three core innovations: the ultraspherical spectral method, separable representations (splitting rank), and automatic differentiation (AD).

Flowchart of the automatic PDE solver algorithm

As shown in the flowchart above, the solver operates as a "black-box." The user provides the PDE and boundary conditions as an anonymous function. The software then:

  • Converts handles into discretization instructions: Using forward-mode AD to parse the user's function and determine the operator's splitting rank.
  • Constructs a generalized Sylvester matrix equation: If the operator can be written as a sum of products of 1D operators (e.g., the Laplacian), the 2D PDE is converted into an efficient matrix equation.
  • Imposes constraints and solves: Boundary conditions are integrated directly into the matrix framework.
  • Adaptive Refinement: The solver iteratively increases the discretization size ($n_x, n_y$) until the solution's Chebyshev coefficients decay to machine precision ($10^{-14}$).

Key Insights: The "Rank 2" Sweet Spot

A critical insight of this research is the prevalence of "Rank 2" operators. Most fundamental linear PDEs—including Laplace, Helmholtz, Heat, Wave, and Schrödinger equations—have a splitting rank of 2. This allows them to be solved using the Bartels–Stewart algorithm in $O(N^{1.5})$ time, a significant improvement over the $O(N^3)$ required for general systems.

Furthermore, the use of ultraspherical polynomials leads to almost banded (sparse) matrices for differentiation. This ensures that the resulting linear systems remain well-conditioned and computationally efficient even at very high resolutions.

Performance and Results

The method was evaluated against several classic benchmarks, including the Helmholtz, Wave, and Schrödinger equations. For fourth-order problems like the Biharmonic equation (splitting rank 3), the solver utilizes a block-banded approach.

In practical tests, the solver (implemented as chebop2 in the Chebfun package) resolved a Helmholtz problem with a million degrees of freedom in approximately 60 seconds in MATLAB. An experimental Julia implementation reduced this time to just 10 seconds, demonstrating the method's high efficiency and accuracy.

Limitations and Future Directions

While powerful, the current method is restricted to rectangular domains. While L-shaped domains can be decomposed into rectangles, general curved geometries remain a challenge for this global spectral approach. Additionally, while non-linear problems can be addressed via Newton iteration, the resulting operators often lose their low-rank structure, impacting performance. Finally, for operators with a splitting rank $k \ge 3$, the solver reverts to a block-banded system ($O(N^2)$), suggesting that direct algorithms for higher-rank operators remain a fertile area for future research.

Summary updated

BibTeX
@article{townsend2015automatic,
  author = {Alex Townsend and Sheehan Olver},
  title = {{The automatic solution of partial differential equations using a global spectral method}},
  journal = {Journal of Computational Physics},
  year = {2015},
  doi = {10.1016/j.jcp.2015.06.031},
}
Figure