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// 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_TIME_HARMONIC_ELASTICITY_TENSOR_HEADER
31 #define OOMPH_TIME_HARMONIC_ELASTICITY_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  //=====================================================================
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:
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  //===================================================================
147  {
148  // Storage for the independent components of the elasticity tensor
149  double C[4];
150 
151  // Translation scheme between the 21 independent components of the general
152  // elasticity tensor and the isotropic case
153  static const unsigned StaticIndex[21];
154 
155  public:
161  TimeHarmonicIsotropicElasticityTensor(const double& nu, const double& E)
163  {
164  // Set the three indepdent components
165  C[0] = 0.0;
166  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
167  double mu = E / (2.0 * (1.0 + nu));
168  this->set_lame_coefficients(lambda, mu);
169  }
170 
176  {
177  // Set the three indepdent components
178  C[0] = 0.0;
179 
180  // reference value
181  double E = 1.0;
182  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
183  double mu = E / (2.0 * (1.0 + nu));
184  this->set_lame_coefficients(lambda, mu);
185  }
186 
192  void update_constitutive_parameters(const double& nu, const double& E = 1.0)
193  {
194  // Set the three indepdent components
195  C[0] = 0.0;
196  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
197  double mu = E / (2.0 * (1.0 + nu));
198  this->set_lame_coefficients(lambda, mu);
199  }
200 
201 
203  inline double independent_component(const unsigned& i) const
204  {
205  return C[StaticIndex[i]];
206  }
207 
208 
209  private:
210  // Set the values of the lame coefficients
211  void set_lame_coefficients(const double& lambda, const double& mu)
212  {
213  C[1] = lambda + 2.0 * mu;
214  C[2] = lambda;
215  C[3] = mu;
216  }
217  };
218 
219 } // namespace oomph
220 #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: matrices.h:74
Definition: oomph_definitions.h:222
Definition: time_harmonic_elasticity_tensor.h:55
TimeHarmonicElasticityTensor()
Empty Constructor.
Definition: time_harmonic_elasticity_tensor.h:113
virtual double independent_component(const unsigned &i) const
Definition: time_harmonic_elasticity_tensor.h:63
static const unsigned Index[3][3][3][3]
Definition: time_harmonic_elasticity_tensor.h:58
void range_check(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: time_harmonic_elasticity_tensor.h:73
double operator()(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: time_harmonic_elasticity_tensor.h:122
virtual ~TimeHarmonicElasticityTensor()
Empty virtual Destructor.
Definition: time_harmonic_elasticity_tensor.h:117
Definition: time_harmonic_elasticity_tensor.h:147
double independent_component(const unsigned &i) const
Overload the independent coefficient function.
Definition: time_harmonic_elasticity_tensor.h:203
static const unsigned StaticIndex[21]
Translation scheme for the isotropic elasticity tensor.
Definition: time_harmonic_elasticity_tensor.h:153
TimeHarmonicIsotropicElasticityTensor(const double &nu)
Definition: time_harmonic_elasticity_tensor.h:174
void update_constitutive_parameters(const double &nu, const double &E=1.0)
Definition: time_harmonic_elasticity_tensor.h:192
TimeHarmonicIsotropicElasticityTensor(const double &nu, const double &E)
Definition: time_harmonic_elasticity_tensor.h:161
void set_lame_coefficients(const double &lambda, const double &mu)
Definition: time_harmonic_elasticity_tensor.h:211
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