diff options
author | Aaron LI <aly@aaronly.me> | 2018-10-31 17:24:16 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-10-31 17:24:16 +0800 |
commit | 23e033542455ae6105edf7f28c945d9cb7e6223b (patch) | |
tree | de99bb33cd1aaa3100d1b4a995da3900ddb9d63b /fg21sim/extragalactic | |
parent | 01c61b6b3c9eb8c1d5723d4f9ca9da12b7a3d0be (diff) | |
download | fg21sim-23e033542455ae6105edf7f28c945d9cb7e6223b.tar.bz2 |
clusters/halo: Support to calculate the fiducial electron spectrum
The fiducial electron spectrum is the one that is derived with the
turbulent acceleration turned off. It can be used to determine whether
the acceleration is indeed effective for one cluster and then further
determine whether the radio halo is formed/observable.
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 4d0e41b..c83e791 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -423,19 +423,20 @@ class RadioHalo: n_inj = self.fp_injection(self.gamma) n0_e = n_inj * (self.age_begin - self.time_init) - logger.debug("Derive the initial electron spectrum ...") + logger.debug("Deriving the initial electron spectrum ...") self._acceleration_disabled = True - dt = self.fpsolver.tstep tstart = self.age_begin tstop = self.age_begin + self.time_init - self.fpsolver.tstep = 3 * dt # Bigger step to save time + self.fpsolver.tstep = self.time_step * 3 # To save time + n_e = self.fpsolver.solve(u0=n0_e, tstart=tstart, tstop=tstop) - self.fpsolver.tstep = dt self._acceleration_disabled = False + self.fpsolver.tstep = self.time_step return n_e - def calc_electron_spectrum(self, tstart=None, tstop=None, n0_e=None): + def calc_electron_spectrum(self, tstart=None, tstop=None, n0_e=None, + fiducial=False): """ Calculate the relativistic electron spectrum by solving the Fokker-Planck equation. @@ -456,11 +457,15 @@ class RadioHalo: The initial electron spectrum (number distribution). Default: ``self.electron_spec_init`` Unit: [cm^-3] + fiducial : bool + Whether to disable the turbulent acceleration and derive the + fiducial electron spectrum? + Default: ``False`` Returns ------- n_e : float 1D `~numpy.ndarray` - The solved electron spectrum at ``tstop``. + The solved electron spectrum. Unit: [cm^-3] """ if tstart is None: @@ -469,7 +474,15 @@ class RadioHalo: tstop = self.age_obs if n0_e is None: n0_e = self.electron_spec_init - return self.fpsolver.solve(u0=n0_e, tstart=tstart, tstop=tstop) + if fiducial: + self._acceleration_disabled = True + self.fpsolver.tstep = self.time_step * 2 # To save time + + n_e = self.fpsolver.solve(u0=n0_e, tstart=tstart, tstop=tstop) + self._acceleration_disabled = False + self.fpsolver.tstep = self.time_step + + return n_e def fp_injection(self, gamma, t=None): """ |