pml_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_PML_TIME_HARMONIC_ELASTICITY_TENSOR_HEADER
31 #define OOMPH_PML_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 #include "math.h"
40 #include <complex>
41 
42 namespace oomph
43 {
44  //=====================================================================
55  //=====================================================================
57  {
60  static const unsigned Index[3][3][3][3];
61 
62  protected:
65  virtual inline std::complex<double> independent_component(
66  const unsigned& i) const
67  {
68  return std::complex<double>(0.0, 0.0);
69  }
70 
71 
76  void range_check(const unsigned& i,
77  const unsigned& j,
78  const unsigned& k,
79  const unsigned& l) const
80  {
81  if ((i > 2) || (j > 2) || (k > 2) || (l > 2))
82  {
83  std::ostringstream error_message;
84  if (i > 2)
85  {
86  error_message << "Range Error : Index 1 " << i
87  << " is not in the range (0,2)";
88  }
89  if (j > 2)
90  {
91  error_message << "Range Error : Index 2 " << j
92  << " is not in the range (0,2)";
93  }
94 
95  if (k > 2)
96  {
97  error_message << "Range Error : Index 2 " << k
98  << " is not in the range (0,2)";
99  }
100 
101  if (l > 2)
102  {
103  error_message << "Range Error : Index 4 " << l
104  << " is not in the range (0,2)";
105  }
106 
107  // Throw the error
108  throw OomphLibError(error_message.str(),
111  }
112  }
113 
114 
117 
118  public:
121 
122  public:
125  std::complex<double> operator()(const unsigned& i,
126  const unsigned& j,
127  const unsigned& k,
128  const unsigned& l) const
129  {
130  // Range check
131 #ifdef PARANOID
132  range_check(i, j, k, l);
133 #endif
134  return independent_component(Index[i][j][k][l]);
135  }
136  };
137 
138 
139  //===================================================================
147  //===================================================================
150  {
152  std::complex<double> C[4];
153 
156  static const unsigned StaticIndex[21];
157 
159  double Nu;
160 
161  public:
167  PMLTimeHarmonicIsotropicElasticityTensor(const double& nu, const double& E)
169  {
170  // Set the three indepdent components
171  C[0] = std::complex<double>(0.0, 0.0);
172  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
173  double mu = E / (2.0 * (1.0 + nu));
174  this->set_lame_coefficients(lambda, mu);
175  }
176 
182  {
183  // Set the three indepdent components
184  C[0] = std::complex<double>(0.0, 0.0);
185 
186  // reference value
187  double E = 1.0;
188  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
189  double mu = E / (2.0 * (1.0 + nu));
190  this->set_lame_coefficients(lambda, mu);
191  }
192 
194  double nu() const
195  {
196  return Nu;
197  }
198 
204  void update_constitutive_parameters(const double& nu, const double& E = 1.0)
205  {
206  // Set the three indepdent components
207  C[0] = std::complex<double>(0.0, 0.0);
208  double lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
209  double mu = E / (2.0 * (1.0 + nu));
210  this->set_lame_coefficients(lambda, mu);
211  }
212 
213 
215  inline std::complex<double> independent_component(const unsigned& i) const
216  {
217  return C[StaticIndex[i]];
218  }
219 
220 
221  private:
222  // Set the values of the lame coefficients
223  void set_lame_coefficients(const double& lambda, const double& mu)
224  {
225  C[1] = lambda + 2.0 * mu;
226  C[2] = lambda;
227  C[3] = mu;
228  }
229  };
230 
231 } // namespace oomph
232 #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: pml_time_harmonic_elasticity_tensor.h:57
static const unsigned Index[3][3][3][3]
Definition: pml_time_harmonic_elasticity_tensor.h:60
PMLTimeHarmonicElasticityTensor()
Empty Constructor.
Definition: pml_time_harmonic_elasticity_tensor.h:116
virtual ~PMLTimeHarmonicElasticityTensor()
Empty virtual Destructor.
Definition: pml_time_harmonic_elasticity_tensor.h:120
virtual std::complex< double > independent_component(const unsigned &i) const
Definition: pml_time_harmonic_elasticity_tensor.h:65
std::complex< double > operator()(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: pml_time_harmonic_elasticity_tensor.h:125
void range_check(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Definition: pml_time_harmonic_elasticity_tensor.h:76
Definition: pml_time_harmonic_elasticity_tensor.h:150
PMLTimeHarmonicIsotropicElasticityTensor(const double &nu, const double &E)
Definition: pml_time_harmonic_elasticity_tensor.h:167
PMLTimeHarmonicIsotropicElasticityTensor(const double &nu)
Definition: pml_time_harmonic_elasticity_tensor.h:180
std::complex< double > independent_component(const unsigned &i) const
Overload the independent coefficient function.
Definition: pml_time_harmonic_elasticity_tensor.h:215
double Nu
Poisson's ratio.
Definition: pml_time_harmonic_elasticity_tensor.h:159
double nu() const
Poisson's ratio.
Definition: pml_time_harmonic_elasticity_tensor.h:194
void update_constitutive_parameters(const double &nu, const double &E=1.0)
Definition: pml_time_harmonic_elasticity_tensor.h:204
static const unsigned StaticIndex[21]
Translation scheme for the isotropic elasticity tensor.
Definition: pml_time_harmonic_elasticity_tensor.h:156
void set_lame_coefficients(const double &lambda, const double &mu)
Definition: pml_time_harmonic_elasticity_tensor.h:223
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