OGS 6.1.0-1699-ge946d4c5f
CreateSmallDeformationProcess.cpp
Go to the documentation of this file.
1 
11 
12 #include <cassert>
13 
17 
20 
21 namespace ProcessLib
22 {
23 namespace SmallDeformation
24 {
25 
26 template <int DisplacementDim>
27 std::unique_ptr<Process>
29  MeshLib::Mesh& mesh,
30  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
31  std::vector<ProcessVariable> const& variables,
32  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
33  unsigned const integration_order,
34  BaseLib::ConfigTree const& config)
35 {
37  config.checkConfigParameter("type", "SMALL_DEFORMATION");
38  DBUG("Create SmallDeformationProcess.");
39 
40  // Process variable.
41 
43  auto const pv_config = config.getConfigSubtree("process_variables");
44 
45  auto per_process_variables = findProcessVariables(
46  variables, pv_config,
47  {
48  "process_variable"});
49 
50  DBUG("Associate displacement with process variable '%s'.",
51  per_process_variables.back().get().getName().c_str());
52 
53  if (per_process_variables.back().get().getNumberOfComponents() !=
54  DisplacementDim)
55  {
56  OGS_FATAL(
57  "Number of components of the process variable '%s' is different "
58  "from the displacement dimension: got %d, expected %d",
59  per_process_variables.back().get().getName().c_str(),
60  per_process_variables.back().get().getNumberOfComponents(),
61  DisplacementDim);
62  }
63  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
64  process_variables;
65  process_variables.push_back(std::move(per_process_variables));
66 
67  auto solid_constitutive_relations =
68  MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
69  parameters, config);
70 
71  // Solid density
72  auto& solid_density = findParameter<double>(
73  config,
75  "solid_density", parameters, 1);
76  DBUG("Use '%s' as solid density parameter.", solid_density.name.c_str());
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  OGS_FATAL(
87  "The size of the specific body force vector does not match the "
88  "displacement dimension. Vector size is %d, displacement "
89  "dimension is %d",
90  b.size(), DisplacementDim);
91 
92  std::copy_n(b.data(), b.size(), specific_body_force.data());
93  }
94 
95  // Reference temperature
96  const auto& reference_temperature =
98  config.getConfigParameter<double>(
99  "reference_temperature", std::numeric_limits<double>::quiet_NaN());
100 
102  materialIDs(mesh), std::move(solid_constitutive_relations),
103  solid_density, specific_body_force, reference_temperature};
104 
105  SecondaryVariableCollection secondary_variables;
106 
107  NumLib::NamedFunctionCaller named_function_caller(
108  {"SmallDeformation_displacement"});
109 
110  ProcessLib::createSecondaryVariables(config, secondary_variables,
111  named_function_caller);
112 
113  return std::make_unique<SmallDeformationProcess<DisplacementDim>>(
114  mesh, std::move(jacobian_assembler), parameters, integration_order,
115  std::move(process_variables), std::move(process_data),
116  std::move(secondary_variables), std::move(named_function_caller));
117 }
118 
119 template std::unique_ptr<Process> createSmallDeformationProcess<2>(
120  MeshLib::Mesh& mesh,
121  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
122  std::vector<ProcessVariable> const& variables,
123  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
124  unsigned const integration_order,
125  BaseLib::ConfigTree const& config);
126 
127 template std::unique_ptr<Process> createSmallDeformationProcess<3>(
128  MeshLib::Mesh& mesh,
129  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
130  std::vector<ProcessVariable> const& variables,
131  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
132  unsigned const integration_order,
133  BaseLib::ConfigTree const& config);
134 
135 } // namespace SmallDeformation
136 } // namespace ProcessLib
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables, NumLib::NamedFunctionCaller &named_function_caller)
std::unique_ptr< Process > createSmallDeformationProcess(MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config)
template std::unique_ptr< Process > createSmallDeformationProcess< 2 >(MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
Builds expression trees of named functions dynamically at runtime.
void checkConfigParameter(std::string const &param, T const &value) const
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:342
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:146
Handles configuration of several secondary variables from the project file.
template std::unique_ptr< Process > createSmallDeformationProcess< 3 >(MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config)
#define OGS_FATAL(fmt,...)
Definition: Error.h:71