OGS
ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim > Struct Template Reference

Detailed Description

template<int DisplacementDim>
struct ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >

Definition at line 34 of file LocalAssemblerInterface.h.

#include <LocalAssemblerInterface.h>

Inheritance diagram for ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >:
[legend]
Collaboration diagram for ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >:
[legend]

Public Member Functions

 SmallDeformationLocalAssemblerInterface (MeshLib::Element const &e, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, SmallDeformationProcessData< DisplacementDim > &process_data)
 
std::size_t setIPDataInitialConditions (std::string_view name, double const *values, int const integration_order)
 Returns number of read integration points.
 
void computeSecondaryVariableConcrete (double const, double const, Eigen::VectorXd const &, Eigen::VectorXd const &) override
 
unsigned getNumberOfIntegrationPoints () const
 
int getMaterialID () const
 
std::vector< double > getMaterialStateVariableInternalState (std::function< std::span< double >(typename MaterialLib::Solids::MechanicsBase< DisplacementDim >::MaterialStateVariables &)> const &get_values_span, int const &n_components) const
 
MaterialLib::Solids::MechanicsBase< DisplacementDim >::MaterialStateVariables const & getMaterialStateVariablesAt (unsigned integration_point) const
 
- Public Member Functions inherited from ProcessLib::LocalAssemblerInterface
virtual ~LocalAssemblerInterface ()=default
 
virtual void setInitialConditions (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, int const process_id)
 
