NiHu  2.0
elastostatics_kernel.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
23 
24 #ifndef ELASTOSTATICS_KERNEL_HPP_INCLUDED
25 #define ELASTOSTATICS_KERNEL_HPP_INCLUDED
26 
27 #include <boost/math/constants/constants.hpp>
28 
29 #include "../core/global_definitions.hpp"
30 #include "../core/kernel.hpp"
31 #include "../core/gaussian_quadrature.hpp"
32 #include "location_normal.hpp"
33 #include "guiggiani_1992.hpp"
34 
35 
36 namespace NiHu
37 {
38 
41 {
42 public:
46  elastostatics_kernel(double nu, double mu)
47  : m_nu(nu)
48  , m_mu(mu)
49  {
50  }
51 
54  double get_poisson_ratio() const
55  {
56  return m_nu;
57  }
58 
61  double get_shear_modulus() const
62  {
63  return m_mu;
64  }
65 
68  double get_lame_lambda() const
69  {
70  return 2. * m_mu * m_nu / (1. - 2. * m_nu);
71  }
72 
75  double get_bulk_modulus() const
76  {
77  return get_lame_lambda() + 2./3.*m_mu;
78  }
79 
80 private:
81  double m_nu;
82  double m_mu;
83 };
84 
85 
87 class elastostatics_2d_U_kernel;
88 
90 template <>
92 {
95  typedef Eigen::Matrix<double, 2, 2> result_t;
97  static bool const is_symmetric = true;
98 
100 
101  static bool const is_singular = true;
102 };
103 
104 
106 template <>
108 {
110  static unsigned const singular_quadrature_order = 7;
112 };
113 
116  : public kernel_base<elastostatics_2d_U_kernel>
117  , public elastostatics_kernel
118 {
119 public:
120  typedef location_input_2d::x_t x_t;
121 
125  elastostatics_2d_U_kernel(double nu, double mu)
126  : elastostatics_kernel(nu, mu)
127  {
128  }
129 
134  result_t operator()(x_t const &x, x_t const &y) const
135  {
136  using boost::math::double_constants::pi;
137  double nu = get_poisson_ratio();
138  double mu = get_shear_modulus();
139  x_t rvec = y - x; // distance vector
140  double r = rvec.norm(); // scalar distance
141  x_t gradr = rvec.normalized(); // gradient of the distance vector
142  return ( - (3.-4.*nu) * result_t::Identity() * std::log(r) + gradr * gradr.transpose() ) / (8.*pi*mu*(1.-nu));
143  }
144 
150  location_input_2d const &x,
151  location_input_2d const &y) const
152  {
153  return (*this)(x.get_x(), y.get_x());
154  }
155 
156 };
157 
158 
160 class elastostatics_2d_T_kernel;
161 
163 template <>
165 {
168  typedef Eigen::Matrix<double, 2, 2> result_t;
170  static bool const is_symmetric = true;
171 
173 
174  static bool const is_singular = true;
175 };
176 
177 
179 template <>
181 {
183  static unsigned const singular_quadrature_order = 7;
185 };
186 
189  : public kernel_base<elastostatics_2d_T_kernel>
190  , public elastostatics_kernel
191 {
192 public:
193  typedef location_input_2d::x_t x_t;
194 
198  elastostatics_2d_T_kernel(double nu, double mu)
199  : elastostatics_kernel(nu, mu)
200  {
201  }
202 
209  x_t const &x,
210  x_t const &y,
211  x_t const &ny) const
212  {
213  using boost::math::double_constants::pi;
214 
215  double nu = get_poisson_ratio();
216  x_t rvec = y - x;
217  double r = rvec.norm();
218  x_t gradr = rvec.normalized();
219  double rdny = gradr.dot(ny);
220  return
221  -1.0 *
222  (rdny * ( (1.-2.*nu)*result_t::Identity() + 2.*(gradr*gradr.transpose()) )
223  -
224  (1.-2.*nu) * (gradr*ny.transpose()-ny*gradr.transpose()) )
225  /
226  (4.*pi*(1.-nu)*r);
227  }
228 
234  location_input_2d const &x,
235  location_normal_input_2d const &y) const
236  {
237  return (*this)(x.get_x(), y.get_x(), y.get_unit_normal());
238  }
239 };
240 
241 
243 class elastostatics_3d_U_kernel;
244 
246 template <>
248 {
251  typedef Eigen::Matrix<double, 3, 3> result_t;
253  static bool const is_symmetric = true;
255  static bool const is_singular = true;
256 };
257 
258 
260 template <>
262 {
264  static unsigned const singular_quadrature_order = 7;
266 };
267 
270  : public kernel_base<elastostatics_3d_U_kernel>
271  , public elastostatics_kernel
272 {
273 public:
274  typedef location_input_3d::x_t x_t;
275 
276  elastostatics_3d_U_kernel(double nu, double mu)
277  : elastostatics_kernel(nu, mu)
278  {
279  }
280 
281  result_t operator()(
282  x_t const& x,
283  x_t const& y) const
284  {
285  using boost::math::double_constants::pi;
286 
287  double nu = get_poisson_ratio();
288  double mu = get_shear_modulus();
289  x_t rvec = y - x;
290  double r = rvec.norm();
291  x_t gradr = rvec.normalized();
292  return ((3. - 4. * nu) * result_t::Identity() + (gradr * gradr.transpose())) / (16. * pi * (1. - nu) * r * mu);
293  }
294 
295 
296  result_t operator()(
297  location_input_3d const &x,
298  location_input_3d const &y) const
299  {
300  return (*this)(x.get_x(), y.get_x());
301  }
302 };
303 
306 
307 template <>
309 {
312  typedef Eigen::Matrix<double, 3, 3> result_t;
314  static bool const is_symmetric = false;
316  static bool const is_singular = true;
317 };
318 
320 template <>
322 {
324  static unsigned const singular_quadrature_order = 7;
326 };
327 
330  : public kernel_base<elastostatics_3d_T_kernel>
331  , public elastostatics_kernel
332 {
333 public:
334  typedef location_input_3d::x_t x_t;
335 
336  elastostatics_3d_T_kernel(double nu, double mu)
337  : elastostatics_kernel(nu, mu)
338  {
339  }
340 
341  result_t operator()(
342  x_t const &x,
343  x_t const &y,
344  x_t const &ny) const
345  {
346  using boost::math::double_constants::pi;
347 
348  auto nu = get_poisson_ratio();
349  auto rvec = y - x;
350  auto r = rvec.norm();
351  auto gradr = rvec.normalized();
352  auto rdny = gradr.dot(ny);
353  return (-rdny * ((1. - 2. * nu) * result_t::Identity() + 3. * (gradr * gradr.transpose()))
354  + (1. - 2. * nu) * (gradr * ny.transpose() - ny * gradr.transpose())
355  ) / (8. * pi * (1. - nu) * r * r);
356  }
357 
358  result_t operator()(
359  location_input_3d const &x,
360  location_normal_input_3d const &y) const
361  {
362  return (*this)(x.get_x(), y.get_x(), y.get_unit_normal());
363  }
364 };
365 
366 
367 template <>
369 {
370 public:
371  template <class guiggiani>
372  static void eval(guiggiani &obj)
373  {
374  using namespace boost::math::double_constants;
375 
376  auto const &r1 = obj.get_rvec_series(_1());
377  auto const &j0 = obj.get_Jvec_series(_0());
378  auto const &N0 = obj.get_shape_series(_0());
379  auto nu = obj.get_kernel().get_poisson_ratio();
380  Eigen::Matrix<double, 3, 3> res = ((r1*j0.transpose())-(j0*r1.transpose()))
381  * (1.-2.*nu)/(1.-nu)/(8.*pi);
382  obj.set_laurent_coeff(_m1(), semi_block_product(res, N0));
383  }
384 };
385 
386 }
387 
388 #endif // ELASTOSTATICS_KERNEL_HPP_INCLUDED
389 
NiHu::elastostatics_2d_U_kernel::elastostatics_2d_U_kernel
elastostatics_2d_U_kernel(double nu, double mu)
Construct a new elastostatics 2d U kernel object.
Definition: elastostatics_kernel.hpp:125
NiHu::elastostatics_kernel::get_lame_lambda
double get_lame_lambda() const
Get the lame's lambda parameter.
Definition: elastostatics_kernel.hpp:68
NiHu::singular_kernel_traits::singular_core_t
kernel_traits_ns::singular_core< Derived >::type singular_core_t
the kernel's singular core type
Definition: kernel.hpp:106
NiHu::elastostatics_2d_T_kernel::operator()
result_t operator()(x_t const &x, x_t const &y, x_t const &ny) const
Evaluate the kernel between two locations.
Definition: elastostatics_kernel.hpp:208
NiHu::kernel_traits::quadrature_family_t
kernel_traits_ns::quadrature_family< Derived >::type quadrature_family_t
the far field asymptotic behaviour of the kernel
Definition: kernel.hpp:84
NiHu::asymptotic::log< 1 >
NiHu::elastostatics_2d_T_kernel
2d traction kernel for elastostatics
Definition: elastostatics_kernel.hpp:188
NiHu::elastostatics_2d_U_kernel
The displacement kernel of 2D elastostatics.
Definition: elastostatics_kernel.hpp:115
NiHu::kernel_traits::far_field_behaviour_t
kernel_traits_ns::far_field_behaviour< Derived >::type far_field_behaviour_t
the far field asymptotic behaviour of the kernel
Definition: kernel.hpp:82
NiHu::singular_kernel_traits
singular traits class of a kernel
Definition: kernel.hpp:101
NiHu::elastostatics_2d_T_kernel::elastostatics_2d_T_kernel
elastostatics_2d_T_kernel(double nu, double mu)
Construct a new elastostatics 2d T kernel object.
Definition: elastostatics_kernel.hpp:198
NiHu::elastostatics_kernel::elastostatics_kernel
elastostatics_kernel(double nu, double mu)
Construct a new elastostatics kernel object.
Definition: elastostatics_kernel.hpp:46
NiHu::elastostatics_kernel::get_shear_modulus
double get_shear_modulus() const
Get the shear modulus.
Definition: elastostatics_kernel.hpp:61
NiHu::semi_block_product
semi_block_product_result_type< mat, rightDerived >::type semi_block_product(mat const &m, Eigen::MatrixBase< rightDerived > const &r)
compute semi block product of a matrix and a vector m * v^T
Definition: block_product.hpp:194
NiHu::elastostatics_kernel::get_bulk_modulus
double get_bulk_modulus() const
get the bulk modulus
Definition: elastostatics_kernel.hpp:75
NiHu::elastostatics_2d_T_kernel::operator()
result_t operator()(location_input_2d const &x, location_normal_input_2d const &y) const
Evaluate the kernel between two inputs.
Definition: elastostatics_kernel.hpp:233
NiHu::kernel_traits::test_input_t
kernel_traits_ns::test_input< Derived >::type test_input_t
kernel test input type
Definition: kernel.hpp:76
NiHu::location_input::x_t
space_t::location_t x_t
the location type
Definition: location_normal.hpp:43
NiHu::location_normal_jacobian_input
a class representing a normal + Jacobian input
Definition: location_normal.hpp:79
NiHu::kernel_traits::is_singular
@ is_singular
indicates if the kernel is singular
Definition: kernel.hpp:91
guiggiani_1992.hpp
Guiggiani's method for CPV and HPF collocational integrals.
NiHu::kernel_base
CRTP base class of all BEM kernels.
Definition: kernel.hpp:133
NiHu::_m1
std::integral_constant< int, -1 > _m1
shorthand for constant minus one
Definition: guiggiani_1992.hpp:69
NiHu::elastostatics_2d_U_kernel::operator()
result_t operator()(location_input_2d const &x, location_input_2d const &y) const
Evaluate the kernel between two locations.
Definition: elastostatics_kernel.hpp:149
NiHu::kernel_traits
traits class of a kernel
Definition: kernel.hpp:71
NiHu::singular_kernel_traits::singular_quadrature_order
@ singular_quadrature_order
the quadrature order singular integrals are handled with
Definition: kernel.hpp:111
NiHu::elastostatics_kernel
Base class for elastostatics kernels. This class contains the two material parameters.
Definition: elastostatics_kernel.hpp:40
NiHu::singular_kernel_traits::singularity_type_t
kernel_traits_ns::singularity_type< Derived >::type singularity_type_t
the kernel's singularity type
Definition: kernel.hpp:104
NiHu::kernel_traits::result_t
kernel_traits_ns::result< Derived >::type result_t
the kernel result type
Definition: kernel.hpp:80
NiHu::kernel_traits::is_symmetric
@ is_symmetric
indicates if the kernel is symmetric
Definition: kernel.hpp:89
NiHu::_1
std::integral_constant< int, 1 > _1
shorthand for constant one
Definition: guiggiani_1992.hpp:73
NiHu::asymptotic::inverse< 1 >
NiHu::elastostatics_3d_U_kernel
the displacement kernel for 3d isotropic elastostatics
Definition: elastostatics_kernel.hpp:269
NiHu::location_input::get_x
const x_t & get_x(void) const
return the location
Definition: location_normal.hpp:65
location_normal.hpp
implementation of location and normal kernel inputs
NiHu::elastostatics_2d_U_kernel::operator()
result_t operator()(x_t const &x, x_t const &y) const
Evaluate the kernel between two kernel inputs.
Definition: elastostatics_kernel.hpp:134
NiHu::kernel_base< elastostatics_2d_U_kernel >::result_t
traits_t::result_t result_t
compile time check if the two kernel inputs are compatible
Definition: kernel.hpp:147
NiHu::polar_laurent_coeffs
definition of Laurent coefficients of singularities
Definition: guiggiani_1992.hpp:64
NiHu::elastostatics_kernel::get_poisson_ratio
double get_poisson_ratio() const
Get the poisson ratio.
Definition: elastostatics_kernel.hpp:54
NiHu::_0
std::integral_constant< int, 0 > _0
shorthand for constant zero
Definition: guiggiani_1992.hpp:71
NiHu::elastostatics_3d_T_kernel
the traction kernel for 3d isotropic elastostatics
Definition: elastostatics_kernel.hpp:329
NiHu::kernel_traits::trial_input_t
kernel_traits_ns::trial_input< Derived >::type trial_input_t
kernel trial input type
Definition: kernel.hpp:78
NiHu::guiggiani
Implementation of Guiggiani's method.
Definition: guiggiani_1992.hpp:84
NiHu::location_input
a class representing a simple location
Definition: location_normal.hpp:37
NiHu::location_normal_jacobian_input::get_unit_normal
const x_t & get_unit_normal(void) const
return the unit normal vector
Definition: location_normal.hpp:116
NiHu::gauss_family_tag
tag for the family of Gaussian quadratures
Definition: gaussian_quadrature.hpp:517