Repository navigation
Improve quadrature rules - #19
Merged
Merged
Conversation
davschneller
commented
Oct 14, 2026
Contributor
- add better symmetric quadrature rules (JS, some Claude-optimized JS ones a.k.a "reduced symmetric")
- fix output for triangle quadrature (always use 2N)
- add output for the new symmetric quadrature rule for plasticity
Add quad_rules.TabulatedTet, which reads a family of tetrahedral rules from text files (barycentric coordinates and weights summing to 1, one point per line) and returns them on the biunit reference tetrahedron, together with helpers to compute barycentric coordinates and to check full vertex-permutation symmetry. The values are converted in decimal arithmetic and rounded to double once. Serve WitherdenVincentTet from such files, converted exactly from the PyFR data (license included). The degree-10 rule in the pickle had lost most minus signs: all 81 points lay outside the tetrahedron and the rule was not exact. Degrees 1 to 9 read bit-identically to the pickle. Also correct the reference elements stated in quad_rules/README.md and in Quadrature.transform, and test exactness, positivity, interior points and symmetry of the tabulated rules. AI-generated. Model: Claude Opus 5.5
Add the fully symmetric, positive tetrahedral rules that F. D. Witherden added to PyFR in 2023 (degrees 10 to 20), converted exactly into the barycentric text format, as quad_rules.WitherdenTet. The degree-14 rule of that set has negative weights (down to -2.8 for weights summing to 1) and is left out. The README lists the rules with points on or close to the boundary (degrees 10, 11, 12, 19 and 20). AI-generated. Model: Claude Opus 5.5
Add the tetrahedral rules of Xiao and Gimbutas (2010) for degrees 1 to 15 as quad_rules.XiaoGimbutasTet, taken unchanged from quadraturerules.org (CC BY 4.0). They have positive weights and interior points; up to degree 10 they need as few points as the existing JaskowiecSukumar rules, above that slightly more. Apart from degrees 1 and 5 they are not invariant under permutations of the vertices. AI-generated. Model: Claude Opus 5.5
Add the fully symmetric tetrahedral rules of Jaskowiec and Sukumar (2021) for degrees 1 to 20 as quad_rules.JaskowiecSukumarSymmetric, converted exactly from the data in modepy (CC BY 4.0). All weights are positive and all points inside. The existing quad_rules.JaskowiecSukumar holds the earlier, non-symmetric rules of the same authors (2020). AI-generated. Model: Claude Opus 5.5
Add two fully symmetric tetrahedral rules with positive weights and all barycentric coordinates above 1e-3 that need fewer points than the other rules of this kind here: 128 points for degree 12 (symmetric Jaskowiec-Sukumar: 168, whose smallest barycentric coordinate is 5.8e-4) and 188 points for degree 14 (204). These are the degrees the products of two basis functions of order 7 and 8 need. They come from tools/reduce_symmetric_tet_rule.py, added here as well: starting from a symmetric rule, it removes orbits of points or replaces them by orbits with fewer points, solves the moment equations for the remaining weights and positions with Levenberg-Marquardt, and refines the result to 40 digits. The committed files are its output for the Jaskowiec-Sukumar rules of degree 13 and 14. AI-generated. Model: Claude Opus 5.5
Add quad_rules.SymmetricTet: for each degree up to 20, the tabulated rule with the fewest points that is invariant under all permutations of the vertices, has positive weights and keeps all barycentric coordinates above 1e-3. For the degrees 2N that the plasticity points of order N + 1 need, these are 1, 4, 14, 24, 46, 81, 128 and 188 points for the orders 1 to 8. The choice is a fixed table, and a test checks that it is the cheapest admissible rule of all families for every degree. The rules are returned ordered by orbits (kind, then parameters, then the permutations of each orbit in lexicographic order), so that SeisSol can reproduce the points in the same order from a table of orbits. AI-generated. Model: Claude Opus 5.5
Add quad_rules.TabulatedTri, the triangular counterpart of TabulatedTet: a family of rules is read from text files (barycentric coordinates and weights summing to 1, one point per line), converted in decimal arithmetic and returned on the biunit reference triangle. Serve WitherdenVincentTri from such files, converted from the PyFR data (license included), in place of the pickle. The rules read bit-identically to the pickle, except for the three edge midpoints of the rule of degree 16, whose coordinate PyFR gives as -5.4e-109 and which now read as 0; the face matrices of the DG generator come out bit-identical for all orders. Add the Xiao-Gimbutas rules for the triangle, degrees 1 to 30, from quadraturerules.org (CC BY 4.0). They are fully symmetric as well, and for degrees 16 and 18 they keep their points further inside than the Witherden-Vincent rules, which have points on the edges at degree 16 and a smallest barycentric coordinate of 5.5e-4 at degree 18. Test exactness, positivity, interior points and symmetry of both families. AI-generated. Model: Claude Opus 5.5
Add quad_rules.SymmetricTri, the triangular counterpart of SymmetricTet: for each degree, the tabulated rule with the fewest points that is invariant under all permutations of the vertices, has positive weights and keeps all barycentric coordinates above 1e-3; of rules with equally many points, the one that keeps its points furthest inside. That is Witherden-Vincent except at degrees 7, 13, 16 and 18, where it is Xiao-Gimbutas. The points come in the order of the orbits of the vertex permutations. Since every vertex permutation maps such a rule onto itself, the two cells sharing a face see the same points of it, only numbered differently; a test checks that for the face reflections and rotations. The point counts for degrees 2, 4, ..., 14 are 3, 6, 12, 16, 25, 33 and 42, the fewest a fully symmetric rule with positive weights and interior points can have there (Papanicolopulos 2015, cited in the README). A search over all orbit structures with fewer points, run for these degrees, found no such rule either. AI-generated. Model: Claude Opus 5.5
The Dunavant and Witherden-Vincent rules for the dynamic rupture matrices were taken exact up to degree order + 1, so that a basis of degree N = order - 1 met a rule of degree N + 2 -- below the 2N its face mass matrix needs from order 4 on. SeisSol's files for orders 2 to 7 come from an earlier version that used degree 2 * order; the files for order 8, generated since, hold the 19-point rule of degree 9. Take the degree 2 * order again, for the generator modes dr and hom and for the script in dr_matrices, through one helper, quad_points.dr_rules. Stroud's rule keeps its order + 1 points per direction (exact up to 2 * order + 1). Pick, among the rules of a family exact up to at least that degree, the one with the fewest points that has positive weights and all points inside the triangle. The Dunavant rules of degrees 3, 7 and 18 have negative weights and those of degrees 11, 15, 16 and 18 points outside; the Witherden-Vincent rule of degree 16 has points on the edges. A fault would be sampled beyond or on its boundary there. For orders 2 to 7 this selects the rules in SeisSol's files (the same points and weights, listed in another order, which a test checks against the files); for order 8 it selects the Dunavant rule of degree 17 (61 points) and the Witherden-Vincent rule of degree 17 (60 points). Write the weights as a vector, which is how SeisSol reads them since it converted its files (except the Dunavant one of order 8, whose weights are still a column). Also add quad_points.symmetric, a rule of SymmetricTri on the unit triangle. AI-generated. Model: Claude Opus 5.5
Add seissol_matrices.face_quadrature, which writes face-sq-matrices-<order>.json for orders 2 to 8: the points and weights of the symmetric triangular rule of degree 2 * (order - 1) on the reference triangle (faceQuadPoints, faceQuadWeights, the weights summing to 1/2), the face basis at the points (V2mToFaceQuad), the integrals of the face basis against values at the points (VFaceQuadTo2m), and the volume basis at the points of each face through its traces (V3mToFaceQuad(face)). They are the counterparts of nodes2D, V2mTo2n, V2nTo2m and V3mTo2nFace for a flux that is integrated with the rule instead of interpolated through the nodes: VFaceQuadTo2m gives the same moments as V2nTo2m for a polynomial on the face, and the moments of a product of material and field that the nodes cannot hold. The rules have 3, 6, 12, 16, 25, 33 and 42 points for orders 2 to 8, against 3, 6, 10, 15, 21, 28 and 36 nodes. Every permutation of the vertices of a face maps the points onto themselves, so the two cells sharing a face see the same points. The tests check the face mass matrix, the volume basis on each face against SeisSol's face parametrisation, the moments against the nodal ones, and the vertex permutations. AI-generated. Model: Claude Opus 5.5
(mode sq)
Add the plasticity mode "sq": the points are those of the cheapest
fully symmetric rule with positive weights and interior points that is
exact for the product of two basis functions (quad_rules.SymmetricTet,
degree 2 * (order - 1)), and vInv is the L2 projection with that rule,
as for "ip". For the orders 2 to 8 this takes 4, 14, 24, 46, 81, 128
and 188 points, against (order + 1)^3 for "ip" and one per basis
function for "nb".
The generator writes plasticity-sq-matrices-{order}.json alongside the
other modes.
AI-generated. Model: Claude Opus 5.5
Add a fully symmetric rule of degree 10 with 79 points, positive weights and all barycentric coordinates above 1e-2 (Witherden-Vincent: 81 points, smallest barycentric coordinate 6.1e-3), and select it for the degrees 9 and 10 in quad_rules.SymmetricTet. The plasticity points of mode sq for order 6 are its points. It comes from tools/search_symmetric_tet_rule.py, added here: for given numbers of orbits of each kind, it solves the moment equations from many random starts at once, keeping the weights positive and the points inside. The orbits S1x1 S4x3 S6x1 S12x5 have one unknown more than the 23 equations of degree 10, so the solutions form a one-parameter family; the tool follows it to the member whose smallest barycentric coordinate is largest (1.06e-2) and refines that to 40 digits. Rules of degree 10 with 79 points have been published before (Chuluunbaatar et al. 2022; Worku, Hicken and Zingg 2024, a member of the same family whose smallest barycentric coordinate is 3.6e-3). A search over the other orbit structures of 70 to 79 points that can satisfy the equations, 6000 starts each, found no rule. Of the family, neither of the two orbits with the smallest weights can be removed: following the family towards a zero weight, points leave the tetrahedron first. AI-generated. Model: Claude Opus 5.5
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.