diff --git a/meanas/fdfd/waveguide_3d.py b/meanas/fdfd/waveguide_3d.py index 5048dea..61ed38e 100644 --- a/meanas/fdfd/waveguide_3d.py +++ b/meanas/fdfd/waveguide_3d.py @@ -157,19 +157,31 @@ def compute_source( def compute_overlap_e( - E: cfdfield, + E: cfdfield_t, wavenumber: complex, dxes: dx_lists_t, axis: int, polarity: int, slices: Sequence[slice], + omega: float, ) -> cfdfield_t: """ Given an eigenmode obtained by `solve_mode`, calculates an overlap_e for the mode orthogonality relation Integrate(((E x H_mode) + (E_mode x H)) dot dn) [assumes reflection symmetry]. - TODO: add reference or derivation for compute_overlap_e + E x H_mode + E_mode x H + -> Ex Hmy - EyHmx + Emx Hy - Emy Hx (Z-prop) + Ex we/B Emx + Ex i/B dy Hmz - Ey (-we/B Emy) - Ey i/B dx Hmz + we/B (Ex Emx + Ey Emy) + i/B (Ex dy Hmz - Ey dx Hmz) + we/B (Ex Emx + Ey Emy) + i/B (Ex dy (dx Emy - dy Emx) - Ey dx (dx Emy - dy Emx)) + we/B (Ex Emx + Ey Emy) + i/B (Ex dy dx Emy - Ex dy dy Emx - Ey dx dx Emy - Ey dx dy Emx) + + Ex j/wu (-jB Emx - dx Emz) - Ey j/wu (dy Emz + jB Emy) + B/wu (Ex Emx + Ey Emy) - j/wu (Ex dx Emz + Ey dy Emz) + + + TODO: add reference Args: E: E-field of the mode @@ -197,9 +209,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 + # Note: We normalize so that (Etgt @ E.conj()) == 1, so (Etgt @ Etgt.conj) != 1 + Etgt /= (Etgt.conj() * Etgt).sum() return cfdfield_t(Etgt)