Repository navigation
Add warped GLL points on a pyramid - #1098
Open
garth-wells wants to merge 1 commit into
Open
garth-wells wants to merge 1 commit into
garth-wells wants to merge 1 commit into
Conversation
Restore the warp and blend construction of a non-equispaced lattice on a pyramid, so that gll_warped Lagrange elements can be created on pyramids. The points on the quadrilateral base are those of a hexahedron face, and the points on each triangular face are those of a tetrahedron face, so the lattice can be used on a mixed mesh. The construction was disabled in #271 after intermittent test failures. The warp function that it interpolates vanishes at the ends of the interval only up to rounding, and the pyramid blending factors all degenerate to one at the apex, so the residuals accumulate there and move the apex off the cell by a few epsilon. The polyset on a pyramid is expressed in the collapsed coordinates x / (1 - z) and y / (1 - z), so such a point tabulates to nonsense. The warp is now shifted to vanish exactly at the endpoints, and the barycentric coordinates are formed from the lattice indices so that the degenerate cases are detected exactly rather than through a tolerance. The warp function is evaluated once for the whole lattice rather than once per point, and the repeated blending factor is a helper function. Points matching Isaac's points on a triangle are still not implemented on a pyramid, and now throw a more specific error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Oct 17, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
gll_warpedlattice on a pyramid, so thatgll_warpedLagrange elements can be created on pyramids. This addresses the first
half of #268; Isaac's points on a pyramid are still not implemented.
The construction is the warp and blend one that was removed in #271
after intermittent CI failures. It is conforming: the points on the
quadrilateral base are those of a hexahedron face, and the points on
each of the four triangular faces are those of a tetrahedron face, both
to machine precision for degrees up to 16. The interior lattice is
exactly the interior subset of the full lattice.
The failure in #269
The warp function is built by interpolation, so it vanishes at the ends
of the interval only up to rounding. On a triangle or a tetrahedron a
blending factor damps that residual at every vertex, but on a pyramid
the blending factors all degenerate to one at the apex, so the four
residuals accumulate and the apex comes out as, for example,
(-2.2e-16, -2.2e-16, 1.0)with1 - zequal to-4.4e-16, i.e.outside the cell.
The polyset on a pyramid is expressed in the collapsed coordinates
x / (1 - z)andy / (1 - z), guarded by an exact comparison ofzagainst one. Tabulating at that perturbed apex instead of the exact one
changes values by O(10^3) at degree 6, and which side of the guard a
point lands on depends on the compiler, its flags and FMA contraction —
which fits a failure that appeared on some CI runs and not others.
Two changes make the lattice exact:
residuals, so that it vanishes at the endpoints exactly;
rather than as
1 - x - z, so a coordinate that should vanish isexactly zero and the degenerate branches are selected exactly. This
replaces a
fabs(l) < 1e-12test, which was belowfloatepsilonand so was unreliable in the
floatinstantiation.All five vertices are then bit-exact and every coordinate is in the
cell, for degrees 1 to 16 in both
floatanddouble. The remaining2e-16 overshoot on the sloping faces is the same as, and smaller than,
that of the existing triangle and tetrahedron warped lattices, and the
pyramid polyset is singular only at the apex.
The warp function is also now evaluated once for the whole lattice
rather than once per lattice point, and the blending factor, which
appears six times, is a helper function.
Why it is worth having
Estimated Lebesgue constants for the pyramid Lagrange element:
The condition number of the orthonormal polyset Vandermonde at the
lattice points falls from 7.7e4 to 8.4e2 at degree 10.
Tests
The cases disabled in #271 are re-enabled:
test_lattice.py::test_pyramidfor(gll, warp), which checks thatthe surface points agree with those on a triangle and a quadrilateral;
test_continuity.py, in both the triangular facet andthe quadrilateral facet tests, which check continuity against
tetrahedra and hexahedra — the property the issue asks for;
gll_warpedlist inutils.py, which pulls itinto the dof transformation, interpolation and tabulation tests.
That is 63 more tests. The full Python suite and the C++ unit tests
pass.
🤖 Generated with Claude Code