Select Git revision
gravity_softened_derivatives.h
gravity_softened_derivatives.h 16.54 KiB
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_GRAVITY_SOFTENED_DERIVATIVE_H
#define SWIFT_GRAVITY_SOFTENED_DERIVATIVE_H
/**
* @file gravity_softened_derivatives.h
* @brief Derivatives of the softened gravitational potential.
*
* We use the notation of Dehnen, Computational Astrophysics and Cosmology,
* 1, 1, pp. 24 (2014), arXiv:1405.2255
*/
/* Config parameters. */
#include "../config.h"
/* Local headers. */
#include "inline.h"
#include "kernel_gravity.h"
#if 0
/*************************/
/* 0th order derivatives */
/*************************/
/**
* @brief \f$ \phi(r_x, r_y, r_z, h) \f$.
*
* @param r_x x-coordinate of the distance vector (\f$ r_x \f$).
* @param r_y y-coordinate of the distance vector (\f$ r_y \f$).
* @param r_z z-coordinate of the distance vector (\f$ r_z \f$).
* @param r Norm of the distance vector (\f$ |r| \f$).
* @param eps_inv Inverse of the softening length (\f$ 1/h \f$).
*/
__attribute__((always_inline)) INLINE static double D_soft_000(
double r_x, double r_y, double r_z, double r, double eps_inv) {
const double u = r * eps_inv;
return eps_inv * D_soft_0(u);
}
/*************************/
/* 1st order derivatives */
/*************************/
/**
* @brief \f$ \frac{\partial\phi(r_x, r_y, r_z, h)}{\partial r_x} \f$.
*
* @param r_x x-coordinate of the distance vector (\f$ r_x \f$).
* @param r_y y-coordinate of the distance vector (\f$ r_y \f$).
* @param r_z z-coordinate of the distance vector (\f$ r_z \f$).
* @param r Norm of the distance vector (\f$ |r| \f$).
* @param eps_inv Inverse of the softening length (\f$ 1/h \f$).