GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Kernel.hpp
Go to the documentation of this file.
1 //
2 // Author(s) : - Jean-luc CHARLES I2M-DuMAS/ENSAM Talence France
3 // <jean-luc.charles@ensam.eu>
4 // - Damien ANDRE SPCTS/ENS Ceramique industrielle, Limoges France
5 // <damien.andre@unilim.fr>
6 // - Jeremie GIRARDOT I2M-DuMAS/ENSAM Talence France
7 // <jeremie.girardot@ensam.eu>
8 // - Cedric Hubert LAMIH/UVHC Valenciennes France
9 // <cedric.hubert@univ-valenciennes.fr>
10 // - Ivan IORDANOFF I2M-DuMAS-MPI/ENSAM Talence France
11 // <ivan.iordanoff@ensam.eu>
12 //
13 // Copyright (C) 2008-2016 JL. CHARLES, D. ANDRE, I. IORDANOFF, J. GIRARDOT
14 //
15 //
16 //
17 //
18 //
19 // This program is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 // This program is distributed in the hope that it will be useful,
25 // but WITHOUT ANY WARRANTY; without even the implied warranty of
26 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 // GNU General Public License for more details.
28 //
29 // You should have received a copy of the GNU General Public License
30 // along with this program. If not, see <http://www.gnu.org/licenses/>.
31 
32 
33 
34 #ifndef GranOO_SPH_Kernel_hpp
35 #define GranOO_SPH_Kernel_hpp
36 
37 
38 #include "GranOO3/Geom/Vector.hpp"
39 
40 namespace GranOO3
41 {
42  namespace SPH
43  {
44  namespace Kernel
45  {
46 
47  struct K0 // The default main kernel
48  {
49  static double k_def(const double &h, const Geom::Vector &d);
50  static Geom::Vector gk_def(const double &h, const Geom::Vector &d);
51  static double lk_def(const double &h, const Geom::Vector &d);
52  static Geom::Vector gk_pres(const double &h, const Geom::Vector &d);
53  static double lk_visc(const double &h, const Geom::Vector &d);
54  };
55 
56 
57 
58  inline double
59  K0::k_def(const double &h, const Geom::Vector &d) {
60  const double r = d.norm();
61  if (r <= h)
62  return (315./ (64*M_PI*pow(h,9.)) ) * pow( (h*h) - (r*r), 3.);
63  else
64  return 0.;
65  }
66 
67  inline Geom::Vector
68  K0::gk_def(const double &h, const Geom::Vector &d) {
69  double Norm = d.norm();
70 
71  if (Norm<=h)
72  return -945*d*pow((h*h-pow(Norm,2)),2)/(32*M_PI*pow(h,9));
73 
74  return Geom::Vector(0., 0., 0);
75  }
76 
77  inline double
78  K0::lk_def(const double &h, const Geom::Vector &d) {
79  double Norm = d.norm();
80  if (Norm<=h)
81  return -945*(h*h-pow(Norm,2))*(3*h*h-7*pow(Norm,2))/(32*M_PI*pow(h,9));
82  else
83  return 0.;
84  }
85 
86  inline Geom::Vector
87  K0::gk_pres(const double &h, const Geom::Vector &d) {
88  const double r = d.norm();
89  if (r > 0. && r <= h)
90  return (-45. / (M_PI*pow(h,6.))) * (d/r) * pow(h-r,2.);
91 
92  return Geom::Vector(0., 0., 0.);
93  }
94 
95  inline double
96  K0::lk_visc(const double &h, const Geom::Vector &d) {
97  double r = d.norm();
98  if (r <= h)
99  return (45. / (M_PI*pow(h,6)) ) * (h -r);
100  else
101  return 0.;
102  }
103 
104  }
105  }
106 }
107 
108 
109 
110 
111 
112 
113 #endif
Definition: Vector.hpp:75
double norm() const
Definition: Common.hpp:198
T pow(const T v0, const T v1)
Definition: Exprtk.hpp:1491
Definition: Kernel.hpp:48
static double lk_visc(const double &h, const Geom::Vector &d)
Definition: Kernel.hpp:96
static Geom::Vector gk_pres(const double &h, const Geom::Vector &d)
Definition: Kernel.hpp:87
static double lk_def(const double &h, const Geom::Vector &d)
Definition: Kernel.hpp:78
static Geom::Vector gk_def(const double &h, const Geom::Vector &d)
Definition: Kernel.hpp:68
static double k_def(const double &h, const Geom::Vector &d)
Definition: Kernel.hpp:59