VERB_code_2.3
VF Namespace Reference

Various functions. More...

Functions

double alc (double L)
 Loss cone calculations. More...
 
double T (double alpha)
 Function for bounce time. More...
 
double G (double alpha)
 G-function. More...
 
double Y (double alpha)
 Y(α) function. More...
 
double Dfe (double alpha, double Ke, double L, double Kp)
 Electrostatic radial diffusion coefficient. More...
 
double Coulomb (double L, double energy)
 Coulomb scattering electron lifetime. More...
 
double Precipitation (double Kp, double L, double energy)
 Empirical electron lifetime. More...
 
double Jc_calc (double L, double pc, double Alpha)
 Caltulating J*c. More...
 
double f_interp (double E, double f1, double E1, double f2, double E2)
 Interpolation f on specific energy. More...
 
double mu_calc (double L, double pc, double Alpha)
 Caltulating μ. More...
 
double density (double L)
 Chorus density model. More...
 
double max (double v1, double v2)
 Return maximum. More...
 
string dtostr (double n)
 Convert double to string. More...
 
bool check_time (int iter, int d_iter)
 Small routine for checking if it is right iteration for the next output. More...
 
function for bounce
double bounce_time_new (double L, double pc, double alpha)
 bounce time More...
 
Computation of dipole magnetic field
double B (double Lparam)
 Dipole magnetic field. More...
 
Specifying outer boundary
double Outer_Boundary_Flux_at_L7 (double E7, string J_L7_function)
 Call various flux model of the outer boundary. More...
 
double J_L7 (double K, double x1, double y1, double x2, double y2)
 Interpolate spectrum. More...
 
double J_L7_corrected (double K)
 Outer boundary spectrum (accurate) More...
 
double J_L7_corrected_0 (double K)
 Outer boundary spectrum (accurate with 0 end the end) More...
 
double J_L7_old (double K)
 Outer boundary spectrum (old) More...
 
Converting pc to energy
double pfunc (double K)
 Computation of moumentum from Kinetic energy . More...
 
double Kfunc (double pc)
 Computation of Kinetic energy from given momentum . More...
 
Converting μ to pc
double mu2pc (double L, double mu, double alpha)
 Convert μ to pc. More...
 
double pc2mu (double L, double pc, double alpha)
 Convert pc to μ. More...
 

Detailed Description

Various functions.

This namespace presented in variousFunctions.h and variousFunctions.cpp.

  • α is equatorial pitch-angle
  • pc is momentum
  • L - L-shell

Function Documentation

double VF::alc ( double  L)

Loss cone calculations.

Loss cone in rad.

\[ sin(\alpha)^2 = \frac{L^{-3}}{\sqrt{4 - \frac{3}{L}}} \]

Parameters
L- L-shell

Definition at line 23 of file variousFunctions.cpp.

double VF::B ( double  Lparam)

Dipole magnetic field.

Computation of dipole magnetic field in Gauss.

\[ B = \frac{0.31}{L^3} \]

Parameters
Lparam- L-shell

Definition at line 72 of file variousFunctions.cpp.

double VF::bounce_time_new ( double  L,
double  pc,
double  alpha 
)

bounce time

Bounce time, in days.

\[ \tau = \frac{4.0 \times L \times R_E \times mc^2}{pc \times c \times T(\alpha) \times ( 60 \times 60 \times 24 )}\]

Parameters
L- L-shell
pc- momentum
alpha- α

Definition at line 49 of file variousFunctions.cpp.

bool VF::check_time ( int  iter,
int  d_iter 
)

Small routine for checking if it is right iteration for the next output.

Function determs is it right iteration for the next output.

Parameters
iter- base iteration to check
d_iter- second iteration to check

Definition at line 367 of file variousFunctions.cpp.

double VF::Coulomb ( double  L,
double  energy 
)

Coulomb scattering electron lifetime.

-----------------------------------------------------------------—
Coulomb scattering electron lifetime [Lyons and Thorne, 1973, JGR]
-----------------------------------------------------------------—
(1) Inputs : L in dimensionless, energy in MeV
(2) Outputs: tau in days
-----------------------------------------------------------------—

