Compare commits
No commits in common. "107c0fcd7e65c61230b628a21cd62c3c77c81fd9" and "5c3b3532a96b981573e1da0cc5f365210b36118e" have entirely different histories.
107c0fcd7e
...
5c3b3532a9
@ -26,8 +26,6 @@ def test_poynting_planes(sim: 'FDResult') -> None:
|
|||||||
# for dxa in dxg:
|
# for dxa in dxg:
|
||||||
# if not (dxa == sim.dxes[0][0][0]).all():
|
# if not (dxa == sim.dxes[0][0][0]).all():
|
||||||
# pytest.skip('test_poynting_planes skips nonuniform dxes')
|
# pytest.skip('test_poynting_planes skips nonuniform dxes')
|
||||||
|
|
||||||
# pick only the second point
|
|
||||||
points = numpy.where(mask)
|
points = numpy.where(mask)
|
||||||
mask[points[0][0], points[1][0], points[2][0]] = 0
|
mask[points[0][0], points[1][0], points[2][0]] = 0
|
||||||
|
|
||||||
@ -45,14 +43,10 @@ def test_poynting_planes(sim: 'FDResult') -> None:
|
|||||||
s[1, mask].sum(), -s[1, my].sum(),
|
s[1, mask].sum(), -s[1, my].sum(),
|
||||||
s[2, mask].sum(), -s[2, mz].sum()]
|
s[2, mask].sum(), -s[2, mz].sum()]
|
||||||
|
|
||||||
e_dot_j = sim.e * sim.j.conj()
|
e_dot_j = sim.e * sim.j * sim.dxes[0][0][:, None, None] * sim.dxes[0][1][None, :, None] * sim.dxes[0][2][None, None, :]
|
||||||
dv = (sim.dxes[0][0][:, None, None]
|
src_energy = -e_dot_j[:, mask].real / 2
|
||||||
* sim.dxes[0][1][None, :, None]
|
|
||||||
* sim.dxes[0][2][None, None, :]
|
|
||||||
)
|
|
||||||
src_energy = -(e_dot_j.real * dv)[:, mask] / 2
|
|
||||||
|
|
||||||
assert_close(sum(planes), src_energy.sum(), rtol=1e-6) # TODO improve energy calculation accuracy?
|
assert_close(sum(planes), src_energy.sum())
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@ -94,8 +88,8 @@ def j_distribution(
|
|||||||
if request.param == 'center':
|
if request.param == 'center':
|
||||||
j[center_mask] = j_mag
|
j[center_mask] = j_mag
|
||||||
elif request.param == 'diag':
|
elif request.param == 'diag':
|
||||||
j[numpy.roll(center_mask, [1, 1, 1], axis=(1, 2, 3))] = (1 + 1j) * j_mag
|
j[numpy.roll(center_mask, [1, 1, 1], axis=(1, 2, 3))] = j_mag
|
||||||
j[numpy.roll(center_mask, [-1, -1, -1], axis=(1, 2, 3))] = (1 - 1j) * j_mag
|
j[numpy.roll(center_mask, [-1, -1, -1], axis=(1, 2, 3))] = -1j * j_mag
|
||||||
yield j
|
yield j
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user