OGS
CreateEhlers.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "Ehlers.h"
15#include "ParameterLib/Utils.h"
16
17namespace MaterialLib
18{
19namespace Solids
20{
21namespace Ehlers
22{
23inline std::unique_ptr<DamagePropertiesParameters> createDamageProperties(
24 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
25 BaseLib::ConfigTree const& config)
26{
28 auto& alpha_d =
29 ParameterLib::findParameter<double>(config, "alpha_d", parameters, 1);
30
31 DBUG("Use '{:s}' as alpha_d.", alpha_d.name);
32
34 auto& beta_d =
35 ParameterLib::findParameter<double>(config, "beta_d", parameters, 1);
36
37 DBUG("Use '{:s}' as beta_d.", beta_d.name);
38
40 auto& h_d =
41 ParameterLib::findParameter<double>(config, "h_d", parameters, 1);
42
43 DBUG("Use '{:s}' as h_d.", h_d.name);
44
45 return std::make_unique<DamagePropertiesParameters>(
46 DamagePropertiesParameters{alpha_d, beta_d, h_d});
47}
48
49template <int DisplacementDim>
50std::unique_ptr<SolidEhlers<DisplacementDim>> createEhlers(
51 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
52 BaseLib::ConfigTree const& config)
53{
55 config.checkConfigParameter("type", "Ehlers");
56 DBUG("Create Ehlers material");
57
59 auto& shear_modulus = ParameterLib::findParameter<double>(
60 config, "shear_modulus", parameters, 1);
61
62 DBUG("Use '{:s}' as shear modulus parameter.", shear_modulus.name);
63
65 auto& bulk_modulus = ParameterLib::findParameter<double>(
66 config, "bulk_modulus", parameters, 1);
67
68 DBUG("Use '{:s}' as bulk modulus parameter.", bulk_modulus.name);
69
71 auto& kappa =
72 ParameterLib::findParameter<double>(config, "kappa", parameters, 1);
73
74 DBUG("Use '{:s}' as kappa.", kappa.name);
75
77 auto& beta =
78 ParameterLib::findParameter<double>(config, "beta", parameters, 1);
79
80 DBUG("Use '{:s}' as beta.", beta.name);
81
83 auto& gamma =
84 ParameterLib::findParameter<double>(config, "gamma", parameters, 1);
85
86 DBUG("Use '{:s}' as gamma.", gamma.name);
87
89 auto& hardening_modulus = ParameterLib::findParameter<double>(
90 config, "hardening_modulus", parameters, 1);
91
92 DBUG("Use '{:s}' as hardening modulus parameter.", hardening_modulus.name);
93
95 auto& alpha =
96 ParameterLib::findParameter<double>(config, "alpha", parameters, 1);
97
98 DBUG("Use '{:s}' as alpha.", alpha.name);
99
101 auto& delta =
102 ParameterLib::findParameter<double>(config, "delta", parameters, 1);
103
104 DBUG("Use '{:s}' as delta.", delta.name);
105
107 auto& eps =
108 ParameterLib::findParameter<double>(config, "eps", parameters, 1);
109
110 DBUG("Use '{:s}' as eps.", eps.name);
111
113 auto& m = ParameterLib::findParameter<double>(config, "m", parameters, 1);
114
115 DBUG("Use '{:s}' as m.", m.name);
116
118 auto& alphap =
119 ParameterLib::findParameter<double>(config, "alphap", parameters, 1);
120
121 DBUG("Use '{:s}' as alphap.", alphap.name);
122
124 auto& deltap =
125 ParameterLib::findParameter<double>(config, "deltap", parameters, 1);
126
127 DBUG("Use '{:s}' as deltap.", deltap.name);
128
130 auto& epsp =
131 ParameterLib::findParameter<double>(config, "epsp", parameters, 1);
132
133 DBUG("Use '{:s}' as epsp.", epsp.name);
134
136 auto& paremeter_mp =
137 ParameterLib::findParameter<double>(config, "mp", parameters, 1);
138
139 DBUG("Use '{:s}' as mp.", paremeter_mp.name);
140
142 auto& betap =
143 ParameterLib::findParameter<double>(config, "betap", parameters, 1);
144
145 DBUG("Use '{:s}' as betap.", betap.name);
146
148 auto& gammap =
149 ParameterLib::findParameter<double>(config, "gammap", parameters, 1);
150
151 DBUG("Use '{:s}' as gammap.", gammap.name);
152
153 auto tangent_type =
155 makeTangentType(config.getConfigParameter<std::string>("tangent_type"));
156
158 shear_modulus, bulk_modulus, alpha, beta,
159 gamma, delta, eps, m,
160 alphap, betap, gammap, deltap,
161 epsp, paremeter_mp, kappa, hardening_modulus};
162
163 // Damage properties.
164 std::unique_ptr<DamagePropertiesParameters> ehlers_damage_properties;
165
166 auto const& ehlers_damage_config =
168 config.getConfigSubtreeOptional("damage_properties");
169 if (ehlers_damage_config)
170 {
171 ehlers_damage_properties =
172 createDamageProperties(parameters, *ehlers_damage_config);
173 }
174
175 auto const& nonlinear_solver_config =
177 config.getConfigSubtree("nonlinear_solver");
178 auto const nonlinear_solver_parameters =
179 NumLib::createNewtonRaphsonSolverParameters(nonlinear_solver_config);
180
181 return std::make_unique<SolidEhlers<DisplacementDim>>(
182 nonlinear_solver_parameters,
183 mp,
184 std::move(ehlers_damage_properties),
185 tangent_type);
186}
187
188} // namespace Ehlers
189} // namespace Solids
190} // namespace MaterialLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
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
std::unique_ptr< DamagePropertiesParameters > createDamageProperties(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, BaseLib::ConfigTree const &config)
std::unique_ptr< SolidEhlers< DisplacementDim > > createEhlers(std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, BaseLib::ConfigTree const &config)
TangentType makeTangentType(std::string const &s)
Definition Ehlers.h:43
NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const &config)