Remove unused waveguide_mode functions
This commit is contained in:
parent
d2d4220313
commit
f4bac9598d
@ -307,107 +307,6 @@ def solve_waveguide_mode_cylindrical(mode_number: int,
|
|||||||
return fields
|
return fields
|
||||||
|
|
||||||
|
|
||||||
def compute_source_q(E: field_t,
|
|
||||||
H: field_t,
|
|
||||||
wavenumber: complex,
|
|
||||||
omega: complex,
|
|
||||||
dxes: dx_lists_t,
|
|
||||||
axis: int,
|
|
||||||
polarity: int,
|
|
||||||
slices: List[slice],
|
|
||||||
mu: field_t = None,
|
|
||||||
) -> field_t:
|
|
||||||
A1f = functional.curl_h(dxes)
|
|
||||||
A2f = functional.curl_e(dxes)
|
|
||||||
|
|
||||||
J = A1f(H)
|
|
||||||
M = A2f(-E)
|
|
||||||
|
|
||||||
m2j = functional.m2j(omega, dxes, mu)
|
|
||||||
Jm = m2j(M)
|
|
||||||
|
|
||||||
Jtot = J + Jm
|
|
||||||
return Jtot, J, M
|
|
||||||
|
|
||||||
|
|
||||||
def compute_source_e(QE: field_t,
|
|
||||||
omega: complex,
|
|
||||||
dxes: dx_lists_t,
|
|
||||||
axis: int,
|
|
||||||
polarity: int,
|
|
||||||
slices: List[slice],
|
|
||||||
epsilon: field_t,
|
|
||||||
mu: field_t = None,
|
|
||||||
) -> field_t:
|
|
||||||
"""
|
|
||||||
Want AQE = -iwJ, where Q is mask and normally AE = -iwJ
|
|
||||||
## Want (AQ-QA) E = -iwJ, where Q is a mask
|
|
||||||
## If E is an eigenmode, AE = 0 so just AQE = -iwJ
|
|
||||||
Really only need E in 4 cells along axis (0, 0, Emode1, Emode2), find AE (1 iteration), then use center 2 cells as src
|
|
||||||
Maybe better to use (0, Emode1, Emode2, Emode3), find AE (1 iteration), then use left 2 cells as src?
|
|
||||||
"""
|
|
||||||
slices = tuple(slices)
|
|
||||||
|
|
||||||
# Trim a cell from each end of the propagation axis
|
|
||||||
slices_reduced = list(slices)
|
|
||||||
for aa in range(3):
|
|
||||||
if aa == axis:
|
|
||||||
if polarity > 0:
|
|
||||||
slices_reduced[axis] = slice(slices[axis].start, slices[axis].start+2)
|
|
||||||
else:
|
|
||||||
slices_reduced[axis] = slice(slices[axis].stop-2, slices[axis].stop)
|
|
||||||
else:
|
|
||||||
start = slices[aa].start
|
|
||||||
stop = slices[aa].stop
|
|
||||||
# if start is not None or stop is not None:
|
|
||||||
# if start is None:
|
|
||||||
# start = 1
|
|
||||||
# stop -= 1
|
|
||||||
# elif stop is None:
|
|
||||||
# stop = E.shape[aa + 1] - 1
|
|
||||||
# start += 1
|
|
||||||
# else:
|
|
||||||
# start += 1
|
|
||||||
# stop -= 1
|
|
||||||
# slices_reduced[aa] = slice(start, stop)
|
|
||||||
slices_reduced = (slice(None), *slices_reduced)
|
|
||||||
|
|
||||||
# Don't actually need to mask out E here since it needs to be pre-masked (QE)
|
|
||||||
|
|
||||||
A = functional.e_full(omega, dxes, epsilon, mu)
|
|
||||||
J4 = A(QE) / (-1j * omega) #J4 is 4-cell result of -iwJ = A QE
|
|
||||||
|
|
||||||
J = numpy.zeros_like(J4)
|
|
||||||
J[slices_reduced] = J4[slices_reduced]
|
|
||||||
return J
|
|
||||||
|
|
||||||
|
|
||||||
def compute_source_wg(E: field_t,
|
|
||||||
wavenumber: complex,
|
|
||||||
omega: complex,
|
|
||||||
dxes: dx_lists_t,
|
|
||||||
axis: int,
|
|
||||||
polarity: int,
|
|
||||||
slices: List[slice],
|
|
||||||
epsilon: field_t,
|
|
||||||
mu: field_t = None,
|
|
||||||
) -> field_t:
|
|
||||||
slices = tuple(slices)
|
|
||||||
Etgt, _slices2 = compute_overlap_ce(E=E, wavenumber=wavenumber,
|
|
||||||
dxes=dxes, axis=axis, polarity=polarity,
|
|
||||||
slices=slices)
|
|
||||||
|
|
||||||
slices4 = list(slices)
|
|
||||||
slices4[axis] = slice(slices[axis].start - 4 * polarity, slices[axis].start)
|
|
||||||
slices4 = tuple(slices4)
|
|
||||||
|
|
||||||
J = compute_source_e(QE=Etgt,
|
|
||||||
omega=omega, dxes=dxes, axis=axis,
|
|
||||||
polarity=polarity, slices=slices4,
|
|
||||||
epsilon=epsilon, mu=mu)
|
|
||||||
return J
|
|
||||||
|
|
||||||
|
|
||||||
def compute_overlap_ce(E: field_t,
|
def compute_overlap_ce(E: field_t,
|
||||||
wavenumber: complex,
|
wavenumber: complex,
|
||||||
dxes: dx_lists_t,
|
dxes: dx_lists_t,
|
||||||
|
Loading…
Reference in New Issue
Block a user