From 13861dc37376e04ea64bbf61a49c0f183d84a558 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 18 Oct 2017 23:20:40 +0800 Subject: clusters/halo: Increase the time step, but require a minimum of 20 steps --- fg21sim/configs/20-extragalactic.conf.spec | 2 +- fg21sim/extragalactic/clusters/halo.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'fg21sim') diff --git a/fg21sim/configs/20-extragalactic.conf.spec b/fg21sim/configs/20-extragalactic.conf.spec index cda58b1..425df88 100644 --- a/fg21sim/configs/20-extragalactic.conf.spec +++ b/fg21sim/configs/20-extragalactic.conf.spec @@ -145,7 +145,7 @@ # Time step for solving the Fokker-Planck equation # Unit: [Gyr] - time_step = float(default=0.01, min=1e-5, max=0.1) + time_step = float(default=0.02, min=1e-4, max=0.1) # Electron injection, which is assumed to have a constant injection # rate and a power-law spectrum. diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 6bfa4ca..a481ce5 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -290,6 +290,13 @@ class RadioHalo: n_inj = self.fp_injection(self.gamma) n0_e = n_inj * tstart + # When the evolution time is too short, decrease the time step + # to improve the results. + # XXX: is this necessary??? + nstep_min = 20 + if (tstop - tstart) / self.fpsolver.tstep < nstep_min: + self.fpsolver.tstep = (tstop - tstart) / nstep_min + self.electron_spec = self.fpsolver.solve(u0=n0_e, tstart=tstart, tstop=tstop) return self.electron_spec -- cgit v1.2.2