# A substrate's permittivity and loss, recovered from |S11| by gradient

Channel: release; package: 2.2.0; source: 084b5032b7d014f12b65b4b947cf61a840970bf4

Page: https://remilab.ai/rfx/showcase/patch-calibration/
Source: https://github.com/bk-squared/rfx/blob/084b5032b7d014f12b65b4b947cf61a840970bf4/docs/public/showcase/patch-calibration.mdx

A patch antenna's |S11| curve is set by its substrate: the permittivity moves the
resonance, and the loss sets how deep and how wide the dip is. Fitting a computed
curve to a reference one therefore recovers both values. Here the antenna is a
probe-fed patch on RT/Duroid 5880, and the two unknowns are the substrate's relative
permittivity εr and its conductivity σ. The misfit is the mean, over 71 frequencies
from 2.15 to 2.50 GHz, of (|S11 model| − |S11 reference|)² in linear magnitude. Adam
lowers it, with its gradient with respect to εr and σ taken through the FDTD solve.

The reference curve is not a measurement. rfx computed it on the same antenna model
and mesh, with the substrate set to εr 2.30 and σ 3.0×10⁻³ S/m; the fit starts
without these values. The case shows that the gradient recovers material values a
model was built with. It does not show how close the model is to a real board.

  ![Video poster](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/patch_calibration_film_poster.png)

    [source](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/patch_calibration_film.mp4)

    [Download the film (MP4, 1920×1080, 77 s)](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/patch_calibration_film.mp4).
  
  The calibration in 77 seconds, with narration.

  εr 2.301 recovered (reference built with 2.30; start 2.20)
  σ 3.19×10⁻³ S/m recovered (reference built with 3.0×10⁻³; start 2.94×10⁻⁴)

## What happened

The fit starts from the datasheet permittivity, εr 2.20, and a conductivity of
2.94×10⁻⁴ S/m. After 51 updates it stands at εr 2.3012 and σ 3.193×10⁻³ S/m:
0.05 % and 6.4 % from the values the reference was computed with. The misfit falls
from 4.4×10⁻² to 9.9×10⁻⁶. The permittivity is within 0.1 % of 2.30 after 11
updates. The optimizer's momentum then carries both values past the reference ones,
the conductivity up to 4.9×10⁻³ S/m, and they swing back around them with a
shrinking amplitude. The fit ends at its declared limit of 51 updates, while the
conductivity still moves by up to about 1 % per update.

All runs use one mesh, cells of 0.79 mm. Because the reference comes from the same
model and mesh, the recovered values are those of this mesh's model; on a real
board, the mesh error would enter the recovered values.

## How it was checked

The checks and their thresholds were fixed before the runs.

- **Gradient against a 1.5× longer simulation time**, at the start and at a point
  between the start and the reference values: at most 4.6×10⁻⁴ relative difference for σ and 2.9×10⁻⁵
  for εr, against a threshold of 5×10⁻².
- **End of the simulation**: the response still arriving after the reference run
  ends is 83 dB below its peak.
- **The same model through `run()` and `forward()`**: |S11| agrees to 1.8×10⁻⁶ at
  every frequency.

## Files

  [result.json](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/result.json) (start, reference and recovered values, objective, optimizer, band, cell size)
  [curves.npz](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/curves.npz) (the reference |S11| and the curve, εr, σ and misfit at every update)
  [patch_calibration_film.mp4](https://remilab.cnu.ac.kr/share/f1abd0bff18d/patch-calibration/patch_calibration_film.mp4)
