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

Merge branch 'gizmo_fix' into 'master'

Added some extra sensibility checks to primitive variable drift.

See merge request !471
parents 8053d50a 4ac35966
No related branches found
No related tags found
1 merge request!471Added some extra sensibility checks to primitive variable drift.
...@@ -537,19 +537,24 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( ...@@ -537,19 +537,24 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
} }
/* drift the primitive variables based on the old fluxes */ /* drift the primitive variables based on the old fluxes */
p->primitives.rho += p->conserved.flux.mass * dt / p->geometry.volume; if (p->geometry.volume > 0.) {
p->primitives.rho += p->conserved.flux.mass * dt / p->geometry.volume;
}
p->primitives.v[0] += p->conserved.flux.momentum[0] * dt / p->conserved.mass; if (p->conserved.mass > 0.) {
p->primitives.v[1] += p->conserved.flux.momentum[1] * dt / p->conserved.mass; p->primitives.v[0] +=
p->primitives.v[2] += p->conserved.flux.momentum[2] * dt / p->conserved.mass; p->conserved.flux.momentum[0] * dt / p->conserved.mass;
p->primitives.v[1] +=
p->conserved.flux.momentum[1] * dt / p->conserved.mass;
p->primitives.v[2] +=
p->conserved.flux.momentum[2] * dt / p->conserved.mass;
#if !defined(EOS_ISOTHERMAL_GAS) #if !defined(EOS_ISOTHERMAL_GAS)
if (p->conserved.mass > 0.) {
const float u = p->conserved.energy + p->conserved.flux.energy * dt; const float u = p->conserved.energy + p->conserved.flux.energy * dt;
p->primitives.P = p->primitives.P =
hydro_gamma_minus_one * u * p->primitives.rho / p->conserved.mass; hydro_gamma_minus_one * u * p->primitives.rho / p->conserved.mass;
}
#endif #endif
}
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (p->h <= 0.) { if (p->h <= 0.) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment