From 8b2083b53c5f897aed7292f005d35674a962594a Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 22 Oct 2017 16:21:41 +0800 Subject: clusters/halo: Add "use_max_merger" option to allow use max merger events --- fg21sim/configs/20-extragalactic.conf.spec | 14 ++++++--- fg21sim/extragalactic/clusters/main.py | 50 ++++++++++++++++++------------ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/fg21sim/configs/20-extragalactic.conf.spec b/fg21sim/configs/20-extragalactic.conf.spec index ea6479f..042a808 100644 --- a/fg21sim/configs/20-extragalactic.conf.spec +++ b/fg21sim/configs/20-extragalactic.conf.spec @@ -108,10 +108,6 @@ # Unit: [Msun] merger_mass_min = float(default=1e12, min=1e10, max=1e14) - # Mass ratio of the main and sub clusters, below which is regarded as - # a major merger event. - ratio_major = float(default=3.0, min=1.0, max=10.0) - # The merger timescale, which roughly describes the duration of the # merger-induced disturbance (~2-3 Gyr). This timescale is much longer # the merger crossing time (~1 Gyr), and is also longer than the lifetime @@ -119,6 +115,16 @@ # Unit: [Gyr] tau_merger = float(default=2.0, min=1.0, max=5.0) + # Mass ratio of the main and sub clusters, below which is regarded as + # a major merger event. + ratio_major = float(default=3.0, min=1.0, max=10.0) + + # Whether to use the maximum merger event (i.e., biggest mass of the + # sub cluster) within the above ``tau_merger`` timescale to simulate the + # subsequent radio halo simulation? Otherwise only the most recent major + # merger event will be used. + use_max_merger = boolean(default=False) + # The fraction of the magnetic field energy density w.r.t. the ICM # thermal energy density, which is used to determine the mean magnetic # field strength within the ICM and is also assumed to be uniform. diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index dfc8e6e..1aeb522 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -88,6 +88,7 @@ class GalaxyClusters: self.output_dir = self.configs.get_path(comp+"/output_dir") self.merger_mass_min = self.configs.getn(comp+"/merger_mass_min") self.ratio_major = self.configs.getn(comp+"/ratio_major") + self.use_max_merger = self.configs.getn(comp+"/use_max_merger") self.tau_merger = self.configs.getn(comp+"/tau_merger") self.frequencies = self.configs.frequencies self.filename_pattern = self.configs.getn("output/filename_pattern") @@ -169,38 +170,43 @@ class GalaxyClusters: def _simulate_mergers(self): """ - Simulate the *recent major merger* event for each cluster. + Simulate the *recent major/maximum merger* event for each cluster. First simulate the cluster formation history by tracing the merger and accretion events of the main cluster, then identify the most recent major merger event according to the mass ratio - of two merging clusters. And the properties of the found merger - event are appended to the catalog. + of two merging clusters. If ``self.use_max_merger=True`` then + the recent maximum merger (associated with biggest sub cluster) + is selected. The merger event properties are then appended to + the catalog for subsequent radio halo simulation. NOTE ---- - There may be no such recent major merger event satisfying the + There may be no such recent *major* merger event satisfying the criteria, since we only tracing ``tau_merger`` (~2-3 Gyr) back. On the other hand, the cluster may only experience minor merger or accretion events. Catalog columns --------------- - * ``rmm_mass1``, ``rmm_mass2`` : masses of the main and sub - clusters upon the recent major merger event; unit: [Msun] - * ``rmm_z``, ``rmm_age`` : redshift and cosmic age; unit: [Gyr] - of the recent major merger event. + * ``rmm_mass1``, ``rmm_mass2`` : [Msun] masses of the main and sub + clusters upon the recent major/maximum merger event; + * ``rmm_z``, ``rmm_age`` : redshift and cosmic age [Gyr] + of the recent major/maximum merger event. """ logger.info("Simulating the galaxy formation to identify " + - "the most recent major merger event ...") + "the most recent major/maximum merger event ...") + if self.use_max_merger: + logger.info("Use the recent *maximum* merger event!") + else: + logger.info("Use the recent *major* merger event!") num = len(self.catalog) mdata = np.zeros(shape=(num, 4)) mdata.fill(np.nan) - num_major = 0 # number of clusters with recent major merger for i, row in zip(range(num), self.catalog.itertuples()): ii = i + 1 - if ii % 50 == 0: + if ii % 100 == 0: logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num)) z0, M0 = row.z, row.mass age0 = COSMO.age(z0) @@ -209,9 +215,11 @@ class GalaxyClusters: ratio_major=self.ratio_major, merger_mass_min=self.merger_mass_min) clform.simulate_mergertree(main_only=True) - mmev = clform.recent_major_merger + if self.use_max_merger: + mmev = clform.max_merger + else: + mmev = clform.recent_major_merger if mmev: - num_major += 1 mdata[i, :] = [mmev["M_main"], mmev["M_sub"], mmev["z"], mmev["age"]] @@ -220,14 +228,16 @@ class GalaxyClusters: "rmm_z", "rmm_age"]) self.catalog = self.catalog.join(mdf, how="outer") self.catalog_comment += [ - "rmm_mass1 : main cluster mass at recent major merger; [Msun]", - "rmm_mass2 : sub cluster mass at recent major merger; [Msun]", - "rmm_z : redshift of the recent major merger", - "rmm_age : cosmic age of the recent major merger; [Gyr]", + "rmm_mass1 : [Msun] main cluster mass of recent major/maximum merger", + "rmm_mass2 : [Msun] sub cluster mass of recent major/maximum merger", + "rmm_z : redshift of the recent major/maximum merger", + "rmm_age : [Gyr] cosmic age at the recent major/maximum merger", ] - logger.info("Simulated and identified recent major merger events.") - logger.info("%d (%.1f%%) clusters have recent major mergers." % - (num_major, 100*num_major/num)) + logger.info("Simulated and identified recent major/maximum mergers.") + if not self.use_max_merger: + num_major = np.sum(~mdf["rmm_z"].isnull()) + logger.info("%d (%.1f%%) clusters have recent major mergers." % + (num_major, 100*num_major/num)) def _simulate_halos(self): """ -- cgit v1.2.2