# Modes and S-parameters

Integrated photonics is naturally described in ports. A port mode is a cross-sectional eigenfield with propagation constant $\beta$ and effective index

$$
n_\text{eff}=\frac{\beta}{k_0}, \qquad k_0=\frac{2\pi}{\lambda_0}.
$$

FDTDX computes modes on the simulation grid, injects them with `ModePlaneSource`, and projects measured fields with `ModeOverlapDetector`.

```{figure} ../_static/generated/pic_geometry_atlas.svg
:alt: Waveguide, Y junction, ring, Bragg, grating, and MMI geometries

The validated PIC path spans straight guides, a Y junction, Bragg layers, and a bus-coupled ring. Grating and MMI cases remain visible as blocked work rather than being omitted.
```

## Overlap

A reciprocal mode overlap combines simulated and reference transverse fields. In schematic form,

$$
a_m \propto \int_A \left(\mathbf E\times\mathbf H_m^* + \mathbf E_m^*\times\mathbf H\right)\cdot\hat{\mathbf n}\,dA.
$$

Consistent staggering, cell-area weights, propagation direction, and normalization are essential. A sign or conjugation mistake may preserve field pictures while corrupting port power.

## S-parameter workflow

1. Solve or supply each port mode at the requested frequency.
2. Calibrate incident amplitude at the input reference plane.
3. Run the device with the same source convention.
4. Project port fields onto forward/backward modes.
5. Divide complex output amplitude by complex incident amplitude.

Power in a unit-power normalized mode is $|a|^2$. For passive structures, the sum of propagating output powers cannot exceed incident power except within numerical and normalization error.

## Spectra and resonators

Short runs and coarse grids can shift resonance frequencies even if the underlying coupling physics is correct. The ring-bus case therefore uses declared resolution-aware tolerances and is not presented as a high-$Q$ spectroscopy validation. Inspect convergence in grid spacing, runtime, and spectral sampling before trusting a narrow linewidth.

