diff --git a/meanas/fdfd/waveguide_2d.py b/meanas/fdfd/waveguide_2d.py index e8f766b..7d1f651 100644 --- a/meanas/fdfd/waveguide_2d.py +++ b/meanas/fdfd/waveguide_2d.py @@ -413,7 +413,6 @@ def _normalized_fields( shape = [s.size for s in dxes[0]] # Find time-averaged Sz and normalize to it - # H phase is adjusted by a half-cell forward shift for Yee cell, and 1-cell reverse shift for Poynting Sz_tavg = inner_product(e, h, dxes=dxes, prop_phase=prop_phase, conj_h=True).real assert Sz_tavg > 0, f'Found a mode propagating in the wrong direction! {Sz_tavg=}' diff --git a/meanas/fdfd/waveguide_3d.py b/meanas/fdfd/waveguide_3d.py index da50533..5048dea 100644 --- a/meanas/fdfd/waveguide_3d.py +++ b/meanas/fdfd/waveguide_3d.py @@ -45,6 +45,7 @@ def solve_mode( 'E': NDArray[complexfloating], 'H': NDArray[complexfloating], 'wavenumber': complex, + 'wavenumber_2d': complex, } ``` """ @@ -196,6 +197,8 @@ def compute_overlap_e( Etgt = numpy.zeros_like(Ee) Etgt[slices2] = Ee[slices2] + # note no sqrt() when normalizing below since we want to get 1.0 after overlapping with the + # original field, not the normalized one Etgt /= (Etgt.conj() * Etgt).sum() # type: ignore return cfdfield_t(Etgt)