Skip to content
Snippets Groups Projects
Commit c3c9903a authored by Loic Hausammann's avatar Loic Hausammann Committed by Matthieu Schaller
Browse files

Use only min mass gas in time step

parent 068064ac
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
This value rarely needs altering. See the theory documents for its the baryon component of the calculation: ``dt_RMS_use_gas_only`` (default: ``0``)
precise meaning.
These values rarely need altering. The second parameter is only
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:
...@@ -620,10 +624,11 @@ Whilst for a cosmological run, one would need: ...@@ -620,10 +624,11 @@ Whilst for a cosmological run, one would need:
.. code:: YAML .. code:: YAML
TimeIntegration: TimeIntegration:
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:
Initial Conditions Initial Conditions
......
...@@ -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,7 +19,8 @@ TimeIntegration: ...@@ -19,7 +19,8 @@ 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:
h: 0.673 # Reduced Hubble constant h: 0.673 # Reduced Hubble constant
......
...@@ -143,12 +143,13 @@ Scheduler: ...@@ -143,12 +143,13 @@ Scheduler:
# Parameters governing the time integration (Set dt_min and dt_max to the same value for a fixed time-step run.) # Parameters governing the time integration (Set dt_min and dt_max to the same value for a fixed time-step run.)
TimeIntegration: TimeIntegration:
time_begin: 0. # The starting time of the simulation (in internal units). time_begin: 0. # The starting time of the simulation (in internal units).
time_end: 1. # The end time of the simulation (in internal units). time_end: 1. # The end time of the simulation (in internal units).
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:
basename: output # Common part of the name of output files. basename: output # Common part of the name of output files.
......
...@@ -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 register or to comment