From 4cce485e0965bd4a3c7a19d1fcf4a7b9252a5b75 Mon Sep 17 00:00:00 2001 From: Bert Vandenbroucke <bert.vandenbroucke@gmail.com> Date: Tue, 23 May 2017 12:14:11 +0100 Subject: [PATCH] Disabled GIZMO particle steering for vacuum particles. Disabled warning messages for unphysical values and pathological configurations. --- src/const.h | 4 +- src/hydro/Gizmo/hydro_velocities.h | 63 ++++++++++++++++-------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/const.h b/src/const.h index 144049d6b6..141eb48acc 100644 --- a/src/const.h +++ b/src/const.h @@ -68,12 +68,12 @@ #define GIZMO_UNPHYSICAL_RESCUE /* Show a warning message if an unphysical value was reset (only works if GIZMO_UNPHYSICAL_RESCUE is also selected). */ -#define GIZMO_UNPHYSICAL_WARNING +//#define GIZMO_UNPHYSICAL_WARNING /* Parameters that control how GIZMO handles pathological particle configurations. */ /* Show a warning message if a pathological configuration has been detected. */ -#define GIZMO_PATHOLOGICAL_WARNING +//#define GIZMO_PATHOLOGICAL_WARNING /* Crash if a pathological configuration has been detected. */ //#define GIZMO_PATHOLOGICAL_ERROR /* Maximum allowed gradient matrix condition number. If the condition number of diff --git a/src/hydro/Gizmo/hydro_velocities.h b/src/hydro/Gizmo/hydro_velocities.h index a0c896d600..08ba1f972b 100644 --- a/src/hydro/Gizmo/hydro_velocities.h +++ b/src/hydro/Gizmo/hydro_velocities.h @@ -105,42 +105,45 @@ __attribute__((always_inline)) INLINE static void hydro_velocities_set( p->v[0] = p->conserved.momentum[0] / p->conserved.mass; p->v[1] = p->conserved.momentum[1] / p->conserved.mass; p->v[2] = p->conserved.momentum[2] / p->conserved.mass; - } else { - /* Vacuum particles have no fluid velocity. */ - p->v[0] = 0.; - p->v[1] = 0.; - p->v[2] = 0.; - } #ifdef GIZMO_STEER_MOTION - /* Add a correction to the velocity to keep particle positions close enough to - the centroid of their mesh-free "cell". */ - /* The correction term below is the same one described in Springel (2010). */ - float ds[3]; - ds[0] = p->geometry.centroid[0]; - ds[1] = p->geometry.centroid[1]; - ds[2] = p->geometry.centroid[2]; - const float d = sqrtf(ds[0] * ds[0] + ds[1] * ds[1] + ds[2] * ds[2]); - const float R = get_radius_dimension_sphere(p->geometry.volume); - const float eta = 0.25; - const float etaR = eta * R; - const float xi = 1.; - const float soundspeed = - sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho); - /* We only apply the correction if the offset between centroid and position is - too large. */ - if (d > 0.9 * etaR) { - float fac = xi * soundspeed / d; - if (d < 1.1 * etaR) { - fac *= 5. * (d - 0.9 * etaR) / etaR; + /* Add a correction to the velocity to keep particle positions close enough + to + the centroid of their mesh-free "cell". */ + /* The correction term below is the same one described in Springel (2010). + */ + float ds[3]; + ds[0] = p->geometry.centroid[0]; + ds[1] = p->geometry.centroid[1]; + ds[2] = p->geometry.centroid[2]; + const float d = sqrtf(ds[0] * ds[0] + ds[1] * ds[1] + ds[2] * ds[2]); + const float R = get_radius_dimension_sphere(p->geometry.volume); + const float eta = 0.25; + const float etaR = eta * R; + const float xi = 1.; + const float soundspeed = + sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho); + /* We only apply the correction if the offset between centroid and position + is + too large. */ + if (d > 0.9 * etaR) { + float fac = xi * soundspeed / d; + if (d < 1.1 * etaR) { + fac *= 5. * (d - 0.9 * etaR) / etaR; + } + p->v[0] -= ds[0] * fac; + p->v[1] -= ds[1] * fac; + p->v[2] -= ds[2] * fac; } - p->v[0] -= ds[0] * fac; - p->v[1] -= ds[1] * fac; - p->v[2] -= ds[2] * fac; - } #endif // GIZMO_STEER_MOTION + } else { + /* Vacuum particles have no fluid velocity. */ + p->v[0] = 0.; + p->v[1] = 0.; + p->v[2] = 0.; + } #endif // GIZMO_FIX_PARTICLES -- GitLab