diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index 290fbed04ab..4660f31e776 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -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 > localTooHighFracCount( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooLowFracCount( 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,8 +915,12 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, if( compFrac[ei][ic] < 0.0 ) localNegativeValues += 1; } - if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 ) - localWrongSum += 1; + localMinFrac.min( sumCompFrac ); + localMaxFrac.max( sumCompFrac ); + if( sumCompFrac > 1 + 1e-6 ) + localTooHighFracCount += 1; + if( sumCompFrac < 1 - 1e-6 ) + localTooLowFracCount += 1; } ); localIndex const negativeValues = MpiWrapper::sum( localNegativeValues.get() ); @@ -921,10 +928,19 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, 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( localTooHighFracCount.get() ); + localIndex const totalInfFrac = MpiWrapper::sum( localTooLowFracCount.get() ); + localIndex const totalWrongCompFrac = totalSupFrac + totalInfFrac; + localIndex const minFrac = MpiWrapper::min( localMinFrac.get() ); + localIndex const maxFrac = MpiWrapper::sum( localMaxFrac.get() ); + 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(), + localTooLowFracCount.get(), localTooHighFracCount.get(), minFrac, maxFrac, + fields::flow::globalCompFraction::key() ), + getDataContext()); } // Assume global component fractions have been prescribed. diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index 0d6554b6eef..524c0e52517 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -463,6 +463,10 @@ + + + + @@ -491,6 +495,10 @@ + + + + @@ -569,6 +577,10 @@ + + + + @@ -581,6 +593,10 @@ + + + + @@ -2740,6 +2756,7 @@ Information output from lower logLevels is added with the desired log level + @@ -2747,6 +2764,7 @@ Information output from lower logLevels is added with the desired log level + @@ -5028,6 +5046,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5368,6 +5440,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5912,9 +6038,11 @@ When set to `all` output both convergence & iteration information to a csv.--> + + @@ -6108,6 +6236,19 @@ Information output from lower logLevels is added with the desired log level + + + + + + + + + + + + + + + + + + + + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index bea55da9276..35676a136fc 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -526,7 +526,7 @@ A field can represent a physical variable. (pressure, temperature, global compos - + @@ -595,6 +595,7 @@ A field can represent a physical variable. (pressure, temperature, global compos + @@ -602,6 +603,7 @@ A field can represent a physical variable. (pressure, temperature, global compos + @@ -1209,6 +1211,17 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + @@ -1284,6 +1297,17 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + @@ -1452,9 +1476,11 @@ A field can represent a physical variable. (pressure, temperature, global compos + + @@ -1484,9 +1510,11 @@ A field can represent a physical variable. (pressure, temperature, global compos + + @@ -1526,7 +1554,7 @@ A field can represent a physical variable. (pressure, temperature, global compos - + @@ -3559,6 +3587,12 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + @@ -3573,14 +3607,26 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + +