---
title: Nested source-equilibrated midpoint-guide cavity campaign
---

# Nested source-equilibrated midpoint-guide cavity campaign

```{admonition} Live optimizer
:class: tip

This inert successor equilibrates a fixed-norm freeform source before every gentle dielectric proposal, re-equilibrates it at the proposal before committing material, and starts a 1 µm-wide density region from a midpoint-permittivity waveguide before a deliberately slow beta continuation and smooth spline-boundary handoff.
```

| State | Value |
|---|---:|
| Status | `running_incumbent_source_equilibration` |
| Source | `trainable_fixed_norm_modal_electric_current` |
| Source spatial profile | `freeform Ex/Ey/Ez on physical center plane` |
| Source spatial profile trainable | `True` |
| Active source degrees of freedom | 2700 |
| Source coordinate shape | `(3, 1, 42, 42)` |
| Ex / Ey / Ez coordinate norms | `0.1126, 0.9893, 0.0930` |
| Source current norm ratio | 1 |
| Source/reference overlap | 0.98556 |
| Source angular trust radius | 8.958e-05 rad |
| Detector / target trainable | `False / False` |
| Temporal observable | `fixed_scale_reciprocal_mode_electric_coordinate` |
| Phase | `shifted_lossless_temporal` |
| Active coordinates | `filtered_density_pixels` |
| Completed updates | 170 |
| Temporal objective | -0.95304 |
| Whole-trace fixed-waveform fidelity | 0.51202 |
| Source-off fixed-waveform fidelity | 0.51138 |
| Fixed target source-off power (telemetry) | 0.49996 |
| Fixed-target gain (ideal = 1) | 0.023844 |
| Fixed-target normalized MSE | 0.95304 |
| Normalized temporal residual | 0.97624 |
| Full-field coherence | 0.99999 |
| Shifted stationarity | 0.87539 |
| Q telemetry | 433.94 |
| Normalized V telemetry | 0.025308 |
| Active pole tape | 0.65 ps |
| Maxwell-step reduction vs 2 ps | 3.08× |
| Material continuation stage | `gradual_density_to_spline_handoff` |
| Projection beta / eta | 59.22 / 0.50 |
| Bulk gray fraction | 2.12% |
| Initial guide density | 0.5 |
| Initial guide permittivity | 3.0804 |
| Design width in y | 1 µm |
| Material optimizer | `nested_variable_projection_midindex_density_to_spline_v4` |
| Material coordinates | `filtered continuous density pixels; later spline boundary` |
| Material trust radius | 0.00362 maximum density change |
| L-BFGS memory pairs | 8 |
| Forward-only rejected-step retries | 0 |
| Source gradient transform | `unit-sphere tangent and geodesic retraction` |
| Source L-BFGS memory pairs | 6 |
| Active nested block | `incumbent_source` |
| Nested Maxwell turns | 1142 |
| Accepted material commits | 170 |
| Active source inner turn | 7 |
| Last source move accepted | True |
| Last source exact / predicted gain | 1.1921e-07 / 6.3209e-08 |
| Material commit rule | `candidate source equilibrium before commit` |
| Source projected 10 mrad gain | 8.4675e-06 |
| Material trust ceiling | 0.017171 maximum density change |
| Uncommitted material candidate active | False |
| Continuation clock | `accepted material commits only` |
| Boundary handoff | `waiting_for_binary_stable_topology` |
| Stable binary-topology states | 0 / 3 |
| Boundary trust radius | inactive until spline handoff |
| Last candidate accepted | True |
| Last pole trustworthy | True |
| Latest update wall time | 59.59 s |
| Last artifact write | 2026-08-29 11:51:38 UTC |

The authoritative state is
`benchmarks/artifacts/invdes_fryett_modal_temporal_modal_current_nested_midindex_v4.npz`. The active fixed-source modal checkpoint is a separate preserved artifact; preparing this successor neither seeds from nor modifies it.

## Geometry and exact material difference

![Initial, accepted, and difference geometry](../_static/generated/fryett_modal_source_bilevel_geometry.png)

## Field used by the temporal objective

