diff --git a/ProcessLib/RichardsMechanics/LocalAssemblerInterface.h b/ProcessLib/RichardsMechanics/LocalAssemblerInterface.h index a9f01c33a63..fd8d870dafe 100644 --- a/ProcessLib/RichardsMechanics/LocalAssemblerInterface.h +++ b/ProcessLib/RichardsMechanics/LocalAssemblerInterface.h @@ -114,20 +114,38 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, name, values, current_states_); } - virtual std::vector getMaterialStateVariableInternalState( + std::vector getMaterialStateVariableInternalState( std::function( typename MaterialLib::Solids::MechanicsBase:: MaterialStateVariables&)> const& get_values_span, - int const& n_components) const = 0; + int const& n_components) const + { + return ProcessLib::getIntegrationPointDataMaterialStateVariables( + material_states_, + &ProcessLib::ThermoRichardsMechanics::MaterialStateData< + DisplacementDim>::material_state_variables, + get_values_span, n_components); + } // TODO move to NumLib::ExtrapolatableElement - virtual unsigned getNumberOfIntegrationPoints() const = 0; + unsigned getNumberOfIntegrationPoints() const + { + return integration_method_.getNumberOfPoints(); + } - virtual int getMaterialID() const = 0; + int getMaterialID() const + { + return process_data_.material_ids == nullptr + ? 0 + : (*process_data_.material_ids)[element_.getID()]; + } - virtual typename MaterialLib::Solids::MechanicsBase< + typename MaterialLib::Solids::MechanicsBase< DisplacementDim>::MaterialStateVariables const& - getMaterialStateVariablesAt(unsigned /*integration_point*/) const = 0; + getMaterialStateVariablesAt(unsigned integration_point) const + { + return *material_states_[integration_point].material_state_variables; + } static auto getReflectionDataForOutput() { @@ -137,6 +155,25 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, &Self::current_states_, &Self::output_data_); } + void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, + Eigen::VectorXd const& /*local_x_prev*/, + double const /*t*/, double const /*dt*/, + int const /*process_id*/) override final + { + unsigned const n_integration_points = + integration_method_.getNumberOfPoints(); + + for (auto& s : material_states_) + { + s.pushBackState(); + } + + for (unsigned ip = 0; ip < n_integration_points; ip++) + { + prev_states_[ip] = current_states_[ip]; + } + } + protected: RichardsMechanicsProcessData& process_data_; NumLib::GenericIntegrationMethod const& integration_method_; diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h index fbb5818088c..b225b114f76 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h @@ -1443,34 +1443,6 @@ void RichardsMechanicsLocalAssembler -int RichardsMechanicsLocalAssembler::getMaterialID() const -{ - return this->process_data_.material_ids == nullptr - ? 0 - : (*this->process_data_.material_ids)[this->element_.getID()]; -} - -template -std::vector RichardsMechanicsLocalAssembler< - ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>:: - getMaterialStateVariableInternalState( - std::function( - typename MaterialLib::Solids::MechanicsBase:: - MaterialStateVariables&)> const& get_values_span, - int const& n_components) const -{ - return ProcessLib::getIntegrationPointDataMaterialStateVariables( - this->material_states_, - &ProcessLib::ThermoRichardsMechanics::MaterialStateData< - DisplacementDim>::material_state_variables, - get_values_span, n_components); -} - template void RichardsMechanicsLocalAssembler(this->element_, this->is_axially_symmetric_, p_L, *this->process_data_.pressure_interpolated); } - -template -unsigned RichardsMechanicsLocalAssembler< - ShapeFunctionDisplacement, ShapeFunctionPressure, - DisplacementDim>::getNumberOfIntegrationPoints() const -{ - return this->integration_method_.getNumberOfPoints(); -} - -template -typename MaterialLib::Solids::MechanicsBase< - DisplacementDim>::MaterialStateVariables const& -RichardsMechanicsLocalAssembler:: - getMaterialStateVariablesAt(unsigned integration_point) const -{ - return *this->material_states_[integration_point].material_state_variables; -} } // namespace RichardsMechanics } // namespace ProcessLib diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h index 553bfb996ee..f11da1d504d 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h @@ -158,26 +158,6 @@ class RichardsMechanicsLocalAssembler } } - void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_prev*/, - double const /*t*/, double const /*dt*/, - int const /*process_id*/) override - { - unsigned const n_integration_points = - this->integration_method_.getNumberOfPoints(); - - for (auto& s : this->material_states_) - { - s.pushBackState(); - } - - // TODO move to the local assembler interface - for (unsigned ip = 0; ip < n_integration_points; ip++) - { - this->prev_states_[ip] = this->current_states_[ip]; - } - } - void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, Eigen::VectorXd const& local_x_prev) override; @@ -191,14 +171,6 @@ class RichardsMechanicsLocalAssembler return Eigen::Map(N_u.data(), N_u.size()); } - int getMaterialID() const override; - - std::vector getMaterialStateVariableInternalState( - std::function( - typename MaterialLib::Solids::MechanicsBase:: - MaterialStateVariables&)> const& get_values_span, - int const& n_components) const override; - private: /** * Assemble local matrices and vectors arise from the linearized discretized @@ -261,12 +233,6 @@ class RichardsMechanicsLocalAssembler std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data); - unsigned getNumberOfIntegrationPoints() const override; - - typename MaterialLib::Solids::MechanicsBase< - DisplacementDim>::MaterialStateVariables const& - getMaterialStateVariablesAt(unsigned integration_point) const override; - private: static void assembleWithJacobianEvalConstitutiveSetting( double const t, double const dt,