def test_simplifiy(): domain = Domain(3, 3) complex_1 = Complex(domain, 'P-', 1) space = FormSpace(complex_1, 0) Hspace = HarmonicSpace(complex_1, 0) ref = ReferenceCell(domain) f = Coefficient(space) p = Coefficient(Hspace) u = trialfunction(space) v = Argument(space, 0) kappa = Constant(1) g1 = wedge(kappa, d(u)) a = inner(wedge(kappa, d(u)), d(v)) L = inner((f - p), u) w = pullback(a) w1 = pullback(g1) w2 = simplify(w) w3 = simplify(w1) assert not isinstance(w2.integrand, Pullback) and isinstance( w.integrand, Pullback) and not isinstance(w3, Pullback) and isinstance( w1, Pullback)
def test_possion_str(): domain = Domain(3, 3) complex_1 = Complex(domain, 'P-', 1) space = FormSpace(complex_1, 0) Hspace = HarmonicSpace(complex_1, 0) f = Coefficient(space) p = Coefficient(Hspace) u = trialfunction(space) v = Argument(space, 0) kappa = Constant(1) a = inner(wedge(kappa, d(u)), d(v)) L = inner((f - p), u) print( "This test will fail if all tests are run, due to string numbers changing, use command py.test.exe test_str.py to check" ) assert ( str(a) == "∫Ω₁{(((-1∧W₀)+W₁)∧*(U))}" or str(a) == "\u222b\u03a9\u2081{((1\u2227d(U))\u2227*(d(V)))}" or str(a) == "\u222b\u03a9\u2081\u2087{((1\u2227d(U))\u2227*(d(V)))}" ) and ( str(L) == "∫Ω₁{(((-1∧W₀)+W₁)∧*(U))}" or str(L) == "\u222b\u03a9\u2081{(((-1\u2227W\u2080)+W\u2081)\u2227*(U))}" or str(L) == "\u222b\u03a9\u2081\u2087{(((-1\u2227W\u2081\u2082)+W\u2081\u2083)\u2227*(U))}" )
def test_coefficient(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) f = Coefficient(space) g = Coefficient(space) assert f.degree == 1 and f.domain == D and f != g
def test_possion(): domain = Domain(3, 3) complex_1 = Complex(domain, 'P-', 1) space = FormSpace(complex_1, 0) Hspace = HarmonicSpace(complex_1, 0) f = Coefficient(space) p = Coefficient(Hspace) u = trialfunction(space) v = Argument(space, 0) kappa = Constant(1) a = inner(wedge(kappa, d(u)), d(v)) L = inner((f - p), u) assert L.domain == domain and L.integrand.degree == 3 and a.integrand.degree == 3
def test_wedge(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) f = Coefficient(space) u = Argument(space, 1) v = Argument(space, 0) w = wedge(wedge(u, v), f) assert w.degree == 3 and w.domain == D
def test_pullback(): domain = Domain(3, 3) complex_1 = Complex(domain, 'P-', 1) space = FormSpace(complex_1, 0) Hspace = HarmonicSpace(complex_1, 0) ref = ReferenceCell(domain) f = Coefficient(space) p = Coefficient(Hspace) u = trialfunction(space) v = Argument(space, 0) kappa = Constant(1) g1 = wedge(kappa, d(u)) a = inner(wedge(kappa, d(u)), d(v)) L = inner((f - p), u) w = pullback(a) w1 = pullback(g1) assert w1.domain == domain and w.integrand.degree == 3 and w.domain == ref
def test_integral_1(): domain = Domain(3, 3) complex = Complex(domain, 'P-', 2) space = FormSpace(complex, 1) G = Coefficient(space) u = Argument(space, 1) form = wedge(wedge(d(u), Constant(3)), G) a = Integral(form) assert a.domain == domain and a.integrand == form
def test_Sum(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) space2 = FormSpace(complex_1, 2) f = Coefficient(space2) u = Argument(space, 1) v = Argument(space, 0) w = Sum(u, v) w1 = Sum(w, f) assert w.degree == 1 and w.domain == D and w1.degree == 1 and w1.domain == D
def test_d_2(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) space2 = FormSpace(complex_1, 2) f = Coefficient(space2) u = Argument(space, 1) v = Argument(space, 0) w1 = d(wedge(3.45, wedge(u, v))) w2 = d(wedge(w1, f)) assert w1.degree == 3 and w1.domain == D and w2.degree == 6 and w2.domain == D
def test_wedge_2(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) space2 = FormSpace(complex_1, 2) f = Coefficient(space2) u = Argument(space, 1) v = Argument(space, 0) w1 = wedge(wedge(u, v), 7) w2 = wedge(w1, f) assert w1.degree == 2 and w1.domain == D and w2.degree == 4
def test_forms(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) f = Coefficient(space) u = Argument(space, 1) v = Argument(space, 0) w = u + v w1 = f + w w2 = w1 - v assert w2.degree == 1 and w2.domain == D
def test_d(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 1) space2 = FormSpace(complex_1, 2) f = Coefficient(space) u = Argument(space, 1) v = Argument(space2, 0) w1 = d(u) w2 = d(v) w3 = d(f) assert w1.degree == 2 and w1.domain == D and w2.degree == 3 and w3.degree == 2
def test_ints_with_forms(): D = Domain(2, 3) complex_1 = Complex(D, 'P-', 2) space = FormSpace(complex_1, 0) f = Coefficient(space) u = Argument(space, 1) v = Argument(space, 0) w = u + 1 w1 = w - v w2 = w1 - f w3 = w2 - 5 assert w3.domain == D and w3.degree == 0