![Current windowed Ey field](../_static/generated/fryett_modal_source_bilevel_fields.png)

## Exact temporal target response

![Simulated and projected target traces](../_static/generated/fryett_modal_source_bilevel_temporal.png)

The orange curve is the fixed causal convolution of the prescribed current waveform
with the cosine Green function of one lossless pole. It is not the source waveform and
is not fitted to the simulation. During the drive it contains the exact causal build-up;
after turn-off its extrema are exactly -1 and +1. The blue simulation is plotted in those
same absolute objective units, so a smaller blue envelope is a real amplitude error, not
a display normalization. The current waveform appears only in the diagnostic panel on
its own explicitly independent display scale. The former blue background bands were 4D
field-snapshot windows; they were never objective weights and have been removed from
this plot to make the absolute comparison unambiguous. Every temporal sample still
enters the single normalized mean-square error equally.

## Evolving freeform source profile

![Area-whitened Ex, Ey, and Ez source coordinates](../_static/generated/fryett_modal_source_bilevel_source_profile.png)


## Live nested-source progress

![Source inner-loop progress](../_static/generated/fryett_modal_source_bilevel_nested_source_progress.png)

The accepted-material and Q plots keep the same x coordinate while the inner
source problem is being solved. This panel advances on every source
forward/adjoint turn, so accepted source motion is visible before the next
material commit.


## Full-field temporal correlations

![Temporal Gram matrix and energies](../_static/generated/fryett_modal_source_bilevel_gram.png)

## Objective, gradual beta continuation, and pole history

![Temporal campaign history](../_static/generated/fryett_modal_source_bilevel_history.png)

## Q versus accepted material commit — linear scale

![Cavity Q versus accepted material commit on a linear scale](../_static/generated/fryett_modal_source_bilevel_q_history.png)

## Exact methodology, target response, and moving components

## Scientific question and launch state

This opt-in successor asks whether the dielectric can avoid committing early
to an accidentally convenient source. It preserves the 8 µm-long design
domain but makes its full width in y exactly 1 µm. Inside that region it starts
from one continuous 450 nm-wide guide whose relative permittivity is

\[
  \epsilon_{\mathrm{mid}}={\epsilon_{\max}+\epsilon_{\min}\over2}.
\]

The initial source is exactly the fundamental mode solved on that same
midpoint-permittivity guide. The reciprocal detector, fixed-amplitude lossless
temporal target, minimum viable pole tapes, and automatic pole tracking remain
fixed. The optimization order is:

1. equilibrate the freeform source for the accepted dielectric;
2. make one very small, uncommitted continuous-density proposal;
3. equilibrate a private source copy at that proposal;
4. commit material only if the source-optimized objective improves;
5. sharpen density gradually on accepted material commits only;
6. replay the mature topology into a smooth spline cut-cell boundary chart.

Preparation creates the independent artifact
`modal_current_nested_midindex_v4` with status `ready_not_started`. It does not
run an FDTD baseline, launch an optimizer, stop the current campaign, or alter
the current checkpoint.

## Fixed objective and exact resonant-burst response

The source has a fixed spatial norm but a trainable transverse profile. Its
prescribed temporal waveform is a resonant carrier with smooth sin² turn-on
and turn-off envelopes,

\[
  s(t)=a(t)\cos(\omega_c t),
\]

where \(a(t)\) rises and falls over six carrier cycles and is exactly zero for
\(t\ge80\) fs. This is a finite resonant CW burst, not an infinite
steady-state solve: the driven part supplies coherent narrowband gradients and
the source-free part exposes ringdown and permits Q estimation.

For one ideal lossless pole, an electric-current impulse changes the electric
modal coordinate directly, so its causal discrete Green function is a cosine.
At FDTD sample \(n\), the exact target is

\[
  y_n^*=-{\kappa\over A}
  \sum_{m=0}^{n}s_m\cos[\omega_c(n-m)\Delta t],
\]

with geometry-independent reciprocal source/detector coupling

\[
  \kappa=\left\langle e_{\mathrm{det}},
  \Delta E[J_{\mathrm{ref}}]\right\rangle.
\]

The analytic normalization

