Units and resolution
Two kinds of units
Section titled “Two kinds of units”Scenes are described in physical units: positions and wavelengths in nanometres. The default domain is 12.8 µm across. The solver itself works in normalized units where the cell size and the speed of light are both 1.
The bridge between them is the cell size:
Δx = domain size / grid size e.g. 12 800 nm / 512 = 25 nmA source with a vacuum wavelength λ then oscillates at a normalized frequency of Δx / λ cycles per unit time. Change the grid size and Δx changes with it, but the scene in nanometres stays the same. That is why the same scene runs on a phone (256 cells) and on a desktop (768 cells), only sharper on the latter.
Time in the status bar is converted the same way: one normalized time unit is Δx / c, so a step is Δt = 0.5 · Δx / c. At Δx = 25 nm that is 0.042 fs.
How fine is fine enough
Section titled “How fine is fine enough”A wave needs enough grid points per wavelength to be represented faithfully. Inside a material with refractive index n the wavelength shrinks to λ/n, so the number that matters is
N = λ / (n · Δx) cells per wavelengthThe inspector shows N for the shortest source wavelength in the densest material in the scene.
The plot shows what goes wrong on a coarse grid: waves travel too slowly, and more slowly along the axes than along the diagonals. This is numerical dispersion. With N = 20 the error is a fraction of a percent; with N = 10 it is about 1%, which accumulates into visible phase errors over long distances; below 6 the waves are badly distorted.
PhotonLab colours the readout accordingly:
| N | Readout | Meaning |
|---|---|---|
| ≥ 10 | green | Fine for everything the app is meant for. |
| 6–10 | amber | Qualitatively right; expect shifted interference fringes and resonances. |
| < 6 | red | Do not trust the result. |
What to do when it is red
Section titled “What to do when it is red”Silicon at visible wavelengths is the usual culprit: n = 3.48 makes the wavelength inside 3.5 times shorter. In order of preference:
- Use a longer wavelength. Silicon photonics runs at 1550 nm for good reason.
- Make the domain smaller (Simulation → Domain size). Halving it halves Δx.
- Choose a larger grid (Simulation → Grid), if your device can carry it.
Metals do not count towards N. Light does not propagate inside them; it decays within a few nanometres. For that decay to be resolved, though, Δx should be no more than about 10–15 nm when you are interested in plasmons.