diff --git a/doc/RTD/source/ParameterFiles/parameter_description.rst b/doc/RTD/source/ParameterFiles/parameter_description.rst index f29d5a6b47b3ad5e0e3bf9f1575eed254718ae37..45b68c9e9c490df52de675ba3d37011d4b48222b 100644 --- a/doc/RTD/source/ParameterFiles/parameter_description.rst +++ b/doc/RTD/source/ParameterFiles/parameter_description.rst @@ -601,9 +601,13 @@ the start and end times or scale factors from the parameter file. * Dimensionless pre-factor of the maximal allowed displacement: ``max_dt_RMS_factor`` (default: ``0.25``) - -This value rarely needs altering. See the theory documents for its -precise meaning. +* 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``) + +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: @@ -620,10 +624,11 @@ Whilst for a cosmological run, one would need: .. code:: YAML TimeIntegration: - dt_max: 1e-4 - dt_min: 1e-10 - max_dt_RMS_factor: 0.25 # Default optional value - + dt_max: 1e-4 + dt_min: 1e-10 + max_dt_RMS_factor: 0.25 # Default optional value + dt_RMS_use_gas_only: 0 # Default optional value + .. _Parameters_ICs: Initial Conditions diff --git a/examples/GEAR/AgoraCosmo/agora_cosmo.yml b/examples/GEAR/AgoraCosmo/agora_cosmo.yml index 74b4d855b5ad5c9fedfefbb38bcfbdbfd4608046..b4c4b6b9dac625f835e2baca017d1e3f07bec5f5 100644 --- a/examples/GEAR/AgoraCosmo/agora_cosmo.yml +++ b/examples/GEAR/AgoraCosmo/agora_cosmo.yml @@ -14,6 +14,7 @@ TimeIntegration: 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). 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 Cosmology: diff --git a/examples/GEAR/ZoomIn/zoom_in.yml b/examples/GEAR/ZoomIn/zoom_in.yml index feb87d67b6c46b74b084a787784c0ce17bc18e62..9e9135d04deecd15632517b123e24915a5ccfad5 100644 --- a/examples/GEAR/ZoomIn/zoom_in.yml +++ b/examples/GEAR/ZoomIn/zoom_in.yml @@ -19,7 +19,8 @@ TimeIntegration: 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). 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 Cosmology: h: 0.673 # Reduced Hubble constant diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 8239c4c44b820220d511e828551ef72e2f3ce214..bbc0807bbf19af836e0247ed957509448ecaebef 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -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.) TimeIntegration: - time_begin: 0. # The starting 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_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. - + time_begin: 0. # The starting 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_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. + 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 Snapshots: basename: output # Common part of the name of output files. diff --git a/src/engine.c b/src/engine.c index ef2857c5d0706b70cc79bcf3c87fe8cfa60d4e0e..c09a55eb32d06ea8a70e3441746014dffba19187 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2820,6 +2820,8 @@ void engine_init( e->dt_max_RMS_displacement = FLT_MAX; e->max_RMS_displacement_factor = parser_get_opt_param_double( 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->a_first_statistics = parser_get_opt_param_double(params, "Statistics:scale_factor_first", 0.1); @@ -3115,9 +3117,12 @@ void engine_recompute_displacement_constraint(struct engine *e) { /* Baryon case */ if (N_b > 0.f) { - /* Minimal mass for the baryons */ - const float min_mass_b = - min4(min_mass[0], min_mass[3], min_mass[4], min_mass[5]); + /* Minimal mass for the bayons */ + float min_mass_b; + 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 */ const float d_b = cbrtf(min_mass_b / (Ob * rho_crit0)); diff --git a/src/engine.h b/src/engine.h index 248df75026519061f7e5f2944448d152eeddb809..e83c21f1928d7cbef540cb2d6220b559ade4e165 100644 --- a/src/engine.h +++ b/src/engine.h @@ -163,6 +163,10 @@ struct engine { /* Dimensionless factor for the RMS time-step condition. */ 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 */ double time_begin;