1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     Andreas Aigner (JKU Linz)
36     Markus Schoergenhumer (JKU Linz, 2D kernel)
37 
38     Copyright 2009-2012 JKU Linz
39 ------------------------------------------------------------------------- */
40 
41 #ifdef SPH_KERNEL_CLASS
42 
43     // kernel identifier (a unique integer >= 0)
44     // a name for the kernel
45     // name of the functions for the kernel, its derivative, and the cutoff are defined
46     SPHKernel
47     (
48         3,
49         spiky2d,
50         sph_kernel_spiky2d,
51         sph_kernel_spiky2d_der,
52         sph_kernel_spiky2d_cut
53     )
54 
55 #else
56 
57 #ifndef LMP_SPH_KERNEL_SPIKY2D
58 #define LMP_SPH_KERNEL_SPIKY2D
59 
60 namespace SPH_KERNEL_NS {
61   inline double sph_kernel_spiky2d(double s, double h, double hinv);
62   inline double sph_kernel_spiky2d_der(double s, double h, double hinv);
63   inline double sph_kernel_spiky2d_cut();
64 }
65 
66 /* ----------------------------------------------------------------------
67    Spiky SPH kernel 2D
68    h is kernel parameter
69    s is distance normalized by h
70    0.09947183943 is 5 over 16*pi
71 ------------------------------------------------------------------------- */
72 
73 inline double SPH_KERNEL_NS::sph_kernel_spiky2d(double s, double, double hinv)
74 {
75   if (s < 2.)
76   {
77       return (0.09947183943*hinv*hinv * (2.-s)*(2.-s)*(2.-s));
78   }
79   else
80   {
81       return 0;
82   }
83 }
84 
85 /* ----------------------------------------------------------------------
86    Derivative of Spiky SPH kernel 2D
87    is equal to grad W if multiplied with radial unit vector
88    h is kernel parameter
89    s is distance normalized by h
90    0.298415518297304 is 15 over 16*pi
91 ------------------------------------------------------------------------- */
92 
93 inline double SPH_KERNEL_NS::sph_kernel_spiky2d_der(double s, double, double hinv)
94 {
95     if (s < 2.)
96     {
97         return (-0.298415518297304*hinv*hinv*hinv * (2.-s)*(2.-s));
98     }
99     else
100     {
101         return 0;
102     }
103 }
104 
105 /* ----------------------------------------------------------------------
106    Definition of Spiky SPH 2D kernel cutoff in terms of s
107    s is normalized distance
108 ------------------------------------------------------------------------- */
109 
110 inline double SPH_KERNEL_NS::sph_kernel_spiky2d_cut()
111 {
112   return 2.;
113 }
114 
115 #endif
116 #endif
117 
118