From d6a34b280eb22e5ff06ff1785fa356ab24ef93ff Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 26 Aug 2019 00:28:06 -0700 Subject: [PATCH] Simplify compute_source and fix propagation direction --- meanas/fdfd/waveguide_mode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meanas/fdfd/waveguide_mode.py b/meanas/fdfd/waveguide_mode.py index b9524e5..cd59b5f 100644 --- a/meanas/fdfd/waveguide_mode.py +++ b/meanas/fdfd/waveguide_mode.py @@ -178,10 +178,10 @@ def compute_source(E: field_t, s2[axis] = slice(slices[axis].start, slices[axis].stop) s2 = (src_order, *s2) - rollby = 1 if polarity > 0 else 0 - exp_iphi = numpy.exp(-1j * polarity * wavenumber * dxes[1][axis][slices[axis]]) - J[s2] = numpy.roll(functional.curl_h(dxes=dxes)(H.conj()), -rollby, axis=axis+1)[s2] * polarity * exp_iphi - M[s2] = -numpy.roll(functional.curl_e(dxes=dxes)(E.conj()), rollby, axis=axis+1)[s2] + rollby = 1 if polarity < 0 else 0 + exp_iphi = numpy.exp(-1j * -rollby * wavenumber * dxes[1][axis][slices[axis]]) + J[s2] = numpy.roll(functional.curl_h(dxes=dxes)(H), -rollby, axis=axis+1)[s2] * exp_iphi * -polarity + M[s2] = numpy.roll(functional.curl_e(dxes=dxes)(E), rollby, axis=axis+1)[s2] m2j = functional.m2j(omega, dxes, mu) Jm = m2j(M)