Skip to content

Commit b434058

Browse files
committed
Update demo_tnt-elements.py
According to https://github.com/mscroggs/symfem/blob/main/symfem/elements/tnt.py, we need to multiply by the primary bubble function, and take the laplacian. To this end tabulation which also generates the derivatives is used.
1 parent 9ee46f0 commit b434058

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

python/demo/demo_tnt-elements.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@ def create_tnt_quad(degree):
218218
x[2].append(np.zeros([0, 2]))
219219
M[2].append(np.zeros([0, 1, 0, 1]))
220220
else:
221-
pts, wts = basix.make_quadrature(basix.CellType.quadrilateral, 2 * degree - 1)
222-
poly = basix.tabulate_polynomials(
223-
basix.PolynomialType.legendre, basix.CellType.quadrilateral, degree - 2, pts
224-
)
221+
pts, wts = basix.make_quadrature(basix.CellType.quadrilateral, 2 * degree)
222+
u = pts[:, 0]
223+
v = pts[:, 1]
224+
poly = basix.polynomials.tabulate_polynomial_set(basix.CellType.quadrilateral, basix.PolynomialType.legendre, degree-2, 2, pts)
225+
# this assumes the conventional [0 to 1][0 to 1] domain of the reference element, and takes the Laplacian of (1-u)*u*(1-v)*v*poly, cf https://github.com/mscroggs/symfem/blob/main/symfem/elements/tnt.py
226+
poly = (poly[5]+poly[3])*(u-1)*u*(v-1)*v+2*(poly[2]*(u-1)*u*(2*v-1)+poly[1]*(v-1)*v*(2*u-1)+poly[0]*((u-1)*u+(v-1)*v))
225227
face_ndofs = poly.shape[0]
226228
x[2].append(pts)
227229
mat = np.zeros((face_ndofs, 1, len(pts), 1))

0 commit comments

Comments
 (0)