Skip to content

Commit 0947374

Browse files
authored
Add BDDF element (#44)
* remove print * correct docstring * Add BDDM element on hex
1 parent c7c693a commit 0947374

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

symfem/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def create_element(cell_type, element_type, order):
9999
Raviart-Thomas, RT, N1div, dQ, NCE, RTCE, Qcurl, Q, NCF, RTCF, Qdiv, vector Q,
100100
vQ, Brezzi-Douglas-Marini, BDM, N2div, Morley, Hermite, Mardal-Tai-Winther,
101101
MTW, Argyris, bubble, dual, Buffa-Christiansen, BC, rotated Buffa-Christiansen,
102-
RBC, Brezzi-Douglas-Fortin-Marini, BDFM
102+
RBC, Brezzi-Douglas-Fortin-Marini, BDFM, Brezzi-Douglas-Duran-Fortin, BDDF
103103
order : int
104104
The order of the element.
105105
"""

symfem/elements/bddm.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""Brezzi-Douglas-Duran-Fortin elements."""
2+
3+
from ..core.finite_element import FiniteElement
4+
from ..core.moments import make_integral_moment_dofs
5+
from ..core.polynomials import polynomial_set
6+
from ..core.symbolic import x, zero
7+
from ..core.calculus import curl
8+
from ..core.functionals import NormalIntegralMoment, IntegralMoment
9+
from .lagrange import DiscontinuousLagrange, VectorDiscontinuousLagrange
10+
11+
12+
def bddf_polyset(reference, order):
13+
"""Create the polynomial basis for a BDDF element."""
14+
dim = reference.tdim
15+
pset = []
16+
assert reference.name == "hexahedron"
17+
pset = polynomial_set(dim, dim, order)
18+
pset.append(curl((zero, zero, x[0] ** (order + 1) * x[1])))
19+
pset.append(curl((zero, x[0] * x[2] ** (order + 1), zero)))
20+
pset.append(curl((x[1] ** (order + 1) * x[2], zero, zero)))
21+
for i in range(1, order + 1):
22+
pset.append(curl((zero, zero, x[0] * x[1] ** (i + 1) * x[2] ** (order - i))))
23+
pset.append(curl((zero, x[0] ** (i + 1) * x[1] ** (order - i) * x[2], zero)))
24+
pset.append(curl((x[0] ** (order - i) * x[1] * x[2] ** (i + 1), zero, zero)))
25+
26+
return pset
27+
28+
29+
class BDDF(FiniteElement):
30+
"""Brezzi-Douglas-Duran-Fortin Hdiv finite element."""
31+
32+
def __init__(self, reference, order):
33+
poly = bddf_polyset(reference, order)
34+
35+
dofs = make_integral_moment_dofs(
36+
reference,
37+
facets=(NormalIntegralMoment, DiscontinuousLagrange, order),
38+
cells=(IntegralMoment, VectorDiscontinuousLagrange, order - 2),
39+
)
40+
41+
super().__init__(reference, order, poly, dofs, reference.tdim, reference.tdim)
42+
43+
names = ["Brezzi-Douglas-Duran-Fortin", "BDDF"]
44+
references = ["hexahedron"]
45+
min_order = 1
46+
mapping = "contravariant"
47+
continuity = "H(div)"

symfem/elements/bdfm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Brezzi-Douglas-Fortin-Marini and Brezzi-Douglas-Duran-Fortin elements."""
1+
"""Brezzi-Douglas-Fortin-Marini elements."""
22

33
from ..core.finite_element import FiniteElement
44
from ..core.moments import make_integral_moment_dofs

test/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"serendipity Hcurl": 3,
3434
},
3535
"hexahedron": {
36+
"Brezzi-Douglas-Duran-Fortin": 2,
3637
"Brezzi-Douglas-Fortin-Marini": 2,
3738
"NCE": 2,
3839
"NCF": 2,
@@ -77,7 +78,6 @@ def elements(max_order=5, include_dual=True, include_non_dual=True,
7778
max_o = max_o[r]
7879
else:
7980
max_o = 100
80-
print(r, e.names[0])
8181
if r in max_orders_getting_basis and e.names[0] in max_orders_getting_basis[r]:
8282
max_o = min(max_orders_getting_basis[r][e.names[0]], max_o)
8383

0 commit comments

Comments
 (0)