Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions grudge/models/em.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,20 @@ def operator(self, t, w):
material_divisor = (
[self.epsilon]*elec_components+[self.mu]*mag_components)

tags_and_bcs = [
(self.pec_tag, self.pec_bc(w)),
(self.pmc_tag, self.pmc_bc(w)),
(self.absorb_tag, self.absorbing_bc(w)),
(self.incident_tag, self.incident_bc(w)),
actx = get_container_context_recursively(w)

tags_and_bcs_real = [
(self.pec_tag, self.pec_bc(actx.np.real(w))),
(self.pmc_tag, self.pmc_bc(actx.np.real(w))),
(self.absorb_tag, self.absorbing_bc(actx.np.real(w))),
(self.incident_tag, self.incident_bc(actx.np.real(w))),
]

tags_and_bcs_imag = [
(self.pec_tag, self.pec_bc(actx.np.imag(w))),
(self.pmc_tag, self.pmc_bc(actx.np.imag(w))),
(self.absorb_tag, self.absorbing_bc(actx.np.imag(w))),
(self.incident_tag, self.incident_bc(actx.np.imag(w))),
]

dcoll = self.dcoll
Expand All @@ -407,14 +416,26 @@ def flux(pair):
return op.project(dcoll, pair.dd, "all_faces", self.flux(pair))

return (
- self.local_derivatives(w)
- self.local_derivatives(actx.np.real(w))
- 1j*self.local_derivatives(actx.np.imag(w))
- op.inverse_mass(
dcoll,
op.face_mass(
dcoll,
sum(flux(tpair) for tpair in op.interior_trace_pairs(dcoll, w))
+ sum(flux(op.bv_trace_pair(dcoll, tag, w, bc))
for tag, bc in tags_and_bcs)
sum(flux(tpair) for tpair in op.interior_trace_pairs(
dcoll, actx.np.real(w)))
+ sum(flux(op.bv_trace_pair(dcoll, tag, actx.np.real(w), bc))
for tag, bc in tags_and_bcs_real)
)
)
- 1j*op.inverse_mass(
dcoll,
op.face_mass(
dcoll,
sum(flux(tpair) for tpair in op.interior_trace_pairs(
dcoll, actx.np.imag(w)))
+ sum(flux(op.bv_trace_pair(dcoll, tag, actx.np.imag(w), bc))
for tag, bc in tags_and_bcs_imag)
)
)
) / material_divisor
Expand Down