poroelasticity/elasticity_tensor.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for objects representing the fourth-rank elasticity tensor
27 // for linear elasticity problems
28 
29 // Include guards to prevent multiple inclusion of the header
30 #ifndef OOMPH_POROELASTICITY_TENSOR_HEADER
31 #define OOMPH_POROELASTICITY_TENSOR_HEADER
32 
33 // Config header generated by autoconfig
34 #ifdef HAVE_CONFIG_H
35 #include <oomph-lib-config.h>
36 #endif
37 
38 #include "../generic/oomph_utilities.h"
39 
40 namespace oomph
41 {
42  //=====================================================================
53  //=====================================================================
54  class ElasticityTensor
55  {
58  static const unsigned Index[3][3][3][3];
59 
60  protected:
63  virtual inline double independent_component(const unsigned& i) const
64  {
65  return 0.0;
66  }
67 
68 
73  void range_check(const unsigned& i,
74  const unsigned& j,
75  const unsigned& k,
76  const unsigned& l) const
77  {
78  if ((i > 2) || (j > 2) || (k > 2) || (l > 2))
79  {
80  std::ostringstream error_message;
81  if (i > 2)
82  {
83  error_message << "Range Error : Index 1 " << i
84  << " is not in the range (0,2)";
85  }
86  if (j > 2)
87  {
88  error_message << "Range Error : Index 2 " << j
89  << " is not in the range (0,2)";
90  }
91 
92  if (k > 2)
93  {
94  error_message << "Range Error : Index 2 " << k
95  << " is not in the range (0,2)";
96  }
97 
98  if (l > 2)
99  {
100  error_message << "Range Error : Index 4 " << l
101  << " is not in the range (0,2)";
102  }
103 
104  // Throw the error
105  throw OomphLibError(error_message.str(),
108  }
109  }
110 
111 
114 
115  public:
117  virtual ~ElasticityTensor() {}
118 
119  public:
122  double operator()(const unsigned& i,
123  const unsigned& j,
124  const unsigned& k,
125  const unsigned& l) const
126  {
127  // Range check
128 #ifdef PARANOID
129  range_check(i, j, k, l);
130 #endif
131  return independent_component(Index[i][j][k][l]);
132  }
133  };
134 
135 
136  //===================================================================
144  //===================================================================
145  class IsotropicElasticityTensor : public ElasticityTensor
146  {
147  // Storage for the independent components of the elasticity tensor
148  double C[4];
149 
150  // Translation scheme between the 21 independent components of the general
151  // elasticity tensor and the isotropic case
152  static const unsigned StaticIndex[21];
153 
154  public:
160  IsotropicElasticityTensor(const double& nu, const double& E)
161  : ElasticityTensor()
162  {
163  // Set the three independent components
164  C[0] = 0.0;
165  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
166  double mu = E / (2.0 * (1.0 + nu));
167  this->set_lame_coefficients(lambda, mu);
168  }
169 
174  {
175  // Set the three independent components
176  C[0] = 0.0;
177 
178  // reference value
179  double E = 1.0;
180  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
181  double mu = E / (2.0 * (1.0 + nu));
182  this->set_lame_coefficients(lambda, mu);
183  }
184 
189  {
190  // Set the three independent components
191  C[0] = 0.0;
192  this->set_lame_coefficients(lame[0], lame[1]);
193  }
194 
195 
197  inline double independent_component(const unsigned& i) const
198  {
199  return C[StaticIndex[i]];
200  }
201 
202 
203  private:
204  // Set the values of the lame coefficients
205  void set_lame_coefficients(const double& lambda, const double& mu)
206  {
207  C[1] = lambda + 2.0 * mu;
208  C[2] = lambda;
209  C[3] = mu;
210  }
211  };
212 
213 
214  //===================================================================
222  //===================================================================
224  {
225  // Storage for the independent components of the elasticity tensor
226  double C[3];
227 
228  // Storage for the first Lame parameter
229  double Lambda;
230 
231  // Storage for the second Lame parameter
232  double Mu;
233 
234  // Translation scheme between the 21 independent components of the general
235  // elasticity tensor and the isotropic case
236  static const unsigned StaticIndex[21];
237 
238  public:
243  {
244  C[0] = 0.0;
245  double E = 1.0;
246  double nu = 0.5;
247  double lambda = 0.0;
248  double mu = E / (2.0 * (1.0 + nu));
249  this->set_lame_coefficients(lambda, mu);
250  }
251 
257  DeviatoricIsotropicElasticityTensor(const double& nu, const double& E)
258  : ElasticityTensor()
259  {
260  // Set the three independent components
261  C[0] = 0.0;
262  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
263  double mu = E / (2.0 * (1.0 + nu));
264  this->set_lame_coefficients(lambda, mu);
265  }
266 
271  {
272  // Set the three independent components
273  C[0] = 0.0;
274 
275  // reference value
276  double E = 1.0;
277  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
278  double mu = E / (2.0 * (1.0 + nu));
279  this->set_lame_coefficients(lambda, mu);
280  }
281 
286  {
287  // Set the three independent components
288  C[0] = 0.0;
289  this->set_lame_coefficients(lame[0], lame[1]);
290  }
291 
292 
294  inline double independent_component(const unsigned& i) const
295  {
296  return C[StaticIndex[i]];
297  }
298 
300  const double& lambda() const
301  {
302  return Lambda;
303  }
304 
306  const double& mu() const
307  {
308  return Mu;
309  }
310 
311  private:
312  // Set the values of the lame coefficients
313  void set_lame_coefficients(const double& lambda, const double& mu)
314  {
315  C[1] = 2.0 * mu;
316  C[2] = mu;
317 
318  Lambda = lambda;
319  Mu = mu;
320  }
321  };
322 
323 } // namespace oomph
324 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
Definition: ComplexEigenSolver_compute.cpp:9
Definition: poroelasticity/elasticity_tensor.h:224
static const unsigned StaticIndex[21]
Translation scheme for the deviatoric isotropic elasticity tensor.
Definition: poroelasticity/elasticity_tensor.h:236
DeviatoricIsotropicElasticityTensor(const double &nu)
Definition: poroelasticity/elasticity_tensor.h:270
double Lambda
Definition: poroelasticity/elasticity_tensor.h:229
void set_lame_coefficients(const double &lambda, const double &mu)
Definition: poroelasticity/elasticity_tensor.h:313
DeviatoricIsotropicElasticityTensor()
Definition: poroelasticity/elasticity_tensor.h:242
DeviatoricIsotropicElasticityTensor(const double &nu, const double &E)
Definition: poroelasticity/elasticity_tensor.h:257
const double & lambda() const
Accessor function for the first lame parameter.
Definition: poroelasticity/elasticity_tensor.h:300
double Mu
Definition: poroelasticity/elasticity_tensor.h:232
const double & mu() const
Accessor function for the second lame parameter.
Definition: poroelasticity/elasticity_tensor.h:306
double independent_component(const unsigned &i) const
Overload the independent coefficient function.
Definition: poroelasticity/elasticity_tensor.h:294
DeviatoricIsotropicElasticityTensor(const Vector< double > &lame)
Definition: poroelasticity/elasticity_tensor.h:285
Definition: linear_elasticity/elasticity_tensor.h:55
virtual ~ElasticityTensor()
Empty virtual Destructor.
Definition: poroelasticity/elasticity_tensor.h:117
double operator()(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: poroelasticity/elasticity_tensor.h:122
static const unsigned Index[3][3][3][3]
Definition: linear_elasticity/elasticity_tensor.h:59
virtual double independent_component(const unsigned &i) const
Definition: poroelasticity/elasticity_tensor.h:63
ElasticityTensor()
Empty Constructor.
Definition: poroelasticity/elasticity_tensor.h:113
void range_check(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: poroelasticity/elasticity_tensor.h:73
IsotropicElasticityTensor(const double &nu, const double &E)
Definition: poroelasticity/elasticity_tensor.h:160
IsotropicElasticityTensor(const Vector< double > &lame)
Definition: poroelasticity/elasticity_tensor.h:188
void set_lame_coefficients(const double &lambda, const double &mu)
Definition: linear_elasticity/elasticity_tensor.h:233
IsotropicElasticityTensor(const double &nu)
Definition: poroelasticity/elasticity_tensor.h:173
double independent_component(const unsigned &i) const
Overload the independent coefficient function.
Definition: poroelasticity/elasticity_tensor.h:197
static const unsigned StaticIndex[21]
Translation scheme for the isotropic elasticity tensor.
Definition: linear_elasticity/elasticity_tensor.h:166
Definition: matrices.h:74
Definition: oomph_definitions.h:222
char char char int int * k
Definition: level2_impl.h:374
std::complex< double > mu
Definition: time_harmonic_fourier_decomposed_linear_elasticity/cylinder/cylinder.cc:52
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2