diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 4d43ae30f5bcd0df4970168591f03f97c092b21e..cabc94d2bba38b462b1974c01f416c40df10ef9f 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -292,6 +292,7 @@ SineWavePotential: timestep_limit: 1. # Time-step dimensionless pre-factor. growth_time: 0. # (Optional) Time for the potential to grow to its final size. + # Parameters related to entropy floors ---------------------------------------------- EAGLEEntropyFloor: @@ -303,12 +304,14 @@ EAGLEEntropyFloor: Cool_over_density_threshold: 10. # Overdensity above which the EAGLE Cool limiter entropy floor can kick in. Cool_temperature_norm_K: 8000 # Temperature of the EAGLE Cool limiter entropy floor at the density threshold expressed in Kelvin. Cool_gamma_effective: 1. # Slope the of the EAGLE Cool limiter entropy floor - + + # Parameters related to pressure floors ---------------------------------------------- GEARPressureFloor: jeans_factor: 10. # Number of particles required to suppose a resolved clump and avoid the pressure floor. + # Parameters related to cooling function ---------------------------------------------- # Constant du/dt cooling function @@ -326,6 +329,7 @@ LambdaCooling: EAGLECooling: dir_name: ./coolingtables/ # Location of the Wiersma+08 cooling tables H_reion_z: 8.5 # Redshift of Hydrogen re-ionization + H_reion_eV_p_H: 2.0 # Energy inject by Hydrogen re-ionization in electron-volt per Hydrogen atom He_reion_z_centre: 3.5 # Redshift of the centre of the Helium re-ionization Gaussian He_reion_z_sigma: 0.5 # Spread in redshift of the Helium re-ionization Gaussian He_reion_eV_p_H: 2.0 # Energy inject by Helium re-ionization in electron-volt per Hydrogen atom @@ -336,16 +340,17 @@ EAGLECooling: # Cooling with Grackle 3.0 GrackleCooling: cloudy_table: CloudyData_UVB=HM2012.h5 # Name of the Cloudy Table (available on the grackle bitbucket repository) - with_UV_background: 1 # Enable or not the UV background - redshift: 0 # Redshift to use (-1 means time based redshift) - with_metal_cooling: 1 # Enable or not the metal cooling - provide_volumetric_heating_rates: 0 # (optional) User provide volumetric heating rates - provide_specific_heating_rates: 0 # (optional) User provide specific heating rates + with_UV_background: 1 # Enable or not the UV background + redshift: 0 # Redshift to use (-1 means time based redshift) + with_metal_cooling: 1 # Enable or not the metal cooling + provide_volumetric_heating_rates: 0 # (optional) User provide volumetric heating rates + provide_specific_heating_rates: 0 # (optional) User provide specific heating rates max_steps: 10000 # (optional) Max number of step when computing the initial composition convergence_limit: 1e-2 # (optional) Convergence threshold (relative) for initial composition thermal_time_myr: 5 # (optional) Time (in Myr) for adiabatic cooling after a feedback event. - self_shielding_method: -1 # (optional) Grackle (1->3 for Grackle's ones, 0 for none and -1 for GEAR) - self_shielding_threshold_atom_per_cm3: 0.007 # Required only with GEAR's self shielding. Density threshold of the self shielding + self_shielding_method: -1 # (optional) Grackle (1->3 for Grackle's ones, 0 for none and -1 for GEAR) + self_shielding_threshold_atom_per_cm3: 0.007 # Required only with GEAR's self shielding. Density threshold of the self shielding + # Parameters related to chemistry models ----------------------------------------------- @@ -365,16 +370,11 @@ EAGLEChemistry: # GEAR chemistry model (Revaz and Jablonka 2018) GEARChemistry: initial_metallicity: 1 # Initial metallicity of the gas (mass fraction) - scale_initial_metallicity: 1 # Should we scale the initial metallicity with the solar one? + scale_initial_metallicity: 1 # Should we scale the initial metallicity with the solar one? # Parameters related to star formation models ----------------------------------------------- -# GEAR star formation model (Revaz and Jablonka 2018) -GEARStarFormation: - star_formation_efficiency: 0.01 # star formation efficiency (c_*) - maximal_temperature: 3e4 # Upper limit to the temperature of a star forming particle - # EAGLE star formation model (Schaye and Dalla Vecchia 2008) EAGLEStarFormation: EOS_density_norm_H_p_cm3: 0.1 # Physical density used for the normalisation of the EOS assumed for the star-forming gas in Hydrogen atoms per cm^3. @@ -392,7 +392,13 @@ EAGLEStarFormation: threshold_Z0: 0.002 # Reference metallicity (metal mass fraction) for the metal-dependant threshold for star formation. threshold_slope: -0.64 # Slope of the metal-dependant star formation threshold threshold_max_density_H_p_cm3: 10.0 # Maximal density of the metal-dependant density threshold for star formation in Hydrogen atoms per cm^3. - + +# GEAR star formation model (Revaz and Jablonka 2018) +GEARStarFormation: + star_formation_efficiency: 0.01 # star formation efficiency (c_*) + maximal_temperature: 3e4 # Upper limit to the temperature of a star forming particle + + # Parameters related to feedback models ----------------------------------------------- # EAGLE feedback model @@ -438,9 +444,10 @@ EAGLEFeedback: # GEAR feedback model GEARFeedback: - supernovae_energy_erg: 0.1e51 # Energy released by a single supernovae. + supernovae_energy_erg: 0.1e51 # Energy released by a single supernovae. yields_table: chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5 # Table containing the yields. - discrete_yields: 0 # Should we use discrete yields or the IMF integrated one? + discrete_yields: 0 # Should we use discrete yields or the IMF integrated one? + # Parameters related to AGN models ----------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index 7144496b68a9e6789d0eaf0fb0dd19ff014e6d4b..7678220bbf0a05fab3af60248245493c3be9886b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -77,7 +77,7 @@ if HAVEGRACKLECOOLING GRACKLE_COOLING_SOURCES += cooling/grackle/cooling.c endif -# source files for GRACKLE cooling +# source files for GEAR feedback GEAR_FEEDBACK_SOURCES = if HAVEGEARFEEDBACK GEAR_FEEDBACK_SOURCES += feedback/GEAR/stellar_evolution.c feedback/GEAR/feedback.c \ @@ -102,8 +102,8 @@ AM_SOURCES = space.c runner_main.c runner_doiact_hydro.c runner_doiact_limiter.c chemistry.c cosmology.c restart.c mesh_gravity.c velociraptor_interface.c \ outputlist.c velociraptor_dummy.c logger_io.c memuse.c mpiuse.c memuse_rnodes.c fof.c \ hashmap.c pressure_floor.c \ - $(EAGLE_COOLING_SOURCES) $(EAGLE_FEEDBACK_SOURCES) $(GRACKLE_COOLING_SOURCES) \ - $(GEAR_FEEDBACK_SOURCES) + $(EAGLE_COOLING_SOURCES) $(EAGLE_FEEDBACK_SOURCES) \ + $(GRACKLE_COOLING_SOURCES) $(GEAR_FEEDBACK_SOURCES) # Include files for distribution, not installation. nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \ diff --git a/src/cooling/Compton/cooling.h b/src/cooling/Compton/cooling.h index a594cdca6916c361b737763e0360ed32d459ba99..78318560220781fedf700dfab07b4930e536a6e8 100644 --- a/src/cooling/Compton/cooling.h +++ b/src/cooling/Compton/cooling.h @@ -136,9 +136,10 @@ __attribute__((always_inline)) INLINE static double Compton_cooling_rate_cgs( * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the particle' extended data. - * @param time The current time. * @param dt The time-step of this particle. * @param dt_therm The time-step operator used for thermal quantities. + * @param time Time since Big Bang (or start of the simulation) in internal + * units. */ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct phys_const* restrict phys_const, @@ -147,8 +148,8 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct hydro_props* hydro_props, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, - struct part* restrict p, struct xpart* restrict xp, const double time, - const float dt, const float dt_therm) { + struct part* restrict p, struct xpart* restrict xp, const float dt, + const float dt_therm, const double time) { /* Nothing to do here? */ if (dt == 0.) return; diff --git a/src/cooling/EAGLE/cooling.c b/src/cooling/EAGLE/cooling.c index 3a6fb523b83ba34d7fea2ff981a5c899e9f04a1c..9d5a5786230d661dd39877154358bce094d9c6a6 100644 --- a/src/cooling/EAGLE/cooling.c +++ b/src/cooling/EAGLE/cooling.c @@ -372,10 +372,10 @@ INLINE static double bisection_iter( * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the extended particle data. - * @param time The current time (since the Big Bang or start of the run) in - * internal units. * @param dt The cooling time-step of this particle. * @param dt_therm The hydro time-step of this particle. + * @param time The current time (since the Big Bang or start of the run) in + * internal units. */ void cooling_cool_part(const struct phys_const *phys_const, const struct unit_system *us, @@ -384,8 +384,8 @@ void cooling_cool_part(const struct phys_const *phys_const, const struct entropy_floor_properties *floor_props, const struct cooling_function_data *cooling, struct part *restrict p, struct xpart *restrict xp, - const double time, const float dt, - const float dt_therm) { + const float dt, const float dt_therm, + const double time) { /* No cooling happens over zero time */ if (dt == 0.) return; diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h index 90c1c01e82c7eec6d6615546866083afdfc1e328..760e455a05e518027bb8ffd66954531d406591be 100644 --- a/src/cooling/EAGLE/cooling.h +++ b/src/cooling/EAGLE/cooling.h @@ -44,7 +44,7 @@ void cooling_cool_part(const struct phys_const *phys_const, const struct entropy_floor_properties *floor_props, const struct cooling_function_data *cooling, struct part *restrict p, struct xpart *restrict xp, - const double time, const float dt, const float dt_therm); + const float dt, const float dt_therm, const double time); float cooling_timestep(const struct cooling_function_data *restrict cooling, const struct phys_const *restrict phys_const, diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index de5164e59498a1a17c62fecfed0b0f61bcf2a2c2..69424fa331b60964fd7448b08ecc59d7751a492d 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -76,9 +76,10 @@ INLINE static void cooling_update(const struct cosmology* cosmo, * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the extended particle data. - * @param time The current time. * @param dt The time-step of this particle. * @param dt_therm The time-step operator used for thermal quantities. + * @param time Time since Big Bang (or start of the simulation) in internal + * units. */ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct phys_const* restrict phys_const, @@ -87,8 +88,8 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct hydro_props* hydro_props, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, - struct part* restrict p, struct xpart* restrict xp, const double time, - const float dt, const float dt_therm) { + struct part* restrict p, struct xpart* restrict xp, const float dt, + const float dt_therm, const double time) { /* Internal energy floor */ const float u_floor = cooling->min_energy; diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index ef56b6e3575d11f767af8061e303f6ffe9248d7a..1597687bf6feec49f88f8a2f2b4bba05ecbf5939 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -106,9 +106,10 @@ __attribute__((always_inline)) INLINE static double cooling_rate_cgs( * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the particle' extended data. - * @param time The current time. * @param dt The time-step of this particle. * @param dt_therm The time-step operator used for thermal quantities. + * @param time Time since Big Bang (or start of the simulation) in internal + * units. */ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct phys_const* restrict phys_const, @@ -117,8 +118,8 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct hydro_props* hydro_props, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, - struct part* restrict p, struct xpart* restrict xp, const double time, - const float dt, const float dt_therm) { + struct part* restrict p, struct xpart* restrict xp, const float dt, + const float dt_therm, const double time) { /* Nothing to do here? */ if (dt == 0.) return; diff --git a/src/cooling/grackle/cooling.c b/src/cooling/grackle/cooling.c index 6b74b72aefa0bb64717f83d9b5a54d497e6ae260..b51afd83f0be3fee94e10f1e03ea24303b621a26 100644 --- a/src/cooling/grackle/cooling.c +++ b/src/cooling/grackle/cooling.c @@ -748,9 +748,10 @@ void cooling_apply(struct part* restrict p, struct xpart* restrict xp, * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the particle' extended data. - * @param time The current time. * @param dt The time-step of this particle. * @param dt_therm The time-step operator used for thermal quantities. + * @param time The current time (since the Big Bang or start of the run) in + * internal units. */ void cooling_cool_part(const struct phys_const* restrict phys_const, const struct unit_system* restrict us, @@ -759,8 +760,8 @@ void cooling_cool_part(const struct phys_const* restrict phys_const, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, struct part* restrict p, struct xpart* restrict xp, - const double time, const double dt, - const double dt_therm) { + const double dt, const double dt_therm, + const double time) { /* Nothing to do here? */ if (dt == 0.) return; diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h index 209b986c6f39595a7f60b64539c97e3292e79571..c5230c077b29bfdce39b34931c9f0107c490ee14 100644 --- a/src/cooling/grackle/cooling.h +++ b/src/cooling/grackle/cooling.h @@ -115,8 +115,8 @@ void cooling_cool_part(const struct phys_const* restrict phys_const, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, struct part* restrict p, struct xpart* restrict xp, - const double time, const double dt, - const double dt_therm); + const double dt, const double dt_therm, + const double time); float cooling_get_temperature( const struct phys_const* restrict phys_const, diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h index 107ea4b88a24d2505b8cceb346672f855df7b9da..abd29bfb84d23ec1b701f19479dbd71eac3a1555 100644 --- a/src/cooling/none/cooling.h +++ b/src/cooling/none/cooling.h @@ -63,9 +63,10 @@ INLINE static void cooling_update(const struct cosmology* cosmo, * @param cooling The #cooling_function_data used in the run. * @param p Pointer to the particle data. * @param xp Pointer to the extended particle data. - * @param time The current time. * @param dt The time-step of this particle. * @param dt_therm The time-step operator used for thermal quantities. + * @param time The current time (since the Big Bang or start of the run) in + * internal units. */ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct phys_const* restrict phys_const, @@ -74,8 +75,8 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct hydro_props* hydro_props, const struct entropy_floor_properties* floor_props, const struct cooling_function_data* restrict cooling, - struct part* restrict p, struct xpart* restrict xp, const double time, - const float dt, const float dt_therm) {} + struct part* restrict p, struct xpart* restrict xp, const float dt, + const float dt_therm, const double time) {} /** * @brief Computes the cooling time-step. diff --git a/src/runner_others.c b/src/runner_others.c index 2f7a82e2ff0158e99987b25c3bc9c6e7f3c15dec..8231b520e7436c40c151200c066b63f4b9c41b86 100644 --- a/src/runner_others.c +++ b/src/runner_others.c @@ -145,6 +145,7 @@ void runner_do_grav_mesh(struct runner *r, struct cell *c, int timer) { * @param timer 1 if the time is to be recorded. */ void runner_do_cooling(struct runner *r, struct cell *c, int timer) { + const struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; const int with_cosmology = (e->policy & engine_policy_cosmology); @@ -202,8 +203,8 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) { /* Let's cool ! */ cooling_cool_part(constants, us, cosmo, hydro_props, - entropy_floor_props, cooling_func, p, xp, time, - dt_cool, dt_therm); + entropy_floor_props, cooling_func, p, xp, dt_cool, + dt_therm, time); /* Apply the effects of feedback on this particle * (Note: Only used in schemes that have a delayed feedback mechanism