1
|
|
|
# coding: utf-8 |
2
|
|
|
# Copyright (c) 2020 Stefan Bender |
3
|
|
|
# |
4
|
|
|
# This file is part of pyeppaurora. |
5
|
|
|
# pyeppaurora is free software: you can redistribute it or modify |
6
|
|
|
# it under the terms of the GNU General Public License as published |
7
|
|
|
# by the Free Software Foundation, version 2. |
8
|
|
|
# See accompanying LICENSE file or http://www.gnu.org/licenses/gpl-2.0.html. |
9
|
|
|
"""Particle precipitation spectra |
10
|
|
|
|
11
|
|
|
""" |
12
|
|
|
|
13
|
|
|
import numpy as np |
14
|
|
|
|
15
|
|
|
__all__ = [ |
16
|
|
|
"maxwell_general", |
17
|
|
|
"pflux_maxwell", |
18
|
|
|
] |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
def maxwell_general(en, en_0=10.): |
22
|
|
|
r"""Maxwell number flux spectrum as in Fang2008 [1] |
23
|
|
|
|
24
|
|
|
Defined in Fang et al., JGR 2008, Eq. (1), |
25
|
|
|
normalized to :math:`\int_0^\infty \phi(E) \text{d}E = 1`. |
26
|
|
|
|
27
|
|
|
Parameters |
28
|
|
|
---------- |
29
|
|
|
en: float or array_like (N,) |
30
|
|
|
Energy in [keV] |
31
|
|
|
en_0: float, optional |
32
|
|
|
Characteristic energy in [keV], i.e. mode of the distribution. |
33
|
|
|
Default: 10 keV |
34
|
|
|
|
35
|
|
|
Returns |
36
|
|
|
------- |
37
|
|
|
phi: float or array_like (N,) |
38
|
|
|
Normalized differential hemispherical number flux at `en` in [keV-1 cm-2 s-1] |
39
|
|
|
([keV] or scaled by 1 keV-2 cm-2 s-1, e.g.). |
40
|
|
|
""" |
41
|
|
|
return en / en_0**2 * np.exp(-en / en_0) |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
def pflux_maxwell(en, en_0=10.): |
45
|
|
|
r"""Maxwell particle flux spectrum as in Fang2008 [1] |
46
|
|
|
|
47
|
|
|
Defined in Fang et al., JGR 2008, Eq. (1). |
48
|
|
|
The total precipitating energy flux is fixed to 1 keV cm-2 s-1, |
49
|
|
|
multiply by Q_0 [keV cm-2 s-1] to scale the particle flux. |
50
|
|
|
|
51
|
|
|
Normalized to :math:`\int_0^\infty \phi(E) E \text{d}E = 1`. |
52
|
|
|
|
53
|
|
|
Parameters |
54
|
|
|
---------- |
55
|
|
|
en: float or array_like (N,) |
56
|
|
|
Energy in [keV] |
57
|
|
|
en_0: float, optional |
58
|
|
|
Characteristic energy in [keV], i.e. mode of the distribution. |
59
|
|
|
Default: 10 keV. |
60
|
|
|
|
61
|
|
|
Returns |
62
|
|
|
------- |
63
|
|
|
phi: float or array_like (N,) |
64
|
|
|
Hemispherical differential particle flux at `en` in [keV-1 cm-2 s-1] |
65
|
|
|
([kev-2] scaled by unit energy flux). |
66
|
|
|
""" |
67
|
|
|
return 0.5 / en_0 * maxwell_general(en, en_0) |
68
|
|
|
|