OGS
ProcessLib::Deformation Namespace Reference

Classes

class  CollectIntegrationPointDataForExtrapolation
class  CollectIntegrationPointDataForIpWriter
struct  InternalVariablesCollection

Functions

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 20 of file SolidMaterialInternalToSecondaryVariables.h.

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

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 18 of file GMatrix.h.

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

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

◆ forEachSolidMaterialInternalVariable()

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

Definition at line 102 of file SolidMaterialInternalToSecondaryVariables.h.

105{
106 auto internal_variables_by_name = collectInternalVariables(solid_materials);
107
108 // Multiple material ids could be present but only one material for the
109 // whole domain. In this case the choice of callbacks is independent of
110 // local assembler's material id, and the material id is 0.
111 // \see selectSolidConstitutiveRelation() for material id logic.
112 bool const material_id_independent = solid_materials.size() == 1;
113
114 // Create *single* callback passing all solid materials to it. Choose
115 // correct solid material based on the local assembler's solid material in
116 // the callback.
117 for (auto&& [name, mat_iv_collection] : internal_variables_by_name)
118 {
119 auto const num_components =
120 mat_iv_collection.front().second.num_components;
121
122 function(name,
123 InternalVariablesCollection{std::move(mat_iv_collection),
124 num_components,
125 material_id_independent});
126 }
127}
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 197 of file SolidMaterialInternalToSecondaryVariables.h.

200{
201 auto register_secondary_variable =
202 [&add_secondary_variable](
203 std::string const& name,
205 typename SolidMaterial::InternalVariable>&&
206 internal_variables_collection)
207 {
208 DBUG("Registering internal variable {:s}.", name);
209
210 add_secondary_variable(name,
211 internal_variables_collection.num_components,
213 std::move(internal_variables_collection)});
214 };
215
217 register_secondary_variable);
218}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void forEachSolidMaterialInternalVariable(std::map< int, std::shared_ptr< SolidMaterial > > const &solid_materials, auto const &function)

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 256 of file SolidMaterialInternalToSecondaryVariables.h.

263{
264 auto add_integration_point_writer =
265 [&local_assemblers, &integration_point_writer, integration_order](
266 std::string const& name,
268 typename SolidMaterial::InternalVariable>&&
269 internal_variables_collection)
270 {
271 DBUG("Creating integration point writer for internal variable {:s}.",
272 name);
273
274 integration_point_writer.emplace_back(
275 std::make_unique<MeshLib::IntegrationPointWriter>(
276 "material_state_variable_" + name + "_ip",
277 internal_variables_collection.num_components, integration_order,
278 local_assemblers,
280 std::move(internal_variables_collection)}));
281 };
282
284 add_integration_point_writer);
285}

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().