diff --git a/examples/EAGLE_ICs/EAGLE_100/eagle_100.yml b/examples/EAGLE_ICs/EAGLE_100/eagle_100.yml index c0180fd68b3ba3b4a029d0a506ad72b878a05bc1..c1eb5731bff8e0019cb0ac84d565b8f0363feb7b 100644 --- a/examples/EAGLE_ICs/EAGLE_100/eagle_100.yml +++ b/examples/EAGLE_ICs/EAGLE_100/eagle_100.yml @@ -219,6 +219,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml index 876abc4358db40d72b388026849f3618d4a6ad94..0445c7aa754f702a2f28640c51ea321fa1b8e40e 100644 --- a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml @@ -218,6 +218,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml index 74f16e9441ffdc089edfedbad51b25ff9bc158f4..5a7411e62be3278d3cd5f7b2377ed9422f741ef7 100644 --- a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml @@ -218,6 +218,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_25_low_res/eagle_25.yml b/examples/EAGLE_ICs/EAGLE_25_low_res/eagle_25.yml index fe0ab8459480b398cfb776c28052e4709506a35d..7d651ffb8cea8ebb134da0a86bc87158bc3af584 100644 --- a/examples/EAGLE_ICs/EAGLE_25_low_res/eagle_25.yml +++ b/examples/EAGLE_ICs/EAGLE_25_low_res/eagle_25.yml @@ -215,6 +215,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 7.2e6 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml index 6c7dea4d27c346e2563a8243e7888c650a933850..81994004a4b3ae15ee7024fd2e7720cb23baab80 100644 --- a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml @@ -216,6 +216,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_50_low_res/eagle_50.yml b/examples/EAGLE_ICs/EAGLE_50_low_res/eagle_50.yml index 066529edfa2abfed4b3c5c4d9427aebe01e58b5c..57ab0ffa4a1bf21b0149b6d70158c02af3499d50 100644 --- a/examples/EAGLE_ICs/EAGLE_50_low_res/eagle_50.yml +++ b/examples/EAGLE_ICs/EAGLE_50_low_res/eagle_50.yml @@ -215,6 +215,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 7.2e6 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_ICs/EAGLE_6/eagle_6.yml b/examples/EAGLE_ICs/EAGLE_6/eagle_6.yml index 97715ae389248fa0ece53f697614d9f13d8d7de0..070658018576f1b48519898f623e7ac433a74ce0 100644 --- a/examples/EAGLE_ICs/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_ICs/EAGLE_6/eagle_6.yml @@ -218,6 +218,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. diff --git a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml index 9e6e5658822746a164fc2d85d5deff563b52e402..d04684faa623358e6c84984480ee7bb38c7c1879 100644 --- a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml @@ -202,6 +202,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. diff --git a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml index 022474e6da69351ac174310a75dabdedd5815a77..cc9d29a43fd33efe771dbff67cffec9384992f94 100644 --- a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml @@ -210,6 +210,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. diff --git a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml index ea5bc25942e9c6253c9c8192ff6dfb51cf610e88..36128a05385b2c5e6a92fbc4cc09c3bd64dcd565 100644 --- a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml @@ -201,6 +201,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. diff --git a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml index 1bb9b94b9341e4f285080d41523d7f0191792572..98f9cd5713ac18b47ea34c6f74cf29ef738ac529 100644 --- a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml @@ -213,6 +213,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term use_nibbling: 1 # Continuously transfer small amounts of mass from all gas neighbours to a black hole [1] or stochastically swallow whole gas particles [0]? min_gas_mass_for_nibbling: 9e5 # Minimum mass for a gas particle to be nibbled from [M_Sun]. Only used if use_nibbling is 1. radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 8933395fa6f28778beb6b00ff110c07c6950c4c0..4d19572c088716fe4f2a7a5bdba728a078c2c26b 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -571,6 +571,9 @@ EAGLEAGN: boost_alpha: 1. # Lowest value for the accretion effeciency for the Booth & Schaye 2009 accretion model. boost_beta: 2. # Slope of the power law for the Booth & Schaye 2009 model, set beta to zero for constant alpha models. boost_n_h_star_H_p_cm3: 0.1 # Normalization of the power law for the Booth & Schaye 2009 model in cgs (cm^-3). + with_fixed_T_near_EoS: 0 # Are we using a fixed temperature to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term? + fixed_T_above_EoS_dex: 0.3 # Distance above the entropy floor for which we use a fixed sound-speed + fixed_T_near_EoS_K: 8000 # Fixed temperature assumed to compute the sound-speed of gas on the entropy floor in the Bondy-Hoyle accretion term radiative_efficiency: 0.1 # Fraction of the accreted mass that gets radiated. max_eddington_fraction: 1. # Maximal allowed accretion rate in units of the Eddington rate. eddington_fraction_for_recording: 0.1 # Record the last time BHs reached an Eddington ratio above this threshold. diff --git a/src/black_holes/Default/black_holes_iact.h b/src/black_holes/Default/black_holes_iact.h index 67f36ede20a0dbbe48c92a67e02a2b97fc80c86a..012ba050edda07b70fdb4d1a97628ad51ab078e9 100644 --- a/src/black_holes/Default/black_holes_iact.h +++ b/src/black_holes/Default/black_holes_iact.h @@ -41,8 +41,9 @@ runner_iact_nonsym_bh_gas_density( struct bpart *bi, const struct part *pj, const struct xpart *xpj, const int with_cosmology, const struct cosmology *cosmo, const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, const integertime_t ti_current, - const double time) { + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) { float wi, wi_dx; @@ -89,15 +90,14 @@ runner_iact_nonsym_bh_gas_density( * @param time current physical time in the simulation */ __attribute__((always_inline)) INLINE static void -runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx, - const float hi, const float hj, - const struct bpart *bi, struct part *pj, - struct xpart *xpj, const int with_cosmology, - const struct cosmology *cosmo, - const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, - const integertime_t ti_current, - const double time) {} +runner_iact_nonsym_bh_gas_swallow( + const float r2, const float *dx, const float hi, const float hj, + const struct bpart *bi, struct part *pj, struct xpart *xpj, + const int with_cosmology, const struct cosmology *cosmo, + const struct gravity_props *grav_props, + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) {} /** * @brief Swallowing interaction between two BH particles (non-symmetric). @@ -141,15 +141,14 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, * @param time current physical time in the simulation */ __attribute__((always_inline)) INLINE static void -runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, - const float hi, const float hj, - struct bpart *bi, struct part *pj, - struct xpart *xpj, const int with_cosmology, - const struct cosmology *cosmo, - const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, - const integertime_t ti_current, - const double time) { +runner_iact_nonsym_bh_gas_feedback( + const float r2, const float *dx, const float hi, const float hj, + struct bpart *bi, struct part *pj, struct xpart *xpj, + const int with_cosmology, const struct cosmology *cosmo, + const struct gravity_props *grav_props, + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) { #ifdef DEBUG_INTERACTIONS_BH /* Update ngb counters */ if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_BH) diff --git a/src/black_holes/EAGLE/black_holes_iact.h b/src/black_holes/EAGLE/black_holes_iact.h index 1cf60a80d00490afd67d0363d50f3c54edc4128c..5018f17527378feb47af3e0a59912e592e370fbc 100644 --- a/src/black_holes/EAGLE/black_holes_iact.h +++ b/src/black_holes/EAGLE/black_holes_iact.h @@ -21,6 +21,8 @@ /* Local includes */ #include "black_holes_parameters.h" +#include "entropy_floor.h" +#include "equation_of_state.h" #include "gravity.h" #include "hydro.h" #include "random.h" @@ -52,8 +54,9 @@ runner_iact_nonsym_bh_gas_density( struct bpart *bi, const struct part *pj, const struct xpart *xpj, const int with_cosmology, const struct cosmology *cosmo, const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, const integertime_t ti_current, - const double time) { + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) { float wi, wi_dx; @@ -83,7 +86,19 @@ runner_iact_nonsym_bh_gas_density( bi->ngb_mass += mj; /* Contribution to the smoothed sound speed */ - const float cj = hydro_get_comoving_soundspeed(pj); + float cj = hydro_get_comoving_soundspeed(pj); + if (bh_props->with_fixed_T_near_EoS) { + + /* Check whether we are close to the entropy floor. If we are, we + * re-calculate the sound speed using the fixed internal energy */ + const float u_EoS = entropy_floor_temperature(pj, cosmo, floor_props) * + bh_props->temp_to_u_factor; + if (pj->u < u_EoS * bh_props->fixed_T_above_EoS_factor && + pj->u > bh_props->fixed_u_for_soundspeed) { + cj = gas_soundspeed_from_internal_energy( + pj->rho, bh_props->fixed_u_for_soundspeed); + } + } bi->sound_speed_gas += mj * wi * cj; /* Neighbour internal energy */ @@ -255,15 +270,14 @@ runner_iact_nonsym_bh_gas_density( * @param time Current physical time in the simulation. */ __attribute__((always_inline)) INLINE static void -runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx, - const float hi, const float hj, - struct bpart *bi, struct part *pj, - struct xpart *xpj, const int with_cosmology, - const struct cosmology *cosmo, - const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, - const integertime_t ti_current, - const double time) { +runner_iact_nonsym_bh_gas_swallow( + const float r2, const float *dx, const float hi, const float hj, + struct bpart *bi, struct part *pj, struct xpart *xpj, + const int with_cosmology, const struct cosmology *cosmo, + const struct gravity_props *grav_props, + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) { float wi; @@ -629,15 +643,14 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, * @param time current physical time in the simulation */ __attribute__((always_inline)) INLINE static void -runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, - const float hi, const float hj, - const struct bpart *bi, struct part *pj, - struct xpart *xpj, const int with_cosmology, - const struct cosmology *cosmo, - const struct gravity_props *grav_props, - const struct black_holes_props *bh_props, - const integertime_t ti_current, - const double time) { +runner_iact_nonsym_bh_gas_feedback( + const float r2, const float *dx, const float hi, const float hj, + const struct bpart *bi, struct part *pj, struct xpart *xpj, + const int with_cosmology, const struct cosmology *cosmo, + const struct gravity_props *grav_props, + const struct black_holes_props *bh_props, + const struct entropy_floor_properties *floor_props, + const integertime_t ti_current, const double time) { /* Number of energy injections per BH per time-step */ const int num_energy_injections_per_BH = diff --git a/src/black_holes/EAGLE/black_holes_properties.h b/src/black_holes/EAGLE/black_holes_properties.h index 5f86bedf34d2bdab0ab66a785c0565e5710d08e1..2845a1a0fec308939ff2ea0a005762be638af2b9 100644 --- a/src/black_holes/EAGLE/black_holes_properties.h +++ b/src/black_holes/EAGLE/black_holes_properties.h @@ -24,6 +24,7 @@ /* Local includes. */ #include "chemistry.h" +#include "exp10.h" #include "hydro_properties.h" /* Includes. */ @@ -121,6 +122,15 @@ struct black_holes_props { /*! Minimum gas particle mass in nibbling mode */ float min_gas_mass_for_nibbling; + /*! Switch to calculate the sound speed with a fixed T near the EoS */ + int with_fixed_T_near_EoS; + + /*! Factor above EoS below which fixed T applies for sound speed */ + float fixed_T_above_EoS_factor; + + /*! Fixed T (expressed as internal energy) for sound speed near EoS */ + float fixed_u_for_soundspeed; + /* ---- Properties of the feedback model ------- */ /*! AGN feedback model: random, isotropic or minimum distance */ @@ -270,6 +280,13 @@ INLINE static void black_holes_props_init(struct black_holes_props *bp, const struct hydro_props *hydro_props, const struct cosmology *cosmo) { + /* Calculate temperature to internal energy conversion factor (all internal + * units) */ + const double k_B = phys_const->const_boltzmann_k; + const double m_p = phys_const->const_proton_mass; + const double mu = hydro_props->mu_ionised; + bp->temp_to_u_factor = k_B / (mu * hydro_gamma_minus_one * m_p); + /* Read in the basic neighbour search properties or default to the hydro ones if the user did not provide any different values */ @@ -369,6 +386,17 @@ INLINE static void black_holes_props_init(struct black_holes_props *bp, bp->min_gas_mass_for_nibbling *= phys_const->const_solar_mass; } + bp->with_fixed_T_near_EoS = + parser_get_param_int(params, "EAGLEAGN:with_fixed_T_near_EoS"); + if (bp->with_fixed_T_near_EoS) { + bp->fixed_T_above_EoS_factor = + exp10(parser_get_param_float(params, "EAGLEAGN:fixed_T_above_EoS_dex")); + bp->fixed_u_for_soundspeed = + parser_get_param_float(params, "EAGLEAGN:fixed_T_near_EoS_K") / + units_cgs_conversion_factor(us, UNIT_CONV_TEMPERATURE); + bp->fixed_u_for_soundspeed *= bp->temp_to_u_factor; + } + /* Feedback parameters ---------------------------------- */ char temp[40]; @@ -530,13 +558,6 @@ INLINE static void black_holes_props_init(struct black_holes_props *bp, /* Common conversion factors ----------------------------- */ - /* Calculate temperature to internal energy conversion factor (all internal - * units) */ - const double k_B = phys_const->const_boltzmann_k; - const double m_p = phys_const->const_proton_mass; - const double mu = hydro_props->mu_ionised; - bp->temp_to_u_factor = k_B / (mu * hydro_gamma_minus_one * m_p); - /* Calculate conversion factor from rho to n_H. * Note this assumes primoridal abundance */ const double X_H = hydro_props->hydrogen_mass_fraction; diff --git a/src/runner_doiact_functions_black_holes.h b/src/runner_doiact_functions_black_holes.h index 1cbd4d66d5a73b3f8f6056a9064e142c2d685719..cd439300b8807a4a7a44ca4cd176d7762c0eeb6e 100644 --- a/src/runner_doiact_functions_black_holes.h +++ b/src/runner_doiact_functions_black_holes.h @@ -103,7 +103,7 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) { if (r2 < hig2) { IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo, e->gravity_properties, e->black_holes_properties, - ti_current, e->time); + e->entropy_floor, ti_current, e->time); } } /* loop over the parts in ci. */ } /* loop over the bparts in ci. */ @@ -257,7 +257,7 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci, if (r2 < hig2) { IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo, e->gravity_properties, e->black_holes_properties, - ti_current, e->time); + e->entropy_floor, ti_current, e->time); } } /* loop over the parts in cj. */ } /* loop over the bparts in ci. */ @@ -425,7 +425,7 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci, if (r2 < hig2) { IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo, e->gravity_properties, e->black_holes_properties, - ti_current, e->time); + e->entropy_floor, ti_current, e->time); } } /* loop over the parts in cj. */ } /* loop over the parts in ci. */ @@ -503,7 +503,7 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci, if (r2 < hig2) { IACT_BH_GAS(r2, dx, hi, pj->h, bi, pj, xpj, with_cosmology, cosmo, e->gravity_properties, e->black_holes_properties, - ti_current, e->time); + e->entropy_floor, ti_current, e->time); } } /* loop over the parts in cj. */ } /* loop over the parts in ci. */