Commit 6c935826 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[PL] Moved several members to interface class

parent ebe7af9f
......@@ -11,8 +11,12 @@
#pragma once
#include "MaterialLib/SolidModels/MechanicsBase.h"
#include "MaterialLib/SolidModels/SelectSolidConstitutiveRelation.h"
#include "NumLib/Extrapolation/ExtrapolatableElement.h"
#include "NumLib/Fem/Integration/GenericIntegrationMethod.h"
#include "ProcessLib/LocalAssemblerInterface.h"
#include "ProcessLib/ThermoRichardsMechanics/ConstitutiveSetting.h"
#include "ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcessData.h"
namespace ProcessLib::ThermoRichardsMechanics
{
......@@ -20,6 +24,33 @@ template <int DisplacementDim>
struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
public NumLib::ExtrapolatableElement
{
LocalAssemblerInterface(
MeshLib::Element const& e,
NumLib::GenericIntegrationMethod const& integration_method,
bool const is_axially_symmetric,
ThermoRichardsMechanicsProcessData<DisplacementDim>& process_data)
: process_data_(process_data),
integration_method_(integration_method),
element_(e),
is_axially_symmetric_(is_axially_symmetric),
solid_material_(MaterialLib::Solids::selectSolidConstitutiveRelation(
process_data_.solid_materials, process_data_.material_ids,
e.getID()))
{
unsigned const n_integration_points =
integration_method_.getNumberOfPoints();
current_states_.resize(n_integration_points);
prev_states_.resize(n_integration_points);
output_data_.resize(n_integration_points);
material_states_.reserve(n_integration_points);
for (unsigned ip = 0; ip < n_integration_points; ++ip)
{
material_states_.emplace_back(solid_material_);
}
}
virtual std::size_t setIPDataInitialConditions(
std::string const& name, double const* values,
int const integration_order) = 0;
......@@ -102,6 +133,26 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
virtual typename MaterialLib::Solids::MechanicsBase<
DisplacementDim>::MaterialStateVariables const&
getMaterialStateVariablesAt(unsigned /*integration_point*/) const = 0;
protected:
ThermoRichardsMechanicsProcessData<DisplacementDim>& process_data_;
std::vector<StatefulData<DisplacementDim>>
current_states_; // TODO maybe do not store but rather re-evaluate for
// state update
std::vector<StatefulData<DisplacementDim>> prev_states_;
// Material state is special, because it contains both the current and the
// old state.
std::vector<MaterialStateData<DisplacementDim>> material_states_;
NumLib::GenericIntegrationMethod const& integration_method_;
MeshLib::Element const& element_;
bool const is_axially_symmetric_;
MaterialLib::Solids::MechanicsBase<DisplacementDim> const& solid_material_;
std::vector<OutputData<DisplacementDim>> output_data_;
};
} // namespace ProcessLib::ThermoRichardsMechanics
......@@ -16,17 +16,11 @@
#include "ConstitutiveSetting.h"
#include "IntegrationPointData.h"
#include "LocalAssemblerInterface.h"
#include "MaterialLib/SolidModels/LinearElasticIsotropic.h"
#include "MathLib/KelvinVector.h"
#include "MathLib/LinAlg/Eigen/EigenMapTools.h"
#include "NumLib/DOF/DOFTableUtil.h"
#include "NumLib/Fem/InitShapeMatrices.h"
#include "NumLib/Fem/Integration/GenericIntegrationMethod.h"
#include "NumLib/Fem/ShapeMatrixPolicy.h"
#include "ParameterLib/Parameter.h"
#include "ProcessLib/Deformation/BMatrixPolicy.h"
#include "ProcessLib/Deformation/LinearBMatrix.h"
#include "ProcessLib/LocalAssemblerTraits.h"
#include "ThermoRichardsMechanicsProcessData.h"
namespace ProcessLib
......@@ -274,32 +268,32 @@ public:
void initializeConcrete() override
{
unsigned const n_integration_points =
integration_method_.getNumberOfPoints();
this->integration_method_.getNumberOfPoints();
for (unsigned ip = 0; ip < n_integration_points; ip++)
{
// Set initial stress from parameter.
if (process_data_.initial_stress != nullptr)
if (this->process_data_.initial_stress != nullptr)
{
ParameterLib::SpatialPosition const x_position{
std::nullopt, element_.getID(), ip,
std::nullopt, this->element_.getID(), ip,
MathLib::Point3d(NumLib::interpolateCoordinates<
ShapeFunctionDisplacement,
ShapeMatricesTypeDisplacement>(
element_, ip_data_[ip].N_u))};
this->element_, ip_data_[ip].N_u))};
current_states_[ip].s_mech_data.sigma_eff =
this->current_states_[ip].s_mech_data.sigma_eff =
MathLib::KelvinVector::symmetricTensorToKelvinVector<
DisplacementDim>((*process_data_.initial_stress)(
DisplacementDim>((*this->process_data_.initial_stress)(
std::numeric_limits<
double>::quiet_NaN() /* time independent */,
x_position));
}
material_states_[ip].pushBackState();
this->material_states_[ip].pushBackState();
}
prev_states_ = current_states_;
this->prev_states_ = this->current_states_;
}
void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
......@@ -307,15 +301,15 @@ public:
double const /*dt*/) override
{
unsigned const n_integration_points =
integration_method_.getNumberOfPoints();
this->integration_method_.getNumberOfPoints();
for (unsigned ip = 0; ip < n_integration_points; ip++)
{
// TODO re-evaluate part of the assembly in order to be consistent?
material_states_[ip].pushBackState();
this->material_states_[ip].pushBackState();
}
prev_states_ = current_states_;
this->prev_states_ = this->current_states_;
}
void computeSecondaryVariableConcrete(
......@@ -406,30 +400,11 @@ private:
getMaterialStateVariablesAt(unsigned integration_point) const override;
private:
ThermoRichardsMechanicsProcessData<DisplacementDim>& process_data_;
std::vector<StatefulData<DisplacementDim>>
current_states_; // TODO maybe do not store but rather re-evaluate for
// state update
std::vector<StatefulData<DisplacementDim>> prev_states_;
// Material state is special, because it contains both the current and the
// old state.
std::vector<MaterialStateData<DisplacementDim>> material_states_;
std::vector<IpData> ip_data_;
NumLib::GenericIntegrationMethod const& integration_method_;
MeshLib::Element const& element_;
bool const is_axially_symmetric_;
SecondaryData<
typename ShapeMatricesTypeDisplacement::ShapeMatrices::ShapeType>
secondary_data_;
MaterialLib::Solids::MechanicsBase<DisplacementDim> const& solid_material_;
std::vector<OutputData<DisplacementDim>> output_data_;
static auto block_uu(auto& mat)
{
return mat.template block<displacement_size, displacement_size>(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment