From 544836016d2c7cf5e82513e47fd26a0be867492a Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Tue, 28 Sep 2021 16:22:32 +0200 Subject: [PATCH] [MPL] Convert asserts to OGS_FATAL in dValue(). Avoids taking unimplemented derivatives. Also fix few typos in error messages. --- .../MPL/Properties/AverageMolarMass.cpp | 14 ++++++----- .../MPL/Properties/BishopsPowerLaw.cpp | 10 ++++---- .../Properties/BishopsSaturationCutoff.cpp | 11 +++++---- ...pillaryPressureRegularizedVanGenuchten.cpp | 10 ++++---- .../CapillaryPressureVanGenuchten.cpp | 10 ++++---- .../SaturationBrooksCorey.cpp | 23 +++++++++++-------- .../SaturationLiakopoulos.cpp | 23 +++++++++++-------- .../SaturationVanGenuchten.cpp | 10 ++++---- .../Properties/Density/WaterVapourDensity.cpp | 2 +- .../EmbeddedFracturePermeability.cpp | 10 ++++---- ...rthotropicEmbeddedFracturePermeability.cpp | 10 ++++---- .../PermeabilityOrthotropicPowerLaw.cpp | 10 ++++---- .../RelPermBrooksCorey.cpp | 11 +++++---- .../RelPermBrooksCoreyNonwettingPhase.cpp | 10 ++++---- .../RelPermLiakopoulos.cpp | 10 ++++---- ...lPermNonWettingPhaseVanGenuchtenMualem.cpp | 11 +++++---- .../RelativePermeability/RelPermUdell.cpp | 10 ++++---- .../RelPermUdellNonwettingPhase.cpp | 10 ++++---- .../RelPermVanGenuchten.cpp | 11 +++++---- .../SaturationDependentSwelling.cpp | 10 ++++---- ...SaturationDependentThermalConductivity.cpp | 10 ++++---- .../LinearSaturationSwellingStress.cpp | 10 ++++---- .../SoilThermalConductivitySomerton.cpp | 20 +++++++++------- 23 files changed, 157 insertions(+), 109 deletions(-) diff --git a/MaterialLib/MPL/Properties/AverageMolarMass.cpp b/MaterialLib/MPL/Properties/AverageMolarMass.cpp index 4af19eb5c43..6d386df1b04 100644 --- a/MaterialLib/MPL/Properties/AverageMolarMass.cpp +++ b/MaterialLib/MPL/Properties/AverageMolarMass.cpp @@ -87,11 +87,13 @@ PropertyDataType AverageMolarMass::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const dt) const { - (void)primary_variable; - assert(((primary_variable == Variable::phase_pressure) || - (primary_variable == Variable::temperature)) && - "AverageMolarMass::dValue is implemented for derivatives with " - "respect to phase_pressure or temperature only."); + if ((primary_variable != Variable::phase_pressure) && + (primary_variable != Variable::temperature)) + { + OGS_FATAL( + "AverageMolarMass::dValue is implemented for derivatives with " + "respect to phase_pressure or temperature only."); + } auto phase = std::get<Phase*>(scale_); @@ -103,7 +105,7 @@ PropertyDataType AverageMolarMass::dValue( else if (numberOfComponents > 2) { OGS_FATAL( - "AverageMolarMass::dvalue is currently implemented two or less " + "AverageMolarMass::dValue is currently implemented two or less " "phase components only."); } diff --git a/MaterialLib/MPL/Properties/BishopsPowerLaw.cpp b/MaterialLib/MPL/Properties/BishopsPowerLaw.cpp index 68f057f2fcd..af728228ee9 100644 --- a/MaterialLib/MPL/Properties/BishopsPowerLaw.cpp +++ b/MaterialLib/MPL/Properties/BishopsPowerLaw.cpp @@ -43,10 +43,12 @@ PropertyDataType BishopsPowerLaw::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "BishopsPowerLaw::dvalue is implemented for derivatives with " - "respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "BishopsPowerLaw::dValue is implemented for derivatives with " + "respect to liquid saturation only."); + } auto const S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/BishopsSaturationCutoff.cpp b/MaterialLib/MPL/Properties/BishopsSaturationCutoff.cpp index 9b3702ccff2..da8095513e5 100644 --- a/MaterialLib/MPL/Properties/BishopsSaturationCutoff.cpp +++ b/MaterialLib/MPL/Properties/BishopsSaturationCutoff.cpp @@ -44,11 +44,12 @@ PropertyDataType BishopsSaturationCutoff::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert( - (variable == Variable::liquid_saturation) && - "BishopsSaturationCutoff::dvalue is implemented for derivatives with " - "respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "BishopsSaturationCutoff::dValue is implemented for derivatives " + "with respect to liquid saturation only."); + } return 0.; } diff --git a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureRegularizedVanGenuchten.cpp b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureRegularizedVanGenuchten.cpp index e594193ede8..c9fe7464571 100644 --- a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureRegularizedVanGenuchten.cpp +++ b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureRegularizedVanGenuchten.cpp @@ -73,10 +73,12 @@ PropertyDataType CapillaryPressureRegularizedVanGenuchten::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::liquid_saturation) && - "CapillaryPressureRegularizedVanGenuchten::dValue is implemented " - "for derivatives with respect to liquid saturation only."); + if (primary_variable != Variable::liquid_saturation) + { + OGS_FATAL( + "CapillaryPressureRegularizedVanGenuchten::dValue is implemented " + "for derivatives with respect to liquid saturation only."); + } const double Sl = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureVanGenuchten.cpp b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureVanGenuchten.cpp index abbb155f408..77f0a5901a8 100644 --- a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureVanGenuchten.cpp +++ b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/CapillaryPressureVanGenuchten.cpp @@ -112,10 +112,12 @@ PropertyDataType CapillaryPressureVanGenuchten::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::liquid_saturation) && - "CapillaryPressureVanGenuchten::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (primary_variable != Variable::liquid_saturation) + { + OGS_FATAL( + "CapillaryPressureVanGenuchten::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } double const S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationBrooksCorey.cpp b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationBrooksCorey.cpp index 555d735b171..5a2bbf997ea 100644 --- a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationBrooksCorey.cpp +++ b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationBrooksCorey.cpp @@ -61,10 +61,12 @@ PropertyDataType SaturationBrooksCorey::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const dt) const { - (void)primary_variable; - assert((primary_variable == Variable::capillary_pressure) && - "SaturationBrooksCorey::dValue is implemented for " - " derivatives with respect to capillary pressure only."); + if (primary_variable != Variable::capillary_pressure) + { + OGS_FATAL( + "SaturationBrooksCorey::dValue is implemented for derivatives with " + "respect to capillary pressure only."); + } const double s_L_res = residual_liquid_saturation_; const double s_L_max = 1.0 - residual_gas_saturation_; @@ -93,12 +95,13 @@ PropertyDataType SaturationBrooksCorey::d2Value( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable1; - (void)primary_variable2; - assert((primary_variable1 == Variable::capillary_pressure) && - (primary_variable2 == Variable::capillary_pressure) && - "SaturationBrooksCorey::d2Value is implemented for " - " derivatives with respect to capillary pressure only."); + if ((primary_variable1 != Variable::capillary_pressure) && + (primary_variable2 != Variable::capillary_pressure)) + { + OGS_FATAL( + "SaturationBrooksCorey::d2Value is implemented for derivatives " + "with respect to capillary pressure only."); + } const double p_b = entry_pressure_; const double p_cap = std::max( diff --git a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationLiakopoulos.cpp b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationLiakopoulos.cpp index d8d0069aacb..c4faca877be 100644 --- a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationLiakopoulos.cpp +++ b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationLiakopoulos.cpp @@ -42,10 +42,12 @@ PropertyDataType SaturationLiakopoulos::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::capillary_pressure) && - "SaturationLiakopoulos::dvalue is implemented for derivatives with " - "respect to capillary pressure only."); + if (primary_variable != Variable::capillary_pressure) + { + OGS_FATAL( + "SaturationLiakopoulos::dValue is implemented for derivatives with " + "respect to capillary pressure only."); + } const double p_cap = std::get<double>( variable_array[static_cast<int>(Variable::capillary_pressure)]); @@ -65,12 +67,13 @@ PropertyDataType SaturationLiakopoulos::d2Value( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable1; - (void)primary_variable2; - assert((primary_variable1 == Variable::capillary_pressure) && - (primary_variable2 == Variable::capillary_pressure) && - "SaturationLiakopoulos::ddvalue is implemented for derivatives " - "with respect to capillary pressure only."); + if ((primary_variable1 != Variable::capillary_pressure) && + (primary_variable2 != Variable::capillary_pressure)) + { + OGS_FATAL( + "SaturationLiakopoulos::d2Value is implemented for derivatives " + "with respect to capillary pressure only."); + } const double p_cap = std::get<double>( variable_array[static_cast<int>(Variable::capillary_pressure)]); diff --git a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationVanGenuchten.cpp b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationVanGenuchten.cpp index 9e8154c2db0..75021cb71f9 100644 --- a/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationVanGenuchten.cpp +++ b/MaterialLib/MPL/Properties/CapillaryPressureSaturation/SaturationVanGenuchten.cpp @@ -66,10 +66,12 @@ PropertyDataType SaturationVanGenuchten::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::capillary_pressure) && - "SaturationVanGenuchten::dvalue is implemented for derivatives with " - "respect to capillary pressure only."); + if (primary_variable != Variable::capillary_pressure) + { + OGS_FATAL( + "SaturationVanGenuchten::dValue is implemented for derivatives " + "with respect to capillary pressure only."); + } const double p_cap = std::get<double>( variable_array[static_cast<int>(Variable::capillary_pressure)]); diff --git a/MaterialLib/MPL/Properties/Density/WaterVapourDensity.cpp b/MaterialLib/MPL/Properties/Density/WaterVapourDensity.cpp index 2246f00db70..461062b30f8 100644 --- a/MaterialLib/MPL/Properties/Density/WaterVapourDensity.cpp +++ b/MaterialLib/MPL/Properties/Density/WaterVapourDensity.cpp @@ -90,7 +90,7 @@ PropertyDataType WaterVapourDensity::dValue( } OGS_FATAL( - "WaterVapourDensity::dvalue is implemented for derivatives with " + "WaterVapourDensity::dValue is implemented for derivatives with " "respect to temperature or phase_pressure only."); } diff --git a/MaterialLib/MPL/Properties/EmbeddedFracturePermeability.cpp b/MaterialLib/MPL/Properties/EmbeddedFracturePermeability.cpp index 8c01cb4ec6c..bc25b0772f9 100644 --- a/MaterialLib/MPL/Properties/EmbeddedFracturePermeability.cpp +++ b/MaterialLib/MPL/Properties/EmbeddedFracturePermeability.cpp @@ -83,10 +83,12 @@ PropertyDataType EmbeddedFracturePermeability<DisplacementDim>::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::mechanical_strain) && - "EmbeddedFracturePermeability::dValue is implemented for " - "derivatives with respect to strain only."); + if (primary_variable != Variable::mechanical_strain) + { + OGS_FATAL( + "EmbeddedFracturePermeability::dValue is implemented for " + "derivatives with respect to strain only."); + } Eigen::Matrix<double, 3, 1> const n = [&] { if (_n_const) diff --git a/MaterialLib/MPL/Properties/OrthotropicEmbeddedFracturePermeability.cpp b/MaterialLib/MPL/Properties/OrthotropicEmbeddedFracturePermeability.cpp index f2c9c7392ae..c999a9e97ea 100644 --- a/MaterialLib/MPL/Properties/OrthotropicEmbeddedFracturePermeability.cpp +++ b/MaterialLib/MPL/Properties/OrthotropicEmbeddedFracturePermeability.cpp @@ -88,10 +88,12 @@ OrthotropicEmbeddedFracturePermeability<DisplacementDim>::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::mechanical_strain) && - "OrthotropicEmbeddedFracturePermeability::dValue is implemented for " - " derivatives with respect to strain only."); + if (primary_variable != Variable::mechanical_strain) + { + OGS_FATAL( + "OrthotropicEmbeddedFracturePermeability::dValue is implemented " + "for derivatives with respect to strain only."); + } auto const eps = formEigenTensor<3>(std::get<SymmetricTensor>( variable_array[static_cast<int>(Variable::mechanical_strain)])); diff --git a/MaterialLib/MPL/Properties/PermeabilityOrthotropicPowerLaw.cpp b/MaterialLib/MPL/Properties/PermeabilityOrthotropicPowerLaw.cpp index 4affdb393cd..04fe43dda64 100644 --- a/MaterialLib/MPL/Properties/PermeabilityOrthotropicPowerLaw.cpp +++ b/MaterialLib/MPL/Properties/PermeabilityOrthotropicPowerLaw.cpp @@ -91,10 +91,12 @@ PropertyDataType PermeabilityOrthotropicPowerLaw<DisplacementDim>::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::total_strain) && - "PermeabilityOrthotropicPowerLaw::dValue is implemented for " - "derivatives with respect to total strain only."); + if (primary_variable != Variable::total_strain) + { + OGS_FATAL( + "PermeabilityOrthotropicPowerLaw::dValue is implemented for " + "derivatives with respect to total strain only."); + } return 0.; } diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCorey.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCorey.cpp index 49b3a9f4824..02b9957f980 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCorey.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCorey.cpp @@ -77,10 +77,13 @@ PropertyDataType RelPermBrooksCorey::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const dt) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "RelPermBrooksCorey::dValue is implemented for " - " derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermBrooksCorey::dValue is implemented for derivatives with " + "respect to liquid saturation only."); + } + /// here, an extra computation of saturation is forced, guaranteeing a /// correct value. In order to speed up the computing time, saturation could /// be inserted into the primary variable array after it is computed in the diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCoreyNonwettingPhase.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCoreyNonwettingPhase.cpp index fb7309ddc5f..4e07916b9b6 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCoreyNonwettingPhase.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermBrooksCoreyNonwettingPhase.cpp @@ -79,10 +79,12 @@ PropertyDataType RelPermBrooksCoreyNonwettingPhase::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const dt) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "RelPermBrooksCorey::dValue is implemented for " - " derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermBrooksCoreyNonwettingPhase::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } /// here, an extra computation of saturation is forced, guaranteeing a /// correct value. In order to speed up the computing time, saturation could /// be inserted into the primary variable array after it is computed in the diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermLiakopoulos.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermLiakopoulos.cpp index efb0545f7d1..a8ccbd34fef 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermLiakopoulos.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermLiakopoulos.cpp @@ -65,10 +65,12 @@ PropertyDataType RelPermLiakopoulos::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const dt) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "RelPermLiakopoulos::dValue is implemented for " - " derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermLiakopoulos::dValue is implemented for derivatives with " + "respect to liquid saturation only."); + } /// here, an extra computation of saturation is forced, guaranteeing a /// correct value. In order to speed up the computing time, saturation could /// be inserted into the primary variable array after it is computed in the diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermNonWettingPhaseVanGenuchtenMualem.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermNonWettingPhaseVanGenuchtenMualem.cpp index ca8bdbfd8de..bb824fb3d7e 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermNonWettingPhaseVanGenuchtenMualem.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermNonWettingPhaseVanGenuchtenMualem.cpp @@ -56,11 +56,12 @@ PropertyDataType RelPermNonWettingPhaseVanGenuchtenMualem::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert( - (variable == Variable::liquid_saturation) && - "RelPermNonWettingPhaseVanGenuchtenMualem::dValue is implemented for " - "the derivative with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermNonWettingPhaseVanGenuchtenMualem::dValue is implemented " + "for the derivative with respect to liquid saturation only."); + } const double S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp index 3f046a6eef8..556dcde80f7 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp @@ -67,10 +67,12 @@ PropertyDataType RelPermUdell::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "RelPermUdell::dValue is implemented for " - " derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermUdell::dValue is implemented for derivatives with respect " + "to liquid saturation only."); + } const double S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdellNonwettingPhase.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdellNonwettingPhase.cpp index bfc695e08d7..e4a15acb3e0 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdellNonwettingPhase.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdellNonwettingPhase.cpp @@ -72,10 +72,12 @@ PropertyDataType RelPermUdellNonwettingPhase::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::liquid_saturation) && - "RelPermUdellNonwettingPhase::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (primary_variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelPermUdellNonwettingPhase::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } const double S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermVanGenuchten.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermVanGenuchten.cpp index 4e9d85e4cd7..f532e7df04b 100644 --- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermVanGenuchten.cpp +++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermVanGenuchten.cpp @@ -60,10 +60,13 @@ PropertyDataType RelPermVanGenuchten::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::liquid_saturation) && - "RelativePermeabilityVanGenuchten::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (primary_variable != Variable::liquid_saturation) + { + OGS_FATAL( + "RelativePermeabilityVanGenuchten::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } + double const S_L = std::clamp( std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]), diff --git a/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp b/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp index e3b967f4c00..6b3ec181039 100644 --- a/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp +++ b/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp @@ -104,10 +104,12 @@ PropertyDataType SaturationDependentSwelling::dValue( ParameterLib::SpatialPosition const& pos, double const /*t*/, double const /*dt*/) const { - (void)primary_variable; - assert((primary_variable == Variable::liquid_saturation) && - "SaturationDependentSwelling::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (primary_variable != Variable::liquid_saturation) + { + OGS_FATAL( + "SaturationDependentSwelling::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } auto const S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); diff --git a/MaterialLib/MPL/Properties/SaturationDependentThermalConductivity.cpp b/MaterialLib/MPL/Properties/SaturationDependentThermalConductivity.cpp index dc7f54cdfd7..3e9f2957058 100644 --- a/MaterialLib/MPL/Properties/SaturationDependentThermalConductivity.cpp +++ b/MaterialLib/MPL/Properties/SaturationDependentThermalConductivity.cpp @@ -46,10 +46,12 @@ PropertyDataType SaturationDependentThermalConductivity::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "SaturationDependentThermalConductivity::dvalue is implemented for " - "derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "SaturationDependentThermalConductivity::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } return K_wet_ - K_dry_; } diff --git a/MaterialLib/MPL/Properties/SwellingStress/LinearSaturationSwellingStress.cpp b/MaterialLib/MPL/Properties/SwellingStress/LinearSaturationSwellingStress.cpp index 6c8e9682dbd..fc2c4c38057 100644 --- a/MaterialLib/MPL/Properties/SwellingStress/LinearSaturationSwellingStress.cpp +++ b/MaterialLib/MPL/Properties/SwellingStress/LinearSaturationSwellingStress.cpp @@ -61,10 +61,12 @@ PropertyDataType LinearSaturationSwellingStress::dValue( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "LinearSaturationSwellingStress::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "LinearSaturationSwellingStress::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } // Sl <= S_max is guaranteed by the saturation property or // the saturation calculation. diff --git a/MaterialLib/MPL/Properties/ThermalConductivity/SoilThermalConductivitySomerton.cpp b/MaterialLib/MPL/Properties/ThermalConductivity/SoilThermalConductivitySomerton.cpp index 474a47612f1..a9f45b8c426 100644 --- a/MaterialLib/MPL/Properties/ThermalConductivity/SoilThermalConductivitySomerton.cpp +++ b/MaterialLib/MPL/Properties/ThermalConductivity/SoilThermalConductivitySomerton.cpp @@ -90,10 +90,12 @@ PropertyDataType SoilThermalConductivitySomerton<1>::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "SoilThermalConductivitySomerton::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "SoilThermalConductivitySomerton::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } double const S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); @@ -209,10 +211,12 @@ PropertyDataType SoilThermalConductivitySomerton<GlobalDimension>::dValue( ParameterLib::SpatialPosition const& pos, double const t, double const /*dt*/) const { - (void)variable; - assert((variable == Variable::liquid_saturation) && - "SoilThermalConductivitySomerton::dValue is implemented for " - "derivatives with respect to liquid saturation only."); + if (variable != Variable::liquid_saturation) + { + OGS_FATAL( + "SoilThermalConductivitySomerton::dValue is implemented for " + "derivatives with respect to liquid saturation only."); + } double const S_L = std::get<double>( variable_array[static_cast<int>(Variable::liquid_saturation)]); -- GitLab