OGS
TH2M/LocalAssemblerInterface.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
15#include "TH2MProcessData.h"
16
17namespace ProcessLib
18{
19namespace TH2M
20{
21template <int DisplacementDim>
24{
26 MeshLib::Element const& e,
27 NumLib::GenericIntegrationMethod const& integration_method,
28 bool const is_axially_symmetric,
30 : process_data_(process_data),
31 integration_method_(integration_method),
32 element_(e),
33 is_axially_symmetric_(is_axially_symmetric),
34 solid_material_(MaterialLib::Solids::selectSolidConstitutiveRelation(
35 process_data_.solid_materials, process_data_.material_ids,
36 element_.getID()))
37 {
38 unsigned const n_integration_points =
39 integration_method_.getNumberOfPoints();
40
41 current_states_.resize(n_integration_points);
42 prev_states_.resize(n_integration_points);
43 output_data_.resize(n_integration_points);
44
45 material_states_.reserve(n_integration_points);
46 for (unsigned ip = 0; ip < n_integration_points; ++ip)
47 {
48 material_states_.emplace_back(
49 solid_material_.createMaterialStateVariables());
50
51 // Set initial stress field to zero. Might be overwritten by
52 // integration point data or initial stress.
53 current_states_[ip].eff_stress_data.sigma_eff =
55 }
56 }
57
58 virtual std::size_t setIPDataInitialConditions(
59 std::string_view name, double const* values,
60 int const integration_order) = 0;
61
62 // TODO move to NumLib::ExtrapolatableElement
64 {
65 return integration_method_.getNumberOfPoints();
66 }
67
68 int getMaterialID() const
69 {
70 return process_data_.material_ids == nullptr
71 ? 0
72 : (*process_data_.material_ids)[element_.getID()];
73 }
74
76 std::function<std::span<double>(
78 DisplacementDim>::MaterialStateVariables&)> const&
79 get_values_span,
80 int const& n_components) const
81 {
85 DisplacementDim>::material_state_variables,
86 get_values_span, n_components);
87 }
88
90 DisplacementDim>::MaterialStateVariables const&
91 getMaterialStateVariablesAt(unsigned integration_point) const
92 {
93 return *material_states_[integration_point].material_state_variables;
94 }
95
97 {
99
101 &Self::current_states_, &Self::output_data_);
102 }
103
105
106 std::vector<typename ConstitutiveRelations::StatefulData<DisplacementDim>>
107 current_states_; // TODO maybe do not store but rather re-evaluate for
108 // state update
109 std::vector<
112
113 // Material state is special, because it contains both the current and the
114 // old state.
115 std::vector<ConstitutiveRelations::MaterialStateData<DisplacementDim>>
117 std::vector<ConstitutiveRelations::OutputData<DisplacementDim>>
119
125};
126
127} // namespace TH2M
128} // namespace ProcessLib
KV::KelvinVectorType< DisplacementDim > KelvinVector
auto reflectWithoutName(Accessors &&... accessors)
MaterialLib::Solids::MechanicsBase< DisplacementDim > SolidConstitutiveRelation
std::vector< double > getIntegrationPointDataMaterialStateVariables(IntegrationPointDataVector const &ip_data_vector, MemberType member, std::function< std::span< double >(MaterialStateVariables &)> get_values_span, int const n_components)
NumLib::GenericIntegrationMethod const & integration_method_
LocalAssemblerInterface(MeshLib::Element const &e, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, TH2MProcessData< DisplacementDim > &process_data)
std::vector< double > getMaterialStateVariableInternalState(std::function< std::span< double >(typename ConstitutiveRelations::SolidConstitutiveRelation< DisplacementDim >::MaterialStateVariables &)> const &get_values_span, int const &n_components) const
TH2MProcessData< DisplacementDim > & process_data_
virtual std::size_t setIPDataInitialConditions(std::string_view name, double const *values, int const integration_order)=0
ConstitutiveRelations::SolidConstitutiveRelation< DisplacementDim > const & solid_material_
std::vector< typename ConstitutiveRelations::StatefulData< DisplacementDim > > current_states_
std::vector< typename ConstitutiveRelations::StatefulDataPrev< DisplacementDim > > prev_states_
ConstitutiveRelations::SolidConstitutiveRelation< DisplacementDim >::MaterialStateVariables const & getMaterialStateVariablesAt(unsigned integration_point) const
std::vector< ConstitutiveRelations::OutputData< DisplacementDim > > output_data_
std::vector< ConstitutiveRelations::MaterialStateData< DisplacementDim > > material_states_