\[
  A=|\kappa|\sqrt{
  \left(\sum_m s_m\cos\omega_c m\Delta t\right)^2+
  \left(\sum_m s_m\sin\omega_c m\Delta t\right)^2}
\]

makes the source-free target a nondecaying sinusoid with extrema exactly -1
and +1. The source-on portion is the exact causal build-up rather than a
guessed transient. The source and ideal response share a carrier, but are
different quantities and are not overlaid in a common amplitude normalization.

The simulated reciprocal modal coordinate \(y_n\) is divided by that same
fixed analytic scale \(A\). Neither amplitude nor phase is fitted. The sole
scalar objective is

\[
  F(\rho,u)=-
  {\sum_n [y_n(\rho,u)-y_n^*]^2\over\sum_n(y_n^*)^2}.
\]

Q, Q/V, mode volume, energy, pole-fit residuals, and field snapshots are
telemetry and safety gates, not additional objective terms.

## Freeform standing-mode source

The source is a center-plane electric-current sheet with one real coordinate
for every Ex, Ey, and Ez Yee degree of freedom on the physical non-PML 30 × 30
cross-section: 2700 coordinates. Area whitening and sphere retraction keep its
integrated current norm exactly fixed. It starts as the solved midpoint-guide
mode but can evolve to any real transverse standing-mode cross-section,
including a defect-plane cross-section of a Bloch cavity. It cannot paint a
longitudinal Bloch envelope or increase total source power. A generic traveling
Bloch wave would require complex quadratures; this campaign targets a
reciprocal standing cavity.

## Nested source equilibrium

For dielectric coordinates \(\rho\), define the source-envelope objective

\[
  \bar F(\rho)=\max_{\|u\|_2=1}F(\rho,u).
\]

At an inner stationary solution \(u^*(\rho)\), the envelope theorem gives

\[
  \nabla_\rho\bar F(\rho)
  =\partial_\rho F(\rho,u^*(\rho)).
\]

One forward/reverse FDTD pair supplies the gradients with respect to all source
and all material coordinates, but it does not solve the nonlinear source
maximization in one shot. The campaign takes source trust-region turns until
the allowed fixed-norm source gradient is small, both at the incumbent and at
each uncommitted material candidate.

For normalized source \(u\), the allowed gradient is

\[
  g_T=g-u(u^Tg).
\]

The stationarity diagnostic is the maximum first-order gain predicted for a
10 mrad source rotation, \(0.01\|g_T\|_2\). It must remain below both the
absolute and relative threshold for two consecutive adjoint evaluations. A
candidate inherited from the already-equilibrated incumbent can therefore
finish after two checks when its projected gain is already numerically
negligible; the controller no longer forces unsuccessful source motions merely
to satisfy a turn count. Source proposals use eight-pair L-BFGS, tangent
projection, geodesic sphere retraction, and an adaptive angular trust radius.
Source amplitude is fixed.

Trust-region convergence also has a numerical floor. When the angular radius
has contracted to its minimum, two unchanged exact replays whose predicted
gain is smaller than one float32 objective ULP certify numerical stationarity.
As a final deadlock guard, six consecutive finite rejected trials at the
minimum radius advance the outer material problem with an explicit recorded
reason. These exits do not claim an exact zero source gradient; they state that
the inner problem cannot make a resolvable accepted move at its configured
trust tolerance. Every accepted source move resets both counters.

Once the incumbent source is stationary, one material adjoint produces an
uncommitted candidate \(\rho'\). The source is equilibrated again there, and
the commit compares like with like:

\[
  \Delta\bar F=
  F(\rho',u^*(\rho'))-F(\rho,u^*(\rho)).
\]

The candidate is accepted only when \(\Delta\bar F>0\), its predicted material
gain is positive, the trust agreement is at least 0.05, and the pole, field,
and topology gates pass. Rejection leaves the accepted source, geometry,
continuation clock, and beta unchanged.

## Continuous-density discovery and gradual trust release

