Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Step 11 -- 2D Helmholtz Equation

Authors
Affiliations
University of Valencia

The Helmholtz equation generalises the Poisson equation with a screening term:

(∇2−λ) ϕ=f(\nabla^2 - \lambda)\,\phi = f

When λ=0\lambda = 0 this reduces to the Poisson equation from Step 10. When λ>0\lambda > 0 the extra term screens the solution -- suppressing long-range influences and reducing the amplitude.

Physics:

  • Quasi-geostrophic PV inversion: (∇2−F)ψ=q(\nabla^2 - F)\psi = q, where FF is the inverse Rossby deformation radius squared. Larger FF (smaller deformation radius) screens the flow, making eddies more localised.

  • Yukawa screening: In plasma physics and particle physics, the screened Poisson equation models exponentially-decaying potentials.

  • Reaction-diffusion steady states: Diffusion with linear decay leads to a Helmholtz-type equation.

What you will learn:

  1. How to create and use the HelmholtzSolver2D

  2. How increasing λ\lambda screens the solution

  3. That λ=0\lambda = 0 recovers the Poisson solution exactly

Arakawa C-Grid and Boundary Conditions

The solver operates on a 2D Arakawa C-grid where scalar fields (temperature, pressure, streamfunction) live at cell centres and velocity components live on cell faces:

       V_{j+1/2}
    ┌─────●─────┐
    │           │
 U  ●     T     ●  U
i-1/2   (i,j)    i+1/2
    │           │
    └─────●─────┘
       V_{j-1/2}

The spectral solver operates on interior cells only. The boundary condition type determines which spectral transform is used.

Dirichlet BCs (ϕ=0\phi = 0 on boundary): The DST (Discrete Sine Transform) automatically enforces zero values at the domain edges. Ghost cells are set to the negative of the nearest interior cell: ghost = -interior (antisymmetric). The Helmholtz screening parameter λ\lambda does not change the boundary treatment -- it only modifies the spectral-space eigenvalues from λmn\lambda_{mn} to λmn−λ\lambda_{mn} - \lambda.

1. Setup

We use a sinusoidal source term f=sin⁡(πx)sin⁡(πy)f = \sin(\pi x)\sin(\pi y) on [0,1]2[0,1]^2 with homogeneous Dirichlet BCs and solve the Helmholtz equation at several values of λ\lambda.

2. Screening effect

We solve (∇2−λ)ϕ=f(\nabla^2 - \lambda)\phi = f for λ∈{0,1,10,100}\lambda \in \{0, 1, 10, 100\}. As λ\lambda increases the solution amplitude should decrease and the field should become more localised.

lambda =    0.0  max|phi| = 0.053551
lambda =    1.0  max|phi| = 0.050761
lambda =   10.0  max|phi| = 0.034598
lambda =  100.0  max|phi| = 0.008362
<Figure size 1800x400 with 8 Axes>

The amplitude drops dramatically with increasing λ\lambda. Physically, the screening term −λϕ-\lambda\phi acts as a restoring force that penalises large values of ϕ\phi, pulling the solution toward zero.

3. Cross-section comparison

A 1D slice along y=0.5y = 0.5 (the centre row) shows the screening effect more clearly.

<Figure size 800x400 with 1 Axes>

4. Helmholtz at λ=0\lambda = 0 matches Poisson

When λ=0\lambda = 0 the Helmholtz equation reduces to the Poisson equation. We verify that the two solvers produce identical results.

Max |Poisson - Helmholtz(lambda=0)|: 0.00e+00

The difference is at machine precision, confirming that the Helmholtz solver generalises the Poisson solver correctly.

Connection to finitevolX: For more advanced use cases (e.g. multilayer QG models), somax also provides DirichletHelmholtzCache which wraps the DirichletHelmholtzSolver2D from spectraldiffx with a pre-configured Helmholtz parameter. See somax._src.core.helmholtz for details.

5. Amplitude vs. λ\lambda

For the single-mode source f=sin⁡(πx)sin⁡(πy)f = \sin(\pi x)\sin(\pi y), the analytical solution of the Helmholtz equation is:

ϕ=f−2π2−λ\phi = \frac{f}{-2\pi^2 - \lambda}

So the peak amplitude scales as 1/(2π2+λ)1 / (2\pi^2 + \lambda). Let us verify this over a wider range of λ\lambda.

<Figure size 700x400 with 1 Axes>

Summary

ConceptAPI
Create Helmholtz solverHelmholtzSolver2D.create(nx, ny, lambda_=..., bc=...)
Solvesolver.solve(rhs)
Poisson limitlambda_=0.0 recovers Poisson exactly
ScreeningLarger λ\lambda reduces amplitude and range
QG connection(∇2−F)ψ=q(\nabla^2 - F)\psi = q for PV inversion

Next: Step 12 tackles the full Navier--Stokes equations with the lid-driven cavity benchmark.