Commit 62e0011a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'energy_conservation' into 'master'

Time integration mistake ?

Noticed this time integration mistake whilst working on the gravity code. Could this explain the non-conservation of energy ?

See merge request !196
parents 794a9482 c7378f2c
...@@ -251,8 +251,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( ...@@ -251,8 +251,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
p->entropy *= 0.5f; p->entropy *= 0.5f;
/* Do not 'overcool' when timestep increases */ /* Do not 'overcool' when timestep increases */
if (p->entropy + 0.5f * p->entropy_dt * dt < 0.5f * p->entropy) if (p->entropy + p->entropy_dt * half_dt < 0.5f * p->entropy)
p->entropy_dt = -0.5f * p->entropy / dt; p->entropy_dt = -0.5f * p->entropy / half_dt;
} }
/** /**
......
Supports Markdown
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