OGS
CreateSmallDeformationNonlocalProcess.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14
16#include "ParameterLib/Utils.h"
21
22namespace ProcessLib
23{
24namespace SmallDeformationNonlocal
25{
26template <int DisplacementDim>
28 std::string const& name,
29 MeshLib::Mesh& mesh,
30 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
31 std::vector<ProcessVariable> const& variables,
32 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
33 std::optional<ParameterLib::CoordinateSystem> const&
34 local_coordinate_system,
35 unsigned const integration_order,
36 BaseLib::ConfigTree const& config)
37{
39 config.checkConfigParameter("type", "SMALL_DEFORMATION_NONLOCAL");
40 DBUG("Create SmallDeformationNonlocalProcess.");
41
43
45 auto const pv_config = config.getConfigSubtree("process_variables");
46
48 auto per_process_variables = findProcessVariables(
49 variables, pv_config,
50 {
51 "process_variable"});
52
53 DBUG("Associate displacement with process variable '{:s}'.",
54 per_process_variables.back().get().getName());
55
56 if (per_process_variables.back().get().getNumberOfGlobalComponents() !=
57 DisplacementDim)
58 {
60 "Number of components of the process variable '{:s}' is different "
61 "from the displacement dimension: got {:d}, expected {:d}",
62 per_process_variables.back().get().getName(),
63 per_process_variables.back().get().getNumberOfGlobalComponents(),
64 DisplacementDim);
65 }
66 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
67 process_variables;
68 process_variables.push_back(std::move(per_process_variables));
69
71 auto solid_constitutive_relations =
72 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
73 parameters, local_coordinate_system, config);
74
75 // Solid density
76 auto const& solid_density = ParameterLib::findParameter<double>(
77 config,
79 "solid_density", parameters, 1, &mesh);
80 DBUG("Use '{:s}' as solid density parameter.", solid_density.name);
81
82 // Specific body force
83 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
84 {
85 std::vector<double> const b =
87 config.getConfigParameter<std::vector<double>>(
88 "specific_body_force");
89 if (b.size() != DisplacementDim)
90 {
92 "The size of the specific body force vector does not match the "
93 "displacement dimension. Vector size is {:d}, displacement "
94 "dimension is {:d}",
95 b.size(), DisplacementDim);
96 }
97
98 std::copy_n(b.data(), b.size(), specific_body_force.data());
99 }
100
101 // Reference temperature
102 const auto& reference_temperature =
104 config.getConfigParameter<double>(
105 "reference_temperature", std::numeric_limits<double>::quiet_NaN());
106
107 auto const internal_length =
109 config.getConfigParameter<double>("internal_length");
110
112 materialIDs(mesh), std::move(solid_constitutive_relations),
113 solid_density, specific_body_force,
114 reference_temperature, internal_length * internal_length};
115
116 SecondaryVariableCollection secondary_variables;
117
118 ProcessLib::createSecondaryVariables(config, secondary_variables);
119
120 return std::make_unique<SmallDeformationNonlocalProcess<DisplacementDim>>(
121 std::move(name), mesh, std::move(jacobian_assembler), parameters,
122 integration_order, std::move(process_variables),
123 std::move(process_data), std::move(secondary_variables));
124}
125
126template std::unique_ptr<Process> createSmallDeformationNonlocalProcess<2>(
127 std::string const& name,
128 MeshLib::Mesh& mesh,
129 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
130 std::vector<ProcessVariable> const& variables,
131 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
132 std::optional<ParameterLib::CoordinateSystem> const&
133 local_coordinate_system,
134 unsigned const integration_order,
135 BaseLib::ConfigTree const& config);
136
137template std::unique_ptr<Process> createSmallDeformationNonlocalProcess<3>(
138 std::string const& 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
148} // namespace SmallDeformationNonlocal
149} // 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.
template std::unique_ptr< Process > createSmallDeformationNonlocalProcess< 2 >(std::string const &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::unique_ptr< Process > createSmallDeformationNonlocalProcess(std::string const &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)
template std::unique_ptr< Process > createSmallDeformationNonlocalProcess< 3 >(std::string const &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::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)