Before running this example, you must install
Basix.UFL:
pip3 install git+https://github.com/FEniCS/basix fenics-ufl
This element can then be created with the following lines of Python:
import basix
import basix.ufl
import numpy as np
# Create Radau degree 1 on a interval
e = basix.ufl.custom_element(
basix.CellType.interval,
(),
np.array([[1.0, 0.0], [0.5, 0.2886751345948128]], dtype=np.float64),
[[np.array([[0.0]], dtype=np.float64), np.array([[1.0]], dtype=np.float64)], [np.empty((0, 1), dtype=np.float64)], [], []],
[[np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64)], [np.empty((0, 1, 0, 1), dtype=np.float64)], [], []],
0,
basix.MapType.identity,
basix.SobolevSpace.H1,
False,
-1,
1,
basix.PolysetType.standard, dtype=np.float64
)
# Create Radau degree 2 on a interval
e = basix.ufl.custom_element(
basix.CellType.interval,
(),
np.array([[0.9999999999999998, 0.0, 0.0], [0.4999999999999999, 0.28867513459481275, 0.0], [0.33333333333333326, 0.2886751345948128, 0.074535599249993]], dtype=np.float64),
[[np.array([[0.0]], dtype=np.float64), np.array([[1.0]], dtype=np.float64)], [np.array([[0.3550510257216822]], dtype=np.float64)], [], []],
[[np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64)], [np.array([[[[1.0]]]], dtype=np.float64)], [], []],
0,
basix.MapType.identity,
basix.SobolevSpace.H1,
False,
-1,
2,
basix.PolysetType.standard, dtype=np.float64
)
# Create Radau degree 1 on a quadrilateral
e = basix.ufl.custom_element(
basix.CellType.quadrilateral,
(),
np.array([[1.0, 0.0, 0.0, 0.0], [0.5, 0.2886751345948128, 0.0, 0.0], [0.5, 0.0, 0.2886751345948128, 0.0], [0.25, 0.14433756729740643, 0.14433756729740643, 0.08333333333333333]], dtype=np.float64),
[[np.array([[0.0, 0.0]], dtype=np.float64), np.array([[1.0, 0.0]], dtype=np.float64), np.array([[0.0, 1.0]], dtype=np.float64), np.array([[1.0, 1.0]], dtype=np.float64)], [np.empty((0, 2), dtype=np.float64), np.empty((0, 2), dtype=np.float64), np.empty((0, 2), dtype=np.float64), np.empty((0, 2), dtype=np.float64)], [np.empty((0, 2), dtype=np.float64)], []],
[[np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64)], [np.empty((0, 1, 0, 1), dtype=np.float64), np.empty((0, 1, 0, 1), dtype=np.float64), np.empty((0, 1, 0, 1), dtype=np.float64), np.empty((0, 1, 0, 1), dtype=np.float64)], [np.empty((0, 1, 0, 1), dtype=np.float64)], []],
0,
basix.MapType.identity,
basix.SobolevSpace.H1,
False,
-1,
1,
basix.PolysetType.standard, dtype=np.float64
)
# Create Radau degree 2 on a quadrilateral
e = basix.ufl.custom_element(
basix.CellType.quadrilateral,
(),
np.array([[0.9999999999999996, 0.0, 0.0, -2.7755575615628914e-17, 0.0, 0.0, 0.0, 0.0, -8.326672684688674e-17], [0.4999999999999998, 0.28867513459481275, 0.0, 0.0, 0.0, 0.0, 1.3877787807814457e-17, -4.163336342344337e-17, -4.163336342344337e-17], [0.33333333333333315, 0.2886751345948127, 0.07453559924999298, 0.0, 0.0, 0.0, -1.3877787807814457e-17, -4.163336342344337e-17, -1.3877787807814457e-17], [0.49999999999999983, 0.0, -1.3877787807814457e-17, 0.28867513459481275, 0.0, -2.7755575615628914e-17, 0.0, 1.3877787807814457e-17, -4.163336342344337e-17], [0.2499999999999999, 0.14433756729740635, 0.0, 0.14433756729740632, 0.08333333333333329, 0.0, 6.938893903907228e-18, -2.7755575615628914e-17, -1.3877787807814457e-17], [0.16666666666666657, 0.14433756729740638, 0.03726779962499649, 0.09622504486493758, 0.0833333333333333, 0.021516574145596754, 0.0, -2.7755575615628914e-17, -6.938893903907228e-18], [0.33333333333333315, 0.0, -1.3877787807814457e-17, 0.2886751345948127, 0.0, -2.7755575615628914e-17, 0.07453559924999298, 0.0, -2.0816681711721685e-17], [0.16666666666666657, 0.09622504486493756, -1.3877787807814457e-17, 0.14433756729740638, 0.0833333333333333, -1.3877787807814457e-17, 0.03726779962499649, 0.02151657414559674, -6.938893903907228e-18], [0.11111111111111108, 0.09622504486493758, 0.024845199749997656, 0.09622504486493758, 0.08333333333333329, 0.021516574145596754, 0.02484519974999766, 0.02151657414559674, 0.00555555555555555]], dtype=np.float64),
[[np.array([[0.0, 0.0]], dtype=np.float64), np.array([[1.0, 0.0]], dtype=np.float64), np.array([[0.0, 1.0]], dtype=np.float64), np.array([[1.0, 1.0]], dtype=np.float64)], [np.array([[0.3550510257216822, 0.0]], dtype=np.float64), np.array([[0.0, 0.3550510257216822]], dtype=np.float64), np.array([[1.0, 0.3550510257216822]], dtype=np.float64), np.array([[0.3550510257216822, 1.0]], dtype=np.float64)], [np.array([[0.3550510257216822, 0.3550510257216822]], dtype=np.float64)], []],
[[np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64)], [np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64), np.array([[[[1.0]]]], dtype=np.float64)], [np.array([[[[1.0]]]], dtype=np.float64)], []],
0,
basix.MapType.identity,
basix.SobolevSpace.H1,
False,
-1,
2,
basix.PolysetType.standard, dtype=np.float64
)