Skip to content

Conversation

@arng40
Copy link
Contributor

@arng40 arng40 commented Nov 27, 2025

Update this error message

***** ERROR
***** LOCATION: path/to/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp:939
***** Error cause: wrongSum > 0 l.925
***** Rank 6: compositionalMultiphaseFlow: component fractions do not sum to 1.0 in subregion 'cellBlock' for 342000 elements

@arng40 arng40 self-assigned this Nov 27, 2025
@arng40 arng40 added type: cleanup / refactor Non-functional change (NFC) flag: ready for review flag: no rebaseline Does not require rebaseline labels Nov 27, 2025
@MelReyCG MelReyCG changed the title refactor: Update initializeFluidState error message refactor: Update wrong fluid fraction error message Nov 27, 2025
Copy link
Contributor

@MelReyCG MelReyCG left a 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.

Comment on lines 920 to +923
if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 )
localWrongSum += 1;
localSupFrac += 1;
if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 )
localInfFrac += 1;
Copy link
Contributor

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:

Suggested change
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 ?

Copy link
Collaborator

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

Comment on lines +939 to +942
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());
Copy link
Contributor

Choose a reason for hiding this comment

The 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());
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());

Comment on lines +905 to +906
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooLowFracCount( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooHighFracCount( 0 );

Comment on lines +937 to +938
localIndex const infFrac = MpiWrapper::min( localMinFrac.get() );
localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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() );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flag: no rebaseline Does not require rebaseline flag: ready for review type: cleanup / refactor Non-functional change (NFC)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants