Commit 491be102 authored by John Helly's avatar John Helly

Merge branch 'master' into hashmap_mesh

parents 1a9a55d9 520b031f
......@@ -192,6 +192,18 @@ __attribute__((always_inline)) INLINE static void gravity_end_force(
struct gpart* gp, float const_G, const float potential_normalisation,
const int periodic) {
/* Record the norm of the acceleration for the adaptive opening criteria.
* Will always be an (active) timestep behind. */
gp->old_a_grav_norm = gp->a_grav[0] * gp->a_grav[0] +
gp->a_grav[1] * gp->a_grav[1] +
gp->a_grav[2] * gp->a_grav[2];
gp->old_a_grav_norm = sqrtf(gp->old_a_grav_norm);
#ifdef SWIFT_DEBUG_CHECKS
if (gp->old_a_grav_norm == 0.f) error("Old acceleration is 0!");
#endif
/* Let's get physical... */
gp->a_grav[0] *= const_G;
gp->a_grav[1] *= const_G;
......@@ -254,6 +266,7 @@ __attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
struct gpart* gp, const struct gravity_props* grav_props) {
gp->time_bin = 0;
gp->old_a_grav_norm = 0.f;
gravity_init_gpart(gp);
}
......
......@@ -42,6 +42,9 @@ struct gpart {
/*! Particle mass. */
float mass;
/*! Norm of the acceleration at the previous step. */
float old_a_grav_norm;
/*! Particle FoF properties (group ID, group size, ...) */
struct fof_gpart_data fof_data;
......
......@@ -176,6 +176,18 @@ __attribute__((always_inline)) INLINE static void gravity_end_force(
/* Apply the periodic correction to the peculiar potential */
if (periodic) gp->potential += potential_normalisation;
/* Record the norm of the acceleration for the adaptive opening criteria.
* Will always be an (active) timestep behind. */
gp->old_a_grav_norm = gp->a_grav[0] * gp->a_grav[0] +
gp->a_grav[1] * gp->a_grav[1] +
gp->a_grav[2] * gp->a_grav[2];
gp->old_a_grav_norm = sqrtf(gp->old_a_grav_norm);
#ifdef SWIFT_DEBUG_CHECKS
if (gp->old_a_grav_norm == 0.f) error("Old acceleration is 0!");
#endif
/* Let's get physical... */
gp->a_grav[0] *= const_G;
gp->a_grav[1] *= const_G;
......@@ -236,6 +248,7 @@ __attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
struct gpart* gp, const struct gravity_props* grav_props) {
gp->time_bin = 0;
gp->old_a_grav_norm = 0.f;
gravity_init_gpart(gp);
}
......
......@@ -39,11 +39,14 @@ struct gpart {
/*! Particle acceleration. */
float a_grav[3];
/*! Gravitational potential */
float potential;
/*! Particle mass. */
float mass;
/*! Gravitational potential */
float potential;
/*! Norm of the acceleration at the previous step. */
float old_a_grav_norm;
/*! Particle FoF properties (group ID, group size, ...) */
struct fof_gpart_data fof_data;
......
......@@ -27,4 +27,4 @@ ytick.direction: in
axes.axisbelow: False
# Setup colours
axes.prop_cycle: cycler('color', ['00AEFF','FF8C40','CC4314', '5766B3', '68246D'])
axes.prop_cycle: cycler('color', ['5EEA8C', '00AEFF','FF8C40', 'A646FF', 'CC4314', '5766B3', '68246D'])
\ No newline at end of file
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