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 
36     Andreas Aigner (JKU Linz))
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         4,
49         spiky,
50         sph_kernel_spiky,
51         sph_kernel_spiky_der,
52         sph_kernel_spiky_cut
53     )
54 
55 #else
56 
57 #ifndef LMP_SPH_KERNEL_SPIKY
58 #define LMP_SPH_KERNEL_SPIKY
59 
60 namespace SPH_KERNEL_NS {
61   inline double sph_kernel_spiky(double s, double h, double hinv);
62   inline double sph_kernel_spiky_der(double s, double h, double hinv);
63   inline double sph_kernel_spiky_cut();
64 }
65 
66 /* ----------------------------------------------------------------------
67    Cubic spline SPH kernel
68    h is kernel parameter
69    s is distance normalized by h
70    4.7746 is 15 over pi
71    0.07460388 is 15 over 64*pi
72 ------------------------------------------------------------------------- */
73 
74 inline double SPH_KERNEL_NS::sph_kernel_spiky(double s, double, double hinv)
75 {
76   if (s < 2.)
77   {
78       return (0.07460388*hinv*hinv*hinv * (2.-s)*(2.-s)*(2.-s));
79   }
80   else
81   {
82       return 0;
83   }
84   /*
85     if (s < 1.)
86     {
87         return (4.7746*hinv*hinv*hinv * (1.-s)*(1.-s)*(1.-s));
88     }
89     else
90     {
91         return 0;
92     }
93   */
94 }
95 
96 /* ----------------------------------------------------------------------
97    Derivative of cubic spline SPH kernel
98    is equal to grad W if multiplied with radial unit vector
99    h is kernel parameter
100    s is distance normalized by h
101    14.323944876 is 45 over pi
102    0.223811639 is 45 over 64*pi
103 ------------------------------------------------------------------------- */
104 
105 inline double SPH_KERNEL_NS::sph_kernel_spiky_der(double s, double, double hinv)
106 {
107     if (s < 2.)
108     {
109         return (-0.223811639*hinv*hinv*hinv*hinv * (2.-s)*(2.-s));
110     }
111     else
112     {
113         return 0;
114     }
115   /*
116     if (s < 1.)
117     {
118         return (-14.324*hinv*hinv*hinv*hinv * (1.-s)*(1.-s));
119     }
120     else
121     {
122         return 0;
123     }
124   */
125 }
126 
127 /* ----------------------------------------------------------------------
128    Definition of cubic spline SPH kernel cutoff in terms of s
129    s is normalized distance
130 ------------------------------------------------------------------------- */
131 
132 inline double SPH_KERNEL_NS::sph_kernel_spiky_cut()
133 {
134   return 2.;
135   /*
136     return 1.;
137   */
138 }
139 
140 #endif
141 #endif
142 
143