Toy model
Maxwell
Maxwell's equations in vacuum for electromagnetic field evolution.
Overview
using Maxwell's equations without sources. It uses a finite element exterior calculus (FEEC) formulation with the electric field in H(curl) and the magnetic field in H(div) spaces.
Use cases
Governing equations
PDEs solved by model:
Ampère's law (no current):
Faraday's law:
Normalization
where is the speed of light.
Discretization
Diagnostics
The following scalars are tracked during simulation:
- Electric energy:
- Magnetic energy:
- Total energy:
Examples

Coaxial waveguide
An exact electromagnetic mode between two concentric conducting cylinders rotates around the annulus. Struphy's structure-preserving Maxwell solver reproduces its shape, its frequency and the conservation of its energy. With , the initial mode is between and ; and are Bessel functions.

Maxwell cavity resonances
Noise in the electric field excites every electromagnetic mode of a rectangular periodic box. The power spectrum of the field over time has one peak per resonance, at the exact frequencies ω = c |k| of the box. The launch uses coefficient noise of amplitude and . The periodic box selects for integer mode numbers .

Electromagnetic pulse on a distorted mesh
A Gaussian pulse of the electric field spreads as a ring across a periodic box, on a mesh that the Colella mapping has bent. The structure-preserving Maxwell solver keeps the energy constant and follows the exact solution, which is a sum of cosine modes. The initial pulse is a truncated, zero-mean Gaussian Fourier expansion: where , and . The width is , is the Kronecker delta, and the magnetic field starts at zero.

Structure preservation in time integration
One standing electromagnetic wave, stepped by Crank-Nicolson, RK4 and Heun's method at the same time step. The symplectic implicit scheme keeps the energy error bounded for the whole run, while the explicit schemes do not: RK4 loses energy steadily, and Heun's method is unstable for this operator. All three runs start from with periodic length and time step in units where .

Maxwell light-wave dispersion
Excite a broadband electric field and recover the vacuum dispersion relation ω = ck with Struphy’s FEEC Maxwell solver. The two transverse electric components start with coefficient-noise amplitude , while . On the periodic interval , the allowed wavenumbers are