A user would like a kratos run to exit gracefully, even when there is an error (e.g. due to an inverted element), i.e. there should not be a hard crash.
Acceptance Criteria
Given A user has defined a problem which results in inverted elements
When the user runs the simulation
Then the simulation exits by reporting the error.
Background
This issue was reported by the Embankment team, who use the GeoMechanicsApplication and notice that for simulations with inverted elements, the simulation sometimes results in a hard crash instead of a graceful exit with an error message.
The following small problem can be used to reproduce the issue:
InvertedElements.zip
In a first investigation, it was found that changing the 'raw' pragma omp loops in the residual block builder and solver into block_for_each loops seems to solve this issue, see the following branch, but we get an issue when running our nightly tests (a STATUS_HEAP_CORRUPTION):

A user would like a kratos run to exit gracefully, even when there is an error (e.g. due to an inverted element), i.e. there should not be a hard crash.
Acceptance Criteria
Given A user has defined a problem which results in inverted elements
When the user runs the simulation
Then the simulation exits by reporting the error.
Background
This issue was reported by the Embankment team, who use the GeoMechanicsApplication and notice that for simulations with inverted elements, the simulation sometimes results in a hard crash instead of a graceful exit with an error message.
The following small problem can be used to reproduce the issue:
InvertedElements.zip
In a first investigation, it was found that changing the 'raw' pragma omp loops in the residual block builder and solver into block_for_each loops seems to solve this issue, see the following branch, but we get an issue when running our nightly tests (a STATUS_HEAP_CORRUPTION):