Skip to content
Snippets Groups Projects
Commit aaab643a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Removed more debugging information

parent 177227c0
No related branches found
No related tags found
1 merge request!314Timestep order
...@@ -59,6 +59,4 @@ ...@@ -59,6 +59,4 @@
#define SOURCETERMS_NONE #define SOURCETERMS_NONE
//#define SOURCETERMS_SN_FEEDBACK //#define SOURCETERMS_SN_FEEDBACK
#define ICHECK 0
#endif /* SWIFT_CONST_H */ #endif /* SWIFT_CONST_H */
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
* @param ti_current Integer end of time-step * @param ti_current Integer end of time-step
*/ */
__attribute__((always_inline)) INLINE static void drift_gpart( __attribute__((always_inline)) INLINE static void drift_gpart(
struct gpart *restrict gp, double dt, double timeBase, integertime_t ti_old, struct gpart *restrict gp, float dt, double timeBase, integertime_t ti_old,
integertime_t ti_current) { integertime_t ti_current) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
...@@ -53,9 +53,6 @@ __attribute__((always_inline)) INLINE static void drift_gpart( ...@@ -53,9 +53,6 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
gp->ti_drift = ti_current; gp->ti_drift = ti_current;
#endif #endif
// message("dt= %e", dt);
// fprintf(files_timestep[gp->id_or_neg_offset], "drift: dt=%e\n", dt);
/* Drift... */ /* Drift... */
gp->x[0] += gp->v_full[0] * dt; gp->x[0] += gp->v_full[0] * dt;
gp->x[1] += gp->v_full[1] * dt; gp->x[1] += gp->v_full[1] * dt;
...@@ -78,7 +75,7 @@ __attribute__((always_inline)) INLINE static void drift_gpart( ...@@ -78,7 +75,7 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
* @param ti_current Integer end of time-step * @param ti_current Integer end of time-step
*/ */
__attribute__((always_inline)) INLINE static void drift_part( __attribute__((always_inline)) INLINE static void drift_part(
struct part *restrict p, struct xpart *restrict xp, double dt, struct part *restrict p, struct xpart *restrict xp, float dt,
double timeBase, integertime_t ti_old, integertime_t ti_current) { double timeBase, integertime_t ti_old, integertime_t ti_current) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
......
...@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static void kick_gpart( ...@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static void kick_gpart(
double timeBase) { double timeBase) {
/* Time interval for this half-kick */ /* Time interval for this half-kick */
const double dt = (ti_end - ti_start) * timeBase; const float dt = (ti_end - ti_start) * timeBase;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (gp->ti_kick != ti_start) if (gp->ti_kick != ti_start)
...@@ -75,7 +75,7 @@ __attribute__((always_inline)) INLINE static void kick_part( ...@@ -75,7 +75,7 @@ __attribute__((always_inline)) INLINE static void kick_part(
integertime_t ti_end, double timeBase) { integertime_t ti_end, double timeBase) {
/* Time interval for this half-kick */ /* Time interval for this half-kick */
const double dt = (ti_end - ti_start) * timeBase; const float dt = (ti_end - ti_start) * timeBase;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (p->ti_kick != ti_start) if (p->ti_kick != ti_start)
......
...@@ -64,33 +64,27 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep( ...@@ -64,33 +64,27 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
const struct gpart* restrict g) { const struct gpart* restrict g) {
const double G_newton = phys_const->const_newton_G; const float G_newton = phys_const->const_newton_G;
const double dx = g->x[0] - potential->x; const float dx = g->x[0] - potential->x;
const double dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const double dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
/* const float rinv = 1.f / sqrtf(dx * dx + dy * dy + dz * dz); */ const float rinv = 1.f / sqrtf(dx * dx + dy * dy + dz * dz);
/* const float rinv2 = rinv * rinv; */ const float rinv2 = rinv * rinv;
/* const float rinv3 = rinv2 * rinv; */ const float rinv3 = rinv2 * rinv;
/* const float drdv = (g->x[0] - potential->x) * (g->v_full[0]) + */ const float drdv = (g->x[0] - potential->x) * (g->v_full[0]) +
/* (g->x[1] - potential->y) * (g->v_full[1]) + */ (g->x[1] - potential->y) * (g->v_full[1]) +
/* (g->x[2] - potential->z) * (g->v_full[2]); */ (g->x[2] - potential->z) * (g->v_full[2]);
/* const float dota_x = G_newton * potential->mass * rinv3 * */ const float dota_x = G_newton * potential->mass * rinv3 *
/* (-g->v_full[0] + 3.f * rinv2 * drdv * dx); */ (-g->v_full[0] + 3.f * rinv2 * drdv * dx);
/* const float dota_y = G_newton * potential->mass * rinv3 * */ const float dota_y = G_newton * potential->mass * rinv3 *
/* (-g->v_full[1] + 3.f * rinv2 * drdv * dy); */ (-g->v_full[1] + 3.f * rinv2 * drdv * dy);
/* const float dota_z = G_newton * potential->mass * rinv3 * */ const float dota_z = G_newton * potential->mass * rinv3 *
/* (-g->v_full[2] + 3.f * rinv2 * drdv * dz); */ (-g->v_full[2] + 3.f * rinv2 * drdv * dz);
/* const float dota_2 = dota_x * dota_x + dota_y * dota_y + dota_z * dota_z; const float dota_2 = dota_x * dota_x + dota_y * dota_y + dota_z * dota_z;
*/ const float a_2 = g->a_grav[0] * g->a_grav[0] + g->a_grav[1] * g->a_grav[1] +
/* const float a_2 = g->a_grav[0] * g->a_grav[0] + g->a_grav[1] * g->a_grav[1] g->a_grav[2] * g->a_grav[2];
*/
/* + g->a_grav[2] * g->a_grav[2]; */ return potential->timestep_mult * sqrtf(a_2 / dota_2);
/* return potential->timestep_mult * sqrtf(a_2 / dota_2); */
const double r = sqrt(dx * dx + dy * dy + dz * dz);
return potential->timestep_mult *
sqrt(r * r * r / (G_newton * potential->mass));
} }
/** /**
...@@ -111,11 +105,11 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -111,11 +105,11 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
double time, const struct external_potential* restrict potential, double time, const struct external_potential* restrict potential,
const struct phys_const* restrict phys_const, struct gpart* restrict g) { const struct phys_const* restrict phys_const, struct gpart* restrict g) {
const double dx = g->x[0] - potential->x; const float dx = g->x[0] - potential->x;
const double dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const double dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
const double rinv = 1. / sqrt(dx * dx + dy * dy + dz * dz); const float rinv = 1.f / sqrtf(dx * dx + dy * dy + dz * dz);
const double rinv3 = rinv * rinv * rinv; const float rinv3 = rinv * rinv * rinv;
g->a_grav[0] += -potential->mass * dx * rinv3; g->a_grav[0] += -potential->mass * dx * rinv3;
g->a_grav[1] += -potential->mass * dy * rinv3; g->a_grav[1] += -potential->mass * dy * rinv3;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment