From ec80cf2bf8d2c05b65959ad02810bd2788a43425 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Mon, 9 Mar 2020 16:06:59 +0000 Subject: [PATCH] Give a sensible DM softening also for runs without DM --- examples/HydroTests/EvrardCollapse_3D/evrard.yml | 7 +++---- examples/Planetary/EarthImpact/earth_impact.yml | 7 +++---- src/gravity_properties.c | 6 ++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/HydroTests/EvrardCollapse_3D/evrard.yml b/examples/HydroTests/EvrardCollapse_3D/evrard.yml index c14f9151b5..ab43864638 100644 --- a/examples/HydroTests/EvrardCollapse_3D/evrard.yml +++ b/examples/HydroTests/EvrardCollapse_3D/evrard.yml @@ -31,10 +31,9 @@ SPH: # Parameters for the self-gravity scheme Gravity: - eta: 0.025 # Constant dimensionless multiplier for time integration. - theta: 0.9 - comoving_softening: 0.001 # Comoving softening length (in internal units). - max_physical_softening: 0.001 # Physical softening length (in internal units). + eta: 0.025 # Constant dimensionless multiplier for time integration. + theta: 0.7 + max_physical_baryon_softening: 0.001 # Physical softening length (in internal units). # Parameters related to the initial conditions InitialConditions: diff --git a/examples/Planetary/EarthImpact/earth_impact.yml b/examples/Planetary/EarthImpact/earth_impact.yml index b1df0a6974..83aa4d027b 100644 --- a/examples/Planetary/EarthImpact/earth_impact.yml +++ b/examples/Planetary/EarthImpact/earth_impact.yml @@ -44,10 +44,9 @@ SPH: # Parameters for the self-gravity scheme Gravity: - eta: 0.025 # Constant dimensionless multiplier for time integration. - theta: 0.7 # Opening angle (Multipole acceptance criterion) - comoving_baryon_softening: 0.003 # Comoving softening length (in internal units). - max_physical_baryon_softening: 0.003 # Physical softening length (in internal units). + eta: 0.025 # Constant dimensionless multiplier for time integration. + theta: 0.7 # Opening angle (Multipole acceptance criterion) + max_physical_baryon_softening: 0.003 # Physical softening length (in internal units). # Parameters for the task scheduling Scheduler: diff --git a/src/gravity_properties.c b/src/gravity_properties.c index 6b21b20b8e..cd7a890917 100644 --- a/src/gravity_properties.c +++ b/src/gravity_properties.c @@ -151,6 +151,12 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params, params, "Gravity:max_physical_baryon_softening"); } + /* Some gravity models use the DM softening as the one and only softening + length that exists. So, if we don't have DM (e.g. hydro test or planetary + physics), we must have a non-zero epsilon. */ + if (!has_DM && has_baryons) + p->epsilon_DM_max_physical = p->epsilon_baryon_max_physical; + p->epsilon_DM_comoving = p->epsilon_DM_max_physical; p->epsilon_baryon_comoving = p->epsilon_baryon_max_physical; } -- GitLab