def test_gauss_1d_dielectric(): pp = ParallelPlates((2.0, 4.0), (3e-3, 2e-3)) X, er = pp.get_arrays(101) v1 = 10.0 V = pp.potential(X, v1) Q = np.array([fdm.gauss_1d(X, V, er, i) for i in range(1, len(X) - 1)]) Qa = pp.charge(v1) assert Q == approx(Qa)
def test_charge(): pp = ParallelPlates(3.5, 1e-3) Va = 10.0 expected = pp.capacitance() * Va assert pp.charge(Va) == approx(expected)