Commit 91f40ec4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Modify the time-step multiplier in the Lambda-cooling model, if the user wishes to.

parent cb952932
......@@ -39,7 +39,7 @@ Gravity:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 10 # (internal units)
minimal_temperature: 10. # Kelvin
# Parameters related to the initial conditions
InitialConditions:
......@@ -50,9 +50,6 @@ InitialConditions:
# Dimensionless pre-factor for the time-step condition
LambdaCooling:
lambda_cgs: 1.0e-22 # Cooling rate (in cgs units)
minimum_temperature: 1.0e2 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
# Cooling with Grackle 2.0
......
......@@ -27,6 +27,7 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 100. # Kelvin
# Parameters related to the initial conditions
InitialConditions:
......@@ -35,9 +36,6 @@ InitialConditions:
# Dimensionless pre-factor for the time-step condition
LambdaCooling:
lambda_cgs: 1.0e-22 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
# Cooling with Grackle 2.0
......
......@@ -27,7 +27,8 @@ Snapshots:
SPH:
resolution_eta: 1.2349 # Target smoothing length in units of the mean inter-particle separation (1.2349 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 1e4 # Kelvin
# Parameters related to the initial conditions
InitialConditions:
file_name: CoolingHalo.hdf5 # The file to read
......@@ -41,7 +42,4 @@ IsothermalPotential:
# Cooling parameters
LambdaCooling:
lambda_cgs: 1.0e-22 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
......@@ -27,6 +27,7 @@ Snapshots:
SPH:
resolution_eta: 1.2349 # Target smoothing length in units of the mean inter-particle separation (1.2349 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 1e4 # Kelvin
# Parameters related to the initial conditions
InitialConditions:
......@@ -41,7 +42,4 @@ IsothermalPotential:
# Cooling parameters
LambdaCooling:
lambda_cgs: 1.0e-22 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 0.1 # Dimensionless pre-factor for the time-step condition
......@@ -7,6 +7,11 @@ on the options to cancel the h-factors and a-factors at reading time.
We generate gas from the ICs using SWIFT's internal mechanism and set the
temperature to the expected gas temperature at this redshift.
This example runs with cooling switch on. Depending on the cooling
model chosen at the time SWIFT was configured, the answer will be
different. Interesting cases to compare to the no-cooling case are
a constant cooling rate or Compton cooling.
The 'plotTempEvolution.py' plots the temperature evolution of the gas
in the simulated volume.
......
......@@ -59,5 +59,4 @@ InitialConditions:
# Constant lambda cooling function
LambdaCooling:
lambda_cgs: 1e-30 # Cooling rate (in cgs units)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
lambda_cgs: 1e-26 # Cooling rate (in cgs units)
......@@ -199,10 +199,7 @@ ConstCooling:
# Constant lambda cooling function
LambdaCooling:
lambda_cgs: 2.0 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
cooling_tstep_mult: 1.0 # (Optional) Dimensionless pre-factor for the time-step condition.
# Cooling with Grackle 3.0
GrackleCooling:
......
......@@ -159,6 +159,11 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
const struct unit_system* restrict us,
const struct hydro_props* hydro_props, const struct part* restrict p) {
/* Start with the case where there is no limit */
if (cooling->cooling_tstep_mult == FLT_MAX) {
return FLT_MAX;
}
/* Get current internal energy and cooling rate */
const float u = hydro_get_physical_internal_energy(p, cosmo);
const double cooling_du_dt_cgs =
......@@ -225,8 +230,8 @@ static INLINE void cooling_init_backend(struct swift_params* parameter_file,
/* Read in the cooling parameters */
cooling->lambda_cgs =
parser_get_param_double(parameter_file, "LambdaCooling:lambda_cgs");
cooling->cooling_tstep_mult = parser_get_param_double(
parameter_file, "LambdaCooling:cooling_tstep_mult");
cooling->cooling_tstep_mult = parser_get_opt_param_float(
parameter_file, "LambdaCooling:cooling_tstep_mult", FLT_MAX);
/* Some useful conversion values */
cooling->conv_factor_density_to_cgs =
......@@ -251,6 +256,12 @@ static INLINE void cooling_print_backend(
message("Cooling function is 'Constant lambda' with Lambda=%g [cgs]",
cooling->lambda_cgs);
if (cooling->cooling_tstep_mult == FLT_MAX)
message("Cooling function time-step size is unlimited");
else
message("Cooling function time-step size limited to %f of u/(du/dt)",
cooling->cooling_tstep_mult);
}
#endif /* SWIFT_COOLING_CONST_LAMBDA_H */
......@@ -461,11 +461,11 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
if (part_is_active(p, e)) {
double dt_cool, dt_therm;
;
if (with_cosmology) {
const integertime_t ti_step = get_integer_timestep(p->time_bin);
const integertime_t ti_begin =
get_integer_time_begin(ti_current + 1, p->time_bin);
get_integer_time_begin(ti_current - 1, p->time_bin);
dt_cool =
cosmology_get_delta_time(cosmo, ti_begin, ti_begin + ti_step);
dt_therm = cosmology_get_therm_kick_factor(e->cosmology, ti_begin,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment