OGS 6.1.0-1699-ge946d4c5f
CreateSmallDeformationNonlocalProcess.cpp
Go to the documentation of this file.
1 
13 
14 #include <cassert>
15 
19 
22 
23 namespace ProcessLib
24 {
25 namespace SmallDeformationNonlocal
26 {
27 template <int DisplacementDim>
28 std::unique_ptr<Process> createSmallDeformationNonlocalProcess(
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_NONLOCAL");
38  DBUG("Create SmallDeformationNonlocalProcess.");
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 
101  auto const internal_length =
103  config.getConfigParameter<double>("internal_length");
104 
106  materialIDs(mesh), std::move(solid_constitutive_relations),
107  solid_density, specific_body_force,
108  reference_temperature, internal_length};
109 
110  SecondaryVariableCollection secondary_variables;
111 
112  NumLib::NamedFunctionCaller named_function_caller(
113  {"SmallDeformationNonlocal_displacement"});
114 
115  ProcessLib::createSecondaryVariables(config, secondary_variables,
116  named_function_caller);
117 
118  return std::make_unique<SmallDeformationNonlocalProcess<DisplacementDim>>(
119  mesh, std::move(jacobian_assembler), parameters, integration_order,
120  std::move(process_variables), std::move(process_data),
121  std::move(secondary_variables), std::move(named_function_caller));
122 }
123 
124 template std::unique_ptr<Process> createSmallDeformationNonlocalProcess<2>(
125  MeshLib::Mesh& mesh,
126  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
127  std::vector<ProcessVariable> const& variables,
128  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
129  unsigned const integration_order,
130  BaseLib::ConfigTree const& config);
131 
132 template std::unique_ptr<Process> createSmallDeformationNonlocalProcess<3>(
133  MeshLib::Mesh& mesh,
134  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
135  std::vector<ProcessVariable> const& variables,
136  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
137  unsigned const integration_order,
138  BaseLib::ConfigTree const& config);
139 
140 } // namespace SmallDeformationNonlocal
141 } // namespace ProcessLib
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables, NumLib::NamedFunctionCaller &named_function_caller)
template std::unique_ptr< Process > createSmallDeformationNonlocalProcess< 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)
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
template std::unique_ptr< Process > createSmallDeformationNonlocalProcess< 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)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:342
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:146
std::unique_ptr< Process > createSmallDeformationNonlocalProcess(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)
Handles configuration of several secondary variables from the project file.
#define OGS_FATAL(fmt,...)
Definition: Error.h:71