Skip to content

Commit

Permalink
Merge pull request #20 from angel-chandro/devel
Browse files Browse the repository at this point in the history
Several small fixes
  • Loading branch information
cdplagos authored Sep 16, 2024
2 parents ce7cac5 + 5931dfa commit be72622
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions sample.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ power_spectrum = planck15
sim_name = mini-SURFS
volume = 144703.125
lbox = 210
particle_mass = 2.21e8 # in Msun/h
tot_n_subvolumes = 64
min_snapshot = 51
max_snapshot = 199
Expand Down
1 change: 1 addition & 0 deletions sample_lagos23.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ spin_mass_dependence = true
sim_name = mini-SURFS
volume = 144703.125
lbox = 210
particle_mass = 2.21e8 # in Msun/h
tot_n_subvolumes = 64
min_snapshot = 51
max_snapshot = 199
Expand Down
8 changes: 2 additions & 6 deletions src/evolve_halos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ void transfer_galaxies_to_next_snapshot(const std::vector<HaloPtr> &halos, int s
for(auto &halo: halos){
for(auto &subhalo: halo->all_subhalos()) {

// Make sure all SFRs and BH accretion rates (in mass and metals) are set to 0 for the next snapshot
for (auto &galaxy: subhalo->galaxies) {
//restart descendant_id
galaxy.descendant_id = -1;
}

// Check if this is a satellite subhalo, and whether this is the last snapshot in which it is identified.
// In that case, the transfer of galaxies has already been done in merging_subhalos.
// In any other case, we need to do the transfer.
Expand Down Expand Up @@ -207,6 +201,8 @@ void reset_instantaneous_galaxy_properties(const std::vector<HaloPtr> &halos, in
galaxy.sfr_disk = 0;
galaxy.smbh.macc_sb = 0;
galaxy.smbh.macc_hh = 0;
//restart descendant_id
galaxy.descendant_id = -1;

//restart counter of mergers and disk instabilities.
galaxy.interaction.restore_interaction_item();
Expand Down
2 changes: 1 addition & 1 deletion src/galaxy_mergers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void GalaxyMergers::merging_timescale(Galaxy &galaxy, SubhaloPtr &primary, Subha

// The satellites mass including its baryon mass
double mgal = galaxy.baryon_mass();
double ms = simparams.particle_mass * secondary->Npart + mgal;
double ms = secondary->Mvir + mgal;
if(transfer_types2){
ms = galaxy.msubhalo_type2 + mgal;
}
Expand Down
10 changes: 5 additions & 5 deletions src/tree_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector<HaloPtr> &halos, Simul
std::set<int> halo_snapshots;
for(const auto &halo: halos) {
halo_snapshots.insert(halo->snapshot);
// compute the minimum particle number for structures
for(const auto &subhalo: halo->all_subhalos()) {
if (exec_params.define_transient == ExecutionParameters::ZDEP_3SIGMA || exec_params.define_transient == ExecutionParameters::CONST_10MINPART){
// compute the minimum particle number for structures when the transient fixes are applied
if ((exec_params.apply_fix_to_massive_transient_events) && (exec_params.define_transient == ExecutionParameters::ZDEP_3SIGMA || exec_params.define_transient == ExecutionParameters::CONST_10MINPART)){
for(const auto &subhalo: halo->all_subhalos()) {
// compute the particle number for each subhalo
particle_subhalo = round(subhalo->Mvir/sim_params.particle_mass);
// find the minimum and save it
Expand All @@ -761,8 +761,8 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector<HaloPtr> &halos, Simul
}
}
}
// minimum particle number for structures
if (exec_params.define_transient == ExecutionParameters::ZDEP_3SIGMA || exec_params.define_transient == ExecutionParameters::CONST_10MINPART){
// minimum particle number for structures when the transient fixes are applied
if ((exec_params.apply_fix_to_massive_transient_events) && (exec_params.define_transient == ExecutionParameters::ZDEP_3SIGMA || exec_params.define_transient == ExecutionParameters::CONST_10MINPART)){
LOG(info) << "Minimum particle subhalo: " << min_particle_subhalo;
}

Expand Down

0 comments on commit be72622

Please sign in to comment.