Add poynting vector and divergence

This commit is contained in:
Jan Petykiewicz 2019-07-09 20:20:49 -07:00
parent a8a5a69e1a
commit 099966f291

View File

@ -241,3 +241,18 @@ def cpml(direction:int,
return e, h return e, h
return pml_e, pml_h, fields return pml_e, pml_h, fields
def poynting(e, h):
s = [numpy.roll(e[1], -1, axis=0) * h[2] - numpy.roll(e[2], -1, axis=0) * h[1],
numpy.roll(e[2], -1, axis=1) * h[0] - numpy.roll(e[0], -1, axis=1) * h[2],
numpy.roll(e[0], -1, axis=2) * h[1] - numpy.roll(e[1], -1, axis=2) * h[0]]
return numpy.array(s)
def div_poyting(dt, dxes, e, h):
s = poynting(e, h)
ds = (s[0] - numpy.roll(s[0], 1, axis=0) +
s[1] - numpy.roll(s[1], 1, axis=1) +
s[2] - numpy.roll(s[2], 1, axis=2))
return ds