# Fields, time stepping, and open boundaries

This first track answers a deceptively simple question: does a launched wave propagate with the right phase, impedance, energy, and decay?

```{figure} ../_static/generated/plane_wave_field.png
:alt: Plane wave field crossing a slab
```

## Start with an empty domain

Use a pulsed dipole in vacuum, surround the domain with PML, and measure total field energy. A healthy run has finite arrays, develops positive energy while driven, and returns toward zero after the pulse leaves.

```bash
uv run fdtdx-bench run --case analytical_vacuum_energy
```

The recorded tail-to-peak energy ratio is $4.54\times10^{-5}$, well below the declared 0.2 ceiling. This test simultaneously catches unstable stepping, broken source injection, and gross PML reflection.

## Measure a plane wave

A sinusoidal plane wave adds sharper checks:

- vacuum phase velocity should be $c$;
- dielectric phase velocity should be $c/n$;
- $|E|/|H|$ should match the medium impedance;
- polarization and propagation direction should obey the right-hand rule.

```bash
uv run fdtdx-bench run --case analytical_plane_wave
uv run fdtdx-bench run --case analytical_plane_source
uv run fdtdx-bench run --case analytical_phasor_poynting
```

The plane-wave case runs four upstream physics tests. The plane-source case checks injection details, while the phasor case ensures frequency-domain and time-domain Poynting measurements agree.

## Change the temporal profile

Run CW, Gaussian, and custom temporal signals through the same machinery:

```bash
uv run fdtdx-bench run --case analytical_temporal_profiles
uv run fdtdx-bench run --case analytical_pulsed_vs_cw
```

Use a pulse when you need a spectrum from one solve; use CW when a single frequency and clean steady-state phase matter more. A pulse must be long/narrow enough to sample the desired band without exciting grid-scale content.

## Stretch the grid

Finally compare a mildly nonuniform `RectilinearGrid` against a uniform-grid baseline:

```bash
uv run fdtdx-bench run --case analytical_nonuniform_grid
```

This is important because the local cell widths enter curls, source weights, detector integration, and the Courant limit. Agreement on only one of those paths would not be sufficient.

```{admonition} Convergence habit
:class: tip

For new scenes, repeat at a finer grid and larger PML before increasing domain complexity. If the answer moves more than the scientific conclusion can tolerate, the original discretization was not resolved.
```

