Skip to content

Commit

Permalink
Tracking BH accretion rates in global files
Browse files Browse the repository at this point in the history
Added new properties for AllBaryons to track the BH accretion rates in
the two modes they present. Then this is written in the global output as
well.
  • Loading branch information
cdplagos committed Jul 31, 2024
1 parent 7033ece commit 4dd74a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/total_baryon.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class TotalBaryon {
* mH2: total mass in the form of molecular gas.
* mDM: total mass in the form of dark matter.
* SFR: integrated SFR of all galaxies over a snapshot for the disk and the bulge.
* mBH_acc: integrated BH accretion rate of all galaxies over a snapshot for the disk and the bulge.
* baryon_total_created: keeps track of the baryons deposited in DM halos to ensure mass convervations.
* max_BH: maximum mass of the SMBHs in this snapshot.
*/
Expand All @@ -73,6 +74,9 @@ class TotalBaryon {

std::vector<double> SFR_disk;
std::vector<double> SFR_bulge;
std::vector<double> mBH_acc_hh;
std::vector<double> mBH_acc_sb;

std::vector<double> max_BH;

/**
Expand Down
10 changes: 9 additions & 1 deletion src/evolve_halos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ void track_total_baryons(Cosmology &cosmology, ExecutionParameters execparams, S

double SFR_total_disk = 0;
double SFR_total_burst = 0;
double mbh_acc_total_hh = 0;
double mbh_acc_total_burst = 0;

int number_major_mergers = 0;
int number_minor_mergers = 0;
Expand Down Expand Up @@ -320,7 +322,10 @@ void track_total_baryons(Cosmology &cosmology, ExecutionParameters execparams, S

SFR_total_disk += galaxy.sfr_disk;
SFR_total_burst += galaxy.sfr_bulge_mergers + galaxy.sfr_bulge_diskins;


mbh_acc_total_hh += galaxy.smbh.macc_hh;
mbh_acc_total_burst += galaxy.smbh.macc_sb;

MBH_total.mass += galaxy.smbh.mass;

if(galaxy.smbh.mass > SMBH_max){
Expand All @@ -338,8 +343,11 @@ void track_total_baryons(Cosmology &cosmology, ExecutionParameters execparams, S
AllBaryons.mHI.push_back(mHI_total);
AllBaryons.mH2.push_back(mH2_total);
AllBaryons.mBH.push_back(MBH_total);

AllBaryons.SFR_disk.push_back(SFR_total_disk);
AllBaryons.SFR_bulge.push_back(SFR_total_burst);
AllBaryons.mBH_acc_hh.push_back(mbh_acc_total_hh);
AllBaryons.mBH_acc_sb.push_back(mbh_acc_total_burst);

AllBaryons.major_mergers.push_back(number_major_mergers);
AllBaryons.minor_mergers.push_back(number_minor_mergers);
Expand Down
6 changes: 6 additions & 0 deletions src/galaxy_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,12 @@ void HDF5GalaxyWriter::write_global_properties (hdf5::Writer &file, int snapshot
comment = "total star formation rate taking place in bulges in the simulated box [Msun/Gyr/h]";
file.write_dataset("global/sfr_burst",AllBaryons.SFR_bulge, comment);

comment = "total black hole accretion rate due to hot-halo accretion in the simulated box [Msun/Gyr/h]";
file.write_dataset("global/bh_acc_hh",AllBaryons.mBH_acc_hh, comment);

comment = "total black hole accretion rate due to starburst accretion in the simulated box [Msun/Gyr/h]";
file.write_dataset("global/bh_acc_sb",AllBaryons.mBH_acc_sb, comment);

comment = "Maximum mass of the SMBHs in the simulated box [Msun/h]";
file.write_dataset("global/smbh_maximum",AllBaryons.max_BH, comment);

Expand Down

0 comments on commit 4dd74a3

Please sign in to comment.