aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters/halo.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-23 10:24:00 +0800
committerAaron LI <aly@aaronly.me>2017-07-23 10:32:38 +0800
commit3bd9c730e20c9a70d17c1459ddf78ba71ee84f60 (patch)
treeb74c651e157f4ae0074feb47de87eb006de0b5b1 /fg21sim/extragalactic/clusters/halo.py
parentbace1e88fcf2f906a1ae17c3c10004eedb176070 (diff)
downloadfg21sim-3bd9c730e20c9a70d17c1459ddf78ba71ee84f60.tar.bz2
clusters/halo.py: Constrain tau_acc to avoid zero diffusion
Zero or negative diffusion coefficient leads to unstable or wrong results due to numerical algorithm/scheme adopted to solve the Fokker-Planck equation. Also add a NOTE to the FokkerPlanckSolver class. Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/extragalactic/clusters/halo.py')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 8fdc78c..75789b6 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -243,6 +243,12 @@ class RadioHalo:
"""
Diffusion term/coefficient for the Fokker-Planck equation.
+ NOTE
+ ----
+ The diffusion coefficients cannot be zero or negative, which
+ may cause unstable or wrong results. So constrain ``tau_acc``
+ be a sufficient large but finite number.
+
Parameters
----------
gamma : float
@@ -322,7 +328,12 @@ class RadioHalo:
A reference value of the acceleration time due to TTD
(transit-time damping) resonance is ~0.1 Gyr (Ref.[brunetti2011],
Eq.(27) below); the formula derived by [cassano2005] (Eq.(40))
- has a dependence on eta_turb.
+ has a dependence on ``eta_turb``.
+
+ NOTE
+ ----
+ A zero diffusion coefficient may lead to unstable/wrong results,
+ so constrain this acceleration timescale be finite.
Returns
-------
@@ -332,9 +343,11 @@ class RadioHalo:
"""
# The reference/typical acceleration timescale
tau_ref = 0.1 # [Gyr]
+ # The maximum timescale to avoid unstable results
+ tau_max = 100.0 # [Gyr]
if t > self.age_merger + self.time_crossing:
- tau = np.inf
+ tau = tau_max
else:
tau = tau_ref / self.eta_turb
return tau