Operator-based soruce

fdtd_extras
Jan Petykiewicz 5 years ago
parent 1a04bab361
commit 07c94617fe

@ -170,18 +170,25 @@ def compute_source(E: field_t,
src_order = numpy.roll(range(3), -axis)
exp_iphi = numpy.exp(1j * polarity * wavenumber * dxes[1][axis][slices[axis]])
J[src_order[1]] = +exp_iphi * H[src_order[2]] * polarity
J[src_order[2]] = -exp_iphi * H[src_order[1]] * polarity
rollby = -1 if polarity > 0 else 0
M[src_order[1]] = +numpy.roll(E[src_order[2]], rollby, axis=axis)
M[src_order[2]] = -numpy.roll(E[src_order[1]], rollby, axis=axis)
# J[src_order[1]] = +exp_iphi * H[src_order[2]] * polarity / dxes[1][axis][slices[axis]]
# J[src_order[2]] = -exp_iphi * H[src_order[1]] * polarity / dxes[1][axis][slices[axis]]
# M[src_order[1]] = +numpy.roll(E[src_order[2]], rollby, axis=axis) / dxes[0][axis][slices[axis]]
# M[src_order[2]] = -numpy.roll(E[src_order[1]], rollby, axis=axis) / dxes[0][axis][slices[axis]]
s2 = [slice(None), slice(None), slice(None)]
s2[axis] = slice(slices[axis].start, slices[axis].stop)
s2 = (src_order, *s2)
J[s2] = numpy.roll(functional.curl_h(dxes=dxes)(H), rollby, axis=axis+1)[s2] * polarity * exp_iphi
M[s2] = numpy.roll(functional.curl_e(dxes=dxes)(E), -rollby, axis=axis+1)[s2]
m2j = functional.m2j(omega, dxes, mu)
Jm = m2j(M)
Jtot = J + Jm
return Jtot
return Jtot.conj()
def compute_overlap_e(E: field_t,
@ -332,7 +339,6 @@ def compute_source_q(E: field_t,
Jm = m2j(M)
Jtot = J + Jm
return Jtot, J, M

Loading…
Cancel
Save