Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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))}"
    )
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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