Skip to content

Conversation

@roystgnr
Copy link
Member

In idaholab/moose#31758 I took the position that we should avoid making it harder to fix the issue where we report problematic element mappings as LogicError exceptions even though they're not logic errors; after a little thought, this isn't a hard issue and I could probably spend more time arguing about hypothetically fixing it than it would take to actually fix it.

In the near term, I think a good migration path here is for user code to catch (std::exception & e) but then check whether e.what() matches "Jacobian" to determine whether it's caught a mapping issue rather than a real internal error or assertion failure.

When an application can catch this, they should get to choose whether they can handle it silently or need to bug the user with the details.
This saves us a few lines of preprocessor macros and should produce the same binary output in both configurations I ran across these while grepping for places where changing exception types might get us into any trouble.
We should really also be classifying inverse_map failures as std::runtime_error rather than std::logic_error, but it's possible for Newton to fail (at least in theory; I haven't seen it in practice myself) on a non-singular and non-inverted mapping.
So let's throw DegenerateMapping instead, and again we'll stuff data into the exception where code can catch it in the best case and it'll still get to stderr eventually in the worst case.
@moosebuild
Copy link

moosebuild commented Oct 22, 2025

Job Coverage, step Generate coverage on 1f8de15 wanted to post the following:

Coverage

af134b #4286 1f8de1
Total Total +/- New
Rate 65.00% 65.02% +0.01% 31.03%
Hits 76964 76966 +2 9
Misses 41434 41410 -24 20

Diff coverage report

Full coverage report

Warnings

  • New new line coverage rate 31.03% is less than the suggested 90.0%

This comment will be updated on new commits.

@roystgnr
Copy link
Member Author

Good MOOSE framework: "A zero mapping Jacobian isn't necessarily an error; it's an exception that we can often catch and recover from."

Evil MOOSE test suite: "If a zero mapping Jacobian doesn't output the exact phrase ERROR: negative Jacobian 0 then you don't pass."

roystgnr added a commit to roystgnr/moose that referenced this pull request Nov 6, 2025
An error message calling 0 a negative number should have been noticed as a bug to fix, not a feature to insist upon! Refs #0 - see libMesh/libmesh#4286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants