OGS
ProcessLib::Deformation Namespace Reference

Classes

class  CollectIntegrationPointDataForExtrapolation
 
class  CollectIntegrationPointDataForIpWriter
 
struct  InternalVariablesCollection
 

Functions

template<int DisplacementDim, int NPOINTS, typename DNDX_Type >
double divergence (const Eigen::Ref< Eigen::Matrix< double, NPOINTS *DisplacementDim, 1 > const > &u, DNDX_Type const &dNdx)
 Divergence of displacement, the volumetric strain.
 
template<int DisplacementDim, int NPOINTS, typename N_Type , typename DNDX_Type , typename GMatrixType >
void computeGMatrix (DNDX_Type const &dNdx, GMatrixType &g_matrix, const bool is_axially_symmetric, N_Type const &N, const double radius)
 Fills a G-matrix based on given shape function dN/dx values.
 
template<typename SolidMaterial >
std::map< std::string, std::vector< std::pair< int, typename SolidMaterial::InternalVariable > > > collectInternalVariables (std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials)
 
template<typename Pair >
 InternalVariablesCollection (std::vector< Pair > &&, int, bool) -> InternalVariablesCollection< typename Pair::second_type >
 
template<typename SolidMaterial >
void forEachSolidMaterialInternalVariable (std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials, auto const &function)
 
template<typename LocalAssemblerInterface , typename SolidMaterial , typename AddSecondaryVariableCallback >
void solidMaterialInternalToSecondaryVariables (std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials, AddSecondaryVariableCallback const &add_secondary_variable)
 
template<typename LocalAssemblerInterface , typename SolidMaterial >
void solidMaterialInternalVariablesToIntegrationPointWriter (std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials, std::vector< std::unique_ptr< LocalAssemblerInterface > > const &local_assemblers, std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > &integration_point_writer, int const integration_order)
 

Function Documentation

◆ collectInternalVariables()

template<typename SolidMaterial >
std::map< std::string, std::vector< std::pair< int, typename SolidMaterial::InternalVariable > > > ProcessLib::Deformation::collectInternalVariables ( std::map< int, std::shared_ptr< SolidMaterial > > const & solid_materials)

Definition at line 27 of file SolidMaterialInternalToSecondaryVariables.h.

29{
30 assert(!solid_materials.empty());
31
32 // For each name of an internal variable collect all solid material/
33 // internal variable pairs.
34 std::map<
35 std::string,
36 std::vector<std::pair<int, typename SolidMaterial::InternalVariable>>>
37 internal_variables_by_name;
38 for (auto const& [material_id, solid_material] : solid_materials)
39 {
40 auto const& internal_variables = solid_material->getInternalVariables();
41 for (auto const& iv : internal_variables)
42 {
43 internal_variables_by_name[iv.name].push_back({material_id, iv});
44 }
45 }
46
47 // Check for each internal variable name, that the number of components is
48 // equal for all materials.
49 for (auto const& [name, mat_iv_collection] : internal_variables_by_name)
50 {
51 if (mat_iv_collection.empty())
52 {
53 continue;
54 }
55 auto const num_components =
56 mat_iv_collection.front().second.num_components;
57
58 if (!std::all_of(
59 begin(mat_iv_collection), end(mat_iv_collection),
60 [num_components](auto const& mat_iv)
61 { return mat_iv.second.num_components == num_components; }))
62 {
64 "Not for all material ids the secondary variable '{:s}' has "
65 "{:d} components.",
66 name, num_components);
67 }
68 }
69
70 return internal_variables_by_name;
71}
#define OGS_FATAL(...)
Definition Error.h:26

References OGS_FATAL.

Referenced by forEachSolidMaterialInternalVariable().

◆ computeGMatrix()

template<int DisplacementDim, int NPOINTS, typename N_Type , typename DNDX_Type , typename GMatrixType >
void ProcessLib::Deformation::computeGMatrix ( DNDX_Type const & dNdx,
GMatrixType & g_matrix,
const bool is_axially_symmetric,
N_Type const & N,
const double radius )

Fills a G-matrix based on given shape function dN/dx values.

Definition at line 25 of file GMatrix.h.

30{
31 static_assert(0 < DisplacementDim && DisplacementDim <= 3,
32 "LinearGMatrix::computeGMatrix: DisplacementDim must be in "
33 "range [1,3].");
34
35 g_matrix.setZero();
36
37 switch (DisplacementDim)
38 {
39 case 3:
40 // The gradient coordinates are organized in the following order:
41 // (1,1), (1,2), (1,3)
42 // (2,1), (2,2), (2,3)
43 // (3,1), (3,2), (3,3)
44 for (int i = 0; i < NPOINTS; ++i)
45 {
46 auto G_col0 = g_matrix.col(i);
47 auto G_col1 = g_matrix.col(i + NPOINTS);
48 auto G_col2 = g_matrix.col(i + 2 * NPOINTS);
49 auto const dNidx = dNdx.col(i);
50
51 G_col0.template segment<DisplacementDim>(0).noalias() = dNidx;
52 G_col1.template segment<DisplacementDim>(DisplacementDim)
53 .noalias() = dNidx;
54 G_col2.template segment<DisplacementDim>(2 * DisplacementDim)
55 .noalias() = dNidx;
56 }
57
58 break;
59 case 2:
60 // The gradient coordinates are organized in the following order:
61 // (1,1), (1,2)
62 // (2,1), (2,2)
63 // (3,3)
64 for (int i = 0; i < NPOINTS; ++i)
65 {
66 auto G_col0 = g_matrix.col(i);
67 auto G_col1 = g_matrix.col(i + NPOINTS);
68 auto const dNidx = dNdx.col(i);
69
70 G_col0.template segment<DisplacementDim>(0).noalias() = dNidx;
71 G_col1.template segment<DisplacementDim>(DisplacementDim)
72 .noalias() = dNidx;
73
74 if (is_axially_symmetric)
75 {
76 G_col0[4] = N[i] / radius;
77 }
78 }
79 break;
80 default:
81 break;
82 }
83}

Referenced by ProcessLib::LargeDeformation::LargeDeformationLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::SmallDeformation::getMaterialForces(), and ProcessLib::LargeDeformation::LargeDeformationLocalAssembler< ShapeFunction, DisplacementDim >::postTimestepConcrete().

◆ divergence()

template<int DisplacementDim, int NPOINTS, typename DNDX_Type >
double ProcessLib::Deformation::divergence ( const Eigen::Ref< Eigen::Matrix< double, NPOINTS *DisplacementDim, 1 > const > & u,
DNDX_Type const & dNdx )

Divergence of displacement, the volumetric strain.

Definition at line 19 of file Divergence.h.

23{
24 double divergence = 0;
25 for (int i = 0; i < DisplacementDim; ++i)
26 {
27 divergence += dNdx.template block<1, NPOINTS>(i, 0) *
28 u.template segment<NPOINTS>(i * NPOINTS);
29 }
30 return divergence;
31}
double divergence(const Eigen::Ref< Eigen::Matrix< double, NPOINTS *DisplacementDim, 1 > const > &u, DNDX_Type const &dNdx)
Divergence of displacement, the volumetric strain.
Definition Divergence.h:19

References divergence().

Referenced by ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::computeCrackIntegral(), and divergence().

◆ forEachSolidMaterialInternalVariable()

template<typename SolidMaterial >
void ProcessLib::Deformation::forEachSolidMaterialInternalVariable ( std::map< int, std::shared_ptr< SolidMaterial > > const & solid_materials,
auto const & function )

Definition at line 109 of file SolidMaterialInternalToSecondaryVariables.h.

112{
113 auto internal_variables_by_name = collectInternalVariables(solid_materials);
114
115 // Multiple material ids could be present but only one material for the
116 // whole domain. In this case the choice of callbacks is independent of
117 // local assembler's material id, and the material id is 0.
118 // \see selectSolidConstitutiveRelation() for material id logic.
119 bool const material_id_independent = solid_materials.size() == 1;
120
121 // Create *single* callback passing all solid materials to it. Choose
122 // correct solid material based on the local assembler's solid material in
123 // the callback.
124 for (auto&& [name, mat_iv_collection] : internal_variables_by_name)
125 {
126 auto const num_components =
127 mat_iv_collection.front().second.num_components;
128
129 function(name,
130 InternalVariablesCollection{std::move(mat_iv_collection),
131 num_components,
132 material_id_independent});
133 }
134}
std::map< std::string, std::vector< std::pair< int, typename SolidMaterial::InternalVariable > > > collectInternalVariables(std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials)

References collectInternalVariables().

Referenced by solidMaterialInternalToSecondaryVariables(), and solidMaterialInternalVariablesToIntegrationPointWriter().

◆ InternalVariablesCollection()

template<typename Pair >
ProcessLib::Deformation::InternalVariablesCollection ( std::vector< Pair > && ,
int ,
bool  ) -> InternalVariablesCollection< typename Pair::second_type >

◆ solidMaterialInternalToSecondaryVariables()

template<typename LocalAssemblerInterface , typename SolidMaterial , typename AddSecondaryVariableCallback >
void ProcessLib::Deformation::solidMaterialInternalToSecondaryVariables ( std::map< int, std::shared_ptr< SolidMaterial > > const & solid_materials,
AddSecondaryVariableCallback const & add_secondary_variable )

Definition at line 204 of file SolidMaterialInternalToSecondaryVariables.h.

207{
208 auto register_secondary_variable =
209 [&add_secondary_variable](
210 std::string const& name,
212 typename SolidMaterial::InternalVariable>&&
213 internal_variables_collection)
214 {
215 DBUG("Registering internal variable {:s}.", name);
216
217 add_secondary_variable(name,
218 internal_variables_collection.num_components,
220 std::move(internal_variables_collection)});
221 };
222
223 forEachSolidMaterialInternalVariable(solid_materials,
224 register_secondary_variable);
225}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30

References DBUG(), and forEachSolidMaterialInternalVariable().

Referenced by ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess().

◆ solidMaterialInternalVariablesToIntegrationPointWriter()

template<typename LocalAssemblerInterface , typename SolidMaterial >
void ProcessLib::Deformation::solidMaterialInternalVariablesToIntegrationPointWriter ( std::map< int, std::shared_ptr< SolidMaterial > > const & solid_materials,
std::vector< std::unique_ptr< LocalAssemblerInterface > > const & local_assemblers,
std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > & integration_point_writer,
int const integration_order )

Definition at line 263 of file SolidMaterialInternalToSecondaryVariables.h.

270{
271 auto add_integration_point_writer =
272 [&local_assemblers, &integration_point_writer, integration_order](
273 std::string const& name,
275 typename SolidMaterial::InternalVariable>&&
276 internal_variables_collection)
277 {
278 DBUG("Creating integration point writer for internal variable {:s}.",
279 name);
280
281 integration_point_writer.emplace_back(
282 std::make_unique<MeshLib::IntegrationPointWriter>(
283 "material_state_variable_" + name + "_ip",
284 internal_variables_collection.num_components, integration_order,
285 local_assemblers,
287 std::move(internal_variables_collection)}));
288 };
289
290 forEachSolidMaterialInternalVariable(solid_materials,
291 add_integration_point_writer);
292}

References DBUG(), and forEachSolidMaterialInternalVariable().

Referenced by ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess().