VERB_code_2.3
ElectronFlux.m
1 function [J_L] = ElectronFlux(L,Kp,tau, varargin)
2 %ElectronFlux This function uses the adiabatic conservation of mu to
3 %compute the electron flux as a function of L.
4 
5 % First, we know the electron flux J as a function of energy at a fixed mu.
6 % Then, assuming the PSD (phase space density) profile is independent of
7 % mu, and J = PSD*(electron momentum squared) as well as the fact that
8 % the electron momentum is related to mu, we can compute J as a function
9 % of L. Ask Alexander Drozdov (adrozdov@ucla.edu) for details on how to
10 % compute this if stuck. We have used Section 3 of RBM 2004 paper on VERB
11 % code to inform this code. See rbm.epss.ucla.edu for link.
12 
13 % L_normalised should be scalar. We ONLY want to reproduce figure 1 of
14 % RBM 2004 paper here, so this function is designed explicitly for that.
15 
16 % Here, angle corresponds to 90 degrees in radians.
17 
18 angle = 1.5707; % this is at angle pi/2
19 
20 L_norm = 7; % the value of L we wish to normalise at
21 
22 if(~any(L == L_norm))
23  % checks to see if the array provided contains 7
24  error('Cannot find L == 7 in the L array');
25 end
26 
27 if(nargin==3)
28  PSD_prof = steady_state(L, RadialDiffCoeff(Kp,L),tau);
29 % the phase space density profile for all L
30 else
31  PSD_prof = varargin{1};
32 end
33 
34 PSD_norm = PSD_prof./PSD_prof(L == L_norm); % PSD normalised at L_norm
35 
36 mu_L = pc2mu(L,pfunc(1), angle); % mu for every L at E = 1 MeV
37 
38 E_7 = Kfunc(mu2pc(L_norm, mu_L, angle)); % energy for every mu at L = 7
39 
40 J_0 = 8222.6.*exp(-7.068.*E_7); % Flux at every L that corresponds to mu_L
41 
42 pc_7 = mu2pc(L_norm,mu_L,angle); % pc for every mu at L = 7
43 
44 pc_L = mu2pc(L,mu_L,angle); % pc for every mu at every L
45 
46 J_L = (J_0./pc_7.^2).*PSD_norm.*(pc_L.^2); % desired profile
47 end
48 
void steady_state(Matrix1D< double > &f, double tau, double Kp, int nx, Matrix1D< double > &L, double f_bnd_out, double f_bnd_in)
Definition: PSD.cpp:2373
double mu2pc(double L, double mu, double alpha)
Convert μ to pc.
double pfunc(double K)
Computation of moumentum from Kinetic energy .
double pc2mu(double L, double pc, double alpha)
Convert pc to μ.
Phase Space Density class.
Definition: PSD.h:48
double density(double L)
Chorus density model.
double Kfunc(double pc)
Computation of Kinetic energy from given momentum .