Skip to content
This repository was archived by the owner on Aug 2, 2026. It is now read-only.

Refine BeamZ modes on the Yee grid - #25

Merged
QuentinWach merged 6 commits into
mainfrom
codex/yee-mode-contract
Jul 26, 2026
Merged

Refine BeamZ modes on the Yee grid#25
QuentinWach merged 6 commits into
mainfrom
codex/yee-mode-contract

Conversation

@QuentinWach

Copy link
Copy Markdown
Collaborator

Summary

  • refine eligible x-normal guided BeamZ modes with a fixed-beta Yee-grid eigenproblem and propagation-constant correction
  • validate refined fields using magnetic overlap, impedance and energy balance, signed power, and discrete Maxwell residuals
  • fall back atomically to the original mode and propagation constant when refinement is ineligible, fails, or produces an unphysical candidate
  • expose refinement controls and diagnostics, and add focused API and numerical tests

Why

BeamZ previously returned component-local profiles from the initial mode solve without a guarded refinement against the discrete Yee operators used downstream. This could leave the mode propagation constant and electric/magnetic fields insufficiently consistent with the discrete grid.

The new refinement path preserves physical mode identity and only adopts a candidate when the joint field, power, energy, and Maxwell checks pass. Callers can explicitly disable refinement, and rejected candidates leave the original mode unchanged.

Impact

Eligible x-normal guided modes gain a more consistent discrete representation and detailed refinement diagnostics. Other axes, unguided modes, disabled refinement, and rejected candidates retain the existing profiles.

Validation

  • uv run pytest -m "not slow" — 40 passed, 3 deselected
  • git diff --check origin/main...HEAD

- Added validation logic to ensure refined x-normal profiles maintain physical mode identity.
- Introduced diagnostics for electric and magnetic overlap, impedance change, and energy balance during refinement.
- Enhanced `solve_beamz_mode` to handle refinement requests and rejections appropriately.
- Updated tests to verify functionality of Yee refinement and its validation process.
@QuentinWach
QuentinWach marked this pull request as ready for review July 26, 2026 14:23
@QuentinWach
QuentinWach merged commit 80c57d8 into main Jul 26, 2026
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant