20 static constexpr double pi = M_PI;
21 static constexpr double kernelSupportRadius = 2.5;
37 static inline double W(
const std::array<double, 3> &dr,
const double h) {
48 static inline double W(
const double dr2,
const double h) {
49 const double H = kernelSupportRadius * h;
51 const double s = sqrt(dr2) / H;
52 const double s1 = 1.0 - s;
53 const double s2 = std::max(0., 0.5 - s);
54 double r_value = (s1 * s1 * s1) - 4.0 * (s2 * s2 * s2);
56 r_value *= 16.0 / pi / (H * H * H);
75 static inline std::array<double, 3>
gradW(
const std::array<double, 3> &dr,
const double h) {
76 using namespace autopas::utils::ArrayMath::literals;
78 const double H = kernelSupportRadius * h;
80 const double s = drabs / H;
81 const double s1 = (1.0 - s < 0) ? 0 : 1.0 - s;
82 const double s2 = (0.5 - s < 0) ? 0 : 0.5 - s;
83 double r_value = -3.0 * (s1 * s1) + 12.0 * (s2 * s2);
85 r_value *= 16.0 / pi / (H * H * H);
86 const double scale = r_value / (drabs * H + 1.0e-6 * h);
class to define a kernel function for SPH simulations
Definition: SPHKernels.h:19
static double W(const double dr2, const double h)
A kernel function for sph simulations.
Definition: SPHKernels.h:48
static unsigned long getFlopsW()
returns the flops for one full calculation of the kernel
Definition: SPHKernels.cpp:11
static std::array< double, 3 > gradW(const std::array< double, 3 > &dr, const double h)
gradient of the kernel function W
Definition: SPHKernels.h:75
static double W(const std::array< double, 3 > &dr, const double h)
A kernel function for SPH simulations.
Definition: SPHKernels.h:37
static double getKernelSupportRadius()
Get the kernelSupportRadius.
Definition: SPHKernels.h:28
constexpr T dot(const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
Generates the dot product of two arrays.
Definition: ArrayMath.h:233
constexpr T L2Norm(const std::array< T, SIZE > &a)
Computes the L2Norm / Euclidean norm.
Definition: ArrayMath.h:265