diff --git a/src/coreComponents/constitutive/ConstitutivePassThru.hpp b/src/coreComponents/constitutive/ConstitutivePassThru.hpp index 1c63ae20f7f..75075f8aae7 100644 --- a/src/coreComponents/constitutive/ConstitutivePassThru.hpp +++ b/src/coreComponents/constitutive/ConstitutivePassThru.hpp @@ -262,8 +262,8 @@ struct ConstitutivePassThru< NullModel > else { GEOS_ERROR( "ConstitutivePassThru< NullModel >::execute failed on constitutive relation " - << constitutiveRelation.getDataContext() << " with type " - << LvArray::system::demangleType( constitutiveRelation ) ); + << LvArray::system::demangleType( constitutiveRelation ), + constitutiveRelation.getDataContext() ); } } }; @@ -285,8 +285,8 @@ struct ConstitutivePassThru< PorousSolid< ElasticIsotropic, ConstantPermeability else { GEOS_ERROR( "ConstitutivePassThru< PorousSolid< ElasticIsotropic, ConstantPermeability > >::execute failed on constitutive relation " - << constitutiveRelation.getDataContext() << " with type " - << LvArray::system::demangleType( constitutiveRelation ) ); + << LvArray::system::demangleType( constitutiveRelation ), + constitutiveRelation.getDataContext() ); } } }; @@ -441,8 +441,8 @@ struct ConstitutivePassThru< ProppantSolid< ProppantPorosity, ProppantPermeabili else { GEOS_ERROR( "ConstitutivePassThru< ProppantSolid >::execute failed on constitutive relation " - << constitutiveRelation.getDataContext() << " with type " - << LvArray::system::demangleType( constitutiveRelation ) ); + << LvArray::system::demangleType( constitutiveRelation ), + constitutiveRelation.getDataContext() ); } } }; diff --git a/src/coreComponents/constitutive/ConstitutivePassThruHandler.hpp b/src/coreComponents/constitutive/ConstitutivePassThruHandler.hpp index 1597cc65cc4..80d888cdc51 100644 --- a/src/coreComponents/constitutive/ConstitutivePassThruHandler.hpp +++ b/src/coreComponents/constitutive/ConstitutivePassThruHandler.hpp @@ -46,8 +46,9 @@ struct ConstitutivePassThruHandler<> static void execute( BASE & relation, LAMBDA lambda ) { GEOS_UNUSED_VAR( relation, lambda ); - GEOS_ERROR( "The constitutive model " << relation.getDataContext() << " was not dispatched. " << - "The model type does not match the list of supported types." ); + GEOS_ERROR( "The constitutive model was not dispatched. " + "The model type does not match the list of supported types.", + relation.getDataContext() ); } }; diff --git a/src/coreComponents/constitutive/capillaryPressure/BrooksCoreyCapillaryPressure.cpp b/src/coreComponents/constitutive/capillaryPressure/BrooksCoreyCapillaryPressure.cpp index f068365eb35..279b8badd01 100644 --- a/src/coreComponents/constitutive/capillaryPressure/BrooksCoreyCapillaryPressure.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/BrooksCoreyCapillaryPressure.cpp @@ -59,8 +59,8 @@ void BrooksCoreyCapillaryPressure::postInputInitialization() auto const checkInputSize = [&]( auto const & array, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( LvArray::integerConversion< size_t >( array.size()), m_phaseNames.size(), - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, viewKeyStruct::phaseMinVolumeFractionString() ); checkInputSize( m_phaseCapPressureExponentInv, viewKeyStruct::phaseCapPressureExponentInvString() ); @@ -71,37 +71,37 @@ void BrooksCoreyCapillaryPressure::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; if( m_phaseTypes[ip] != CapillaryPressureBase::REFERENCE_PHASE ) { GEOS_THROW_IF_LE_MSG( m_phaseCapPressureExponentInv[ip], 0.0, errorMsg( viewKeyStruct::phaseCapPressureExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_phaseEntryPressure[ip], 0.0, errorMsg( viewKeyStruct::phaseEntryPressureString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_capPressureEpsilon, 0.0, errorMsg( viewKeyStruct::capPressureEpsilonString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_capPressureEpsilon, 0.2, errorMsg( viewKeyStruct::capPressureEpsilonString() ), - InputError ); + InputError, getDataContext() ); } } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); } BrooksCoreyCapillaryPressure::KernelWrapper diff --git a/src/coreComponents/constitutive/capillaryPressure/CapillaryPressureBase.cpp b/src/coreComponents/constitutive/capillaryPressure/CapillaryPressureBase.cpp index 9f1db0231ed..beb2c0ce246 100644 --- a/src/coreComponents/constitutive/capillaryPressure/CapillaryPressureBase.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/CapillaryPressureBase.cpp @@ -60,11 +60,11 @@ void CapillaryPressureBase::postInputInitialization() integer const numPhases = numFluidPhases(); GEOS_THROW_IF_LT_MSG( numPhases, 2, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numPhases, MAX_NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); m_phaseTypes.resize( numPhases ); m_phaseOrder.resizeDefault( MAX_NUM_PHASES, -1 ); diff --git a/src/coreComponents/constitutive/capillaryPressure/JFunctionCapillaryPressure.cpp b/src/coreComponents/constitutive/capillaryPressure/JFunctionCapillaryPressure.cpp index e4eb76d02ba..d0eaa9ce36b 100644 --- a/src/coreComponents/constitutive/capillaryPressure/JFunctionCapillaryPressure.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/JFunctionCapillaryPressure.cpp @@ -127,8 +127,7 @@ void JFunctionCapillaryPressure::postInputInitialization() integer const numPhases = m_phaseNames.size(); GEOS_THROW_IF( numPhases != 2 && numPhases != 3, - GEOS_FMT( "{}: the expected number of fluid phases is either two, or three", - getFullName() ), + "the expected number of fluid phases is either two, or three", InputError, getDataContext() ); // Populate the minimum phase volume fractions @@ -137,31 +136,27 @@ void JFunctionCapillaryPressure::postInputInitialization() if( numPhases == 2 ) { GEOS_THROW_IF( m_wettingNonWettingJFuncTableName.empty(), - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify the J-function table for the pair (wetting phase, non-wetting phase)", - getFullName(), + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify the J-function table for the pair (wetting phase, non-wetting phase)", viewKeyStruct::wettingNonWettingJFuncTableNameString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_wettingNonWettingSurfaceTension <= 0, - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify the surface tension for the pair (wetting phase, non-wetting phase)", - getFullName(), + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify the surface tension for the pair (wetting phase, non-wetting phase)", viewKeyStruct::wettingNonWettingSurfaceTensionString() ), InputError, getDataContext() ); } else if( numPhases == 3 ) { GEOS_THROW_IF( m_wettingIntermediateJFuncTableName.empty() || m_nonWettingIntermediateJFuncTableName.empty(), - GEOS_FMT( "{}: for a three-phase flow simulation, we must use {} to specify the J-function table" + GEOS_FMT( "for a three-phase flow simulation, we must use {} to specify the J-function table" "for the pair (wetting phase, intermediate phase), " "and {} to specify the J-function table for the pair (non-wetting phase, intermediate phase)", - getFullName(), viewKeyStruct::wettingIntermediateJFuncTableNameString(), viewKeyStruct::nonWettingIntermediateJFuncTableNameString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_wettingIntermediateSurfaceTension <= 0 || m_nonWettingIntermediateSurfaceTension <= 0, - GEOS_FMT( "{}: for a three-phase flow simulation, we must use {} to specify the surface tension" + GEOS_FMT( "for a three-phase flow simulation, we must use {} to specify the surface tension" "for the pair (wetting phase, intermediate phase), " "and {} to specify the J-function table for the pair (non-wetting phase, intermediate phase)", - getFullName(), viewKeyStruct::wettingIntermediateSurfaceTensionString(), viewKeyStruct::nonWettingIntermediateSurfaceTensionString() ), InputError, getDataContext() ); @@ -178,8 +173,7 @@ void JFunctionCapillaryPressure::initializePreSubGroups() if( numPhases == 2 ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingNonWettingJFuncTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingNonWettingJFuncTableName ), InputError, getDataContext() ); TableFunction const & jFuncTable = functionManager.getGroup< TableFunction >( m_wettingNonWettingJFuncTableName ); @@ -191,16 +185,14 @@ void JFunctionCapillaryPressure::initializePreSubGroups() else if( numPhases == 3 ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingIntermediateJFuncTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingIntermediateJFuncTableName ), InputError, getDataContext() ); TableFunction const & jFuncTableWI = functionManager.getGroup< TableFunction >( m_wettingIntermediateJFuncTableName ); TableCapillaryPressureHelpers::validateCapillaryPressureTable( jFuncTableWI, getFullName(), false ); GEOS_THROW_IF( !functionManager.hasGroup( m_nonWettingIntermediateJFuncTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_nonWettingIntermediateJFuncTableName ), InputError, getDataContext() ); TableFunction const & jFuncTableNWI = functionManager.getGroup< TableFunction >( m_nonWettingIntermediateJFuncTableName ); diff --git a/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressure.cpp b/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressure.cpp index 17b94f4730f..f346fff4222 100644 --- a/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressure.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressure.cpp @@ -77,8 +77,7 @@ void TableCapillaryPressure::postInputInitialization() integer const numPhases = m_phaseNames.size(); GEOS_THROW_IF( numPhases != 2 && numPhases != 3, - GEOS_FMT( "{}: the expected number of fluid phases is either two, or three", - getFullName() ), + "the expected number of fluid phases is either two, or three", InputError, getDataContext() ); // Populate the minimum phase volumes @@ -87,18 +86,16 @@ void TableCapillaryPressure::postInputInitialization() if( numPhases == 2 ) { GEOS_THROW_IF( m_wettingNonWettingCapPresTableName.empty(), - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify the capillary pressure table for the pair (wetting phase, non-wetting phase)", - getFullName(), + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify the capillary pressure table for the pair (wetting phase, non-wetting phase)", viewKeyStruct::wettingNonWettingCapPresTableNameString() ), InputError, getDataContext() ); } else if( numPhases == 3 ) { GEOS_THROW_IF( m_wettingIntermediateCapPresTableName.empty() || m_nonWettingIntermediateCapPresTableName.empty(), - GEOS_FMT( "{}: for a three-phase flow simulation, we must use {} to specify the capillary pressure table " + GEOS_FMT( "for a three-phase flow simulation, we must use {} to specify the capillary pressure table " "for the pair (wetting phase, intermediate phase), and {} to specify the capillary pressure table " "for the pair (non-wetting phase, intermediate phase)", - getFullName(), viewKeyStruct::wettingIntermediateCapPresTableNameString(), viewKeyStruct::nonWettingIntermediateCapPresTableNameString() ), InputError, getDataContext() ); @@ -115,10 +112,9 @@ void TableCapillaryPressure::initializePreSubGroups() if( numPhases == 2 ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingNonWettingCapPresTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingNonWettingCapPresTableName ), - InputError ); + InputError, getDataContext() ); TableFunction const & capPresTable = functionManager.getGroup< TableFunction >( m_wettingNonWettingCapPresTableName ); bool const capPresMustBeIncreasing = ( m_phaseOrder[PhaseType::WATER] < 0 ) ? true // pc on the gas phase, function must be increasing @@ -128,16 +124,14 @@ void TableCapillaryPressure::initializePreSubGroups() else if( numPhases == 3 ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingIntermediateCapPresTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingIntermediateCapPresTableName ), InputError, getDataContext() ); TableFunction const & capPresTableWI = functionManager.getGroup< TableFunction >( m_wettingIntermediateCapPresTableName ); TableCapillaryPressureHelpers::validateCapillaryPressureTable( capPresTableWI, getFullName(), false ); GEOS_THROW_IF( !functionManager.hasGroup( m_nonWettingIntermediateCapPresTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_nonWettingIntermediateCapPresTableName ), InputError, getDataContext() ); TableFunction const & capPresTableNWI = functionManager.getGroup< TableFunction >( m_nonWettingIntermediateCapPresTableName ); diff --git a/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressureHelpers.cpp b/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressureHelpers.cpp index 619e69a22db..90dbfedc5ac 100644 --- a/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressureHelpers.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/TableCapillaryPressureHelpers.cpp @@ -30,20 +30,20 @@ namespace constitutive void TableCapillaryPressureHelpers::validateCapillaryPressureTable( TableFunction const & capPresTable, - string const & fullConstitutiveName, + string const &, bool const capPresMustBeIncreasing ) { ArrayOfArraysView< real64 const > coords = capPresTable.getCoordinates(); GEOS_THROW_IF_NE_MSG( capPresTable.getInterpolationMethod(), TableFunction::InterpolationType::Linear, - GEOS_FMT( "{}: in table '{}' interpolation method must be linear", fullConstitutiveName, capPresTable.getName() ), - InputError ); + GEOS_FMT( "in table '{}' interpolation method must be linear", capPresTable.getName() ), + InputError, capPresTable.getDataContext() ); GEOS_THROW_IF_NE_MSG( capPresTable.numDimensions(), 1, - GEOS_FMT( "{}: table '{}' must have a single independent coordinate", fullConstitutiveName, capPresTable.getName() ), - InputError ); + GEOS_FMT( "table '{}' must have a single independent coordinate", capPresTable.getName() ), + InputError, capPresTable.getDataContext() ); GEOS_THROW_IF_LT_MSG( coords.sizeOfArray( 0 ), 2, - GEOS_FMT( "{}: table `{}` must contain at least two values", fullConstitutiveName, capPresTable.getName() ), - InputError ); + GEOS_FMT( "table `{}` must contain at least two values", capPresTable.getName() ), + InputError, capPresTable.getDataContext() ); arraySlice1d< real64 const > phaseVolFrac = coords[0]; arrayView1d< real64 const > const capPres = capPresTable.getValues(); @@ -52,8 +52,8 @@ TableCapillaryPressureHelpers::validateCapillaryPressureTable( TableFunction con { // check phase volume fraction GEOS_THROW_IF( phaseVolFrac[i] < 0 || phaseVolFrac[i] > 1, - GEOS_FMT( "{}: in table '{}' values must be between 0 and 1", fullConstitutiveName, capPresTable.getName() ), - InputError ); + GEOS_FMT( "in table '{}' values must be between 0 and 1", capPresTable.getName() ), + InputError, capPresTable.getDataContext() ); // note that the TableFunction class has already checked that the coordinates are monotone @@ -61,14 +61,14 @@ TableCapillaryPressureHelpers::validateCapillaryPressureTable( TableFunction con if( capPresMustBeIncreasing ) { GEOS_THROW_IF( !isZero( capPres[i] ) && (capPres[i] - capPres[i-1]) < -1e-15, - GEOS_FMT( "{}: in table '{}' values must be strictly increasing (i.e. |Delta Pc| > 1e-15 between two non-zero values)", fullConstitutiveName, capPresTable.getName() ), - InputError ); + "values must be strictly increasing (i.e. |Delta Pc| > 1e-15 between two non-zero values)", + InputError, capPresTable.getDataContext() ); } else { GEOS_THROW_IF( !isZero( capPres[i] ) && (capPres[i] - capPres[i-1]) > 1e-15, - GEOS_FMT( "{}: in table '{}' values must be strictly decreasing (i.e. |Delta Pc| > 1e-15 between two non-zero values)", fullConstitutiveName, capPresTable.getName() ), - InputError ); + "values must be strictly decreasing (i.e. |Delta Pc| > 1e-15 between two non-zero values)", + InputError, capPresTable.getDataContext() ); } } } diff --git a/src/coreComponents/constitutive/capillaryPressure/VanGenuchtenCapillaryPressure.cpp b/src/coreComponents/constitutive/capillaryPressure/VanGenuchtenCapillaryPressure.cpp index b324366f4f2..a1785e7e1b4 100644 --- a/src/coreComponents/constitutive/capillaryPressure/VanGenuchtenCapillaryPressure.cpp +++ b/src/coreComponents/constitutive/capillaryPressure/VanGenuchtenCapillaryPressure.cpp @@ -64,8 +64,8 @@ void VanGenuchtenCapillaryPressure::postInputInitialization() auto const checkInputSize = [&]( auto const & array, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( LvArray::integerConversion< size_t >( array.size()), m_phaseNames.size(), - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, viewKeyStruct::phaseMinVolumeFractionString() ); checkInputSize( m_phaseCapPressureExponentInv, viewKeyStruct::phaseCapPressureExponentInvString() ); @@ -76,40 +76,40 @@ void VanGenuchtenCapillaryPressure::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; if( m_phaseTypes[ip] != CapillaryPressureBase::REFERENCE_PHASE ) { GEOS_THROW_IF_LE_MSG( m_phaseCapPressureExponentInv[ip], 0.0, errorMsg( viewKeyStruct::phaseCapPressureExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseCapPressureExponentInv[ip], 1.0, errorMsg( viewKeyStruct::phaseCapPressureExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_phaseCapPressureMultiplier[ip], 0.0, errorMsg( viewKeyStruct::phaseCapPressureMultiplierString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_capPressureEpsilon, 0.0, errorMsg( viewKeyStruct::capPressureEpsilonString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_capPressureEpsilon, 0.2, errorMsg( viewKeyStruct::capPressureEpsilonString() ), - InputError ); + InputError, getDataContext() ); } } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); } VanGenuchtenCapillaryPressure::KernelWrapper diff --git a/src/coreComponents/constitutive/contact/BartonBandis.cpp b/src/coreComponents/constitutive/contact/BartonBandis.cpp index e2c52f87d42..165723532e0 100644 --- a/src/coreComponents/constitutive/contact/BartonBandis.cpp +++ b/src/coreComponents/constitutive/contact/BartonBandis.cpp @@ -41,8 +41,8 @@ BartonBandis::BartonBandis( string const & name, Group * const parent ): void BartonBandis::postInputInitialization() { GEOS_THROW_IF( m_referenceNormalStress <= 0.0, - getFullName() << ": The provided reference stress is zero or negative. Value: " << m_referenceNormalStress, - InputError ); + "The provided reference stress is zero or negative. Value: " << m_referenceNormalStress, + InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/contact/CoulombFriction.cpp b/src/coreComponents/constitutive/contact/CoulombFriction.cpp index 021c923e4ca..e11aa3b6bc1 100644 --- a/src/coreComponents/constitutive/contact/CoulombFriction.cpp +++ b/src/coreComponents/constitutive/contact/CoulombFriction.cpp @@ -52,7 +52,7 @@ CoulombFriction::CoulombFriction( string const & name, Group * const parent ): void CoulombFriction::postInputInitialization() { GEOS_THROW_IF( m_frictionCoefficient < 0.0, - getFullName() << ": The provided friction coefficient is less than zero. Value: " << m_frictionCoefficient, + ": The provided friction coefficient is less than zero. Value: " << m_frictionCoefficient, InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/contact/HydraulicApertureTable.cpp b/src/coreComponents/constitutive/contact/HydraulicApertureTable.cpp index 26a3260374a..74458047fc1 100644 --- a/src/coreComponents/constitutive/contact/HydraulicApertureTable.cpp +++ b/src/coreComponents/constitutive/contact/HydraulicApertureTable.cpp @@ -53,13 +53,13 @@ HydraulicApertureTable::HydraulicApertureTable( string const & name, void HydraulicApertureTable::postInputInitialization() { GEOS_THROW_IF( m_apertureTableName.empty(), - getFullName() << ": the aperture table name " << m_apertureTableName << " is empty", + "the aperture table name " << m_apertureTableName << " is empty", InputError, getDataContext() ); FunctionManager & functionManager = FunctionManager::getInstance(); GEOS_THROW_IF( !functionManager.hasGroup( m_apertureTableName ), - getFullName() << ": the aperture table named " << m_apertureTableName << " could not be found", + "the aperture table named " << m_apertureTableName << " could not be found", InputError, getDataContext() ); } @@ -119,29 +119,29 @@ void HydraulicApertureTable::validateApertureTable( TableFunction const & apertu arrayView1d< real64 const > const & hydraulicApertureValues = apertureTable.getValues(); GEOS_THROW_IF( coords.size() == 0, - getFullName() << ": Empty aperture table.", - InputError ); + "Empty aperture table.", + InputError, getDataContext() ); GEOS_THROW_IF( coords.size() > 1, - getFullName() << ": Aperture limiter table cannot be greater than a 1D table.", + "Aperture limiter table cannot be greater than a 1D table.", InputError, getDataContext() ); arraySlice1d< real64 const > apertureValues = coords[0]; localIndex const size = apertureValues.size(); GEOS_THROW_IF( coords( 0, size-1 ) > 0.0 || coords( 0, size-1 ) < 0.0, - getFullName() << ": Invalid aperture limiter table. Last coordinate must be zero!", + "Invalid aperture limiter table. Last coordinate must be zero!", InputError, getDataContext() ); GEOS_THROW_IF( apertureValues.size() < 2, - getFullName() << ": Invalid aperture limiter table. Must have more than two points specified", + "Invalid aperture limiter table. Must have more than two points specified", InputError, getDataContext() ); localIndex const n = apertureValues.size()-1; real64 const slope = ( hydraulicApertureValues[n] - hydraulicApertureValues[n-1] ) / ( apertureValues[n] - apertureValues[n-1] ); GEOS_THROW_IF( slope >= 1.0, - getFullName() << ": Invalid aperture table. The slope of the last two points >= 1 is invalid.", + "Invalid aperture table. The slope of the last two points >= 1 is invalid.", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/diffusion/ConstantDiffusion.cpp b/src/coreComponents/constitutive/diffusion/ConstantDiffusion.cpp index 523a2f38bfb..22d6db8d061 100644 --- a/src/coreComponents/constitutive/diffusion/ConstantDiffusion.cpp +++ b/src/coreComponents/constitutive/diffusion/ConstantDiffusion.cpp @@ -55,15 +55,13 @@ void ConstantDiffusion::allocateConstitutiveData( Group & parent, localIndex con void ConstantDiffusion::postInputInitialization() { GEOS_THROW_IF( m_diffusivityComponents.size() != 3, - GEOS_FMT( "{}: the size of the diffusivity must be equal to 3", - getFullName() ), + "the size of the diffusivity must be equal to 3", InputError, getDataContext() ); GEOS_THROW_IF( m_diffusivityComponents[0] < 0 || m_diffusivityComponents[1] < 0 || m_diffusivityComponents[2] < 0, - GEOS_FMT( "{}: the components of the diffusivity tensor must be non-negative", - getFullName() ), + "the components of the diffusivity tensor must be non-negative", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/diffusion/DiffusionBase.cpp b/src/coreComponents/constitutive/diffusion/DiffusionBase.cpp index 995233e9b36..3b03b6e8990 100644 --- a/src/coreComponents/constitutive/diffusion/DiffusionBase.cpp +++ b/src/coreComponents/constitutive/diffusion/DiffusionBase.cpp @@ -51,16 +51,19 @@ void DiffusionBase::postInputInitialization() integer const numPhases = numFluidPhases(); GEOS_THROW_IF_LT_MSG( numPhases, 2, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numPhases, MAX_NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF( numPhases != m_defaultPhaseDiffusivityMultiplier.size(), - GEOS_FMT( "{}: the arrays in `{}` and `{}` must have the same size", - getFullName(), viewKeyStruct::phaseNamesString(), viewKeyStruct::defaultPhaseDiffusivityMultiplierString() ), - InputError, getDataContext() ); + GEOS_FMT( "the arrays in `{}` and `{}` must have the same size", + viewKeyStruct::phaseNamesString(), viewKeyStruct::defaultPhaseDiffusivityMultiplierString() ), + InputError, + getWrapperDataContext( viewKeyStruct::phaseNamesString()), + getWrapperDataContext( viewKeyStruct::defaultPhaseDiffusivityMultiplierString()), + getDataContext() ); } void DiffusionBase::allocateConstitutiveData( Group & parent, localIndex const numPts ) diff --git a/src/coreComponents/constitutive/dispersion/LinearIsotropicDispersion.cpp b/src/coreComponents/constitutive/dispersion/LinearIsotropicDispersion.cpp index 65f919d2b12..1600415d32f 100644 --- a/src/coreComponents/constitutive/dispersion/LinearIsotropicDispersion.cpp +++ b/src/coreComponents/constitutive/dispersion/LinearIsotropicDispersion.cpp @@ -39,8 +39,7 @@ LinearIsotropicDispersion::LinearIsotropicDispersion( string const & name, Group void LinearIsotropicDispersion::postInputInitialization() { GEOS_THROW_IF( m_longitudinalDispersivity < 0, - GEOS_FMT( "{}: longitudinal dispersivity must be positive", - getFullName() ), + "longitudinal dispersivity must be positive", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp index 470cc72f920..54a9b88b978 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp @@ -216,7 +216,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::initializePreSubGroups() GEOS_FMT( "The `{}` model is disabled for now. Please use the other thermal CO2-brine model instead: `{}`", CO2BrineEzrokhiThermalFluid::catalogName(), CO2BrinePhillipsThermalFluid::catalogName() ), - InputError ); + InputError, getDataContext() ); #endif } @@ -226,23 +226,26 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::postInputInitialization() MultiFluidBase::postInputInitialization(); GEOS_THROW_IF_NE_MSG( numFluidPhases(), 2, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( numFluidComponents(), 2, - GEOS_FMT( "{}: invalid number of components", getFullName() ), - InputError ); + "invalid number of components", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_phasePVTParaFiles.size(), 2, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName() ), - InputError ); + "invalid number of values", + InputError, getDataContext() ); // Make sure one (and only one) of m_flashModelParaFile or m_solubilityTables is provided bool const hasParamFile = !m_flashModelParaFile.empty(); bool const hasTables = !m_solubilityTables.empty(); GEOS_THROW_IF( hasParamFile == hasTables, - GEOS_FMT( "{}: One and only one of {} or {} should be specified", getFullName(), + GEOS_FMT( "One and only one of {} or {} should be specified", viewKeyStruct::flashModelParaFileString(), viewKeyStruct::solubilityTablesString() ), - InputError, getDataContext() ); + InputError, + getWrapperDataContext( viewKeyStruct::flashModelParaFileString()), + getWrapperDataContext( viewKeyStruct::solubilityTablesString()), + getDataContext() ); // NOTE: for now, the names of the phases are still hardcoded here // Later, we could read them from the XML file and we would then have a general class here @@ -277,7 +280,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() if( !strs.empty() ) { GEOS_THROW_IF( strs.size() < 2, - GEOS_FMT( "{}: missing PVT model in line '{}'", getFullName(), str ), + GEOS_FMT( "missing PVT model in line '{}'", str ), InputError, getDataContext() ); if( strs[0] == "DensityFun" ) @@ -315,7 +318,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() } else { - GEOS_THROW( GEOS_FMT( "{}: invalid PVT function type '{}'", getFullName(), strs[0] ), InputError ); + GEOS_THROW( GEOS_FMT( "invalid PVT function type '{}'", strs[0] ), InputError, getDataContext() ); } } } @@ -324,26 +327,26 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() // at this point, we have read the file and we check the consistency of non-thermal models GEOS_THROW_IF( phase1InputParams[PHASE1::InputParamOrder::DENSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE1::Density::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE1::Density::catalogName() ), InputError, getDataContext() ); GEOS_THROW_IF( phase2InputParams[PHASE2::InputParamOrder::DENSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE2::Density::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE2::Density::catalogName() ), InputError, getDataContext() ); GEOS_THROW_IF( phase1InputParams[PHASE1::InputParamOrder::VISCOSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE1::Viscosity::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE1::Viscosity::catalogName() ), InputError, getDataContext() ); GEOS_THROW_IF( phase2InputParams[PHASE2::InputParamOrder::VISCOSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE2::Viscosity::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE2::Viscosity::catalogName() ), InputError, getDataContext() ); // we also detect any inconsistency arising in the enthalpy models GEOS_THROW_IF( phase1InputParams[PHASE1::InputParamOrder::ENTHALPY].empty() && ( PHASE1::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE1::Enthalpy::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE1::Enthalpy::catalogName() ), InputError, getDataContext() ); GEOS_THROW_IF( phase2InputParams[PHASE2::InputParamOrder::ENTHALPY].empty() && ( PHASE2::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE2::Enthalpy::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE2::Enthalpy::catalogName() ), InputError, getDataContext() ); // then, we are ready to instantiate the phase models @@ -377,7 +380,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() if( !strs.empty() ) { GEOS_THROW_IF( strs.size() < 2, - GEOS_FMT( "{}: missing flash model in line '{}'", getFullName(), str ), + GEOS_FMT( "missing flash model in line '{}'", str ), InputError, getDataContext() ); if( strs[0] == "FlashModel" ) @@ -394,7 +397,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() } else { - GEOS_THROW( GEOS_FMT( "{}: invalid flash model type '{}'", getFullName(), strs[0] ), InputError ); + GEOS_THROW( GEOS_FMT( "invalid flash model type '{}'", strs[0] ), InputError, getDataContext() ); } } } @@ -404,7 +407,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() { // The user must provide 1 or 2 tables. GEOS_THROW_IF( m_solubilityTables.size() != 1 && m_solubilityTables.size() != 2, - GEOS_FMT( "{}: The number of table names in {} must be 1 or 2", getFullName(), viewKeyStruct::solubilityTablesString() ), + GEOS_FMT( "The number of table names in {} must be 1 or 2", viewKeyStruct::solubilityTablesString() ), InputError, getDataContext() ); // If 1 table is provided, it is the CO2 solubility table and water vapourisation is zero @@ -435,7 +438,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() } GEOS_THROW_IF( m_flash == nullptr, - GEOS_FMT( "{}: flash model {} not found in input files", getFullName(), FLASH::catalogName() ), + GEOS_FMT( " flash model {} not found in input files", FLASH::catalogName() ), InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.cpp b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.cpp index 818185519f0..d6955ce0bae 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.cpp @@ -159,25 +159,25 @@ void MultiFluidBase::postInputInitialization() integer const numPhase = numFluidPhases(); GEOS_THROW_IF_LT_MSG( numComp, 1, - GEOS_FMT( "{}: invalid number of components", getFullName() ), - InputError ); + "invalid number of components", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numComp, MAX_NUM_COMPONENTS, - GEOS_FMT( "{}: invalid number of components", getFullName() ), - InputError ); + "invalid number of components", + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( numPhase, 1, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numPhase, MAX_NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_componentMolarWeight.size(), numComp, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), viewKeyStruct::componentMolarWeightString() ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::componentMolarWeightString() ), + InputError, getDataContext() ); for( integer ic = 0; ic < numComp; ++ic ) { GEOS_THROW_IF_LT_MSG( m_componentMolarWeight[ic], LvArray::NumericLimits< real64 >::epsilon, - GEOS_FMT( "{}: zero molecular weight found for component {}", getFullName(), m_componentNames[ic] ), - InputError ); + GEOS_FMT( "zero molecular weight found for component {}", m_componentNames[ic] ), + InputError, getDataContext() ); } // Make sure that phase names and component names are not repeated @@ -186,8 +186,8 @@ void MultiFluidBase::postInputInitialization() { std::string const lowerCaseName = stringutilities::toLower( m_phaseNames[ip] ); GEOS_THROW_IF ( uniqueNames.find( lowerCaseName ) != uniqueNames.end(), - GEOS_FMT( "{}: phase name {} is repeated. " - "Phase names should be unique.", getFullName(), m_phaseNames[ip] ), InputError ); + GEOS_FMT( "phase name {} is repeated. " + "Phase names should be unique.", m_phaseNames[ip] ), InputError, getDataContext() ); uniqueNames.insert( lowerCaseName ); } uniqueNames.clear(); @@ -195,8 +195,8 @@ void MultiFluidBase::postInputInitialization() { std::string const lowerCaseName = stringutilities::toLower( m_componentNames[ic] ); GEOS_THROW_IF ( uniqueNames.find( lowerCaseName ) != uniqueNames.end(), - GEOS_FMT( "{}: component name {} is repeated. " - "Component names should be unique.", getFullName(), m_componentNames[ic] ), InputError ); + GEOS_FMT( "component name {} is repeated. " + "Component names should be unique.", m_componentNames[ic] ), InputError, getDataContext() ); uniqueNames.insert( lowerCaseName ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.cpp index d99026ededc..fefb5951ca2 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.cpp @@ -43,20 +43,20 @@ void BlackOilFluid::postInputInitialization() BlackOilFluidBase::postInputInitialization(); GEOS_THROW_IF_NE_MSG( numFluidPhases(), 3, - GEOS_FMT( "{}: this model only supports three-phase flow", getFullName() ), - InputError ); + "this model only supports three-phase flow", + InputError, getDataContext() ); } void BlackOilFluid::readInputDataFromTableFunctions() { - GEOS_THROW( GEOS_FMT( "{}: this option is not implemented yet, please provide PVT files in standard text format", getFullName() ), - InputError ); + GEOS_THROW( "this option is not implemented yet, please provide PVT files in standard text format", + InputError, getDataContext() ); } void BlackOilFluid::readInputDataFromPVTFiles() { GEOS_THROW_IF( m_formationVolFactorTableNames.size() > 0.0 || m_viscosityTableNames.size() > 0.0, - GEOS_FMT( "{}: input is redundant (both TableFunction names and pvt files)", getFullName() ), + "input is redundant (both TableFunction names and pvt files)", InputError, getDataContext() ); using PT = BlackOilFluid::PhaseType; @@ -440,7 +440,7 @@ void BlackOilFluid::checkTableConsistency() const // check for the presence of one bubble point GEOS_THROW_IF( m_PVTO.undersaturatedPressure[m_PVTO.numSaturatedPoints - 1].size() <= 1, - GEOS_FMT( "{}: at least one bubble pressure is required in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "at least one bubble pressure is required in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); // check for saturated region @@ -448,16 +448,16 @@ void BlackOilFluid::checkTableConsistency() const { // Rs must increase with Pb GEOS_THROW_IF( ( m_PVTO.Rs[i + 1] - m_PVTO.Rs[i] ) <= 0, - GEOS_FMT( "{}: Rs must increase with Pb in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "Rs must increase with Pb in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); // Bo must increase with Pb GEOS_THROW_IF( ( m_PVTO.saturatedBo[i + 1] - m_PVTO.saturatedBo[i] ) <= 0, - GEOS_FMT( "{}: Bo must increase with Pb in saturated region in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "Bo must increase with Pb in saturated region in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); // Viscosity must decrease with Pb GEOS_THROW_IF( ( m_PVTO.saturatedViscosity[i + 1] - m_PVTO.saturatedViscosity[i] ) >= 0, - GEOS_FMT( "{}: Viscosity must decrease with Pb in saturated region in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "Viscosity must decrease with Pb in saturated region in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); } @@ -468,15 +468,15 @@ void BlackOilFluid::checkTableConsistency() const { // Pressure GEOS_THROW_IF( ( m_PVTO.undersaturatedPressure[i][j + 1] - m_PVTO.undersaturatedPressure[i][j] ) <= 0, - GEOS_FMT( "{}: P must decrease in undersaturated region in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "P must decrease in undersaturated region in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); // Bo must decrease with P GEOS_THROW_IF( ( m_PVTO.undersaturatedBo[i][j + 1] - m_PVTO.undersaturatedBo[i][j] ) >= 0, - GEOS_FMT( "{}: Bo must decrease with P in undersaturated region in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "Bo must decrease with P in undersaturated region in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); // Viscosity must increase with Pb GEOS_THROW_IF( ( m_PVTO.undersaturatedViscosity[i][j + 1] - m_PVTO.undersaturatedViscosity[i][j] ) < -1e-10, - GEOS_FMT( "{}: viscosity must increase with P in undersaturated region in {}", getFullName(), m_tableFiles[m_phaseOrder[PT::OIL]] ), + GEOS_FMT( "viscosity must increase with P in undersaturated region in {}", m_tableFiles[m_phaseOrder[PT::OIL]] ), InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp index ecf77b94f40..5add8fea865 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp @@ -97,15 +97,15 @@ BlackOilFluidBase::BlackOilFluidBase( string const & name, void BlackOilFluidBase::fillWaterData( array1d< array1d< real64 > > const & tableValues ) { GEOS_THROW_IF_NE_MSG( tableValues.size(), 1, - getFullName() << ": the water table must contain one line and only one", - InputError ); + "the water table must contain one line and only one", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( tableValues[0].size(), 4, - getFullName() << ": four columns (pressure, formation volume factor, compressibility, and viscosity) are expected for water", - InputError ); + "four columns (pressure, formation volume factor, compressibility, and viscosity) are expected for water", + InputError, getDataContext() ); GEOS_THROW_IF( m_waterParams.referencePressure > 0.0 || m_waterParams.formationVolFactor > 0.0 || m_waterParams.compressibility > 0.0 || m_waterParams.viscosity > 0.0, - getFullName() << ": input is redundant (user provided both water data and a water pvt file)", + "input is redundant (user provided both water data and a water pvt file)", InputError, getDataContext() ); m_waterParams.referencePressure = tableValues[0][0]; @@ -127,8 +127,8 @@ void BlackOilFluidBase::fillHydrocarbonData( integer const ip, for( localIndex i = 0; i < tableValues.size(); ++i ) { GEOS_THROW_IF_NE_MSG( tableValues[i].size(), 3, - getFullName() << ": three columns (pressure, formation volume factor, and viscosity) are expected for oil and gas", - InputError ); + "three columns (pressure, formation volume factor, and viscosity) are expected for oil and gas", + InputError, getDataContext() ); pressureCoords[0][i] = tableValues[i][0]; formationVolFactor[i] = tableValues[i][1]; @@ -190,16 +190,15 @@ void BlackOilFluidBase::postInputInitialization() // Number of components should be at least equal to number of phases GEOS_THROW_IF_LT_MSG( numFluidComponents(), numFluidPhases(), - GEOS_FMT( "{}: {} number of components ({}) must be at least number of phases ({})", - getFullName(), viewKeyStruct::componentNamesString(), + GEOS_FMT( "number of components ({}) must be at least number of phases ({})", numFluidComponents(), numFluidPhases() ), - InputError ); + InputError, getWrapperDataContext( viewKeyStruct::componentNamesString()), getDataContext() ); auto const checkInputSize = [&]( auto const & array, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( LvArray::integerConversion< size_t >( array.size()), m_phaseNames.size(), - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_surfacePhaseMassDensity, viewKeyStruct::surfacePhaseMassDensitiesString() ); checkInputSize( m_componentMolarWeight, viewKeyStruct::componentMolarWeightString() ); @@ -282,7 +281,7 @@ void BlackOilFluidBase::checkTablesParameters( real64 const pressure, void BlackOilFluidBase::createAllKernelWrappers() { GEOS_THROW_IF( m_hydrocarbonPhaseOrder.size() != 1 && m_hydrocarbonPhaseOrder.size() != 2, - GEOS_FMT( "{}: the number of hydrocarbon phases must be 1 (oil) or 2 (oil+gas)", getFullName() ), + "the number of hydrocarbon phases must be 1 (oil) or 2 (oil+gas)", InputError, getDataContext() ); if( m_formationVolFactorTableKernels.empty() && m_viscosityTableKernels.empty() ) @@ -302,18 +301,18 @@ void BlackOilFluidBase::validateTable( TableFunction const & table, { arrayView1d< real64 const > const property = table.getValues(); GEOS_THROW_IF_NE_MSG( table.getInterpolationMethod(), TableFunction::InterpolationType::Linear, - GEOS_FMT( "{}: in table '{}' interpolation method must be linear", getFullName(), table.getName() ), - InputError ); + GEOS_FMT( "in table '{}' interpolation method must be linear", table.getName() ), + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( property.size(), 2, - GEOS_FMT( "{}: table '{}' must contain at least two values", getFullName(), table.getName() ), - InputError ); + GEOS_FMT( "table '{}' must contain at least two values", table.getName() ), + InputError, getDataContext() ); // we don't check the first interval, as the first value may be used to specify surface conditions // we only issue a warning here, as we still want to allow this configuration for( localIndex i = 3; i < property.size(); ++i ) { GEOS_THROW_IF( (property[i] - property[i-1]) * (property[i-1] - property[i-2]) < 0, - GEOS_FMT( "{}: in table '{}', viscosity values must be monotone", getFullName(), table.getName() ), + GEOS_FMT( "in table '{}', viscosity values must be monotone", table.getName() ), InputError, getDataContext() ); } @@ -335,8 +334,8 @@ void BlackOilFluidBase::validateWaterParams() const auto const checkPositiveValue = [&]( real64 const value, auto const & attribute ) { GEOS_THROW_IF_LE_MSG( value, 0.0, - GEOS_FMT( "{}: invalid value of attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid value of attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkPositiveValue( m_waterParams.referencePressure, viewKeyStruct::waterRefPressureString() ); checkPositiveValue( m_waterParams.formationVolFactor, viewKeyStruct::waterFormationVolumeFactorString() ); diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp index eb2db5ee9b2..15dda269372 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp @@ -39,17 +39,17 @@ void DeadOilFluid::postInputInitialization() integer const numComps = numFluidComponents(); GEOS_THROW_IF( numComps != 2 && numComps != 3, - GEOS_FMT( "{}: this model only supports 2 or 3 components", getFullName() ), + "this model only supports 2 or 3 components", InputError, getDataContext() ); } void DeadOilFluid::readInputDataFromPVTFiles() { GEOS_THROW_IF_NE_MSG( m_tableFiles.size(), numFluidPhases(), - GEOS_FMT( "{}: the number of table files must be equal to the number of phases", getFullName() ), - InputError ); + "the number of table files must be equal to the number of phases", + InputError, getDataContext() ); GEOS_THROW_IF( m_formationVolFactorTableNames.size() > 0.0 || m_viscosityTableNames.size() > 0.0, - GEOS_FMT( "{}: input is redundant (both TableFunction names and pvt files)", getFullName() ), + "input is redundant (both TableFunction names and pvt files)", InputError, getDataContext() ); array1d< array1d< real64 > > tableValues; @@ -72,7 +72,7 @@ void DeadOilFluid::readInputDataFromPVTFiles() void DeadOilFluid::readInputDataFromTableFunctions() { GEOS_THROW_IF( !m_tableFiles.empty(), - GEOS_FMT( "{}: input is redundant (both TableFunction names and pvt files)", getFullName() ), + "input is redundant (both TableFunction names and pvt files)", InputError, getDataContext() ); integer const ipWater = m_phaseOrder[PhaseType::WATER]; @@ -86,8 +86,8 @@ void DeadOilFluid::readInputDataFromTableFunctions() auto const errorIfPositiveValue = [&]( real64 const value, auto const & attribute ) { GEOS_THROW_IF_GT_MSG( value, 0.0, - GEOS_FMT( "{}: if water is absent, attribute '{}' is not redundant", getFullName(), attribute ), - InputError ); + GEOS_FMT( "if water is absent, attribute '{}' is not redundant", attribute ), + InputError, getDataContext() ); }; errorIfPositiveValue( m_waterParams.referencePressure, viewKeyStruct::waterRefPressureString() ); errorIfPositiveValue( m_waterParams.formationVolFactor, viewKeyStruct::waterFormationVolumeFactorString() ); @@ -97,11 +97,11 @@ void DeadOilFluid::readInputDataFromTableFunctions() size_t const numExpectedTables = (ipGas >= 0) ? 2 : 1; GEOS_THROW_IF_NE_MSG( m_formationVolFactorTableNames.size(), numExpectedTables, - GEOS_FMT( "{}: one formation volume factor table must be provided for each hydrocarbon phase", getFullName() ), - InputError ); + "one formation volume factor table must be provided for each hydrocarbon phase", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_viscosityTableNames.size(), numExpectedTables, - GEOS_FMT( "{}: one viscosity table must be provided for each hydrocarbon phase", getFullName() ), - InputError ); + "one viscosity table must be provided for each hydrocarbon phase", + InputError, getDataContext() ); for( integer ip = 0; ip < numFluidPhases(); ++ip ) { @@ -115,10 +115,10 @@ void DeadOilFluid::readInputDataFromTableFunctions() for( integer iph = 0; iph < m_hydrocarbonPhaseOrder.size(); ++iph ) { GEOS_THROW_IF( !functionManager.hasGroup( m_formationVolFactorTableNames[iph] ), - GEOS_FMT( "{}: formation volume factor table '{}' not found", getFullName(), m_formationVolFactorTableNames[iph] ), + GEOS_FMT( "formation volume factor table '{}' not found", m_formationVolFactorTableNames[iph] ), InputError, getDataContext() ); GEOS_THROW_IF( !functionManager.hasGroup( m_viscosityTableNames[iph] ), - GEOS_FMT( "{}: viscosity table '{}' not found", getFullName(), m_viscosityTableNames[iph] ), + GEOS_FMT( "viscosity table '{}' not found", m_viscosityTableNames[iph] ), InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp index fe61cf48808..56c24735d27 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp @@ -128,9 +128,9 @@ void CompositionalMultiphaseFluid< FLASH, PHASE1, PHASE2, PHASE3 >::postInputIni integer const NP = numFluidPhases(); GEOS_THROW_IF_NE_MSG( NP, NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases in '{}'. There should be {} phases", - getFullName(), viewKeyStruct::phaseNamesString(), NUM_PHASES ), - InputError ); + GEOS_FMT( "invalid number of phases in '{}'. There should be {} phases", + viewKeyStruct::phaseNamesString(), NUM_PHASES ), + InputError, getDataContext() ); // Phase types should not be repeated auto const phaseTypes = getPhaseTypes(); @@ -139,17 +139,17 @@ void CompositionalMultiphaseFluid< FLASH, PHASE1, PHASE2, PHASE3 >::postInputIni { string const type_name = EnumStrings< compositional::PhaseType >::toString( static_cast< compositional::PhaseType >(phaseTypes[ip])); GEOS_THROW_IF ( uniquePhases.find( phaseTypes[ip] ) != uniquePhases.end(), - GEOS_FMT( "{}: phase with name {} is of type {} which is repeated. " - "Phase types should be unique.", getFullName(), m_phaseNames[ip], - type_name ), InputError ); + GEOS_FMT( "phase with name {} is of type {} which is repeated. " + "Phase types should be unique.", m_phaseNames[ip], type_name ), + InputError, getDataContext() ); uniquePhases.insert( phaseTypes[ip] ); } auto const checkInputSize = [&]( auto const & array, integer const expected, string const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_componentProperties->m_componentCriticalPressure, NC, viewKeyStruct::componentCriticalPressureString() ); @@ -175,25 +175,25 @@ void CompositionalMultiphaseFluid< FLASH, PHASE1, PHASE2, PHASE3 >::postInputIni // Binary interaction coefficients should be symmetric and have zero diagonal GEOS_THROW_IF_NE_MSG( componentBinaryCoeff.size( 0 ), NC, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), viewKeyStruct::componentBinaryCoeffString() ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::componentBinaryCoeffString() ), + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( componentBinaryCoeff.size( 1 ), NC, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), viewKeyStruct::componentBinaryCoeffString() ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::componentBinaryCoeffString() ), + InputError, getDataContext() ); for( integer ic = 0; ic < NC; ++ic ) { GEOS_THROW_IF_GT_MSG( LvArray::math::abs( componentBinaryCoeff( ic, ic )), MultiFluidConstants::epsilon, - GEOS_FMT( "{}: {} entry at ({},{}) is {}: should be zero", getFullName(), viewKeyStruct::componentBinaryCoeffString(), + GEOS_FMT( "{} entry at ({},{}) is {}: should be zero", viewKeyStruct::componentBinaryCoeffString(), ic, ic, componentBinaryCoeff( ic, ic ) ), - InputError ); + InputError, getDataContext() ); for( integer jc = ic + 1; jc < NC; ++jc ) { real64 const difference = LvArray::math::abs( componentBinaryCoeff( ic, jc )-componentBinaryCoeff( jc, ic )); GEOS_THROW_IF_GT_MSG( difference, MultiFluidConstants::epsilon, - GEOS_FMT( "{}: {} entry at ({},{}) is {} and is different from entry at ({},{}) which is {}", - getFullName(), viewKeyStruct::componentBinaryCoeffString(), + GEOS_FMT( "{} entry at ({},{}) is {} and is different from entry at ({},{}) which is {}", + viewKeyStruct::componentBinaryCoeffString(), ic, jc, componentBinaryCoeff( ic, jc ), jc, ic, componentBinaryCoeff( jc, ic ) ), - InputError ); + InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.cpp index 86bd59625d4..ae3303004b1 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.cpp @@ -101,8 +101,8 @@ void CompositionalMultiphaseFluidPVTPackage::postInputInitialization() auto const checkInputSize = [&]( auto const & array, auto const expected, string const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_equationsOfState, LvArray::integerConversion< size_t >( NP ), viewKeyStruct::equationsOfStateString() ); diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ConstantViscosity.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ConstantViscosity.cpp index a3239a34f21..ea508b9acb9 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ConstantViscosity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ConstantViscosity.cpp @@ -86,9 +86,9 @@ void ConstantViscosity::Parameters::postInputInitializationImpl( MultiFluidBase } } GEOS_THROW_IF_NE_MSG( m_constantPhaseViscosity.size(), numPhase, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", fluid->getFullName(), + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::constantPhaseViscosityString() ), - InputError ); + InputError, fluid->getDataContext() ); } } // end namespace compositional diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/BrineSalinity.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/BrineSalinity.cpp index b126ce5711d..e46877046f5 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/BrineSalinity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/BrineSalinity.cpp @@ -69,22 +69,19 @@ void BrineSalinity::postInputInitializationImpl( MultiFluidBase const * fluid, real64 constexpr epsilon = MultiFluidConstants::epsilon; GEOS_THROW_IF_LT_MSG( m_salinity, -epsilon, - GEOS_FMT( "{}: invalid salinity value provided in '{}'. Salinity should not be negative.", - fluid->getFullName(), + GEOS_FMT( "invalid salinity value provided in '{}'. Salinity should not be negative.", viewKeyStruct::salinityString() ), - InputError ); + InputError, fluid->getDataContext() ); GEOS_THROW_IF_LT_MSG( m_waterCompressibility, epsilon, - GEOS_FMT( "{}: invalid salinity value provided in '{}'. Compressibility should be positive.", - fluid->getFullName(), + GEOS_FMT( "invalid salinity value provided in '{}'. Compressibility should be positive.", viewKeyStruct::waterCompressibilityString() ), - InputError ); + InputError, fluid->getDataContext() ); GEOS_THROW_IF_LT_MSG( m_saltMolarWeight, epsilon, - GEOS_FMT( "{}: invalid salt molar weight value provided in '{}'. Molar weight should be positive.", - fluid->getFullName(), + GEOS_FMT( "invalid salt molar weight value provided in '{}'. Molar weight should be positive.", viewKeyStruct::saltMolarWeightString() ), - InputError ); + InputError, fluid->getDataContext() ); } } // end namespace compositional diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/CriticalVolume.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/CriticalVolume.cpp index 95d147af02f..2438c7854f9 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/CriticalVolume.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/CriticalVolume.cpp @@ -70,9 +70,9 @@ void CriticalVolume::postInputInitializationImpl( MultiFluidBase const * fluid, } GEOS_THROW_IF_NE_MSG( m_componentCriticalVolume.size(), numComponents, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", fluid->getFullName(), + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::componentCriticalVolumeString() ), - InputError ); + InputError, fluid->getDataContext() ); } void CriticalVolume::calculateCriticalVolume( integer const numComponents, diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/EquationOfState.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/EquationOfState.hpp index 835c078e6aa..1e5156f63b3 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/EquationOfState.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/EquationOfState.hpp @@ -87,9 +87,9 @@ class EquationOfState : public ModelParameters size_t const numPhase = fluid->numFluidPhases(); GEOS_THROW_IF_NE_MSG( m_equationsOfStateNames.size(), numPhase, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", fluid->getFullName(), + GEOS_FMT( "invalid number of values in attribute '{}'", viewKeyStruct::equationsOfStateString() ), - InputError ); + InputError, fluid->getDataContext() ); // If any value is invalid conversion will throw for( string const & eos : m_equationsOfStateNames ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/FlashParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/FlashParameters.cpp index 941f28a950b..06c3b254fe1 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/FlashParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/FlashParameters.cpp @@ -91,17 +91,17 @@ void FlashParameters::postInputInitializationImpl( MultiFluidBase const * fluid, auto const checkLowerBound = [&]( auto const & value, auto const & bound, string const & attribute ) { GEOS_THROW_IF_LT_MSG( value, bound, - GEOS_FMT( "{}: invalid number of value in attribute '{}'. Should be greater than {}", - fluid->getFullName(), bound, attribute ), - InputError ); + GEOS_FMT( "invalid number of value in attribute '{}'. Should be greater than {}", + bound, attribute ), + InputError, fluid->getDataContext() ); }; auto const checkUpperBound = [&]( auto const & value, auto const & bound, string const & attribute ) { GEOS_THROW_IF_GT_MSG( value, bound, - GEOS_FMT( "{}: invalid number of value in attribute '{}'. Should be less than {}", - fluid->getFullName(), bound, attribute ), - InputError ); + GEOS_FMT( "invalid number of value in attribute '{}'. Should be less than {}", + bound, attribute ), + InputError, fluid->getDataContext()); }; real64 constexpr epsilon = MultiFluidConstants::epsilon; diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/ImmiscibleWaterParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/ImmiscibleWaterParameters.cpp index 217b5ad54ae..5de8476a61a 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/ImmiscibleWaterParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/ImmiscibleWaterParameters.cpp @@ -105,23 +105,23 @@ void ImmiscibleWaterParameters::postInputInitializationImpl( MultiFluidBase cons { integer const waterIndex = fluid->getWaterPhaseIndex(); GEOS_THROW_IF_LT_MSG( waterIndex, 0, - GEOS_FMT( "{}: water phase not found '{}'", fluid->getFullName(), + GEOS_FMT( "water phase not found '{}'", MultiFluidBase::viewKeyStruct::phaseNamesString() ), - InputError ); + InputError, fluid->getDataContext() ); integer const h2oIndex = getWaterComponentIndex( componentProperties ); GEOS_THROW_IF_LT_MSG( h2oIndex, 0, - GEOS_FMT( "{}: water component not found '{}'", fluid->getFullName(), + GEOS_FMT( "water component not found '{}'", MultiFluidBase::viewKeyStruct::componentNamesString() ), - InputError ); + InputError, fluid->getDataContext() ); // Pretty much everything should be positive auto const checkLowerBound = [&]( real64 const & value, real64 const & bound, string const & attribute ) { GEOS_THROW_IF_LT_MSG( value, bound, - GEOS_FMT( "{}: invalid number of value in attribute '{}'. Should be greater than {}", - fluid->getFullName(), bound, attribute ), - InputError ); + GEOS_FMT( "invalid number of value in attribute '{}'. Should be greater than {}", + bound, attribute ), + InputError, fluid->getDataContext() ); }; real64 constexpr epsilon = MultiFluidConstants::epsilon; diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp index 3160bf2644b..8a5e751d640 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp @@ -85,14 +85,14 @@ void KValueFlashParameters< NUM_PHASE >::postInputInitializationImpl( MultiFluid integer const numFluidComponent = fluid->numFluidComponents(); GEOS_THROW_IF_NE_MSG( numPhases, numFluidPhase, - GEOS_FMT( "{}: invalid number of phases for the fluid.", fluid->getFullName() ), - InputError ); + "invalid number of phases for the fluid.", + InputError, fluid->getDataContext() ); integer const numTables = m_kValueTables.size(); GEOS_THROW_IF_NE_MSG( numTables, (numPhases-1)*numFluidComponent, - GEOS_FMT( "{}: invalid number of k-value tables provided.", fluid->getFullName() ), - InputError ); + "invalid number of k-value tables provided.", + InputError, fluid->getDataContext() ); // Check that the tables exist and are 2D FunctionManager & functionManager = FunctionManager::getInstance(); @@ -102,7 +102,7 @@ void KValueFlashParameters< NUM_PHASE >::postInputInitializationImpl( MultiFluid FunctionBase * function = functionManager.getGroupPointer< FunctionBase >( functionName ); GEOS_THROW_IF( function == nullptr, GEOS_FMT( "Function with name {} not found. ", functionName ), - InputError ); + InputError, fluid->getDataContext() ); function->initializeFunction(); @@ -123,7 +123,7 @@ void KValueFlashParameters< NUM_PHASE >::postInputInitializationImpl( MultiFluid #endif GEOS_THROW_IF_NE_MSG( numDims, 2, GEOS_FMT( "Function with name {} must have a dimension of 2. ", functionName ), - InputError ); + InputError, fluid->getDataContext() ); } @@ -426,8 +426,8 @@ bool KValueFlashParameters< NUM_PHASE >::validateKValues( MultiFluidBase const * GEOS_WARNING( GEOS_FMT( "{}: {}\n{}", fluidName, message, tableText.toString( tableData ) )); - GEOS_THROW_IF( hasAtLeastOneNegative, GEOS_FMT( "{}: negative k-value found. ", fluidName ), - InputError ); + GEOS_THROW_IF( hasAtLeastOneNegative, "negative k-value found. ", + InputError, fluid->getDataContext() ); } return true; diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PressureTemperatureCoordinates.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PressureTemperatureCoordinates.cpp index feed413b275..fcddae1c8c6 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PressureTemperatureCoordinates.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PressureTemperatureCoordinates.cpp @@ -65,14 +65,14 @@ void PressureTemperatureCoordinates::postInputInitializationImpl( MultiFluidBase { // If coordinates are provided then there must be at least 2 GEOS_THROW_IF_LT_MSG( m_pressureCoordinates.size(), 2, - GEOS_FMT( "{}: invalid number of pressure coordinates provided in {}. " - "At least 2 values must be provided", fluid->getFullName(), viewKeyStruct::pressureCoordinatesString() ), - InputError ); + GEOS_FMT( "invalid number of pressure coordinates provided in {}. " + "At least 2 values must be provided", viewKeyStruct::pressureCoordinatesString() ), + InputError, fluid->getDataContext() ); // Values must be strictly increasing GEOS_THROW_IF( !isStrictlyIncreasing( m_pressureCoordinates.toSliceConst()), - GEOS_FMT( "{}: invalid values of pressure coordinates provided in {}. " - "Values must be strictly increasing.", fluid->getFullName(), viewKeyStruct::pressureCoordinatesString() ), + GEOS_FMT( "invalid values of pressure coordinates provided in {}. " + "Values must be strictly increasing.", viewKeyStruct::pressureCoordinatesString() ), InputError, fluid->getDataContext() ); } @@ -80,14 +80,14 @@ void PressureTemperatureCoordinates::postInputInitializationImpl( MultiFluidBase { // If coordinates are provided then there must be at least 2 GEOS_THROW_IF_LT_MSG( m_temperatureCoordinates.size(), 2, - GEOS_FMT( "{}: invalid number of temperature coordinates provided in {}. " - "At least 2 values must be provided", fluid->getFullName(), viewKeyStruct::temperatureCoordinatesString() ), - InputError ); + GEOS_FMT( "invalid number of temperature coordinates provided in {}. " + "At least 2 values must be provided", viewKeyStruct::temperatureCoordinatesString() ), + InputError, fluid->getDataContext() ); // Values must be strictly increasing GEOS_THROW_IF( !isStrictlyIncreasing( m_temperatureCoordinates.toSliceConst()), - GEOS_FMT( "{}: invalid values of temperature coordinates provided in {}. " - "Values must be strictly increasing.", fluid->getFullName(), viewKeyStruct::temperatureCoordinatesString() ), + GEOS_FMT( "invalid values of temperature coordinates provided in {}. " + "Values must be strictly increasing.", viewKeyStruct::temperatureCoordinatesString() ), InputError, fluid->getDataContext() ); } } diff --git a/src/coreComponents/constitutive/fluid/multifluid/constant/InvariantImmiscibleFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/constant/InvariantImmiscibleFluid.cpp index 7a4640a3c1a..2083fba1b80 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/constant/InvariantImmiscibleFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/constant/InvariantImmiscibleFluid.cpp @@ -54,14 +54,14 @@ void InvariantImmiscibleFluid::postInputInitialization() integer numPhase = numFluidPhases(); // check densities and viscosities size GEOS_THROW_IF_NE_MSG( m_densities.size(), numPhase, - GEOS_FMT( "%s: 'Densities' must have %d values", getFullName(), numPhase ), InputError ); + GEOS_FMT( "'Densities' must have %d values", numPhase ), InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_viscosities.size(), numPhase, - GEOS_FMT( "%s: 'Viscosities' must have %d values", getFullName(), numPhase ), InputError ); + GEOS_FMT( "'Viscosities' must have %d values", numPhase ), InputError, getDataContext() ); integer numComponents = numFluidComponents(); // check tacit assumption of one component per phase GEOS_THROW_IF_NE_MSG( numComponents, numPhase, - GEOS_FMT( "%d number of components must be equato to %d number of phases", getFullName(), numPhase ), InputError ); + GEOS_FMT( "number of components must be equato to %d number of phases", numPhase ), InputError, getDataContext() ); } InvariantImmiscibleFluid::KernelWrapper InvariantImmiscibleFluid::createKernelWrapper() const diff --git a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp index 7371e60d080..e3504a5df8e 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp @@ -130,11 +130,11 @@ void ReactiveBrineFluid< PHASE > ::postInputInitialization() ReactiveMultiFluid::postInputInitialization(); GEOS_THROW_IF_NE_MSG( numFluidPhases(), 1, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_phasePVTParaFiles.size(), 1, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName() ), - InputError ); + "invalid number of values in attribute ", + InputError, getDataContext() ); createPVTModels(); } @@ -159,7 +159,7 @@ void ReactiveBrineFluid< PHASE > ::createPVTModels() if( !strs.empty() ) { GEOS_THROW_IF( strs.size() < 2, - GEOS_FMT( "{}: missing PVT model in line '{}'", getFullName(), str ), + GEOS_FMT( "missing PVT model in line '{}'", str ), InputError, getDataContext() ); if( strs[0] == "DensityFun" ) @@ -185,7 +185,7 @@ void ReactiveBrineFluid< PHASE > ::createPVTModels() } else { - GEOS_THROW( GEOS_FMT( "{}: invalid PVT function type '{}'", getFullName(), strs[0] ), InputError ); + GEOS_THROW( GEOS_FMT( "invalid PVT function type '{}'", strs[0] ), InputError, getDataContext() ); } } } @@ -194,15 +194,15 @@ void ReactiveBrineFluid< PHASE > ::createPVTModels() // at this point, we have read the file and we check the consistency of non-thermal models GEOS_THROW_IF( phase1InputParams[PHASE::InputParamOrder::DENSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE::Density::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE::Density::catalogName() ), InputError, getDataContext() ); GEOS_THROW_IF( phase1InputParams[PHASE::InputParamOrder::VISCOSITY].empty(), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE::Viscosity::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE::Viscosity::catalogName() ), InputError, getDataContext() ); // we also detect any inconsistency arising in the enthalpy models GEOS_THROW_IF( phase1InputParams[PHASE::InputParamOrder::ENTHALPY].empty() && ( PHASE::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ), - GEOS_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE::Enthalpy::catalogName() ), + GEOS_FMT( "PVT model {} not found in input files", PHASE::Enthalpy::catalogName() ), InputError, getDataContext() ); bool const isClone = this->isClone(); diff --git a/src/coreComponents/constitutive/fluid/singlefluid/CompressibleSinglePhaseFluid.cpp b/src/coreComponents/constitutive/fluid/singlefluid/CompressibleSinglePhaseFluid.cpp index db5e2733f97..f4e2d45f762 100644 --- a/src/coreComponents/constitutive/fluid/singlefluid/CompressibleSinglePhaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/singlefluid/CompressibleSinglePhaseFluid.cpp @@ -92,8 +92,8 @@ void CompressibleSinglePhaseFluid::postInputInitialization() auto const checkNonnegative = [&]( real64 const value, auto const & attribute ) { GEOS_THROW_IF_LT_MSG( value, 0.0, - GEOS_FMT( "{}: invalid value of attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid value of attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkNonnegative( m_compressibility, viewKeyStruct::compressibilityString() ); checkNonnegative( m_viscosibility, viewKeyStruct::viscosibilityString() ); @@ -101,8 +101,8 @@ void CompressibleSinglePhaseFluid::postInputInitialization() auto const checkPositive = [&]( real64 const value, auto const & attribute ) { GEOS_THROW_IF_LE_MSG( value, 0.0, - GEOS_FMT( "{}: invalid value of attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid value of attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkPositive( m_referenceDensity, viewKeyStruct::referenceDensityString() ); checkPositive( m_referenceViscosity, viewKeyStruct::referenceViscosityString() ); @@ -111,9 +111,9 @@ void CompressibleSinglePhaseFluid::postInputInitialization() auto const checkModelType = [&]( ExponentApproximationType const value, ExponentApproximationType const expectedValue, auto const & attribute ) { GEOS_THROW_IF( value != expectedValue, - GEOS_FMT( "{}: invalid model type in attribute '{}' (only {} currently supported)", - getFullName(), attribute, EnumStrings< ExponentApproximationType >::toString( expectedValue ) ), - InputError ); + GEOS_FMT( "invalid model type in attribute '{}' (only {} currently supported)", + attribute, EnumStrings< ExponentApproximationType >::toString( expectedValue ) ), + InputError, getDataContext() ); }; checkModelType( m_densityModelType, ExponentApproximationType::Full, viewKeyStruct::densityModelTypeString() ); checkModelType( m_viscosityModelType, ExponentApproximationType::Linear, viewKeyStruct::viscosityModelTypeString() ); diff --git a/src/coreComponents/constitutive/fluid/singlefluid/ParticleFluid.cpp b/src/coreComponents/constitutive/fluid/singlefluid/ParticleFluid.cpp index 3a252f50c07..d8f3b118886 100644 --- a/src/coreComponents/constitutive/fluid/singlefluid/ParticleFluid.cpp +++ b/src/coreComponents/constitutive/fluid/singlefluid/ParticleFluid.cpp @@ -83,33 +83,27 @@ void ParticleFluid::postInputInitialization() ParticleFluidBase::postInputInitialization(); GEOS_ERROR_IF( m_proppantDensity < 500.0, - "Invalid proppantDensity in ParticleFluid " - << getDataContext() << ", which must >= 500.0 ", + "Invalid proppantDensity in ParticleFluid which must >= 500.0 ", getDataContext() ); GEOS_ERROR_IF( m_proppantDiameter < 10e-6, - "Invalid proppantDiameter in ParticleFluid " - << getDataContext() << ", which must >= 10e-6 ", + "Invalid proppantDiameter in ParticleFluid, which must >= 10e-6 ", getDataContext() ); GEOS_ERROR_IF( m_hinderedSettlingCoefficient< 0.0 || m_hinderedSettlingCoefficient > 10.0, - "Invalid hinderedSettlingCoefficient in ParticleFluid " - << getDataContext() << ", which must between 0 and 10 ", + "Invalid hinderedSettlingCoefficient in ParticleFluid, which must between 0 and 10 ", getDataContext() ); GEOS_ERROR_IF( m_collisionAlpha < 1.0, - "Invalid collisionAlpha in ParticleFluid " - << getDataContext() << ", which must >= 1 ", + "Invalid collisionAlpha in ParticleFluid , which must >= 1 ", getDataContext() ); GEOS_ERROR_IF( m_collisionBeta < 0.0, - "Invalid collisionBeta in ParticleFluid " - << getDataContext() << ", which must >= 0", + "Invalid collisionBeta in ParticleFluid , which must >= 0", getDataContext() ); GEOS_ERROR_IF( m_slipConcentration > 0.3, - "Invalid slipConcentration in ParticleFluid " - << getDataContext() << ", which must <= 0.3", + "Invalid slipConcentration in ParticleFluid, which must <= 0.3", getDataContext() ); m_packPermeabilityCoef = pow( m_sphericity * m_proppantDiameter, 2.0 ) / 180.0; diff --git a/src/coreComponents/constitutive/fluid/singlefluid/ProppantSlurryFluid.cpp b/src/coreComponents/constitutive/fluid/singlefluid/ProppantSlurryFluid.cpp index 6a996fd89d0..6f181890e5b 100644 --- a/src/coreComponents/constitutive/fluid/singlefluid/ProppantSlurryFluid.cpp +++ b/src/coreComponents/constitutive/fluid/singlefluid/ProppantSlurryFluid.cpp @@ -75,19 +75,24 @@ void ProppantSlurryFluid::postInputInitialization() SlurryFluidBase::postInputInitialization(); GEOS_ERROR_IF_LT_MSG( m_compressibility, 0.0, - getFullName() << ": invalid value of " << viewKeyStruct::compressibilityString() ); + "invalid value of " << viewKeyStruct::compressibilityString(), + getDataContext() ); GEOS_ERROR_IF_LE_MSG( m_referenceDensity, 0.0, - getFullName() << ": invalid value of " << viewKeyStruct::referenceDensityString() ); + "invalid value of " << viewKeyStruct::referenceDensityString(), + getDataContext() ); GEOS_ERROR_IF_LT_MSG( m_referenceViscosity, 0.0, - getFullName() << ": invalid value of " << viewKeyStruct::referenceViscosityString() ); + "invalid value of " << viewKeyStruct::referenceViscosityString(), + getDataContext() ); GEOS_ERROR_IF_LE_MSG( m_maxProppantConcentration, 0.0, - getFullName() << ": invalid value of " << viewKeyStruct::maxProppantConcentrationString() ); + "invalid value of " << viewKeyStruct::maxProppantConcentrationString(), + getDataContext() ); GEOS_ERROR_IF_GT_MSG( m_maxProppantConcentration, 1.0, - getFullName() << ": invalid value of " << viewKeyStruct::maxProppantConcentrationString() ); + "invalid value of " << viewKeyStruct::maxProppantConcentrationString(), + getDataContext() ); } ProppantSlurryFluid::KernelWrapper diff --git a/src/coreComponents/constitutive/fluid/singlefluid/SlurryFluidBase.cpp b/src/coreComponents/constitutive/fluid/singlefluid/SlurryFluidBase.cpp index 3f2f93196bd..326fce8e768 100644 --- a/src/coreComponents/constitutive/fluid/singlefluid/SlurryFluidBase.cpp +++ b/src/coreComponents/constitutive/fluid/singlefluid/SlurryFluidBase.cpp @@ -89,13 +89,16 @@ void SlurryFluidBase::postInputInitialization() localIndex const NC = numFluidComponents(); GEOS_ERROR_IF( m_defaultComponentDensity.size() != NC, - getFullName() << ": The number of default density values is not the same as the component number" ); + "The number of default density values is not the same as the component number", + getDataContext() ); GEOS_ERROR_IF( m_defaultComponentCompressibility.size() != NC, - getFullName() << ": The number of default compressibility values is not the same as the component number" ); + "The number of default compressibility values is not the same as the component number", + getDataContext() ); GEOS_ERROR_IF( m_defaultComponentViscosity.size() != NC, - getFullName() << ": The number of default viscosity values is not the same as the component number" ); + "The number of default viscosity values is not the same as the component number", + getDataContext() ); } diff --git a/src/coreComponents/constitutive/fluid/singlefluid/ThermalCompressibleSinglePhaseFluid.cpp b/src/coreComponents/constitutive/fluid/singlefluid/ThermalCompressibleSinglePhaseFluid.cpp index 203cac5b95f..e52ab6a878e 100644 --- a/src/coreComponents/constitutive/fluid/singlefluid/ThermalCompressibleSinglePhaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/singlefluid/ThermalCompressibleSinglePhaseFluid.cpp @@ -75,8 +75,8 @@ void ThermalCompressibleSinglePhaseFluid::postInputInitialization() auto const checkNonnegative = [&]( real64 const value, auto const & attribute ) { GEOS_THROW_IF_LT_MSG( value, 0.0, - GEOS_FMT( "{}: invalid value of attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid value of attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkNonnegative( m_thermalExpansionCoeff, viewKeyStruct::thermalExpansionCoeffString() ); @@ -87,8 +87,8 @@ void ThermalCompressibleSinglePhaseFluid::postInputInitialization() auto const checkModelType = [&]( ExponentApproximationType const value, ExponentApproximationType const expectedValue, auto const & attribute ) { GEOS_THROW_IF( value != expectedValue, - GEOS_FMT( "{}: invalid model type in attribute '{}' (only {} currently supported)", - getFullName(), attribute, EnumStrings< ExponentApproximationType >::toString( expectedValue ) ), + GEOS_FMT( "invalid model type in attribute '{}' (only {} currently supported)", + attribute, EnumStrings< ExponentApproximationType >::toString( expectedValue ) ), InputError, getDataContext() ); }; checkModelType( m_internalEnergyModelType, ExponentApproximationType::Linear, viewKeyStruct::internalEnergyModelTypeString() ); diff --git a/src/coreComponents/constitutive/fluid/twophaseimmisciblefluid/TwoPhaseImmiscibleFluid.cpp b/src/coreComponents/constitutive/fluid/twophaseimmisciblefluid/TwoPhaseImmiscibleFluid.cpp index 3e75ef209f1..0616c616337 100644 --- a/src/coreComponents/constitutive/fluid/twophaseimmisciblefluid/TwoPhaseImmiscibleFluid.cpp +++ b/src/coreComponents/constitutive/fluid/twophaseimmisciblefluid/TwoPhaseImmiscibleFluid.cpp @@ -91,9 +91,9 @@ void TwoPhaseImmiscibleFluid::postInputInitialization() // Ensure that we have two phases defined GEOS_THROW_IF_NE_MSG( m_phaseNames.size(), 2, - GEOS_FMT( "{}: invalid number of phases. There should be 2 phases defined by {}", getFullName(), + GEOS_FMT( "invalid number of phases. There should be 2 phases defined by {}", viewKeyStruct::phaseNamesString() ), - InputError ); + InputError, getDataContext() ); // Input relationships can be provided either as text files or TableFunctions. m_tableFiles.empty() ? readInputDataFromTableFunctions() : readInputDataFromFileTableFunctions(); @@ -113,8 +113,8 @@ void TwoPhaseImmiscibleFluid::fillData( integer const ip, for( localIndex i = 0; i < tableValues.size(); ++i ) { GEOS_THROW_IF_NE_MSG( tableValues[i].size(), 3, - GEOS_FMT( "{}: three columns (pressure, density, and viscosity) are expected", getFullName() ), - InputError ); + "three columns (pressure, density, and viscosity) are expected", + InputError, getDataContext() ); pressureCoords[0][i] = tableValues[i][0]; density[i] = tableValues[i][1]; @@ -146,14 +146,14 @@ void TwoPhaseImmiscibleFluid::readInputDataFromFileTableFunctions() { // Check for ambiguous definition GEOS_THROW_IF( !(m_densityTableNames.empty() && m_viscosityTableNames.empty()), - GEOS_FMT( "{}: input is redundant (both TableFunction names and text files)", getFullName() ), - InputError ); + "input is redundant (both TableFunction names and text files)", + InputError, getDataContext() ); // Check that we have exactly two table files (one per phase) GEOS_THROW_IF_NE_MSG( m_tableFiles.size(), 2, - GEOS_FMT( "{}: expecting two table files (one per phase)", getFullName() ), - InputError ); + "expecting two table files (one per phase)", + InputError, getDataContext() ); array1d< array1d< real64 > > tableValues; for( integer ip = 0; ip < 2; ++ip ) @@ -169,17 +169,17 @@ void TwoPhaseImmiscibleFluid::readInputDataFromTableFunctions() { // Check for ambiguous definition GEOS_THROW_IF( !m_tableFiles.empty(), - GEOS_FMT( "{}: input is redundant (both TableFunction names and text files)", getFullName() ), - InputError ); + "input is redundant (both TableFunction names and text files)", + InputError, getDataContext() ); // Since we are considering a two phase fluid, we should have exactly 2 tables per property GEOS_THROW_IF_NE_MSG( m_densityTableNames.size(), 2, - GEOS_FMT( "{}: one density table must be provided for each phase", getFullName() ), - InputError ); + "one density table must be provided for each phase", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_viscosityTableNames.size(), 2, - GEOS_FMT( "{}: one viscosity table must be provided for each phase", getFullName() ), - InputError ); + "one viscosity table must be provided for each phase", + InputError, getDataContext() ); FunctionManager const & functionManager = FunctionManager::getInstance(); @@ -187,12 +187,12 @@ void TwoPhaseImmiscibleFluid::readInputDataFromTableFunctions() for( integer iph = 0; iph < 2; ++iph ) { GEOS_THROW_IF( !functionManager.hasGroup( m_densityTableNames[iph] ), - GEOS_FMT( "{}: density table '{}' not found", getFullName(), m_densityTableNames[iph] ), - InputError ); + GEOS_FMT( "density table '{}' not found", m_densityTableNames[iph] ), + InputError, getDataContext() ); GEOS_THROW_IF( !functionManager.hasGroup( m_viscosityTableNames[iph] ), - GEOS_FMT( "{}: viscosity table '{}' not found", getFullName(), m_viscosityTableNames[iph] ), - InputError ); + GEOS_FMT( "viscosity table '{}' not found", m_viscosityTableNames[iph] ), + InputError, getDataContext() ); } } @@ -228,8 +228,8 @@ void TwoPhaseImmiscibleFluid::checkTableConsistency() const for( localIndex i = 1; i < density.size(); ++i ) { GEOS_THROW_IF( density[i] - density[i-1] < 0, - GEOS_FMT( "{}: in table '{}' density values must be increasing", getFullName(), densityTable.getName() ), - InputError ); + GEOS_FMT( "in table '{}' density values must be increasing", densityTable.getName() ), + InputError, getDataContext() ); } } } diff --git a/src/coreComponents/constitutive/permeability/PressurePermeability.cpp b/src/coreComponents/constitutive/permeability/PressurePermeability.cpp index 319cc204531..1106fc6df17 100644 --- a/src/coreComponents/constitutive/permeability/PressurePermeability.cpp +++ b/src/coreComponents/constitutive/permeability/PressurePermeability.cpp @@ -65,7 +65,7 @@ void PressurePermeability::postInputInitialization() for( localIndex i=0; i < 3; i++ ) { GEOS_ERROR_IF( std::abs( m_pressureDependenceConstants[i] ) < 1e-15 && m_presModelType == PressureModelType::Hyperbolic, - getDataContext() << ": the pressure dependent constant at component " << i << " is too close to zero, which is not allowed for the hyperbolic model.", + "The pressure dependent constant at component " << i << " is too close to zero, which is not allowed for the hyperbolic model.", getDataContext() ); } } diff --git a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyBakerRelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyBakerRelativePermeability.cpp index 71e9bf5269e..81fc1942390 100644 --- a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyBakerRelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyBakerRelativePermeability.cpp @@ -71,14 +71,14 @@ void BrooksCoreyBakerRelativePermeability::postInputInitialization() RelativePermeabilityBase::postInputInitialization(); GEOS_THROW_IF( m_phaseOrder[PhaseType::OIL] < 0, - GEOS_FMT( "{}: reference oil phase has not been defined and must be included in model", getFullName() ), + "reference oil phase has not been defined and must be included in model", InputError, getDataContext() ); auto const checkInputSize = [&]( auto const & array, localIndex const expected, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, numFluidPhases(), viewKeyStruct::phaseMinVolumeFractionString() ); @@ -99,52 +99,52 @@ void BrooksCoreyBakerRelativePermeability::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); for( integer ip = 0; ip < 2; ++ip ) { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; if( m_phaseOrder[PhaseType::WATER] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_waterOilRelPermExponent[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermExponentString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_waterOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_waterOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } if( m_phaseOrder[PhaseType::GAS] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_gasOilRelPermExponent[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermExponentString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_gasOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_gasOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyRelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyRelativePermeability.cpp index 4212cde703a..592de053ce0 100644 --- a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyRelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyRelativePermeability.cpp @@ -64,8 +64,8 @@ void BrooksCoreyRelativePermeability::postInputInitialization() auto const checkInputSize = [&]( auto const & array, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), LvArray::integerConversion< int >( m_phaseNames.size()), - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, viewKeyStruct::phaseMinVolumeFractionString() ); checkInputSize( m_phaseRelPermExponent, viewKeyStruct::phaseRelPermExponentString() ); @@ -76,31 +76,31 @@ void BrooksCoreyRelativePermeability::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; GEOS_THROW_IF_LT_MSG( m_phaseRelPermExponent[ip], 0.0, errorMsg( viewKeyStruct::phaseRelPermExponentString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_phaseRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::phaseRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::phaseRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); } BrooksCoreyRelativePermeability::KernelWrapper diff --git a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyStone2RelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyStone2RelativePermeability.cpp index 564b3df38f1..7f043dfab9d 100644 --- a/src/coreComponents/constitutive/relativePermeability/BrooksCoreyStone2RelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/BrooksCoreyStone2RelativePermeability.cpp @@ -71,14 +71,14 @@ void BrooksCoreyStone2RelativePermeability::postInputInitialization() RelativePermeabilityBase::postInputInitialization(); GEOS_THROW_IF( m_phaseOrder[PhaseType::OIL] < 0, - GEOS_FMT( "{}: reference oil phase has not been defined and must be included in model", getFullName() ), + "reference oil phase has not been defined and must be included in model", InputError, getDataContext() ); auto const checkInputSize = [&]( auto const & array, localIndex const expected, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, numFluidPhases(), viewKeyStruct::phaseMinVolumeFractionString() ); @@ -99,52 +99,52 @@ void BrooksCoreyStone2RelativePermeability::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); for( integer ip = 0; ip < 2; ++ip ) { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; if( m_phaseOrder[PhaseType::WATER] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_waterOilRelPermExponent[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermExponentString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_waterOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_waterOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } if( m_phaseOrder[PhaseType::GAS] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_gasOilRelPermExponent[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermExponentString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_gasOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_gasOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/relativePermeability/RelativePermeabilityBase.cpp b/src/coreComponents/constitutive/relativePermeability/RelativePermeabilityBase.cpp index d93d335873e..b947d6962bc 100644 --- a/src/coreComponents/constitutive/relativePermeability/RelativePermeabilityBase.cpp +++ b/src/coreComponents/constitutive/relativePermeability/RelativePermeabilityBase.cpp @@ -57,11 +57,11 @@ void RelativePermeabilityBase::postInputInitialization() integer const numPhases = numFluidPhases(); GEOS_THROW_IF_LT_MSG( numPhases, 2, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numPhases, MAX_NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); m_phaseTypes.resize( numPhases ); m_phaseOrder.resizeDefault( MAX_NUM_PHASES, -1 ); diff --git a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeability.cpp index ae8a530ab31..00fc2d7b6b9 100644 --- a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeability.cpp @@ -91,22 +91,19 @@ void TableRelativePermeability::postInputInitialization() integer const numPhases = m_phaseNames.size(); GEOS_THROW_IF( numPhases != 2 && numPhases != 3, - GEOS_FMT( "{}: the expected number of fluid phases is either two, or three", - getFullName() ), + "the expected number of fluid phases is either two, or three", InputError, getDataContext() ); if( numPhases == 2 ) { GEOS_THROW_IF( m_wettingNonWettingRelPermTableNames.empty(), - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify the relative permeability tables for the pair (wetting phase, non-wetting phase)", - getFullName(), + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify the relative permeability tables for the pair (wetting phase, non-wetting phase)", viewKeyStruct::wettingNonWettingRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_wettingNonWettingRelPermTableNames.size() != 2, GEOS_FMT( - "{}: for a two-phase flow simulation, we must use {} to specify exactly two names: first the name of the wetting phase relperm table, second the name on the non-wetting phase relperm table", - getFullName(), + "for a two-phase flow simulation, we must use {} to specify exactly two names: first the name of the wetting phase relperm table, second the name on the non-wetting phase relperm table", viewKeyStruct::wettingNonWettingRelPermTableNamesString() ), InputError, getDataContext() ); @@ -115,23 +112,20 @@ void TableRelativePermeability::postInputInitialization() { GEOS_THROW_IF( m_wettingIntermediateRelPermTableNames.empty() || m_nonWettingIntermediateRelPermTableNames.empty(), GEOS_FMT( - "{}: for a three-phase flow simulation, we must use {} to specify the relative permeability tables for the pair (wetting phase, intermediate phase), and {} to specify the relative permeability tables for the pair (non-wetting phase, intermediate phase)", - getFullName(), + "for a three-phase flow simulation, we must use {} to specify the relative permeability tables for the pair (wetting phase, intermediate phase), and {} to specify the relative permeability tables for the pair (non-wetting phase, intermediate phase)", viewKeyStruct::wettingIntermediateRelPermTableNamesString(), viewKeyStruct::nonWettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_wettingIntermediateRelPermTableNames.size() != 2, GEOS_FMT( - "{}: for a three-phase flow simulation, we must use {} to specify exactly two names: first the name of the wetting phase relperm table, second the name on the intermediate phase relperm table", - getFullName(), + "for a three-phase flow simulation, we must use {} to specify exactly two names: first the name of the wetting phase relperm table, second the name on the intermediate phase relperm table", viewKeyStruct::wettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_nonWettingIntermediateRelPermTableNames.size() != 2, GEOS_FMT( - "{}: for a three-phase flow simulation, we must use {} to specify exactly two names: first the name of the non-wetting phase relperm table, second the name on the intermediate phase relperm table", - getFullName(), + "for a three-phase flow simulation, we must use {} to specify exactly two names: first the name of the non-wetting phase relperm table, second the name on the intermediate phase relperm table", viewKeyStruct::nonWettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); } @@ -161,8 +155,7 @@ void TableRelativePermeability::initializePreSubGroups() for( size_t ip = 0; ip < m_wettingNonWettingRelPermTableNames.size(); ++ip ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingNonWettingRelPermTableNames[ip] ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingNonWettingRelPermTableNames[ip] ), InputError, getDataContext() ); TableFunction const & relPermTable = functionManager.getGroup< TableFunction >( m_wettingNonWettingRelPermTableNames[ip] ); @@ -190,8 +183,7 @@ void TableRelativePermeability::initializePreSubGroups() for( size_t ip = 0; ip < m_wettingIntermediateRelPermTableNames.size(); ++ip ) { GEOS_THROW_IF( !functionManager.hasGroup( m_wettingIntermediateRelPermTableNames[ip] ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_wettingIntermediateRelPermTableNames[ip] ), InputError, getDataContext() ); TableFunction const & relPermTable = functionManager.getGroup< TableFunction >( m_wettingIntermediateRelPermTableNames[ip] ); @@ -218,8 +210,7 @@ void TableRelativePermeability::initializePreSubGroups() for( size_t ip = 0; ip < m_nonWettingIntermediateRelPermTableNames.size(); ++ip ) { GEOS_THROW_IF( !functionManager.hasGroup( m_nonWettingIntermediateRelPermTableNames[ip] ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", m_nonWettingIntermediateRelPermTableNames[ip] ), InputError, getDataContext() ); TableFunction const & relPermTable = functionManager.getGroup< TableFunction >( m_nonWettingIntermediateRelPermTableNames[ip] ); diff --git a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHelpers.cpp b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHelpers.cpp index 965c9278fc1..a93ab87c8a8 100644 --- a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHelpers.cpp +++ b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHelpers.cpp @@ -37,17 +37,14 @@ TableRelativePermeabilityHelpers::validateRelativePermeabilityTable( TableFuncti ArrayOfArraysView< real64 const > coords = relPermTable.getCoordinates(); GEOS_THROW_IF_NE_MSG( relPermTable.getInterpolationMethod(), TableFunction::InterpolationType::Linear, - GEOS_FMT( "{}: TableFunction '{}' interpolation method must be linear", - fullConstitutiveName, relPermTable.getDataContext() ), - InputError ); + GEOS_FMT( "TableFunction '{}' interpolation method must be linear", fullConstitutiveName ), + InputError, relPermTable.getDataContext() ); GEOS_THROW_IF_NE_MSG( relPermTable.numDimensions(), 1, - GEOS_FMT( "{}: TableFunction '{}' must have a single independent coordinate", - fullConstitutiveName, relPermTable.getDataContext() ), - InputError ); + GEOS_FMT( "TableFunction '{}' must have a single independent coordinate", fullConstitutiveName ), + InputError, relPermTable.getDataContext() ); GEOS_THROW_IF_LT_MSG( coords.sizeOfArray( 0 ), 2, - GEOS_FMT( "{}: TableFunction `{}` must contain at least two values", - fullConstitutiveName, relPermTable.getDataContext() ), - InputError ); + GEOS_FMT( "TableFunction '{}' must contain at least two values", fullConstitutiveName ), + InputError, relPermTable.getDataContext() ); arraySlice1d< real64 const > phaseVolFrac = coords[0]; arrayView1d< real64 const > const relPerm = relPermTable.getValues(); @@ -59,23 +56,21 @@ TableRelativePermeabilityHelpers::validateRelativePermeabilityTable( TableFuncti // note that the TableFunction class has already checked that coords.sizeOfArray( 0 ) == relPerm.size() GEOS_THROW_IF( !isZero( relPerm[0] ), - GEOS_FMT( "{}: TableFunction '{}' first value must be equal to 0", - fullConstitutiveName, relPermTable.getDataContext() ), + GEOS_FMT( "TableFunction '{}' first value must be equal to 0", fullConstitutiveName ), InputError, relPermTable.getDataContext() ); for( localIndex i = 1; i < coords.sizeOfArray( 0 ); ++i ) { // check phase volume fraction GEOS_THROW_IF( phaseVolFrac[i] < 0 || phaseVolFrac[i] > 1, - GEOS_FMT( "{}: TableFunction '{}' values must be between 0 and 1", - fullConstitutiveName, relPermTable.getDataContext() ), + GEOS_FMT( "TableFunction '{}' values must be between 0 and 1", fullConstitutiveName ), InputError, relPermTable.getDataContext() ); // note that the TableFunction class has already checked that the coordinates are monotone // check phase relative permeability GEOS_THROW_IF( !isZero( relPerm[i] ) && (relPerm[i] - relPerm[i-1]) < 1e-15, - GEOS_FMT( "{}: TableFunction '{}' values must be strictly increasing (|Delta kr| > 1e-15 between two non-zero values)", - fullConstitutiveName, relPermTable.getDataContext() ), + GEOS_FMT( "TableFunction '{}' values must be strictly increasing (|Delta kr| > 1e-15 between two non-zero values)", + fullConstitutiveName ), InputError, relPermTable.getDataContext() ); if( isZero( relPerm[i-1] ) && !isZero( relPerm[i] ) ) diff --git a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHysteresis.cpp b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHysteresis.cpp index 910c42cce41..7355dd8243d 100644 --- a/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHysteresis.cpp +++ b/src/coreComponents/constitutive/relativePermeability/TableRelativePermeabilityHysteresis.cpp @@ -161,8 +161,7 @@ void TableRelativePermeabilityHysteresis::postInputInitialization() integer const numPhases = m_phaseNames.size(); GEOS_THROW_IF( numPhases != 2 && numPhases != 3, - GEOS_FMT( "{}: the expected number of fluid phases is either two, or three", - getFullName() ), + "the expected number of fluid phases is either two, or three", InputError, getDataContext() ); m_phaseMinVolumeFraction.resize( numPhases ); @@ -174,16 +173,14 @@ void TableRelativePermeabilityHysteresis::postInputInitialization() if( numPhases == 2 ) { GEOS_THROW_IF( m_drainageWettingNonWettingRelPermTableNames.empty(), - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify the relative permeability tables " + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify the relative permeability tables " "for the pair (wetting phase, non-wetting phase)", - getFullName(), viewKeyStruct::drainageWettingNonWettingRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_drainageWettingNonWettingRelPermTableNames.size() != 2, - GEOS_FMT( "{}: for a two-phase flow simulation, we must use {} to specify exactly two names: " + GEOS_FMT( "for a two-phase flow simulation, we must use {} to specify exactly two names: " "first the name of the wetting phase relperm table, second the name on the non-wetting phase relperm table", - getFullName(), viewKeyStruct::drainageWettingNonWettingRelPermTableNamesString() ), InputError, getDataContext() ); @@ -197,25 +194,22 @@ void TableRelativePermeabilityHysteresis::postInputInitialization() else if( numPhases == 3 ) { GEOS_THROW_IF( m_drainageWettingIntermediateRelPermTableNames.empty() || m_drainageNonWettingIntermediateRelPermTableNames.empty(), - GEOS_FMT( "{}: for a three-phase flow simulation, " + GEOS_FMT( "for a three-phase flow simulation, " "we must use {} to specify the relative permeability tables for the pair (wetting phase, intermediate phase), " "and {} to specify the relative permeability tables for the pair (non-wetting phase, intermediate phase)", - getFullName(), viewKeyStruct::drainageWettingIntermediateRelPermTableNamesString(), viewKeyStruct::drainageNonWettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_drainageWettingIntermediateRelPermTableNames.size() != 2, - GEOS_FMT( "{}: for a three-phase flow simulation, we must use {} to specify exactly two names: " + GEOS_FMT( "for a three-phase flow simulation, we must use {} to specify exactly two names: " "first the name of the wetting phase relperm table, second the name on the intermediate phase relperm table", - getFullName(), viewKeyStruct::drainageWettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_drainageNonWettingIntermediateRelPermTableNames.size() != 2, - GEOS_FMT( "{}: for a three-phase flow simulation, we must use {} to specify exactly two names: " + GEOS_FMT( "for a three-phase flow simulation, we must use {} to specify exactly two names: " "first the name of the non-wetting phase relperm table, second the name on the intermediate phase relperm table", - getFullName(), viewKeyStruct::drainageNonWettingIntermediateRelPermTableNamesString() ), InputError, getDataContext() ); @@ -228,8 +222,7 @@ void TableRelativePermeabilityHysteresis::postInputInitialization() } GEOS_THROW_IF( m_phaseHasHysteresis[IPT::WETTING] == 0 && m_phaseHasHysteresis[IPT::NONWETTING] == 0, - GEOS_FMT( "{}: we must use {} or {} to specify at least one imbibition relative permeability table", - getFullName(), + GEOS_FMT( "we must use {} or {} to specify at least one imbibition relative permeability table", viewKeyStruct::imbibitionWettingRelPermTableNameString(), viewKeyStruct::imbibitionNonWettingRelPermTableNameString() ), InputError, getDataContext() ); @@ -294,26 +287,23 @@ void TableRelativePermeabilityHysteresis::checkExistenceAndValidateWettingRelPer imbibitionPhaseRelPermMaxEndPoint ); GEOS_THROW_IF( !isZero( imbibitionPhaseMinVolFraction - drainagePhaseMinVolFraction ), - GEOS_FMT( "{}: the critical wetting-phase volume fraction (saturation) must be the same in drainage and imbibition.\n" + GEOS_FMT( "the critical wetting-phase volume fraction (saturation) must be the same in drainage and imbibition.\n" "However, we found that the drainage critical wetting-phase volume fraction is {}, " "whereas the imbibition critical wetting-phase volume fraction is {}", - getFullName(), drainagePhaseMinVolFraction, imbibitionPhaseMinVolFraction ), InputError, getDataContext() ); GEOS_THROW_IF( imbibitionPhaseMaxVolFraction > drainagePhaseMaxVolFraction, - GEOS_FMT( "{}: the maximum wetting-phase volume fraction (saturation) must be smaller in imbibition (compared to the drainage value).\n" + GEOS_FMT( "the maximum wetting-phase volume fraction (saturation) must be smaller in imbibition (compared to the drainage value).\n" "However, we found that the drainage maximum wetting-phase volume fraction is {}, " "whereas the imbibition maximum wetting-phase volume fraction is {}", - getFullName(), drainagePhaseMaxVolFraction, imbibitionPhaseMaxVolFraction ), InputError, getDataContext() ); GEOS_THROW_IF( imbibitionPhaseRelPermMaxEndPoint > drainagePhaseRelPermMaxEndPoint, - GEOS_FMT( "{}: the maximum wetting-phase relperm must be smaller in imbibition (compared to the drainage value).\n" + GEOS_FMT( "the maximum wetting-phase relperm must be smaller in imbibition (compared to the drainage value).\n" "However, we found that the drainage maximum wetting-phase relperm is {}, " "whereas the imbibition maximum wetting-phase relperm is {}", - getFullName(), drainagePhaseRelPermMaxEndPoint, imbibitionPhaseRelPermMaxEndPoint ), InputError, getDataContext() ); } @@ -370,26 +360,23 @@ void TableRelativePermeabilityHysteresis::checkExistenceAndValidateNonWettingRel imbibitionPhaseRelPermMaxEndPoint ); GEOS_THROW_IF( !isZero ( imbibitionPhaseMaxVolFraction - drainagePhaseMaxVolFraction ), - GEOS_FMT( string( "{}: the maximum non-wetting-phase volume fraction (saturation) must be the same in drainage and imbibition.\n" ) + GEOS_FMT( string( "the maximum non-wetting-phase volume fraction (saturation) must be the same in drainage and imbibition.\n" ) + string( "However, we found that the drainage maximum wetting-phase volume fraction is {}, " ) + string( "whereas the imbibition maximum wetting-phase volume fraction is {}" ), - getFullName(), drainagePhaseMaxVolFraction, imbibitionPhaseMaxVolFraction ), InputError, getDataContext() ); GEOS_THROW_IF( !isZero ( imbibitionPhaseRelPermMaxEndPoint - drainagePhaseRelPermMaxEndPoint ), - GEOS_FMT( string( "{}: the non-wetting-phase relperm endpoint must be the same in drainage and imbibition.\n" ) + GEOS_FMT( string( "the non-wetting-phase relperm endpoint must be the same in drainage and imbibition.\n" ) + string( "However, we found that the drainage endpoint wetting-phase relperm is {}, " ) + string( "whereas the imbibition endpoint wetting-phase relperm is {}" ), - getFullName(), drainagePhaseRelPermMaxEndPoint, imbibitionPhaseRelPermMaxEndPoint ), InputError, getDataContext() ); GEOS_THROW_IF( imbibitionPhaseMinVolFraction < drainagePhaseMinVolFraction, - GEOS_FMT( string( "{}: the critical wetting-phase volume fraction (saturation) must be larger in imbibition (compared to the drainage value).\n" ) + GEOS_FMT( string( "the critical wetting-phase volume fraction (saturation) must be larger in imbibition (compared to the drainage value).\n" ) + string( "However, we found that the drainage critical wetting-phase volume fraction is {}, " ) + string( "whereas the imbibition critical wetting-phase volume fraction is {}" ), - getFullName(), drainagePhaseMinVolFraction, imbibitionPhaseMinVolFraction ), InputError, getDataContext() ); @@ -446,8 +433,7 @@ void TableRelativePermeabilityHysteresis::checkExistenceAndValidateRelPermTable( // check if the table actually exists GEOS_THROW_IF( !functionManager.hasGroup( relPermTableName ), - GEOS_FMT( "{}: the table function named {} could not be found", - getFullName(), + GEOS_FMT( "the table function named {} could not be found", relPermTableName ), InputError, getDataContext() ); TableFunction const & relPermTable = functionManager.getGroup< TableFunction >( relPermTableName ); diff --git a/src/coreComponents/constitutive/relativePermeability/VanGenuchtenBakerRelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/VanGenuchtenBakerRelativePermeability.cpp index 065e1b4ebc8..f9639d69bec 100644 --- a/src/coreComponents/constitutive/relativePermeability/VanGenuchtenBakerRelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/VanGenuchtenBakerRelativePermeability.cpp @@ -73,14 +73,14 @@ void VanGenuchtenBakerRelativePermeability::postInputInitialization() RelativePermeabilityBase::postInputInitialization(); GEOS_THROW_IF( m_phaseOrder[PhaseType::OIL] < 0, - GEOS_FMT( "{}: reference oil phase has not been defined and must be included in model", getFullName() ), + "reference oil phase has not been defined and must be included in model", InputError, getDataContext() ); auto const checkInputSize = [&]( auto const & array, localIndex const expected, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, numFluidPhases(), viewKeyStruct::phaseMinVolumeFractionString() ); @@ -101,51 +101,51 @@ void VanGenuchtenBakerRelativePermeability::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); for( integer ip = 0; ip < 2; ++ip ) { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; if( m_phaseOrder[PhaseType::WATER] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_waterOilRelPermExponentInv[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_waterOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_waterOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } if( m_phaseOrder[PhaseType::GAS] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_gasOilRelPermExponentInv[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_gasOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_gasOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/relativePermeability/VanGenuchtenStone2RelativePermeability.cpp b/src/coreComponents/constitutive/relativePermeability/VanGenuchtenStone2RelativePermeability.cpp index f4e6a083775..60b4f1d9e17 100644 --- a/src/coreComponents/constitutive/relativePermeability/VanGenuchtenStone2RelativePermeability.cpp +++ b/src/coreComponents/constitutive/relativePermeability/VanGenuchtenStone2RelativePermeability.cpp @@ -73,14 +73,14 @@ void VanGenuchtenStone2RelativePermeability::postInputInitialization() RelativePermeabilityBase::postInputInitialization(); GEOS_THROW_IF( m_phaseOrder[PhaseType::OIL] < 0, - GEOS_FMT( "{}: reference oil phase has not been defined and must be included in model", getFullName() ), + "reference oil phase has not been defined and must be included in model", InputError, getDataContext() ); auto const checkInputSize = [&]( auto const & array, localIndex const expected, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), expected, - GEOS_FMT( "{}: invalid number of values in attribute '{}'", getFullName(), attribute ), - InputError ); + GEOS_FMT( "invalid number of values in attribute '{}'", attribute ), + InputError, getDataContext() ); }; checkInputSize( m_phaseMinVolumeFraction, numFluidPhases(), viewKeyStruct::phaseMinVolumeFractionString() ); @@ -101,51 +101,51 @@ void VanGenuchtenStone2RelativePermeability::postInputInitialization() { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; GEOS_THROW_IF_LT_MSG( m_phaseMinVolumeFraction[ip], 0.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_phaseMinVolumeFraction[ip], 1.0, errorMsg( viewKeyStruct::phaseMinVolumeFractionString() ), - InputError ); + InputError, getDataContext() ); m_volFracScale -= m_phaseMinVolumeFraction[ip]; } GEOS_THROW_IF_LT_MSG( m_volFracScale, 0.0, - GEOS_FMT( "{}: sum of min volume fractions exceeds 1.0", getFullName() ), - InputError ); + "sum of min volume fractions exceeds 1.0", + InputError, getDataContext() ); for( integer ip = 0; ip < 2; ++ip ) { auto const errorMsg = [&]( auto const & attribute ) { - return GEOS_FMT( "{}: invalid value at {}[{}]", getFullName(), attribute, ip ); + return GEOS_FMT( "invalid value at {}[{}]", attribute, ip ); }; if( m_phaseOrder[PhaseType::WATER] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_waterOilRelPermExponentInv[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_waterOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_waterOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::waterOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } if( m_phaseOrder[PhaseType::GAS] >= 0 ) { GEOS_THROW_IF_LT_MSG( m_gasOilRelPermExponentInv[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermExponentInvString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_LT_MSG( m_gasOilRelPermMaxValue[ip], 0.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( m_gasOilRelPermMaxValue[ip], 1.0, errorMsg( viewKeyStruct::gasOilRelPermMaxValueString() ), - InputError ); + InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/solid/CeramicDamage.cpp b/src/coreComponents/constitutive/solid/CeramicDamage.cpp index 3d207dc8666..8eb116b233c 100644 --- a/src/coreComponents/constitutive/solid/CeramicDamage.cpp +++ b/src/coreComponents/constitutive/solid/CeramicDamage.cpp @@ -68,10 +68,10 @@ void CeramicDamage::postInputInitialization() { ElasticIsotropic::postInputInitialization(); - GEOS_THROW_IF( m_tensileStrength < 0.0, "Tensile strength must be a positive number.", InputError ); - GEOS_THROW_IF( m_compressiveStrength < m_tensileStrength, "Compressive strength must be greater than tensile strength.", InputError ); - GEOS_THROW_IF( m_maximumStrength < m_compressiveStrength, "Maximum theoretical strength must be greater than compressive strength.", InputError ); - GEOS_THROW_IF( m_crackSpeed < 0.0, "Crack speed must be a positive number.", InputError ); + GEOS_THROW_IF( m_tensileStrength < 0.0, "Tensile strength must be a positive number.", InputError, getDataContext() ); + GEOS_THROW_IF( m_compressiveStrength < m_tensileStrength, "Compressive strength must be greater than tensile strength.", InputError, getDataContext() ); + GEOS_THROW_IF( m_maximumStrength < m_compressiveStrength, "Maximum theoretical strength must be greater than compressive strength.", InputError, getDataContext() ); + GEOS_THROW_IF( m_crackSpeed < 0.0, "Crack speed must be a positive number.", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/solid/CoupledSolid.hpp b/src/coreComponents/constitutive/solid/CoupledSolid.hpp index 93e26caa84a..665820ed0c5 100644 --- a/src/coreComponents/constitutive/solid/CoupledSolid.hpp +++ b/src/coreComponents/constitutive/solid/CoupledSolid.hpp @@ -189,24 +189,27 @@ void CoupledSolid< SOLID_TYPE, PORO_TYPE, PERM_TYPE >::initializePreSubGroups() { if( PORO_TYPE::catalogName() != getPorosityModel().getCatalogName() ) { - GEOS_ERROR( " The coupled solid " << getDataContext() << + GEOS_ERROR( " The coupled solid " << " expects a porosity model of type " << PORO_TYPE::catalogName() << " but the specified porosity model \"" << m_porosityModelName << - "\" is of type " << getPorosityModel().getCatalogName() ); + "\" is of type " << getPorosityModel().getCatalogName(), + getDataContext() ); } if( PERM_TYPE::catalogName() != getPermModel().getCatalogName() ) { - GEOS_ERROR( " The coupled solid " << getDataContext() << + GEOS_ERROR( " The coupled solid " << " expects a permeability model of type " << PERM_TYPE::catalogName() << " but the specified permeability model \"" << m_permeabilityModelName << - "\" is of type " << getPermModel().getCatalogName() ); + "\" is of type " << getPermModel().getCatalogName(), + getDataContext() ); } if( SOLID_TYPE::catalogName() != getSolidModel().getCatalogName() ) { - GEOS_ERROR( " The coupled solid " << getDataContext() << + GEOS_ERROR( " The coupled solid " << " expects a solid model of type " << SOLID_TYPE::catalogName() << " but the specified solid model \"" << m_solidModelName << - "\" is of type" << getSolidModel().getCatalogName() ); + "\" is of type" << getSolidModel().getCatalogName(), + getDataContext() ); } } diff --git a/src/coreComponents/constitutive/solid/Damage.cpp b/src/coreComponents/constitutive/solid/Damage.cpp index 5272581c2ea..1b9e0c1e5da 100644 --- a/src/coreComponents/constitutive/solid/Damage.cpp +++ b/src/coreComponents/constitutive/solid/Damage.cpp @@ -100,20 +100,20 @@ void Damage< BASE >::postInputInitialization() BASE::postInputInitialization(); GEOS_ERROR_IF( m_extDrivingForceFlag != 0 && m_extDrivingForceFlag!= 1, - this->getDataContext() << ": invalid external driving force flag option - must" - " be 0 or 1", + "invalid external driving force flag option - must" + " be 0 or 1", this->getDataContext() ); GEOS_ERROR_IF( m_extDrivingForceFlag == 1 && m_defaultTensileStrength <= 0.0, - this->getDataContext() << ": tensile strength must be input and positive when the" - " external driving force flag is turned on", + "tensile strength must be input and positive when the" + " external driving force flag is turned on", this->getDataContext() ); GEOS_ERROR_IF( m_extDrivingForceFlag == 1 && m_defaultCompressiveStrength <= 0.0, - this->getDataContext() << ": compressive strength must be input and positive when the" - " external driving force flag is turned on", + "compressive strength must be input and positive when the" + " external driving force flag is turned on", this->getDataContext() ); GEOS_ERROR_IF( m_extDrivingForceFlag == 1 && m_defaultDeltaCoefficient < 0.0, - this->getDataContext() << ": delta coefficient must be input and non-negative when the" - " external driving force flag is turned on", + "delta coefficient must be input and non-negative when the" + " external driving force flag is turned on", this->getDataContext() ); // set results as array default values diff --git a/src/coreComponents/constitutive/solid/DelftEgg.cpp b/src/coreComponents/constitutive/solid/DelftEgg.cpp index a73adc31171..b9cb1f48048 100644 --- a/src/coreComponents/constitutive/solid/DelftEgg.cpp +++ b/src/coreComponents/constitutive/solid/DelftEgg.cpp @@ -86,16 +86,16 @@ void DelftEgg::postInputInitialization() ElasticIsotropic::postInputInitialization(); GEOS_THROW_IF( m_defaultCslSlope <= 0, - getFullName() << ": Non-positive slope of critical state line detected", + "Non-positive slope of critical state line detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultShapeParameter < 1., - getFullName() << ": Shape parameter for yield surface must be greater than or equal to one", + "Shape parameter for yield surface must be greater than or equal to one", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultVirginCompressionIndex <= 0, - getFullName() << ": Non-positive virgin compression index detected", + "Non-positive virgin compression index detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultVirginCompressionIndex <= m_defaultRecompressionIndex, - getFullName() << ": Recompression index should exceed virgin recompression index", + "Recompression index should exceed virgin recompression index", InputError, getDataContext() ); // set results as array default values diff --git a/src/coreComponents/constitutive/solid/DruckerPrager.cpp b/src/coreComponents/constitutive/solid/DruckerPrager.cpp index b142889a24d..a64ae00030c 100644 --- a/src/coreComponents/constitutive/solid/DruckerPrager.cpp +++ b/src/coreComponents/constitutive/solid/DruckerPrager.cpp @@ -79,16 +79,16 @@ void DruckerPrager::postInputInitialization() ElasticIsotropic::postInputInitialization(); GEOS_THROW_IF( m_defaultCohesion < 0, - getFullName() << ": Negative cohesion value detected", + "Negative cohesion value detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultFrictionAngle < 0, - getFullName() << ": Negative friction angle detected", + "Negative friction angle detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultDilationAngle < 0, - getFullName() << ": Negative dilation angle detected", + "Negative dilation angle detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultFrictionAngle < m_defaultDilationAngle, - getFullName() << ": Dilation angle should not exceed friction angle", + "Dilation angle should not exceed friction angle", InputError, getDataContext() ); // convert from Mohr-Coulomb constants to Drucker-Prager constants, assuming DP diff --git a/src/coreComponents/constitutive/solid/DruckerPragerExtended.cpp b/src/coreComponents/constitutive/solid/DruckerPragerExtended.cpp index 6a07c27e1bc..8fbeb1479da 100644 --- a/src/coreComponents/constitutive/solid/DruckerPragerExtended.cpp +++ b/src/coreComponents/constitutive/solid/DruckerPragerExtended.cpp @@ -88,22 +88,22 @@ void DruckerPragerExtended::postInputInitialization() ElasticIsotropic::postInputInitialization(); GEOS_THROW_IF( m_defaultCohesion < 0, - getFullName() << ": Negative cohesion value detected", + "Negative cohesion value detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultInitialFrictionAngle < 0, - getFullName() << ": Negative initial friction angle detected", + "Negative initial friction angle detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultResidualFrictionAngle < 0, - getFullName() << ": Negative residual friction angle detected", + "Negative residual friction angle detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultDilationRatio < 0, - getFullName() << ": Dilation ratio out of [0,1] range detected", + "Dilation ratio out of [0,1] range detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultDilationRatio > 1, - getFullName() << ": Dilation ratio out of [0,1] range detected", + "Dilation ratio out of [0,1] range detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultHardening < 0, - getFullName() << ": Negative hardening parameter detected", + "Negative hardening parameter detected", InputError, getDataContext() ); // convert from Mohr-Coulomb constants to Drucker-Prager constants, assuming DP diff --git a/src/coreComponents/constitutive/solid/ElasticIsotropic.cpp b/src/coreComponents/constitutive/solid/ElasticIsotropic.cpp index e89b7f18872..ef0a530ef92 100644 --- a/src/coreComponents/constitutive/solid/ElasticIsotropic.cpp +++ b/src/coreComponents/constitutive/solid/ElasticIsotropic.cpp @@ -95,9 +95,10 @@ void ElasticIsotropic::postInputInitialization() errorCheck += ")"; GEOS_ERROR_IF( numConstantsSpecified != 2, - getFullName() << ": A specific pair of elastic constants is required. " << + "A specific pair of elastic constants is required. " << "Either (K,G), (K,E), (G,E), (K,nu), (G,nu) or (E,nu). " << - "You have specified " << errorCheck ); + "You have specified " << errorCheck, + getDataContext() ); if( nu > -0.5 && nu < 0.5 && E > 0.0 ) { @@ -131,8 +132,9 @@ void ElasticIsotropic::postInputInitialization() } else { - GEOS_ERROR( getFullName() << ": Invalid specification for default elastic constants. " << - errorCheck << " has been specified." ); + GEOS_ERROR( "Invalid specification for default elastic constants. " << + errorCheck << " has been specified.", + getDataContext() ); } // set results as array default values diff --git a/src/coreComponents/constitutive/solid/ElasticIsotropicPressureDependent.cpp b/src/coreComponents/constitutive/solid/ElasticIsotropicPressureDependent.cpp index 2872b738a75..2f4f1a1cf68 100644 --- a/src/coreComponents/constitutive/solid/ElasticIsotropicPressureDependent.cpp +++ b/src/coreComponents/constitutive/solid/ElasticIsotropicPressureDependent.cpp @@ -90,18 +90,18 @@ void ElasticIsotropicPressureDependent::postInputInitialization() errorCheck += ")"; GEOS_ERROR_IF( numConstantsSpecified != 2, - GEOS_FMT( "{}: A specific pair of elastic constants is required: ( Cr G ), specified: {}", - getFullName(), errorCheck ) ); + GEOS_FMT( "A specific pair of elastic constants is required: ( Cr G ), specified: {}", errorCheck ), + getDataContext() ); GEOS_THROW_IF( m_defaultRefPressure >= 0, - GEOS_FMT( "{}: Reference pressure must be negative", getFullName() ), - InputError ); + "Reference pressure must be negative", + InputError, getDataContext() ); GEOS_THROW_IF( m_defaultRecompressionIndex <= 0, - GEOS_FMT( "{}: Non-positive recompression index detected {}", getFullName(), m_defaultRecompressionIndex ), + GEOS_FMT( "Non-positive recompression index detected {}", m_defaultRecompressionIndex ), InputError, getDataContext() ); real64 poisson = conversions::bulkModAndShearMod::toPoissonRatio( -1 * m_defaultRefPressure / m_defaultRecompressionIndex, m_defaultShearModulus ); GEOS_THROW_IF( poisson < 0, - GEOS_FMT( "{}: Elastic parameters lead to negative Poisson ratio at reference pressure", getFullName() ), + "Elastic parameters lead to negative Poisson ratio at reference pressure", InputError, getDataContext() ); // set results as array default values diff --git a/src/coreComponents/constitutive/solid/ElasticOrthotropic.cpp b/src/coreComponents/constitutive/solid/ElasticOrthotropic.cpp index e1ecf690546..79f75d0a71a 100644 --- a/src/coreComponents/constitutive/solid/ElasticOrthotropic.cpp +++ b/src/coreComponents/constitutive/solid/ElasticOrthotropic.cpp @@ -181,12 +181,12 @@ void ElasticOrthotropic::postInputInitialization() } else { - GEOS_ERROR( getFullName() << ": Invalid specification for default elastic constants." ); + GEOS_ERROR( "Invalid specification for default elastic constants.", getDataContext()); } } else if( c11 <= 0.0 || c22 <= 0.0 || c33 <= 0.0 || c44 <= 0.0 || c55 <= 0.0 || c66 <= 0.0 ) { - GEOS_ERROR( getFullName() << ": Invalid specification for default elastic stiffnesses." ); + GEOS_ERROR( "Invalid specification for default elastic stiffnesses.", getDataContext()); } // TODO merge in one diff --git a/src/coreComponents/constitutive/solid/ModifiedCamClay.cpp b/src/coreComponents/constitutive/solid/ModifiedCamClay.cpp index c00a1a90f2c..c168d7e413b 100644 --- a/src/coreComponents/constitutive/solid/ModifiedCamClay.cpp +++ b/src/coreComponents/constitutive/solid/ModifiedCamClay.cpp @@ -71,16 +71,16 @@ void ModifiedCamClay::postInputInitialization() ElasticIsotropicPressureDependent::postInputInitialization(); GEOS_THROW_IF( m_defaultCslSlope <= 0, - GEOS_FMT( "{}: Non-positive slope of critical state line detected", getFullName() ), + "Non-positive slope of critical state line detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultVirginCompressionIndex <= 0, - GEOS_FMT( "{}: Non-positive virgin compression index detected", getFullName() ), + "Non-positive virgin compression index detected", InputError, getDataContext() ); GEOS_THROW_IF( m_defaultVirginCompressionIndex <= m_defaultRecompressionIndex, - GEOS_FMT( "{}: Recompression index should exceed virgin recompression index", getFullName() ), - InputError ); + "Recompression index should exceed virgin recompression index", + InputError, getDataContext() ); GEOS_THROW_IF( m_defaultPreConsolidationPressure >= 0, - GEOS_FMT( "{}: Preconsolidation pressure must be negative", getFullName() ), + "Preconsolidation pressure must be negative", InputError, getDataContext() ); // set results as array default values diff --git a/src/coreComponents/constitutive/solid/PerfectlyPlastic.cpp b/src/coreComponents/constitutive/solid/PerfectlyPlastic.cpp index 931acdcdb37..c2a273ee027 100644 --- a/src/coreComponents/constitutive/solid/PerfectlyPlastic.cpp +++ b/src/coreComponents/constitutive/solid/PerfectlyPlastic.cpp @@ -44,7 +44,7 @@ void PerfectlyPlastic::postInputInitialization() { ElasticIsotropic::postInputInitialization(); - GEOS_THROW_IF( m_defaultYieldStress < 0.0, "Negative yield stress detected", InputError ); + GEOS_THROW_IF( m_defaultYieldStress < 0.0, "Negative yield stress detected", InputError, getDataContext() ); getField< fields::solid::yieldStress >().setApplyDefaultValue( m_defaultYieldStress ); } diff --git a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseConstantThermalConductivity.cpp b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseConstantThermalConductivity.cpp index 5e09a8762cb..da911dd690f 100644 --- a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseConstantThermalConductivity.cpp +++ b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseConstantThermalConductivity.cpp @@ -57,8 +57,7 @@ void MultiPhaseConstantThermalConductivity::postInputInitialization() GEOS_THROW_IF( m_thermalConductivityComponents[0] < 0 || m_thermalConductivityComponents[1] < 0 || m_thermalConductivityComponents[2] < 0, - GEOS_FMT( "{}: the components of the thermal conductivity tensor must be non-negative", - getFullName() ), + "the components of the thermal conductivity tensor must be non-negative", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseThermalConductivityBase.cpp b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseThermalConductivityBase.cpp index 5040067512d..9b706d33ad8 100644 --- a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseThermalConductivityBase.cpp +++ b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseThermalConductivityBase.cpp @@ -47,11 +47,11 @@ void MultiPhaseThermalConductivityBase::postInputInitialization() integer const numPhases = numFluidPhases(); GEOS_THROW_IF_LT_MSG( numPhases, 2, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); GEOS_THROW_IF_GT_MSG( numPhases, MAX_NUM_PHASES, - GEOS_FMT( "{}: invalid number of phases", getFullName() ), - InputError ); + "invalid number of phases", + InputError, getDataContext() ); } void MultiPhaseThermalConductivityBase::allocateConstitutiveData( dataRepository::Group & parent, localIndex const numPts ) diff --git a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseVolumeWeightedThermalConductivity.cpp b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseVolumeWeightedThermalConductivity.cpp index c7e309ceb4b..44aeda87f7d 100644 --- a/src/coreComponents/constitutive/thermalConductivity/MultiPhaseVolumeWeightedThermalConductivity.cpp +++ b/src/coreComponents/constitutive/thermalConductivity/MultiPhaseVolumeWeightedThermalConductivity.cpp @@ -67,15 +67,14 @@ void MultiPhaseVolumeWeightedThermalConductivity::postInputInitialization() GEOS_THROW_IF( m_rockThermalConductivityComponents[0] <= 0 || m_rockThermalConductivityComponents[1] <= 0 || m_rockThermalConductivityComponents[2] <= 0, - GEOS_FMT( "{}: the components of the rock thermal conductivity tensor must be strictly positive", - getFullName() ), + "the components of the rock thermal conductivity tensor must be strictly positive", InputError, getDataContext() ); for( integer ip = 0; ip < numFluidPhases(); ++ip ) { GEOS_THROW_IF( m_phaseThermalConductivity[ip] <= 0, - GEOS_FMT( "{}: the phase thermal conductivity for phase {} must be strictly positive", - getFullName(), ip ), + GEOS_FMT( "the phase thermal conductivity for phase {} must be strictly positive", + ip ), InputError, getDataContext() ); } } diff --git a/src/coreComponents/constitutive/thermalConductivity/SinglePhaseThermalConductivity.cpp b/src/coreComponents/constitutive/thermalConductivity/SinglePhaseThermalConductivity.cpp index 00d77439387..85c990f83ea 100644 --- a/src/coreComponents/constitutive/thermalConductivity/SinglePhaseThermalConductivity.cpp +++ b/src/coreComponents/constitutive/thermalConductivity/SinglePhaseThermalConductivity.cpp @@ -108,8 +108,7 @@ void SinglePhaseThermalConductivity::postInputInitialization() GEOS_THROW_IF( m_defaultThermalConductivityComponents[0] <= 0 || m_defaultThermalConductivityComponents[1] <= 0 || m_defaultThermalConductivityComponents[2] <= 0, - GEOS_FMT( "{}: the components of the default thermal conductivity tensor must be strictly positive", - getFullName() ), + "the components of the default thermal conductivity tensor must be strictly positive", InputError, getDataContext() ); } diff --git a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp index db232e5c37d..ec551e54d86 100644 --- a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp @@ -103,29 +103,24 @@ void PVTDriver::postInputInitialization() { // Validate some inputs GEOS_ERROR_IF( m_outputMassDensity != 0 && m_outputMassDensity != 1, - getWrapperDataContext( viewKeyStruct::outputMassDensityString() ) << - ": option can be either 0 (false) or 1 (true)", + "Option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::outputMassDensityString() ) ); GEOS_ERROR_IF( m_outputCompressibility != 0 && m_outputCompressibility != 1, - getWrapperDataContext( viewKeyStruct::outputCompressibilityString() ) << - ": option can be either 0 (false) or 1 (true)", + "Option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::outputCompressibilityString() ) ); GEOS_ERROR_IF( m_outputPhaseComposition != 0 && m_outputPhaseComposition != 1, - getWrapperDataContext( viewKeyStruct::outputPhaseCompositionString() ) << - ": option can be either 0 (false) or 1 (true)", + "Option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::outputPhaseCompositionString() ) ); GEOS_WARNING_IF( m_precision < minPrecision, - GEOS_FMT( "{}: option should be between {} and {}. A value of {} will be used.", - getWrapperDataContext( viewKeyStruct::precisionString() ), + GEOS_FMT( "option should be between {} and {}. A value of {} will be used.", minPrecision, maxPrecision, minPrecision ), getWrapperDataContext( viewKeyStruct::precisionString() )); GEOS_WARNING_IF( maxPrecision < m_precision, - GEOS_FMT( "{}: option should be between {} and {}. A value of {} will be used.", - getWrapperDataContext( viewKeyStruct::precisionString() ), + GEOS_FMT( "option should be between {} and {}. A value of {} will be used.", minPrecision, maxPrecision, maxPrecision ), getWrapperDataContext( viewKeyStruct::precisionString() ) ); diff --git a/src/coreComponents/constitutiveDrivers/solid/TriaxialDriver.cpp b/src/coreComponents/constitutiveDrivers/solid/TriaxialDriver.cpp index 73bea40106f..2dacce273a2 100644 --- a/src/coreComponents/constitutiveDrivers/solid/TriaxialDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/solid/TriaxialDriver.cpp @@ -151,11 +151,11 @@ void TriaxialDriver::postInputInitialization() // may overwrite it. GEOS_THROW_IF( !isEqual( m_initialStress, m_table( 0, SIG0 ), 1e-6 ), - getDataContext() << ": Initial stress values indicated by initialStress and axialFunction(time=0) appear inconsistent", + "Initial stress values indicated by initialStress and axialFunction(time=0) appear inconsistent", InputError, getDataContext() ); GEOS_THROW_IF( !isEqual( m_initialStress, m_table( 0, SIG1 ), 1e-6 ), - getDataContext() << ": Initial stress values indicated by initialStress and radialFunction(time=0) appear inconsistent", + "Initial stress values indicated by initialStress and radialFunction(time=0) appear inconsistent", InputError, getDataContext() ); } diff --git a/src/coreComponents/dataRepository/Group.cpp b/src/coreComponents/dataRepository/Group.cpp index 409fff42c61..7a1144d5d90 100644 --- a/src/coreComponents/dataRepository/Group.cpp +++ b/src/coreComponents/dataRepository/Group.cpp @@ -77,7 +77,7 @@ WrapperBase & Group::registerWrapper( std::unique_ptr< WrapperBase > wrapper ) void Group::deregisterWrapper( string const & name ) { GEOS_ERROR_IF( !hasWrapper( name ), - "Wrapper " << name << " doesn't exist in Group" << getDataContext() << '.', + "Wrapper " << name << " doesn't exist in Group.", getDataContext() ); m_wrappers.erase( name ); m_conduitNode.remove( name ); @@ -247,11 +247,10 @@ void Group::processInputFile( xmlWrapper::xmlNode const & targetNode, if( !xmlWrapper::isFileMetadataAttribute( attributeName ) ) { GEOS_THROW_IF( processedAttributes.count( attributeName ) == 0, - GEOS_FMT( "Error in {}: XML Node at '{}' contains unused attribute '{}'.\n" + GEOS_FMT( "XML Node at '{}' contains unused attribute '{}'.\n" "Valid attributes are:\n{}\nFor more details, please refer to documentation at:\n" "http://geosx-geosx.readthedocs-hosted.com/en/latest/docs/sphinx/userGuide/Index.html", - getDataContext(), targetNode.path(), attributeName, - dumpInputOptions() ), + targetNode.path(), attributeName, dumpInputOptions() ), InputError, getDataContext() ); } } diff --git a/src/coreComponents/dataRepository/Group.hpp b/src/coreComponents/dataRepository/Group.hpp index bf185a656ef..4f7f96d71f6 100644 --- a/src/coreComponents/dataRepository/Group.hpp +++ b/src/coreComponents/dataRepository/Group.hpp @@ -319,13 +319,12 @@ class Group { Group * const child = m_subGroups[ key ]; GEOS_THROW_IF( child == nullptr, - "Group " << getDataContext() << " has no child named " << key << std::endl - << dumpSubGroupsNames(), + "No child named " << key << " found." << std::endl << dumpSubGroupsNames(), std::domain_error, getDataContext() ); T * const castedChild = dynamicCast< T * >( child ); GEOS_THROW_IF( castedChild == nullptr, - GEOS_FMT( "{} was expected to be a '{}'.", - child->getDataContext(), LvArray::system::demangleType< T >() ), + GEOS_FMT( "'{}' was expected to be a '{}'.", + getName(), LvArray::system::demangleType< T >() ), BadTypeError, child->getDataContext() ); return *castedChild; } @@ -338,13 +337,12 @@ class Group { Group const * const child = m_subGroups[ key ]; GEOS_THROW_IF( child == nullptr, - "Group " << getDataContext() << " has no child named " << key << std::endl - << dumpSubGroupsNames(), + "No child named " << key << " found." << std::endl << dumpSubGroupsNames(), std::domain_error, getDataContext() ); T const * const castedChild = dynamicCast< T const * >( child ); GEOS_THROW_IF( castedChild == nullptr, - GEOS_FMT( "{} was expected to be a '{}'.", - child->getDataContext(), LvArray::system::demangleType< T >() ), + GEOS_FMT( "'{}' was expected to be a '{}'.", + getName(), LvArray::system::demangleType< T >() ), BadTypeError, child->getDataContext() ); return *castedChild; } @@ -1124,8 +1122,8 @@ class Group { WrapperBase const * const wrapper = m_wrappers[ key ]; GEOS_THROW_IF( wrapper == nullptr, - "Group " << getDataContext() << " has no wrapper named " << key << std::endl - << dumpWrappersNames(), + "No wrapper named " << key << " found." << std::endl + << dumpWrappersNames(), std::domain_error, getDataContext() ); return *wrapper; @@ -1139,8 +1137,8 @@ class Group { WrapperBase * const wrapper = m_wrappers[ key ]; GEOS_THROW_IF( wrapper == nullptr, - "Group " << getDataContext() << " has no wrapper named " << key << std::endl - << dumpWrappersNames(), + "No wrapper named " << key << " found." << std::endl + << dumpWrappersNames(), std::domain_error, getDataContext() ); return *wrapper; @@ -1364,7 +1362,7 @@ class Group Group & getParent() { GEOS_THROW_IF( m_parent == nullptr, - "Group at " << getDataContext() << " does not have a parent.", + "Group does not have a parent.", std::domain_error, getDataContext() ); return *m_parent; } @@ -1375,7 +1373,7 @@ class Group Group const & getParent() const { GEOS_THROW_IF( m_parent == nullptr, - "Group at " << getDataContext() << " does not have a parent.", + "Group does not have a parent.", std::domain_error, getDataContext() ); return *m_parent; } diff --git a/src/coreComponents/events/PeriodicEvent.cpp b/src/coreComponents/events/PeriodicEvent.cpp index 4a5a1c64db5..86d6c85bb81 100644 --- a/src/coreComponents/events/PeriodicEvent.cpp +++ b/src/coreComponents/events/PeriodicEvent.cpp @@ -270,18 +270,16 @@ void PeriodicEvent::validate() const constexpr auto determinesTimeStepSize = ExecutableGroup::TimesteppingBehavior::DeterminesTimeStepSize; GEOS_THROW_IF( m_timeFrequency > 0 && target->getTimesteppingBehavior() == determinesTimeStepSize, - GEOS_FMT( "`{}`: This event targets an object that automatically selects the time " + GEOS_FMT( "This event targets an object that automatically selects the time " "step size. Therefore, `{}` cannot be used here. However, forcing a " "constant time step size can still be achived with `{}`.", - getDataContext(), viewKeyStruct::timeFrequencyString(), - EventBase::viewKeyStruct::forceDtString() ), + viewKeyStruct::timeFrequencyString(), EventBase::viewKeyStruct::forceDtString() ), InputError, getDataContext() ); GEOS_THROW_IF( m_cycleFrequency != 1 && target->getTimesteppingBehavior() == determinesTimeStepSize, - GEOS_FMT( "`{}`: This event targets an object that automatically selects the time " + GEOS_FMT( "This event targets an object that automatically selects the time " "step size. Therefore, `{}` cannot be used here. However, forcing a " "constant time step size can still be achived with `{}`.", - getDataContext(), viewKeyStruct::cycleFrequencyString(), - EventBase::viewKeyStruct::forceDtString() ), + viewKeyStruct::cycleFrequencyString(), EventBase::viewKeyStruct::forceDtString() ), InputError, getDataContext() ); } diff --git a/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp b/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp index 667e2ecc682..9ef74dd88eb 100644 --- a/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp +++ b/src/coreComponents/fieldSpecification/AquiferBoundaryCondition.cpp @@ -115,9 +115,8 @@ AquiferBoundaryCondition::AquiferBoundaryCondition( string const & name, Group * void AquiferBoundaryCondition::postInputInitialization() { GEOS_THROW_IF_LE_MSG( m_permeability, 0.0, - getCatalogName() << " " << getDataContext() << - ": the aquifer permeability cannot be equal to zero or negative", - InputError ); + "The aquifer permeability cannot be equal to zero or negative", + InputError, getDataContext() ); if( m_pressureInfluenceFunctionName.empty() ) { @@ -127,37 +126,31 @@ void AquiferBoundaryCondition::postInputInitialization() { FunctionManager const & functionManager = FunctionManager::getInstance(); GEOS_THROW_IF( !functionManager.hasGroup( m_pressureInfluenceFunctionName ), - getCatalogName() << " " << getDataContext() << - ": the pressure influence table " << m_pressureInfluenceFunctionName << " could not be found", + "The pressure influence table " << m_pressureInfluenceFunctionName << " could not be found", InputError, getDataContext() ); TableFunction const & pressureInfluenceFunction = functionManager.getGroup< TableFunction >( m_pressureInfluenceFunctionName ); GEOS_THROW_IF( pressureInfluenceFunction.getInterpolationMethod() != TableFunction::InterpolationType::Linear, - getCatalogName() << " " << getDataContext() << - ": The interpolation method for the pressure influence function table " << - pressureInfluenceFunction.getDataContext() << + "The interpolation method for the pressure influence function table " << " should be TableFunction::InterpolationType::Linear", - InputError, getDataContext() ); + InputError, pressureInfluenceFunction.getDataContext(), getDataContext() ); } computeTimeConstant(); computeInfluxConstant(); GEOS_THROW_IF_LE_MSG( m_timeConstant, 0.0, - getCatalogName() << " " << getDataContext() << - ": the aquifer time constant is equal to zero or negative, the simulation cannot procede", - InputError ); + "The aquifer time constant is equal to zero or negative, the simulation cannot procede", + InputError, getDataContext() ); GEOS_THROW_IF_LE_MSG( m_influxConstant, 0.0, - getCatalogName() << " " << getDataContext() << - ": the aquifer influx constant is equal to zero or negative, the simulation cannot procede", - InputError ); + "The aquifer influx constant is equal to zero or negative, the simulation cannot procede", + InputError, getDataContext() ); GEOS_THROW_IF_NE_MSG( m_phaseComponentFraction.size(), LvArray::integerConversion< int >( m_phaseComponentNames.size() ), - getCatalogName() << " " << getDataContext() << - ": the sizes of " << viewKeyStruct::aquiferWaterPhaseComponentFractionString() << + "The sizes of " << viewKeyStruct::aquiferWaterPhaseComponentFractionString() << " and " << viewKeyStruct::aquiferWaterPhaseComponentNamesString() << " are inconsistent", - InputError ); + InputError, getDataContext() ); } diff --git a/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp b/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp index b8a9b18923d..4e4fd68e6d8 100644 --- a/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp +++ b/src/coreComponents/fieldSpecification/EquilibriumInitialCondition.cpp @@ -102,14 +102,13 @@ void EquilibriumInitialCondition::postInputInitialization() if( !m_componentFractionVsElevationTableNames.empty() ) { GEOS_THROW_IF( m_componentFractionVsElevationTableNames.size() <= 1, - getCatalogName() << " " << getDataContext() << - ": at least two component names must be specified in " << viewKeyStruct::componentNamesString(), + "At least two component names must be specified in " << viewKeyStruct::componentNamesString(), InputError, getDataContext() ); GEOS_THROW_IF( m_componentFractionVsElevationTableNames.size() != m_componentNames.size(), - getCatalogName() << " " << getDataContext() << ": mismatch between the size of " << + "Mismatch between the size of " << viewKeyStruct::componentNamesString() << " and " << viewKeyStruct::componentFractionVsElevationTableNamesString(), - InputError ); + InputError, getDataContext() ); integer const numberOfComponents = static_cast< integer >(m_componentNames.size()); @@ -117,17 +116,16 @@ void EquilibriumInitialCondition::postInputInitialization() { integer const numberOfContacts = static_cast< integer >(m_phaseContacts.size()); GEOS_THROW_IF( m_initPhaseName.empty() && numberOfContacts == 0, - getCatalogName() << " " << getDataContext() - << ": for a multiphase simulation either the initial phase name must be provided using " - << viewKeyStruct::initPhaseNameString() << " or the phase contact elevations number be provided using " - << viewKeyStruct::phaseContactsString(), - InputError ); + ": for a multiphase simulation either the initial phase name must be provided using " + << viewKeyStruct::initPhaseNameString() << " or the phase contact elevations number be provided using " + << viewKeyStruct::phaseContactsString(), + InputError, getDataContext() ); if( !m_initPhaseName.empty() && 0 < numberOfContacts ) { - GEOS_WARNING( getCatalogName() << " " << getDataContext() - << ": both " << viewKeyStruct::initPhaseNameString() << " and " << viewKeyStruct::phaseContactsString() - << " have been specified. The phase contacts will be ignored and single phase initialisation performed" ); + GEOS_WARNING( "both " << viewKeyStruct::initPhaseNameString() << " and " << viewKeyStruct::phaseContactsString() + << " have been specified. The phase contacts will be ignored and single phase initialisation performed", + getDataContext() ); } // Contacts if provided must be non-decreasing @@ -136,9 +134,8 @@ void EquilibriumInitialCondition::postInputInitialization() for( integer i = 1; i < numberOfContacts; i++ ) { GEOS_THROW_IF( m_phaseContacts[i] - m_phaseContacts[i-1] < -LvArray::NumericLimits< real64 >::epsilon, - getCatalogName() << " " << getDataContext() - << ": The phase contacts must be increasing", - InputError ); + "The phase contacts must be increasing", + InputError, getDataContext() ); } } } @@ -147,20 +144,18 @@ void EquilibriumInitialCondition::postInputInitialization() for( integer ic = 0; ic < numberOfComponents; ++ic ) { GEOS_THROW_IF( m_componentFractionVsElevationTableNames[ic].empty(), - getCatalogName() << " " << getDataContext() << - ": the component fraction vs elevation table name is missing for component " << ic, + "The component fraction vs elevation table name is missing for component " << ic, InputError, getDataContext() ); GEOS_THROW_IF( !m_componentFractionVsElevationTableNames[ic].empty() && !functionManager.hasGroup( m_componentFractionVsElevationTableNames[ic] ), - getCatalogName() << " " << getDataContext() << ": the component fraction vs elevation table " << + "The component fraction vs elevation table " << m_componentFractionVsElevationTableNames[ic] << " could not be found" << " for component " << ic, InputError, getDataContext() ); TableFunction const & compFracTable = functionManager.getGroup< TableFunction >( m_componentFractionVsElevationTableNames[ic] ); GEOS_THROW_IF( compFracTable.getInterpolationMethod() != TableFunction::InterpolationType::Linear, - getCatalogName() << " " << getDataContext() << - ": the interpolation method for the component fraction vs elevation table " << + "The interpolation method for the component fraction vs elevation table " << compFracTable.getName() << " should be TableFunction::InterpolationType::Linear", InputError, getDataContext() ); @@ -171,14 +166,13 @@ void EquilibriumInitialCondition::postInputInitialization() { GEOS_THROW_IF( !functionManager.hasGroup( m_temperatureVsElevationTableName ), - getCatalogName() << " " << getDataContext() << ": the temperature vs elevation table " << + "The temperature vs elevation table " << m_temperatureVsElevationTableName << " could not be found", InputError, getDataContext() ); TableFunction const & tempTable = functionManager.getGroup< TableFunction >( m_temperatureVsElevationTableName ); GEOS_THROW_IF( tempTable.getInterpolationMethod() != TableFunction::InterpolationType::Linear, - getCatalogName() << " " << getDataContext() << - ": The interpolation method for the temperature vs elevation table " << tempTable.getName() << + "The interpolation method for the temperature vs elevation table " << tempTable.getName() << " should be TableFunction::InterpolationType::Linear", InputError, getDataContext() ); } @@ -198,8 +192,7 @@ void EquilibriumInitialCondition::initializePreSubGroups() TableFunction const & compFracTable = functionManager.getGroup< TableFunction >( m_componentFractionVsElevationTableNames[ic] ); arrayView1d< real64 const > compFracValues = compFracTable.getValues(); GEOS_THROW_IF( compFracValues.size() <= 1, - getCatalogName() << " " << getDataContext() << - ": the component fraction vs elevation table " << compFracTable.getName() << + "The component fraction vs elevation table " << compFracTable.getName() << " must contain at least two values", InputError, getDataContext() ); @@ -207,8 +200,7 @@ void EquilibriumInitialCondition::initializePreSubGroups() if( ic >= 1 ) { GEOS_THROW_IF( tableSizes[ic] != tableSizes[ic-1], - getCatalogName() << " " << getDataContext() << - ": all the component fraction vs elevation tables must contain the same number of values", + "All the component fraction vs elevation tables must contain the same number of values", InputError, getDataContext() ); } } @@ -229,16 +221,14 @@ void EquilibriumInitialCondition::initializePreSubGroups() if( ic >= 1 ) { GEOS_THROW_IF( !isZero( elevation[ic][i] - elevation[ic-1][i] ), - getCatalogName() << " " << getDataContext() << - ": the elevation values must be the same in all the component vs elevation tables", + "The elevation values must be the same in all the component vs elevation tables", InputError, getDataContext() ); } if( ic == m_componentNames.size() - 1 ) { GEOS_THROW_IF( !isZero( sumCompFrac[i] - 1 ), - getCatalogName() << " " << getDataContext() << - ": at a given elevation, the component fraction sum must be equal to one", + "At a given elevation, the component fraction sum must be equal to one", InputError, getDataContext() ); } } diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index f725a44fafd..6697c275715 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -203,7 +203,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c GEOS_FMT( "No set are available for the targeted `{}`", FieldSpecificationBase::viewKeyStruct::objectPathString() ) ); - GEOS_THROW( errorMessageBuilder.str(), InputError ); + GEOS_THROW( errorMessageBuilder.str(), InputError, getDataContext() ); } if( !setTypesMap.empty() && MpiWrapper::commRank() == 0 ) @@ -254,7 +254,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c case FieldSpecificationBase::SetErrorMode::silent: break; case FieldSpecificationBase::SetErrorMode::error: - GEOS_THROW( message.str(), InputError ); + GEOS_THROW( message.str(), InputError, getDataContext() ); break; case FieldSpecificationBase::SetErrorMode::warning: if( m_isSurfaceGenerationCase ) @@ -288,7 +288,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c GEOS_FMT( "No available field in {}.", fs.getObjectPath() ) ); - GEOS_THROW( errorMessageBuilder.str(), InputError ); + GEOS_THROW( errorMessageBuilder.str(), InputError, getDataContext() ); } } ); } diff --git a/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp b/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp index 11f1b683b04..220630d1761 100644 --- a/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp +++ b/src/coreComponents/fieldSpecification/PerfectlyMatchedLayer.cpp @@ -79,16 +79,14 @@ PerfectlyMatchedLayer::PerfectlyMatchedLayer( string const & name, Group * const void PerfectlyMatchedLayer::postInputInitialization() { GEOS_THROW_IF( (m_xMax[0]1), - getCatalogName() << " " << getDataContext() << " " - << viewKeyStruct::reflectivityString() - << " must satisfy 0 < reflectivity <= 1", + viewKeyStruct::reflectivityString() + << " must satisfy 0 < reflectivity <= 1", InputError, getDataContext() ); GEOS_LOG_RANK_0_IF( (m_xMin[0]( getDirection() ) < 1e-20, - getDataContext() << ": " << viewKeyStruct::directionString() << " is required for " << - viewKeyStruct::tractionTypeString() << " = " << TractionType::vector << + viewKeyStruct::directionString() << " is required for " << + viewKeyStruct::tractionTypeString() << " = " << + EnumStrings< TractionType >::toString( TractionType::vector ) << ", but appears to be unspecified", getDataContext() ); } else { GEOS_LOG_RANK_0_IF( LvArray::tensorOps::l2Norm< 3 >( getDirection() ) > 1e-20, - getDataContext() << ": " << viewKeyStruct::directionString() << " is not required unless " << - viewKeyStruct::tractionTypeString() << " = " << TractionType::vector << + viewKeyStruct::directionString() << " is not required unless " << + viewKeyStruct::tractionTypeString() << " = " << + EnumStrings< TractionType >::toString( TractionType::vector ) << ", but appears to be specified" ); } bool const inputStressRead = getWrapper< R2SymTensor >( viewKeyStruct::inputStressString() ).getSuccessfulReadFromInput(); GEOS_LOG_RANK_0_IF( inputStressRead && m_tractionType != TractionType::stress, - getDataContext() << ": " << viewKeyStruct::inputStressString() << " is specified, but " << - viewKeyStruct::tractionTypeString() << " != " << TractionType::stress << + viewKeyStruct::inputStressString() << " is specified, but " << + viewKeyStruct::tractionTypeString() << " != " << + EnumStrings< TractionType >::toString( TractionType::stress ) << ", so value of " << viewKeyStruct::inputStressString() << " is unused." ); GEOS_ERROR_IF( !inputStressRead && m_tractionType == TractionType::stress, - getDataContext() << ": " << viewKeyStruct::tractionTypeString() << " = " << TractionType::stress << + viewKeyStruct::tractionTypeString() << " = " << + EnumStrings< TractionType >::toString( TractionType::stress ) << ", but " << viewKeyStruct::inputStressString() << " is not specified.", getDataContext() ); diff --git a/src/coreComponents/fileIO/Outputs/MemoryStatsOutput.cpp b/src/coreComponents/fileIO/Outputs/MemoryStatsOutput.cpp index f35719d27d3..eba33964133 100644 --- a/src/coreComponents/fileIO/Outputs/MemoryStatsOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/MemoryStatsOutput.cpp @@ -49,8 +49,8 @@ void MemoryStatsOutput::postInputInitialization() { static bool isInstanceInitialized = false; GEOS_ERROR_IF( isInstanceInitialized, - GEOS_FMT( "{}: Multiple instances of {} are not supported, please remove this one.", - getDataContext(), catalogName() ) ); + GEOS_FMT( "Multiple instances of {} are not supported, please remove this one.", + catalogName() ), getDataContext() ); isInstanceInitialized = true; auto & memLogging = MemoryLogging::getInstance(); diff --git a/src/coreComponents/fileIO/Outputs/SiloOutput.cpp b/src/coreComponents/fileIO/Outputs/SiloOutput.cpp index 7d93495048f..429ed6ece39 100644 --- a/src/coreComponents/fileIO/Outputs/SiloOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/SiloOutput.cpp @@ -97,23 +97,22 @@ void SiloOutput::postInputInitialization() string const onlyPlotSpecifiedFieldNamesString = viewKeysStruct::onlyPlotSpecifiedFieldNames; GEOS_THROW_IF( ( m_onlyPlotSpecifiedFieldNames != 0 ) && m_fieldNames.empty(), - GEOS_FMT( "{} `{}`: the flag `{}` is different from zero, but `{}` is empty, which is inconsistent", - catalogName(), getDataContext(), + GEOS_FMT( "The flag `{}` is different from zero, but `{}` is empty, which is inconsistent", onlyPlotSpecifiedFieldNamesString, fieldNamesString ), InputError, getDataContext() ); GEOS_LOG_RANK_0_IF( !m_fieldNames.empty() && ( m_onlyPlotSpecifiedFieldNames != 0 ), GEOS_FMT( - "{} `{}`: found {} fields to plot in `{}`. These fields will be output regardless" + "`{}`: found {} fields to plot in `{}`. These fields will be output regardless" " of the `plotLevel` specified by the user. No other field will be output.", - catalogName(), getDataContext(), + getDataContext(), std::to_string( m_fieldNames.size() ), fieldNamesString ) ); GEOS_LOG_RANK_0_IF( !m_fieldNames.empty() && ( m_onlyPlotSpecifiedFieldNames == 0 ), GEOS_FMT( - "{} `{}`: found {} fields to plot in `{}`, in addition to all fields with " + "`{}`: found {} fields to plot in `{}`, in addition to all fields with " "`plotLevel` smaller or equal to {}.", - catalogName(), getDataContext(), std::to_string( m_fieldNames.size() ), + getDataContext(), std::to_string( m_fieldNames.size() ), fieldNamesString, m_plotLevel ) ); } diff --git a/src/coreComponents/fileIO/Outputs/VTKOutput.cpp b/src/coreComponents/fileIO/Outputs/VTKOutput.cpp index 5f617298ad5..b9c245340fe 100644 --- a/src/coreComponents/fileIO/Outputs/VTKOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/VTKOutput.cpp @@ -109,37 +109,35 @@ void VTKOutput::postInputInitialization() m_writer.setOnlyPlotSpecifiedFieldNamesFlag( m_onlyPlotSpecifiedFieldNames ); GEOS_ERROR_IF_LT_MSG( m_numberOfTargetProcesses, 1, - GEOS_FMT( "{}: processes count cannot be less than 1.", - getWrapperDataContext( viewKeysStruct::numberOfTargetProcesses ) ) ); + "processes count cannot be less than 1.", + getWrapperDataContext( viewKeysStruct::numberOfTargetProcesses )); GEOS_ERROR_IF_GT_MSG( m_numberOfTargetProcesses, MpiWrapper::commSize(), - GEOS_FMT( "{}: processes count cannot exceed the launched ranks count.", - getWrapperDataContext( viewKeysStruct::numberOfTargetProcesses ) ) ); + "processes count cannot exceed the launched ranks count.", + getWrapperDataContext( viewKeysStruct::numberOfTargetProcesses )); m_writer.setNumberOfTargetProcesses( m_numberOfTargetProcesses ); string const fieldNamesString = viewKeysStruct::fieldNames; string const onlyPlotSpecifiedFieldNamesString = viewKeysStruct::onlyPlotSpecifiedFieldNames; GEOS_THROW_IF( ( m_onlyPlotSpecifiedFieldNames != 0 ) && m_fieldNames.empty(), - GEOS_FMT( "{} `{}`: the flag `{}` is different from zero, but `{}` is empty, which is inconsistent", - catalogName(), getDataContext(), + GEOS_FMT( "The flag `{}` is different from zero, but `{}` is empty, which is inconsistent", onlyPlotSpecifiedFieldNamesString, fieldNamesString ), InputError, getDataContext() ); GEOS_LOG_RANK_0_IF( !m_fieldNames.empty() && ( m_onlyPlotSpecifiedFieldNames != 0 ), GEOS_FMT( - "{} `{}`: found {} fields to plot in `{}`. These fields will be output regardless of the `plotLevel` specified by the user. No other field will be output.", - catalogName(), getDataContext(), + "`{}`: found {} fields to plot in `{}`. These fields will be output regardless of the `plotLevel` specified by the user. No other field will be output.", + getDataContext(), std::to_string( m_fieldNames.size() ), fieldNamesString ) ); GEOS_LOG_RANK_0_IF( !m_fieldNames.empty() && ( m_onlyPlotSpecifiedFieldNames == 0 ), GEOS_FMT( - "{} `{}`: found {} fields to plot in `{}`, in addition to all fields with `plotLevel` smaller or equal to {}.", - catalogName(), getDataContext(), + "`{}`: found {} fields to plot in `{}`, in addition to all fields with `plotLevel` smaller or equal to {}.", + getDataContext(), std::to_string( m_fieldNames.size() ), fieldNamesString, m_plotLevel ) ); GEOS_ERROR_IF( m_writeFaceElementsAs3D, - GEOS_FMT( "{} `{}`: 3D vtk plot of faceElements is not yet supported.", - catalogName(), getDataContext() ), + "3D vtk plot of faceElements is not yet supported.", getDataContext() ); } diff --git a/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp b/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp index be6a5716b43..b4cbabd85b1 100644 --- a/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp +++ b/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp @@ -63,7 +63,7 @@ FiniteElementDiscretization::~FiniteElementDiscretization() void FiniteElementDiscretization::postInputInitialization() { GEOS_ERROR_IF( m_useVem < 0 || m_useVem > 1, - getDataContext() << ": The flag useVirtualElements can be either 0 or 1", + "The flag useVirtualElements can be either 0 or 1", getDataContext() ); } @@ -193,7 +193,8 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #endif default: { - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not have an associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not have an associated element formulation.", + getDataContext() ); } } return {}; @@ -206,7 +207,7 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #if !defined( GEOS_USE_HIP ) case ElementType::Hexahedron: GEOS_ERROR_IF( m_formulation != Formulation::SEM, - getDataContext() << ": Element type Hexahedron with order 2 available" << + "Element type Hexahedron with order 2 available" << " only when using the Spectral Element Method", getDataContext() ); return std::make_unique< Q2_Hexahedron_Lagrange_GaussLobatto >(); @@ -215,13 +216,15 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #endif case ElementType::Tetrahedron: GEOS_ERROR_IF( m_formulation != Formulation::DG, - getDataContext() << ": Element type Tetrahedron with order 2 available" << - " only when using the Discontinuous Galerkin Method" ); + "Element type Tetrahedron with order 2 available" << + " only when using the Discontinuous Galerkin Method", + getDataContext() ); return std::make_unique< BB2_Tetrahedron >(); default: { - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not" << - " have an associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not" << + " have an associated element formulation.", + getDataContext() ); } } return {}; @@ -234,7 +237,7 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #if !defined( GEOS_USE_HIP ) case ElementType::Hexahedron: GEOS_ERROR_IF( m_formulation != Formulation::SEM, - getDataContext() << ": Element type Hexahedron with order 3 available" << + "Element type Hexahedron with order 3 available" << " only when using the Spectral Element Method", getDataContext() ); return std::make_unique< Q3_Hexahedron_Lagrange_GaussLobatto >(); @@ -243,13 +246,15 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #endif case ElementType::Tetrahedron: GEOS_ERROR_IF( m_formulation != Formulation::DG, - getDataContext() << ": Element type Tetrahedron with order 3 available" << - " only when using the Discontinuous Galerkin Method" ); + "Element type Tetrahedron with order 3 available" << + " only when using the Discontinuous Galerkin Method", + getDataContext() ); return std::make_unique< BB3_Tetrahedron >(); default: { - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not" << - " have an associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not" << + " have an associated element formulation.", + getDataContext() ); } } return {}; @@ -262,7 +267,7 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #if !defined( GEOS_USE_HIP ) case ElementType::Hexahedron: GEOS_ERROR_IF( m_formulation != Formulation::SEM, - getDataContext() << ": Element type Hexahedron with order 4 available only" << + "Element type Hexahedron with order 4 available only" << " when using the Spectral Element Method", getDataContext() ); return std::make_unique< Q4_Hexahedron_Lagrange_GaussLobatto >(); @@ -271,13 +276,15 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #endif //case ElementType::Tetrahedron: // GEOS_ERROR_IF( m_formulation != Formulation::DG, - // getDataContext() << ": Element type Tetrahedron with order 4 available" << - // " only when using the Discontinuous Galerkin Method" ); + // << "Element type Tetrahedron with order 4 available" << + // " only when using the Discontinuous Galerkin Method", + // getDataContext() ); // //return std::make_unique< BB4_Tetrahedron >(); default: { - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not have" << - " an associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not have" << + " an associated element formulation.", + getDataContext() ); } } return {}; @@ -290,7 +297,7 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #if !defined( GEOS_USE_HIP ) case ElementType::Hexahedron: GEOS_ERROR_IF( m_formulation != Formulation::SEM, - getDataContext() << ": Element type Hexahedron with order 5 available only" << + "Element type Hexahedron with order 5 available only" << " when using the Spectral Element Method", getDataContext() ); return std::make_unique< Q5_Hexahedron_Lagrange_GaussLobatto >(); @@ -299,19 +306,21 @@ FiniteElementDiscretization::factory( ElementType const parentElementShape ) con #endif //case ElementType::Tetrahedron: // GEOS_ERROR_IF( m_formulation != Formulation::DG, - // getDataContext() << ": Element type Tetrahedron with order 5 available" << + // getDataContext() << "Element type Tetrahedron with order 5 available" << // " only when using the Discontinuous Galerkin Method" ); // //return std::make_unique< BB5_Tetrahedron >(); default: { - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not have" << - " an associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not have" << + " an associated element formulation.", + getDataContext() ); } } return {}; } - GEOS_ERROR( getDataContext() << ": Element type " << parentElementShape << " does not have an" << - " associated element formulation." ); + GEOS_ERROR( "Element type " << parentElementShape << " does not have an" << + " associated element formulation.", + getDataContext() ); return {}; } diff --git a/src/coreComponents/finiteVolume/HybridMimeticDiscretization.cpp b/src/coreComponents/finiteVolume/HybridMimeticDiscretization.cpp index f9740cbb547..9c6a3acc37f 100644 --- a/src/coreComponents/finiteVolume/HybridMimeticDiscretization.cpp +++ b/src/coreComponents/finiteVolume/HybridMimeticDiscretization.cpp @@ -90,7 +90,7 @@ HybridMimeticDiscretization::factory( string const & mimeticInnerProductType ) c } else { - GEOS_ERROR( getDataContext() << ": Key value of "<< mimeticInnerProductType <<" does not have an associated mimetic inner product." ); + GEOS_ERROR( "Key value of "<< mimeticInnerProductType <<" does not have an associated mimetic inner product.", getDataContext() ); } return rval; } diff --git a/src/coreComponents/functions/MultivariableTableFunction.cpp b/src/coreComponents/functions/MultivariableTableFunction.cpp index cd7eca72b66..f80399715bc 100644 --- a/src/coreComponents/functions/MultivariableTableFunction.cpp +++ b/src/coreComponents/functions/MultivariableTableFunction.cpp @@ -35,7 +35,7 @@ MultivariableTableFunction::MultivariableTableFunction( const string & name, void MultivariableTableFunction::initializeFunctionFromFile( string const & filename ) { std::ifstream file( filename.c_str() ); - GEOS_THROW_IF( !file, catalogName() << " " << getDataContext() << ": could not read input file " << filename, + GEOS_THROW_IF( !file, "Could not read input file " << filename, InputError, getDataContext() ); integer numDims, numOps; @@ -47,17 +47,21 @@ void MultivariableTableFunction::initializeFunctionFromFile( string const & file file >> numDims; - GEOS_THROW_IF( !file, "Can`t read number of table dimensions", InputError ); + GEOS_THROW_IF( !file, "Can`t read number of table dimensions", InputError, getDataContext() ); file >> numOps; - GEOS_THROW_IF( !file, "Can`t read number of interpolatored operators", InputError ); + GEOS_THROW_IF( !file, "Can`t read number of interpolatored operators", InputError, getDataContext() ); // assume no more than 10 dimensions - GEOS_THROW_IF_LT_MSG( numDims, 1, catalogName() << " " << getDataContext() << ": positive integer value expected", InputError ); - GEOS_THROW_IF_GT_MSG( numDims, 10, catalogName() << " " << getDataContext() << ": maximum 10 dimensions expected", InputError ); + GEOS_THROW_IF_LT_MSG( numDims, 1, "Positive integer value expected", + InputError, getDataContext() ); + GEOS_THROW_IF_GT_MSG( numDims, 10, "Maximum 10 dimensions expected", + InputError, getDataContext() ); // assume no more than 100 operators - GEOS_THROW_IF_LT_MSG( numOps, 1, catalogName() << " " << getDataContext() << ": positive integer value expected", InputError ); - GEOS_THROW_IF_GT_MSG( numOps, 100, catalogName() << " " << getDataContext() << ": maximum 100 operators expected", InputError ); + GEOS_THROW_IF_LT_MSG( numOps, 1, "Positive integer value expected", + InputError, getDataContext() ); + GEOS_THROW_IF_GT_MSG( numOps, 100, "Maximum 100 operators expected", + InputError, getDataContext() ); axisMinimums.resize( numDims ); axisMaximums.resize( numDims ); @@ -68,16 +72,18 @@ void MultivariableTableFunction::initializeFunctionFromFile( string const & file for( integer i = 0; i < numDims; i++ ) { file >> axisPoints[i]; - GEOS_THROW_IF( !file, catalogName() << " " << getDataContext() << ": can`t read the number of points for axis " + std::to_string( i ), + GEOS_THROW_IF( !file, "Can`t read the number of points for axis " + std::to_string( i ), InputError, getDataContext() ); - GEOS_THROW_IF_LE_MSG( axisPoints[i], 1, catalogName() << " " << getDataContext() << ": minimum 2 discretization point per axis are expected", InputError ); + GEOS_THROW_IF_LE_MSG( axisPoints[i], 1, " Minimum 2 discretization point per axis are expected", + InputError, getDataContext() ); file >> axisMinimums[i]; - GEOS_THROW_IF( !file, catalogName() << " " << getDataContext() << ": can`t read minimum value for axis " + std::to_string( i ), + GEOS_THROW_IF( !file, "Can`t read minimum value for axis " + std::to_string( i ), InputError, getDataContext() ); file >> axisMaximums[i]; - GEOS_THROW_IF( !file, catalogName() << " " << getDataContext() << ": can`t read maximum value for axis " + std::to_string( i ), + GEOS_THROW_IF( !file, "Can`t read maximum value for axis " + std::to_string( i ), InputError, getDataContext() ); - GEOS_THROW_IF_LT_MSG( axisMaximums[i], axisMinimums[i], catalogName() << " " << getDataContext() << ": maximum axis value is expected to be larger than minimum", InputError ); + GEOS_THROW_IF_LT_MSG( axisMaximums[i], axisMinimums[i], "Maximum axis value is expected to be larger than minimum", + InputError, getDataContext() ); numPointsTotal *= axisPoints[i]; } @@ -86,10 +92,10 @@ void MultivariableTableFunction::initializeFunctionFromFile( string const & file real64 pointStorageMemoryLimitGB = 1; GEOS_THROW_IF_GT_MSG( numPointsTotal * numOps, pointStorageMemoryLimitGB * 1024 * 1024 * 1024 / 8, - catalogName() << " " << getDataContext() << - ": point storage size exceeds " + std::to_string( pointStorageMemoryLimitGB ) + + "Point storage size exceeds " + std::to_string( pointStorageMemoryLimitGB ) + " Gb, please reduce number of points", - InputError ); + + InputError, getDataContext() ); m_pointData.resize( numPointsTotal * numOps ); @@ -99,14 +105,14 @@ void MultivariableTableFunction::initializeFunctionFromFile( string const & file for( auto j = 0; j < numOps; j++ ) { file >> m_pointData[i * numOps + j]; - GEOS_THROW_IF( !file, catalogName() << " " << getDataContext() << ": table file is shorter than expected", + GEOS_THROW_IF( !file, "Table file is shorter than expected", InputError, getDataContext() ); } } real64 value; file >> value; - GEOS_THROW_IF( file, catalogName() << " " << getDataContext() << ": table file is longer than expected", + GEOS_THROW_IF( file, "Table file is longer than expected", InputError, getDataContext() ); file.close(); @@ -167,15 +173,15 @@ void MultivariableTableFunction::initializeFunction() // check input - GEOS_THROW_IF_NE_MSG( m_numDims, m_axisMinimums.size(), catalogName() << " " << getDataContext() << - ": single minimum value is expected for each of " + std::to_string( m_numDims ) + "dimensions", - InputError ); - GEOS_THROW_IF_NE_MSG( m_numDims, m_axisMaximums.size(), catalogName() << " " << getDataContext() << - ": single maxumum value is expected for each of " + std::to_string( m_numDims ) + "dimensions", - InputError ); - GEOS_THROW_IF_NE_MSG( m_numDims, m_axisPoints.size(), catalogName() << " " << getDataContext() << - "single number is expected for each of " + std::to_string( m_numDims ) + "dimensions", - InputError ); + GEOS_THROW_IF_NE_MSG( m_numDims, m_axisMinimums.size(), + "Single minimum value is expected for each of " + std::to_string( m_numDims ) + "dimensions", + InputError, getDataContext() ); + GEOS_THROW_IF_NE_MSG( m_numDims, m_axisMaximums.size(), + "Single maxumum value is expected for each of " + std::to_string( m_numDims ) + "dimensions", + InputError, getDataContext() ); + GEOS_THROW_IF_NE_MSG( m_numDims, m_axisPoints.size(), + "Single number is expected for each of " + std::to_string( m_numDims ) + "dimensions", + InputError, getDataContext() ); m_axisSteps.resize( m_numDims ); m_axisStepInvs.resize( m_numDims ); @@ -210,17 +216,17 @@ void MultivariableTableFunction::initializeFunction() // check is point data size is correct - GEOS_THROW_IF_NE_MSG( globalIndex( numTablePoints ) * m_numOps, m_pointData.size(), catalogName() << " " << getDataContext() << - ": table values array is expected to have length of " + std::to_string( globalIndex( numTablePoints ) * m_numOps ), InputError ); + GEOS_THROW_IF_NE_MSG( globalIndex( numTablePoints ) * m_numOps, m_pointData.size(), + "Table values array is expected to have length of " + std::to_string( globalIndex( numTablePoints ) * m_numOps ), + InputError, getDataContext() ); // lets limit the hypercube storage size with 16 Gb real64 hypercubeStorageMemoryLimitGB = 16; GEOS_THROW_IF_GT_MSG( numTableHypercubes * m_numVerts * m_numOps, hypercubeStorageMemoryLimitGB * 1024 * 1024 * 1024 / 8, - catalogName() << " " << getDataContext() << - ": hypercube storage size exceeds " + std::to_string( hypercubeStorageMemoryLimitGB ) + + "Hypercube storage size exceeds " + std::to_string( hypercubeStorageMemoryLimitGB ) + " Gb, please reduce number of points", - InputError ); + InputError, getDataContext() ); // initialize hypercube data storage m_hypercubeData.resize( numTableHypercubes * m_numVerts * m_numOps ); diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index 7ee6c4a3490..e5cc16fab06 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -83,7 +83,7 @@ void TableFunction::readFile( string const & filename, array1d< real64 > & targe } catch( std::runtime_error const & e ) { - GEOS_THROW( GEOS_FMT( "{} {}: {}", catalogName(), getDataContext(), e.what() ), InputError ); + GEOS_THROW( e.what(), InputError, getDataContext() ); } } @@ -103,8 +103,7 @@ void TableFunction::setTableCoordinates( array1d< real64_array > const & coordin for( localIndex j = 1; j < coordinates[i].size(); ++j ) { GEOS_THROW_IF( coordinates[i][j] - coordinates[i][j-1] <= 0, - GEOS_FMT( "{} {}: coordinates must be strictly increasing, but axis {} is not", - catalogName(), getDataContext(), i ), + GEOS_FMT( "coordinates must be strictly increasing, but axis {} is not", i ), InputError, getDataContext() ); } m_coordinates.appendArray( coordinates[i].begin(), coordinates[i].end() ); @@ -132,9 +131,8 @@ void TableFunction::initializeFunction() // 1D Table m_coordinates.appendArray( m_tableCoordinates1D.begin(), m_tableCoordinates1D.end() ); GEOS_THROW_IF_NE_MSG( m_tableCoordinates1D.size(), m_values.size(), - GEOS_FMT( "{} {}: 1D table function coordinates and values must have the same length", - catalogName(), getDataContext() ), - InputError ); + "1D table function coordinates and values must have the same length", + InputError, getDataContext() ); } else { @@ -165,17 +163,15 @@ void TableFunction::reInitializeFunction() for( localIndex j = 1; j < m_coordinates[ii].size(); ++j ) { GEOS_THROW_IF( m_coordinates[ii][j] - m_coordinates[ii][j-1] <= 0, - GEOS_FMT( "{} {}: coordinates must be strictly increasing, but axis {} is not", - catalogName(), getDataContext(), ii ), + GEOS_FMT( "Coordinates must be strictly increasing, but axis {} is not", ii ), InputError, getDataContext() ); } } if( m_coordinates.size() > 0 && !m_values.empty() ) // coordinates and values have been set { GEOS_THROW_IF_NE_MSG( increment, m_values.size(), - GEOS_FMT( "{} {}: number of values does not match total number of table coordinates", - catalogName(), getDataContext() ), - InputError ); + "Number of values does not match total number of table coordinates", + InputError, getDataContext() ); } // Create the kernel wrapper @@ -185,14 +181,13 @@ void TableFunction::reInitializeFunction() void TableFunction::checkCoord( real64 const coord, localIndex const dim ) const { GEOS_THROW_IF( dim >= m_coordinates.size() || dim < 0, - GEOS_FMT( "{}: The {} dimension ( no. {} ) doesn't exist in the table.", - getDataContext(), units::getDescription( getDimUnit( dim ) ), dim ), + GEOS_FMT( "The {} dimension ( no. {} ) doesn't exist in the table.", + units::getDescription( getDimUnit( dim ) ), dim ), SimulationError, getDataContext() ); real64 const lowerBound = m_coordinates[dim][0]; real64 const upperBound = m_coordinates[dim][m_coordinates.sizeOfArray( dim ) - 1]; GEOS_THROW_IF( coord > upperBound || coord < lowerBound, - GEOS_FMT( "{}: Requested {} is out of the table bounds ( lower bound: {} -> upper bound: {} ).", - getDataContext(), + GEOS_FMT( "Requested {} is out of the table bounds ( lower bound: {} -> upper bound: {} ).", units::formatValue( coord, getDimUnit( dim ) ), units::formatValue( lowerBound, getDimUnit( dim ) ), units::formatValue( upperBound, getDimUnit( dim ) ) ), @@ -214,8 +209,9 @@ real64 TableFunction::evaluate( real64 const * const input ) const real64 TableFunction::getCoord( real64 const * const input, localIndex const dim, InterpolationType interpolationMethod ) const { GEOS_ASSERT_MSG( interpolationMethod != InterpolationType::Linear, - GEOS_FMT( "{}: TableFunction::getCoord should not be called with {} interpolation method", - getDataContext(), EnumStrings< InterpolationType >::toString( interpolationMethod ))); + GEOS_FMT( "TableFunction::getCoord should not be called with {} interpolation method", + EnumStrings< InterpolationType >::toString( interpolationMethod )), + getDataContext() ); GEOS_ASSERT( dim >= 0 && dim < m_coordinates.size() ); return m_kernelWrapper.getCoord( input, dim, interpolationMethod ); } diff --git a/src/coreComponents/integrationTests/dataRepositoryTests/testGroupPath.cpp b/src/coreComponents/integrationTests/dataRepositoryTests/testGroupPath.cpp index 3927a3812b4..4ee2907ca92 100644 --- a/src/coreComponents/integrationTests/dataRepositoryTests/testGroupPath.cpp +++ b/src/coreComponents/integrationTests/dataRepositoryTests/testGroupPath.cpp @@ -107,7 +107,7 @@ TEST( testGroupPath, testGlobalPaths ) catch( const std::domain_error & e ) { static constexpr auto expectedMsg = "***** Error cause: child == nullptr\n" - "***** Rank 0: Group Mesh (CodeIncludedXML0, l.10) has no child named mesh2\n" + "***** Rank 0: No child named mesh2 found.\n" "The children of Mesh are: { mesh1 }"; // checks if the exception contains the expected message GEOS_ERROR_IF_EQ_MSG( string( e.what() ).find( expectedMsg ), string::npos, diff --git a/src/coreComponents/integrationTests/meshTests/testElementRegions.cpp b/src/coreComponents/integrationTests/meshTests/testElementRegions.cpp index 791a0a8b949..bc50121e685 100644 --- a/src/coreComponents/integrationTests/meshTests/testElementRegions.cpp +++ b/src/coreComponents/integrationTests/meshTests/testElementRegions.cpp @@ -18,6 +18,7 @@ // Source includes #include "codingUtilities/UnitTestUtilities.hpp" +#include "common/DataTypes.hpp" #include "dataRepository/xmlWrapper.hpp" #include "mainInterface/GeosxState.hpp" #include "mainInterface/initialization.hpp" @@ -102,13 +103,16 @@ TEST_P( ElementRegionTestFixture, testVTKImportRegionSyntaxes ) } catch( InputError const & e ) { - string const expStr = e.what(); - for( auto const & str : testCase.stringsToMention ) + std::vector< string > strEq{ + "***** Rank 0: No cellBlock name is satisfying the qualifier 'helloWorld'." + "Available cellBlock list: { 1, 2, 5, 6 }" + "Available region attribute list: { 1_hexahedra, 1_pyramids, 1_tetrahedra, 2_hexahedra, 2_pyramids, 2_tetrahedra, 5_hexahedra, 5_pyramids, 5_tetrahedra, 6_hexahedra, 6_pyramids, 6_tetrahedra }" + }; + for( auto const & str : strEq ) { - bool isExceptionContainingStr = expStr.find( str ) != string::npos; - EXPECT_TRUE( isExceptionContainingStr ) << GEOS_FMT( "Test case '{}' exception did not mention the string '{}'. Exception string:\n{}", - testCase.name, str, e.what() ); + EXPECT_TRUE( string( e.what()).find( str ) ); } + } catch( std::exception const & e ) { diff --git a/src/coreComponents/mesh/CellElementRegion.cpp b/src/coreComponents/mesh/CellElementRegion.cpp index fe669ed1864..940e6bae5fe 100644 --- a/src/coreComponents/mesh/CellElementRegion.cpp +++ b/src/coreComponents/mesh/CellElementRegion.cpp @@ -49,17 +49,15 @@ CellElementRegion::~CellElementRegion() void CellElementRegion::generateMesh( Group const & cellBlocks ) { - GEOS_THROW_IF( m_cellBlockNames.empty(), - GEOS_FMT( "{}: No cellBlock selected in this region.", - getDataContext() ), + GEOS_THROW_IF( m_cellBlockNames.empty(), "No cellBlock selected in this region.", InputError, getDataContext() ); Group & subRegions = this->getGroup( viewKeyStruct::elementSubRegions() ); for( string const & cbName : m_cellBlockNames ) { CellBlockABC const * cellBlock = cellBlocks.getGroupPointer< CellBlockABC >( cbName ); GEOS_THROW_IF( cellBlock == nullptr, - GEOS_FMT( "{}: No cellBlock named '{}' found.\nAvailable cellBlock list: {{ {} }}\nNo CellElementRegionSelector has been used to verify the cellBlock selection.", - getDataContext(), cbName, stringutilities::join( m_cellBlockNames, ", " ) ), + GEOS_FMT( "No cellBlock named '{}' found.\nAvailable cellBlock list: {{ {} }}\nNo CellElementRegionSelector has been used to verify the cellBlock selection.", + cbName, stringutilities::join( m_cellBlockNames, ", " ) ), InputError, getDataContext() ); // subRegion name must be the same as the cell-block (so we can match them and reference them in errors). diff --git a/src/coreComponents/mesh/CellElementRegionSelector.cpp b/src/coreComponents/mesh/CellElementRegionSelector.cpp index de70294a1ef..65fc5597362 100644 --- a/src/coreComponents/mesh/CellElementRegionSelector.cpp +++ b/src/coreComponents/mesh/CellElementRegionSelector.cpp @@ -63,9 +63,8 @@ CellElementRegionSelector::getMatchingCellblocks( CellElementRegion const & regi } GEOS_THROW_IF( !matching, - GEOS_FMT( "{}: No cellBlock name is satisfying the qualifier '{}'.\n" + GEOS_FMT( "No cellBlock name is satisfying the qualifier '{}'.\n" "Available cellBlock list: {{ {} }}\nAvailable region attribute list: {{ {} }}", - region.getWrapperDataContext( ViewKeys::sourceCellBlockNamesString() ), matchPattern, stringutilities::joinLambda( m_regionAttributesOwners, ", ", []( auto pair ) { return pair->first; } ), @@ -83,8 +82,7 @@ CellElementRegionSelector::verifyRequestedCellBlocks( CellElementRegion const & { // if cell block does not exist in the mesh GEOS_THROW_IF( m_cellBlocksOwners.count( requestedCellBlockName ) == 0, - GEOS_FMT( "{}: No cellBlock named '{}'.\nAvailable cellBlock list: {{ {} }}", - region.getWrapperDataContext( ViewKeys::sourceCellBlockNamesString() ), + GEOS_FMT( "No cellBlock named '{}'.\nAvailable cellBlock list: {{ {} }}", requestedCellBlockName, stringutilities::joinLambda( m_cellBlocksOwners, ", ", []( auto pair ) { return pair->first; } ) ), diff --git a/src/coreComponents/mesh/CellElementSubRegion.cpp b/src/coreComponents/mesh/CellElementSubRegion.cpp index 95b2ac8b269..ff29ba81df3 100644 --- a/src/coreComponents/mesh/CellElementSubRegion.cpp +++ b/src/coreComponents/mesh/CellElementSubRegion.cpp @@ -397,13 +397,13 @@ void CellElementSubRegion:: default: { GEOS_ERROR( GEOS_FMT( "Volume calculation not supported for element type {} in subregion {}", - m_elementType, getDataContext() ) ); + m_elementType ), getDataContext() ); } } GEOS_ERROR_IF( m_elementVolume[k] <= 0.0, GEOS_FMT( "Negative volume for element {} type {} in subregion {}", - k, m_elementType, getDataContext() ) ); + k, m_elementType ), getDataContext() ); } void CellElementSubRegion::calculateElementGeometricQuantities( NodeManager const & nodeManager, diff --git a/src/coreComponents/mesh/ElementRegionManager.cpp b/src/coreComponents/mesh/ElementRegionManager.cpp index 367d0bb2662..97b5eeca57f 100644 --- a/src/coreComponents/mesh/ElementRegionManager.cpp +++ b/src/coreComponents/mesh/ElementRegionManager.cpp @@ -222,9 +222,9 @@ void ElementRegionManager::generateWells( CellBlockManagerABC const & cellBlockM globalIndex const numWellElemsGlobal = MpiWrapper::sum( subRegion.size() ); GEOS_ERROR_IF( numWellElemsGlobal != lineBlock.numElements(), - "Invalid partitioning in well " << lineBlock.getDataContext() << - ", subregion " << subRegion.getDataContext(), - getDataContext() ); + "Invalid partitioning in well " << lineBlock.getName() << + ", subregion " << subRegion.getName(), + getDataContext(), lineBlock.getDataContext(), subRegion.getDataContext() ); } ); @@ -784,12 +784,12 @@ ElementRegionManager::getCellBlockToSubRegionMap( CellBlockManagerABC const & ce GEOS_UNUSED_VAR( region ); // unused if geos_error_if is nulld localIndex const blockIndex = cellBlocks.getIndex( subRegion.getName() ); GEOS_ERROR_IF( blockIndex == Group::subGroupMap::KeyIndex::invalid_index, - GEOS_FMT( "{}, subregion {}: Cell block not found at index {}.", - region.getDataContext().toString(), subRegion.getName(), blockIndex ), + GEOS_FMT( "subregion {}: Cell block not found at index {}.", + subRegion.getName(), blockIndex ), region.getDataContext() ); GEOS_ERROR_IF( blockMap( blockIndex, 1 ) != -1, - GEOS_FMT( "{}, subregion {}: Cell block at index {} is mapped to more than one subregion.", - region.getDataContext().toString(), subRegion.getName(), blockIndex ), + GEOS_FMT( "subregion {}: Cell block at index {} is mapped to more than one subregion.", + subRegion.getName(), blockIndex ), region.getDataContext() ); blockMap( blockIndex, 0 ) = er; diff --git a/src/coreComponents/mesh/ElementRegionManager.hpp b/src/coreComponents/mesh/ElementRegionManager.hpp index 0058e862f63..aec8948fb8e 100644 --- a/src/coreComponents/mesh/ElementRegionManager.hpp +++ b/src/coreComponents/mesh/ElementRegionManager.hpp @@ -1511,9 +1511,7 @@ ElementRegionManager::constructMaterialViewAccessor( string const & viewName, else { GEOS_ERROR_IF( !allowMissingViews, - subRegion.getDataContext() << - ": Material " << constitutiveRelation.getDataContext() << - " does not contain " << viewName, + " : Material " << constitutiveRelation.getName() << " does not contain " << viewName, subRegion.getDataContext(), constitutiveRelation.getDataContext() ); } } ); @@ -1561,8 +1559,8 @@ ElementRegionManager::constructMaterialViewAccessor( string const & viewName, } else { - GEOS_ERROR_IF( !allowMissingViews, region.getDataContext() << ": Material " << materialName - << " does not contain " << viewName, + GEOS_ERROR_IF( !allowMissingViews, "Material " << materialName + << " does not contain " << viewName, region.getDataContext(), subRegion.getDataContext() ); } } ); diff --git a/src/coreComponents/mesh/FaceElementSubRegion.cpp b/src/coreComponents/mesh/FaceElementSubRegion.cpp index ca1a0a79970..3bfe171ae3e 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.cpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.cpp @@ -141,7 +141,7 @@ void FaceElementSubRegion::copyFromCellBlock( FaceBlockABC const & faceBlock ) GEOS_ERROR_IF_NE_MSG( num2dElements, 0, "Could not determine the element type of the fracture \"" << getName() << "\"." ); return ElementType::Hexahedron; default: - GEOS_ERROR( "Unsupported type of elements during the face element sub region creation." ); + GEOS_ERROR( "Unsupported type of elements during the face element sub region creation.", getDataContext() ); return {}; } }; @@ -161,7 +161,7 @@ void FaceElementSubRegion::copyFromCellBlock( FaceBlockABC const & faceBlock ) // If we have found that the input face block contains 2d elements of different types, // we inform the used that the situation may be at risk. // (We're storing the face block in a homogeneous container while it's actually heterogeneous). - GEOS_WARNING( "Heterogeneous face element sub region found and stored as homogeneous. Use at your own risk." ); + GEOS_WARNING( "Heterogeneous face element sub region found and stored as homogeneous. Use at your own risk.", getDataContext() ); } auto const it = std::max_element( sizes.cbegin(), sizes.cend() ); @@ -1216,13 +1216,13 @@ void FaceElementSubRegion::fixNeighboringFacesNormals( FaceManager & faceManager // (i.e., towards the fracture element). if( LvArray::tensorOps::AiBi< 3 >( faceNormal[f0], f0e0vector ) < 0.0 ) { - GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf0 of face {}", kfe, f0 ) ); + GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf0 of face {}", kfe, f0 ), getDataContext() ); LvArray::tensorOps::scale< 3 >( faceNormal[f0], -1.0 ); std::reverse( faceToNodes[f0].begin(), faceToNodes[f0].end() ); } if( LvArray::tensorOps::AiBi< 3 >( faceNormal[f1], f1e1vector ) < 0.0 ) { - GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf1 of face {}", kfe, f1 ) ); + GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf1 of face {}", kfe, f1 ), getDataContext() ); LvArray::tensorOps::scale< 3 >( faceNormal[f1], -1.0 ); std::reverse( faceToNodes[f1].begin(), faceToNodes[f1].end() ); } diff --git a/src/coreComponents/mesh/FaceManager.cpp b/src/coreComponents/mesh/FaceManager.cpp index 1cf388d34f4..568da23ddd9 100644 --- a/src/coreComponents/mesh/FaceManager.cpp +++ b/src/coreComponents/mesh/FaceManager.cpp @@ -276,8 +276,8 @@ void FaceManager::sortAllFaceNodes( NodeManager const & nodeManager, // The face should be connected to at least one element. if( facesToElements( faceIndex, 0 ) < 0 && facesToElements( faceIndex, 1 ) < 0 ) { - GEOS_ERROR( getDataContext() << ": Face " << faceIndex << - " is not connected to any cell. You might have an invalid mesh." ); + GEOS_ERROR( "Face " << faceIndex << + " is not connected to any cell. You might have an invalid mesh.", getDataContext() ); } // Take the first defined face-to-(elt/region/sub region) to sorting direction. @@ -289,8 +289,8 @@ void FaceManager::sortAllFaceNodes( NodeManager const & nodeManager, if( er < 0 || esr < 0 || ei < 0 ) { - GEOS_ERROR( GEOS_FMT( "{0}: Face {1} is connected to an invalid element ({2}/{3}/{4}).", - getDataContext().toString(), faceIndex, er, esr, ei ) ); + GEOS_ERROR( GEOS_FMT( "Face {} is connected to an invalid element ({}/{}/{}).", + faceIndex, er, esr, ei ), getDataContext() ); } try diff --git a/src/coreComponents/mesh/MeshLevel.cpp b/src/coreComponents/mesh/MeshLevel.cpp index bc59224acb8..825013ab9bb 100644 --- a/src/coreComponents/mesh/MeshLevel.cpp +++ b/src/coreComponents/mesh/MeshLevel.cpp @@ -209,7 +209,7 @@ MeshLevel::MeshLevel( string const & name, { if( sourceSubRegion.getElementType() != ElementType::Hexahedron ) { - GEOS_ERROR( "Current order number "<( m_perfStatusTableName ), - GEOS_FMT( "{}: missing perforation status table `{}`", - getDataContext(), m_perfStatusTableName ), - InputError ); + GEOS_FMT( "missing perforation status table `{}`", m_perfStatusTableName ), + InputError, getDataContext() ); } if( !functionManager.hasGroup< TableFunction >( m_perfStatusTableName ) ) @@ -116,15 +115,14 @@ void Perforation::postInputInitialization() // User supplied table in Perforation section GEOS_THROW_IF( m_perfStatusTable[0].size() != m_perfStatusTable[1].size(), - GEOS_FMT( "{}: Perforation status table `{}` missing time or status.", m_perfStatusTableName, getDataContext() ), - InputError ); + GEOS_FMT( "Perforation status table `{}` missing time or status.", m_perfStatusTableName ), + InputError, getDataContext() ); for( std::ptrdiff_t i=0; i( wellElemSubRegion.getParent().getParent() ); GEOS_THROW( "The reservoir element dimensions (dx, dy, and dz) should be positive in " << wellRegion.getWellGeneratorName(), - InputError ); + InputError, getDataContext() ); } real64 d1 = 0; @@ -223,7 +223,7 @@ void PerforationData::computeWellTransmissibility( MeshLevel const & mesh, GEOS_THROW( "The equivalent radius r_eq = " << rEq << " is smaller than the well radius (r = " << wellElemRadius[wellElemIndex] << ") in " << wellRegion.getWellGeneratorName(), - InputError ); + InputError, getDataContext() ); } // compute the well Peaceman index @@ -234,7 +234,7 @@ void PerforationData::computeWellTransmissibility( MeshLevel const & mesh, WellElementRegion const & wellRegion = dynamicCast< WellElementRegion const & >( wellElemSubRegion.getParent().getParent() ); GEOS_THROW( "The well index is negative or equal to zero in " << wellRegion.getWellGeneratorName(), - InputError ); + InputError, getDataContext() ); } } } diff --git a/src/coreComponents/mesh/SurfaceElementRegion.hpp b/src/coreComponents/mesh/SurfaceElementRegion.hpp index 313c983dc7d..fc7da66eb59 100644 --- a/src/coreComponents/mesh/SurfaceElementRegion.hpp +++ b/src/coreComponents/mesh/SurfaceElementRegion.hpp @@ -211,8 +211,7 @@ class SurfaceElementRegion : public ElementRegionBase subRegionNames.push_back( sr.getName() ); } ); GEOS_ERROR_IF( subRegionNames.size() != 1, - "Surface region \"" << getDataContext() << - "\" should have one unique sub region (" << subRegionNames.size() << " found).", + "Surface region should have one unique sub region (" << subRegionNames.size() << " found).", getDataContext() ); return subRegionNames.front(); } diff --git a/src/coreComponents/mesh/WellElementRegion.cpp b/src/coreComponents/mesh/WellElementRegion.cpp index e7b2f54e019..efb1a4fd9bc 100644 --- a/src/coreComponents/mesh/WellElementRegion.cpp +++ b/src/coreComponents/mesh/WellElementRegion.cpp @@ -70,8 +70,8 @@ void WellElementRegion::generateWell( MeshLevel & mesh, // 1) select the local perforations based on connectivity to the local reservoir elements subRegion.connectPerforationsToMeshElements( mesh, lineBlock, geomTol ); - globalIndex const matchedPerforations = MpiWrapper::sum( perforationData->size() ); + //should we do this check in the well generator? Here we don't have the wellGeneratorDataContext GEOS_THROW_IF( matchedPerforations != numPerforationsGlobal, "Invalid mapping perforation-to-element in "<< InternalWellGenerator::catalogName() << " " << getWellGeneratorName() << "." << @@ -81,7 +81,7 @@ void WellElementRegion::generateWell( MeshLevel & mesh, " the well polyline located outside the domain.\n" << " 2- This error can also happen if a perforation falls on a mesh face or a mesh vertex." << " Please try to move the perforation slightly (to the interior of the perforated cell) to see if it fixes the problem.", - InputError ); + InputError, getDataContext() ); // 2) classify well elements based on connectivity to local mesh partition array1d< integer > elemStatusGlobal; diff --git a/src/coreComponents/mesh/WellElementSubRegion.cpp b/src/coreComponents/mesh/WellElementSubRegion.cpp index b58343bdd12..2954a382c8f 100644 --- a/src/coreComponents/mesh/WellElementSubRegion.cpp +++ b/src/coreComponents/mesh/WellElementSubRegion.cpp @@ -509,8 +509,7 @@ void WellElementSubRegion::generate( MeshLevel & mesh, // this is enforced in the LineBlockABC that currently merges two perforations // if they belong to the same well element. This is a temporary solution. // TODO: split the well elements that contain multiple perforations, so that no element is shared - GEOS_THROW_IF( sharedElems.size() > 0, - "Well " << lineBlock.getDataContext() << " contains shared well elements", + GEOS_THROW_IF( sharedElems.size() > 0, "contains shared well elements", InputError, lineBlock.getDataContext() ); // In Steps 1 and 2 we determine the local objects on this rank (elems and nodes) @@ -660,7 +659,7 @@ void WellElementSubRegion::checkPartitioningValidity( LineBlockABC const & lineB globalIndex const prevGlobal = prevElemIdsGlobal[iwelemGlobal][numBranches-1]; GEOS_THROW_IF( prevGlobal <= iwelemGlobal || prevGlobal < 0, - "The structure of well " << lineBlock.getDataContext() << " is invalid. " << + "The structure of well is invalid. " << " The main reason for this error is that there may be no perforation" << " in the bottom well element of the well, which is required to have" << " a well-posed problem.", diff --git a/src/coreComponents/mesh/generators/CellBlock.cpp b/src/coreComponents/mesh/generators/CellBlock.cpp index cd60545c5e9..4f4f3964444 100644 --- a/src/coreComponents/mesh/generators/CellBlock.cpp +++ b/src/coreComponents/mesh/generators/CellBlock.cpp @@ -121,7 +121,7 @@ void CellBlock::setElementType( ElementType elementType ) } default: { - GEOS_ERROR( "Invalid element type " << m_elementType << " for CellBlock " << getDataContext() ); + GEOS_ERROR( "Invalid element type " << m_elementType << " for CellBlock ", getDataContext() ); } } diff --git a/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp b/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp index 0eac2831c21..fbb27feafac 100644 --- a/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp @@ -143,7 +143,7 @@ void InternalMeshGenerator::postInputInitialization() } if( failFlag ) { - GEOS_ERROR( getDataContext() << ": vertex/element mismatch.\n" << generalMeshErrorAdvice ); + GEOS_ERROR( "vertex/element mismatch.\n" << generalMeshErrorAdvice, getDataContext() ); } // If specified, check to make sure bias values have the correct length @@ -156,7 +156,7 @@ void InternalMeshGenerator::postInputInitialization() } if( failFlag ) { - GEOS_ERROR( getDataContext() << ": element/bias mismatch.\n" << generalMeshErrorAdvice ); + GEOS_ERROR( "element/bias mismatch.\n" << generalMeshErrorAdvice, getDataContext() ); } } @@ -170,8 +170,8 @@ void InternalMeshGenerator::postInputInitialization() } else { - GEOS_ERROR( getDataContext() << ": InternalMeshGenerator: The number of element types is inconsistent" << - " with the number of total cell blocks.\n" << generalMeshErrorAdvice ); + GEOS_ERROR( "InternalMeshGenerator: The number of element types is inconsistent" << + " with the number of total cell blocks.\n" << generalMeshErrorAdvice, getDataContext() ); } } @@ -206,7 +206,7 @@ void InternalMeshGenerator::postInputInitialization() } else { - GEOS_ERROR( getDataContext() << ": Incorrect number of regionLayout entries specified." ); + GEOS_ERROR( "Incorrect number of regionLayout entries specified.", getDataContext() ); } } } diff --git a/src/coreComponents/mesh/generators/ParticleBlock.cpp b/src/coreComponents/mesh/generators/ParticleBlock.cpp index 3cf22ea8ae2..3777316a05c 100644 --- a/src/coreComponents/mesh/generators/ParticleBlock.cpp +++ b/src/coreComponents/mesh/generators/ParticleBlock.cpp @@ -64,7 +64,7 @@ void ParticleBlock::setParticleType( ParticleType const particleType ) } default: { - GEOS_ERROR( "Invalid particle type: " << m_particleType ); + GEOS_ERROR( "Invalid particle type: " << m_particleType, getDataContext() ); } } } diff --git a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp index 8f1d434ad45..e4b9e6c7feb 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp @@ -119,7 +119,7 @@ void VTKMeshGenerator::postInputInitialization() m_dataSource = externalDataManager.getGroupPointer< VTKHierarchicalDataSource >( m_dataSourceName ); GEOS_THROW_IF( m_dataSource == nullptr, - getDataContext() << ": VTK Data Object Source not found: " << m_dataSourceName, + "VTK Data Object Source not found: " << m_dataSourceName, InputError, getDataContext() ); m_dataSource->open(); @@ -282,7 +282,7 @@ void VTKMeshGenerator::importVolumicFieldOnArray( string const & cellBlockName, } } - GEOS_ERROR( "Could not import field \"" << meshFieldName << "\" from cell block \"" << cellBlockName << "\"." ); + GEOS_ERROR( "Could not import field \"" << meshFieldName << "\" from cell block \"" << cellBlockName << "\".", getDataContext() ); } @@ -308,7 +308,7 @@ void VTKMeshGenerator::importSurfacicFieldOnArray( string const & faceBlockName, return vtk::importRegularField( vtkArray, wrapper ); } - GEOS_ERROR( "Could not import field \"" << meshFieldName << "\" from face block \"" << faceBlockName << "\"." ); + GEOS_ERROR( "Could not import field \"" << meshFieldName << "\" from face block \"" << faceBlockName << "\".", getDataContext() ); } diff --git a/src/coreComponents/mesh/generators/VTKWellGenerator.cpp b/src/coreComponents/mesh/generators/VTKWellGenerator.cpp index eba79d7076e..8e264fb51a8 100644 --- a/src/coreComponents/mesh/generators/VTKWellGenerator.cpp +++ b/src/coreComponents/mesh/generators/VTKWellGenerator.cpp @@ -69,11 +69,13 @@ void VTKWellGenerator::fillPolylineDataStructure( ) LvArray::tensorOps::copy< 3 >( m_polyNodeCoords[ipoint], point ); } - GEOS_ERROR_IF( polyData->GetLines()->GetNumberOfCells() == 0, GEOS_FMT( "{}: Error! Your VTK file {} doesn't contain any well", - this->getName(), m_filePath )); + GEOS_ERROR_IF( polyData->GetLines()->GetNumberOfCells() == 0, + GEOS_FMT( "Error! Your VTK file {} doesn't contain any well", + m_filePath ), this->getDataContext()); - GEOS_LOG_RANK_0_IF( polyData->GetLines()->GetNumberOfCells() > 1, GEOS_FMT( "{}: Warning! Your VTK file {} contains multiple wells. Only the first one will be read", - this->getName(), m_filePath )); + GEOS_LOG_RANK_0_IF( polyData->GetLines()->GetNumberOfCells() > 1, + GEOS_FMT( "{}: Warning! Your VTK file {} contains multiple wells. Only the first one will be read", + this->getName(), m_filePath )); // load edges // polyData->GetLines()->InitTraversal(); diff --git a/src/coreComponents/mesh/generators/WellGeneratorBase.cpp b/src/coreComponents/mesh/generators/WellGeneratorBase.cpp index f55ba78049d..0fe4dc833a0 100644 --- a/src/coreComponents/mesh/generators/WellGeneratorBase.cpp +++ b/src/coreComponents/mesh/generators/WellGeneratorBase.cpp @@ -147,16 +147,16 @@ void WellGeneratorBase::generateWellGeometry( ) void WellGeneratorBase::postInputInitialization() { GEOS_THROW_IF( m_radius <= 0, - "Invalid " << viewKeyStruct::radiusString() << " in well " << getName(), - InputError ); + "Invalid " << viewKeyStruct::radiusString(), + InputError, getDataContext() ); GEOS_THROW_IF( m_wellRegionName.empty(), - "Invalid well region name in well " << getName(), - InputError ); + "Invalid well region name", + InputError, getDataContext() ); GEOS_THROW_IF( m_wellControlsName.empty(), - "Invalid well constraint name in well " << getName(), - InputError ); + "Invalid well constraint name", + InputError, getDataContext() ); } void WellGeneratorBase::constructPolylineNodeToSegmentMap() @@ -181,13 +181,13 @@ void WellGeneratorBase::constructPolylineNodeToSegmentMap() "Error in the topology of well '" << getName() << "': we detected a polyline segment measuring less than " << m_minSegmentLength << "m. \n" << "You can change the minimum segment length using the field " << viewKeyStruct::minSegmentLengthString(), - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF( m_polyNodeCoords[ipolyNode_a][2] < m_polyNodeCoords[ipolyNode_b][2], "Error in the topology of well '" << getName() << "': in the polyline, each segment must be going down. \n" << "This is not the case between polyline nodes " << m_polyNodeCoords[ipolyNode_a] << " and " << m_polyNodeCoords[ipolyNode_b], - InputError ); + InputError, getDataContext() ); if( segmentLength / m_numElemsPerSegment < m_minElemLength ) { @@ -225,7 +225,7 @@ void WellGeneratorBase::findPolylineHeadNodeIndex() << "' since we use depth to determine which of its nodes is to head node of the well.\n" << "If you are trying to set up a horizontal well, please simply add a non-horizontal segment at the top of the well," << " and this error will go away", - InputError ); + InputError, getDataContext() ); // detect the top node, assuming z oriented upwards m_polylineHeadNodeId = @@ -245,7 +245,7 @@ void WellGeneratorBase::findPolylineHeadNodeIndex() GEOS_THROW_IF( !(currentZcoord < headZcoord), "Error in the topology of well '" << getName() << "' since we found a well node that is above the head node", - InputError ); + InputError, getDataContext() ); } } @@ -269,8 +269,8 @@ void WellGeneratorBase::discretizePolyline() { GEOS_THROW_IF( isegCurrent == -1, - "Invalid segmentToNode map in well " << getName(), - InputError ); + "Invalid segmentToNode map", + InputError, getDataContext() ); globalIndex const ipolyNodeBottom = ( ipolyNodeTop == m_segmentToPolyNodeMap[isegCurrent][0] ) ? m_segmentToPolyNodeMap[isegCurrent][1] @@ -290,8 +290,8 @@ void WellGeneratorBase::discretizePolyline() LvArray::tensorOps::add< 3 >( m_elemCenterCoords[iwelemCurrent], m_polyNodeCoords[ipolyNodeTop] ); GEOS_THROW_IF( iwelemCurrent >= m_numElems, - "Invalid well topology in well " << getName(), - InputError ); + "Invalid well topology", + InputError, getDataContext() ); globalIndex const iwelemTop = iwelemCurrent - 1; globalIndex const iwelemBottom = iwelemCurrent + 1; @@ -365,7 +365,7 @@ void WellGeneratorBase::connectPerforationsToWellElements() << "Here is how the \"distanceFromHead\" keyword is used in the definition of the perforation location: \n" << "We start from the well head (top of the well) and we measure the linear distance along the well polyline as we go down the well.\n" << "When we reach the distanceFromHead specified by the user, we place a perforation on the well at this location of the polyline, and connect it to the reservoir element that contains this perforation", - InputError ); + InputError, getDataContext() ); // start binary search const globalIndex maxNumSteps = m_numElems + 1; @@ -387,8 +387,8 @@ void WellGeneratorBase::connectPerforationsToWellElements() } GEOS_THROW_IF( currentNumSteps > maxNumSteps, - "Perforation " << perf.getName() << " cannot be mapped to a well element in well " << getName(), - InputError ); + "Perforation " << perf.getName() << " cannot be mapped to a well element", + InputError, getDataContext() ); currentNumSteps++; } @@ -396,8 +396,8 @@ void WellGeneratorBase::connectPerforationsToWellElements() // set the index of the matched element globalIndex iwelemMatched = iwelemTop; GEOS_THROW_IF( iwelemMatched >= m_numElems, - "Invalid topology in well " << getName(), - InputError ); + "Invalid topology", + InputError, getDataContext() ); m_perfElemId[iperf] = iwelemMatched; @@ -408,8 +408,8 @@ void WellGeneratorBase::connectPerforationsToWellElements() real64 const topToPerfDist = m_perfDistFromHead[iperf] - m_nodeDistFromHead[inodeTop]; GEOS_THROW_IF( (elemLength <= 0) || (topToPerfDist < 0), - "Invalid topology in well " << getName(), - InputError ); + "Invalid topology", + InputError, getDataContext() ); LvArray::tensorOps::copy< 3 >( m_perfCoords[iperf], m_nodeCoords[inodeBottom] ); LvArray::tensorOps::subtract< 3 >( m_perfCoords[iperf], m_nodeCoords[inodeTop] ); @@ -472,7 +472,7 @@ void WellGeneratorBase::checkPerforationLocationsValidity() << "and place a perforation whose \"distanceFromHead\" is slightly smaller than this total length. \n \n" << "2) Shorten the well polyline. " << "To do that, reduce the length of the well polyline by shortening the segments defined by the keywords \"polylineNodeCoords\" and \"polylineSegmentConn\", or by removing a segment.", - InputError ); + InputError, getDataContext() ); } } } diff --git a/src/coreComponents/mesh/simpleGeometricObjects/Box.cpp b/src/coreComponents/mesh/simpleGeometricObjects/Box.cpp index 172f529ed59..1abc04e5aed 100644 --- a/src/coreComponents/mesh/simpleGeometricObjects/Box.cpp +++ b/src/coreComponents/mesh/simpleGeometricObjects/Box.cpp @@ -77,7 +77,7 @@ void Box::postInputInitialization() if( std::fabs( m_strikeAngle ) > 1e-20 ) { GEOS_ERROR_IF( (m_max[0]-m_min[0]) < (m_max[1]-m_min[1]), - getDataContext() << ": When a strike angle is specified, the box is supposed to" << + "When a strike angle is specified, the box is supposed to" << " represent a plane normal to the y direction. This box seems to be too thick.", getDataContext() ); diff --git a/src/coreComponents/mesh/simpleGeometricObjects/ThickPlane.cpp b/src/coreComponents/mesh/simpleGeometricObjects/ThickPlane.cpp index 4b04b18fd61..fb13744bda0 100644 --- a/src/coreComponents/mesh/simpleGeometricObjects/ThickPlane.cpp +++ b/src/coreComponents/mesh/simpleGeometricObjects/ThickPlane.cpp @@ -50,12 +50,12 @@ void ThickPlane::postInputInitialization() m_thickness *= 0.5; // actually store the half-thickness GEOS_ERROR_IF( m_thickness <= 0, - getDataContext() << ": The plane appears to have zero or negative thickness", + "The plane appears to have zero or negative thickness", getDataContext() ); LvArray::tensorOps::normalize< 3 >( m_normal ); GEOS_ERROR_IF( std::fabs( LvArray::tensorOps::l2Norm< 3 >( m_normal ) - 1.0 ) > 1e-15, - getDataContext() << ": Could not properly normalize input normal.", + "Could not properly normalize input normal.", getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp index af9efb7fefa..13390fe314c 100644 --- a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp +++ b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp @@ -87,8 +87,7 @@ class FieldStatisticsBase : public TaskBase m_solver = physicsSolverManager.getGroupPointer< SOLVER >( m_solverName ); GEOS_THROW_IF( m_solver == nullptr, - GEOS_FMT( "{}: Could not find solver '{}' of type {}", - getDataContext(), + GEOS_FMT( "Could not find solver '{}' of type {}", m_solverName, LvArray::system::demangleType< SOLVER >() ), InputError, getDataContext() ); diff --git a/src/coreComponents/physicsSolvers/LinearSolverParameters.cpp b/src/coreComponents/physicsSolvers/LinearSolverParameters.cpp index cca018cabe3..28dc915890a 100644 --- a/src/coreComponents/physicsSolvers/LinearSolverParameters.cpp +++ b/src/coreComponents/physicsSolvers/LinearSolverParameters.cpp @@ -816,60 +816,54 @@ void LinearSolverParametersInput::postInputInitialization() static const std::set< integer > binaryOptions = { 0, 1 }; GEOS_ERROR_IF( binaryOptions.count( m_parameters.stopIfError ) == 0, - getWrapperDataContext( viewKeyStruct::stopIfErrorString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::stopIfErrorString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_parameters.direct.checkResidual ) == 0, - getWrapperDataContext( viewKeyStruct::directCheckResidualString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::directCheckResidualString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_parameters.direct.equilibrate ) == 0, - getWrapperDataContext( viewKeyStruct::directEquilString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::directEquilString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_parameters.direct.replaceTinyPivot ) == 0, - getWrapperDataContext( viewKeyStruct::directReplTinyPivotString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::directReplTinyPivotString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_parameters.direct.iterativeRefine ) == 0, - getWrapperDataContext( viewKeyStruct::directIterRefString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::directIterRefString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_parameters.direct.parallel ) == 0, - getWrapperDataContext( viewKeyStruct::directParallelString() ) << - ": option can be either 0 (false) or 1 (true)", + "Value can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::directParallelString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.krylov.maxIterations, 0, - getWrapperDataContext( viewKeyStruct::krylovMaxIterString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::krylovMaxIterString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.krylov.maxRestart, 0, - getWrapperDataContext( viewKeyStruct::krylovMaxRestartString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::krylovMaxRestartString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.krylov.relTolerance, 0.0, - getWrapperDataContext( viewKeyStruct::krylovTolString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::krylovTolString() ) ); GEOS_ERROR_IF_GT_MSG( m_parameters.krylov.relTolerance, 1.0, - getWrapperDataContext( viewKeyStruct::krylovTolString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::krylovTolString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.ifact.fill, 0, - getWrapperDataContext( viewKeyStruct::iluFillString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::iluFillString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.ifact.threshold, 0.0, - getWrapperDataContext( viewKeyStruct::iluThresholdString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::iluThresholdString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.amg.numSweeps, 0, - getWrapperDataContext( viewKeyStruct::amgNumSweepsString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::amgNumSweepsString() ) ); GEOS_ERROR_IF_LT_MSG( m_parameters.amg.threshold, 0.0, - getWrapperDataContext( viewKeyStruct::amgThresholdString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::amgThresholdString() ) ); GEOS_ERROR_IF_GT_MSG( m_parameters.amg.threshold, 1.0, - getWrapperDataContext( viewKeyStruct::amgThresholdString() ) << - ": Invalid value." ); + "Invalid value.", + getWrapperDataContext( viewKeyStruct::amgThresholdString() ) ); // TODO input validation for other AMG parameters ? diff --git a/src/coreComponents/physicsSolvers/NonlinearSolverParameters.cpp b/src/coreComponents/physicsSolvers/NonlinearSolverParameters.cpp index a604ff97cfd..e252fa3dc71 100644 --- a/src/coreComponents/physicsSolvers/NonlinearSolverParameters.cpp +++ b/src/coreComponents/physicsSolvers/NonlinearSolverParameters.cpp @@ -215,29 +215,38 @@ NonlinearSolverParameters::NonlinearSolverParameters( string const & name, void NonlinearSolverParameters::postInputInitialization() { GEOS_ERROR_IF_LE_MSG( m_timeStepDecreaseIterLimit, m_timeStepIncreaseIterLimit, - getWrapperDataContext( viewKeysStruct::timeStepIncreaseIterLimString() ) << - ": should be smaller than " << viewKeysStruct::timeStepDecreaseIterLimString() ); + viewKeysStruct::timeStepIncreaseIterLimString() << + " Value should be smaller than " << viewKeysStruct::timeStepDecreaseIterLimString(), + getDataContext() ); GEOS_ERROR_IF_LE_MSG( m_lineSearchResidualFactor, 0.0, - getWrapperDataContext( viewKeysStruct::lineSearchResidualFactorString() ) << ": should be positive" ); + "Value should be positive", + getWrapperDataContext( viewKeysStruct::lineSearchResidualFactorString() ) ); if( m_oscillationScaling > 0 ) { // check oscillation parameters GEOS_ERROR_IF_LE_MSG( m_oscillationScalingFactor, 0.0, - getWrapperDataContext( viewKeysStruct::oscillationScalingFactorString() ) << ": should be positive" ); + "Value should be positive", + getWrapperDataContext( viewKeysStruct::oscillationScalingFactorString()) ); GEOS_ERROR_IF_GT_MSG( m_oscillationScalingFactor, 1.0, - getWrapperDataContext( viewKeysStruct::oscillationScalingFactorString() ) << ": can not be more than 1.0" ); + "Value can not be more than 1.0", + getWrapperDataContext( viewKeysStruct::oscillationScalingFactorString()) ); GEOS_ERROR_IF_LT_MSG( m_oscillationCheckDepth, 2, - getWrapperDataContext( viewKeysStruct::oscillationCheckDepthString() ) << ": can not be less than 2" ); + "Value can not be less than 2", + getWrapperDataContext( viewKeysStruct::oscillationCheckDepthString()) ); GEOS_ERROR_IF_LE_MSG( m_oscillationTolerance, 0.0, - getWrapperDataContext( viewKeysStruct::oscillationToleranceString() ) << ": should be positive" ); + "Value should be positive", + getWrapperDataContext( viewKeysStruct::oscillationToleranceString()) ); GEOS_ERROR_IF_GE_MSG( m_oscillationTolerance, 1.0, - getWrapperDataContext( viewKeysStruct::oscillationToleranceString() ) << ": can not be more than 1.0" ); + "Value can not be more than 1.0", + getWrapperDataContext( viewKeysStruct::oscillationToleranceString()) ); GEOS_ERROR_IF_LT_MSG( m_oscillationFraction, 0.0, - getWrapperDataContext( viewKeysStruct::oscillationFractionString() ) << ": can not be negative" ); + "Value can not be negative", + getWrapperDataContext( viewKeysStruct::oscillationFractionString()) ); GEOS_ERROR_IF_GT_MSG( m_oscillationFraction, 1.0, - getWrapperDataContext( viewKeysStruct::oscillationFractionString() ) << ": can not be more than 1.0" ); + "Value can not be more than 1.0", + getWrapperDataContext( viewKeysStruct::oscillationFractionString()) ); } if( getLogLevel() > 0 ) diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp index 8d301476cc5..6d6d360c13e 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp @@ -166,7 +166,7 @@ void PhysicsSolverBase::generateMeshTargetsFromTargetRegions( Group const & mesh if( targetTokens.size()==1 ) // no MeshBody or MeshLevel specified { GEOS_ERROR_IF( meshBodies.numSubGroups() != 1, - getDataContext() << ": No MeshBody information is specified in" << + "No MeshBody information is specified in" << " PhysicsSolverBase::meshTargets, but there are multiple MeshBody objects", getDataContext() ); MeshBody const & meshBody = meshBodies.getGroup< MeshBody >( 0 ); @@ -182,8 +182,7 @@ void PhysicsSolverBase::generateMeshTargetsFromTargetRegions( Group const & mesh { string const meshBodyName = targetTokens[0]; GEOS_ERROR_IF( !meshBodies.hasGroup( meshBodyName ), - getWrapperDataContext( viewKeyStruct::targetRegionsString() ) << ": MeshBody (" << - meshBodyName << ") is specified in targetRegions, but does not exist.", + "MeshBody (" << meshBodyName << ") is specified in targetRegions, but does not exist.", getWrapperDataContext( viewKeyStruct::targetRegionsString() ) ); string const meshLevelName = m_discretizationName; @@ -196,7 +195,7 @@ void PhysicsSolverBase::generateMeshTargetsFromTargetRegions( Group const & mesh } else { - GEOS_ERROR( getDataContext() << ": Invalid specification of targetRegions" ); + GEOS_ERROR( "Invalid specification of targetRegions", getDataContext() ); } } } @@ -241,8 +240,8 @@ localIndex PhysicsSolverBase::targetRegionIndex( string const & regionName ) con { auto const pos = std::find( m_targetRegionNames.begin(), m_targetRegionNames.end(), regionName ); GEOS_ERROR_IF( pos == m_targetRegionNames.end(), - GEOS_FMT( "{}: Region {} is not a target of the solver.", - getDataContext(), regionName ), getDataContext() ); + GEOS_FMT( "Region {} is not a target of the solver.", + regionName ), getDataContext() ); return std::distance( m_targetRegionNames.begin(), pos ); } @@ -360,8 +359,7 @@ bool PhysicsSolverBase::execute( real64 const time_n, } } GEOS_ERROR_IF( dtRemaining > 0.0, - getDataContext() << ": Maximum allowed number of sub-steps" - " reached. Consider increasing maxSubSteps.", + "Maximum allowed number of sub-steps reached. Consider increasing maxSubSteps.", getDataContext() ); // Decide what to do with the next Dt for the event running the solver. @@ -937,7 +935,7 @@ real64 PhysicsSolverBase::nonlinearImplicitStep( real64 const & time_n, } else { - GEOS_ERROR( "Nonconverged solutions not allowed. Terminating..." ); + GEOS_ERROR( "Nonconverged solutions not allowed. Terminating...", getDataContext() ); } } @@ -1452,14 +1450,12 @@ void PhysicsSolverBase::solveLinearSystem( DofManager const & dofManager, if( params.stopIfError ) { - GEOS_ERROR_IF( m_linearSolverResult.breakdown(), - getDataContext() << ": Linear solution breakdown -> simulation STOP", + GEOS_ERROR_IF( m_linearSolverResult.breakdown(), "Linear solution breakdown -> simulation STOP", getDataContext() ); } else { - GEOS_WARNING_IF( !m_linearSolverResult.success(), - getDataContext() << ": Linear solution failed", + GEOS_WARNING_IF( !m_linearSolverResult.success(), "Linear solution failed", getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp index b02c106a751..a3121fb6942 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp @@ -1267,8 +1267,9 @@ void PhysicsSolverBase::setConstitutiveName( ElementSubRegionBase & subRegion, s string & constitutiveName = subRegion.getReference< string >( wrapperName ); constitutiveName = getConstitutiveName< CONSTITUTIVE >( subRegion ); - GEOS_ERROR_IF( constitutiveName.empty(), GEOS_FMT( "{}: {} constitutive model not found on subregion {}", - getDataContext(), constitutiveType, subRegion.getName() ) ); + GEOS_ERROR_IF( constitutiveName.empty(), GEOS_FMT( "{} constitutive model not found on subregion {}", + constitutiveType, subRegion.getName() ), + getDataContext() ); } /** diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index ec8268e0079..845a6eb1382 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -199,53 +199,53 @@ void CompositionalMultiphaseBase::postInputInitialization() FlowSolverBase::postInputInitialization(); GEOS_ERROR_IF_GT_MSG( m_maxCompFracChange, 1.0, - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) << - ": The maximum absolute change in component fraction in a Newton iteration must be smaller or equal to 1.0" ); + "The maximum absolute change in component fraction in a Newton iteration must be smaller or equal to 1.0", + getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_maxCompFracChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) << - ": The maximum absolute change in component fraction in a Newton iteration must be larger than 0.0" ); + "The maximum absolute change in component fraction in a Newton iteration must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_maxRelativePresChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxRelativePresChangeString() ) << - ": The maximum relative change in pressure in a Newton iteration must be larger than 0.0" ); + "The maximum relative change in pressure in a Newton iteration must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::maxRelativePresChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_maxRelativeTempChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxRelativeTempChangeString() ) << - ": The maximum relative change in temperature in a Newton iteration must be larger than 0.0" ); + "The maximum relative change in temperature in a Newton iteration must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::maxRelativeTempChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_maxRelativeCompDensChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxRelativeCompDensChangeString() ) << - ": The maximum relative change in component density in a Newton iteration must be larger than 0.0" ); + "The maximum relative change in component density in a Newton iteration must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::maxRelativeCompDensChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_targetRelativePresChange, 0.0, - getWrapperDataContext( viewKeyStruct::targetRelativePresChangeString() ) << - ": The target relative change in pressure in a time step must be larger than 0.0" ); + "The target relative change in pressure in a time step must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::targetRelativePresChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_targetRelativeTempChange, 0.0, - getWrapperDataContext( viewKeyStruct::targetRelativeTempChangeString() ) << - ": The target relative change in temperature in a time step must be larger than 0.0" ); + "The target relative change in temperature in a time step must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::targetRelativeTempChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_targetPhaseVolFracChange, 0.0, - getWrapperDataContext( viewKeyStruct::targetPhaseVolFracChangeString() ) << - ": The target change in phase volume fraction in a time step must be larger than 0.0" ); + "The target change in phase volume fraction in a time step must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::targetPhaseVolFracChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_targetRelativeCompDensChange, 0.0, - getWrapperDataContext( viewKeyStruct::targetRelativeCompDensChangeString() ) << - ": The target change in component density in a time step must be larger than 0.0" ); + "The target change in component density in a time step must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::targetRelativeCompDensChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_targetCompFracChange, 0.0, - getWrapperDataContext( viewKeyStruct::targetCompFracChangeString() ) << - ": The target change in component fraction in a time step must be larger than 0.0" ); + "The target change in component fraction in a time step must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::targetCompFracChangeString() ) ); GEOS_ERROR_IF_LT_MSG( m_solutionChangeScalingFactor, 0.0, - getWrapperDataContext( viewKeyStruct::solutionChangeScalingFactorString() ) << - ": The solution change scaling factor must be larger or equal to 0.0" ); + "The solution change scaling factor must be larger or equal to 0.0", + getWrapperDataContext( viewKeyStruct::solutionChangeScalingFactorString() )); GEOS_ERROR_IF_GT_MSG( m_solutionChangeScalingFactor, 1.0, - getWrapperDataContext( viewKeyStruct::solutionChangeScalingFactorString() ) << - ": The solution change scaling factor must be smaller or equal to 1.0" ); + "The solution change scaling factor must be smaller or equal to 1.0", + getWrapperDataContext( viewKeyStruct::solutionChangeScalingFactorString() )); GEOS_ERROR_IF_LE_MSG( m_minScalingFactor, 0.0, - getWrapperDataContext( viewKeyStruct::minScalingFactorString() ) << - ": The minumum scaling factor must be larger than 0.0" ); + "The minumum scaling factor must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::minScalingFactorString() )); GEOS_ERROR_IF_GT_MSG( m_minScalingFactor, 1.0, - getWrapperDataContext( viewKeyStruct::minScalingFactorString() ) << - ": The minumum scaling factor must be smaller or equal to 1.0" ); + "The minumum scaling factor must be smaller or equal to 1.0", + getWrapperDataContext( viewKeyStruct::minScalingFactorString() )); if( m_isThermal && m_useSimpleAccumulation ) // useSimpleAccumulation is not yet compatible with thermal { - GEOS_LOG_RANK_0( GEOS_FMT( "{}: '{}' is not yet implemented for thermal simulation. Switched to phase sum accumulation.", - getDataContext(), viewKeyStruct::useSimpleAccumulationString() ) ); + GEOS_LOG_RANK_0( GEOS_FMT( "'{}' is not yet implemented for thermal simulation. Switched to phase sum accumulation.", + viewKeyStruct::useSimpleAccumulationString(), getDataContext() ) ); m_useSimpleAccumulation = 0; } @@ -255,18 +255,18 @@ void CompositionalMultiphaseBase::postInputInitialization() if( m_isThermal ) // z_c formulation is not yet compatible with thermal { - GEOS_ERROR( GEOS_FMT( "{}: '{}' is currently not available for thermal simulations", - getDataContext(), formulationName ) ); + GEOS_ERROR( GEOS_FMT( " '{}' is currently not available for thermal simulations", + formulationName ), getDataContext()); } if( m_hasDiffusion || m_hasDispersion ) // z_c formulation is not yet compatible with diffusion or dispersion { - GEOS_ERROR( GEOS_FMT( "{}: {} is currently not available for diffusion or dispersion", - getDataContext(), formulationName ) ); + GEOS_ERROR( GEOS_FMT( " {} is currently not available for diffusion or dispersion", + formulationName ), getDataContext() ); } if( m_isJumpStabilized ) // z_c formulation is not yet compatible with pressure stabilization { - GEOS_ERROR( GEOS_FMT( "{}: pressure stabilization is not yet supported by {}", - getDataContext(), formulationName ) ); + GEOS_ERROR( GEOS_FMT( " pressure stabilization is not yet supported by {}", + formulationName ), getDataContext() ); } } } @@ -317,25 +317,22 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) if( m_hasCapPressure ) { GEOS_THROW_IF( getConstitutiveName< CapillaryPressureBase >( subRegion ).empty(), - GEOS_FMT( "{}: Capillary pressure model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + GEOS_FMT( "Capillary pressure model not found on subregion {}", subRegion.getName() ), + InputError, getDataContext(), subRegion.getDataContext() ); } if( m_hasDiffusion ) { GEOS_THROW_IF( getConstitutiveName< DiffusionBase >( subRegion ).empty(), - GEOS_FMT( "{}: Diffusion model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + GEOS_FMT( "Diffusion model not found on subregion {}", subRegion.getName() ), + InputError, getDataContext(), subRegion.getDataContext() ); } if( m_hasDispersion ) { GEOS_THROW_IF( getConstitutiveName< DispersionBase >( subRegion ).empty(), - GEOS_FMT( "{}: Dispersion model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + GEOS_FMT( " Dispersion model not found on subregion {}", subRegion.getName() ), + InputError, getDataContext(), subRegion.getDataContext() ); } } ); } ); @@ -366,7 +363,7 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) } else { - GEOS_ERROR( GEOS_FMT( "{}: unknown formulation type", getDataContext() ) ); + GEOS_ERROR( "unknown formulation type", getDataContext() ); } // 2. Register and resize all fields as necessary @@ -496,15 +493,15 @@ void compareMultiphaseModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & rhs ) { GEOS_THROW_IF_NE_MSG( lhs.numFluidPhases(), rhs.numFluidPhases(), GEOS_FMT( "Mismatch in number of phases between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); for( integer ip = 0; ip < lhs.numFluidPhases(); ++ip ) { GEOS_THROW_IF_NE_MSG( lhs.phaseNames()[ip], rhs.phaseNames()[ip], GEOS_FMT( "Mismatch in phase names between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); } } @@ -513,15 +510,15 @@ void compareMulticomponentModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & r { GEOS_THROW_IF_NE_MSG( lhs.numFluidComponents(), rhs.numFluidComponents(), GEOS_FMT( "Mismatch in number of components between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); for( integer ic = 0; ic < lhs.numFluidComponents(); ++ic ) { GEOS_THROW_IF_NE_MSG( lhs.componentNames()[ic], rhs.componentNames()[ic], GEOS_FMT( "Mismatch in component names between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); } } @@ -547,14 +544,16 @@ void CompositionalMultiphaseBase::initializeAquiferBC( ConstitutiveManager const string_array const & aquiferWaterPhaseCompNames = bc.getWaterPhaseComponentNames(); GEOS_ERROR_IF_NE_MSG( fluid0.numFluidComponents(), aquiferWaterPhaseCompFrac.size(), - getDataContext() << ": Mismatch in number of components between constitutive model " - << fluid0.getName() << " and the water phase composition in aquifer " << bc.getName() ); + "Mismatch in number of components between constitutive model " + << fluid0.getName() << " and the water phase composition in aquifer " << bc.getName(), + getDataContext() ); for( integer ic = 0; ic < fluid0.numFluidComponents(); ++ic ) { GEOS_ERROR_IF_NE_MSG( fluid0.componentNames()[ic], aquiferWaterPhaseCompNames[ic], - getDataContext() << ": Mismatch in component names between constitutive model " - << fluid0.getName() << " and the water phase components in aquifer " << bc.getName() ); + "Mismatch in component names between constitutive model " + << fluid0.getName() << " and the water phase components in aquifer " << bc.getName(), + getDataContext() ); } } ); } @@ -613,12 +612,12 @@ void CompositionalMultiphaseBase::validateConstitutiveModels( DomainPartition co bool const isFluidModelThermal = fluid.isThermal(); GEOS_THROW_IF( m_isThermal && !isFluidModelThermal, - GEOS_FMT( "CompositionalMultiphaseBase {}: the thermal option is enabled in the solver, but the fluid model {} is incompatible with the thermal option", - getDataContext(), fluid.getDataContext() ), + GEOS_FMT( "The thermal option is enabled in the solver, but the fluid model {} is incompatible with the thermal option", + fluid.getName() ), InputError, getDataContext(), fluid.getDataContext() ); GEOS_THROW_IF( !m_isThermal && isFluidModelThermal, - GEOS_FMT( "CompositionalMultiphaseBase {}: the thermal option is enabled in fluid model {}, but the solver options are incompatible with the thermal option", - getDataContext(), fluid.getDataContext() ), + GEOS_FMT( "The thermal option is enabled in fluid model {}, but the solver options are incompatible with the thermal option", + fluid.getName() ), InputError, getDataContext(), fluid.getDataContext() ); string const & relpermName = subRegion.getReference< string >( viewKeyStruct::relPermNamesString() ); @@ -925,8 +924,9 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, 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 ) ); + GEOS_FMT( "negative global component fraction values found in subregion '{}' for {} elements", + subRegion.getName(), negativeValues ), + getDataContext(), subRegion.getDataContext() ); localIndex const totalSupFrac = MpiWrapper::sum( localTooHighFracCount.get() ); localIndex const totalInfFrac = MpiWrapper::sum( localTooLowFracCount.get() ); @@ -1119,26 +1119,23 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition // check that the gravity vector is aligned with the z-axis GEOS_THROW_IF( !isZero( gravVector[0] ) || !isZero( gravVector[1] ), - getCatalogName() << " " << getDataContext() << - ": the gravity vector specified in this simulation (" << gravVector[0] << " " << gravVector[1] << " " << gravVector[2] << + "The gravity vector specified in this simulation (" << gravVector[0] << " " << gravVector[1] << " " << gravVector[2] << ") is not aligned with the z-axis. \n" - "This is incompatible with the " << bc.getCatalogName() << " " << bc.getDataContext() << - "used in this simulation. To proceed, you can either: \n" << + "This is incompatible with the " << bc.getCatalogName() << + " used in this simulation. To proceed, you can either: \n" << " - Use a gravityVector aligned with the z-axis, such as (0.0,0.0,-9.81)\n" << " - Remove the hydrostatic equilibrium initial condition from the XML file", InputError, getDataContext(), bc.getDataContext() ); // ensure that the temperature and composition tables are defined GEOS_THROW_IF( bc.getTemperatureVsElevationTableName().empty(), - getCatalogName() << " " << bc.getDataContext() - << ": " << EquilibriumInitialCondition::viewKeyStruct::temperatureVsElevationTableNameString() - << " must be provided for a multiphase simulation", - InputError ); + EquilibriumInitialCondition::viewKeyStruct::temperatureVsElevationTableNameString() + << " must be provided for a multiphase simulation", + InputError, bc.getDataContext() ); GEOS_THROW_IF( bc.getComponentFractionVsElevationTableNames().empty(), - getCatalogName() << " " << bc.getDataContext() - << ": " << EquilibriumInitialCondition::viewKeyStruct::componentFractionVsElevationTableNamesString() - << " must be provided for a multiphase simulation", - InputError ); + EquilibriumInitialCondition::viewKeyStruct::componentFractionVsElevationTableNamesString() + << " must be provided for a multiphase simulation", + InputError, bc.getDataContext() ); } ); if( equilCounter == 0 ) @@ -1201,7 +1198,7 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition real64 const eps = 0.1 * (maxElevation - minElevation); // we add a small buffer to only log in the pathological cases GEOS_LOG_RANK_0_IF( ( (datumElevation > globalMaxElevation[equilIndex]+eps) || (datumElevation < globalMinElevation[equilIndex]-eps) ), getCatalogName() << " " << getDataContext() << - ": By looking at the elevation of the cell centers in this model, GEOS found that " << + "By looking at the elevation of the cell centers in this model, GEOS found that " << "the min elevation is " << globalMinElevation[equilIndex] << " and the max elevation is " << globalMaxElevation[equilIndex] << "\nBut, a datum elevation of " << datumElevation << " was specified in the input file to equilibrate the model.\n " << @@ -1292,13 +1289,13 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition string_array const & componentNames = fs.getComponentNames(); GEOS_THROW_IF( fluid.componentNames().size() != componentNames.size(), "Mismatch in number of components between constitutive model " - << fluid.getDataContext() << " and the Equilibrium initial condition " << fs.getDataContext(), + << fluid.getName() << " and the Equilibrium initial condition " << fs.getName(), InputError, fluid.getDataContext(), fs.getDataContext() ); for( integer ic = 0; ic < fluid.numFluidComponents(); ++ic ) { GEOS_THROW_IF( fluid.componentNames()[ic] != componentNames[ic], "Mismatch in component names between constitutive model " - << fluid.getDataContext() << " and the Equilibrium initial condition " << fs.getDataContext(), + << fluid.getName() << " and the Equilibrium initial condition " << fs.getName(), InputError, fluid.getDataContext(), fs.getDataContext() ); } @@ -1310,7 +1307,7 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition GEOS_THROW_IF( itPhaseNames == std::end( phaseNames ), getCatalogName() << " " << getDataContext() << ": phase name " << initPhaseName << " not found in the phases of " << fluid.getDataContext(), - InputError ); + InputError, getDataContext() ); ipInit = std::distance( std::begin( phaseNames ), itPhaseNames ); } @@ -1392,8 +1389,7 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition phaseCompFrac.toView() ); GEOS_THROW_IF( returnValue == Kernel::ReturnType::FAILED_TO_CONVERGE, - getCatalogName() << " " << getDataContext() << - ": hydrostatic pressure initialization failed to converge in region " << region.getName() << "! \n" << + "hydrostatic pressure initialization failed to converge in region " << region.getName() << "! \n" << "Try to loosen the equilibration tolerance, or increase the number of equilibration iterations. \n" << "If nothing works, something may be wrong in the fluid model, see ", std::runtime_error, getDataContext() ); @@ -1531,8 +1527,8 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition } ); GEOS_ERROR_IF( minPressure.get() < 0.0, - GEOS_FMT( "{}: A negative pressure of {} Pa was found during hydrostatic initialization in region/subRegion {}/{}", - getDataContext(), minPressure.get(), region.getName(), subRegion.getName() ) ); + GEOS_FMT( "A negative pressure of {} Pa was found during hydrostatic initialization in region/subRegion {}/{}", + minPressure.get(), region.getName(), subRegion.getName() ), getDataContext() ); // For multiphase initialisation, after the computation of the pressure and composition, we invert // the capillary pressure curves to calculate new saturations. @@ -2047,7 +2043,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::invalidComponentIndex( comp, fs.getName(), - flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ), fs.getDataContext() ); return; // can't check next part with invalid component id } @@ -2111,8 +2107,7 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, if( m_nonlinearSolverParameters.m_numNewtonIterations == 0 ) { bool const bcConsistent = validateDirichletBC( domain, time_n + dt ); - GEOS_ERROR_IF( !bcConsistent, - GEOS_FMT( "CompositionalMultiphaseBase {}: inconsistent boundary conditions", getDataContext() ), + GEOS_ERROR_IF( !bcConsistent, "CompositionalMultiphaseBase: inconsistent boundary conditions", getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index f4a8d3c3ffd..9ae57598d88 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -134,8 +134,8 @@ void CompositionalMultiphaseFVM::postInputInitialization() if( m_dbcParams.useDBC ) // z_c formulation is not compatible with DBC { - GEOS_ERROR( GEOS_FMT( "{}: '{}' is not compatible with {}", - getDataContext(), formulationName, viewKeyStruct::useDBCString() ) ); + GEOS_ERROR( GEOS_FMT( " '{}' is not compatible", formulationName ), + getWrapperDataContext( viewKeyStruct::useDBCString() ) ); } DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); @@ -146,10 +146,9 @@ void CompositionalMultiphaseFVM::postInputInitialization() if( upwindingParams.upwindingScheme == UpwindingScheme::C1PPU || upwindingParams.upwindingScheme == UpwindingScheme::IHU ) { - GEOS_ERROR( GEOS_FMT( "{}: {} is not available for {}", - getDataContext(), + GEOS_ERROR( GEOS_FMT( "{} is not available for {}", EnumStrings< UpwindingScheme >::toString( upwindingParams.upwindingScheme ), - formulationName ) ); + formulationName ), getDataContext() ); } } } @@ -189,9 +188,10 @@ void CompositionalMultiphaseFVM::initializePreSubGroups() if( m_scalingType == ScalingType::Local && m_nonlinearSolverParameters.m_lineSearchAction != NonlinearSolverParameters::LineSearchAction::None ) { - GEOS_ERROR( GEOS_FMT( "{}: line search is not supported for {} = {}", - getName(), viewKeyStruct::scalingTypeString(), - EnumStrings< ScalingType >::toString( ScalingType::Local )) ); + GEOS_ERROR( GEOS_FMT( "line search is not supported for {} = {}", + viewKeyStruct::scalingTypeString(), + EnumStrings< ScalingType >::toString( ScalingType::Local )), + getDataContext()); } m_linearSolverParameters.get().mgr.strategy = m_isThermal @@ -205,8 +205,7 @@ void CompositionalMultiphaseFVM::initializePreSubGroups() FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); GEOS_ERROR_IF( fluxApprox.upwindingParams().upwindingScheme == UpwindingScheme::HU2PH && m_numPhases != 2, - GEOS_FMT( "{}: upwinding scheme {} only supports 2-phase flow", - getDataContext(), + GEOS_FMT( "upwinding scheme {} only supports 2-phase flow", EnumStrings< UpwindingScheme >::toString( UpwindingScheme::HU2PH )), getDataContext() ); } @@ -1266,9 +1265,7 @@ void CompositionalMultiphaseFVM::applyFaceDirichletBC( real64 const time_n, if( m_nonlinearSolverParameters.m_numNewtonIterations == 0 ) { bool const bcConsistent = validateFaceDirichletBC( domain, time_n + dt ); - GEOS_ERROR_IF( !bcConsistent, - GEOS_FMT( "{}: inconsistent boundary conditions", getDataContext() ), - getDataContext() ); + GEOS_ERROR_IF( !bcConsistent, "inconsistent boundary conditions", getDataContext() ); } using namespace isothermalCompositionalMultiphaseFVMKernels; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp index 7f1998b66a1..fefc0fd40fb 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp @@ -19,6 +19,7 @@ #include "CompositionalMultiphaseHybridFVM.hpp" +#include "common/logger/Logger.hpp" #include "mesh/DomainPartition.hpp" #include "constitutive/ConstitutivePassThru.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" @@ -123,13 +124,11 @@ void CompositionalMultiphaseHybridFVM::initializePreSubGroups() FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); GEOS_THROW_IF( !fvManager.hasGroup< HybridMimeticDiscretization >( m_discretizationName ), - getCatalogName() << " " << getDataContext() << - ": the HybridMimeticDiscretization must be selected with CompositionalMultiphaseHybridFVM", + "The HybridMimeticDiscretization must be selected with CompositionalMultiphaseHybridFVM", InputError, getDataContext() ); GEOS_THROW_IF( m_hasCapPressure, - getCatalogName() << " " << getDataContext() << - ": capillary pressure is not yet supported by CompositionalMultiphaseHybridFVM", + "Capillary pressure is not yet supported by CompositionalMultiphaseHybridFVM", InputError, getDataContext() ); } @@ -147,8 +146,8 @@ void CompositionalMultiphaseHybridFVM::initializePostInitialConditionsPreSubGrou if( dynamicCast< QuasiRTInnerProduct const * >( &mimeticInnerProductBase ) || dynamicCast< SimpleInnerProduct const * >( &mimeticInnerProductBase ) ) { - GEOS_ERROR( getCatalogName() << " " << getDataContext() << - "The QuasiRT, and Simple inner products are only available in SinglePhaseHybridFVM" ); + GEOS_ERROR( "The QuasiRT, QuasiTPFA, and Simple inner products are only available in SinglePhaseHybridFVM", + getDataContext() ); } m_lengthTolerance = domain.getMeshBody( 0 ).getGlobalLengthScale() * 1e-8; @@ -180,9 +179,8 @@ void CompositionalMultiphaseHybridFVM::initializePostInitialConditionsPreSubGrou } ); GEOS_THROW_IF( minVal.get() <= 0.0, - getCatalogName() << " " << getDataContext() << - ": the transmissibility multipliers used in SinglePhaseHybridFVM must be strictly larger than 0.0", - std::runtime_error ); + "The transmissibility multipliers used in SinglePhaseHybridFVM must be strictly larger than 0.0", + std::runtime_error, getDataContext() ); // Initialize face-based constitutive property arrays to zero to prevent uninitialized memory usage on GPU arrayView2d< real64, compflow::USD_PHASE > facePhaseMob = faceManager.getField< flow::facePhaseMobility >(); @@ -229,9 +227,9 @@ void CompositionalMultiphaseHybridFVM::initializePostInitialConditionsPreSubGrou fsManager.forSubGroups< AquiferBoundaryCondition >( [&] ( AquiferBoundaryCondition const & bc ) { - GEOS_LOG_RANK_0( getCatalogName() << " " << getDataContext() << ": An aquifer boundary condition named " << - bc.getName() << " was requested in the XML file. \n" << - "This type of boundary condition is not yet supported by CompositionalMultiphaseHybridFVM and will be ignored" ); + GEOS_WARNING( "An aquifer boundary condition named " << bc.getName() << " was requested in the XML file. \n" << + "This type of boundary condition is not yet supported by CompositionalMultiphaseHybridFVM and will be ignored", + getDataContext() ); } ); } ); @@ -908,7 +906,7 @@ void CompositionalMultiphaseHybridFVM::applyFaceDirichletBC( real64 const time_n else if( numFacesPerElement == 13 ) launchKernel( IP_TAG, std::integral_constant< integer, 13 >{} ); else - GEOS_ERROR( "Unsupported number of faces per element: " << numFacesPerElement ); + GEOS_ERROR( "Unsupported number of faces per element: " << numFacesPerElement, getDataContext() ); }; // Inner-product selection @@ -926,7 +924,7 @@ void CompositionalMultiphaseHybridFVM::applyFaceDirichletBC( real64 const time_n } else { - GEOS_ERROR( "Unsupported inner product type: " << innerProductType ); + GEOS_ERROR( "Unsupported inner product type: " << innerProductType, getDataContext() ); } }; @@ -935,7 +933,7 @@ void CompositionalMultiphaseHybridFVM::applyFaceDirichletBC( real64 const time_n else if( m_numPhases == 3 ) launchWithPhases( std::integral_constant< integer, 3 >{} ); else - GEOS_ERROR( "Unsupported number of phases: " << m_numPhases ); + GEOS_ERROR( "Unsupported number of phases: " << m_numPhases, getDataContext() ); } ); } } ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp index ab798921033..c83695e5a98 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp @@ -73,9 +73,8 @@ void CompositionalMultiphaseStatistics::postInputInitialization() if( dynamicCast< CompositionalMultiphaseHybridFVM * >( m_solver ) && m_computeCFLNumbers != 0 ) { - GEOS_THROW( GEOS_FMT( "{} {}: the option to compute CFL numbers is incompatible with CompositionalMultiphaseHybridFVM", - catalogName(), getDataContext() ), - InputError ); + GEOS_THROW( "The option to compute CFL numbers is incompatible with CompositionalMultiphaseHybridFVM", + InputError, getDataContext() ); } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index 3cba71973ca..bbc5a8466c3 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -369,15 +369,17 @@ void FlowSolverBase::checkDiscretizationName() const if( !discretizationMethods.empty()) { - GEOS_ERROR( GEOS_FMT( "{}: can not find discretization named '{}' in 'FiniteVolume'.\nFound discretization : {}", - getDataContext(), m_discretizationName, discretizationMethods, - stringutilities::join( discretizationMethods, ", " ))); + GEOS_ERROR( GEOS_FMT( "can not find discretization named '{}' in 'FiniteVolume'.\nFound discretization : {}", + m_discretizationName, discretizationMethods, + stringutilities::join( discretizationMethods, ", " )), + getDataContext()); } else { - GEOS_ERROR( GEOS_FMT( "{}: can not find discretization named '{}' in 'FiniteVolume'.\n" \ + GEOS_ERROR( GEOS_FMT( "can not find discretization named '{}' in 'FiniteVolume'.\n" \ "No discretization found, check that you have correctly entered a numerical method", - getDataContext(), m_discretizationName )); + m_discretizationName ), + getDataContext()); } } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp index a198a78cb17..b1dc1a08fb9 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp @@ -143,9 +143,9 @@ void ImmiscibleMultiphaseFlow::registerDataOnMesh( Group & meshBodies ) string & capPresName = subRegion.getReference< string >( viewKeyStruct::capPressureNamesString() ); capPresName = getConstitutiveName< CapillaryPressureBase >( subRegion ); GEOS_THROW_IF( capPresName.empty(), - GEOS_FMT( "{}: Capillary pressure model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + GEOS_FMT( "Capillary pressure model not found on subregion {}", + subRegion.getName() ), + InputError, getDataContext(), subRegion.getDataContext() ); } // The resizing of the arrays needs to happen here, before the call to initializePreSubGroups, @@ -723,13 +723,15 @@ bool ImmiscibleMultiphaseFlow::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::missingPressure( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + fields::flow::pressure::key() ), + getDataContext() ); } if( comp < 0 || comp >= m_numPhases ) { bcConsistent = false; GEOS_WARNING( BCMessage::invalidComponentIndex( comp, fs.getName(), - fields::immiscibleMultiphaseFlow::phaseVolumeFraction::key() ) ); + fields::immiscibleMultiphaseFlow::phaseVolumeFraction::key() ), + getDataContext() ); return; // can't check next part with invalid component id } @@ -742,7 +744,8 @@ bool ImmiscibleMultiphaseFlow::validateDirichletBC( DomainPartition & domain, string_array const & componentNames = bc.getComponentNames(); GEOS_WARNING( BCMessage::conflictingComposition( comp, componentNames[comp], regionName, subRegionName, setName, - fields::immiscibleMultiphaseFlow::phaseVolumeFraction::key() ) ); + fields::immiscibleMultiphaseFlow::phaseVolumeFraction::key() ) + , getDataContext() ); } ); } compMask.set( comp ); @@ -793,7 +796,7 @@ void ImmiscibleMultiphaseFlow::applyDirichletBC( real64 const time_n, if( m_nonlinearSolverParameters.m_numNewtonIterations == 0 ) { bool const bcConsistent = validateDirichletBC( domain, time_n + dt ); - GEOS_ERROR_IF( !bcConsistent, GEOS_FMT( "ImmiscibleMultiphaseFlow {}: inconsistent boundary conditions", getDataContext() ) ); + GEOS_ERROR_IF( !bcConsistent, "ImmiscibleMultiphaseFlow : inconsistent boundary conditions", getDataContext() ); } FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp index 0d73fce12dd..82c15573fbd 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp @@ -188,13 +188,13 @@ void ReactiveCompositionalMultiphaseOBL::postInputInitialization() PhysicsSolverBase::postInputInitialization(); GEOS_THROW_IF_GT_MSG( m_maxCompFracChange, 1.0, - GEOS_FMT( "{}: The maximum absolute change in component fraction is set to {}, while it must not be greater than 1.0", - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ), m_maxCompFracChange ), - InputError ); + GEOS_FMT( "The maximum absolute change in component fraction is set to {}, while it must not be greater than 1.0", + m_maxCompFracChange ), + InputError, getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); GEOS_THROW_IF_LT_MSG( m_maxCompFracChange, 0.0, - GEOS_FMT( "{}: The maximum absolute change in component fraction is set to {}, while it must not be lesser than 0.0", - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ), m_maxCompFracChange ), - InputError ); + GEOS_FMT( "The maximum absolute change in component fraction is set to {}, while it must not be lesser than 0.0", + m_maxCompFracChange ), + InputError, getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); m_OBLOperatorsTable = makeOBLOperatorsTable( m_OBLOperatorsTableFile, FunctionManager::getInstance()); @@ -205,20 +205,18 @@ void ReactiveCompositionalMultiphaseOBL::postInputInitialization() m_numOBLOperators = COMPUTE_NUM_OPS( m_numPhases, m_numComponents, m_enableEnergyBalance ); GEOS_THROW_IF_NE_MSG( m_numDofPerCell, m_OBLOperatorsTable->numDims(), - GEOS_FMT( "The number of degrees of freedom per cell used in the solver (at {}) has a value of {}, " + GEOS_FMT( "The number of degrees of freedom per cell used in the solver has a value of {}, " "whereas it as a value of {} in the operator table (at {}).", - getWrapperDataContext( viewKeyStruct::elemDofFieldString() ), m_numDofPerCell, m_OBLOperatorsTable->numDims(), m_OBLOperatorsTableFile ), - InputError ); + InputError, getWrapperDataContext( viewKeyStruct::elemDofFieldString() ) ); GEOS_THROW_IF_NE_MSG( m_numOBLOperators, m_OBLOperatorsTable->numOps(), - GEOS_FMT( "The number of operators per cell used in the solver (at {}) has a value of {}, " + GEOS_FMT( "The number of operators per cell used in the solver has a value of {}, " "whereas it as a value of {} in the operator table (at {}).", - getWrapperDataContext( viewKeyStruct::elemDofFieldString() ), m_numDofPerCell, m_OBLOperatorsTable->numDims(), m_OBLOperatorsTableFile ), - InputError ); + InputError, getWrapperDataContext( viewKeyStruct::elemDofFieldString() ) ); } @@ -965,13 +963,13 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & { bcConsistent = false; GEOS_WARNING( BCMessage::missingPressure( regionName, subRegionName, setName, - flow::pressure::key() ) ); + flow::pressure::key() ), getDataContext() ); } if( comp < 0 || comp >= numComp ) { bcConsistent = false; GEOS_WARNING( BCMessage::invalidComponentIndex( comp, fs.getName(), - flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ), getDataContext() ); return; // can't check next part with invalid component id } @@ -984,7 +982,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & string_array const & componentNames = bc.getComponentNames(); GEOS_WARNING( BCMessage::conflictingComposition( comp, componentNames[comp], regionName, subRegionName, setName, - flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ), getDataContext() ); } ); } compMask.set( comp ); @@ -1068,8 +1066,7 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, if( m_nonlinearSolverParameters.m_numNewtonIterations == 0 ) { bool const bcConsistent = validateDirichletBC( domain, time + dt ); - GEOS_ERROR_IF( !bcConsistent, - GEOS_FMT( "CompositionalMultiphaseBase {}: inconsistent boundary conditions", getDataContext() ), + GEOS_ERROR_IF( !bcConsistent, "inconsistent boundary conditions", getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp index 9b06fff0cf3..9b0115cffdc 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp @@ -164,11 +164,11 @@ void SinglePhaseBase::validateConstitutiveModels( DomainPartition & domain ) con string const fluidModelName = castedFluid.getCatalogName(); GEOS_THROW_IF( m_isThermal && ((fluidModelName != "ThermalCompressibleSinglePhaseFluid") && (fluidModelName != "ReactiveThermalCompressibleSinglePhaseFluid")), GEOS_FMT( "SingleFluidBase {}: the thermal option is enabled in the solver, but the fluid model {} is not for thermal fluid", - getDataContext(), fluid.getDataContext() ), + fluid.getName() ), InputError, getDataContext(), fluid.getDataContext() ); GEOS_THROW_IF( !m_isThermal && ((fluidModelName == "ThermalCompressibleSinglePhaseFluid") || (fluidModelName == "ReactiveThermalCompressibleSinglePhaseFluid")), GEOS_FMT( "SingleFluidBase {}: the fluid model is for thermal fluid {}, but the solver option is incompatible with the fluid model", - getDataContext(), fluid.getDataContext() ), + fluid.getName() ), InputError, getDataContext(), fluid.getDataContext() ); } ); } ); @@ -414,10 +414,9 @@ void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) // check that the gravity vector is aligned with the z-axis GEOS_THROW_IF( !isZero( gravVector[0] ) || !isZero( gravVector[1] ), - getCatalogName() << " " << getDataContext() << - ": the gravity vector specified in this simulation (" << gravVector[0] << " " << gravVector[1] << " " << gravVector[2] << + "The gravity vector specified in this simulation (" << gravVector[0] << " " << gravVector[1] << " " << gravVector[2] << ") is not aligned with the z-axis. \n" - "This is incompatible with the " << bc.getCatalogName() << " " << bc.getDataContext() << + "This is incompatible with the " << bc.getCatalogName() << " " << bc.getName() << "used in this simulation. To proceed, you can either: \n" << " - Use a gravityVector aligned with the z-axis, such as (0.0,0.0,-9.81)\n" << " - Remove the hydrostatic equilibrium initial condition from the XML file", @@ -425,22 +424,19 @@ void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) // ensure that the temperature tables are defined for thermal simulations GEOS_THROW_IF( m_isThermal && bc.getTemperatureVsElevationTableName().empty(), - getCatalogName() << " " << bc.getDataContext() - << ": " << EquilibriumInitialCondition::viewKeyStruct::temperatureVsElevationTableNameString() - << " must be provided for a thermal simulation", + EquilibriumInitialCondition::viewKeyStruct::temperatureVsElevationTableNameString() + << " must be provided for a thermal simulation", InputError, getDataContext(), bc.getDataContext() ); //ensure that compositions are empty GEOS_THROW_IF( !bc.getComponentFractionVsElevationTableNames().empty(), - getCatalogName() << " " << bc.getDataContext() - << ": " << EquilibriumInitialCondition::viewKeyStruct::componentFractionVsElevationTableNamesString() - << " must not be provided for a single phase simulation.", + EquilibriumInitialCondition::viewKeyStruct::componentFractionVsElevationTableNamesString() + << " must not be provided for a single phase simulation.", InputError, getDataContext(), bc.getDataContext() ); GEOS_THROW_IF( !bc.getComponentNames().empty(), - getCatalogName() << " " << bc.getDataContext() - << ": " << EquilibriumInitialCondition::viewKeyStruct::componentNamesString() - << " must not be provided for a single phase simulation.", + EquilibriumInitialCondition::viewKeyStruct::componentNamesString() + << " must not be provided for a single phase simulation.", InputError, getDataContext(), bc.getDataContext() ); } ); @@ -497,7 +493,7 @@ void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) real64 const eps = 0.1 * (maxElevation - minElevation); // we add a small buffer to only log in the pathological cases GEOS_LOG_RANK_0_IF( ( (datumElevation > globalMaxElevation[equilIndex]+eps) || (datumElevation < globalMinElevation[equilIndex]-eps) ), getCatalogName() << " " << getDataContext() << - ": By looking at the elevation of the cell centers in this model, GEOS found that " << + "By looking at the elevation of the cell centers in this model, GEOS found that " << "the min elevation is " << globalMinElevation[equilIndex] << " and the max elevation is " << globalMaxElevation[equilIndex] << "\nBut, a datum elevation of " << datumElevation << " was specified in the input file to equilibrate the model.\n " << @@ -577,8 +573,7 @@ void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) pressureValues.toView() ); GEOS_THROW_IF( !equilHasConverged, - getCatalogName() << " " << getDataContext() << - ": hydrostatic pressure initialization failed to converge in region " << region.getName() << "!", + "Hydrostatic pressure initialization failed to converge in region " << region.getName() << "!", std::runtime_error, getDataContext() ); } ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp index 5ae213a31b2..13e038c9142 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp @@ -19,6 +19,7 @@ #include "SinglePhaseHybridFVM.hpp" +#include "common/logger/Logger.hpp" #include "constitutive/ConstitutivePassThru.hpp" #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp" #include "fieldSpecification/AquiferBoundaryCondition.hpp" @@ -94,8 +95,7 @@ void SinglePhaseHybridFVM::initializePreSubGroups() SinglePhaseBase::initializePreSubGroups(); GEOS_THROW_IF( m_isThermal, - GEOS_FMT( "{} {}: The thermal option is not supported by SinglePhaseHybridFVM", - getCatalogName(), getDataContext().toString() ), + "The thermal option is not supported by SinglePhaseHybridFVM", InputError, getDataContext() ); DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); @@ -103,8 +103,7 @@ void SinglePhaseHybridFVM::initializePreSubGroups() FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); GEOS_THROW_IF( !fvManager.hasGroup< HybridMimeticDiscretization >( m_discretizationName ), - getCatalogName() << " " << getDataContext() << - ": the HybridMimeticDiscretization must be selected with SinglePhaseHybridFVM", + "The HybridMimeticDiscretization must be selected with SinglePhaseHybridFVM", InputError, getDataContext() ); } @@ -139,16 +138,15 @@ void SinglePhaseHybridFVM::initializePostInitialConditionsPreSubGroups() } ); GEOS_THROW_IF_LE_MSG( minVal.get(), 0.0, - getCatalogName() << " " << getDataContext() << "The transmissibility multipliers used in SinglePhaseHybridFVM must strictly larger than 0.0", - std::runtime_error ); + std::runtime_error, getDataContext() ); FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); fsManager.forSubGroups< AquiferBoundaryCondition >( [&] ( AquiferBoundaryCondition const & bc ) { - GEOS_LOG_RANK_0( getCatalogName() << " " << getDataContext() << - "The aquifer boundary condition " << bc.getDataContext() << " was requested in the XML file. \n" << - "This type of boundary condition is not yet supported by SinglePhaseHybridFVM and will be ignored" ); + GEOS_WARNING( "The aquifer boundary condition was requested in the XML file. \n" << + "This type of boundary condition is not yet supported by SinglePhaseHybridFVM and will be ignored", + getDataContext(), bc.getDataContext() ); } ); } ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp index ab76d6cf7bf..33444b3aaa9 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp @@ -258,7 +258,8 @@ void SinglePhaseStatistics::computeRegionStatistics( real64 const time, { stats.averagePressure = 0.0; stats.averageTemperature = 0.0; - GEOS_WARNING( GEOS_FMT( "{}, {}: Cannot compute average pressure & temperature because region pore volume is zero.", getName(), regionNames[i] ) ); + GEOS_WARNING( GEOS_FMT( "{}: Cannot compute average pressure & temperature because region pore volume is zero.", regionNames[i] ), + getDataContext() ); } string_view massUnit = units::getSymbol( m_solver->getMassUnit() ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp index e454f54030d..77c7a48f690 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp @@ -58,19 +58,19 @@ void SourceFluxStatsAggregator::postInputInitialization() m_fluxNames.emplace_back( string( sourceFlux.getName() ) ); } ); GEOS_WARNING_IF( m_fluxNames.empty(), - GEOS_FMT( "{}: No {} was found in {}.", - getDataContext(), SourceFluxBoundaryCondition::catalogName(), - fsManager.getDataContext() ), - getDataContext(), fsManager.getDataContext() ); + GEOS_FMT( "No {} was found in {}.", + SourceFluxBoundaryCondition::catalogName(), fsManager.getName() ), + getDataContext(), fsManager.getDataContext(), getDataContext() ); } else { for( string const & fluxName : m_fluxNames ) { GEOS_ERROR_IF( !fsManager.hasGroup< SourceFluxBoundaryCondition >( fluxName ), - GEOS_FMT( "{}: No {} named {} was found in {}.", - getDataContext(), SourceFluxBoundaryCondition::catalogName(), - fluxName, fsManager.getDataContext() ), getDataContext() ); + GEOS_FMT( "No {} named {} was found in {}.", + SourceFluxBoundaryCondition::catalogName(), + fluxName, fsManager.getName() ), + getDataContext(), fsManager.getDataContext(), getDataContext() ); } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp index 5accd9a0def..f94bf37302e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp @@ -69,9 +69,7 @@ void StencilDataCollection::postInputInitialization() m_solver = physicsSolverManager.getGroupPointer< FlowSolverBase >( m_solverName ); GEOS_THROW_IF( m_solver == nullptr, - GEOS_FMT( "{}: Could not find flow solver named '{}'.", - getDataContext(), - m_solverName ), + GEOS_FMT( "Could not find flow solver named '{}'.", m_solverName ), InputError, getDataContext() ); } @@ -91,8 +89,9 @@ void StencilDataCollection::postInputInitialization() } catch( BadTypeError const & e ) { // only TPFA is supported for now - GEOS_ERROR( GEOS_FMT( "{}: target discretization is not supported by {} (for now, only '{}' is).", - getDataContext(), catalogName(), TwoPointFluxApproximation::catalogName() ) ); + GEOS_ERROR( GEOS_FMT( "target discretization is not supported by {} (for now, only '{}' is).", + catalogName(), TwoPointFluxApproximation::catalogName() ), + getDataContext() ); } } } @@ -113,11 +112,9 @@ void StencilDataCollection::initializePostInitialConditionsPostSubGroups() getName(), connCount, m_discretization->getName() ) ); ++supportedStencilCount; } ); - GEOS_ERROR_IF( supportedStencilCount == 0, - GEOS_FMT( "{}: No compatible discretization was found.", getDataContext() ), + GEOS_ERROR_IF( supportedStencilCount == 0, "No compatible discretization was found.", getDataContext() ); - GEOS_ERROR_IF( supportedStencilCount > 1, - GEOS_FMT( "{}: Multiple discretization was found.", getDataContext() ), + GEOS_ERROR_IF( supportedStencilCount > 1, "Multiple discretization was found.", getDataContext() ); } @@ -269,8 +266,8 @@ void StencilDataCollection::storeConnectionData( string_view stencilName, { // data storing GEOS_ERROR_IF_NE_MSG( size_t( m_cellAGlobalId.size() ), size_t( sortedData.size() ), - GEOS_FMT( "{}: Unexpected stencil size!\n{}", - getDataContext(), formatKernelDataExtract( kernelData, 8 ) ) ); + GEOS_FMT( "Unexpected stencil size!\n{}", formatKernelDataExtract( kernelData, 8 ) ), + getDataContext() ); globalIndex i = 0; for( ConnectionData const & conn : sortedData ) { diff --git a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp index 98f54f20a2f..7ca9b25ff24 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp @@ -701,7 +701,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, string const & subRegionName = subRegion.getName(); GEOS_ERROR_IF( bcStatusMap[subRegionName].count( setName ) > 0, - getDataContext() << ": Conflicting proppant boundary conditions on set " << setName, + "Conflicting proppant boundary conditions on set " << setName, getDataContext() ); bcStatusMap[subRegionName][setName].resize( m_numComponents ); bcStatusMap[subRegionName][setName].setValues< serialPolicy >( false ); @@ -722,10 +722,10 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, localIndex const comp = fs.getComponent(); GEOS_ERROR_IF( bcStatusMap[subRegionName].count( setName ) == 0, - getDataContext() << ": Proppant boundary condition not prescribed on set '" << setName << "'", + "Proppant boundary condition not prescribed on set '" << setName << "'", getDataContext() ); GEOS_ERROR_IF( bcStatusMap[subRegionName][setName][comp], - getDataContext() << ": Conflicting composition[" << comp << "] boundary conditions on set '" << setName << "'", + "Conflicting composition[" << comp << "] boundary conditions on set '" << setName << "'", getDataContext() ); bcStatusMap[subRegionName][setName][comp] = true; @@ -745,7 +745,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, { bcConsistent &= bcStatusEntryInner.second[ic]; GEOS_WARNING_IF( !bcConsistent, - getDataContext() << ": Composition boundary condition not applied to component " << + "Composition boundary condition not applied to component " << ic << " on region '" << bcStatusEntryOuter.first << "'," << " set '" << bcStatusEntryInner.first << "'", getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp index 28def34e770..07b796f9dce 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp @@ -126,15 +126,15 @@ void CompositionalMultiphaseWell::postInputInitialization() WellSolverBase::postInputInitialization(); GEOS_ERROR_IF_GT_MSG( m_maxCompFracChange, 1.0, - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) << - ": The maximum absolute change in component fraction must smaller or equal to 1.0" ); + "The maximum absolute change in component fraction must smaller or equal to 1.0", + getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); GEOS_ERROR_IF_LT_MSG( m_maxCompFracChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) << - ": The maximum absolute change in component fraction must larger or equal to 0.0" ); + "The maximum absolute change in component fraction must larger or equal to 0.0", + getWrapperDataContext( viewKeyStruct::maxCompFracChangeString() ) ); GEOS_ERROR_IF_LE_MSG( m_maxRelativeCompDensChange, 0.0, - getWrapperDataContext( viewKeyStruct::maxRelativeCompDensChangeString() ) << - ": The maximum relative change in component density must be larger than 0.0" ); + "The maximum relative change in component density must be larger than 0.0", + getWrapperDataContext( viewKeyStruct::maxRelativeCompDensChangeString() ) ); } void CompositionalMultiphaseWell::registerDataOnMesh( Group & meshBodies ) @@ -305,15 +305,15 @@ void compareMultiphaseModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & rhs ) { GEOS_THROW_IF_NE_MSG( lhs.numFluidPhases(), rhs.numFluidPhases(), GEOS_FMT( "Mismatch in number of phases between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); for( integer ip = 0; ip < lhs.numFluidPhases(); ++ip ) { GEOS_THROW_IF_NE_MSG( lhs.phaseNames()[ip], rhs.phaseNames()[ip], GEOS_FMT( "Mismatch in phase names between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); } } @@ -322,15 +322,15 @@ void compareMulticomponentModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & r { GEOS_THROW_IF_NE_MSG( lhs.numFluidComponents(), rhs.numFluidComponents(), GEOS_FMT( "Mismatch in number of components between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); for( integer ic = 0; ic < lhs.numFluidComponents(); ++ic ) { GEOS_THROW_IF_NE_MSG( lhs.componentNames()[ic], rhs.componentNames()[ic], GEOS_FMT( "Mismatch in component names between constitutive models {} and {}", - lhs.getDataContext(), rhs.getDataContext() ), - InputError ); + lhs.getName(), rhs.getName() ), + InputError, lhs.getDataContext(), rhs.getDataContext() ); } } @@ -401,29 +401,24 @@ void CompositionalMultiphaseWell::validateInjectionStreams( WellElementSubRegion integer const streamSize = injectionStream.size(); GEOS_THROW_IF( ( streamSize == 0 ), - "WellControls " << wellControls.getName() << - " : Injection stream not specified for well " << subRegion.getName(), - InputError ); + "Injection stream not specified for well ", + InputError, wellControls.getDataContext() ); GEOS_THROW_IF( ( streamSize != m_numComponents ), - "WellControls " << wellControls.getName() << - " : Injection stream for well " << subRegion.getName() << " should have " << - m_numComponents << " components.", - InputError ); + "Injection stream for well should have " << m_numComponents << " components.", + InputError, wellControls.getDataContext() ); real64 compFracSum = 0; for( integer ic = 0; ic < m_numComponents; ++ic ) { real64 const compFrac = injectionStream[ic]; GEOS_THROW_IF( ( compFrac < 0.0 ) || ( compFrac > 1.0 ), - "WellControls " << wellControls.getDataContext() << - ": Invalid injection stream for well " << subRegion.getName(), + "Invalid injection stream for well ", InputError, wellControls.getDataContext() ); compFracSum += compFrac; } GEOS_THROW_IF( ( compFracSum < 1.0 - std::numeric_limits< real64 >::epsilon() ) || ( compFracSum > 1.0 + std::numeric_limits< real64 >::epsilon() ), - "WellControls " << wellControls.getDataContext() << - ": Invalid injection stream for well " << subRegion.getName(), + "Invalid injection stream for well ", InputError, wellControls.getDataContext() ); } } @@ -452,8 +447,9 @@ void CompositionalMultiphaseWell::validateWellConstraints( real64 const & time_n string_array const & targetRegionsNames = flowSolver.getTargetRegionNames(); auto const pos = std::find( targetRegionsNames.begin(), targetRegionsNames.end(), regionName ); GEOS_ERROR_IF( pos == targetRegionsNames.end(), - GEOS_FMT( "{}: Region {} is not a target of the reservoir solver and cannot be used for referenceReservoirRegion in WellControl {}.", - getDataContext(), regionName, wellControls.getName() ) ); + GEOS_FMT( "Region {} is not a target of the reservoir solver and cannot be used for referenceReservoirRegion in WellControl {}.", + regionName, wellControls.getName() ), + getDataContext() ); } @@ -467,43 +463,34 @@ void CompositionalMultiphaseWell::validateWellConstraints( real64 const & time_n real64 const & targetMassRate = wellControls.getTargetMassRate( time_n ); GEOS_THROW_IF( wellControls.isInjector() && currentControl == WellControls::Control::PHASEVOLRATE, - "WellControls " << wellControls.getDataContext() << - ": Phase rate control is not available for injectors", + "Phase rate control is not available for injectors", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isProducer() && currentControl == WellControls::Control::TOTALVOLRATE, - "WellControls " << wellControls.getDataContext() << - ": Total rate control is not available for producers", + "Total rate control is not available for producers", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isInjector() && targetTotalRate < 0.0, - "WellControls " << wellControls.getDataContext() << - ": Target total rate cannot be negative for injectors", + "Target total rate cannot be negative for injectors", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isInjector() && !isZero( targetPhaseRate ), - "WellControls " << wellControls.getDataContext() << - ": Target phase rate cannot be used for injectors", + "Target phase rate cannot be used for injectors", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isProducer() && !isZero( targetTotalRate ), - "WellControls " << wellControls.getDataContext() << - ": Target total rate cannot be used for producers", + "Target total rate cannot be used for producers", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isProducer() && !isZero( targetMassRate ), - "WellControls " << wellControls.getDataContext() << - ": Target mass rate cannot be used for producers", + "Target mass rate cannot be used for producers", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( !m_useMass && !isZero( targetMassRate ), - "WellControls " << wellControls.getDataContext() << - ": Target mass rate cannot with useMass=0", + "Target mass rate cannot with useMass=0", InputError, wellControls.getDataContext() ); // The user always provides positive rates, but these rates are later multiplied by -1 internally for producers GEOS_THROW_IF( wellControls.isProducer() && targetPhaseRate > 0.0, - "WellControls " << wellControls.getDataContext() << - ": Target phase rate cannot be negative for producers", + "Target phase rate cannot be negative for producers", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( wellControls.isProducer() && !isZero( targetTotalRate ), - "WellControls " << wellControls.getDataContext() << - ": Target total rate cannot be used for producers", + "Target total rate cannot be used for producers", InputError, wellControls.getDataContext() ); // Find target phase index for phase rate constraint @@ -515,8 +502,7 @@ void CompositionalMultiphaseWell::validateWellConstraints( real64 const & time_n } } GEOS_THROW_IF( wellControls.isProducer() && m_targetPhaseIndex == -1, - "WellControls " << wellControls.getDataContext() << - ": Phase " << wellControls.getTargetPhaseName() << " not found for well control " << wellControls.getName(), + "Phase " << wellControls.getTargetPhaseName() << " not found", InputError, wellControls.getDataContext() ); } @@ -733,16 +719,18 @@ void CompositionalMultiphaseWell::updateVolRatesForConstraint( ElementRegionMana { ElementRegionBase const & region = elemManager.getRegion( wellControls.referenceReservoirRegion()); GEOS_ERROR_IF ( !region.hasWrapper( CompositionalMultiphaseStatistics::regionStatisticsName() ), - GEOS_FMT( "{}: WellControl {} referenceReservoirRegion field requires CompositionalMultiphaseStatistics to be configured for region {} ", - getDataContext(), wellControls.getName(), wellControls.referenceReservoirRegion() ) ); + GEOS_FMT( "WellControl {} referenceReservoirRegion field requires CompositionalMultiphaseStatistics to be configured for region {} ", + wellControls.getName(), wellControls.referenceReservoirRegion() ), + getDataContext() ); CompositionalMultiphaseStatistics::RegionStatistics const & stats = region.getReference< CompositionalMultiphaseStatistics::RegionStatistics >( CompositionalMultiphaseStatistics::regionStatisticsName() ); wellControls.setRegionAveragePressure( stats.averagePressure ); wellControls.setRegionAverageTemperature( stats.averageTemperature ); GEOS_ERROR_IF( stats.averagePressure <= 0.0, - GEOS_FMT( "{}: No region average quantities computed. WellControl {} referenceReservoirRegion field requires CompositionalMultiphaseStatistics to be configured for region {} ", - getDataContext(), wellControls.getName(), wellControls.referenceReservoirRegion() )); + GEOS_FMT( "No region average quantities computed. WellControl {} referenceReservoirRegion field requires CompositionalMultiphaseStatistics to be configured for region {} ", + wellControls.getName(), wellControls.referenceReservoirRegion() ), + getDataContext()); } // If flashPressure is not set by region the value is defaulted to -1 and indicates to use top segment conditions flashPressure = wellControls.getRegionAveragePressure(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp index 54716e387d4..6414693bf22 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp @@ -160,8 +160,9 @@ void SinglePhaseWell::validateWellConstraints( real64 const & time_n, string_array const & targetRegionsNames = flowSolver.getTargetRegionNames(); auto const pos = std::find( targetRegionsNames.begin(), targetRegionsNames.end(), regionName ); GEOS_ERROR_IF( pos == targetRegionsNames.end(), - GEOS_FMT( "{}: Region {} is not a target of the reservoir solver and cannot be used for referenceReservoirRegion in WellControl {}.", - getDataContext(), regionName, wellControls.getName() ) ); + GEOS_FMT( "Region {} is not a target of the reservoir solver and cannot be used for referenceReservoirRegion in WellControl {}.", + regionName, wellControls.getName() ), + getDataContext() ); } } @@ -169,18 +170,15 @@ void SinglePhaseWell::validateWellConstraints( real64 const & time_n, real64 const targetTotalRate = wellControls.getTargetTotalRate( time_n ); real64 const targetPhaseRate = wellControls.getTargetPhaseRate( time_n ); GEOS_THROW_IF( currentControl == WellControls::Control::PHASEVOLRATE, - "WellControls " << wellControls.getDataContext() << - ": Phase rate control is not available for SinglePhaseWell", + "Phase rate control is not available for SinglePhaseWell", InputError, wellControls.getDataContext() ); // The user always provides positive rates, but these rates are later multiplied by -1 internally for producers GEOS_THROW_IF( ( ( wellControls.isInjector() && targetTotalRate < 0.0 ) || ( wellControls.isProducer() && targetTotalRate > 0.0) ), - "WellControls " << wellControls.getDataContext() << - ": Target total rate cannot be negative", + "Target total rate cannot be negative", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( !isZero( targetPhaseRate ), - "WellControls " << wellControls.getDataContext() << - ": Target phase rate cannot be used for SinglePhaseWell", + "Target phase rate cannot be used for SinglePhaseWell", InputError, wellControls.getDataContext() ); } @@ -296,14 +294,16 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e { ElementRegionBase const & region = elemManager.getRegion( wellControls.referenceReservoirRegion() ); GEOS_ERROR_IF ( !region.hasWrapper( SinglePhaseStatistics::regionStatisticsName()), - GEOS_FMT( "{}: WellControl {} referenceReservoirRegion field requires SinglePhaseStatistics to be configured for region {} ", - getDataContext(), wellControls.getName(), wellControls.referenceReservoirRegion() ) ); + GEOS_FMT( "WellControl {} referenceReservoirRegion field requires SinglePhaseStatistics to be configured for region {} ", + wellControls.getName(), wellControls.referenceReservoirRegion() ), + getDataContext() ); SinglePhaseStatistics::RegionStatistics const & stats = region.getReference< SinglePhaseStatistics::RegionStatistics >( SinglePhaseStatistics::regionStatisticsName() ); GEOS_ERROR_IF( stats.averagePressure <= 0.0, GEOS_FMT( - "{}: No region average quantities computed. WellControl {} referenceReservoirRegion field requires SinglePhaseStatistics to be configured for region {} ", - getDataContext(), wellControls.getName(), wellControls.referenceReservoirRegion() )); + "No region average quantities computed. WellControl {} referenceReservoirRegion field requires SinglePhaseStatistics to be configured for region {} ", + wellControls.getName(), wellControls.referenceReservoirRegion() ), + getDataContext()); wellControls.setRegionAveragePressure( stats.averagePressure ); wellControls.setRegionAverageTemperature( stats.averageTemperature ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellControls.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellControls.cpp index d0d20deb642..684306cce46 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellControls.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellControls.cpp @@ -241,8 +241,7 @@ void WellControls::postInputInitialization() // When the simulation starts from a restart file, we don't want to use the inputControl, // because the control may have switched in the simulation that generated the restart GEOS_THROW_IF( m_inputControl == Control::UNINITIALIZED, - getWrapperDataContext( viewKeyStruct::inputControlString() ) << - ": Input well control cannot be uninitialized", + "Input well control cannot be uninitialized", InputError, getWrapperDataContext( viewKeyStruct::inputControlString() ) ); if( m_currentControl == Control::UNINITIALIZED ) @@ -252,28 +251,27 @@ void WellControls::postInputInitialization() // 1.a) check target BHP GEOS_THROW_IF( m_targetBHP < 0, - getWrapperDataContext( viewKeyStruct::targetBHPString() ) << - ": Target bottom-hole pressure is negative", + "Target bottom-hole pressure is negative", InputError, getWrapperDataContext( viewKeyStruct::targetBHPString() ) ); // 1.b) check target rates GEOS_THROW_IF( m_targetTotalRate < 0, - getWrapperDataContext( viewKeyStruct::targetTotalRateString() ) << ": Target rate is negative", + "Target rate is negative", InputError, getWrapperDataContext( viewKeyStruct::targetTotalRateString() ) ); GEOS_THROW_IF( m_targetPhaseRate < 0, - getWrapperDataContext( viewKeyStruct::targetPhaseRateString() ) << ": Target oil rate is negative", + "Target oil rate is negative", InputError, getWrapperDataContext( viewKeyStruct::targetPhaseRateString() ) ); GEOS_THROW_IF( m_targetMassRate < 0, - getWrapperDataContext( viewKeyStruct::targetMassRateString() ) << ": Target mass rate is negative", + "Target mass rate is negative", InputError, getWrapperDataContext( viewKeyStruct::targetMassRateString() ) ); GEOS_THROW_IF( (m_injectionStream.empty() && m_injectionTemperature >= 0) || (!m_injectionStream.empty() && m_injectionTemperature < 0), - "WellControls " << getDataContext() << ": Both " - << viewKeyStruct::injectionStreamString() << " and " << viewKeyStruct::injectionTemperatureString() - << " must be specified for multiphase simulations", + "Both " + << viewKeyStruct::injectionStreamString() << " and " << viewKeyStruct::injectionTemperatureString() + << " must be specified for multiphase simulations", InputError, getDataContext() ); // 1.c) Set the multiplier for the rates @@ -293,31 +291,31 @@ void WellControls::postInputInitialization() for( localIndex ic = 0; ic < m_injectionStream.size(); ++ic ) { GEOS_ERROR_IF( m_injectionStream[ic] < 0.0 || m_injectionStream[ic] > 1.0, - getWrapperDataContext( viewKeyStruct::injectionStreamString() ) << ": Invalid injection stream", + "Invalid injection stream", getWrapperDataContext( viewKeyStruct::injectionStreamString() ) ); sum += m_injectionStream[ic]; } GEOS_THROW_IF( LvArray::math::abs( 1.0 - sum ) > std::numeric_limits< real64 >::epsilon(), - getWrapperDataContext( viewKeyStruct::injectionStreamString() ) << ": Invalid injection stream", + "Invalid injection stream", InputError, getWrapperDataContext( viewKeyStruct::injectionStreamString() ) ); } // 3) check the flag for surface / reservoir conditions GEOS_THROW_IF( m_useSurfaceConditions != 0 && m_useSurfaceConditions != 1, - getWrapperDataContext( viewKeyStruct::useSurfaceConditionsString() ) << ": The flag to select surface/reservoir conditions must be equal to 0 or 1", + "The flag to select surface/reservoir conditions must be equal to 0 or 1", InputError, getWrapperDataContext( viewKeyStruct::useSurfaceConditionsString() ) ); // 4) check that at least one rate constraint has been defined GEOS_THROW_IF( ((m_targetPhaseRate <= 0.0 && m_targetPhaseRateTableName.empty()) && (m_targetMassRate <= 0.0 && m_targetMassRateTableName.empty()) && (m_targetTotalRate <= 0.0 && m_targetTotalRateTableName.empty())), - "WellControls " << getDataContext() << ": You need to specify a phase, mass, or total rate constraint. \n" << + "You need to specify a phase, mass, or total rate constraint. \n" << "The phase rate constraint can be specified using " << "either " << viewKeyStruct::targetPhaseRateString() << " or " << viewKeyStruct::targetPhaseRateTableNameString() << ".\n" << - "The total rate constraint can be specified using " << + "The total rate constraint can be specified using " << ".\n" << "either " << viewKeyStruct::targetTotalRateString() << - " or " << viewKeyStruct::targetTotalRateTableNameString()<< + " or " << viewKeyStruct::targetTotalRateTableNameString() << ".\n" << "The mass rate constraint can be specified using " << "either " << viewKeyStruct::targetMassRateString() << " or " << viewKeyStruct::targetMassRateTableNameString(), @@ -325,27 +323,27 @@ void WellControls::postInputInitialization() // 5) check whether redundant information has been provided GEOS_THROW_IF( ((m_targetPhaseRate > 0.0 && !m_targetPhaseRateTableName.empty())), - "WellControls " << getDataContext() << ": You have provided redundant information for well phase rate." << + "You have provided redundant information for well phase rate." << " The keywords " << viewKeyStruct::targetPhaseRateString() << " and " << viewKeyStruct::targetPhaseRateTableNameString() << " cannot be specified together", InputError, getDataContext() ); GEOS_THROW_IF( ((m_targetTotalRate > 0.0 && !m_targetTotalRateTableName.empty())), - "WellControls " << getDataContext() << ": You have provided redundant information for well total rate." << + "You have provided redundant information for well total rate." << " The keywords " << viewKeyStruct::targetTotalRateString() << " and " << viewKeyStruct::targetTotalRateTableNameString() << " cannot be specified together", InputError, getDataContext() ); GEOS_THROW_IF( ((m_targetBHP > 0.0 && !m_targetBHPTableName.empty())), - "WellControls " << getDataContext() << ": You have provided redundant information for well BHP." << + "You have provided redundant information for well BHP." << " The keywords " << viewKeyStruct::targetBHPString() << " and " << viewKeyStruct::targetBHPTableNameString() << " cannot be specified together", InputError, getDataContext() ); GEOS_THROW_IF( ((m_targetMassRate > 0.0 && !m_targetMassRateTableName.empty())), - "WellControls " << getDataContext() << ": You have provided redundant information for well mass rate." << + "You have provided redundant information for well mass rate." << " The keywords " << viewKeyStruct::targetMassRateString() << " and " << viewKeyStruct::targetMassRateTableNameString() << " cannot be specified together", InputError, getDataContext() ); GEOS_THROW_IF( ((m_targetMassRate > 0.0 && m_useSurfaceConditions==0)), - "WellControls " << getDataContext() << ": Option only valid if useSurfaceConditions set to 1", + "Option only valid if useSurfaceConditions set to 1", InputError, getDataContext() ); // 6.1) If the well is under BHP control then the BHP must be specified. @@ -353,8 +351,8 @@ void WellControls::postInputInitialization() if( m_currentControl == Control::BHP ) { GEOS_THROW_IF( ((m_targetBHP <= 0.0 && m_targetBHPTableName.empty())), - "WellControls " << getDataContext() << ": You have to provide well BHP by specifying either " - << viewKeyStruct::targetBHPString() << " or " << viewKeyStruct::targetBHPTableNameString(), + "You have to provide well BHP by specifying either " + << viewKeyStruct::targetBHPString() << " or " << viewKeyStruct::targetBHPTableNameString(), InputError, getDataContext() ); } else if( m_targetBHP <= 0.0 && m_targetBHPTableName.empty() ) @@ -368,20 +366,20 @@ void WellControls::postInputInitialization() // An injector must be controlled by TotalVolRate GEOS_THROW_IF( (isInjector() && (m_inputControl == Control::PHASEVOLRATE)), - "WellControls " << getDataContext() << ": You have to control an injector with " - << EnumStrings< Control >::toString( Control::TOTALVOLRATE ), + "You have to control an injector with " + << EnumStrings< Control >::toString( Control::TOTALVOLRATE ), InputError, getDataContext() ); // An injector must be controlled by TotalVolRate GEOS_THROW_IF( (isProducer() && (m_inputControl == Control::MASSRATE)), - "WellControls " << getDataContext() << ": You have to control an injector with " - << EnumStrings< Control >::toString( Control::MASSRATE ), + "You have to control an injector with " + << EnumStrings< Control >::toString( Control::MASSRATE ), InputError, getDataContext() ); // 8) Make sure that the initial pressure coefficient is positive GEOS_THROW_IF( m_initialPressureCoefficient < 0, - getWrapperDataContext( viewKeyStruct::initialPressureCoefficientString() ) << - ": This tuning coefficient is negative", + viewKeyStruct::initialPressureCoefficientString() << + "This tuning coefficient is negative", InputError, getWrapperDataContext( viewKeyStruct::initialPressureCoefficientString() ) ); @@ -397,8 +395,8 @@ void WellControls::postInputInitialization() m_targetBHPTable = &(functionManager.getGroup< TableFunction const >( m_targetBHPTableName )); GEOS_THROW_IF( m_targetBHPTable->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellControls " << getDataContext() << ": The interpolation method for the time-dependent BHP table " - << m_targetBHPTable->getName() << " should be TableFunction::InterpolationType::Lower", + "The interpolation method for the time-dependent BHP table " + << m_targetBHPTable->getName() << " should be TableFunction::InterpolationType::Lower", InputError, getDataContext() ); } @@ -414,8 +412,8 @@ void WellControls::postInputInitialization() m_targetTotalRateTable = &(functionManager.getGroup< TableFunction const >( m_targetTotalRateTableName )); GEOS_THROW_IF( m_targetTotalRateTable->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellControls " << getDataContext() << ": The interpolation method for the time-dependent total rate table " - << m_targetTotalRateTable->getName() << " should be TableFunction::InterpolationType::Lower", + "The interpolation method for the time-dependent total rate table " + << m_targetTotalRateTable->getName() << " should be TableFunction::InterpolationType::Lower", InputError, getDataContext() ); } @@ -431,8 +429,8 @@ void WellControls::postInputInitialization() m_targetPhaseRateTable = &(functionManager.getGroup< TableFunction const >( m_targetPhaseRateTableName )); GEOS_THROW_IF( m_targetPhaseRateTable->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellControls " << getDataContext() << ": The interpolation method for the time-dependent phase rate table " - << m_targetPhaseRateTable->getName() << " should be TableFunction::InterpolationType::Lower", + "The interpolation method for the time-dependent phase rate table " + << m_targetPhaseRateTable->getName() << " should be TableFunction::InterpolationType::Lower", InputError, getDataContext() ); } // Create time-dependent mass rate table @@ -447,8 +445,8 @@ void WellControls::postInputInitialization() m_targetMassRateTable = &(functionManager.getGroup< TableFunction const >( m_targetMassRateTableName )); GEOS_THROW_IF( m_targetMassRateTable->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellControls " << getDataContext() << ": The interpolation method for the time-dependent mass rate table " - << m_targetMassRateTable->getName() << " should be TableFunction::InterpolationType::Lower", + "The interpolation method for the time-dependent mass rate table " + << m_targetMassRateTable->getName() << " should be TableFunction::InterpolationType::Lower", InputError, getDataContext() ); } // 12) Create the time-dependent well status table @@ -469,8 +467,8 @@ void WellControls::postInputInitialization() m_statusTable = &(functionManager.getGroup< TableFunction const >( m_statusTableName )); GEOS_THROW_IF( m_statusTable->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellControls " << getDataContext() << ": The interpolation method for the time-dependent status table " - << m_statusTable->getName() << " should be TableFunction::InterpolationType::Lower", + "The interpolation method for the time-dependent status table " + << m_statusTable->getName() << " should be TableFunction::InterpolationType::Lower", InputError, getDataContext() ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index a76a66c2c72..2e98c2fbaf2 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -169,9 +169,9 @@ void WellSolverBase::initializePostSubGroups() { TableFunction * tableFunction = functionManager.getGroupPointer< TableFunction >( perfStatusTableName[i] ); GEOS_THROW_IF( tableFunction->getInterpolationMethod() != TableFunction::InterpolationType::Lower, - "WellSolverBase " << getDataContext() << ": The interpolation method for the perforation status table " - << tableFunction->getName() << " should be TableFunction::InterpolationType::Lower", - InputError ); + "The interpolation method for the perforation status table " + << tableFunction->getName() << " should be TableFunction::InterpolationType::Lower", + InputError, getDataContext() ); } } ); } ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp index ee04ffa8c73..ab153369374 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp @@ -680,13 +680,13 @@ PresTempCompFracInitializationKernel:: GEOS_THROW_IF( foundNegativePres.get() == 1, - wellControls.getDataContext() << "Invalid well initialization, negative pressure was found.", + "Invalid well initialization, negative pressure was found.", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( foundNegativeTemp.get() == 1, - wellControls.getDataContext() << "Invalid well initialization, negative temperature was found.", + "Invalid well initialization, negative temperature was found.", InputError, wellControls.getDataContext() ); GEOS_THROW_IF( foundInconsistentCompFrac.get() == 1, - wellControls.getDataContext() << "Invalid well initialization, inconsistent component fractions were found.", + "Invalid well initialization, inconsistent component fractions were found.", InputError, wellControls.getDataContext() ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/SinglePhaseWellKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/SinglePhaseWellKernels.cpp index ddd707cf9b1..5870c7c919c 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/SinglePhaseWellKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/SinglePhaseWellKernels.cpp @@ -579,12 +579,12 @@ PresTempInitializationKernel:: } ); GEOS_THROW_IF( foundNegativePressure.get() == 1, - wellControls.getDataContext() << ": Invalid well initialization, negative pressure was found.", + "Invalid well initialization, negative pressure was found.", InputError, wellControls.getDataContext() ); if( isThermal ) // tjb change temp in isothermal cases shouldnt be an issue (also what if temp in fluid prop calcs like compo) { GEOS_THROW_IF( foundNegativeTemp.get() == 1, - wellControls.getDataContext() << "Invalid well initialization, negative temperature was found.", + "Invalid well initialization, negative temperature was found.", InputError, wellControls.getDataContext() ); } } diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/SpringSlider.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/SpringSlider.cpp index 345a118ed74..8780405182c 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/SpringSlider.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/SpringSlider.cpp @@ -90,9 +90,8 @@ void SpringSlider< RSSOLVER_TYPE >::registerDataOnMesh( Group & meshBodies ) string & frictionLawName = subRegion.getReference< string >( viewKeyStruct::frictionLawNameString() ); frictionLawName = PhysicsSolverBase::getConstitutiveName< FrictionBase >( subRegion ); GEOS_ERROR_IF( frictionLawName.empty(), - GEOS_FMT( "{}: FrictionBase model not found on subregion {}", - this->getDataContext(), subRegion.getDataContext() ), - this->getDataContext() ); + GEOS_FMT( "Model not found on subregion {}", subRegion.getName() ), + this->getDataContext(), subRegion.getDataContext() ); } ); } ); } diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index 425bccfa72c..5c71fa5c776 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -87,8 +87,9 @@ setMGRStrategy() { if( isThermal() ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for thermal {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for thermal {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName()), + getDataContext()); } else { @@ -126,8 +127,9 @@ setMGRStrategy() if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() ) ); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName() ), + getDataContext() ); } else { @@ -151,17 +153,17 @@ initializePreSubGroups() bool const useMassFlow = flowSolver->getReference< integer >( CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString() ); bool const useMassWell = Base::wellSolver()->template getReference< integer >( CompositionalMultiphaseWell::viewKeyStruct::useMassFlagString() ); GEOS_THROW_IF( useMassFlow != useMassWell, - GEOS_FMT( "{}: the input flag {} must be the same in the flow and well solvers, respectively '{}' and '{}'", - this->getDataContext(), CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString(), - Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ), + GEOS_FMT( "The input flag {} must be the same in the flow and well solvers, respectively '{}' and '{}'", + CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString(), + Base::reservoirSolver()->getName(), Base::wellSolver()->getName() ), InputError, this->getDataContext(), Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ); bool const isThermalFlow = flowSolver->getReference< integer >( CompositionalMultiphaseBase::viewKeyStruct::isThermalString() ); bool const isThermalWell = Base::wellSolver()->template getReference< integer >( CompositionalMultiphaseWell::viewKeyStruct::isThermalString() ); GEOS_THROW_IF( isThermalFlow != isThermalWell, - GEOS_FMT( "{}: the input flag {} must be the same in the flow and well solvers, respectively '{}' and '{}'", - this->getDataContext(), CompositionalMultiphaseBase::viewKeyStruct::isThermalString(), - Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ), + GEOS_FMT( "The input flag {} must be the same in the flow and well solvers, respectively '{}' and '{}'", + CompositionalMultiphaseBase::viewKeyStruct::isThermalString(), + Base::reservoirSolver()->getName(), Base::wellSolver()->getName() ), InputError, this->getDataContext(), Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ); } @@ -289,9 +291,8 @@ assembleCouplingTerms( real64 const time_n, using namespace compositionalMultiphaseUtilities; GEOS_THROW_IF( !Base::m_isWellTransmissibilityComputed, - GEOS_FMT( "{} {}: The well transmissibility has not been computed yet", - this->getCatalogName(), this->getName() ), - std::runtime_error ); + "The well transmissibility has not been computed yet", + std::runtime_error, Base::getDataContext()); BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; if( Base::wellSolver()->useTotalMassEquation() ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp index fbb8e7fb935..7de02132da5 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp @@ -155,8 +155,8 @@ bool validateWellPerforations( PhysicsSolverBase const * const reservoirSolver, localIndex const hasBadPerforations = MpiWrapper::max( badPerforation.first.empty() ? 0 : 1 ); GEOS_THROW_IF( !badPerforation.first.empty(), - GEOS_FMT( "{}: The well {} has a connection to the region {} which is not targeted by the flow solver", - wellSolver->getDataContext(), badPerforation.first, badPerforation.second ), + GEOS_FMT( "The well {} has a connection to the region {} which is not targeted by the flow solver", + badPerforation.first, badPerforation.second ), std::runtime_error, wellSolver->getDataContext() ); return hasBadPerforations == 0; } diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp index c6da8277ae7..3c04dedfef8 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp @@ -73,7 +73,9 @@ class CoupledSolver : public PhysicsSolverBase CoupledSolver & operator=( CoupledSolver && ) = delete; template< typename T > - void throwSolversNotFound( std::ostringstream & errorMessage, string const & solverType ) + void throwSolversNotFound( std::ostringstream & errorMessage, + string const & solverWrapperKey, + string const & solverType ) { string_array availableSolvers; @@ -94,7 +96,8 @@ class CoupledSolver : public PhysicsSolverBase stringutilities::join( availableSolvers, ", " ) ); } - GEOS_THROW( errorMessage.str(), InputError ); + GEOS_THROW( errorMessage.str(), + InputError, getWrapperDataContext( solverWrapperKey ) ); } /** * @brief Utility function to set the subsolvers pointers using the names provided by the user @@ -112,9 +115,8 @@ class CoupledSolver : public PhysicsSolverBase { string const solverWrapperKey = SolverType::coupledSolverAttributePrefix() + "SolverName"; std::ostringstream errorMessage; - errorMessage << GEOS_FMT( "{}: Could not find solver named '{}'.\n", - getWrapperDataContext( solverWrapperKey ), solverName ); - throwSolversNotFound< SolverType >( errorMessage, SolverType::coupledSolverAttributePrefix() ); + errorMessage << GEOS_FMT( "Could not find solver named '{}'.\n", solverName ); + throwSolversNotFound< SolverType >( errorMessage, solverWrapperKey, SolverType::coupledSolverAttributePrefix() ); } @@ -266,7 +268,7 @@ class CoupledSolver : public PhysicsSolverBase } else { - GEOS_ERROR( getDataContext() << ": Invalid coupling type option." ); + GEOS_ERROR( "Invalid coupling type option.", getDataContext() ); return 0; } @@ -603,7 +605,7 @@ class CoupledSolver : public PhysicsSolverBase } else { - GEOS_ERROR( "Nonconverged solutions not allowed. Terminating..." ); + GEOS_ERROR( "Nonconverged solutions not allowed. Terminating...", getDataContext() ); } } @@ -706,7 +708,7 @@ class CoupledSolver : public PhysicsSolverBase } else { - GEOS_ERROR( getDataContext() << ": Invalid sequential convergence criterion." ); + GEOS_ERROR( "Invalid sequential convergence criterion.", getDataContext() ); } if( isConverged ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 075df069e75..5ad14505464 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -184,8 +184,9 @@ void MultiphasePoromechanics<>::setMGRStrategy() if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName()) + , getDataContext() ); } else { @@ -218,8 +219,9 @@ void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidM if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() ) ); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName() ), + getDataContext() ); } else { diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsConformingFractures.hpp index 2366f915fd4..9e0828e19d5 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsConformingFractures.hpp @@ -268,7 +268,7 @@ class PoromechanicsConformingFractures : public POROMECHANICS_BASE< FLOW_SOLVER, fractureRegion.getUniqueSubRegion< FaceElementSubRegion >(); GEOS_ERROR_IF( !fractureSubRegion.hasWrapper( fields::flow::pressure::key() ), - this->getDataContext() << ": The fracture subregion must contain pressure field." ); + "The fracture subregion must contain pressure field.", this->getDataContext() ); arrayView2d< localIndex const > const elem2dToFaces = fractureSubRegion.faceList().toViewConst(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp index e476c613cbb..993304f9c22 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp @@ -73,8 +73,7 @@ postInputInitialization() Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); GEOS_THROW_IF( !physicsSolverManager.hasGroup( m_poromechanicsSolverName ), - GEOS_FMT( "{}: {} solver named {} not found", - getWrapperDataContext( viewKeyStruct::poromechanicsSolverNameString() ), + GEOS_FMT( "{} solver named {} not found", POROMECHANICS_SOLVER::catalogName(), m_poromechanicsSolverName ), InputError, getWrapperDataContext( viewKeyStruct::poromechanicsSolverNameString() ) ); @@ -86,8 +85,7 @@ postInputInitialization() TasksManager & tasksManager = problemManager.getGroup< TasksManager >( "Tasks" ); GEOS_THROW_IF( !tasksManager.hasGroup( m_solidMechanicsStatisticsName ), - GEOS_FMT( "{}: {} task named {} not found", - getWrapperDataContext( viewKeyStruct::solidMechanicsStatisticsNameString() ), + GEOS_FMT( "{} task named {} not found", SolidMechanicsStatistics::catalogName(), m_solidMechanicsStatisticsName ), InputError, getWrapperDataContext( viewKeyStruct::solidMechanicsStatisticsNameString() ) ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index 9471da04798..d5840a2eaf2 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -115,17 +115,16 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER Base::postInputInitialization(); GEOS_THROW_IF( this->m_isThermal && !this->flowSolver()->isThermal(), - GEOS_FMT( "{} {}: The attribute `{}` of the flow solver must be thermal since the poromechanics solver is thermal", - this->getCatalogName(), this->getName(), this->flowSolver()->getName() ), - InputError ); + GEOS_FMT( "The attribute `{}` of the flow solver must be thermal since the poromechanics solver is thermal", + this->flowSolver()->getName() ), + InputError, this->flowSolver()->getDataContext() ); GEOS_THROW_IF( this->solidMechanicsSolver()->timeIntegrationOption() != SolidMechanicsLagrangianFEM::TimeIntegrationOption::QuasiStatic, - GEOS_FMT( "{} {}: The attribute `{}` of solid mechanics solver `{}` must be `{}`", - this->getCatalogName(), this->getName(), + GEOS_FMT( "The attribute `{}` of solid mechanics solver `{}` must be `{}`", SolidMechanicsLagrangianFEM::viewKeyStruct::timeIntegrationOptionString(), this->solidMechanicsSolver()->getName(), EnumStrings< SolidMechanicsLagrangianFEM::TimeIntegrationOption >::toString( SolidMechanicsLagrangianFEM::TimeIntegrationOption::QuasiStatic ) ), - InputError ); + InputError, this->solidMechanicsSolver()->getDataContext() ); setMGRStrategy(); } @@ -475,15 +474,14 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER GEOS_THROW_IF( std::find( solidMechanicsTargetRegionNames.begin(), solidMechanicsTargetRegionNames.end(), poromechanicsTargetRegionNames[i] ) == solidMechanicsTargetRegionNames.end(), - GEOS_FMT( "{} {}: region {} must be a target region of {}", - this->getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], - this->solidMechanicsSolver()->getDataContext() ), - InputError ); + GEOS_FMT( "Region {} must be a target region of {}", + poromechanicsTargetRegionNames[i], this->solidMechanicsSolver()->getName() ), + InputError, this->getDataContext(), this->solidMechanicsSolver()->getDataContext()); GEOS_THROW_IF( std::find( flowTargetRegionNames.begin(), flowTargetRegionNames.end(), poromechanicsTargetRegionNames[i] ) == flowTargetRegionNames.end(), - GEOS_FMT( "{} {}: region `{}` must be a target region of `{}`", - this->getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], this->flowSolver()->getDataContext() ), - InputError ); + GEOS_FMT( "Region `{}` must be a target region of `{}`", + poromechanicsTargetRegionNames[i], this->flowSolver()->getCatalogName() ), + InputError, this->getDataContext(), this->flowSolver()->getDataContext() ); } } diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 15e1250edbe..7265e98d52e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -112,8 +112,9 @@ void SinglePhasePoromechanics<>::setMGRStrategy() { if( this->m_isThermal ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for thermal {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() )); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for thermal {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName() ), + getDataContext() ); } else { @@ -151,8 +152,9 @@ void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLag if( dynamic_cast< SinglePhaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for poromechanics {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for poromechanics {}/{}", + this->getCatalogName(), this->flowSolver()->getCatalogName()), + getDataContext() ); } else { diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index a327d48e569..9ac8d570c7f 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -65,9 +65,10 @@ void SinglePhasePoromechanicsEmbeddedFractures::postInputInitialization() Base::postInputInitialization(); GEOS_ERROR_IF( solidMechanicsSolver()->useStaticCondensation(), - GEOS_FMT( "{}: {} = 1 in {} solver named {} is not supported for {}", - this->getName(), SolidMechanicsEmbeddedFractures::viewKeyStruct::useStaticCondensationString(), - solidMechanicsSolver()->getCatalogName(), solidMechanicsSolver()->getName(), getCatalogName() )); + GEOS_FMT( "{} = 1 in {} solver named {} is not supported for {}", + SolidMechanicsEmbeddedFractures::viewKeyStruct::useStaticCondensationString(), + solidMechanicsSolver()->getCatalogName(), solidMechanicsSolver()->getName(), getCatalogName() ), + getDataContext() ); } void SinglePhasePoromechanicsEmbeddedFractures::registerDataOnMesh( dataRepository::Group & meshBodies ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 46cf3257088..bd04e1b9f11 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -106,8 +106,9 @@ setMGRStrategy() if( dynamic_cast< SinglePhaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for poromechanics {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + GEOS_ERROR( GEOS_FMT( "MGR strategy is not implemented for poromechanics {}/{}", + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName()), + getDataContext() ); } else { @@ -247,9 +248,8 @@ assembleCouplingTerms( real64 const time_n, { GEOS_UNUSED_VAR( time_n ); GEOS_THROW_IF( !Base::m_isWellTransmissibilityComputed, - GEOS_FMT( "{} {}: The well transmissibility has not been computed yet", - this->getCatalogName(), this->getName() ), - std::runtime_error ); + "The well transmissibility has not been computed yet", + std::runtime_error, Base::getDataContext() ); this->template forDiscretizationOnMeshTargets<>( domain.getMeshBodies(), [&] ( string const &, MeshLevel const & mesh, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 18e7714e97d..3d5e24741cc 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -293,8 +293,8 @@ real64 SolidMechanicsLagrangianFEM::explicitKernelDispatch( MeshLevel & mesh, } else { - GEOS_ERROR( getWrapperDataContext( viewKeyStruct::strainTheoryString() ) << - ": Invalid option for strain theory (0 = infinitesimal strain, 1 = finite strain" ); + GEOS_ERROR( "Invalid option for strain theory (0 = infinitesimal strain, 1 = finite strain", + getWrapperDataContext( viewKeyStruct::strainTheoryString() ) ); } return rval; @@ -575,7 +575,8 @@ real64 SolidMechanicsLagrangianFEM::explicitStep( real64 const & time_n, SortedArrayView< localIndex const > const & targetSet ) { integer const component = bc.getComponent(); - GEOS_ERROR_IF_LT_MSG( component, 0, getDataContext() << ": Component index required for displacement BC " << bc.getDataContext() ); + GEOS_ERROR_IF_LT_MSG( component, 0, "Component index required for displacement BC ", + getDataContext(), bc.getDataContext() ); forAll< parallelDevicePolicy< 1024 > >( targetSet.size(), [=] GEOS_DEVICE ( localIndex const i ) @@ -588,7 +589,8 @@ real64 SolidMechanicsLagrangianFEM::explicitStep( real64 const & time_n, SortedArrayView< localIndex const > const & targetSet ) { integer const component = bc.getComponent(); - GEOS_ERROR_IF_LT_MSG( component, 0, getDataContext() << ": Component index required for displacement BC " << bc.getDataContext() ); + GEOS_ERROR_IF_LT_MSG( component, 0, "Component index required for displacement BC ", + getDataContext(), bc.getDataContext() ); forAll< parallelDevicePolicy< 1024 > >( targetSet.size(), [=] GEOS_DEVICE ( localIndex const i ) @@ -710,17 +712,17 @@ void SolidMechanicsLagrangianFEM::applyDisplacementBCImplicit( real64 const time { char const bcLogMessage[] = "\nWarning!" - "\n{} {}: There is no displacement boundary condition applied to this problem in the {} direction. \n" + "\nThere is no displacement boundary condition applied to this problem in the {} direction. \n" "The problem may be ill-posed.\n"; GEOS_WARNING_IF( isDisplacementBCAppliedGlobal[0] == 0, // target set is empty - GEOS_FMT( bcLogMessage, - getCatalogName(), getDataContext(), 'x' ), getDataContext() ); + GEOS_FMT( bcLogMessage, 'x' ), + getDataContext() ); GEOS_WARNING_IF( isDisplacementBCAppliedGlobal[1] == 0, // target set is empty - GEOS_FMT( bcLogMessage, - getCatalogName(), getDataContext(), 'y' ), getDataContext() ); + GEOS_FMT( bcLogMessage, 'y' ), + getDataContext() ); GEOS_WARNING_IF( isDisplacementBCAppliedGlobal[2] == 0, // target set is empty - GEOS_FMT( bcLogMessage, - getCatalogName(), getDataContext(), 'z' ), getDataContext() ); + GEOS_FMT( bcLogMessage, 'z' ), + getDataContext() ); } } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index e4fdff69db4..7f2ef8169df 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -542,7 +542,7 @@ real64 SolidMechanicsMPM::solverStep( real64 const & time_n, } else { - GEOS_ERROR( "MPM solver only currently supports explicit time stepping!" ); + GEOS_ERROR( "MPM solver only currently supports explicit time stepping!", getDataContext() ); } return dtReturn; @@ -3714,7 +3714,7 @@ void SolidMechanicsMPM::flagOutOfRangeParticles( ParticleManager & particleManag } default: { - GEOS_ERROR( "Particle type \"" << particleType << "\" is not yet supported." ); + GEOS_ERROR( "Particle type \"" << particleType << "\" is not yet supported.", getDataContext() ); break; } } @@ -4048,7 +4048,7 @@ void SolidMechanicsMPM::populateMappingArrays( ParticleManager & particleManager default: { - GEOS_ERROR( "Particle type \"" << subRegion.getParticleType() << "\" is not yet supported." ); + GEOS_ERROR( "Particle type \"" << subRegion.getParticleType() << "\" is not yet supported.", getDataContext() ); break; } } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp index b8fe2dd7c96..51086bdc70c 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp @@ -65,8 +65,7 @@ void SolidMechanicsStateReset::postInputInitialization() Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); GEOS_THROW_IF( !physicsSolverManager.hasGroup( m_solidSolverName ), - GEOS_FMT( "Task {}: physics solver named {} not found", - getDataContext(), m_solidSolverName ), + GEOS_FMT( "physics solver named {} not found", m_solidSolverName ), InputError, getDataContext() ); m_solidSolver = &physicsSolverManager.getGroup< SolidMechanicsLagrangianFEM >( m_solidSolverName ); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp index 469aa255c3d..b61ae87fc5b 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp @@ -54,11 +54,10 @@ void ContactSolverBase::postInputInitialization() SolidMechanicsLagrangianFEM::postInputInitialization(); GEOS_THROW_IF( m_timeIntegrationOption != TimeIntegrationOption::QuasiStatic, - GEOS_FMT( "{} {}: The attribute `{}` must be `{}`", - this->getCatalogName(), this->getName(), + GEOS_FMT( "The attribute `{}` must be `{}`", viewKeyStruct::timeIntegrationOptionString(), EnumStrings< TimeIntegrationOption >::toString( TimeIntegrationOption::QuasiStatic ) ), - InputError ); + InputError, getDataContext() ); } void ContactSolverBase::registerDataOnMesh( dataRepository::Group & meshBodies ) @@ -126,9 +125,8 @@ void ContactSolverBase::setFractureRegions( dataRepository::Group const & meshBo // TODO remove once multiple regions are fully supported GEOS_THROW_IF( m_fractureRegionNames.size() > 1, - GEOS_FMT( "{} {}: The number of fracture regions can not be more than one", - this->getCatalogName(), this->getName() ), - InputError ); + "The number of fracture regions can not be more than one", + InputError, getDataContext() ); } void ContactSolverBase::computeFractureStateStatistics( MeshLevel const & mesh, @@ -223,7 +221,7 @@ real64 ContactSolverBase::explicitStep( real64 const & GEOS_UNUSED_PARAM( time_n DomainPartition & GEOS_UNUSED_PARAM( domain ) ) { GEOS_MARK_FUNCTION; - GEOS_ERROR( getDataContext() << ": ExplicitStep non available for contact solvers." ); + GEOS_ERROR( "ExplicitStep non available for contact solvers.", getDataContext() ); return dt; } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp index df469f26ea1..cd4b39239f6 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -1315,7 +1315,7 @@ void SolidMechanicsAugmentedLagrangianContact::createFaceTypeList( DomainPartiti } else { - GEOS_ERROR( "SolidMechanicsAugmentedLagrangianContact:: invalid face type" ); + GEOS_ERROR( "SolidMechanicsAugmentedLagrangianContact:: invalid face type", getDataContext() ); } } ); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp index 855864cb1e3..20949bc3a7e 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp @@ -926,7 +926,7 @@ SolidMechanicsLagrangeContact::createPreconditioner( DomainPartition & domain ) } else { - GEOS_ERROR( "SolidMechanicsLagrangeContact::CreatePreconditioner leadingBlockApproximation option " << leadingBlockApproximation << " not supported" ); + GEOS_ERROR( "SolidMechanicsLagrangeContact::CreatePreconditioner leadingBlockApproximation option " << leadingBlockApproximation << " not supported", getDataContext()); } // Preconditioner for the leading block: tracPrecond @@ -1321,8 +1321,9 @@ void SolidMechanicsLagrangeContact::computeFaceNodalArea( localIndex const kf0, } else { - GEOS_ERROR( "SolidMechanicsLagrangeContact " << getDataContext() << ": face with " << numNodesPerFace << - " nodes. Only triangles and quadrilaterals and PEBI prisms up to 11 sides are supported." ); + GEOS_ERROR( "Face with " << numNodesPerFace << + " nodes. Only triangles and quadrilaterals and PEBI prisms up to 11 sides are supported.", + getDataContext() ); } } @@ -1829,8 +1830,7 @@ void SolidMechanicsLagrangeContact::assembleStabilization( MeshLevel const & mes realNodes++; } } - GEOS_ERROR_IF( realNodes != 2, - getDataContext() << ": An edge shared by two fracture elements must have 2 nodes.", + GEOS_ERROR_IF( realNodes != 2, "An edge shared by two fracture elements must have 2 nodes.", getDataContext() ); edge.resize( realNodes ); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index 76a9fd032c4..c37a2318a72 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -193,18 +193,15 @@ void SurfaceGenerator::postInputInitialization() static const std::set< integer > binaryOptions = { 0, 1 }; GEOS_ERROR_IF( binaryOptions.count( m_isPoroelastic ) == 0, - getWrapperDataContext( viewKeyStruct::isPoroelasticString() ) << - ": option can be either 0 (false) or 1 (true)", + "option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::isPoroelasticString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_nodeBasedSIF ) == 0, - getWrapperDataContext( viewKeyStruct::nodeBasedSIFString() ) << - ": option can be either 0 (false) or 1 (true)", + "option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::nodeBasedSIFString() ) ); GEOS_ERROR_IF( binaryOptions.count( m_mpiCommOrder ) == 0, - getWrapperDataContext( viewKeyStruct::mpiCommOrderString() ) << - ": option can be either 0 (false) or 1 (true)", + "option can be either 0 (false) or 1 (true)", getWrapperDataContext( viewKeyStruct::mpiCommOrderString() ) ); } @@ -953,8 +950,7 @@ void SurfaceGenerator::synchronizeTipSets ( FaceManager & faceManager, { localIndex const parentNodeIndex = parentNodeIndices[nodeIndex]; - GEOS_ERROR_IF( parentNodeIndex == -1, - getDataContext() << ": parentNodeIndex should not be -1", + GEOS_ERROR_IF( parentNodeIndex == -1, "parentNodeIndex should not be -1", getDataContext() ); m_tipNodes.remove( parentNodeIndex ); @@ -980,8 +976,7 @@ void SurfaceGenerator::synchronizeTipSets ( FaceManager & faceManager, { localIndex const parentEdgeIndex = parentEdgeIndices[edgeIndex]; - GEOS_ERROR_IF( parentEdgeIndex == -1, - getDataContext() << ": parentEdgeIndex should not be -1", + GEOS_ERROR_IF( parentEdgeIndex == -1, "parentEdgeIndex should not be -1", getDataContext() ); m_tipEdges.remove( parentEdgeIndex ); @@ -1015,8 +1010,7 @@ void SurfaceGenerator::synchronizeTipSets ( FaceManager & faceManager, for( localIndex const faceIndex : receivedObjects.newFaces ) { localIndex const parentFaceIndex = parentFaceIndices[faceIndex]; - GEOS_ERROR_IF( parentFaceIndex == -1, - getDataContext() << ": parentFaceIndex should not be -1", + GEOS_ERROR_IF( parentFaceIndex == -1, "parentFaceIndex should not be -1", getDataContext() ); m_trailingFaces.insert( parentFaceIndex ); @@ -1267,7 +1261,7 @@ bool SurfaceGenerator::findFracturePlanes( localIndex const nodeID, if( edge[0] == INT_MAX || edge[1] == INT_MAX ) { - GEOS_ERROR( getDataContext() << ": invalid edge (SurfaceGenerator::findFracturePlanes)." ); + GEOS_ERROR( "invalid edge (SurfaceGenerator::findFracturePlanes).", getDataContext() ); } @@ -1412,11 +1406,12 @@ bool SurfaceGenerator::findFracturePlanes( localIndex const nodeID, // NOT be included in the path!!! if( nextEdge!=startingEdge && !(isEdgeExternal[nextEdge]==1 && startingEdgeExternal ) ) { - GEOS_ERROR( getDataContext() << ": Crap !" << + GEOS_ERROR( "Crap !" << " NodeID, ParentID = " << nodeID << ", " << parentNodeIndex << '\n' << " Starting Edge/Face = " << startingEdge << ", " << startingFace << '\n' << " Face Separation Path = " << facePath << '\n' << - " Edge Separation Path = " << edgePath << '\n' ); + " Edge Separation Path = " << edgePath << '\n', + getDataContext() ); } // add faces in the path to separationPathFaces @@ -1528,7 +1523,7 @@ bool SurfaceGenerator::findFracturePlanes( localIndex const nodeID, } if( pathFound == false ) { - GEOS_ERROR( getDataContext() << ": couldn't find the next face in the rupture path (SurfaceGenerator::findFracturePlanes" ); + GEOS_ERROR( "couldn't find the next face in the rupture path (SurfaceGenerator::findFracturePlanes", getDataContext() ); } } @@ -1547,7 +1542,7 @@ bool SurfaceGenerator::findFracturePlanes( localIndex const nodeID, } else { - GEOS_ERROR( getDataContext() << ": next edge in separation path is apparently connected to less than 2 ruptured face (SurfaceGenerator::findFracturePlanes" ); + GEOS_ERROR( "next edge in separation path is apparently connected to less than 2 ruptured face (SurfaceGenerator::findFracturePlanes", getDataContext() ); } } @@ -1575,7 +1570,7 @@ bool SurfaceGenerator::findFracturePlanes( localIndex const nodeID, if( edge[0] == INT_MAX || edge[1] == INT_MAX ) { - GEOS_ERROR( getDataContext() << ": invalid edge. (SurfaceGenerator::findFracturePlanes" ); + GEOS_ERROR( "invalid edge. (SurfaceGenerator::findFracturePlanes", getDataContext() ); } @@ -3210,7 +3205,8 @@ void SurfaceGenerator::calculateNodeAndFaceSif( DomainPartition const & domain, if( tralingNodeID == std::numeric_limits< localIndex >::max()) { - GEOS_ERROR( getDataContext() << ": The triangular trailing face has three tip nodes but cannot find the other trailing face containing the trailing node." ); + GEOS_ERROR( "The triangular trailing face has three tip nodes but cannot find the other trailing face containing the trailing node.", + getDataContext() ); } } else if( unpinchedNodeID.size() == 1 ) @@ -3498,8 +3494,9 @@ real64 SurfaceGenerator::calculateEdgeSif( DomainPartition const & domain, } else { - GEOS_ERROR( GEOS_FMT( "{}: Edge {} has two external faces, but the parent-child relationship is wrong.", - getDataContext(), edgeID ) ); + GEOS_ERROR( GEOS_FMT( "Edge {} has two external faces, but the parent-child relationship is wrong.", + edgeID ), + getDataContext() ); } trailFaceID = faceParentIndex[faceInvolved[0]]==-1 ? faceInvolved[0] : faceParentIndex[faceInvolved[0]]; @@ -3576,7 +3573,7 @@ real64 SurfaceGenerator::calculateEdgeSif( DomainPartition const & domain, if( numSharedNodes == 4 ) { - GEOS_ERROR( getDataContext() << ": The fracture face has four shared nodes with its child. This should not happen." ); + GEOS_ERROR( "The fracture face has four shared nodes with its child. This should not happen.", getDataContext() ); } else if( numSharedNodes == 3 ) { @@ -3585,7 +3582,7 @@ real64 SurfaceGenerator::calculateEdgeSif( DomainPartition const & domain, //wu40: I think the following check is not necessary. if( lNodeFaceA.size() != 1 || lNodeFaceAp.size() != 1 ) { - GEOS_ERROR( getDataContext() << ": these two faces share three nodes but the number of remaining nodes is not one." ); + GEOS_ERROR( "these two faces share three nodes but the number of remaining nodes is not one.", getDataContext() ); } else { @@ -3624,7 +3621,7 @@ real64 SurfaceGenerator::calculateEdgeSif( DomainPartition const & domain, } if( convexCorner == std::numeric_limits< localIndex >::max()) - GEOS_ERROR( getDataContext() << ": This is a three-node-pinched edge but I cannot find the convex corner" ); + GEOS_ERROR( "This is a three-node-pinched edge but I cannot find the convex corner", getDataContext() ); } @@ -3694,7 +3691,7 @@ real64 SurfaceGenerator::calculateEdgeSif( DomainPartition const & domain, if( trailingNodes.size() > 2 || trailingNodes.size() == 0 ) { - GEOS_ERROR( getDataContext() << ": Fatal error in finding nodes behind tip edge." ); + GEOS_ERROR( "Fatal error in finding nodes behind tip edge.", getDataContext() ); } else if( trailingNodes.size() == 1 ) // Need some work to find the other node { diff --git a/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp b/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp index 367118d3c4b..51956b4a801 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp @@ -194,7 +194,7 @@ void AcousticWaveEquationDG::precomputeSourceAndReceiverTerm( MeshLevel & baseMe { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Tetrahedron, "Invalid type of element, the acoustic DG solver is designed for tetrahedral meshes only ", - InputError ); + InputError, getDataContext() ); arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList(); arrayView2d< localIndex const, cells::NODE_MAP_USD > const & baseElemsToNodes = baseMesh.getElemManager().getRegion( er ).getSubRegion< CellElementSubRegion >( esr ).nodeList(); @@ -286,7 +286,7 @@ void AcousticWaveEquationDG::initializePostInitialConditionsPreSubGroups() { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Tetrahedron, "Invalid type of element, the acoustic DG solver is designed for tetrahedral meshes only ", - InputError ); + InputError, getDataContext() ); finiteElement::FiniteElementBase const & @@ -383,7 +383,7 @@ void AcousticWaveEquationDG::initializePostInitialConditionsPreSubGroups() real64 AcousticWaveEquationDG::computeTimeStep( real64 & dtOut ) { - GEOS_ERROR( getDataContext() << ": Time-Step computation for acoustic dg wave propagator not yet implemented" ); + GEOS_ERROR( " Time-Step computation for acoustic dg wave propagator not yet implemented", getDataContext() ); return dtOut; } @@ -391,7 +391,7 @@ real64 AcousticWaveEquationDG::computeTimeStep( real64 & dtOut ) void AcousticWaveEquationDG::applyFreeSurfaceBC( real64 const time, DomainPartition & domain ) { GEOS_UNUSED_VAR( time, domain ); - GEOS_ERROR( getDataContext() << ": Free-Surface computation for acoustic dg wave propagator not yet implemented" ); + GEOS_ERROR( " Free-Surface computation for acoustic dg wave propagator not yet implemented", getDataContext() ); // FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); // FunctionManager const & functionManager = FunctionManager::getInstance(); // diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp index 35446a74147..1dbb298ceca 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp @@ -212,7 +212,7 @@ void AcousticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLev CellElementSubRegion & elementSubRegion ) { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron, - getDataContext() << ": Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8) ", + "Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8) ", InputError, getDataContext() ); arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList(); @@ -349,7 +349,7 @@ void AcousticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGro real64 AcousticFirstOrderWaveEquationSEM::computeTimeStep( real64 & dtOut ) { - GEOS_ERROR( getDataContext() << ": Time-Step computation for the first order acoustic wave propagator not yet implemented" ); + GEOS_ERROR( " Time-Step computation for the first order acoustic wave propagator not yet implemented", getDataContext() ); return dtOut; } @@ -432,7 +432,7 @@ real64 AcousticFirstOrderWaveEquationSEM::explicitStepBackward( real64 const & t DomainPartition & domain, integer GEOS_UNUSED_PARAM( computeGradient ) ) { - GEOS_ERROR( getDataContext() << ": Backward propagation for the first-order wave propagator not yet implemented" ); + GEOS_ERROR( "Backward propagation for the first-order wave propagator not yet implemented", getDataContext() ); real64 dtOut = explicitStepInternal( time_n, dt, cycleNumber, domain ); return dtOut; } @@ -590,12 +590,12 @@ void AcousticFirstOrderWaveEquationSEM::cleanup( real64 const time_n, integer co void AcousticFirstOrderWaveEquationSEM::initializePML() { - GEOS_ERROR( getDataContext() << ": PML for the first order acoustic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the first order acoustic wave propagator not yet implemented", getDataContext() ); } void AcousticFirstOrderWaveEquationSEM::applyPML( real64 const, DomainPartition & ) { - GEOS_ERROR( getDataContext() << ": PML for the first order acoustic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the first order acoustic wave propagator not yet implemented", getDataContext() ); } REGISTER_CATALOG_ENTRY( PhysicsSolverBase, AcousticFirstOrderWaveEquationSEM, string const &, dataRepository::Group * const ) diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp index 815be667e88..a9a9206afdc 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp @@ -359,7 +359,7 @@ void AcousticVTIWaveEquationSEM::initializePostInitialConditionsPreSubGroups() real64 AcousticVTIWaveEquationSEM::computeTimeStep( real64 & dtOut ) { - GEOS_ERROR( getDataContext() << ": Time-Step computation for the second order acoustic vti wave propagator not yet implemented" ); + GEOS_ERROR( "Time-Step computation for the second order acoustic vti wave propagator not yet implemented", getDataContext() ); return dtOut; } diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp index 6190586dded..ec377cd1afd 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp @@ -221,7 +221,7 @@ void AcousticWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & baseM CellElementSubRegion & elementSubRegion ) { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron, - getDataContext() << ": Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8), using the SEM formulation", + "Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8), using the SEM formulation", InputError, getDataContext() ); arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList(); @@ -292,7 +292,7 @@ void AcousticWaveEquationSEM::addSourceToRightHandSide( integer const cycleNumbe arrayView2d< real32 const > const sourceValue = m_sourceValue.toViewConst(); GEOS_THROW_IF( cycleNumber > sourceValue.size( 0 ), - getDataContext() << ": Too many steps compared to array size", + "Too many steps compared to array size", std::runtime_error, getDataContext() ); forAll< EXEC_POLICY >( sourceConstants.size( 0 ), [=] GEOS_HOST_DEVICE ( localIndex const isrc ) { @@ -1039,12 +1039,12 @@ real64 AcousticWaveEquationSEM::explicitStepForward( real64 const & time_n, std::ofstream wf( fileName, std::ios::out | std::ios::binary ); GEOS_THROW_IF( !wf, - getDataContext() << ": Could not open file "<< fileName << " for writing", + "Could not open file "<< fileName << " for writing", InputError, getDataContext() ); wf.write( (char *)&p_n[0], p_n.size()*sizeof( real32 ) ); wf.close( ); GEOS_THROW_IF( !wf.good(), - getDataContext() << ": An error occured while writing "<< fileName, + "An error occured while writing "<< fileName, InputError, getDataContext() ); } @@ -1106,8 +1106,7 @@ real64 AcousticWaveEquationSEM::explicitStepBackward( real64 const & time_n, int const rank = MpiWrapper::commRank( MPI_COMM_GEOS ); std::string fileName = GEOS_FMT( "lifo/rank_{:05}/pressure_forward_{:06}_{:08}.dat", rank, m_shotIndex, cycleNumber ); std::ifstream wf( fileName, std::ios::in | std::ios::binary ); - GEOS_THROW_IF( !wf, - getDataContext() << ": Could not open file "<< fileName << " for reading", + GEOS_THROW_IF( !wf, "Could not open file "<< fileName << " for reading", InputError, getDataContext() ); p_forward.move( LvArray::MemorySpace::host, true ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp index 0434b2f71f9..ffc9fc8b4d3 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp @@ -262,9 +262,8 @@ void ElasticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLeve { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron, - getDataContext() << ": Invalid type of element, the elastic solver is designed for hexahedral meshes only (C3D8) ", - InputError, getDataContext(), - elementSubRegion.getDataContext().getContextInfo().setPriority( -1 ) ); + "Invalid type of element, the elastic solver is designed for hexahedral meshes only (C3D8) ", + InputError, getDataContext(), elementSubRegion.getDataContext().getContextInfo().setPriority( -1 ) ); arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList(); arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes = elementSubRegion.nodeList(); @@ -415,7 +414,7 @@ void ElasticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGrou real64 ElasticFirstOrderWaveEquationSEM::computeTimeStep( real64 & dtOut ) { - GEOS_ERROR( getDataContext() << ": Time-Step computation for the first order elastic wave propagator not yet implemented" ); + GEOS_ERROR( " Time-Step computation for the first order elastic wave propagator not yet implemented", getDataContext()); return dtOut; } @@ -499,7 +498,7 @@ real64 ElasticFirstOrderWaveEquationSEM::explicitStepBackward( real64 const & ti DomainPartition & domain, integer GEOS_UNUSED_PARAM( computeGradient ) ) { - GEOS_ERROR( getDataContext() << ": Backward propagation for the first order elastic wave propagator not yet implemented" ); + GEOS_ERROR( "Backward propagation for the first order elastic wave propagator not yet implemented", getDataContext()); real64 dtOut = explicitStepInternal( time_n, dt, cycleNumber, domain ); return dtOut; } @@ -737,12 +736,12 @@ void ElasticFirstOrderWaveEquationSEM::cleanup( real64 const time_n, void ElasticFirstOrderWaveEquationSEM::initializePML() { - GEOS_ERROR( getDataContext() << ": PML for the first order elastic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the first order elastic wave propagator not yet implemented", getDataContext()); } void ElasticFirstOrderWaveEquationSEM::applyPML( real64 const, DomainPartition & ) { - GEOS_ERROR( getDataContext() << ": PML for the first order elastic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the first order elastic wave propagator not yet implemented", getDataContext()); } REGISTER_CATALOG_ENTRY( PhysicsSolverBase, ElasticFirstOrderWaveEquationSEM, string const &, dataRepository::Group * const ) diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp index 2c16780151b..ab5061dfd8f 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp @@ -297,9 +297,8 @@ void ElasticWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & baseMe { GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron, - getDataContext() << ": Invalid type of element, the elastic solver is designed for hexahedral meshes only (C3D8) ", - InputError, getDataContext(), - elementSubRegion.getDataContext().getContextInfo().setPriority( -1 ) ); + "Invalid type of element, the elastic solver is designed for hexahedral meshes only (C3D8) ", + InputError, getDataContext(), elementSubRegion.getDataContext().getContextInfo().setPriority( -1 ) ); arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList(); arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes = elementSubRegion.nodeList(); @@ -767,7 +766,7 @@ void ElasticWaveEquationSEM::applyFreeSurfaceBC( real64 const time, DomainPartit } else { - GEOS_ERROR( getDataContext() << ": This option is not supported yet" ); + GEOS_ERROR( "This option is not supported yet", getDataContext() ); } } ); } @@ -792,7 +791,7 @@ real64 ElasticWaveEquationSEM::explicitStepBackward( real64 const & time_n, DomainPartition & domain, integer GEOS_UNUSED_PARAM( computeGradient ) ) { - GEOS_ERROR( getDataContext() << ": Backward propagation for the elastic wave propagator not yet implemented" ); + GEOS_ERROR( "Backward propagation for the elastic wave propagator not yet implemented", getDataContext() ); real64 dtOut = explicitStepInternal( time_n, dt, domain ); return dtOut; } @@ -1097,12 +1096,12 @@ void ElasticWaveEquationSEM::cleanup( real64 const time_n, void ElasticWaveEquationSEM::initializePML() { - GEOS_ERROR( getDataContext() << ": PML for the elastic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the elastic wave propagator not yet implemented", getDataContext() ); } void ElasticWaveEquationSEM::applyPML( real64 const, DomainPartition & ) { - GEOS_ERROR( getDataContext() << ": PML for the elastic wave propagator not yet implemented" ); + GEOS_ERROR( "PML for the elastic wave propagator not yet implemented", getDataContext() ); } REGISTER_CATALOG_ENTRY( PhysicsSolverBase, ElasticWaveEquationSEM, string const &, dataRepository::Group * const ) diff --git a/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp b/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp index bd0561bc9b5..22e4bb663a1 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp @@ -336,8 +336,7 @@ void WaveSolverBase::postInputInitialization() { counter++; } ); - GEOS_THROW_IF( counter > 1, - getDataContext() << ": One single PML field specification is allowed", + GEOS_THROW_IF( counter > 1, "One single PML field specification is allowed", InputError, getDataContext() ); m_usePML = counter; @@ -387,7 +386,7 @@ void WaveSolverBase::postInputInitialization() { GEOS_THROW_IF( m_slsReferenceAngularFrequencies.size( 0 ) != m_slsAnelasticityCoefficients.size( 0 ), "The number of attenuation anelasticity coefficients for the SLS model must be equal to the number of reference angular frequencies", - InputError ); + InputError, getDataContext() ); if( m_slsReferenceAngularFrequencies.size( 0 ) == 0 || m_slsAnelasticityCoefficients.size( 0 ) == 0 ) { m_slsReferenceAngularFrequencies.resize( 1 ); @@ -401,11 +400,11 @@ void WaveSolverBase::postInputInitialization() GEOS_THROW_IF( m_sourceCoordinates.size( 0 ) > 0 && m_sourceCoordinates.size( 1 ) != 3, "Invalid number of physical coordinates for the sources", - InputError ); + InputError, getDataContext() ); GEOS_THROW_IF( m_receiverCoordinates.size( 0 ) > 0 && m_receiverCoordinates.size( 1 ) != 3, "Invalid number of physical coordinates for the receivers", - InputError ); + InputError, getDataContext() ); EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); real64 const & maxTime = event.getReference< real64 >( EventManager::viewKeyStruct::maxTimeString() ); @@ -421,7 +420,7 @@ void WaveSolverBase::postInputInitialization() GEOS_THROW_IF( m_sourceWaveletTableNames.size() > 0 && static_cast< localIndex >(m_sourceWaveletTableNames.size()) != m_sourceCoordinates.size( 0 ), "Invalid number of source wavelet table names. The number of table functions must be equal to the number of sources", - InputError ); + InputError, getDataContext() ); m_useSourceWaveletTables = m_sourceWaveletTableNames.size() > 0; } @@ -460,8 +459,7 @@ localIndex WaveSolverBase::getNumNodesPerElem() FiniteElementDiscretization const * const feDiscretization = feDiscretizationManager.getGroupPointer< FiniteElementDiscretization >( m_discretizationName ); - GEOS_THROW_IF( feDiscretization == nullptr, - getDataContext() << ": FE discretization not found: " << m_discretizationName, + GEOS_THROW_IF( feDiscretization == nullptr, "FE discretization not found: " << m_discretizationName, InputError, getDataContext() ); localIndex numNodesPerElem = 0; diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 4a2f9c949c6..6ed1f71381f 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 - + @@ -1562,7 +1562,7 @@ A field can represent a physical variable. (pressure, temperature, global compos - +