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

Merge branch 'fix_timestep_zoom' into 'master'

Use only min mass gas in time step

Closes #758

See merge request !1341
parents 068064ac c3c9903a
No related branches found
No related tags found
1 merge request!1341Use only min mass gas in time step
...@@ -601,9 +601,13 @@ the start and end times or scale factors from the parameter file. ...@@ -601,9 +601,13 @@ the start and end times or scale factors from the parameter file.
* Dimensionless pre-factor of the maximal allowed displacement: * Dimensionless pre-factor of the maximal allowed displacement:
``max_dt_RMS_factor`` (default: ``0.25``) ``max_dt_RMS_factor`` (default: ``0.25``)
* Whether or not only the gas particle masses should be considered for
the baryon component of the calculation: ``dt_RMS_use_gas_only`` (default: ``0``)
This value rarely needs altering. See the theory documents for its These values rarely need altering. The second parameter is only
precise meaning. meaningful if a subgrid model produces star (or other) particles with
masses substantially smaller than the gas masses. See the theory
documents for the precise meanings.
A full time-step section for a non-cosmological run would be: A full time-step section for a non-cosmological run would be:
...@@ -623,6 +627,7 @@ Whilst for a cosmological run, one would need: ...@@ -623,6 +627,7 @@ Whilst for a cosmological run, one would need:
dt_max: 1e-4 dt_max: 1e-4
dt_min: 1e-10 dt_min: 1e-10
max_dt_RMS_factor: 0.25 # Default optional value max_dt_RMS_factor: 0.25 # Default optional value
dt_RMS_use_gas_only: 0 # Default optional value
.. _Parameters_ICs: .. _Parameters_ICs:
... ...
......
...@@ -14,6 +14,7 @@ TimeIntegration: ...@@ -14,6 +14,7 @@ TimeIntegration:
dt_min: 1e-16 # The minimal time-step size of the simulation (in internal units). dt_min: 1e-16 # The minimal time-step size of the simulation (in internal units).
dt_max: 0.1 # The maximal time-step size of the simulation (in internal units). dt_max: 0.1 # The maximal time-step size of the simulation (in internal units).
max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities. max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities.
dt_RMS_use_gas_only: 1
# Cosmological parameters # Cosmological parameters
Cosmology: Cosmology:
... ...
......
...@@ -19,6 +19,7 @@ TimeIntegration: ...@@ -19,6 +19,7 @@ TimeIntegration:
dt_min: 1e-16 # The minimal time-step size of the simulation (in internal units). dt_min: 1e-16 # The minimal time-step size of the simulation (in internal units).
dt_max: 0.1 # The maximal time-step size of the simulation (in internal units). dt_max: 0.1 # The maximal time-step size of the simulation (in internal units).
max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities. max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities.
dt_RMS_use_gas_only: 1
# Cosmological parameters # Cosmological parameters
Cosmology: Cosmology:
... ...
......
...@@ -148,6 +148,7 @@ TimeIntegration: ...@@ -148,6 +148,7 @@ TimeIntegration:
dt_min: 1e-6 # The minimal time-step size of the simulation (in internal units). dt_min: 1e-6 # The minimal time-step size of the simulation (in internal units).
dt_max: 1e-2 # The maximal time-step size of the simulation (in internal units). dt_max: 1e-2 # The maximal time-step size of the simulation (in internal units).
max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities. max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities.
dt_RMS_use_gas_only: 0 # (Optional) When computing the max RMS dt, should only the gas particles be considered in the baryon component calculation?
# Parameters governing the snapshots # Parameters governing the snapshots
Snapshots: Snapshots:
... ...
......
...@@ -2820,6 +2820,8 @@ void engine_init( ...@@ -2820,6 +2820,8 @@ void engine_init(
e->dt_max_RMS_displacement = FLT_MAX; e->dt_max_RMS_displacement = FLT_MAX;
e->max_RMS_displacement_factor = parser_get_opt_param_double( e->max_RMS_displacement_factor = parser_get_opt_param_double(
params, "TimeIntegration:max_dt_RMS_factor", 0.25); params, "TimeIntegration:max_dt_RMS_factor", 0.25);
e->max_RMS_dt_use_only_gas = parser_get_opt_param_int(
params, "TimeIntegration:dt_RMS_use_gas_only", 0);
e->dt_kick_grav_mesh_for_io = 0.f; e->dt_kick_grav_mesh_for_io = 0.f;
e->a_first_statistics = e->a_first_statistics =
parser_get_opt_param_double(params, "Statistics:scale_factor_first", 0.1); parser_get_opt_param_double(params, "Statistics:scale_factor_first", 0.1);
...@@ -3115,9 +3117,12 @@ void engine_recompute_displacement_constraint(struct engine *e) { ...@@ -3115,9 +3117,12 @@ void engine_recompute_displacement_constraint(struct engine *e) {
/* Baryon case */ /* Baryon case */
if (N_b > 0.f) { if (N_b > 0.f) {
/* Minimal mass for the baryons */ /* Minimal mass for the bayons */
const float min_mass_b = float min_mass_b;
min4(min_mass[0], min_mass[3], min_mass[4], min_mass[5]); if (e->max_RMS_dt_use_only_gas)
min_mass_b = min_mass[0];
else
min_mass_b = min4(min_mass[0], min_mass[3], min_mass[4], min_mass[5]);
/* Inter-particle sepration for the baryons */ /* Inter-particle sepration for the baryons */
const float d_b = cbrtf(min_mass_b / (Ob * rho_crit0)); const float d_b = cbrtf(min_mass_b / (Ob * rho_crit0));
... ...
......
...@@ -163,6 +163,10 @@ struct engine { ...@@ -163,6 +163,10 @@ struct engine {
/* Dimensionless factor for the RMS time-step condition. */ /* Dimensionless factor for the RMS time-step condition. */
double max_RMS_displacement_factor; double max_RMS_displacement_factor;
/* When computing the max RMS dt, should only the gas particles
* be considered as the baryon component? */
int max_RMS_dt_use_only_gas;
/* Time of the simulation beginning */ /* Time of the simulation beginning */
double time_begin; double time_begin;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment