Add residual testing

This commit is contained in:
Jan Petykiewicz 2019-11-12 01:10:01 -08:00
parent 0fd6df441e
commit b24b5d169f

View File

@ -8,6 +8,13 @@ from .. import fdfd, vec, unvec
from .utils import assert_close, assert_fields_close, PRNG from .utils import assert_close, assert_fields_close, PRNG
def test_residual(sim):
A = fdfd.operators.e_full(sim.omega, sim.dxes, vec(sim.epsilon)).tocsr()
b = -1j * sim.omega * vec(sim.j)
residual = A @ vec(sim.e) - b
assert numpy.linalg.norm(residual) < 1e-10
def test_poynting_planes(sim): def test_poynting_planes(sim):
mask = (sim.j != 0).any(axis=0) mask = (sim.j != 0).any(axis=0)
if mask.sum() != 2: if mask.sum() != 2: