From 5571d0243940c4898e73becfbe576f50ac4c734f Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 13:35:09 +1000 Subject: [PATCH 1/6] Restart descendant_id variable after writing output files --- src/evolve_halos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evolve_halos.cpp b/src/evolve_halos.cpp index c09d49c..c226ca5 100644 --- a/src/evolve_halos.cpp +++ b/src/evolve_halos.cpp @@ -117,7 +117,7 @@ void transfer_galaxies_to_next_snapshot(const std::vector &halos, int s // 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; + //galaxy.descendant_id = -1; } // Check if this is a satellite subhalo, and whether this is the last snapshot in which it is identified. From cda268e9346ef3b48129de7713f4a45172f9aef8 Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 13:54:02 +1000 Subject: [PATCH 2/6] Restart descendant_id variable after writing output files --- src/evolve_halos.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/evolve_halos.cpp b/src/evolve_halos.cpp index c226ca5..81c8474 100644 --- a/src/evolve_halos.cpp +++ b/src/evolve_halos.cpp @@ -114,12 +114,6 @@ void transfer_galaxies_to_next_snapshot(const std::vector &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. @@ -207,6 +201,8 @@ void reset_instantaneous_galaxy_properties(const std::vector &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(); From 2ed36561d95e638c1cfb7539df9a7d161dfde3f4 Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 13:55:53 +1000 Subject: [PATCH 3/6] Compute the merging timescale in POULTON20 via the input virial mass --- src/galaxy_mergers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/galaxy_mergers.cpp b/src/galaxy_mergers.cpp index 1414bf9..cdf7d5c 100644 --- a/src/galaxy_mergers.cpp +++ b/src/galaxy_mergers.cpp @@ -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; } From e3c8e17cbcfa143721e637b793bc2a3d8a93a170 Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 13:56:58 +1000 Subject: [PATCH 4/6] Compute minimum particle subhalo just when the fixes for the transients are applied --- src/tree_builder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tree_builder.cpp b/src/tree_builder.cpp index ea558f4..79b2110 100644 --- a/src/tree_builder.cpp +++ b/src/tree_builder.cpp @@ -750,8 +750,8 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector &halos, Simul 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){ + 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 @@ -762,7 +762,7 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector &halos, Simul } } // minimum particle number for structures - if (exec_params.define_transient == ExecutionParameters::ZDEP_3SIGMA || exec_params.define_transient == ExecutionParameters::CONST_10MINPART){ + 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; } From df0b907b97cf5c7ca09140fe60a42f006b5716f8 Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 14:02:55 +1000 Subject: [PATCH 5/6] Add particle_mass variable to default parameter files --- sample.cfg | 1 + sample_lagos23.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/sample.cfg b/sample.cfg index 06c4d50..34d5047 100644 --- a/sample.cfg +++ b/sample.cfg @@ -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 diff --git a/sample_lagos23.cfg b/sample_lagos23.cfg index 3dfee36..03e90b2 100644 --- a/sample_lagos23.cfg +++ b/sample_lagos23.cfg @@ -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 From 5931dfae3bb24b4be7047cb13665426c6a48d128 Mon Sep 17 00:00:00 2001 From: angel-chandro Date: Fri, 13 Sep 2024 15:38:01 +1000 Subject: [PATCH 6/6] Commenting better the changes --- src/tree_builder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tree_builder.cpp b/src/tree_builder.cpp index 79b2110..bf495a7 100644 --- a/src/tree_builder.cpp +++ b/src/tree_builder.cpp @@ -749,7 +749,7 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector &halos, Simul std::set halo_snapshots; for(const auto &halo: halos) { halo_snapshots.insert(halo->snapshot); - // compute the minimum particle number for structures + // 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 @@ -761,7 +761,7 @@ void HaloBasedTreeBuilder::loop_through_halos(std::vector &halos, Simul } } } - // minimum particle number for structures + // 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; }