Directory: | ./ |
---|---|
File: | HyperelasticityLaws/stVenantKirchhoff.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 53 | 57 | 93.0% |
Branches: | 4 | 16 | 25.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: S. Gilles | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | #include <string> | ||
17 | #include <limits> | ||
18 | |||
19 | // External includes | ||
20 | |||
21 | // Project includes | ||
22 | #include "Core/felisceTools.hpp" | ||
23 | #include "Core/felisceParam.hpp" | ||
24 | #include "HyperelasticityLaws/stVenantKirchhoff.hpp" | ||
25 | |||
26 | namespace felisce | ||
27 | { | ||
28 | 574 | StVenantKirchhoff::StVenantKirchhoff() | |
29 | : BaseClassType(), | ||
30 | 574 | m_lame_lambda(1.e20), // silly value on purpose | |
31 | 574 | m_lame_mu(1.e20) | |
32 | { | ||
33 | 574 | } | |
34 | |||
35 | /***********************************************************************************/ | ||
36 | /***********************************************************************************/ | ||
37 | |||
38 | 38 | void StVenantKirchhoff::InitParameters() | |
39 | { | ||
40 | // Call base class | ||
41 | 38 | BaseClassType::InitParameters(); | |
42 | |||
43 | 38 | const double poisson_ratio = FelisceParam::instance().poisson; | |
44 | 38 | const double young_modulus = FelisceParam::instance().young; | |
45 | |||
46 | // Check the values were correctly initialized in the input file | ||
47 | { | ||
48 | 38 | std::bitset<3> are_parameters_unused; | |
49 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if (poisson_ratio < 0.) |
50 | ✗ | are_parameters_unused.set(0); | |
51 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if (young_modulus < 0.) |
52 | ✗ | are_parameters_unused.set(1); | |
53 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if (m_bulk < 0.) |
54 | ✗ | are_parameters_unused.set(2); | |
55 | |||
56 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
|
38 | if (are_parameters_unused.any()) |
57 | ✗ | throw ErrorInvalidParameter(are_parameters_unused); | |
58 | } | ||
59 | |||
60 | 38 | m_lame_lambda = poisson_ratio * young_modulus / ((1. + poisson_ratio) * (1. - 2. * poisson_ratio)); | |
61 | 38 | m_lame_mu = young_modulus * 0.5 / (1. + poisson_ratio); | |
62 | 38 | } | |
63 | |||
64 | /***********************************************************************************/ | ||
65 | /***********************************************************************************/ | ||
66 | |||
67 | 3 | double StVenantKirchhoff::W() const | |
68 | { | ||
69 | 3 | BaseClassType::W(); | |
70 | |||
71 | 3 | const double I1 = HyperElasticLaw::m_invariants[0]; | |
72 | 3 | const double I2 = HyperElasticLaw::m_invariants[1]; | |
73 | |||
74 | // Law: St-Venant - Kirchhoff | ||
75 | // W = lambda(Tr(E))^2 + mu Tr(E^2) | ||
76 | // W=e1/8(gi1-3)^2+e2/4(gi1^2-2gi2-2gi1+3) | ||
77 | 3 | return (0.125 * m_lame_lambda+ 0.25 * m_lame_mu) * std::pow(I1, 2) | |
78 | 3 | - (0.75 * m_lame_lambda+ 0.5 * m_lame_mu) * I1 | |
79 | 3 | - 0.5 * m_lame_mu* I2 | |
80 | 3 | + 1.125 * m_lame_lambda+ 0.75 * m_lame_mu; | |
81 | } | ||
82 | |||
83 | /***********************************************************************************/ | ||
84 | /***********************************************************************************/ | ||
85 | |||
86 | 782271 | double StVenantKirchhoff::FirstDerivativeWFirstInvariant() const | |
87 | { | ||
88 | 782271 | BaseClassType::FirstDerivativeWFirstInvariant(); | |
89 | 782271 | const double I1 = HyperElasticLaw::m_invariants[0]; | |
90 | |||
91 | 782271 | return (0.25 * m_lame_lambda+ 0.5 * m_lame_mu) * I1 | |
92 | 782271 | - (0.75 * m_lame_lambda+ 0.5 * m_lame_mu); | |
93 | } | ||
94 | |||
95 | /***********************************************************************************/ | ||
96 | /***********************************************************************************/ | ||
97 | |||
98 | 782271 | double StVenantKirchhoff::FirstDerivativeWSecondInvariant() const | |
99 | { | ||
100 | 782271 | BaseClassType::FirstDerivativeWSecondInvariant(); | |
101 | 782271 | return - 0.5 * m_lame_mu; | |
102 | } | ||
103 | |||
104 | /***********************************************************************************/ | ||
105 | /***********************************************************************************/ | ||
106 | |||
107 | 782270 | double StVenantKirchhoff::FirstDerivativeWThirdInvariant() const | |
108 | { | ||
109 | 782270 | BaseClassType::FirstDerivativeWThirdInvariant(); | |
110 | 782270 | return 0.0; | |
111 | } | ||
112 | |||
113 | /***********************************************************************************/ | ||
114 | /***********************************************************************************/ | ||
115 | |||
116 | 782271 | double StVenantKirchhoff::SecondDerivativeWFirstInvariant() const | |
117 | { | ||
118 | 782271 | BaseClassType::SecondDerivativeWFirstInvariant(); | |
119 | 782271 | return (0.25 * m_lame_lambda+ 0.5 * m_lame_mu); | |
120 | } | ||
121 | |||
122 | /***********************************************************************************/ | ||
123 | /***********************************************************************************/ | ||
124 | |||
125 | 782270 | double StVenantKirchhoff::SecondDerivativeWSecondInvariant() const | |
126 | { | ||
127 | 782270 | BaseClassType::SecondDerivativeWSecondInvariant(); | |
128 | 782270 | return 0.0; | |
129 | } | ||
130 | |||
131 | /***********************************************************************************/ | ||
132 | /***********************************************************************************/ | ||
133 | |||
134 | 782270 | double StVenantKirchhoff::SecondDerivativeWThirdInvariant() const | |
135 | { | ||
136 | 782270 | BaseClassType::SecondDerivativeWThirdInvariant(); | |
137 | 782270 | return 0.0; | |
138 | } | ||
139 | |||
140 | /***********************************************************************************/ | ||
141 | /***********************************************************************************/ | ||
142 | |||
143 | 780002 | double StVenantKirchhoff::SecondDerivativeWFirstAndThirdInvariant() const | |
144 | { | ||
145 | 780002 | BaseClassType::SecondDerivativeWFirstAndThirdInvariant(); | |
146 | 780002 | return 0.0; | |
147 | } | ||
148 | |||
149 | /***********************************************************************************/ | ||
150 | /***********************************************************************************/ | ||
151 | |||
152 | 780002 | double StVenantKirchhoff::SecondDerivativeWSecondAndThirdInvariant() const | |
153 | { | ||
154 | 780002 | BaseClassType::SecondDerivativeWSecondAndThirdInvariant(); | |
155 | 780002 | return 0.0; | |
156 | } | ||
157 | |||
158 | /***********************************************************************************/ | ||
159 | /***********************************************************************************/ | ||
160 | |||
161 | 780002 | double StVenantKirchhoff::SecondDerivativeWFirstAndSecondInvariant() const | |
162 | { | ||
163 | 780002 | BaseClassType::SecondDerivativeWFirstAndSecondInvariant(); | |
164 | 780002 | return 0.0; | |
165 | } | ||
166 | |||
167 | } // namespace felisce | ||
168 | |||
169 |