def test_very_nonlinear_burgers():
    ambient_dim = 2

    p = 1
    q = 2
    r = 2

    u = sym.Field("u")

    B = np.array([1.0, 2.0])

    Adiff = 0.001
    C = 0.0001

    eqns = sym.join(
            sym.d_dt(u**p)
            + sym.div(B * u**q)
            - sym.div(Adiff * sym.grad(u**r))
            + C * u
            )

    print(sym.pretty(eqns))

    print(generate_proteus_problem_file(
            PDESystem(
                ambient_dim=ambient_dim,
                pde_system=eqns,
                unknowns=[u],
                ),
            "Burgers"))
def test_parabolic_system():
    ambient_dim = 2

    u = sym.Field("u")
    v = sym.Field("v")

    eqns = sym.join(
            sym.d_dt(u) - sym.div(sym.grad(u-v)),
            sym.d_dt(v) - sym.div(sym.grad(u+v)),
            )

    print(sym.pretty(eqns))

    generate_proteus_problem_file(
            PDESystem(
                ambient_dim=ambient_dim,
                pde_system=eqns,
                unknowns=[u, v],
                ),
            "ParabolicSystem")
def test_burgers():
    ambient_dim = 2

    u = sym.Field("u")

    vec = np.array([1.0, 2.0])

    eqns = sym.join(
            sym.d_dt(u)
            + sym.div(vec * u**2)
            - sym.div(sym.grad(u))
            )

    print(sym.pretty(eqns))

    generate_proteus_problem_file(
            PDESystem(
                ambient_dim=ambient_dim,
                pde_system=eqns,
                unknowns=[u],
                ),
            "Burgers")
def test_heat():
    ambient_dim = 2

    u = sym.Field("u")

    eqns = sym.join(
            sym.d_dt(u)
            - sym.div(sym.grad(u))
            )

    print(sym.pretty(eqns))

    generate_proteus_problem_file(
            PDESystem(
                ambient_dim=ambient_dim,
                pde_system=eqns,
                unknowns=[u],
                ),
            "Heat")
def test_wave():
    dim = 3
    u = sym.Field("u")
    f = sym.Field("f")
    c = sym.Parameter("c")
    v = sym.VectorField("v")

    eqns = sym.join(
            sym.d_dt(u)
            + c * sym.div(v) - f,

            sym.d_dt(v)
            + c * sym.grad(u)
            )

    print(sym.pretty(eqns))

    generate_proteus_problem_file(
            PDESystem(
                ambient_dim=dim,
                pde_system=eqns,
                unknowns=[u, v],
                ),
            "Wave")