Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
91f40ec4
Commit
91f40ec4
authored
Oct 07, 2018
by
Matthieu Schaller
Browse files
Modify the time-step multiplier in the Lambda-cooling model, if the user wishes to.
parent
cb952932
Changes
9
Hide whitespace changes
Inline
Side-by-side
examples/AgoraDisk/agora_disk.yml
View file @
91f40ec4
...
...
@@ -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
...
...
examples/CoolingBox/coolingBox.yml
View file @
91f40ec4
...
...
@@ -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
...
...
examples/CoolingHalo/cooling_halo.yml
View file @
91f40ec4
...
...
@@ -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
examples/CoolingHaloWithSpin/cooling_halo.yml
View file @
91f40ec4
...
...
@@ -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
examples/SmallCosmoVolume_cooling/README
View file @
91f40ec4
...
...
@@ -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.
...
...
examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml
View file @
91f40ec4
...
...
@@ -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)
examples/parameter_example.yml
View file @
91f40ec4
...
...
@@ -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
:
...
...
src/cooling/const_lambda/cooling.h
View file @
91f40ec4
...
...
@@ -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 */
src/runner.c
View file @
91f40ec4
...
...
@@ -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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment