11#include <dune/common/float_cmp.hh>
66 std::is_same_v<MP, YoungsModulusAndPoissonsRatio> or std::is_same_v<MP, YoungsModulusAndBulkModulus> or
67 std::is_same_v<MP, YoungsModulusAndLamesFirstParameter> or std::is_same_v<MP, BulkModulusAndLamesFirstParameter> or
68 std::is_same_v<MP, LamesFirstParameterAndShearModulus> or std::is_same_v<MP, YoungsModulusAndShearModulus>;
75template <
typename ValuePair>
79 requires(!std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter> and
80 !std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter> and
81 !std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>)
83 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
84 const auto& E = vp_.emodul;
85 const auto& nu = vp_.nu;
86 return Dune::FloatCmp::eq(nu, 0.5) ? std::numeric_limits<double>::infinity()
87 : E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
88 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
89 const auto& E = vp_.emodul;
90 const auto& mu = vp_.mu;
91 return mu * (E - 2.0 * mu) / (3.0 * mu - E);
92 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
93 const auto& E = vp_.emodul;
94 const auto& K = vp_.K;
95 return 3.0 * K * (3.0 * K - E) / (9.0 * K - E);
97 assert(
false &&
"Your LameParameter request is not implemented");
101 requires(!std::is_same_v<ValuePair, YoungsModulusAndBulkModulus> and
102 !std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>)
104 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
105 const auto& E = vp_.emodul;
106 const auto& nu = vp_.nu;
107 return E / (3.0 * (1.0 - 2.0 * nu));
108 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
109 const auto& E = vp_.emodul;
110 const auto& mu = vp_.mu;
111 return E * mu / (3.0 * (3.0 * mu - E));
112 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
113 const auto& E = vp_.emodul;
114 const auto& lambda = vp_.lambda;
115 return (E + 3.0 * lambda + calcR(vp_)) / 6.0;
116 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
117 const auto& lambda = vp_.lambda;
118 const auto& mu = vp_.mu;
119 return lambda + 2.0 * mu / 3.0;
121 assert(
false &&
"Your LameParameter request is not implemented");
125 requires(!std::is_same_v<ValuePair, YoungsModulusAndShearModulus> and
126 !std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>)
128 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
129 const auto& E = vp_.emodul;
130 const auto& nu = vp_.nu;
131 return E / (2.0 * (1.0 + nu));
132 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
133 const auto& E = vp_.emodul;
134 const auto& K = vp_.K;
135 return 3.0 * K * E / (9.0 * K - E);
136 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
137 const auto& E = vp_.emodul;
138 const auto& lambda = vp_.lambda;
139 return (E - 3.0 * lambda + calcR(vp_)) / 4.0;
140 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
141 const auto& K = vp_.K;
142 const auto& lambda = vp_.lambda;
143 return 3.0 * (K - lambda) / 2.0;
145 assert(
false &&
"Your LameParameter request is not implemented");
149 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
150 const auto& E = vp_.emodul;
151 const auto& nu = vp_.nu;
152 return E * (1.0 - nu) / ((1.0 + nu) * (1.0 - 2.0 * nu));
153 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
154 const auto& E = vp_.emodul;
155 const auto& mu = vp_.mu;
156 return mu * (4.0 * mu - E) / (3.0 * mu - E);
157 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
158 const auto& E = vp_.emodul;
159 const auto& K = vp_.K;
160 return 3.0 * K * (3.0 * K + E) / (9.0 * K - E);
161 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
162 const auto& E = vp_.emodul;
163 const auto& lambda = vp_.lambda;
164 return (E - lambda + calcR(vp_)) / 2.0;
165 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
166 const auto& K = vp_.K;
167 const auto& lambda = vp_.lambda;
168 return 3.0 * K - 2.0 * lambda;
169 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
170 const auto& lambda = vp_.lambda;
171 const auto& mu = vp_.mu;
172 return lambda + 2.0 * mu;
174 assert(
false &&
"Your LameParameter request is not implemented");
178 requires(!std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>)
180 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
181 const auto& E = vp_.emodul;
182 const auto& mu = vp_.mu;
183 return E / (2.0 * mu) - 1.0;
184 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
185 const auto& E = vp_.emodul;
186 const auto& K = vp_.K;
187 return (3.0 * K - E) / (6.0 * K);
188 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
189 const auto& E = vp_.emodul;
190 const auto& lambda = vp_.lambda;
191 return 2.0 * lambda / (E + lambda + calcR(vp_));
192 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
193 const auto& K = vp_.K;
194 const auto& lambda = vp_.lambda;
195 return lambda / (3 * K - lambda);
196 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
197 const auto& lambda = vp_.lambda;
198 const auto& mu = vp_.mu;
199 return lambda / (2.0 * (lambda + mu));
201 assert(
false &&
"Your LameParameter request is not implemented");
205 requires(!std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio> and
206 !std::is_same_v<ValuePair, YoungsModulusAndShearModulus> and
207 !std::is_same_v<ValuePair, YoungsModulusAndBulkModulus> and
208 !std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>)
210 if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
211 return 9.0 * vp_.K * (vp_.K - vp_.lambda) / (3.0 * vp_.K - vp_.lambda);
212 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
213 const auto& lambda = vp_.lambda;
214 const auto& mu = vp_.mu;
215 return mu * (3.0 * lambda + 2.0 * mu) / (lambda + mu);
217 assert(
false &&
"Your LameParameter request is not implemented");
240 ConvertLameConstants(
const ValuePair& valuePair)
243 double calcR(
const YoungsModulusAndLamesFirstParameter& valuePair) {
244 const auto& E = valuePair.emodul;
245 const auto& lambda = valuePair.lambda;
246 return std::sqrt(E * E + 9 * lambda * lambda + 2 * E * lambda);
Definition: assemblermanipulatorbuildingblocks.hh:22
auto toLamesFirstParameterAndShearModulus(const YoungsModulusAndPoissonsRatio &matParameter)
Converts Young's modulus and Poisson's ratio to Lame's first parameter and shear modulus.
Definition: physicshelper.hh:281
auto toYoungsModulusAndPoissonsRatio(const LamesFirstParameterAndShearModulus &matParameter)
Converts Lame's first parameter and shear modulus to Young's modulus and Poisson's ratio.
Definition: physicshelper.hh:294
ConvertLameConstants< YoungsModulusAndPoissonsRatio > convertLameConstants(const YoungsModulusAndPoissonsRatio &valuePair)
Definition: physicshelper.hh:250
see https://en.wikipedia.org/wiki/Lam%C3%A9_parameters Structure representing Young's modulus and she...
Definition: physicshelper.hh:19
double emodul
Definition: physicshelper.hh:20
double nu
Definition: physicshelper.hh:21
Structure representing Young's modulus and bulk modulus.
Definition: physicshelper.hh:26
double mu
Definition: physicshelper.hh:28
double emodul
Definition: physicshelper.hh:27
Structure representing Young's modulus and Lame's first parameter.
Definition: physicshelper.hh:33
double emodul
Definition: physicshelper.hh:34
double K
Definition: physicshelper.hh:35
Structure representing bulk modulus and Lame's first parameter.
Definition: physicshelper.hh:40
double lambda
Definition: physicshelper.hh:42
double emodul
Definition: physicshelper.hh:41
Structure representing Lame's first parameter and shear modulus.
Definition: physicshelper.hh:47
double K
Definition: physicshelper.hh:48
double lambda
Definition: physicshelper.hh:49
Definition: physicshelper.hh:54
double lambda
Definition: physicshelper.hh:55
double mu
Definition: physicshelper.hh:56
Conversion utility for Lame's constants.
Definition: physicshelper.hh:77
constexpr double toYoungsModulus()
Definition: physicshelper.hh:204
constexpr double toBulkModulus()
Definition: physicshelper.hh:100
constexpr double toPoissonsRatio()
Definition: physicshelper.hh:177
friend ConvertLameConstants< YoungsModulusAndPoissonsRatio > convertLameConstants(const YoungsModulusAndPoissonsRatio &valuePair)
Definition: physicshelper.hh:250
constexpr double toLamesFirstParameter()
Definition: physicshelper.hh:78
constexpr double toPWaveModulus()
Definition: physicshelper.hh:148
constexpr double toShearModulus()
Definition: physicshelper.hh:124
Concept for checking if a type is a valid material parameter tuple.
Definition: physicshelper.hh:65