diff --git a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h index 411dae3241ae77543771ec7dec044ee3d26fe70a..95fc8994c39933d9d85a9786411716f069caef19 100644 --- a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h +++ b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h @@ -17,6 +17,7 @@ #include "ProcessLib/LocalAssemblerInterface.h" #include "ProcessLib/ThermoRichardsMechanics/ConstitutiveSetting.h" #include "ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcessData.h" +#include "ProcessLib/Utils/SetOrGetIntegrationPointData.h" namespace ProcessLib::ThermoRichardsMechanics { @@ -51,9 +52,71 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, } } - virtual std::size_t setIPDataInitialConditions( - std::string const& name, double const* values, - int const integration_order) = 0; + std::size_t setIPDataInitialConditions(std::string const& name, + double const* values, + int const integration_order) + { + if (integration_order != + static_cast<int>(this->integration_method_.getIntegrationOrder())) + { + OGS_FATAL( + "Setting integration point initial conditions; The integration " + "order of the local assembler for element {:d} is different " + "from the integration order in the initial condition.", + this->element_.getID()); + } + + if (name == "sigma_ip") + { + if (this->process_data_.initial_stress != nullptr) + { + OGS_FATAL( + "Setting initial conditions for stress from integration " + "point data and from a parameter '{:s}' is not possible " + "simultaneously.", + this->process_data_.initial_stress->name); + } + return ProcessLib::setIntegrationPointKelvinVectorData< + DisplacementDim>(values, this->current_states_, + [](auto const& cs) + { return cs.s_mech_data.sigma_eff; }); + } + + if (name == "saturation_ip") + { + return ProcessLib::setIntegrationPointScalarData( + values, this->current_states_, + [](auto& state) -> auto& { return state.S_L_data.S_L; }); + } + if (name == "porosity_ip") + { + return ProcessLib::setIntegrationPointScalarData( + values, this->current_states_, + [](auto& state) -> auto& { return state.poro_data.phi; }); + } + if (name == "transport_porosity_ip") + { + return ProcessLib::setIntegrationPointScalarData( + values, this->current_states_, [](auto& state) -> auto& { + return state.transport_poro_data.phi; + }); + } + if (name == "swelling_stress_ip") + { + return ProcessLib::setIntegrationPointKelvinVectorData< + DisplacementDim>(values, this->current_states_, + [](auto const& cs) + { return cs.swelling_data.sigma_sw; }); + } + if (name == "epsilon_ip") + { + return ProcessLib::setIntegrationPointKelvinVectorData< + DisplacementDim>(values, this->current_states_, + [](auto const& cs) + { return cs.eps_data.eps; }); + } + return 0; + } virtual std::vector<double> getSigma() const = 0; diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h index d3335c9f90ba2e4445351978a7650cd9e491e2ff..c2bcedfe026e1ac3ef5895ae05aeb55569620534 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h @@ -121,72 +121,6 @@ ThermoRichardsMechanicsLocalAssembler<ShapeFunctionDisplacement, ShapeFunction, } } -template <typename ShapeFunctionDisplacement, typename ShapeFunction, - int DisplacementDim> -std::size_t ThermoRichardsMechanicsLocalAssembler< - ShapeFunctionDisplacement, ShapeFunction, - DisplacementDim>::setIPDataInitialConditions(std::string const& name, - double const* values, - int const integration_order) -{ - if (integration_order != - static_cast<int>(this->integration_method_.getIntegrationOrder())) - { - OGS_FATAL( - "Setting integration point initial conditions; The integration " - "order of the local assembler for element {:d} is different " - "from the integration order in the initial condition.", - this->element_.getID()); - } - - if (name == "sigma_ip") - { - if (this->process_data_.initial_stress != nullptr) - { - OGS_FATAL( - "Setting initial conditions for stress from integration " - "point data and from a parameter '{:s}' is not possible " - "simultaneously.", - this->process_data_.initial_stress->name); - } - return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>( - values, this->current_states_, - [](auto const& cs) { return cs.s_mech_data.sigma_eff; }); - } - - if (name == "saturation_ip") - { - return ProcessLib::setIntegrationPointScalarData( - values, this->current_states_, - [](auto& state) -> auto& { return state.S_L_data.S_L; }); - } - if (name == "porosity_ip") - { - return ProcessLib::setIntegrationPointScalarData( - values, this->current_states_, - [](auto& state) -> auto& { return state.poro_data.phi; }); - } - if (name == "transport_porosity_ip") - { - return ProcessLib::setIntegrationPointScalarData( - values, this->current_states_, - [](auto& state) -> auto& { return state.transport_poro_data.phi; }); - } - if (name == "swelling_stress_ip") - { - return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>( - values, this->current_states_, - [](auto const& cs) { return cs.swelling_data.sigma_sw; }); - } - if (name == "epsilon_ip") - { - return ProcessLib::setIntegrationPointKelvinVectorData<DisplacementDim>( - values, this->current_states_, - [](auto const& cs) { return cs.eps_data.eps; }); - } - return 0; -} - template <typename ShapeFunctionDisplacement, typename ShapeFunction, int DisplacementDim> void ThermoRichardsMechanicsLocalAssembler<ShapeFunctionDisplacement, diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h index 0010418cf63868cf949cd3614f0fe96728cebc26..b4fb4dd4ae62fa5d84d91904899066192eccee8b 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h @@ -87,12 +87,6 @@ public: bool const is_axially_symmetric, ThermoRichardsMechanicsProcessData<DisplacementDim>& process_data); - /// \return the number of read integration points. - std::size_t setIPDataInitialConditions( - std::string const& name, - double const* values, - int const integration_order) override; - void setInitialConditionsConcrete(std::vector<double> const& local_x, double const t, bool const use_monolithic_scheme,