Parameters
L- L-shell
energy- Energy

Definition at line 137 of file variousFunctions.cpp.

double VF::density ( double  L)

Chorus density model.

Chorus density model? (deprecated?) \( D = 10^{-0.3145L + 3.9043} \)

Parameters
L- L-shell

Definition at line 337 of file variousFunctions.cpp.

double VF::Dfe ( double  alpha,
double  Ke,
double  L,
double  Kp 
)

Electrostatic radial diffusion coefficient.

-------------------------------------------------------------------------------—
Electrostatic radial diffusion coefficient [see Brautigam and Albert(2000),JGR]
-------------------------------------------------------------------------------—
This model seems to overestimate radial diffusion rate, so we need to scale down
by adjusting a parameter "scale_factor".
-------------------------------------------------------------------------------—
(1) Inputs : alpha in radian, Ke in MeV, L and Kp in dimensionless unit
(2) Outputs : DLLe in 1/day or Re^2/day
-------------------------------------------------------------------------------—

Parameters
alpha- α
Ke- Kinetic energy
L- L-shell
Kp- Kp-Index

Definition at line 87 of file variousFunctions.cpp.

string VF::dtostr ( double  n)

Convert double to string.

Double to string.

Parameters
n- convert this variable to string

Definition at line 360 of file variousFunctions.cpp.

double VF::f_interp ( double  E,
double  f1,
double  E1,
double  f2,
double  E2 
)

Interpolation f on specific energy.

Getting f on specific energy. Linear interpolation of logarithm.

Parameters
E- target E
f1- left f(E1)
E1- left E1
f2- right f(E2)
E2- right E2

Definition at line 313 of file variousFunctions.cpp.

double VF::G ( double  alpha)

G-function.

This function used in Fokker-Plank equation. \( G = \cos(\alpha) \times \sin(\alpha) \) from Jacobian from mu;,J to alpha;, p and bounce avarage. G-function \( G = \cos(\alpha) \times \sin(\alpha) \times T(\alpha)\)

Parameters
alpha- α

Definition at line 40 of file variousFunctions.cpp.

double VF::J_L7 ( double  K,
double  x1,
double  y1,
double  x2,
double  y2 
)

Interpolate spectrum.

Interpolate outer boundary. This function used by VF::J_L7_corrected, VF::J_L7_corrected_0 ... The output is interpolation of the initial spectrum for specific point.

Parameters
K- Energy
x1- Left energy point
y1- Left flux point
x2- Right energy point
y2- Right flux point

Definition at line 228 of file variousFunctions.cpp.

double VF::J_L7_corrected ( double  K)

Outer boundary spectrum (accurate)

Specifying outer boundary, more accurate function.

Parameters
K- Energy

Definition at line 245 of file variousFunctions.cpp.

double VF::J_L7_corrected_0 ( double  K)

Outer boundary spectrum (accurate with 0 end the end)

Specifying outer boundary, more accurate function, zero at infinity

Parameters
K- Energy

Definition at line 259 of file variousFunctions.cpp.

double VF::J_L7_old ( double  K)

Outer boundary spectrum (old)

old version \( J = 8222.6 \times \exp(-7.068 \times K); \)

Parameters
K- Energy

Definition at line 271 of file variousFunctions.cpp.

double VF::Jc_calc ( double  L,
double  pc,
double  Alpha 
)

Caltulating J*c.

Caltulating J*c from L, pc, α.

Warning
Determined up to a constant.

\[ J = 2 \times pc \times L \times Y(\alpha) \]

Parameters
L- L-shell
pc- momentum
Alpha- α

Definition at line 301 of file variousFunctions.cpp.

double VF::Kfunc ( double  pc)

Computation of Kinetic energy from given momentum .

Computation of Kinetic energy from given momentum.

\[ K = (\sqrt{ 1 + ({\frac{pc}{mc^2}})^2 } - 1) \times mc^2 \]

Parameters
pc- momentum

Definition at line 220 of file variousFunctions.cpp.

double VF::max ( double  v1,
double  v2 
)

Return maximum.

Simple maximum.

Parameters
v1- first input double variable
v2- second input double variable

