aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-25 21:02:32 +0800
committerAaron LI <aly@aaronly.me>2017-10-25 21:06:17 +0800
commit7999e74388e1760f95420e1886efe32cf3ec6516 (patch)
treee14d595e1d772b2f276f25b8f761106848a500fa
parente4abd18875c642ff84ba11cce44a11f55cba5003 (diff)
downloadfg21sim-7999e74388e1760f95420e1886efe32cf3ec6516.tar.bz2
clusters/solver: Update buffer_np description and handling
-rw-r--r--fg21sim/extragalactic/clusters/halo.py2
-rw-r--r--fg21sim/extragalactic/clusters/solver.py13
2 files changed, 11 insertions, 4 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 281093d..6b91f7f 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -149,6 +149,8 @@ class RadioHalo:
self.gamma_max = self.configs.getn(comp+"/gamma_max")
self.gamma_np = self.configs.getn(comp+"/gamma_np")
self.buffer_np = self.configs.getn(comp+"/buffer_np")
+ if self.buffer_np == 0:
+ self.buffer_np = None
self.time_step = self.configs.getn(comp+"/time_step")
self.time_init = self.configs.getn(comp+"/time_init")
self.injection_index = self.configs.getn(comp+"/injection_index")
diff --git a/fg21sim/extragalactic/clusters/solver.py b/fg21sim/extragalactic/clusters/solver.py
index 52e07c7..ad5c320 100644
--- a/fg21sim/extragalactic/clusters/solver.py
+++ b/fg21sim/extragalactic/clusters/solver.py
@@ -109,10 +109,12 @@ class FokkerPlanckSolver:
f_escape : function, optional
Function f(x,t) to calculate the escape coefficient T(x,t)
buffer_np : int, optional
- Number of grid points taking as the buffer region near the lower
- boundary. The densities within this buffer region will be replaced
- by extrapolating an power law to avoid unphysical accumulations.
- This fix is ignored if this parameter is not specified.
+ Number of grid cells taken as the buffer regions near both the
+ lower and upper boundaries. The values within the buffer regions
+ will be replaced by extrapolating with a power law to avoid
+ unphysical pile-ups.
+ The fix will be ignored if this parameter is ``None`` or is less
+ than 2.
(This parameter is suggested to be about 5%-10% of ``x_np``.)
NOTE
@@ -142,6 +144,9 @@ class FokkerPlanckSolver:
self.f_injection = f_injection
self.f_escape = f_escape
self.buffer_np = buffer_np
+ if (buffer_np is not None) and (buffer_np < 2):
+ logger.warning("buffer_np set but < 2; disable boundary fixes!")
+ self.buffer_np = None
@property
def x(self):