Skip to content

Commit 6102643

Browse files
weiliangjin2021momchil-flex
authored andcommitted
Improve accuracy of normal E-field computation in mode solver
1 parent dc999fe commit 6102643

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Fixed automatic creation of missing output directories.
2222
- Bug in handling of tuple-type gradients that could lead to empty tuples or failing gradient calculations when differentiating w.r.t. (for instance) `td.Box.center`.
2323
- Bug causing incorrect field projection results when multiple projection monitors with numerous sampling points were used.
24+
- Improved accuracy for normal E-field components in mode solver at microwave frequencies.
2425

2526
## [2.8.0] - 2025-03-04
2627

tidy3d/components/mode/solver.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,12 @@ def conditional_inverted_vec(eps_vec, threshold=1):
660660
Hx = h_field[:N, :] / (1j * neff - keff)
661661
Hy = h_field[N:, :] / (1j * neff - keff)
662662
Hz = inv_mu_zz.dot(dxf.dot(Ey) - dyf.dot(Ex))
663-
Ez = inv_eps_zz.dot(dxb.dot(Hy) - dyb.dot(Hx))
663+
# Ez = inv_eps_zz.dot(dxb.dot(Hy) - dyb.dot(Hx))
664+
665+
# Ez = -inv_eps_zz * div^H J H_xy, while Hxy = vals^-1 * qmat * Exy;
666+
# Note that div^H J q_partial = 0, so Ez = -vals^-1 inv_eps_zz * div^H J q_ep Exy
667+
h_partial_field = q_ep.dot(vecs) / (1j * neff - keff)
668+
Ez = inv_eps_zz.dot(dxb.dot(h_partial_field[N:, :]) - dyb.dot(h_partial_field[:N, :]))
664669

665670
# Bundle up
666671
E = np.stack((Ex, Ey, Ez), axis=0)

0 commit comments

Comments
 (0)