Definition at line 355 of file variousFunctions.cpp.

double VF::mu2pc ( double  L,
double  mu,
double  alpha 
)

Convert μ to pc.

Calculating pc from L, μ, alpha.

\[ pc = \frac{\sqrt{ \mu \times 2 \times B(L) \times mc^2 }}{\sin(\alpha)} \]

Parameters
L- L-shell
mu- μ
alpha- α

Definition at line 283 of file variousFunctions.cpp.

double VF::mu_calc ( double  L,
double  pc,
double  Alpha 
)

Caltulating μ.

Caltulating μ from L, pc, α.

\[ \mu = \frac{pc^2}{mc^2} \times \frac{ \sin(\alpha)^2 } { 2 \times B(L) }; \]

Parameters
L- L-shell
pc- momentum
Alpha- α

Definition at line 329 of file variousFunctions.cpp.

double VF::Outer_Boundary_Flux_at_L7 ( double  E7,
string  J_L7_function 
)

Call various flux model of the outer boundary.

-----------------------------------------------------------------—
Subroutine to call various flux model of the outer boundary at L=7
-----------------------------------------------------------------—
(1) Inputs : EL - energy(MeV) at L=7
J_L7_function - name of boundary flux function
(2) Outputs : JL - flux at L=7
-----------------------------------------------------------------—

Parameters
E7- Energy in MeV at L=7
J_L7_function- name of boundary flux function

Definition at line 188 of file variousFunctions.cpp.

double VF::pc2mu ( double  L,
double  pc,
double  alpha 
)

Convert pc to μ.

Calculating μ from L, pc, alpha.

\[ \mu = \frac{pc^2 \times \sin(\alpha)^2}{B(L) \times 2 \times mc^2 } \]

Parameters
L- L-shell
pc- momentum
alpha- α

Definition at line 292 of file variousFunctions.cpp.

double VF::pfunc ( double  K)

Computation of moumentum from Kinetic energy .

Computation of moumentum from Kinetic energy.

\[ pc = (\sqrt{ { \frac{K}{mc^2} + 1}^2 } - 1) \times mc^2 \]

Parameters
K- Energy (MeV)

Definition at line 212 of file variousFunctions.cpp.

double VF::Precipitation ( double  Kp,
double  L,
double  energy 
)

Empirical electron lifetime.

------------------------------------------------------------------—
Empirical electron lifetime related to the resonant scattering by
plasmaspheric hiss, lightining-generated whistlers
and VLF transmitter signals, which is valid only in the slot region
between 2.5 and Lpp (plasmapause location) [see Su et al, 2010, JGR]
------------------------------------------------------------------—
(1) Inputs : energy in MeV, Kp and L in dimensionless
(2) Outputs : tau in days
------------------------------------------------------------------—
This model is valid up to Lpp, so class "PSD::SourcesAndLosses" checks if input L is larger than Lpp or not. For L<2.5 \( \tau = 10^99 \), for L>=2.5

\[ \tau = \frac{2}{Kp}^2 \times 10^{(L-3.5)^4}+0.4 \]

Parameters
Kp- Kp-Index
L- L-shell
energy- Energy

Definition at line 168 of file variousFunctions.cpp.

double VF::T ( double  alpha)

Function for bounce time.

T(α) - function, related to bounce time

\[ y = sin(\alpha) \]

\[ T = 1.38 + 0.055 \times y^{1/3} - 0.32 \times y^{1/2} - 0.037 \times y^{2/3} - 0.394 \times y + 0.056 \times y^{4/3} \]

[Orlova and Shprits, On the bounce-averaging of scattering rates and the calculation of bounce period ,2011]

Parameters
alpha- α

Definition at line 32 of file variousFunctions.cpp.

double VF::Y ( double  alpha)

Y(α) function.

Y(α) function. More accurate approximation.

\[ y = sin(\alpha); T_0, T_1 = constant; \]

\[ Y = 2(1 - y) \times T_0 + (T_0 - T_1) \times (y \log{y} + 2y - 2 \sqrt{y}) \]

Parameters
alpha- α

Definition at line 58 of file variousFunctions.cpp.