Reduce the estimated degree only on simplex cells - #506
Merged
jorgensd merged 2 commits intoAug 24, 2026
Merged
Conversation
A derivative lowers the polynomial degree in one direction only. On a cell that is not a simplex the degree is a degree for each direction, so that degree stays the same. The docstring of _reduce_degree already says that it does not lower the degree for tensor product or quadrilateral elements. The test only compared the cell name against quadrilateral and hexahedron, so it missed tensor product, prism and pyramid cells. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jorgensd
approved these changes
Aug 24, 2026
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.
The problem
_reduce_degree()lowers the degree by one for each derivative. Its docstringsays that it does not do this when tensor product elements or quadrilateral
elements are involved. The code does not agree with the docstring. It tests the
name of the cell against
quadrilateralandhexahedrononly. A tensor productcell has the name
quadrilateral * interval, which is not in that list. UFLtherefore lowers the degree on a tensor product cell.
A derivative lowers the degree in one direction only. On a cell that is not a
simplex, the degree is a degree for each direction. The degree for each
direction therefore stays the same. To lower it gives a rule that is too coarse.
Prism cells and pyramid cells have the same problem.
The change
_reduce_degree()now lowers the degree only on a simplex cell. This is thebehaviour that the docstring describes.
Rules on prism cells and on pyramid cells become finer. Rules on simplex cells,
on quadrilateral cells and on hexahedron cells do not change.
Effect
Firedrake gives an element on a tensor product cell a degree for each direction.
The numbers below also need a change in FIAT, which makes
TensorProductElement.embedded_superdegreegive the degree for each direction.This pull request on its own does not change them.
Before that pair of changes, a Q7 space on a
quadrilateral * intervalcell got aquadrature rule of degree 29, which has 3375 points. After this change, the same
space gets a rule of degree 17, which has 729 points. The rule with 729 points
integrates the form to machine precision.
inner(grad(u), grad(v))*dxinner(curl(u), curl(v))*dxEach matrix agrees with a rule of degree 32 to machine precision.
Tests
test_tensor_product_degree_estimationputs a Lagrange element of degree 7 on aquadrilateral * intervalcell. It shows that a derivative does not lower thedegree. The test fails before this change, with a degree of 6 in place of 7.
AI declaration: written with Claude Code (Claude Opus 5).