Skip to content
Snippets Groups Projects
Commit ffc5fcce authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'synch_spin_jet_code' into 'master'

Synch spin jet code with downstream

See merge request !2131
parents b40075ae 9ce37e09
No related branches found
No related tags found
2 merge requests!2165Merge master,!2131Synch spin jet code with downstream
...@@ -1494,6 +1494,7 @@ __attribute__((always_inline)) INLINE static void black_holes_end_reposition( ...@@ -1494,6 +1494,7 @@ __attribute__((always_inline)) INLINE static void black_holes_end_reposition(
* actual potential minimum. */ * actual potential minimum. */
if (repos_frac > 1) repos_frac = 1.; if (repos_frac > 1) repos_frac = 1.;
bp->last_repos_vel = (float)repos_vel;
bp->reposition.delta_x[0] *= repos_frac; bp->reposition.delta_x[0] *= repos_frac;
bp->reposition.delta_x[1] *= repos_frac; bp->reposition.delta_x[1] *= repos_frac;
bp->reposition.delta_x[2] *= repos_frac; bp->reposition.delta_x[2] *= repos_frac;
......
...@@ -189,7 +189,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -189,7 +189,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
const int with_cosmology) { const int with_cosmology) {
/* Say how much we want to write */ /* Say how much we want to write */
*num_fields = 62; *num_fields = 63;
/* List what we want to write */ /* List what we want to write */
list[0] = io_make_output_field_convert_bpart( list[0] = io_make_output_field_convert_bpart(
...@@ -237,11 +237,10 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -237,11 +237,10 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
-1.5f * hydro_gamma_minus_one, bparts, sound_speed_gas, -1.5f * hydro_gamma_minus_one, bparts, sound_speed_gas,
"Co-moving sound-speeds of the gas around the particles"); "Co-moving sound-speeds of the gas around the particles");
list[9] = io_make_output_field( list[9] = io_make_physical_output_field(
"EnergyReservoirs", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, "EnergyReservoirs", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts,
energy_reservoir, energy_reservoir, /*can convert to comoving=*/0,
"Physcial energy contained in the thermal feedback reservoir of the " "Physcial energy contained in the feedback reservoir of the particles");
"particles");
list[10] = io_make_output_field( list[10] = io_make_output_field(
"AccretionRates", FLOAT, 1, UNIT_CONV_MASS_PER_UNIT_TIME, 0.f, bparts, "AccretionRates", FLOAT, 1, UNIT_CONV_MASS_PER_UNIT_TIME, 0.f, bparts,
...@@ -289,7 +288,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -289,7 +288,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"Scale-factors at which the black holes last had a minor merger."); "Scale-factors at which the black holes last had a minor merger.");
} else { } else {
list[15] = io_make_output_field( list[15] = io_make_output_field(
"LastMinorMergerScaleTimes", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts, "LastMinorMergerTimes", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts,
last_minor_merger_time, last_minor_merger_time,
"Times at which the black holes last had a minor merger."); "Times at which the black holes last had a minor merger.");
} }
...@@ -301,14 +300,14 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -301,14 +300,14 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"Scale-factors at which the black holes last had a major merger."); "Scale-factors at which the black holes last had a major merger.");
} else { } else {
list[16] = io_make_output_field( list[16] = io_make_output_field(
"LastMajorMergerScaleTimes", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts, "LastMajorMergerTimes", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts,
last_major_merger_time, last_major_merger_time,
"Times at which the black holes last had a major merger."); "Times at which the black holes last had a major merger.");
} }
list[17] = io_make_output_field( list[17] = io_make_physical_output_field(
"SwallowedAngularMomenta", FLOAT, 3, UNIT_CONV_ANGULAR_MOMENTUM, 0.f, "SwallowedAngularMomenta", FLOAT, 3, UNIT_CONV_ANGULAR_MOMENTUM, 0.f,
bparts, swallowed_angular_momentum, bparts, swallowed_angular_momentum, /*can convert to comoving=*/0,
"Physical angular momenta that the black holes have accumulated by " "Physical angular momenta that the black holes have accumulated by "
"swallowing gas particles."); "swallowing gas particles.");
...@@ -385,9 +384,9 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -385,9 +384,9 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
convert_bpart_gas_velocity_curl, convert_bpart_gas_velocity_curl,
"Velocity curl (3D) of the gas particles around the black holes."); "Velocity curl (3D) of the gas particles around the black holes.");
list[29] = io_make_output_field( list[29] = io_make_physical_output_field(
"AccretedAngularMomenta", FLOAT, 3, UNIT_CONV_ANGULAR_MOMENTUM, 0.f, "AccretedAngularMomenta", FLOAT, 3, UNIT_CONV_ANGULAR_MOMENTUM, 0.f,
bparts, accreted_angular_momentum, bparts, accreted_angular_momentum, /*can convert to comoving=*/0,
"Physical angular momenta that the black holes have accumulated through " "Physical angular momenta that the black holes have accumulated through "
"subgrid accretion."); "subgrid accretion.");
...@@ -429,12 +428,11 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -429,12 +428,11 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"Accretion-limited time steps of black holes. The actual time step of " "Accretion-limited time steps of black holes. The actual time step of "
"the particles may differ due to the minimum allowed value."); "the particles may differ due to the minimum allowed value.");
list[35] = io_make_output_field( list[35] = io_make_physical_output_field(
"AGNTotalInjectedEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, "AGNTotalInjectedEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts,
AGN_cumulative_energy, AGN_cumulative_energy, /*can convert to comoving=*/0,
"Total (cumulative) physical thermal energies injected into gas " "Total (cumulative) physical energies injected into gas particles "
"particles in thermal AGN feedback, including the effects of both " "in AGN feedback, including the effects of both radiation and winds.");
"radiation and winds.");
list[36] = io_make_output_field_convert_bpart( list[36] = io_make_output_field_convert_bpart(
"Potentials", FLOAT, 1, UNIT_CONV_POTENTIAL, -1.f, bparts, "Potentials", FLOAT, 1, UNIT_CONV_POTENTIAL, -1.f, bparts,
...@@ -442,8 +440,8 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -442,8 +440,8 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
list[37] = io_make_output_field( list[37] = io_make_output_field(
"Spins", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts, spin, "Spins", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts, spin,
"Dimensionless spins of the black holes. " "Dimensionless spins of the black holes. Negative values indicate "
"Negative values indicate retrograde accretion."); "retrograde accretion.");
list[38] = io_make_output_field( list[38] = io_make_output_field(
"AngularMomentumDirections", FLOAT, 3, UNIT_CONV_NO_UNITS, 0.f, bparts, "AngularMomentumDirections", FLOAT, 3, UNIT_CONV_NO_UNITS, 0.f, bparts,
...@@ -456,9 +454,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -456,9 +454,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
list[40] = io_make_output_field( list[40] = io_make_output_field(
"RadiativeEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts, "RadiativeEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts,
radiative_efficiency, radiative_efficiency, "AGN luminosity divided by accretion rate.");
"The radiative efficiencies of the BHs, i.e. the "
"AGN luminosity divided by accretion rate.");
list[41] = io_make_output_field("CosAccretionDiskAngle", FLOAT, 1, list[41] = io_make_output_field("CosAccretionDiskAngle", FLOAT, 1,
UNIT_CONV_NO_UNITS, 0.f, bparts, UNIT_CONV_NO_UNITS, 0.f, bparts,
...@@ -475,9 +471,10 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -475,9 +471,10 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"Total jet energy waiting to be released (once it " "Total jet energy waiting to be released (once it "
"grows large enough to kick a single particle)."); "grows large enough to kick a single particle).");
list[44] = io_make_output_field( list[44] = io_make_physical_output_field(
"InjectedJetEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, "InjectedJetEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts,
total_jet_energy, "Total jet energy injected into AGN surroundings."); total_jet_energy, /*can convert to comoving=*/0,
"Total jet energy injected into AGN surroundings.");
list[45] = io_make_output_field( list[45] = io_make_output_field(
"JetTimeSteps", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts, dt_jet, "JetTimeSteps", FLOAT, 1, UNIT_CONV_TIME, 0.f, bparts, dt_jet,
...@@ -524,17 +521,19 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -524,17 +521,19 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"The total accreted mass in each accretion mode. The components to the " "The total accreted mass in each accretion mode. The components to the "
"mass accreted in the thick, thin and slim disc modes, respectively."); "mass accreted in the thick, thin and slim disc modes, respectively.");
list[52] = io_make_output_field( list[52] = io_make_physical_output_field(
"AGNTotalInjectedEnergiesByMode", FLOAT, BH_accretion_modes_count, "AGNTotalInjectedEnergiesByMode", FLOAT, BH_accretion_modes_count,
UNIT_CONV_ENERGY, 0.f, bparts, thermal_energy_by_mode, UNIT_CONV_ENERGY, 0.f, bparts, thermal_energy_by_mode,
/*can convert to comoving=*/0,
"The total energy injected in the thermal AGN feedback mode, including " "The total energy injected in the thermal AGN feedback mode, including "
"the contributions of both radiation and wind feedback, split by " "the contributions of both radiation and wind feedback, split by "
"accretion mode. The components correspond to the thermal energy dumped " "accretion mode. The components correspond to the thermal energy dumped "
"in the thick, thin and slim disc modes, respectively."); "in the thick, thin and slim disc modes, respectively.");
list[53] = io_make_output_field( list[53] = io_make_physical_output_field(
"InjectedJetEnergiesByMode", FLOAT, BH_accretion_modes_count, "InjectedJetEnergiesByMode", FLOAT, BH_accretion_modes_count,
UNIT_CONV_ENERGY, 0.f, bparts, jet_energy_by_mode, UNIT_CONV_ENERGY, 0.f, bparts, jet_energy_by_mode,
/*can convert to comoving=*/0,
"The total energy injected in the kinetic jet AGN feedback mode, split " "The total energy injected in the kinetic jet AGN feedback mode, split "
"by accretion mode. The components correspond to the jet energy " "by accretion mode. The components correspond to the jet energy "
"dumped in the thick, thin and slim disc modes, respectively."); "dumped in the thick, thin and slim disc modes, respectively.");
...@@ -543,27 +542,29 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -543,27 +542,29 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
"WindEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts, "WindEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts,
wind_efficiency, "The wind efficiencies of the black holes."); wind_efficiency, "The wind efficiencies of the black holes.");
list[55] = io_make_output_field( list[55] = io_make_physical_output_field(
"TotalRadiatedEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, "TotalRadiatedEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts,
radiated_energy, radiated_energy, /*can convert to comoving=*/0,
"The total energy launched into radiation by the black holes, " "The total energy launched into radiation by the black holes, "
"in all accretion modes. "); "in all accretion modes. ");
list[56] = io_make_output_field( list[56] = io_make_physical_output_field(
"RadiatedEnergiesByMode", FLOAT, BH_accretion_modes_count, "RadiatedEnergiesByMode", FLOAT, BH_accretion_modes_count,
UNIT_CONV_ENERGY, 0.f, bparts, radiated_energy_by_mode, UNIT_CONV_ENERGY, 0.f, bparts, radiated_energy_by_mode,
/*can convert to comoving=*/0,
"The total energy launched into radiation by the black holes, split " "The total energy launched into radiation by the black holes, split "
"by accretion mode. The components correspond to the radiative energy " "by accretion mode. The components correspond to the radiative energy "
"dumped in the thick, thin and slim disc modes, respectively."); "dumped in the thick, thin and slim disc modes, respectively.");
list[57] = io_make_output_field( list[57] = io_make_physical_output_field(
"TotalWindEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, wind_energy, "TotalWindEnergies", FLOAT, 1, UNIT_CONV_ENERGY, 0.f, bparts, wind_energy,
"The total energy launched into accretion disc winds by the black " /*can convert to comoving=*/0,
"holes, in all accretion modes. "); "The total energy launched into accretion disc winds by the black holes, "
"in all accretion modes. ");
list[58] = io_make_output_field( list[58] = io_make_physical_output_field(
"WindEnergiesByMode", FLOAT, BH_accretion_modes_count, UNIT_CONV_ENERGY, "WindEnergiesByMode", FLOAT, BH_accretion_modes_count, UNIT_CONV_ENERGY,
0.f, bparts, wind_energy_by_mode, 0.f, bparts, wind_energy_by_mode, /*can convert to comoving=*/0,
"The total energy launched into accretion disc winds by the black " "The total energy launched into accretion disc winds by the black "
"holes, split by accretion mode. The components correspond to the " "holes, split by accretion mode. The components correspond to the "
"radiative energy dumped in the thick, thin and slim disc modes, " "radiative energy dumped in the thick, thin and slim disc modes, "
...@@ -581,7 +582,14 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -581,7 +582,14 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
convert_bpart_gas_temperatures, convert_bpart_gas_temperatures,
"Temperature of the gas surrounding the black holes."); "Temperature of the gas surrounding the black holes.");
list[61] = io_make_output_field( list[61] = io_make_physical_output_field(
"LastRepositionVelocities", FLOAT, 1, UNIT_CONV_SPEED, 0.f, bparts,
last_repos_vel, /*can convert to comoving=*/0,
"Physical speeds at which the black holes repositioned most recently. "
"This is 0 for black holes that have never repositioned, or if the "
"simulation has been run without prescribed repositioning speed.");
list[62] = io_make_output_field(
"AccretionEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts, "AccretionEfficiencies", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts,
accretion_efficiency, accretion_efficiency,
"The accretion efficiencies of black holes. These are used to convert " "The accretion efficiencies of black holes. These are used to convert "
......
...@@ -167,6 +167,9 @@ struct bpart { ...@@ -167,6 +167,9 @@ struct bpart {
* lower potential than all eligible neighbours) */ * lower potential than all eligible neighbours) */
int number_of_reposition_attempts; int number_of_reposition_attempts;
/* Velocity of most recent reposition jump */
float last_repos_vel;
/*! Total number of time steps in which the black hole was active. */ /*! Total number of time steps in which the black hole was active. */
int number_of_time_steps; int number_of_time_steps;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment