diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.cpp index 0cde8d5a7ba3b0255ea97300c3ee9e7b4f1d450e..89ffef0a7d378d2280d13b1c92d861bbf45d6a04 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.cpp @@ -11,11 +11,56 @@ #include "ConstitutiveSetting.h" #include "ProcessLib/Graph/Apply.h" +#include "ProcessLib/Graph/CheckEvalOrderRT.h" namespace ProcessLib::ThermoRichardsMechanics { namespace ConstitutiveStressSaturation_StrainPressureTemperature { + +template <int DisplacementDim> +static bool checkCorrectModelEvalOrder() +{ + INFO( + "Checking correct model evaluation order in the constitutive setting."); + + using namespace boost::mp11; + + constexpr auto D = DisplacementDim; + + using Inputs = + mp_list<SpaceTimeData, MediaData, TemperatureData<D>, + CapillaryPressureData<D>, StrainData<D> + //, MaterialStateData<D> /*TODO material state data is a special + // case: it's both input and output data.*/ + >; + + using InputsAndPrevState = mp_append<Inputs, StatefulDataPrev<D>>; + + bool const is_correct = ProcessLib::Graph::isEvalOrderCorrectRT< + ConstitutiveModels<DisplacementDim>, InputsAndPrevState>(); + + if (!is_correct) + { + OGS_FATAL("The constitutive setting has a wrong evaluation order."); + } + + INFO("Model evaluation order is correct."); + + return is_correct; +} + +template <int DisplacementDim> +void ConstitutiveSetting<DisplacementDim>::init( + ConstitutiveModels<DisplacementDim>&, double const /*t*/, + double const /*dt*/, ParameterLib::SpatialPosition const&, MediaData const&, + TemperatureData<DisplacementDim> const&, StatefulData<DisplacementDim>&, + StatefulDataPrev<DisplacementDim>&) const +{ + [[maybe_unused]] static const bool model_order_correct = + checkCorrectModelEvalOrder<DisplacementDim>(); +} + template <int DisplacementDim> void ConstitutiveSetting<DisplacementDim>::eval( ConstitutiveModels<DisplacementDim>& models, double const t, diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.h b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.h index b992057f5115f64eaf09d3709c488875af529407..88c6e9bfe8e5c37bb72d716f5ad5e87f596cd381 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.h +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ConstitutiveSetting.h @@ -24,9 +24,7 @@ struct ConstitutiveSetting double const /*dt*/, ParameterLib::SpatialPosition const&, MediaData const&, TemperatureData<DisplacementDim> const&, StatefulData<DisplacementDim>&, - StatefulDataPrev<DisplacementDim>&) const - { - } + StatefulDataPrev<DisplacementDim>&) const; /// Evaluate the constitutive setting. void eval(ConstitutiveModels<DisplacementDim>& models, double const t, diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ConstitutiveSetting.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ConstitutiveSetting.cpp index 5dd4952ca6561b7699d91f2091df955a5427e697..ea77471a7e51abded4fa5339bf654314d020b44a 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ConstitutiveSetting.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ConstitutiveSetting.cpp @@ -14,11 +14,41 @@ #include "MaterialLib/MPL/PropertyType.h" #include "ProcessLib/Graph/Apply.h" +#include "ProcessLib/Graph/CheckEvalOrderRT.h" namespace ProcessLib::ThermoRichardsMechanics { namespace ConstitutiveStress_StrainTemperature { + +template <int DisplacementDim> +static bool checkCorrectModelEvalOrder() +{ + INFO( + "Checking correct model evaluation order in the constitutive setting."); + + using namespace boost::mp11; + + constexpr auto D = DisplacementDim; + + using Inputs = mp_list<SpaceTimeData, MediaData, TemperatureData<D>, + CapillaryPressureData<D>, StrainData<D>>; + + using InputsAndPrevState = mp_append<Inputs, StatefulDataPrev<D>>; + + bool const is_correct = ProcessLib::Graph::isEvalOrderCorrectRT< + ConstitutiveModels<DisplacementDim>, InputsAndPrevState>(); + + if (!is_correct) + { + OGS_FATAL("The constitutive setting has a wrong evaluation order."); + } + + INFO("Model evaluation order is correct."); + + return is_correct; +} + template <int DisplacementDim> void ConstitutiveSetting<DisplacementDim>::init( ConstitutiveModels<DisplacementDim>& models, double const t, @@ -27,6 +57,9 @@ void ConstitutiveSetting<DisplacementDim>::init( StatefulData<DisplacementDim>& state, StatefulDataPrev<DisplacementDim>& prev_state) const { + [[maybe_unused]] static const bool model_order_correct = + checkCorrectModelEvalOrder<DisplacementDim>(); + // Set eps_m_prev from potentially non-zero eps and sigma_sw from // restart. SpaceTimeData const x_t{x_position, t, dt};