Commit a15bfe22 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Improved referencing of the Gadget-2 SPH-scheme

parent aad1163b
......@@ -19,6 +19,18 @@
#ifndef SWIFT_GADGET2_HYDRO_H
#define SWIFT_GADGET2_HYDRO_H
/**
* @file Gadget2/hydro.h
* @brief SPH interaction functions following the Gadget-2 version of SPH.
*
* The interactions computed here are the ones presented in the Gadget-2 paper
* Springel, V., MNRAS, Volume 364, Issue 4, pp. 1105-1134.
* We use the same numerical coefficients as the Gadget-2 code. When used with
* the Spline-3 kernel, the results should be equivalent to the ones obtained
* with Gadget-2 up to the rounding errors and interactions missed by the
* Gadget-2 tree-code neighbours search.
*/
#include "adiabatic_index.h"
#include "approx_math.h"
#include "dimension.h"
......
......@@ -20,18 +20,20 @@
#ifndef SWIFT_GADGET2_HYDRO_IACT_H
#define SWIFT_GADGET2_HYDRO_IACT_H
#include "minmax.h"
/**
* @file Gadget2/hydro_iact.h
* @brief SPH interaction functions following the Gadget-2 version of SPH.
*
* The interactions computed here are the ones presented in the Gadget-2 paper
* and use the same numerical coefficients as the Gadget-2 code. When used with
* Springel, V., MNRAS, Volume 364, Issue 4, pp. 1105-1134.
* We use the same numerical coefficients as the Gadget-2 code. When used with
* the Spline-3 kernel, the results should be equivalent to the ones obtained
* with Gadget-2 up to the rounding errors and interactions missed by the
* Gadget-2 tree-code neighbours search.
*/
#include "minmax.h"
/**
* @brief Density loop
*/
......
......@@ -19,6 +19,18 @@
#ifndef SWIFT_GADGET2_HYDRO_PART_H
#define SWIFT_GADGET2_HYDRO_PART_H
/**
* @file Gadget2/hydro_part.h
* @brief SPH interaction functions following the Gadget-2 version of SPH.
*
* The interactions computed here are the ones presented in the Gadget-2 paper
* Springel, V., MNRAS, Volume 364, Issue 4, pp. 1105-1134.
* We use the same numerical coefficients as the Gadget-2 code. When used with
* the Spline-3 kernel, the results should be equivalent to the ones obtained
* with Gadget-2 up to the rounding errors and interactions missed by the
* Gadget-2 tree-code neighbours search.
*/
#include "cooling_struct.h"
/* Extra particle data not needed during the SPH loops over neighbours. */
......
......@@ -29,9 +29,8 @@
* term is implemented.
*
* This corresponds to equations (43), (44), (45), (101), (103) and (104) with
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of
* Price, D., Journal of Computational Physics, 2012, Volume 231, Issue 3,
* pp. 759-794.
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of Price, D., Journal of Computational
* Physics, 2012, Volume 231, Issue 3, pp. 759-794.
*/
#include "adiabatic_index.h"
......
......@@ -28,9 +28,8 @@
* term is implemented.
*
* This corresponds to equations (43), (44), (45), (101), (103) and (104) with
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of
* Price, D., Journal of Computational Physics, 2012, Volume 231, Issue 3,
* pp. 759-794.
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of Price, D., Journal of Computational
* Physics, 2012, Volume 231, Issue 3, pp. 759-794.
*/
#include "adiabatic_index.h"
......
......@@ -28,9 +28,8 @@
* term is implemented.
*
* This corresponds to equations (43), (44), (45), (101), (103) and (104) with
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of
* Price, D., Journal of Computational Physics, 2012, Volume 231, Issue 3,
* pp. 759-794.
* \f$\beta=3\f$ and \f$\alpha_u=0\f$ of Price, D., Journal of Computational
* Physics, 2012, Volume 231, Issue 3, pp. 759-794.
*/
#include "cooling_struct.h"
......@@ -44,13 +43,14 @@
*/
struct xpart {
float x_diff[3]; /*!< Offset between current position and position at last
tree rebuild. */
/*! Offset between current position and position at last tree rebuild. */
float x_diff[3];
float v_full[3]; /*!< Velocity at the last full step. */
/*! Velocity at the last full step. */
float v_full[3];
struct cooling_xpart_data
cooling_data; /*!< Additional data used to record cooling information */
/*! Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
} SWIFT_STRUCT_ALIGN;
......@@ -63,27 +63,38 @@ struct xpart {
*/
struct part {
double x[3]; /*!< Particle position. */
/*! Particle position. */
double x[3];
float v[3]; /*!< Particle predicted velocity. */
/*! Particle predicted velocity. */
float v[3];
float a_hydro[3]; /*!< Particle acceleration. */
/*! Particle acceleration. */
float a_hydro[3];
float mass; /*!< Particle mass. */
/*! Particle mass. */
float mass;
float h; /*!< Particle smoothing length. */
/*! Particle smoothing length. */
float h;
int ti_begin; /*!< Time at the beginning of time-step. */
/*! Time at the beginning of time-step. */
int ti_begin;
int ti_end; /*!< Time at the end of time-step. */
/*! Time at the end of time-step. */
int ti_end;
float u; /*!< Particle internal energy. */
/*! Particle internal energy. */
float u;
float u_dt; /*!< Time derivative of the internal energy. */
/*! Time derivative of the internal energy. */
float u_dt;
float rho; /*!< Particle density. */
/*! Particle density. */
float rho;
float rho_dh; /*!< Derivative of density with respect to h */
/*! Derivative of density with respect to h */
float rho_dh;
/* Store density/force specific stuff. */
union {
......@@ -97,10 +108,12 @@ struct part {
*/
struct {
float wcount; /*!< Neighbour number count. */
/*! Neighbour number count. */
float wcount;
/*! Derivative of the neighbour number with respect to h. */
float wcount_dh;
float wcount_dh; /*!< Derivative of the neighbour number with respect to
h. */
} density;
/**
......@@ -112,19 +125,24 @@ struct part {
*/
struct {
float pressure; /*!< Particle pressure. */
/*! Particle pressure. */
float pressure;
float v_sig; /*!< Particle signal velocity */
/*! Particle signal velocity */
float v_sig;
float h_dt; /*!< Time derivative of smoothing length */
/*! Time derivative of smoothing length */
float h_dt;
} force;
};
long long id; /*!< Particle unique ID. */
/*! Particle unique ID. */
long long id;
struct gpart* gpart; /*!< Pointer to corresponding gravity part. */
/*! Pointer to corresponding gravity part. */
struct gpart* gpart;
} __attribute__((aligned(part_align)));
} SWIFT_STRUCT_ALIGN;
#endif /* SWIFT_MINIMAL_HYDRO_PART_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment