def test_single_block_with_restriction_from_block_element(
        mesh, restriction, Element):
    V_element = Element(mesh)
    V = FunctionSpace(mesh, V_element)
    block_V_element = BlockElement(V_element)
    block_V = BlockFunctionSpace(mesh, block_V_element, restrict=[restriction])
    assert_dof_map_single_block_with_restriction(V, block_V)
def test_two_blocks_with_restriction_from_block_element(mesh, restriction, Elements):
    (Element1, Element2) = Elements
    V1_element = Element1(mesh)
    V2_element = Element2(mesh)
    V1 = FunctionSpace(mesh, V1_element)
    V2 = FunctionSpace(mesh, V2_element)
    block_V_element = BlockElement(V1_element, V2_element)
    block_V = BlockFunctionSpace(mesh, block_V_element, restrict=restriction)
    assert_dof_map_test_two_blocks_with_restriction(V1, V2, block_V)
Exemplo n.º 3
0
                local_p[4 * i + 2 - local_range[0]] = 0.
                local_p[4 * i + 3 - local_range[0]] = math.pow(10, row[0])
    p.vector().set_local(local_p)
    p.vector().apply("insert")


mesh = Mesh("data/biot_2mat.xml")
subdomains = MeshFunction("size_t", mesh, "data/biot_2mat_physical_region.xml")
boundaries = MeshFunction("size_t", mesh, "data/biot_2mat_facet_region.xml")

for discretization in ("DG", "EG"):
    # Block function space
    V_element = VectorElement("CG", mesh.ufl_cell(), 2)
    if discretization == "DG":
        Q_element = FiniteElement("DG", mesh.ufl_cell(), 1)
        W_element = BlockElement(V_element, Q_element)
    elif discretization == "EG":
        Q_element = FiniteElement("CG", mesh.ufl_cell(), 1)
        D_element = FiniteElement("DG", mesh.ufl_cell(), 0)
        EG_element = Q_element + D_element
        W_element = BlockElement(V_element, EG_element)
    else:
        raise RuntimeError("Invalid discretization")
    W = BlockFunctionSpace(mesh, W_element)

    PM = FunctionSpace(mesh, "DG", 0)
    TM = TensorFunctionSpace(mesh, "DG", 0)

    I = Identity(mesh.topology().dim())

    dx = Measure("dx", domain=mesh, subdomain_data=subdomains)