Skip to content
Snippets Groups Projects
Commit 4cce485e authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Disabled GIZMO particle steering for vacuum particles. Disabled warning...

Disabled GIZMO particle steering for vacuum particles. Disabled warning messages for unphysical values and pathological configurations.
parent 7af1bb35
No related branches found
No related tags found
1 merge request!346Disabled GIZMO particle steering for vacuum particles
...@@ -68,12 +68,12 @@ ...@@ -68,12 +68,12 @@
#define GIZMO_UNPHYSICAL_RESCUE #define GIZMO_UNPHYSICAL_RESCUE
/* Show a warning message if an unphysical value was reset (only works if /* Show a warning message if an unphysical value was reset (only works if
GIZMO_UNPHYSICAL_RESCUE is also selected). */ GIZMO_UNPHYSICAL_RESCUE is also selected). */
#define GIZMO_UNPHYSICAL_WARNING //#define GIZMO_UNPHYSICAL_WARNING
/* Parameters that control how GIZMO handles pathological particle /* Parameters that control how GIZMO handles pathological particle
configurations. */ configurations. */
/* Show a warning message if a pathological configuration has been detected. */ /* 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. */ /* Crash if a pathological configuration has been detected. */
//#define GIZMO_PATHOLOGICAL_ERROR //#define GIZMO_PATHOLOGICAL_ERROR
/* Maximum allowed gradient matrix condition number. If the condition number of /* Maximum allowed gradient matrix condition number. If the condition number of
......
...@@ -105,42 +105,45 @@ __attribute__((always_inline)) INLINE static void hydro_velocities_set( ...@@ -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[0] = p->conserved.momentum[0] / p->conserved.mass;
p->v[1] = p->conserved.momentum[1] / p->conserved.mass; p->v[1] = p->conserved.momentum[1] / p->conserved.mass;
p->v[2] = p->conserved.momentum[2] / 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 #ifdef GIZMO_STEER_MOTION
/* Add a correction to the velocity to keep particle positions close enough to /* Add a correction to the velocity to keep particle positions close enough
the centroid of their mesh-free "cell". */ to
/* The correction term below is the same one described in Springel (2010). */ the centroid of their mesh-free "cell". */
float ds[3]; /* The correction term below is the same one described in Springel (2010).
ds[0] = p->geometry.centroid[0]; */
ds[1] = p->geometry.centroid[1]; float ds[3];
ds[2] = p->geometry.centroid[2]; ds[0] = p->geometry.centroid[0];
const float d = sqrtf(ds[0] * ds[0] + ds[1] * ds[1] + ds[2] * ds[2]); ds[1] = p->geometry.centroid[1];
const float R = get_radius_dimension_sphere(p->geometry.volume); ds[2] = p->geometry.centroid[2];
const float eta = 0.25; const float d = sqrtf(ds[0] * ds[0] + ds[1] * ds[1] + ds[2] * ds[2]);
const float etaR = eta * R; const float R = get_radius_dimension_sphere(p->geometry.volume);
const float xi = 1.; const float eta = 0.25;
const float soundspeed = const float etaR = eta * R;
sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho); const float xi = 1.;
/* We only apply the correction if the offset between centroid and position is const float soundspeed =
too large. */ sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho);
if (d > 0.9 * etaR) { /* We only apply the correction if the offset between centroid and position
float fac = xi * soundspeed / d; is
if (d < 1.1 * etaR) { too large. */
fac *= 5. * (d - 0.9 * etaR) / etaR; 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 #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 #endif // GIZMO_FIX_PARTICLES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment