Skip to content

Refine BeamZ modes on the Yee grid#25

Draft
QuentinWach wants to merge 6 commits into
mainfrom
codex/yee-mode-contract
Draft

Refine BeamZ modes on the Yee grid#25
QuentinWach wants to merge 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant