Examples in 3D¶
This page will describe the foundational element definitions in three dimensions and how they are written in this software.
Describing a tetrahedron¶
A tetrahedron is initially set up like this:
tetra = make_tetrahedron()
and then components of the tetrahedron may be extracted using either the helper functions Point.vertices and Point.edges or the generic function Point.d_entities.
vert = tetra.vertices()[0]
edge = tetra.edges()[0]
face = tetra.d_entities(2)[0]
CG3 on a tetrahedron¶
xs = [DOF(DeltaPairing(), PointKernel(()))]
dg0 = ElementTriple(vert, (P0, "C0"),
DOFGenerator(xs, S1))
xs = [DOF(DeltaPairing(), PointKernel((-1/3,)))]
dg1_int = ElementTriple(edge, (P1, "C0"),
DOFGenerator(xs, S2))
xs = [DOF(DeltaPairing(), PointKernel((0, 0)))]
dg0_face = ElementTriple(face, (P0, "C0"),
DOFGenerator(xs, S1))
v_xs = [immerse(tetra, dg0)]
cgverts = DOFGenerator(v_xs, Z4)
e_xs = [immerse(tetra, dg1_int)]
cgedges = DOFGenerator(e_xs, tet_edges)
f_xs = [immerse(tetra, dg0_face)]
cgfaces = DOFGenerator(f_xs, tet_faces)
cg3 = ElementTriple(tetra, (P3, "C0"),
[cgverts, cgedges, cgfaces])
(Source code, png, hires.png, pdf)
Raviart Thomas on a tetrahedron¶
x = sp.Symbol("x")
y = sp.Symbol("y")
z = sp.Symbol("z")
M = sp.Matrix([[x, y, z]])
vec_Pd = PolynomialSpace(deg - 1, shape=3)
Pd = PolynomialSpace(deg - 1)
rt_space = vec_Pd + (Pd.restrict(deg - 2, deg - 1))*M
xs = [DOF(L2Pairing(), VectorKernel(1, action=HDiv))]
dofs = DOFGenerator(xs, S1)
face_vec = ElementTriple(face, (P0, L2), dofs)
im_xs = [immerse(cell, face_vec)]
face = DOFGenerator(im_xs, tet_faces)
rt1 = ElementTriple(cell, (rt_space, "C0"),
[face])
(Source code, png, hires.png, pdf)
Nedelec on a tetrahedron¶
xs = [DOF(L2Pairing(), VectorKernel(1, action=HCurl))]
dofs = DOFGenerator(xs, S1)
edges = ElementTriple(edge, (P0, L2), dofs)
xs = [immerse(tet, edges)]
tet_edges = PermutationSetRepresentation([Permutation([0, 1, 2, 3]), Permutation([3, 2, 0, 1]),
Permutation([1, 0, 3, 2]), Permutation([1, 2, 3, 0]),
Permutation([2, 0, 1, 3]), Permutation([2, 3, 1, 0])])
edge_dofs = DOFGenerator(xs, tet_edges)
(Source code, png, hires.png, pdf)