diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index 1caf49bff1696efd2a201b5953732c437ffd67a9..0636adec588dd2d215f9aaf2874af61a707ab532 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -48,7 +48,7 @@ __attribute__((always_inline)) INLINE static float cooling_rate( const struct cooling_function_data* cooling, const struct part* p) { /* Get particle density */ - const float rho = p->rho; + const float rho = hydro_get_density(p); /* Get cooling function properties */ const float X_H = cooling->hydrogen_mass_abundance; @@ -91,6 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( } else { u_new = u_floor; } + /* Update the internal energy */ hydro_set_internal_energy(p, u_new); diff --git a/src/cooling/const_lambda/cooling_struct.h b/src/cooling/const_lambda/cooling_struct.h index 6226ca3179175f15599f88d1c1264496b390a31e..30d4e5e4af9c7bd139337709897d8111f88d2aa8 100644 --- a/src/cooling/const_lambda/cooling_struct.h +++ b/src/cooling/const_lambda/cooling_struct.h @@ -28,7 +28,7 @@ */ struct cooling_function_data { - /*! Cooling rate in cgs units. Defined by 'rho * du/dt = -lambda * n_H^2'*/ + /*! Cooling rate in internal units */ double lambda; /*! Fraction of gas mass that is Hydrogen. Used to calculate n_H */ diff --git a/src/potential/isothermal/potential.h b/src/potential/isothermal/potential.h index 4dae388c7114d80774c68c2988ce6ce04cd63308..a582dce17daba0ac9705ef4ae1fc6be9db19315a 100644 --- a/src/potential/isothermal/potential.h +++ b/src/potential/isothermal/potential.h @@ -107,13 +107,13 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( const float dy = g->x[1] - potential->y; const float dz = g->x[2] - potential->z; - const float rinv2 = 1. / (dx * dx + dy * dy + dz * dz); + const float rinv2 = 1.f / (dx * dx + dy * dy + dz * dz); const double term = -potential->vrot2_over_G * rinv2; - g->a_grav[0] = term * dx; - g->a_grav[1] = term * dy; - g->a_grav[2] = term * dz; + g->a_grav[0] += term * dx; + g->a_grav[1] += term * dy; + g->a_grav[2] += term * dz; } /** diff --git a/src/potential/softened_isothermal/potential.h b/src/potential/softened_isothermal/potential.h index 893f0b92c98029ad167fdc8dfbbb7e1f353a3f9f..b28e5f7a17e0c7fd1956e099a8d4e21a5ec7ff20 100644 --- a/src/potential/softened_isothermal/potential.h +++ b/src/potential/softened_isothermal/potential.h @@ -118,9 +118,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( const double term = -potential->vrot2_over_G * r2_plus_epsilon2_inv; - g->a_grav[0] = term * dx; - g->a_grav[1] = term * dy; - g->a_grav[2] = term * dz; + g->a_grav[0] += term * dx; + g->a_grav[1] += term * dy; + g->a_grav[2] += term * dz; } /** diff --git a/src/runner.c b/src/runner.c index 2f9ca45d6d7d2d6ac01668acdc0ec74010800402..f5efc99d492be837509e50bd2674ab6923404446 100644 --- a/src/runner.c +++ b/src/runner.c @@ -52,7 +52,6 @@ #include "hydro_properties.h" #include "kick.h" #include "minmax.h" -#include "potential.h" #include "scheduler.h" #include "sourceterms.h" #include "space.h"