From d908d35ff8a9b52cb8da1bb61f84ceb832335138 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 20 Jul 2016 15:05:44 +0100 Subject: [PATCH] Remove wrong factors in prepare_force() for DEFAULT_SPH --- src/const.h | 4 ++-- src/hydro/Default/hydro.h | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/const.h b/src/const.h index 65404d6a3e..e3a7756f5e 100644 --- a/src/const.h +++ b/src/const.h @@ -56,8 +56,8 @@ /* SPH variant to use */ //#define MINIMAL_SPH -#define GADGET2_SPH -//#define DEFAULT_SPH +//#define GADGET2_SPH +#define DEFAULT_SPH /* Gravity properties */ #define EXTERNAL_POTENTIAL_POINTMASS diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index ee693d6099..a316eb21db 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -136,15 +136,12 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force( /* Some smoothing length multiples. */ const float h = p->h; const float ih = 1.0f / h; - const float ih2 = ih * ih; - const float ih4 = ih2 * ih2; /* Pre-compute some stuff for the balsara switch. */ - const float normDiv_v = fabs(p->density.div_v / p->rho * ih4); + const float normDiv_v = fabs(p->density.div_v); const float normRot_v = sqrtf(p->density.rot_v[0] * p->density.rot_v[0] + p->density.rot_v[1] * p->density.rot_v[1] + - p->density.rot_v[2] * p->density.rot_v[2]) / - p->rho * ih4; + p->density.rot_v[2] * p->density.rot_v[2]); /* Compute this particle's sound speed. */ const float u = p->u; -- GitLab