-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -902,7 +902,10 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localNegativeValues( 0 ); | ||||||||||||||||||||||||||
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localWrongSum( 0 ); | ||||||||||||||||||||||||||
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 ); | ||||||||||||||||||||||||||
| RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 ); | ||||||||||||||||||||||||||
| RAJA::ReduceMin< parallelDeviceReduce, localIndex > localMinFrac( LvArray::NumericLimits< localIndex >::max ); | ||||||||||||||||||||||||||
| RAJA::ReduceMax< parallelDeviceReduce, localIndex > localMaxFrac( LvArray::NumericLimits< localIndex >::min ); | ||||||||||||||||||||||||||
| forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| real64 sumCompFrac = 0.0; | ||||||||||||||||||||||||||
|
|
@@ -912,19 +915,31 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, | |||||||||||||||||||||||||
| if( compFrac[ei][ic] < 0.0 ) | ||||||||||||||||||||||||||
| localNegativeValues += 1; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| localMinFrac.min( sumCompFrac ); | ||||||||||||||||||||||||||
| localMaxFrac.max( sumCompFrac ); | ||||||||||||||||||||||||||
| if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 ) | ||||||||||||||||||||||||||
| localWrongSum += 1; | ||||||||||||||||||||||||||
| localSupFrac += 1; | ||||||||||||||||||||||||||
| if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 ) | ||||||||||||||||||||||||||
| localInfFrac += 1; | ||||||||||||||||||||||||||
|
Comment on lines
920
to
+923
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You must adapt the computation here:
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed tolerance is probably ok |
||||||||||||||||||||||||||
| } ); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| localMinFrac = MpiWrapper::min( localMinFrac.get() ); | ||||||||||||||||||||||||||
| localMaxFrac = MpiWrapper::max( localMaxFrac.get() ); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| localIndex const negativeValues = MpiWrapper::sum( localNegativeValues.get() ); | ||||||||||||||||||||||||||
| GEOS_ERROR_IF( negativeValues > 0, | ||||||||||||||||||||||||||
| GEOS_FMT( "{}: negative global component fraction values found in subregion '{}' for {} elements", | ||||||||||||||||||||||||||
| getName(), subRegion.getName(), negativeValues ) ); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| localIndex const wrongSum = MpiWrapper::sum( localWrongSum.get() ); | ||||||||||||||||||||||||||
| GEOS_ERROR_IF( wrongSum > 0, | ||||||||||||||||||||||||||
| GEOS_FMT( "{}: component fractions do not sum to 1.0 in subregion '{}' for {} elements", | ||||||||||||||||||||||||||
| getName(), subRegion.getName(), wrongSum ) ); | ||||||||||||||||||||||||||
| localIndex const totalSupFrac = MpiWrapper::sum( localSupFrac.get() ); | ||||||||||||||||||||||||||
| localIndex const totalInfFrac = MpiWrapper::sum( localInfFrac.get() ); | ||||||||||||||||||||||||||
| localIndex const totalWrongCompFrac = totalSupFrac + totalInfFrac; | ||||||||||||||||||||||||||
| localIndex const infFrac = MpiWrapper::min( localMinFrac.get() ); | ||||||||||||||||||||||||||
| localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() ); | ||||||||||||||||||||||||||
|
Comment on lines
+937
to
+938
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
| 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()); | ||||||||||||||||||||||||||
|
Comment on lines
+939
to
+942
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Assume global component fractions have been prescribed. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.