From b24b5d169f3980d7b5768e461dd75e29fb5d3be6 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 12 Nov 2019 01:10:01 -0800 Subject: [PATCH] Add residual testing --- meanas/test/test_fdfd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meanas/test/test_fdfd.py b/meanas/test/test_fdfd.py index d126cd7..e9f3a21 100644 --- a/meanas/test/test_fdfd.py +++ b/meanas/test/test_fdfd.py @@ -8,6 +8,13 @@ from .. import fdfd, vec, unvec 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): mask = (sim.j != 0).any(axis=0) if mask.sum() != 2: