OGS
CreateLargeDeformationProcess.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14
19#include "ParameterLib/Utils.h"
22
23namespace ProcessLib
24{
25namespace LargeDeformation
26{
27template <int DisplacementDim>
28std::unique_ptr<Process> createLargeDeformationProcess(
29 std::string name,
30 MeshLib::Mesh& mesh,
31 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
32 std::vector<ProcessVariable> const& variables,
33 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
34 std::optional<ParameterLib::CoordinateSystem> const&
35 local_coordinate_system,
36 unsigned const integration_order,
37 BaseLib::ConfigTree const& config,
38 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
39{
41 config.checkConfigParameter("type", "LARGE_DEFORMATION");
42 DBUG("Create LargeDeformationProcess.");
43
45
47 auto const pv_config = config.getConfigSubtree("process_variables");
48
50 auto per_process_variables = findProcessVariables(
51 variables, pv_config,
52 {
53 "process_variable"});
54
55 DBUG("Associate displacement with process variable '{:s}'.",
56 per_process_variables.back().get().getName());
57
58 if (per_process_variables.back().get().getNumberOfGlobalComponents() !=
59 DisplacementDim)
60 {
62 "Number of components of the process variable '{:s}' is different "
63 "from the displacement dimension: got {:d}, expected {:d}",
64 per_process_variables.back().get().getName(),
65 per_process_variables.back().get().getNumberOfGlobalComponents(),
66 DisplacementDim);
67 }
68 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
69 process_variables;
70 process_variables.push_back(std::move(per_process_variables));
71
73 auto solid_constitutive_relations =
76 parameters, local_coordinate_system, materialIDs(mesh), config);
77
78 // Specific body force
79 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
80 {
81 std::vector<double> const b =
83 config.getConfigParameter<std::vector<double>>(
84 "specific_body_force");
85 if (b.size() != DisplacementDim)
86 {
88 "The size of the specific body force vector does not match the "
89 "displacement dimension. Vector size is {:d}, displacement "
90 "dimension is {:d}",
91 b.size(), DisplacementDim);
92 }
93
94 std::copy_n(b.data(), b.size(), specific_body_force.data());
95 }
96
97 auto media_map =
99
100 // Reference temperature
101 auto const reference_temperature = ParameterLib::findOptionalTagParameter<
102 double>(
104 config, "reference_temperature", parameters, 1, &mesh);
105 if (reference_temperature)
106 {
107 DBUG("Use '{:s}' as reference temperature parameter.",
108 (*reference_temperature).name);
109 }
110
111 // Initial stress conditions
112 auto const initial_stress = ParameterLib::findOptionalTagParameter<double>(
114 config, "initial_stress", parameters,
115 // Symmetric tensor size, 4 or 6, not a Kelvin vector.
117 &mesh);
118
120 materialIDs(mesh),
121 std::move(media_map),
122 std::move(solid_constitutive_relations),
123 initial_stress,
124 specific_body_force,
125 reference_temperature};
126
127 SecondaryVariableCollection secondary_variables;
128
129 ProcessLib::createSecondaryVariables(config, secondary_variables);
130
131 return std::make_unique<LargeDeformationProcess<DisplacementDim>>(
132 std::move(name), mesh, std::move(jacobian_assembler), parameters,
133 integration_order, std::move(process_variables),
134 std::move(process_data), std::move(secondary_variables));
135}
136
137template std::unique_ptr<Process> createLargeDeformationProcess<2>(
138 std::string name,
139 MeshLib::Mesh& mesh,
140 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
141 std::vector<ProcessVariable> const& variables,
142 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
143 std::optional<ParameterLib::CoordinateSystem> const&
144 local_coordinate_system,
145 unsigned const integration_order,
146 BaseLib::ConfigTree const& config,
147 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
148
149template std::unique_ptr<Process> createLargeDeformationProcess<3>(
150 std::string name,
151 MeshLib::Mesh& mesh,
152 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
153 std::vector<ProcessVariable> const& variables,
154 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
155 std::optional<ParameterLib::CoordinateSystem> const&
156 local_coordinate_system,
157 unsigned const integration_order,
158 BaseLib::ConfigTree const& config,
159 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
160
161} // namespace LargeDeformation
162} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
Handles configuration of several secondary variables from the project file.
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Parameter< ParameterDataType > * findOptionalTagParameter(BaseLib::ConfigTree const &process_config, std::string const &tag, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
Definition Utils.h:166
template std::unique_ptr< Process > createLargeDeformationProcess< 2 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::unique_ptr< Process > createLargeDeformationProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template std::unique_ptr< Process > createLargeDeformationProcess< 3 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
static std::map< int, std::shared_ptr< SolidConstitutiveRelation< DisplacementDim > > > createSolidConstitutiveRelations(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, MeshLib::PropertyVector< int > const *const material_ids, BaseLib::ConfigTree const &config)