Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a quadrature rule for higher degree polynomials #72

Closed

Conversation

btalamini
Copy link
Collaborator

  • Add a 25 point rule for the triangle that exactly integrates polynomials up to degree 10.
  • Improve error messaging. Before, if the user asked for a quadrature rule of higher precision than we have implemented, they would see UnboundLocalError: local variable 'xi' referenced before assignment. Now they get ValueError: Quadrature of precision this high is not implemented.
  • Improved the test fixture for the quadrature rules: one of the tests loops over degrees of precision, ensuring that the quadrature rule returned can actually exactly integrate polynomials of that degree. Before, if any case failed, the test reported a single failure and nothing else, leaving you to guess which quadrature rule(s) were broken. Now the subTest facility of unittest (or pytest) is used so that you see which precision checks failed.

Before: the primal output was computed in-line in the custom jvp
function. The advantage is that this avoids a second call to the
eigendecomposition. The downside is that this in-line computation
doesn't itself have a custom jvp, so its derivative can be wrong.

After: I re-compute the primal value through the base function
(e.g., log_symm), which has the custom jvp defined on it. The
eigendecomposition is repeated. We can refactor to eliminate this
later if profiling reveals it to be a performance bottleneck.
Put a leading underscore on functions menat for internal use.
Most Python tools will ignore these when reporting contents of
a module.
Replace all calls except in the new viscoelastic model. Changes are
about to merge there and I want to handle the conflicts separately.
Also: now a ValueError is emitted if a user asks for a quadrature
rule precision that is above what we have implemented. Before
the error was a bit obscure.

Improved the unit testing of the quadrature rules by making
subtests for every polynomial degree check. This way, if the test
fails, you can figure out which quadrature rules are broken.
@btalamini btalamini requested a review from tupek2 December 3, 2023 15:12
@btalamini btalamini closed this Dec 3, 2023
@btalamini btalamini deleted the feature/quadrature_precision_10_rule branch December 3, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant