aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters/main.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-01-10 00:11:08 +0800
committerAaron LI <aly@aaronly.me>2019-01-10 00:11:08 +0800
commit9a5478446d5e28b64783efe9c8282f2eb27be1a5 (patch)
tree4e945e1385144735f5a5c518e5d5c19e090a84b2 /fg21sim/extragalactic/clusters/main.py
parent01bf43948b9e186953ff0fa3d2b76a8a958689ae (diff)
downloadfg21sim-9a5478446d5e28b64783efe9c8282f2eb27be1a5.tar.bz2
clusters/main: Add _calc_cluster_info()
Move the calculation of Rvir, kT, and B from halo.py to main.py.
Diffstat (limited to 'fg21sim/extragalactic/clusters/main.py')
-rw-r--r--fg21sim/extragalactic/clusters/main.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 2a1a6b3..bd68f0d 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -172,6 +172,28 @@ class GalaxyClusters:
]
logger.info("Added catalog items: age, lon, lat, felong, rotation.")
+ def _calc_cluster_info(self):
+ """
+ Calculate some basic information for each cluster.
+ """
+ logger.info("Calculating basic information for each cluster ...")
+ for cdict in enumerate(self.catalog):
+ z, mass = cdict["z"], cdict["mass"]
+ Rvir = helper.radius_virial(mass, z)
+ kT = helper.kT_cluster(mass, z, configs=self.configs)
+ B = helper.magnetic_field(mass, z, configs=self.configs)
+ cdict.update([
+ ("Rvir", Rvir),
+ ("kT", kT),
+ ("B", B),
+ ])
+
+ self.comments += [
+ "Rvir - [kpc] virial radius",
+ "kT - [keV] ICM mean temperature",
+ "B - [uG] magnetic field",
+ ]
+
def _simulate_mergers(self):
"""
Simulate the formation history of each cluster to build their
@@ -519,6 +541,7 @@ class GalaxyClusters:
else:
self._simulate_catalog()
self._process_catalog()
+ self._calc_cluster_info()
self._simulate_mergers()
if self.use_dump_halos_data: