Equations whose coefficients vary in space

This page explains how pdemagic solves a linear stationary equation

\[L u = f, \qquad L u = \sum_j c_j(\mathbf{x})\, D_j u ,\]

in which each \(D_j\) is a derivative and each coefficient \(c_j\) a function of the position. Two examples are Poisson’s equation in a medium, \(-\nabla \cdot \left( \varepsilon \nabla u \right) = g\), with a permittivity \(\varepsilon(\mathbf{x})\), and a screened equation with a potential, \(-\nabla^2 u + V(\mathbf{x})\, u = f\).

The domain here is free space or a periodic box. Between walls and on round domains the same idea runs on another solver: see collocation.

The method

In free space and on a periodic box, an equation with constant coefficients is solved directly, wave by wave or with a Green’s function. An equation whose coefficients vary is not, but it is close to one that is. Three steps make use of that.

The reference. Every coefficient is replaced by one number: the value it settles to towards the free faces of the box, or its mean on a domain that is periodic in every direction. These numbers make an operator \(L_0\) with constant coefficients, which the Fourier methods solve.

The scaling. The equation is divided by \(w(\mathbf{x})\), the coefficient of the highest derivatives relative to its reference value. For Poisson’s equation in a medium \(w = \varepsilon/\bar\varepsilon\), and the equation becomes

\[-\bar\varepsilon\, \nabla^2 u - \bar\varepsilon\, \nabla(\ln \varepsilon) \cdot \nabla u = \frac{\bar\varepsilon\, g}{\varepsilon} .\]

The highest derivatives now have constant coefficients. What varies is of lower order, and that is what makes the iteration fast.

The iteration. Call \(s = L_0 u\) the effective source: the source that gives the same solution in the reference equation. In terms of it the equation reads

\[s + \sum_j \delta_j(\mathbf{x})\, D_j L_0^{-1} s = \frac{f}{w}, \qquad \delta_j = \frac{c_j}{w} - \bar c_j .\]

It is linear in \(s\) and is solved by GMRES. Each step solves once with \(L_0\) and takes the derivatives \(D_j\) of the result in Fourier space, as part of the same transform.

For the medium, the effective source is the given charge, screened by \(\varepsilon\), plus the polarization charge that the field induces wherever \(\varepsilon\) changes.

Free directions. Where the coefficients have settled, \(s\) equals \(f\), which vanishes outside the box. So \(s\) lives in the box, and the Green’s function of \(L_0\) gives the solution with the right behaviour at infinity. Nothing is cut off. The reference equation must be one that is solved in free space: a Poisson, a screened Poisson or a Helmholtz equation, with or without unequal weights along the axes.

Waves in a medium. If the reference is a Helmholtz equation, the Green’s function is the outgoing one, and the solution is the one in which waves leave and none come in. It is complex, whatever the equation is written with. For \(-\nabla^2 u - k^2 n^2(\mathbf{x})\, u = f\) with an index of refraction \(n\) that settles to one, the equation for \(s\) is the Lippmann–Schwinger equation,

\[s - k^2 (n^2 - 1)\, G_k * s = f ,\]

with the outgoing Green’s function \(G_k\). A wave that comes in from outside is not a source that vanishes outside the box, so it is split off: with \(u = u_\text{in} + u_\text{s}\) and \(u_\text{in}\) a solution in the empty space, the scattered part \(u_\text{s}\) obeys the same equation with the source \(k^2 (n^2 - 1)\, u_\text{in}\), which lives where the medium is.

Periodic domains. \(L_0\) can be any operator. If it vanishes for some wave although \(L\) does not, that wave passes through the reference solve unchanged, and the iteration takes care of it. If the unknown appears in derivatives only, a constant solves the homogeneous equation: the mean of the solution is zero, and a multiple of \(w\) is taken off the source so that a solution exists. The diagnostics report it.

Accuracy

For smooth coefficients the method is spectrally accurate. For the manufactured solution \(u = e^{-r^2}\) with a dielectric bump that raises \(\varepsilon\) from 1 to 5, on the box that the planner chooses:

Points per axis

Error

16

2.1e-2

24

5.3e-6

32

1.4e-9

48

6.0e-11

For the same solution of \(-\nabla^2 u + (1 + V)\,u = f\) in the plane, with a potential well \(V\) of depth 3:

Points per axis

Error

24

6.9e-4

32

3.9e-6

40

5.2e-9

48

9.3e-12

For a wave of the wave number 2 on the line that meets the well \(2/\cosh^2 x\), which lets every wave pass without reflection, against the exact solution:

Points

Error

96

6.6e-5

144

9.5e-8

192

2.1e-10

288

2.0e-12

A further test follows the physics: a charge at the centre of a spherical dielectric bump, whose potential follows from Gauss’s law by a one-dimensional integral. The computed potential agrees with it, and is well below the potential of the same charge in vacuum: the dielectric screens it.

The iteration is stopped at a residual of \(10^{-10}\) relative to the right-hand side. The error of the solution is of that size or a little above.

What the planner chooses

  • The box holds the source and the region where the coefficients differ from the constants they settle to. Those constants are found by sampling, like the extent of the source.

  • The grid resolves the source and the coefficients, both as they are written and as the iteration works with them: divided by \(w\). That can take more points than the coefficients need as written, because \(1/\varepsilon\) is less smooth than \(\varepsilon\).

  • The iteration runs to a residual of \(10^{-10}\) in at most 200 steps. Both are entries of the plan.

  • For waves, the box is two wavelengths wider on every free side, as for the Helmholtz equation, and the grid has at least six points per wavelength where the waves are shortest: where the medium is densest.

Cost

Each step costs one forward transform and one inverse transform for each derivative that has a varying coefficient after the scaling: the dimension for a medium, one for a potential. With free directions the transforms are padded. In the tests a permittivity between 1 and 5 needs 12 steps, between 1 and 20 it needs 17, and between 1 and 80 it needs 21.

Diagnostics

Entry

Meaning

iterations, residual

The steps that were taken and the residual that was reached.

coefficient_boundary_ratio

How far the coefficients are from the constants that stand for them, on the free faces of the box, relative to how far they are from them at most.

source_boundary_ratio

Covers the effective source as well as the given one. Both must vanish on the free faces.

spectral_tail

Covers the source and the coefficients, as written and as the iteration works with them.

solution_tail

How far the spectrum of the effective source has decayed. It holds the waves of the solution, the short ones with more weight.

Limits

  • Smooth coefficients only. They must be resolved by the grid. A sharp surface has to be smoothed over a few grid spacings, and the accuracy then falls with the width of that transition. Bodies with sharp surfaces have a method of their own.

  • The highest derivatives keep their coefficient. It may not vanish or change its sign, which would change the type of the equation, and it may not fall to zero where the reference is taken.

  • With free directions, the coefficients settle. Along the free directions every coefficient must approach a constant, and what is left there must be a Poisson, a screened Poisson or a Helmholtz equation with real coefficients.

  • A medium for waves must not trap them. The iteration slows down as the medium gets denser and larger in wavelengths, and near a resonance of the medium it may not converge.

  • No conductors. A conductor is not the limit of a large permittivity in this method: the iteration slows down as the contrast grows.

  • Cartesian coordinates, one unknown, no walls. Systems take constant coefficients in stationary equations. Boxes with boundary conditions and round domains take coefficients that vary by an iteration of their own: see iteration between walls. A region of the plane takes coefficients that vary, and is solved directly, without this iteration: see spectral elements.

Nonlinear stationary equations are solved by Newton’s method on top of this iteration, and on a region of the plane on top of the direct solve.