# Descend through FDTD to a closed-form optimum

Channel: development; package: 2.0.0rc1; source: 2c32b7cf79b796fae825bfa08fc73d9914e61723

Page: https://remilab.ai/rfx/showcase/descent-to-optimum/
Source: https://github.com/bk-squared/rfx/blob/2c32b7cf79b796fae825bfa08fc73d9914e61723/docs/public/showcase/descent-to-optimum.mdx

A three-layer coating matches free space to a substrate of εr = 12 over
8–12 GHz. Each layer is 5.5 mm (11 cells) thick; the three permittivities are
the design variables and the objective is the band-mean power reflection. The
transfer-matrix method gives the exact optimum, so the question is whether
gradient descent through a time-domain solve lands there.

  ![Video poster](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating_site.png)

    [source](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating.mp4)

    [Download the loop (MP4)](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating.mp4).
  

  1.1 % largest layer-permittivity gap to the optimum
  0.1 % closed-form reflection above the optimum
  60 Adam steps

  [Reflection of the coating from rfx FDTD and the transfer matrix, the three layer permittivities over the Adam iterations, and the band-mean reflection against the transfer-matrix optimum](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating_site.png)

## What happened

From the geometric-ladder start (1.861 / 3.464 / 6.447) the layer permittivities
settle at 1.922 / 4.670 / 4.707 against the optimum 1.943 / 4.652 / 4.720,
although the closed-form optimizer started from a different point. Evaluated
with the transfer matrix, the design's band-mean |R|² is 0.03434 against the
optimum's 0.03430, −14.6 dB, 3.0 dB below the start. FDTD and
transfer-matrix |R|² of the final design differ by at most 1.5×10⁻³ over the 15
frequencies the cost uses (8.20–11.78 GHz).

## How the gradient was checked

Against central differences at the start to 5.5×10⁻⁴, and against a 1.5× longer
record to 4.8×10⁻⁴.

A one-dimensional stack at normal incidence; it shows the optimizer and the gradient work together, not the accuracy of a 3-D radome.

## Downloads

  [iterations.npz](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/iterations.npz)
  [tmm_curves.npz](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/tmm_curves.npz)
  [result.json](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/result.json)
  [ar_coating_social.mp4](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating_social.mp4)
  [ar_coating_social.png](https://remilab.cnu.ac.kr/share/7c02ad43c580/ar-coating/ar_coating_social.png)

## Run it

```bash
python examples/inverse_design/multilayer_ar_coating.py
```

CPU, minutes; the showcase script `scripts/showcase/ar_coating.py` records every
iterate.