Discovery uses all 160 × 20 density pixels in the x/y symmetry-reduced
representation of the full 8 µm × 1 µm region (equivalent to a 320 × 40 full
grid). No terminal design pixel is
pinned. The initial raw density is 0.5 inside the 450 nm guide and 0 in its
cladding; the material interpolation

\[
  \epsilon(\rho)=\epsilon_{\min}
  +(\epsilon_{\max}-\epsilon_{\min})\rho
\]

therefore makes the starting core exactly \(\epsilon_{\mathrm{mid}}\). A
75 nm conic fabrication filter couples neighboring pixels before a tanh
projection. There is no DCT preconditioner and no imposed periodicity.

Material trust is dimensionless: it is the maximum proposed change of any raw
density coordinate. It starts at 0.001, has a floor of 0.0001, and can reach at
most 0.05. A smooth accepted-material clock releases that ceiling over the
first 120 committed material steps. Conservative Q telemetry imposes an
additional ceiling:

- Q below 100: at most 0.005;
- Q from 100 to 300: logarithmic interpolation from 0.005 to 0.015;
- Q from 300 to 1000: logarithmic interpolation from 0.015 to 0.030;
- Q above 1000: gradual release from 0.030 toward 0.050.

An accurate, trust-boundary-using accepted step grows the active radius by
1.20; rejection halves it. There is no Q-dependent density cap and no routine
multi-point line search. L-BFGS memory is not reset when beta changes.

## Slow beta schedule and spline-boundary handoff

Beta is held at 1 through accepted material commit 20. It then changes only
once every five accepted material commits: logarithmic smoothstep plateaus move
from 1 to 4 by commit 80, and from 4 to 64 by commit 180. Eta remains 0.5.
Source inner turns, candidate equilibration, and rejected
material proposals do not advance beta. When beta changes, the accepted source
is re-equilibrated before the next material proposal.

At beta 64, three trustworthy states must have at most 4% gray cells and stable
topology. The campaign then replays that density into a topology-guarded cubic
spline level-set boundary. FDTD receives 4 × 4 inverse-subpixel cut-cell area
fractions, so bulk islands are exactly binary and only cells intersected by the
smooth physical boundary can be gray. The same temporal objective and nested
source-equilibrium logic continue in this boundary stage.

## Fixed and moving components

Fixed:

- grid, stack, symmetry, PML, 8 µm × 1 µm region, and terminal feedthrough;
- initial 450 nm midpoint-permittivity guide and its solved starting mode;
- source plane and support, resonant-burst waveform, turn-off time, and total
  source-current norm;
- reciprocal detector and analytic unity-amplitude target;
- absence of amplitude/phase fitting, DCT conditioning, prescribed period,
  output coupling, mode volume, Q/V, or late-power objective terms.

Moving:

- the 2700 real fixed-norm source coordinates during each inner solve;
- all 160 × 20 symmetry-reduced filtered density controls during gradual discovery;
- after handoff, the topology-preserving smooth spline boundary controls;
- independent source and material L-BFGS memories and adaptive trust radii;
- after trustworthy Q exceeds 100, the tracked carrier and minimum viable pole
  tape selected by scheduled Shaker--Johnson-style pole audits.

## Dashboard interpretation

The temporal figure preserves objective units. Its top panel shows absolute
one-carrier-period RMS envelopes; zoom panels show the source-on, turn-off, and
late-ringdown carrier with one y scale and ±1 reference lines. A perfect late
response touches both lines. The current waveform is shown only on an
independent diagnostic scale. Field-snapshot windows remain available in field
and Gram diagnostics but are not background bands in the waveform plot and do
not weight the objective.


## Operations

A bounded manual turn can be run with:

```bash
FDTDX_FRYETT_MODAL_SOURCE_CO_DESIGN=1 FDTDX_FRYETT_MODAL_SOURCE_BILEVEL=1 FDTDX_FRYETT_MODAL_TEMPORAL_ID=modal_current_nested_midindex_v4 uv run python -m benchmarks.cases.invdes_fryett_hybrid_scratch.modal_temporal --updates 1
```

The persistent launcher is `scripts/start_fryett_modal_source_bilevel_campaign.sh`.

<script>setTimeout(() => window.location.reload(), 60000);</script>
