time_harmonic_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// Version 1.0; svn revision $LastChangedRevision: 1299 $
7 //LIC//
8 //LIC// $LastChangedDate: 2017-10-06 07:40:18 +0100 (Fri, 06 Oct 2017) $
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Header file for objects representing the fourth-rank elasticity tensor
31 //for linear elasticity problems
32 
33 //Include guards to prevent multiple inclusion of the header
34 #ifndef OOMPH_TIME_HARMONIC_ELASTICITY_TENSOR_HEADER
35 #define OOMPH_TIME_HARMONIC_ELASTICITY_TENSOR_HEADER
36 
37 // Config header generated by autoconfig
38 #ifdef HAVE_CONFIG_H
39  #include <oomph-lib-config.h>
40 #endif
41 
42 #include "../generic/oomph_utilities.h"
43 
44 namespace oomph
45 {
46  //=====================================================================
47  /// A base class that represents the fourth-rank elasticity tensor
48  /// \f$E_{ijkl}\f$ defined such that
49  /// \f[\tau_{ij} = E_{ijkl} e_{kl},\f]
50  /// where \f$e_{ij}\f$ is the infinitessimal (Cauchy) strain tensor
51  /// and \f$\tau_{ij}\f$ is the stress tensor. The symmetries of the
52  /// tensor are such that
53  /// \f[E_{ijkl} = E_{jikl} = E_{ijlk} = E_{klij}\f]
54  /// and thus there are relatively few independent components. These
55  /// symmetries are included in the definition of the object so that
56  /// non-physical symmetries cannot be accidentally imposed.
57  //=====================================================================
59  {
60 
61  ///\short Translation table from the four indices to the corresponding
62  ///independent component
63  static const unsigned Index[3][3][3][3];
64 
65  protected:
66 
67  ///Member function that returns the i-th independent component of the
68  ///elasticity tensor
69  virtual inline double independent_component(const unsigned &i) const
70  {return 0.0;}
71 
72 
73  ///\short Helper range checking function
74  /// (Note that this only captures over-runs in 3D but
75  /// errors are likely to be caught in evaluation of the
76  /// stress and strain tensors anyway...)
77  void range_check(const unsigned &i, const unsigned &j,
78  const unsigned &k, const unsigned &l) const
79  {
80  if((i > 2) || (j > 2) || (k> 2) || (l>2))
81  {
82  std::ostringstream error_message;
83  if(i > 2)
84  {
85  error_message << "Range Error : Index 1 " << i
86  << " is not in the range (0,2)";
87  }
88  if(j > 2)
89  {
90  error_message << "Range Error : Index 2 " << j
91  << " is not in the range (0,2)";
92  }
93 
94  if(k > 2)
95  {
96  error_message << "Range Error : Index 2 " << k
97  << " is not in the range (0,2)";
98  }
99 
100  if(l > 2)
101  {
102  error_message << "Range Error : Index 4 " << l
103  << " is not in the range (0,2)";
104  }
105 
106  //Throw the error
107  throw OomphLibError(error_message.str(),
108  OOMPH_CURRENT_FUNCTION,
109  OOMPH_EXCEPTION_LOCATION);
110  }
111  }
112 
113 
114  ///Empty Constructor
116 
117  public:
118 
119  ///Empty virtual Destructor
121 
122  public:
123 
124  ///\short Return the appropriate independent component
125  ///via the index translation scheme (const version).
126  double operator()(const unsigned &i, const unsigned &j,
127  const unsigned &k, const unsigned &l) const
128  {
129  //Range check
130 #ifdef PARANOID
131  range_check(i,j,k,l);
132 #endif
133  return independent_component(Index[i][j][k][l]);
134  }
135  };
136 
137 
138 //===================================================================
139 /// An isotropic elasticity tensor defined in terms of Young's modulus
140 /// and Poisson's ratio. The elasticity tensor is assumed to be
141 /// non-dimensionalised on some reference value for Young's modulus
142 /// so the value provided to the constructor (if any) is to be
143 /// interpreted as the ratio of the actual Young's modulus to the
144 /// Young's modulus used to non-dimensionalise the stresses/tractions
145 /// in the governing equations.
146 //===================================================================
149  {
150  //Storage for the independent components of the elasticity tensor
151  double C[4];
152 
153  //Translation scheme between the 21 independent components of the general
154  //elasticity tensor and the isotropic case
155  static const unsigned StaticIndex[21];
156 
157  public:
158 
159  /// \short Constructor. Passing in the values of the Poisson's ratio
160  /// and Young's modulus (interpreted as the ratio of the actual
161  /// Young's modulus to the Young's modulus (or other reference stiffness)
162  /// used to non-dimensionalise stresses and tractions in the governing
163  /// equations).
165  const double &E) :
167  {
168  //Set the three indepdent components
169  C[0] = 0.0;
170  double lambda=E*nu/((1.0+nu)*(1.0-2.0*nu));
171  double mu=E/(2.0*(1.0+nu));
172  this->set_lame_coefficients(lambda,mu);
173  }
174 
175  /// \short Constructor. Passing in the value of the Poisson's ratio.
176  /// Stresses and tractions in the governing equations are assumed
177  /// to have been non-dimensionalised on Young's modulus.
180  {
181  //Set the three indepdent components
182  C[0] = 0.0;
183 
184  // reference value
185  double E=1.0;
186  double lambda=E*nu/((1.0+nu)*(1.0-2.0*nu));
187  double mu=E/(2.0*(1.0+nu));
188  this->set_lame_coefficients(lambda,mu);
189  }
190 
191  /// \short Update parameters: Specify values of the Poisson's ratio
192  /// and (optionally) Young's modulus (interpreted as the ratio of the actual
193  /// Young's modulus to the Young's modulus (or other reference stiffness)
194  /// used to non-dimensionalise stresses and tractions in the governing
195  /// equations).
196  void update_constitutive_parameters(const double &nu,
197  const double &E=1.0)
198  {
199  //Set the three indepdent components
200  C[0] = 0.0;
201  double lambda=E*nu/((1.0+nu)*(1.0-2.0*nu));
202  double mu=E/(2.0*(1.0+nu));
203  this->set_lame_coefficients(lambda,mu);
204  }
205 
206 
207  ///Overload the independent coefficient function
208  inline double independent_component(const unsigned &i) const
209  {return C[StaticIndex[i]];}
210 
211 
212  private:
213 
214  //Set the values of the lame coefficients
215  void set_lame_coefficients(const double &lambda, const double &mu)
216  {
217  C[1] = lambda + 2.0*mu;
218  C[2] = lambda;
219  C[3] = mu;
220  }
221 
222  };
223 
224 }
225 #endif
TimeHarmonicIsotropicElasticityTensor(const double &nu)
Constructor. Passing in the value of the Poisson's ratio. Stresses and tractions in the governing equ...
cstr elem_len * i
Definition: cfortran.h:607
double independent_component(const unsigned &i) const
Overload the independent coefficient function.
void set_lame_coefficients(const double &lambda, const double &mu)
static const unsigned StaticIndex[21]
Translation scheme for the isotropic elasticity tensor.
void range_check(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Helper range checking function (Note that this only captures over-runs in 3D but errors are likely to...
double operator()(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Return the appropriate independent component via the index translation scheme (const version)...
virtual double independent_component(const unsigned &i) const
virtual ~TimeHarmonicElasticityTensor()
Empty virtual Destructor.
TimeHarmonicIsotropicElasticityTensor(const double &nu, const double &E)
Constructor. Passing in the values of the Poisson's ratio and Young's modulus (interpreted as the rat...
static const unsigned Index[3][3][3][3]
Translation table from the four indices to the corresponding independent component.
void update_constitutive_parameters(const double &nu, const double &E=1.0)
Update parameters: Specify values of the Poisson's ratio and (optionally) Young's modulus (interprete...