-
Notifications
You must be signed in to change notification settings - Fork 97
refactor: Update wrong fluid fraction error message #3917
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
base: develop
Are you sure you want to change the base?
Conversation
MelReyCG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposing some naming & information displaying improvements.
| if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 ) | ||
| localWrongSum += 1; | ||
| localSupFrac += 1; | ||
| if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 ) | ||
| localInfFrac += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must adapt the computation here:
| if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 ) | |
| localWrongSum += 1; | |
| localSupFrac += 1; | |
| if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 ) | |
| localInfFrac += 1; | |
| if( sumCompFrac > 1.0 + 1e-6 ) | |
| localSupFrac += 1; | |
| if( sumCompFrac < 1.0 - 1e-6 ) | |
| localInfFrac += 1; |
- use a configurable tolerance? What do you think @paveltomin ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed tolerance is probably ok
| GEOS_ERROR_IF( totalWrongCompFrac > 0, | ||
| GEOS_FMT( "Component fractions go from {} to {} ( over {} elements ) in subregion '{}', but should always sum to 1.0", | ||
| infFrac, supFrac, totalWrongCompFrac, subRegion.getName() ), | ||
| getDataContext()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| GEOS_ERROR_IF( totalWrongCompFrac > 0, | |
| GEOS_FMT( "Component fractions go from {} to {} ( over {} elements ) in subregion '{}', but should always sum to 1.0", | |
| infFrac, supFrac, totalWrongCompFrac, subRegion.getName() ), | |
| getDataContext()); | |
| GEOS_ERROR_IF( totalWrongCompFrac > 0, | |
| GEOS_FMT( "{} component fractions do not sum to 1.0 in subregion '{}'!\n" | |
| "{} are too low ; {} are too high ; component fractions sum range is from {} to {}.\n" | |
| "Consider adding field specification to initialize the '{}' field.", | |
| totalWrongCompFrac, subRegion.getName(), | |
| tooLowFracCount, tooHighFracCount, minFrac, maxFrac, | |
| /* globalCompFrac viewkey here */ ), | |
| getDataContext()); |
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 ); | ||
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 ); | |
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 ); | |
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooLowFracCount( 0 ); | |
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooHighFracCount( 0 ); |
| localIndex const infFrac = MpiWrapper::min( localMinFrac.get() ); | ||
| localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| localIndex const infFrac = MpiWrapper::min( localMinFrac.get() ); | |
| localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() ); | |
| localIndex const minFrac = MpiWrapper::min( localMinFrac.get() ); | |
| localIndex const maxFrac = MpiWrapper::sum( localMaxFrac.get() ); |
Update this error message