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
Merged
Conversation
- 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
marked this pull request as ready for review
July 26, 2026 14:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 deselectedgit diff --check origin/main...HEAD