virtual void initialize (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
 
virtual void preAssemble (double const, double const, std::vector< double > const &)
 
virtual void assemble (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
 
virtual void assembleForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
 
virtual void assembleWithJacobian (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
 
virtual void assembleWithJacobianForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
 
virtual void computeSecondaryVariable (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
 
virtual void preTimestep (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
 
virtual void postTimestep (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
 
void postNonLinearSolver (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
 
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< double > const &) const
 
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< std::vector< double > > const &) const
 Fits to staggered scheme.
 
- Public Member Functions inherited from ProcessLib::SmallDeformation::MaterialForcesInterface
virtual std::vector< double > const & getMaterialForces (std::vector< double > const &local_x, std::vector< double > &nodal_values)=0
 
virtual ~MaterialForcesInterface ()=default
 
- Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix (const unsigned integration_point) const =0
 Provides the shape matrix at the given integration point.
 
virtual ~ExtrapolatableElement ()=default
 

Static Public Member Functions

static auto getReflectionDataForOutput ()
 

Protected Attributes

SmallDeformationProcessData< DisplacementDim > & process_data_
 
std::vector< MaterialStateData< DisplacementDim > > material_states_
 
std::vector< typename ConstitutiveRelations::StatefulData< DisplacementDim > > current_states_
 
std::vector< typename ConstitutiveRelations::StatefulDataPrev< DisplacementDim > > prev_states_
 
std::vector< typename ConstitutiveRelations::OutputData< DisplacementDim > > output_data_
 
NumLib::GenericIntegrationMethod const & integration_method_
 
MeshLib::Element const & element_
 
bool const is_axially_symmetric_
 
MaterialLib::Solids::MechanicsBase< DisplacementDim > const & solid_material_
 
ConstitutiveRelations::ConstitutiveSetting< DisplacementDim > constitutive_setting
 

Constructor & Destructor Documentation

◆ SmallDeformationLocalAssemblerInterface()

template<int DisplacementDim>
ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::SmallDeformationLocalAssemblerInterface ( MeshLib::Element const & e,
NumLib::GenericIntegrationMethod const & integration_method,
bool const is_axially_symmetric,
SmallDeformationProcessData< DisplacementDim > & process_data )
inline

Definition at line 39 of file LocalAssemblerInterface.h.

44 : process_data_(process_data),
45 integration_method_(integration_method),
46 element_(e),
47 is_axially_symmetric_(is_axially_symmetric),
49 process_data_.solid_materials, process_data_.material_ids,
50 element_.getID()))
51 {
52 unsigned const n_integration_points =
54
55 current_states_.resize(n_integration_points);
56 prev_states_.resize(n_integration_points);
57 output_data_.resize(n_integration_points);
58
59 material_states_.reserve(n_integration_points);
60 for (unsigned ip = 0; ip < n_integration_points; ++ip)
61 {
62 material_states_.emplace_back(
63 solid_material_.createMaterialStateVariables());
64
65 // Set initial stress field to zero. Might be overwritten by
66 // integration point data or initial stress.
67 this->current_states_[ip].stress_data.sigma.noalias() =
69 DisplacementDim>::Zero();
70 }
71 }
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
auto & selectSolidConstitutiveRelation(SolidMaterialsMap const &constitutive_relations, MeshLib::PropertyVector< int > const *const material_ids, std::size_t const element_id)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
std::vector< typename ConstitutiveRelations::StatefulDataPrev< DisplacementDim > > prev_states_
std::vector< typename ConstitutiveRelations::StatefulData< DisplacementDim > > current_states_
std::vector< typename ConstitutiveRelations::OutputData< DisplacementDim > > output_data_
MaterialLib::Solids::MechanicsBase< DisplacementDim > const & solid_material_
std::vector< MaterialStateData< DisplacementDim > > material_states_

References ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::current_states_, NumLib::GenericIntegrationMethod::getNumberOfPoints(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::integration_method_, ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::material_states_, ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::output_data_, ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::prev_states_, and ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::solid_material_.

Member Function Documentation

◆ computeSecondaryVariableConcrete()

template<int DisplacementDim>
void ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::computeSecondaryVariableConcrete ( double const ,
double const ,
Eigen::VectorXd const & ,
Eigen::VectorXd const &  )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 121 of file LocalAssemblerInterface.h.

124 {
125 int const elem_id = element_.getID();
127 x_position.setElementID(elem_id);
128 unsigned const n_integration_points =
130
131 auto sigma_sum = MathLib::KelvinVector::tensorToKelvin<DisplacementDim>(
132 Eigen::Matrix<double, 3, 3>::Zero());
133
134 for (unsigned ip = 0; ip < n_integration_points; ip++)
135 {
136 x_position.setIntegrationPoint(ip);
137 auto const& sigma = current_states_[ip].stress_data.sigma;
138 sigma_sum += sigma;
139 }
140
141 Eigen::Matrix<double, 3, 3, 0, 3, 3> const sigma_avg =
143 n_integration_points;
144
145 Eigen::SelfAdjointEigenSolver<Eigen::Matrix<double, 3, 3>> e_s(
146 sigma_avg);
147
148 Eigen::Map<Eigen::Vector3d>(
149 &(*process_data_.principal_stress_values)[elem_id * 3], 3) =
150 e_s.eigenvalues();
151
152 auto eigen_vectors = e_s.eigenvectors();
153
154 for (auto i = 0; i < 3; i++)
155 {
156 Eigen::Map<Eigen::Vector3d>(
157 &(*process_data_.principal_stress_vector[i])[elem_id * 3], 3) =
158 eigen_vectors.col(i);
159 }
160 }
void setElementID(std::size_t element_id)
void setIntegrationPoint(unsigned integration_point)
Eigen::Matrix< double, 3, 3 > kelvinVectorToTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)

References ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::current_states_, ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::element_, MeshLib::Element::getID(), NumLib::GenericIntegrationMethod::getNumberOfPoints(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::integration_method_, MathLib::KelvinVector::kelvinVectorToTensor(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::process_data_, ParameterLib::SpatialPosition::setElementID(), and ParameterLib::SpatialPosition::setIntegrationPoint().

◆ getMaterialID()

◆ getMaterialStateVariableInternalState()

template<int DisplacementDim>
std::vector< double > ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::getMaterialStateVariableInternalState ( std::function< std::span< double >(typename MaterialLib::Solids::MechanicsBase< DisplacementDim >::MaterialStateVariables &)> const & get_values_span,
int const & n_components ) const
inline

Definition at line 175 of file LocalAssemblerInterface.h.

180 {
184 get_values_span, n_components);
185 }
std::vector< double > getIntegrationPointDataMaterialStateVariables(IntegrationPointDataVector const &ip_data_vector, MemberType member, std::function< std::span< double >(MaterialStateVariables &)> get_values_span, int const n_components)

References ProcessLib::getIntegrationPointDataMaterialStateVariables(), and ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::material_states_.

◆ getMaterialStateVariablesAt()

template<int DisplacementDim>
MaterialLib::Solids::MechanicsBase< DisplacementDim >::MaterialStateVariables const & ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::getMaterialStateVariablesAt ( unsigned integration_point) const
inline

Definition at line 189 of file LocalAssemblerInterface.h.

190 {
191 return *material_states_[integration_point].material_state_variables;
192 }

References ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::material_states_.

◆ getNumberOfIntegrationPoints()

◆ getReflectionDataForOutput()

template<int DisplacementDim>
static auto ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::getReflectionDataForOutput ( )
inlinestatic

Definition at line 194 of file LocalAssemblerInterface.h.

195 {
196 using Self = SmallDeformationLocalAssemblerInterface<DisplacementDim>;
197
199 &Self::current_states_, &Self::output_data_);
200 }
auto reflectWithoutName(Accessors &&... accessors)

References ProcessLib::Reflection::reflectWithoutName().

◆ setIPDataInitialConditions()

template<int DisplacementDim>
std::size_t ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::setIPDataInitialConditions ( std::string_view name,
double const * values,
int const integration_order )
inline

Returns number of read integration points.

Definition at line 73 of file LocalAssemblerInterface.h.

76 {
77 if (integration_order !=
78 static_cast<int>(integration_method_.getIntegrationOrder()))
79 {
81 "Setting integration point initial conditions; The integration "
82 "order of the local assembler for element {:d} is different "
83 "from the integration order in the initial condition.",
84 element_.getID());
85 }
86
87 if (name.starts_with("material_state_variable_"))
88 {
89 name.remove_prefix(24);
90
91 auto const& internal_variables =
92 solid_material_.getInternalVariables();
93 if (auto const iv = std::find_if(
94 begin(internal_variables), end(internal_variables),
95 [&name](auto const& iv) { return iv.name == name; });
96 iv != end(internal_variables))
97 {
98 DBUG("Setting material state variable '{:s}'", name);
99 return ProcessLib::
101 values, material_states_,
102 &MaterialStateData<
103 DisplacementDim>::material_state_variables,
104 iv->reference);
105 }
106
107 WARN(
108 "Could not find variable {:s} in solid material model's "
109 "internal variables.",
110 name);
111 return 0;
112 }
113
114 // TODO this logic could be pulled out of the local assembler into the
115 // process. That might lead to a slightly better performance due to less
116 // string comparisons.
117 return ProcessLib::Reflection::reflectSetIPData<DisplacementDim>(
118 name, values, current_states_);
119 }
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
std::size_t setIntegrationPointDataMaterialStateVariables(double const *values, IntegrationPointDataVector &ip_data_vector, MemberType member, std::function< std::span< double >(MaterialStateVariables &)> get_values_span)

References ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::current_states_, DBUG(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::element_, MeshLib::Element::getID(), NumLib::GenericIntegrationMethod::getIntegrationOrder(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::integration_method_, ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::material_states_, OGS_FATAL, ProcessLib::setIntegrationPointDataMaterialStateVariables(), ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::solid_material_, and WARN().

Member Data Documentation

◆ constitutive_setting

◆ current_states_

◆ element_

◆ integration_method_

◆ is_axially_symmetric_

◆ material_states_

◆ output_data_

◆ prev_states_

◆ process_data_

◆ solid_material_


The documentation for this struct was generated from the following file: