SlideShare a Scribd company logo
1 of 54
Download to read offline
Radboud University Nijmegen
Department of Astrophysics
Bachelor Thesis
The propagation of cosmic rays in the
galactic magnetic field
Author:
Jordy Davelaar
Supervisor:
Prof. A. Achterberg
Second corrector:
Dr. ir. G.A. De Wijs
October 31, 2013
1 ABSTRACT
1 Abstract
Aims
The aim of this project is to find an integrator that solves the trajectories of cosmic rays which
are propagating through a random magnetic field.
Methods
The Runge Kutta Fehlberg method is used as an integrator. The accuracy of the integrator has
been tested with several cases; the case of a single particle in a uniform magnetic field, B
drifting of a single particle, E ×B drifting of a single particle, N-particles in an uniform magnetic
field and the low scattering limit. If the integrator is indeed accurate enough it will be used to
solve the equation of motion in the quasi random field.
Results
The integrator has been tested and it is shown that it is indeed accurate enough. The single
particle in a uniform magnetic had a stable trajectory with fluctuations with an order of mag-
nitude of 10−6
. The the experimental value of the B drifting was only 0.05% less than the
theoretical one. The value of the E × B drifting was exactly the same as predicted by theory.
The N particles in a uniform magnetic field differ 0.3% of the theoretical value. And the low
scattering limit was accurate up to 8.8%. The integrator is then used to evaluate different cases
for the magnetic field with a random component of arbitrary strength, defined as B = B0 ˆz +δB.
Conclusion
The Runge Kutta Fehlberg method is an accurate integrator for simulating the trajectories of
particles in a random magnetic field. The diffusion coefficients and diffusion times are calculated
and they have the right order of magnitudes and the right scaling in the low scattering limit.
For radii larger than a coherence length and δB bigger than B0 the diffusion coefficient gets a
different behavior, this is described in chapter 11.
ii
CONTENTS CONTENTS
Contents
1 Abstract ii
2 Introduction 1
3 Electromagnetism 3
3.1 Lorentz Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2 Cyclotron motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.3 Relativistic Lorentz force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.4 E × B drift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.5 B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.6 Casting the equations into a dimensionless form . . . . . . . . . . . . . . . . . . . 6
4 Simulating the cosmic magnetic field 9
5 Creating the cosmic rays 11
6 N-particle simulations 13
6.1 Motions in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . 13
7 Diffusion processes 15
7.1 The random walk model for diffusion in one dimension . . . . . . . . . . . . . . . 15
7.2 The weak scattering limit for scattering by random
magnetic fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
8 Numerical methods 19
8.1 Runge Kutta Fehlberg Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
9 Testing the integrator 21
9.1 Motion in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.2 Motions with E × B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.3 Motions with B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.4 N particles in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . 28
9.5 N particles low scattering limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.6 Distribution of particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
10 Simulating the different cases 31
10.1 Diffusion coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
10.1.1 Weak Scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
10.1.2 Strong scattering regime . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
10.2 Diffusion times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
11 Conclusion 41
12 Bibliography 43
13 Appendices 45
iv
2 INTRODUCTION
2 Introduction
In 1912 Victor Hess measured the flux of charged particles in the atmosphere. This gave an
interesting result: the higher he measured, the higher the flux was. It was thought then that
the crust of the Earth was the main source of ionized radiation. If that would be the case then
when you go higher into the atmosphere you expect a decreasing flux due to the shielding of
the underlying air column. At first they thought that the source of the charged particles was
the sun. Hess did measurements during a total eclipse and still got this increasing flux. The
explanation for this radiation is a flux of charged particles which has an galactic or extra galactic
origin. These particles are called cosmic rays. These high energetic particles strike the Earth’s
atmosphere, creating a shower of particles. In 1936 Hess received the Nobel Prize for his discovery.
The origin of the cosmic rays is still open to debate. The low- and medium-energetic cosmic
rays, which have energies up to 1018
eV , probably have a solar or galactic origin. The high and
ultra-high cosmic rays probably have an extragalactic origin. There is strong evidence that the
cosmic rays with a galactic origin are produced in super nova remnants. The origin of the cosmic
rays with energies above 1018
eV is still unknown. The uncertainty for the low and medium
energetic particles is due to the fact that the charged particles are confined by the magnetic
fields of a galaxy. These magnetic fields scatter them and due to this scattering they propagate
in a diffuse way. The amount of scattering is related to the energy of the particles, the higher
the energy the bigger the free path length and the faster the diffusion. Due to this scattering we
are unable to trace the origin of the low-energy particles. The very energetic particles can be
traced back but they are extremely rare.
The trajectories of the particles in a magnetic field with a random component can not be
solved analytically. Using numerical algorithms we are able to solve them. In this way we can
understand their behavior in a statistical sense and find equations that predict it. For example
with the diffusion coefficients of particles we are able to better understand the measurements
of cosmic showers. For instance: if a detector measures two high energetic events at almost the
same place in the sky at almost the same time, is it just coincidence or is it possible that these
two cosmic rays had the same origin?
The main goal of this project was to program an integrator that can solve the equations of
motion of particles in a turbulent magnetic field. In chapter three we will discuss some single
particle cases that can be solved analytically. The cases that will be discussed in chapter three
are: the single particle in a uniform magnetic field , E ×B drifting and B drifting. At the end of
chapter three we will look back at the derived equations and cast them into a dimensionless form.
These equations will be used to check the accuracy of the integrator that has been programmed.
In chapter four it is explained how the magnetic field is simulated and in chapter 5 we use a
similar approach to simulate the particles. In chapter six we use statistics to find equations for
the mean velocity and its deviation of the N particles in a uniform magnetic field.
In the case of turbulent magnetic fields the particles propagate diffusively. This is explained
in chapter 7.1. In par. 7.2 the low scattering limit is explained, this is an analytic solvable limit
for the diffuse propagation of the particles. In chapter 8 we describe the numerical method that
is used. In chapter 9 the test cases are used to check the accuracy of the integrator and in chapter
10 we use the integrator to solve the equations of motion of a particle in a quasi turbulent
magnetic field. In chapter 11 we look back at the results and draw our conclusions.
This subject was presented to me by prof. A. Achterberg who is a professor at the Astronomy
Department of the Radboud University in Nijmegen. I came in contact with him with help of dr.
1
2 INTRODUCTION
M. Haverkorn who I asked for a theoretical bachelor student project. In this bachelor project I
definitely learned a lot that I can use in the future. The power of simulating nature to understand
it, is really fascinating.
I would like to thank my supervisor, prof. A. Achterberg, for his time, assitance and for
answering my questions. Without his help none of this would have been possible. I also would
like to thank my seccond corrector dr. ir. G. A. de Wijs.
2
3 ELECTROMAGNETISM
3 Electromagnetism
3.1 Lorentz Force
In electromagnetism the Lorentz force is the force that acts on charged particles due to a magnetic
or electric field. It has been derived by Hendrik Lorentz in the nineteenth century. The force F
that a particle experiences if it is in an electromagnetic field is in CGS units [1]
F = q(E +
v
c
× B) (1)
with q the charge of the particle, v the velocity of the particle, E the electric field, B the
magnetic field and c the speed of light.
3.2 Cyclotron motion
In this paragraph we will solve the equation of motion for a single particle in a uniform magnetic
field. This will give a relation for the radius and the frequency of the motion.
If the particle is in an uniform magnetic field, which is in the ˆz direction, the force that acts
on the particle is
Fx =
q
c
vyBz
Fy = −
q
c
vxBz
Fz = 0.
Newtons second law states
F =
dp
dt
(2)
with p the momentum of a particle. Using (2) and decoupling the differential equations gives
˙vx = −
qBz
mc
2
vx
˙vy = −
qBz
mc
2
vy
˙vz = 0.
This is an harmonic oscillation around the magnetic field lines with frequency
ω0 =
qBz
mc
.
The radius of the motion can be calculated with the help of the centrifugal force
Fc =
mv⊥
2
r
=
qv⊥B
c
.
This gives for the radius
r0 =
mcv⊥
qB
.
This simple analytic result will be used to evaluate the accuracy of the integrator.
3
3.3 Relativistic Lorentz force 3 ELECTROMAGNETISM
3.3 Relativistic Lorentz force
The charged particles in the cosmic magnetic fields have ultra high energies. The classical ap-
proach as in par. 2.2 is in this case not valid. Relativistic effects, caused by the high speeds of
the particles, have to be taken into account. This will result in a Lorentz contracted radius and
time dilated frequency.
In that case the Lorentz force is [1]
dp
dt
= q(E +
v
c
× B). (3)
On first sight there is no difference, but p is now the spatial component of the four-momentum
of the particle, so
dv
dt
=
q
mγ
(E +
v
c
× B) (4)
with
γ =
1
1 − β2
β =
v
c
.
The radius and frequency of the cyclotron motion in the relativistic case is
rg =
γc2
mβ⊥
qB
= γr0 (5)
ωg =
qBz
γmc
=
ω0
γ
. (6)
3.4 E × B drift
In this paragraph we will solve the equation of motion of a particle drifting in crossed magnetic
and electric fields. This will lead to a relation for the drift velocity.
It is possible to write the equation of motion in alternative form by splitting the velocities into
two components, one parallel to the magnetic field and one perpendicular to the magnetic field so
that v = v + v⊥. The v coincides with the component of the guiding center along the magnetic
field. The perpendicular velocity is the guiding center velocity component perpendicular to the
magnetic field. The equation of motion then reads
m
dv
dt
= qE
m
dv⊥
dt
= qE⊥ +
q
c
v⊥ × B.
Due to the electric field the particle gets accelerated and decelerated. This leads to an drift
velocity vdrift. In the case of E × B drifting the electric field on has a component perpendicular
to the direction of the magnetic field. The equation of motion then reads
4
3.5 B drifting 3 ELECTROMAGNETISM
m
dv
dt
= 0
m
dv⊥
dt
= qE⊥ +
q
c
v⊥ × B.
If we assume that the velocity of the drift speed is constant, we can neglect all time derivatives
of the velocities such that
E⊥ +
v⊥
c
× B = 0.
If we then take the cross product of this equation with B we get
B × E⊥ + B ×
v⊥
c
× B = 0.
Using the triple product rule for cross products A × B × C = B(A · C) − C(A · B) we get
B × E⊥ +
v⊥
c
(B · B) − B(
v⊥
c
· B) = 0.
The last product is equal to zero by definition so that
B × E⊥ +
v⊥
c
B2
= 0.
Rewriting this equation gives the drift velocity for E × B drifting
v⊥
c
= βdrift =
E⊥ × B
B2
. (7)
3.5 B drifting
In this paragraph we will give the relation for the B drift velocity.
When a particle is in a magnetic field with B = 0, for example B = (B0 + xdB
dx )ˆz, it
experiences a changing magnetic field when it gyrates around the uniform field B0. Due to the
fact that the magnetic field varies along the x direction, the guiding center of the particle’s
trajectory will move. This movement is called a drift. The drift velocity is given by
vdrift = −
c
qB
M( ⊥B × ˆb). (8)
M is the magnetic moment, which is given by
M =
p⊥v⊥
2B
=
γmv2
⊥
2B
.
The direction of the magnetic field is defined by the unit vector ˆb.
For the drift approximation we assume that to lowest order the orbit of the charged particle
is still given by the orbit in a uniform magnetic field. The field varies with a typical scale given
by L = B
B . If we want that the orbit of the particle is the orbit as in a uniform magnetic field
we want that the radius of the orbit is much smaller that the typical scale L. We can only use
the approximation if
5
3.6 Casting the equations into a dimensionless form 3 ELECTROMAGNETISM
| ⊥B |
| B |
rg
(9)
with rg given by (5).
3.6 Casting the equations into a dimensionless form
In numerical methods it is convenient to use variables that are normalized with the typical values
of the problem. First all the lengths are measured in terms of the coherence length lcoh which is
the typical length scale for a random magnetic field, so that in a cube with size lcoh the magnetic
field roughly is constant. In our numerical modelling we will assume that the field is exactly
constant over a correlation length. Also, all velocities are measured in terms of the speed of light c.
If we have a length L then it its dimensionless counterpart is ˜L = L/lcoh. For a velocity v
we define β = v/c.
With this we can write the Lorentz force (3) in an alternative form. Substituting the velocities
gives
dβ
dt
=
q
mcγ
(β × B).
If the magnetic field has a uniform component B0 in the ˆz direction and a random perturbation
δB so that
B = B0 ˆz + δB
it is possible to scale the magnetic field with the strength of the uniform component by defining
h =
δB
B0
. (10)
Substituting this result into the Lorentz force then
dβ
dt
=
qB0
mcγ
(β × (ˆz + h)).
The factor qB0
mcγ is in fact the gyro frequency ωg as defined in (6).
A given time t has a dimensionless counterpart ˜t defined as ˜t = ct
lcoh
. Substituting this gives
dβ
d˜t
= ωg
lcoh
c
(β × (ˆz + h)).
The dimensionless gyration frequency then follows as
˜ωg = ωg
lcoh
c
(11)
so that
dβ
d˜t
= ˜ωg(β × (ˆz + h)). (12)
In these dimensionless variables the gyration radius of the circular motion in the plane perpen-
dicular to the uniform magnetic field is
6
3.6 Casting the equations into a dimensionless form 3 ELECTROMAGNETISM
˜r =
β
˜ωg
(13)
which is a relation between the velocity and the gyration radius of the particle in the uniform field.
For the B drift speed (8) the following dimensionless relation holds
βdrift = −
1
2˜ωg
β2
⊥( ˜ ˜B × ˜b) (14)
with ˜B the dimensionless magnetic field defined as ˜B = B
B0
and coh the dimensionless gradient.
For the E × B drift speed (7) the following dimensionless equation holds
βdrift =
˜E⊥ × ˜B
˜B2
(15)
with the dimensionless electric field ˜E defined as ˜E = E
B0
.
For a table with all useful equations and variables see table 1 in the Appendices.
7
4 SIMULATING THE COSMIC MAGNETIC FIELD
4 Simulating the cosmic magnetic field
Cosmic magnetic fields are almost never uniform or regular: they show sings of magnetic turbu-
lence. Such turbulent magnetic fields with a random component δB can be represented as:
B(r) = B0 + δB(r). (16)
For this random component a discrete function is used. We take a cube with edges of size
L and cut it in N cells which are all equal of size. In these cells we can appoint a different
magnetic field δB. If the dimensions of a cell is chosen to be equal to the coherence length
then the dimensionless size of a cell is just 1. This choice has its practical reasons because
it is then simple to track a particle through the cells. We can give each cell three numbers:
ηx, ηy and ηz, these are the integer values of the coordinates the center of a cell. The integer
value of the coordinate of the the particle is then just the number of the cell in a specific direction.
By using periodic boundary conditions (x = x + L) we can follow particles which go further
than a linear distance L. If the particle leaves the cube on one side it enters it at the correspond-
ing position on the opposite side.
If the cube is big enough, or when the random component in the magnetic field is big enough,
all the memory of the initial conditions can be erased in a statistical sense. This is possible if a
particle scatters through a large angle. For this to occur it is sufficient that the particle enters a
different cell than the one it originated from.
It is convenient for numerically generating an isotropically distributed turbulent magnetic
field by using spherical coordinates. In that case the average of the magnetic turbulent field is
always zero. The vector δB can be represented by,
δBx =| δB | 1 − cos2(θ) cos(φ)
δBy =| δB | 1 − cos2(θ) sin(φ)
δBz =| δB | cos(θ)
We can then use a random number generator to produce random values for φ and cos(θ) between
0 < φ < 2π and −1 < cos(θ) < 1.
9
5 CREATING THE COSMIC RAYS
5 Creating the cosmic rays
In general particles do not have exactly the same initial conditions. In our simulation N cosmic
rays enter our simulation box of linear size L. Each cosmic ray requires initial conditions in
position and momentum space, amounting to 6 vector components.
The position of each simulated cosmic ray is chosen in the following manner: we randomly
place a cosmic ray in a small box. This is done by using a random number generator. The box
is chosen to be in the center of a cell. This cell is located in the center of the cube. We make
this choice because then the particles does not leave a cell or the cube in the first integration step.
The initial velocity in terms of β is distributed isotropically on a sphere, so that we can
employ a similar approach as used for generating the random component of the magnetic field.
βx =| β | 1 − cos2(θ) cos(φ) (17)
βy =| β | 1 − cos2(θ) sin(φ) (18)
βz =| β | cos(θ). (19)
For the random distribution of φ and cos(θ) a random number generator is used in the same
way as it is for δB.
11
6 N-PARTICLE SIMULATIONS
6 N-particle simulations
The behavior of N particles , with N 1, can be described in the framework of statistics. Due
to the fact that N is a really large number, typically N=10.000, the only way to say something
about the system is in terms of averages. In the one dimensional case a bunch of N particles,
which are distributed by some function f(x), have an average position < x >, an average position
squared < x2
> and an root mean squared deviation called σx, which are defined by [2]
< x >= xf(x)dx (20)
< x2
>= x2
f(x)dx (21)
σ2
x =< x2
> − < x >2
(22)
For instance for a stochastic variable x distributed uniformly between x = x0 and x = x1 we
have:
f(x) =
1
x1 − x0
(23)
6.1 Motions in a uniform magnetic field
In the case of a uniform magnetic field we can calculate the averages of the velocities of the
particles and the deviation of the velocities. Lets consider the velocity parallel to the magnetic
field. The velocity in the ˆz direction of a single particle is given by (19). If we define µ = cos(θ)
and 0 ≤ µ ≤ 1. Then using (23), f(µ) = 1 for 0 ≤ µ ≤ 1 and zero otherwise. Using (20) we can
calculate the average position
β t =
1
0
βtµdµ =
βt
2
.
We can then use (21) to calculate the average position squared
β2
t2
=
1
0
β2
t2
µ2
dµ =
β2
t2
3
.
Then using this two result we can calculate the deviation by using (22). This gives
σ2
β t =
β2
t2
12
. (24)
So in the case that the magnetic field is chosen to be uniform and in the z-direction then
the deviation of z is proportional with t and has a coefficient that can be calculated both
numerically and analytically. This is another way to check the accuracy of the integrator, but it
is fundamentally different from the situation we are after. In this case the particles velocities are
distributed informally and the motions are completely regular. In the case of random magnetic
fields the motions become irregular.
13
7 DIFFUSION PROCESSES
7 Diffusion processes
In galaxies the magnetic fields have random components. Due to this random components the
direction of propagation of a cosmic ray can be inverted. Due to δB the Lorentz force can have
a component that changes v . This component will slowdown the particle and if it is strong
enough or is anti parallel for a longer time it will even let the cosmic ray move in the opposite
direction. The parallel component is not the only component that is disturbed by the random
field also the perpendicular motions feels a force. This also results in a diffuse propagation.
7.1 The random walk model for diffusion in one dimension
Diffusion is the physical process where particles propagate with a random walk [3]. This model
has been solved by Chandrasekhar [4]. He gave a solution for the probability that a particle
could reach a point m after N steps. In the case of a unit step size, that probability is given
by [5]
W(m, N) =
N!
N+m
2 ! N−m
2 !
1
2
2
Using Stirling’s approximation [6] on the factorials one can show that for sufficiently large N
W(m, N) = 2/πNe
−m2
2N
In a random walk with step size l, starting at x = 0 at time t = 0, the net displacement
x equals x = ml. If a particle scatters n times per second we have N = nt The probability of
finding a particle in the interval [x, x + dx] at time t then equals W(x, t)dx with
W(x, t) =
1
√
4πDt
e
−x2
2Dt . (25)
D is the diffusion coefficient defined as D = nl2
, so that the mean displacement is
σx =
√
2Dt.
The diffusion coefficient is the ”speed” of the diffusion. The bigger it is, the more diffusive the
system is.
7.2 The weak scattering limit for scattering by random
magnetic fields
Another test case is the low scattering limit [7]. This is the case where weak random fields deflect
charges in a strong (uniform) guide field, taken to be in the z-direction. Weak scattering applies
if the deflection incurred when a particle traverses one cell remains small.. But these deflection
add up diffusely. Particles typically reverse their direction and their motions can be described
in a statistical sense with the diffusion coefficients as explained in the previous section. In this
section we will derive the diffusion coefficients for the low scattering limit.
In absence of an electric field the Lorentz force law (3) implies that the velocity of a particle
remains constant. We can then define ˆn = β
|β|
and use the substitution ds = vdt to rewrite the
equation of motion
dˆn
ds
=
ˆn × (ˆz + h)
rg
15
7.2 The weak scattering limit for scattering by random
magnetic fields 7 DIFFUSION PROCESSES
Due to the isotropic distribution of hrms (10) its average vanishes: hx = hy = hz = 0. The
assumption that the random fields are isotropically distributed implies that
h2
x = h2
y = h2
z = h2
rms/3, (26)
If we look at the z direction, then with nz = cos(θ) = µ:
dµ
ds
=
hrms · (ˆz × ˆn)
rg
In one cell hrms is uniform so that we can integrate it with respect to s to find an expression for
∆µ
∆µ =
hrms · (ˆz × ˆn)
rg
∆s
Taking the absolute value and using the fact that ∆s ∼ lcoh, the change of the pitch angle cosine
is given by
| ∆µ |= h2
rms
lcoh
rg
.
The only condition is |∆µ| 1 (small deflection in one cell) so one must demand hrms coh/rg 1
This is only valid when the deflection in one cell is small |∆µ| 1. So one must demand
hrms coh/rg 1. If we then use that h2
rms =
h2
rms
3 then
| ∆µ |=
hrms
√
3
lcoh
rg
The direction of motion along the z axis is reverted if
√
N | ∆µ |= 1. This corresponds to
∆s = Nlcoh = lcoh
|∆µ|2 = lmfp with lmfp is the mean free path length. Then using the definition of
Dzz this gives the following for the diffusion coefficient
Dzz =
1
3
vlmfp =
vr2
g
lcohh2
rms
.
This calculation gives the correct scaling, and differs from the exact result by factors of order unity.
We can rewrite the equation of Dzz when we define a scattering frequency νs as follows
νs =
2h2
rmsvlcoh
3r2
g
. (27)
This gives for Dzz
Dzz =
v2
3νs
The uniform field in the z-direction limits the amount of diffusion across the field. If one takes
the effect of the gyration around the uniform field into account, the diffusion in the x − y plane
can be characterized by a diffusion coefficient D⊥. In the weak scattering limit it is given by:
D⊥ =
νs
ωg
2
Dzz
The low scattering regime holds if νs ωg.
16
7.2 The weak scattering limit for scattering by random
magnetic fields 7 DIFFUSION PROCESSES
The diffusion coefficients have a dimensionless counterparts
˜Dzz ≡
Dzz
c coh
=
β˜r2
2h2
rms
(28)
˜D⊥ ≡
D⊥
c coh
=
2
9
βh2
rms. (29)
The dimensionless counterpart of the low scattering limit is ˜rg 2h2
rms/3.
We can also define a product between the the diffusion coefficients
˜Dzz
˜D⊥ =
1
9
β2
˜r2
. (30)
It is only valid in the weak scattering limit and is useful because it is independent of hrms. This
equation will be used to check the scaling of the values that will be calculated with the integrator.
Beside the diffusion coefficients we are also able to predict the diffusion times in the low
scattering limit. If a particle needs to traverse N cell before it reverses its direction, then the
mean free path length of the particle is
lmfp = Nlcoh =
lcoh
| ∆µ |2
3r2
g
lcohh2
rms
.
So the typical distance to become diffuse is proportional to this mean free path length. The
diffusion time is then proportional to
tdif
Nlcoh
v
=
3r2
g
vlcohh2
rms
.
The dimensionless diffusion time is then given by
˜tdif
3˜r2
g
βh2
rms
. (31)
17
8 NUMERICAL METHODS
8 Numerical methods
There are several methods to numerically solve N coupled ordinary differential equations, which
have the form
dyi(x)
dt
= fi (t, y1, ..., yN ) i = 1, ..., N.
The easiest way to solve differential equations is with the Euler method [8]
xn+1 = xn + hf (t, xn).
with h = tn+1 − tn. This method calculates the derivative once, and takes a step h in time. This
results into an unstable and inaccurate method. A better way is to evaluate the derivative n
times between xn+1 and xn. With this information the final step is more accurate. A method is
called nth order if the error term is O(hn+1
).
8.1 Runge Kutta Fehlberg Method
The Runge Kutta Fehlberg method is developed by the German mathematician Erwin Fehlberg.
This method uses a fourth and fifth order Runge Kutta method. The biggest advantage is that
we can combine these two methods to evaluate the accuracy of the step that is made. If it is not
accurate enough we can change the step size and thereby increase the accuracy to a user defined
tolerance. [9]
The Runge Kutta Fehlberg uses the following equations
k1 = h · f (tn, xn)
k2 = h · f (tn +
h
4
, xn +
k1
4
)
k3 = h · f (tn +
3h
8
, xn +
3
32
k1 +
9
32
k2)
k4 = h · f (tn +
12h
13
, xn +
1932
2197
k1 −
7200
2197
k2 +
7296
2197
k3)
k5 = h · f (tn + h, xn +
439
216
k1 − 8k2 +
3680
513
k3 −
845
4104
k4)
k6 = h · f (tn +
h
2
, xn −
8
27
k1 + 2k2 −
3544
2565
k3 +
1859
4104
k4 −
11
40
k5)
We can then calculate the steps for the 4th
and 5th
order with
y4th
n+1 = yn +
25
216
k1 +
1408
2565
k3 +
2197
4104
k4 −
k5
5
y5th
n+1 = yn +
16
135
k1 +
6656
12825
k3 +
28561
56430
k4 −
9
50
k5 +
2
55
k6
Using these values we are able to check the accuracy
R =| y5th
n+1 − y4th
n+1 |
If R is bigger than a user defined tolerance value TOL, the step has to be adapted. We can
choose the following for calculating the scale factor d of h
19
8.1 Runge Kutta Fehlberg Method 8 NUMERICAL METHODS
d =
TOL
2R
0.25
.
The 0.5 is a safety factor to ensure success on the next try. Typically the next try will have a
error of TOL/2. Defining a minimum and maximum value for h ensures that h does not grow
too big or too small, which would otherwise effects the run time of the method.
The condition for the time steps is t << 1
ωg
so that we resolve the gyro-motion around the
uniform field.
20
9 TESTING THE INTEGRATOR
9 Testing the integrator
9.1 Motion in a uniform magnetic field
The first way to check if the integrator is accurate enough is by using analytically solvable
problems. This can for example be a uniform magnetic field B0 in the ˆz direction as explained in
section 3.2. When the trajectory of the particle is averaged over a full gyration period Pg = 2π/ωg,
we expect to see a free particle moving in the z direction with a constant x and y position.
In the figures 1-6 the simulated value is compared and scaled to the theoretical value. For
the theoretical value we used the following function: x0(t) = x0(t = 0), y0(t) = y0(t = 0) and
z0(t) = vzt + z0(t = 0). The initial velocity of the particle was βz = 0.5. The theoretical center
of the motion at t = 0 was at x0 = 51.207, y0 = 49.793 and z0 = 50.5. We can identify two types
of numerical noise, on small scales in the figures 2 and 4 and on larger scales in the figures 1 and
3. The large scale noise has an order of magnitude up to 10−3
and the small scale an order of
magnitude up to 10−6
. In figure 5 and 6 it is clearly visible that there is an asymptotic behavior
and the relative error tends to 10−7
. We can conclude that the numerical result and theoretical
predictions are almost equal. If we fit a line f(t) = βzt + z0 with the simulated data for z, we
get βz = 0.5 ± 3.18 · 10−10
and z0 = 50.5001 ± 9.169 · 10−07
.
-0.0012
-0.001
-0.0008
-0.0006
-0.0004
-0.0002
0
0.0002
0.0004
0 1000 2000 3000 4000 5000
(x−x0)
x0
t
Numerical noise
Figure 1: The numerical noise in the x trajectory as a function of time.
21
9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR
-8e-06
-7e-06
-6e-06
-5e-06
-4e-06
-3e-06
-2e-06
-1e-06
0
0 1000 2000 3000 4000 5000
(x−x0)
x0
t
Numerical noise
Figure 2: The numerical noise in the x trajectory as a function of time.
-0.0025
-0.002
-0.0015
-0.001
-0.0005
0
0.0005
0 1000 2000 3000 4000 5000
(y−y0)
y0
t
Numerical noise
Figure 3: The numerical noise in the y trajectory as a function of time.
22
9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR
-8e-06
-7e-06
-6e-06
-5e-06
-4e-06
-3e-06
-2e-06
-1e-06
0
0 1000 2000 3000 4000 5000
(y−y0)
y0
t
Numerical noise
Figure 4: The numerical noise in the y trajectory as a function of time.
0
1e-06
2e-06
3e-06
4e-06
5e-06
6e-06
7e-06
8e-06
0 10 20 30 40 50 60
(z−z0)
z0
t
Numerical noise
Figure 5: The numerical error in the z trajectory as a function of time.
23
9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR
0
1e-07
2e-07
3e-07
4e-07
5e-07
6e-07
500 1000 1500 2000 2500 3000 3500 4000 4500 5000
(z−z0)
z0
t
Numerical noise
Figure 6: The numerical error in the z trajectory as a function of time.
24
9.2 Motions with E × B drifting 9 TESTING THE INTEGRATOR
9.2 Motions with E × B drifting
The next test case is the E × B drifting. We can calculate a theoretical value by using eqn. (15).
The direction of the electric field is chosen in the ˆx direction and the direction of the magnetic
field is chosen in the ˆz direction. Using (15) this gives the following for the drift velocity
βdrift = −
˜E
˜B
ˆy
The values for both ˜E and ˜B are chosen equally large so that the drift velocity is equal to −1 in
the ˆy direction. Running the simulation for a single particle we can calculate a numerical value
for the drift speed.
In the figures 7 and 8 the simulated values are compared and scaled to the theoretical values.
For the theoretical value we used the following function: y0(t) = βdriftt + y0(t = 0). With
βdrift = −1 and y0(t = 0) = 49.793. In figure 7 we can see that there is noise on larger scales
until t = 300. The large scale noise has an order of magnitude up to 10−2
. In figure 8 it is
clearly visible that after t = 300 there is an asymptotic behavior and the relative error tends to
10−7
. So that we can conclude that the numerical result and theoretical predictions are almost
equal. If we fit a line y(t) = βdriftt + y0 with the simulated data of y, we obtain a drift speed of
βdrift = −1 ± 0.000000007021. Which is as predicted by theory.
-0.002
0
0.002
0.004
0.006
0.008
0.01
0.012
0 50 100 150 200 250 300
(y−y0)
y0
t
Numerical noise
Figure 7: The numerical noise of the particle’s trajectory.
25
9.2 Motions with E × B drifting 9 TESTING THE INTEGRATOR
0
5e-07
1e-06
1.5e-06
2e-06
2.5e-06
3e-06
3.5e-06
500 1000 1500 2000 2500 3000 3500 4000 4500 5000
(y−y0)
y0
t
Numerical noise
Figure 8: The numerical error of the particle’s trajectory.
26
9.3 Motions with B drifting 9 TESTING THE INTEGRATOR
9.3 Motions with B drifting
In paragraph 3.5 we gave the equation for the B drift velocity (14). We can use this equation
to calculate a theoretical value for the drift speed. First a value for B has to be chosen which
is not too big otherwise the approximation is not valid. The direction of the gradient of the
magnetic field is chosen to be only in the x direction. We can then find that d ¯B
dx 1. A proper
value would be in the order of 10−3
. For the frequency and the perpendicular velocity the follow-
ing values are chosen: β2
⊥ = 0.48 and ωg = 0.6917. Using (14) we find that βdrift = 3.4587∗10−4
ˆy.
Running the simulation, only considering the change in the ˆy direction and only looking
at the average of the motion, we can calculate what the numerical value is. If we fit a line
y(t) = βdriftt + y0 with the data, we obtain a drift speed of βdrift = (3.45919 ± 0.00002052)10−4
.
In figure 9 the simulated values are compared and scaled to the theoretical values. For the
theoretical value we used the following function: y0(t) = βdriftt + y0(t = 0). With βdrift =
3.4587 ∗ 10−4
and y0(t = 0) = 1, 48903. There is some numerical noise visible with an order
of magnitude up to 10−3
. So that we can conclude that the numerical result and theoretical
predictions are nearly the same.
0.0014
0.0016
0.0018
0.002
0.0022
0.0024
0.0026
0.0028
0.003
0 100 200 300 400 500
(y−y0)
y0
t
Numerical noise
Figure 9: The numerical noise of the particle’s trajectory.
27
9.4 N particles in a uniform magnetic field 9 TESTING THE INTEGRATOR
9.4 N particles in a uniform magnetic field
We will now consider the N particles with their velocities distributed over a sphere with radius:
| v |. We choose the radii of the motions of the particles as ˜rg = 1.00. Using (13) and a frequency
of ˜ωg = 0.6917 we can calculate the velocity of the particles | β |= 0.6917. The deviation
is given by equation (24). If we fit a line β√
3
t with the data, we obtain a numerical value of
β = 0.688108 ± 0.000572.
In the figures 10 and 11 the simulated values are compared and scaled to the theoretical
values. For the theoretical values we used the following function: σ0(t) = β√
3
t. The numerical
noise tends to 10−3
as t grows larger. So that we can conclude that the numerical result and the
theoretical predictions are almost the same.
-0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0 200 400 600 800 1000
(σ−σ0)
σ0
t
Numerical noise
Figure 10: The numerical error of the N particles deviation in a uniform field.
28
9.5 N particles low scattering limit 9 TESTING THE INTEGRATOR
-0.004
-0.0038
-0.0036
-0.0034
-0.0032
-0.003
0 200 400 600 800 1000
(σ−σ0)
σ0
t
Numerical noise
Figure 11: The numerical noise of the N particles deviation in a uniform field.
9.5 N particles low scattering limit
The next test case for the integrator is the low scattering limit. The low scattering limit holds
when ˜rg
2
3 h2
rms. For ˜rg = 1, β = 0.69 and hrms = 0.1 this is true. Using (28) and (29)
we can calculate the theoretical values for the diffusion coefficients. The theoretical values are
then ˜Dzz = 34.5, ˜D⊥ = 0, 0015. For 20.000 particles a simulation has been run and it gave the
following result
˜Dxx = 0.00115 ± 0.0000004843
˜Dyy = 0.00129 ± 0.0000006387
˜Dzz = 46.8702 ± 0.0213
The numerical values differ from the theoretical values. The problem is here that the coherence
length is set equal to the box size. But in the case of a cube the average crossing length to one
of its faces is not equal to one. The path length through a single cell can very between zero
and
√
3 coh 1.73 coh. This has some consequences for the analysis that has been done in the
section 3.5. The distances should not scaled by lcoh but by the average path length through a
cube with sides coh, which is equal to ξ coh. The average path length of a particle through a
cube, which plays the role of the coherence length of the magnetic field, is calculated to be 1.485
in units where the cube size is unity. The diffusion coefficients are then given by
˜Dzz = ξ
β˜r2
g
2h2
rms
(32)
˜D⊥ =
1
ξ
2
9
βh2
rms. (33)
The new theoretical values are then ˜Dzz = 51.22, ˜D⊥ = 0, 00103.
If we average the perpendicular diffusion coefficients and calculate the product (30) between
them then
29
9.6 Distribution of particles 9 TESTING THE INTEGRATOR
˜D⊥ = 0, 00122 (34)
˜D⊥ · ˜Dzz = 0, 0057. (35)
The theoretical value is ˜D⊥ · ˜Dzz = 0, 0052.
9.6 Distribution of particles
When the system is indeed diffuse the particles are distributed by a Gaussian curve given by
(25). In figure 12 a histogram of the particles as a function of their relative coordinates is plotted.
The histogram has a Gaussian shape as predicted by (25).
Figure 12: The Gaussian distribution of the particles as function of their relative coordinates.
30
10 SIMULATING THE DIFFERENT CASES
10 Simulating the different cases
In our description in terms of dimensionless variables there remain only two free parameters:
the gyration radius in units of the box size, rg/ coh (a measure of the strength of the uniform
field) and the relative strength hrms = δB/B0 of the random magnetic field component. For
these two parameters the following values are used ˜rg = {0.25, 0.5, 0.71, 1.0, 1.41, 2.0, 4.0} and
hrms = {0.25, 0.5, 0.71, 1.0, 1.41, 2.0, 4.0}. There are 10.000 particles per simulation.
10.1 Diffusion coefficients
The results for different values of hrms are shown in figures 13 and 14.
Figure 13: The dimensionless diffusion coefficient in the perpendicular direction as function of
the dimensionless gyration radius for a given random magnetic field strength.
31
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
Figure 14: The dimensionless diffusion coefficient in the parallel direction as function of the
dimensionless radius for a given random magnetic field strength.
In the figures 15 and 16 the diffusion coefficients for different radii are shown
Figure 15: The dimensionless diffusion coefficient in the perpendicular direction as a function of
the random magnetic field strength for a given dimensionless gyration radius.
32
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
Figure 16: The dimensionless diffusion coefficient in the parallel direction as a function of the
random magnetic field strength for a given dimensionless gyration radius.
In figure 17 the product between the diffusion coefficients is shown for different values of
hrms and in figure 18 for different radii.
Figure 17: The product between the dimensionless diffusion coefficient as a function of the
dimensionless gyration radius for a given random magnetic field strength.
33
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
Figure 18: The product between the dimensionless diffusion coefficient as a function of the
random magnetic field strength for a given dimensionless gyration radius.
The data that are used in this section can be found in the tables 2 and 3 in the appendices.
34
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
10.1.1 Weak Scattering
The figures 13 and 14 give the diffusion coefficients as a function of ˜rg for a given random mag-
netic field strength. In the low scattering limit the following must hold; if the random magnetic
field is
√
2 larger then the diffusion coefficient is also two times larger. The distance between the
curves is as predicted by eqn. (29). It is clearly visible in figure 13 that the lines up to hrms = 1
satisfy this. Above hrms = 1 the distances between the curves become smaller. Above ˜rg = 1√
2
the lines flatten. In fig. 14 the lines also meet up with the prediction, above ˜rg = 1√
2
the lines
get a different slope.
In the figures 15 and 16 the diffusion coefficients as function of hrms for a given dimensionless
gyration raidus are plotted. In figure 15 the distances between the curves meet up with the
predictions until ˜rg = 1√
2
, for larger radii the distances are smaller. After hrms = 1 the lines
flatten just as in figure 13 for ˜rg = 1√
2
. In figure 16 it is also visible that curves are equidistant,
the slopes steepen above hrms = 1.
If we look at the product of the parallel and perpendicular coefficients we see in figure 17 that
as a function of the radius the product is almost constant until hrms = 1. For bigger magnetic
fields it gets smaller. In 18 this is also visible, for different radii the products are constant until
hrms = 1.
So combining these results we can conclude the following. Around hrms = 1 and ˜rg = 1√
2
there is a change in the diffusion coefficients visible. This is the place where the weak scatter-
ing break down starts. The radius ˜rg = 1√
2
is the radius that corresponds to the coherence length.
In the figures 19 and 20 the numerical values of the parallel diffusion coefficients are com-
pared with the theoretical value (Dzz0
) of the weak scattering regime. We plotted the difference
between the two values and scaled it with the theoretical value. The same has been done for the
perpendicular diffusion coefficients in the figures 21 and 22.
For hrms < 0.5 and large values of ˜rg the difference between the theoretical and numerical
values drops to 0.1. The diffusion coefficients for the low scattering limit are in the right order
of magnitude and have the right scaling.
35
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
Figure 19: The difference between the theoretical and numerical values of the parallel diffusion
coefficient as a function of the dimensionless gyration radius for a given random magnetic field
strength.
Figure 20: The difference between the theoretical and numerical values of the parallel diffusion
coefficient as a function of the random magnetic field strength for a given dimensionless gyration
radius.
36
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
Figure 21: The difference between the theoretical and numerical values of the perpendicular
diffusion coefficient as a function of the dimensionless gyration radius for a given random magnetic
field strength.
Figure 22: The difference between the theoretical and numerical values of the perpendicular
diffusion coefficient as a function of the random magnetic field strength for a given dimensionless
gyration radius.
37
10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES
10.1.2 Strong scattering regime
In the strong scattering regime theory predicts that Dzz = D⊥. In the case of strong scattering
we must demand that hrms 1 and ˜rg 1. The difference between the the perpendicular and
parallel diffusion coefficient is plotted in figure 23. This difference is given as a function of the
dimensionless gyration radius for the random magnetic fields strengths: hrms = 2 and hrms = 4.
0.001
0.01
0.1
1
0.25 0.5 1 2 4
Dzz−D⊥
(Dzz+D⊥)/2
˜rg
h = 4
h = 2
Figure 23: The difference between the perpendicular and parallel diffusion coefficient as a function
of the dimensionless gyration radius for a given random magnetic field strength.
It is visible that for larger hrms and smaller ˜rg the difference between the coefficient becomes
smaller.
38
10.2 Diffusion times 10 SIMULATING THE DIFFERENT CASES
10.2 Diffusion times
The diffusion times are calculated in the following way, first the σ(t)2
2t = D(t) is calculated. D(t)
is also called the running diffusion coefficient. The diffusion time is then defined as the time tdif
where the running diffusion coefficient becomes constant, D(tdiff ) = D. This is due to the fact
that when a system is diffuse the deviation is equal to σ2
= 2Dt. If we plot the diffusion coefficient
as a function of time we are able to find the point where this is true. This method is then used for
the same cases as in paragraph 10.1. The results for different values of hrms are shown in figure 24.
Figure 24: Diffusion times as a function of the random magnetic field strength for a given
dimensionless gyration radius.
39
10.2 Diffusion times 10 SIMULATING THE DIFFERENT CASES
The diffusion times for different radii are shown in figure 25.
Figure 25: Diffusion times as a function of the dimensionless gyration radius for a given random
magnetic field strength.
In figure 24 the diffusion times as a function of ˜rg for a given random magnetic field strength
are plotted. As a function of radius we see that for large radii the diffusion time scales with
˜r2
g as predicted by eq. (31). For smaller radii the diffusion time becomes smaller until it has a
minimum around ˜rg = 1√
2
for hrms > 0.5, for radii smaller that 0.71 the diffusion becomes bigger.
If hrms < 0.5 the diffusion times scales with ˜r2
g for all ˜rg.
In figure 25 the diffusion times are plotted as a function of hrms for a given dimensionless
gyration radius. As a function of the random magnetic field strength we see that for small values
of hrms or large values of ˜rg the diffusion time scales with h−2
rms as predicted by eqn. (31). For
˜rg = 1√
2
there is a drop visible around hrms = 1. The diffusion time becomes constant until
hrms = 2 and then becomes bigger.
So combining these results we can conclude the following. Around hrms = 1 and ˜rg = 1√
2
there is a change in the diffusion time visible. This is the place where the weak scattering break
down starts. The radius ˜rg = 1√
2
is the radius that corresponds to the coherence length.
The data that are used in this section can be found in the table 4 in the appendices.
40
11 CONCLUSION
11 Conclusion
The Runge Kutta Fehlberg scheme provides itself as an accurate integrator for this type of dif-
ferential equations. In section 9.1. it gave a stable trajectory for the single particle in a uniform
magnetic field. It was able to calculate the drift speed for the B drifting (section 9.3) and
the E × B drifting (section 9.2). In the N particle cases we were able to calculate the average
velocity of N particles in a uniform magnetic field (section 9.4) which was also very accurate. In
the low scattering limit (section 9.5) with defining a effective coherence we were able to calculate
the diffusion coefficients, these were accurate up to 8.8% and had the right scaling. In section
9.6 it is shown that the particles are Gaussian distributed.
In section 10 we simulated for different values of th dimensionless gyration radius and random
magnetic field strength, from the data we found the diffusion coefficients and diffusion times.
In section 10.1. we looked at the diffusion coefficients, for the low scattering regime we found a
break down around hrms = 1 and ˜rg = 1√
2
. This break down was also found with the diffusion
times. To get a better knowledge of what is really happening around hrms = 1 and ˜rg = 1√
2
more
simulations are needed. With more accurate simulations we can fit the data and find a scaling
law that describes the behavior of cosmic rays in this regime.
The simulations do not deal with radiation effects. When a charged particle gyrates around
a magnetic field line it radiates synchrotron radiation. To make the simulations more accurate
this effect has to be taken into account, because it is one of the energy loss mechanisms of cosmic
rays. Another detail that is not taken into account is dust and gas: in the milky way cosmic rays
heath the interstellar medium. In this simulation the particles propagate through vacuum. In
molecular clouds the cosmic rays interact with the gas and radiate in the gamma ray regime so
that the cosmic rays lose energy. All this types of energy losses were not taken into account yet,
but for the longer integration times they are definitely not neglectable.
41
REFERENCES
12 Bibliography
References
[1] D.J. Griffiths. Introduction to Electrodynamics (3rd Edition). Benjamin Cummings, 1999.
[2] Vijay Kumar Rohatgi. An introduction to probability theory and mathematical statistics.
Wiley series in probability and mathematical statistics.
[3] C. Ruhla. The physics of chance: from Blaise Pascal to Niels Bohr. Oxford University Press,
1992.
[4] S. Chandrasekhar. Stochastic problems in physics and astronomy. Rev. Mod. Phys., 15:1–89,
Jan 1943.
[5] T. Stanev. High Energy Cosmic Rays. Springer Praxis Books / Astronomy and Planetary
Sciences. Springer, 2010.
[6] R. Bowley and M. S´anchez. Introductory statistical mechanics. Oxford science publications.
Clarendon Press, 1999.
[7] N.A. Krall and A.W. Trivelpiece. Principles of Plasma Physics. International Series in Pure
and Applied Physics. San Francisco Press, 1986.
[8] W.H. Press. Numerical Recipes in C. Cambridge University Press, 1988.
[9] E. Fehlberg. Low-order classical Runge-Kutta formulas with stepsize control and their ap-
plication to some heat transfer problems. NASA technical report. National Aeronautics and
Space Administration, 1969.
43
13 APPENDICES
13 Appendices
symbol physical dimensionless
position ˜x x x/l
velocity β v v/c
time ˜t t tc/l
frequency ˜ω ω ωl/c
Larmor radius ˜rg rg v/ωg
magnetic field
˜
B B B/B0
electric field
˜
E E E/B0
gradient ˜ d/dx = l
B drift velocity βdrift − c
qB M( ⊥B × ˆb) − 1
2˜ωg
β2
⊥( ˜ ˜B × ˜b)
E × B drift velocity βdrift c(E⊥ × B)/(B2
) ( ˜E⊥ × ˜B)/( ˜B2
)
diffusion coefficient ˜D D D/cl
˜Dzz (v2
)/(3νs) (β˜r2
)/(2h2
rms)
˜D⊥ (νs/ωg)
2
Dzz
2
9 βh2
rms
low scattering limit νs ωg ˜rg 2h2
rms/3
Table 1: Useful equations and variables and their dimensionless counterparts
45
13 APPENDICES
˜rghrms
˜D⊥error˜D⊥
˜Dzzerror˜Dzz
˜D⊥
˜Dzzerror˜D⊥
˜Dzz
0,250,250,000861690,0000002570,4390440,00023350,00037830,000000231
0,50,250,0026550550,0000021861,686810,00035450,004478570,00000381
1√
2
0,250,004060730,0000010393,75720,0015140,0152570,00000728
10,250,0055247850,0000155609,313450,0050360,051454810,000148√
20,250,005951730,00000281622,9950,0061360,136860,0000743
20,250,0065679050,00000150152,26680,0062150,3432830,0000884
40,250,007203790,000002929229,5470,013111,653610,000679
0,250,50,003054240,0000006820,1294450,00003340,00039540,000000135
0,50,50,0088719050,000004440,5235310,00019420,00464470,00000289
1√
2
0,50,01416130,00000644051,162790,00048980,0164670,0000102
10,50,018079450,00000856852,734270,00043120,04943410,000025√
20,50,02137910,00000892956,455720,0018470,1380170,0000699
20,50,02382910,00002175514,2990,009310,34070,000382
40,50,026714350,00001451562,98990,059331,6827340,00183
0,251√
2
0,00615640,00000160150,07586430,00002780,000467050,000000210
0,51√
2
0,018021450,00000851650,3028110,00011820,005457090,00000334
1√
2
1√
2
0,02702320,000040960,6381740,00047890,01724550,0000292
11√
2
0,03524440,0000194851,454970,00065850,0512800,000037
√
21√
2
0,04149260,00002783,359060,0010240,1393760,000103
21√
2
0,04671840,000025127,419440,0051750,3466240,000305
41√
2
0,05155870,00008925532,31680,073441,666210,00476
0,2510,010869750,0000053210,04217230,00001910,0004584020,000000306
0,510,031946850,0000146050,160730,00004010,00513480,00000267
1√
2
10,04998080,000025280,3495770,00014540,01747210,0000114
110,06781840,0000454450,741760,00043260,0503050,0000447√
210,081592250,000055151,777780,00004410,1450530,0000981
210,090380950,0000937353,849650,0071130,34793500,000737
410,10348850,0003478516,0040,054711,6560,00794
Table2:Diffusioncoefficients
46
13 APPENDICES
˜rghrms
˜D⊥error˜D⊥
˜Dzzerror˜Dzz
˜D⊥
˜Dzzerror˜D⊥
˜Dzz
0,25
√
20,01389850,0000079930,02581890,000007940,000358840,000000234
0,5
√
20,04540240,0000274250,09823470,00002490,004460090,00000292
1√
2
√
20,07742360,0000580650,1942190,00012510,01503710,0000149
1
√
20,11460750,0000487350,4053190,00024760,04645260,0000346√
2
√
20,14933550,000064910,9073590,00056660,13550090,000103
2
√
20,17328450,000138951,912910,0016180,3314780,000386
4
√
20,197920,00024018,401310,010621,66280,0029
0,2520,012926050,0000054670,01615880,00001850,000208870,000000255
0,520,0443450,000021470,06080240,00003660,0026960,00000208
1√
2
20,080151250,000032640,1154420,00008710,00925280,00000793
120,1384740,0000868550,2183140,00048140,0302310,0000693√
220,2104970,0000947850,4555910,00019640,0959010,0000598
220,28166550,000196351,002380,00030820,282340,000215
420,3710940,00026284,312920,0028021,600500,00154
0,2540,0075752850,00000792750,007522190,00001640,0000569830,000000138
0,540,02666980,000017620,02830020,00002140,000754760,000000757
1√
2
40,048628650,000038010,05343290,00003650,0025983700,00000270
140,084125950,000054120,0926090,0000310,007790820,00000565√
240,13945350,0000999150,1525130,00016250,02126850,0000273
240,2384080,000289150,2657260,00063930,0633510,000171
440,6614790,000947051,070910,0011670,708380,00127
Table3:Diffusioncoefficients
47
13 APPENDICES
˜rg hrms tdif
0,25 0,25 150
0,25 0,5 60
0,25 1√
2
350
0,25 1 400
0,25
√
2 400
0,25 2 1500
0,25 4 2000
0,5 0,25 400
0,5 0,5 100
0,5 1√
2
100
0,5 1 200
0,5
√
2 80
0,5 2 200
0,5 4 800
1√
2
0,25 1350
1√
2
0,5 400
1√
2
1√
2
50
1√
2
1 60
1√
2
√
2 60
1√
2
2 70
1√
2
4 150
1 0,25 3850
1 0,5 750
1 1√
2
400
1 1 100
1
√
2 100
1 2 100
1 4 175
˜rg hrms tdif√
2 0,25 1350√
2 0,5 400√
2 1√
2
50
√
2 1 60√
2
√
2 60√
2 2 70√
2 4 150
2 0,25 9000
2 0,5 3000
2 1√
2
1500
2 1 800
2
√
2 400
2 2 350
2 4 300
4 0,25 26000
4 0,5 5500
4 1√
2
3500
4 1 1200
4
√
2 600
4 2 500
4 4 400
Table 4: Diffusion times
48

More Related Content

What's hot

Review of Elementary Quantum Mechanics
Review of Elementary Quantum MechanicsReview of Elementary Quantum Mechanics
Review of Elementary Quantum MechanicsMd Kaleem
 
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะ
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะบทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะ
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะThepsatri Rajabhat University
 
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMU
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMUHot topics in actual neutrino physics - Seminar in Particle Physics at LMU
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMUChristiaan Roca Catala
 
5 introduction to quantum mechanics
5 introduction to quantum mechanics5 introduction to quantum mechanics
5 introduction to quantum mechanicsSolo Hermelin
 
Quantum mechanics a brief
Quantum mechanics a briefQuantum mechanics a brief
Quantum mechanics a briefChaitanya Areti
 
Virtual particles in the vacuum and gravity
Virtual particles in the vacuum and gravityVirtual particles in the vacuum and gravity
Virtual particles in the vacuum and gravityEran Sinbar
 
Basic and fundamental of quantum mechanics (Theory)
Basic and fundamental of quantum mechanics (Theory)Basic and fundamental of quantum mechanics (Theory)
Basic and fundamental of quantum mechanics (Theory)Halavath Ramesh
 
Engineering physics lab manual
Engineering physics lab manualEngineering physics lab manual
Engineering physics lab manualkveerabhadrarao1
 
Quantum mechanics for Engineering Students
Quantum mechanics for Engineering StudentsQuantum mechanics for Engineering Students
Quantum mechanics for Engineering StudentsPraveen Vaidya
 
Fundamentals of modern physics
Fundamentals of modern physicsFundamentals of modern physics
Fundamentals of modern physicsPraveen Vaidya
 

What's hot (20)

Review of Elementary Quantum Mechanics
Review of Elementary Quantum MechanicsReview of Elementary Quantum Mechanics
Review of Elementary Quantum Mechanics
 
Quantum mechanics S5
Quantum mechanics S5 Quantum mechanics S5
Quantum mechanics S5
 
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะ
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะบทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะ
บทที่ 2 ทฤษฎีสัมพัทธภาพเฉพาะ
 
Part III - Quantum Mechanics
Part III - Quantum MechanicsPart III - Quantum Mechanics
Part III - Quantum Mechanics
 
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMU
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMUHot topics in actual neutrino physics - Seminar in Particle Physics at LMU
Hot topics in actual neutrino physics - Seminar in Particle Physics at LMU
 
5 introduction to quantum mechanics
5 introduction to quantum mechanics5 introduction to quantum mechanics
5 introduction to quantum mechanics
 
Wave mechanics
Wave mechanicsWave mechanics
Wave mechanics
 
Quantum mechanics a brief
Quantum mechanics a briefQuantum mechanics a brief
Quantum mechanics a brief
 
FirstMatter - Copy
FirstMatter - CopyFirstMatter - Copy
FirstMatter - Copy
 
Trm 7
Trm 7Trm 7
Trm 7
 
Solid state
Solid stateSolid state
Solid state
 
Virtual particles in the vacuum and gravity
Virtual particles in the vacuum and gravityVirtual particles in the vacuum and gravity
Virtual particles in the vacuum and gravity
 
CHAPTER 3 The Experimental Basis of Quantum Theory
CHAPTER 3The Experimental Basis of Quantum TheoryCHAPTER 3The Experimental Basis of Quantum Theory
CHAPTER 3 The Experimental Basis of Quantum Theory
 
Basic and fundamental of quantum mechanics (Theory)
Basic and fundamental of quantum mechanics (Theory)Basic and fundamental of quantum mechanics (Theory)
Basic and fundamental of quantum mechanics (Theory)
 
Tesla memorial-conf-2013-stoyan-sarg
Tesla memorial-conf-2013-stoyan-sargTesla memorial-conf-2013-stoyan-sarg
Tesla memorial-conf-2013-stoyan-sarg
 
Engineering physics lab manual
Engineering physics lab manualEngineering physics lab manual
Engineering physics lab manual
 
CHAPTER 4 Structure of the Atom
CHAPTER 4Structure of the AtomCHAPTER 4Structure of the Atom
CHAPTER 4 Structure of the Atom
 
Quantum mechanics for Engineering Students
Quantum mechanics for Engineering StudentsQuantum mechanics for Engineering Students
Quantum mechanics for Engineering Students
 
Fundamentals of modern physics
Fundamentals of modern physicsFundamentals of modern physics
Fundamentals of modern physics
 
Quantum mechanics
Quantum mechanicsQuantum mechanics
Quantum mechanics
 

Viewers also liked

G1 changoluisa proaño_daniela_introd_diseño
G1 changoluisa proaño_daniela_introd_diseñoG1 changoluisa proaño_daniela_introd_diseño
G1 changoluisa proaño_daniela_introd_diseñoDaniela Lisbeth
 
ready for occupancy houses in cavite rush for sale/affordable house and lot ...
 ready for occupancy houses in cavite rush for sale/affordable house and lot ... ready for occupancy houses in cavite rush for sale/affordable house and lot ...
ready for occupancy houses in cavite rush for sale/affordable house and lot ...Murangbahaysacavite Cora Sacdalan
 
Investing in Cavite Real Estate Thru ACM Homes
Investing in Cavite Real Estate Thru ACM HomesInvesting in Cavite Real Estate Thru ACM Homes
Investing in Cavite Real Estate Thru ACM HomesRon Del de Castro
 
Lire un ecg amis med.com
Lire un ecg amis med.comLire un ecg amis med.com
Lire un ecg amis med.comamis-med
 
Role of Remote sensing
Role of Remote sensing Role of Remote sensing
Role of Remote sensing MOHTISHIM CH
 
Christine Allen vitae 2_19_2015
Christine Allen vitae 2_19_2015Christine Allen vitae 2_19_2015
Christine Allen vitae 2_19_2015Christine Allen
 
suresh renewed CV(1)
suresh renewed CV(1)suresh renewed CV(1)
suresh renewed CV(1)suresh pandu
 
Бессмертный полк в ауле Карасарт.
Бессмертный полк в ауле Карасарт.Бессмертный полк в ауле Карасарт.
Бессмертный полк в ауле Карасарт.alsu2003
 
''Resume DT - Abbas A. khan
''Resume DT - Abbas A. khan''Resume DT - Abbas A. khan
''Resume DT - Abbas A. khanAbbas Khan
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud ComputingWang, Sen
 
Cv english-dr al ajlouni .
Cv english-dr al ajlouni .Cv english-dr al ajlouni .
Cv english-dr al ajlouni .Ahmed Al-Ajlouni
 
Week2 why journalism
Week2   why journalismWeek2   why journalism
Week2 why journalismKyoungsu Kwak
 

Viewers also liked (20)

Social media 101
Social media 101Social media 101
Social media 101
 
G1 changoluisa proaño_daniela_introd_diseño
G1 changoluisa proaño_daniela_introd_diseñoG1 changoluisa proaño_daniela_introd_diseño
G1 changoluisa proaño_daniela_introd_diseño
 
ready for occupancy houses in cavite rush for sale/affordable house and lot ...
 ready for occupancy houses in cavite rush for sale/affordable house and lot ... ready for occupancy houses in cavite rush for sale/affordable house and lot ...
ready for occupancy houses in cavite rush for sale/affordable house and lot ...
 
Investing in Cavite Real Estate Thru ACM Homes
Investing in Cavite Real Estate Thru ACM HomesInvesting in Cavite Real Estate Thru ACM Homes
Investing in Cavite Real Estate Thru ACM Homes
 
Ernest Mc Millan CV
Ernest Mc Millan CVErnest Mc Millan CV
Ernest Mc Millan CV
 
Praktek sik (astri)
Praktek sik (astri)Praktek sik (astri)
Praktek sik (astri)
 
Lire un ecg amis med.com
Lire un ecg amis med.comLire un ecg amis med.com
Lire un ecg amis med.com
 
Role of Remote sensing
Role of Remote sensing Role of Remote sensing
Role of Remote sensing
 
Christine Allen vitae 2_19_2015
Christine Allen vitae 2_19_2015Christine Allen vitae 2_19_2015
Christine Allen vitae 2_19_2015
 
Riset Update (selesai)
Riset Update (selesai)Riset Update (selesai)
Riset Update (selesai)
 
CV - MAC 0415 Word
CV - MAC 0415 WordCV - MAC 0415 Word
CV - MAC 0415 Word
 
March 2015 3 slides from power point presentation
March 2015 3 slides from power point presentationMarch 2015 3 slides from power point presentation
March 2015 3 slides from power point presentation
 
suresh renewed CV(1)
suresh renewed CV(1)suresh renewed CV(1)
suresh renewed CV(1)
 
Бессмертный полк в ауле Карасарт.
Бессмертный полк в ауле Карасарт.Бессмертный полк в ауле Карасарт.
Бессмертный полк в ауле Карасарт.
 
''Resume DT - Abbas A. khan
''Resume DT - Abbas A. khan''Resume DT - Abbas A. khan
''Resume DT - Abbas A. khan
 
5. cohort studies
5. cohort  studies5. cohort  studies
5. cohort studies
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
Cv english-dr al ajlouni .
Cv english-dr al ajlouni .Cv english-dr al ajlouni .
Cv english-dr al ajlouni .
 
Week2 why journalism
Week2   why journalismWeek2   why journalism
Week2 why journalism
 
Technical seminar
Technical seminarTechnical seminar
Technical seminar
 

Similar to scriptie (20)

Dark Energy Thesis
Dark Energy ThesisDark Energy Thesis
Dark Energy Thesis
 
ddmd
ddmdddmd
ddmd
 
thesis
thesisthesis
thesis
 
SeniorThesis
SeniorThesisSeniorThesis
SeniorThesis
 
Master_Thesis
Master_ThesisMaster_Thesis
Master_Thesis
 
ASE II FINAL
ASE II FINALASE II FINAL
ASE II FINAL
 
A_Papoulia_thesis2015
A_Papoulia_thesis2015A_Papoulia_thesis2015
A_Papoulia_thesis2015
 
dissertation
dissertationdissertation
dissertation
 
thesis
thesisthesis
thesis
 
WOO thesis
WOO thesisWOO thesis
WOO thesis
 
thesis_mark5
thesis_mark5thesis_mark5
thesis_mark5
 
Predicting neutrino mass constraints from galaxy cluster surveys
Predicting neutrino mass constraints from galaxy cluster surveysPredicting neutrino mass constraints from galaxy cluster surveys
Predicting neutrino mass constraints from galaxy cluster surveys
 
thesis_v07
thesis_v07thesis_v07
thesis_v07
 
Laser trappedmirrorsinspace
Laser trappedmirrorsinspaceLaser trappedmirrorsinspace
Laser trappedmirrorsinspace
 
604 2441-1-pb
604 2441-1-pb604 2441-1-pb
604 2441-1-pb
 
Uncovering the Missing Secrets of Magnetism by: Ken Lee Wheeler
Uncovering the Missing Secrets of Magnetism  by: Ken Lee WheelerUncovering the Missing Secrets of Magnetism  by: Ken Lee Wheeler
Uncovering the Missing Secrets of Magnetism by: Ken Lee Wheeler
 
Louro optics
Louro opticsLouro optics
Louro optics
 
FinalThesis
FinalThesisFinalThesis
FinalThesis
 
Othr bacics of ed
Othr bacics of edOthr bacics of ed
Othr bacics of ed
 
SFT_preprint-EN_2_col.pdf
SFT_preprint-EN_2_col.pdfSFT_preprint-EN_2_col.pdf
SFT_preprint-EN_2_col.pdf
 

scriptie

  • 1. Radboud University Nijmegen Department of Astrophysics Bachelor Thesis The propagation of cosmic rays in the galactic magnetic field Author: Jordy Davelaar Supervisor: Prof. A. Achterberg Second corrector: Dr. ir. G.A. De Wijs October 31, 2013
  • 2.
  • 3. 1 ABSTRACT 1 Abstract Aims The aim of this project is to find an integrator that solves the trajectories of cosmic rays which are propagating through a random magnetic field. Methods The Runge Kutta Fehlberg method is used as an integrator. The accuracy of the integrator has been tested with several cases; the case of a single particle in a uniform magnetic field, B drifting of a single particle, E ×B drifting of a single particle, N-particles in an uniform magnetic field and the low scattering limit. If the integrator is indeed accurate enough it will be used to solve the equation of motion in the quasi random field. Results The integrator has been tested and it is shown that it is indeed accurate enough. The single particle in a uniform magnetic had a stable trajectory with fluctuations with an order of mag- nitude of 10−6 . The the experimental value of the B drifting was only 0.05% less than the theoretical one. The value of the E × B drifting was exactly the same as predicted by theory. The N particles in a uniform magnetic field differ 0.3% of the theoretical value. And the low scattering limit was accurate up to 8.8%. The integrator is then used to evaluate different cases for the magnetic field with a random component of arbitrary strength, defined as B = B0 ˆz +δB. Conclusion The Runge Kutta Fehlberg method is an accurate integrator for simulating the trajectories of particles in a random magnetic field. The diffusion coefficients and diffusion times are calculated and they have the right order of magnitudes and the right scaling in the low scattering limit. For radii larger than a coherence length and δB bigger than B0 the diffusion coefficient gets a different behavior, this is described in chapter 11. ii
  • 4.
  • 5. CONTENTS CONTENTS Contents 1 Abstract ii 2 Introduction 1 3 Electromagnetism 3 3.1 Lorentz Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.2 Cyclotron motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.3 Relativistic Lorentz force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.4 E × B drift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.5 B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.6 Casting the equations into a dimensionless form . . . . . . . . . . . . . . . . . . . 6 4 Simulating the cosmic magnetic field 9 5 Creating the cosmic rays 11 6 N-particle simulations 13 6.1 Motions in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . 13 7 Diffusion processes 15 7.1 The random walk model for diffusion in one dimension . . . . . . . . . . . . . . . 15 7.2 The weak scattering limit for scattering by random magnetic fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 8 Numerical methods 19 8.1 Runge Kutta Fehlberg Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 9 Testing the integrator 21 9.1 Motion in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . . 21 9.2 Motions with E × B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 9.3 Motions with B drifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 9.4 N particles in a uniform magnetic field . . . . . . . . . . . . . . . . . . . . . . . . 28 9.5 N particles low scattering limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 9.6 Distribution of particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 10 Simulating the different cases 31 10.1 Diffusion coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 10.1.1 Weak Scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 10.1.2 Strong scattering regime . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 10.2 Diffusion times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 11 Conclusion 41 12 Bibliography 43 13 Appendices 45 iv
  • 6.
  • 7. 2 INTRODUCTION 2 Introduction In 1912 Victor Hess measured the flux of charged particles in the atmosphere. This gave an interesting result: the higher he measured, the higher the flux was. It was thought then that the crust of the Earth was the main source of ionized radiation. If that would be the case then when you go higher into the atmosphere you expect a decreasing flux due to the shielding of the underlying air column. At first they thought that the source of the charged particles was the sun. Hess did measurements during a total eclipse and still got this increasing flux. The explanation for this radiation is a flux of charged particles which has an galactic or extra galactic origin. These particles are called cosmic rays. These high energetic particles strike the Earth’s atmosphere, creating a shower of particles. In 1936 Hess received the Nobel Prize for his discovery. The origin of the cosmic rays is still open to debate. The low- and medium-energetic cosmic rays, which have energies up to 1018 eV , probably have a solar or galactic origin. The high and ultra-high cosmic rays probably have an extragalactic origin. There is strong evidence that the cosmic rays with a galactic origin are produced in super nova remnants. The origin of the cosmic rays with energies above 1018 eV is still unknown. The uncertainty for the low and medium energetic particles is due to the fact that the charged particles are confined by the magnetic fields of a galaxy. These magnetic fields scatter them and due to this scattering they propagate in a diffuse way. The amount of scattering is related to the energy of the particles, the higher the energy the bigger the free path length and the faster the diffusion. Due to this scattering we are unable to trace the origin of the low-energy particles. The very energetic particles can be traced back but they are extremely rare. The trajectories of the particles in a magnetic field with a random component can not be solved analytically. Using numerical algorithms we are able to solve them. In this way we can understand their behavior in a statistical sense and find equations that predict it. For example with the diffusion coefficients of particles we are able to better understand the measurements of cosmic showers. For instance: if a detector measures two high energetic events at almost the same place in the sky at almost the same time, is it just coincidence or is it possible that these two cosmic rays had the same origin? The main goal of this project was to program an integrator that can solve the equations of motion of particles in a turbulent magnetic field. In chapter three we will discuss some single particle cases that can be solved analytically. The cases that will be discussed in chapter three are: the single particle in a uniform magnetic field , E ×B drifting and B drifting. At the end of chapter three we will look back at the derived equations and cast them into a dimensionless form. These equations will be used to check the accuracy of the integrator that has been programmed. In chapter four it is explained how the magnetic field is simulated and in chapter 5 we use a similar approach to simulate the particles. In chapter six we use statistics to find equations for the mean velocity and its deviation of the N particles in a uniform magnetic field. In the case of turbulent magnetic fields the particles propagate diffusively. This is explained in chapter 7.1. In par. 7.2 the low scattering limit is explained, this is an analytic solvable limit for the diffuse propagation of the particles. In chapter 8 we describe the numerical method that is used. In chapter 9 the test cases are used to check the accuracy of the integrator and in chapter 10 we use the integrator to solve the equations of motion of a particle in a quasi turbulent magnetic field. In chapter 11 we look back at the results and draw our conclusions. This subject was presented to me by prof. A. Achterberg who is a professor at the Astronomy Department of the Radboud University in Nijmegen. I came in contact with him with help of dr. 1
  • 8. 2 INTRODUCTION M. Haverkorn who I asked for a theoretical bachelor student project. In this bachelor project I definitely learned a lot that I can use in the future. The power of simulating nature to understand it, is really fascinating. I would like to thank my supervisor, prof. A. Achterberg, for his time, assitance and for answering my questions. Without his help none of this would have been possible. I also would like to thank my seccond corrector dr. ir. G. A. de Wijs. 2
  • 9. 3 ELECTROMAGNETISM 3 Electromagnetism 3.1 Lorentz Force In electromagnetism the Lorentz force is the force that acts on charged particles due to a magnetic or electric field. It has been derived by Hendrik Lorentz in the nineteenth century. The force F that a particle experiences if it is in an electromagnetic field is in CGS units [1] F = q(E + v c × B) (1) with q the charge of the particle, v the velocity of the particle, E the electric field, B the magnetic field and c the speed of light. 3.2 Cyclotron motion In this paragraph we will solve the equation of motion for a single particle in a uniform magnetic field. This will give a relation for the radius and the frequency of the motion. If the particle is in an uniform magnetic field, which is in the ˆz direction, the force that acts on the particle is Fx = q c vyBz Fy = − q c vxBz Fz = 0. Newtons second law states F = dp dt (2) with p the momentum of a particle. Using (2) and decoupling the differential equations gives ˙vx = − qBz mc 2 vx ˙vy = − qBz mc 2 vy ˙vz = 0. This is an harmonic oscillation around the magnetic field lines with frequency ω0 = qBz mc . The radius of the motion can be calculated with the help of the centrifugal force Fc = mv⊥ 2 r = qv⊥B c . This gives for the radius r0 = mcv⊥ qB . This simple analytic result will be used to evaluate the accuracy of the integrator. 3
  • 10. 3.3 Relativistic Lorentz force 3 ELECTROMAGNETISM 3.3 Relativistic Lorentz force The charged particles in the cosmic magnetic fields have ultra high energies. The classical ap- proach as in par. 2.2 is in this case not valid. Relativistic effects, caused by the high speeds of the particles, have to be taken into account. This will result in a Lorentz contracted radius and time dilated frequency. In that case the Lorentz force is [1] dp dt = q(E + v c × B). (3) On first sight there is no difference, but p is now the spatial component of the four-momentum of the particle, so dv dt = q mγ (E + v c × B) (4) with γ = 1 1 − β2 β = v c . The radius and frequency of the cyclotron motion in the relativistic case is rg = γc2 mβ⊥ qB = γr0 (5) ωg = qBz γmc = ω0 γ . (6) 3.4 E × B drift In this paragraph we will solve the equation of motion of a particle drifting in crossed magnetic and electric fields. This will lead to a relation for the drift velocity. It is possible to write the equation of motion in alternative form by splitting the velocities into two components, one parallel to the magnetic field and one perpendicular to the magnetic field so that v = v + v⊥. The v coincides with the component of the guiding center along the magnetic field. The perpendicular velocity is the guiding center velocity component perpendicular to the magnetic field. The equation of motion then reads m dv dt = qE m dv⊥ dt = qE⊥ + q c v⊥ × B. Due to the electric field the particle gets accelerated and decelerated. This leads to an drift velocity vdrift. In the case of E × B drifting the electric field on has a component perpendicular to the direction of the magnetic field. The equation of motion then reads 4
  • 11. 3.5 B drifting 3 ELECTROMAGNETISM m dv dt = 0 m dv⊥ dt = qE⊥ + q c v⊥ × B. If we assume that the velocity of the drift speed is constant, we can neglect all time derivatives of the velocities such that E⊥ + v⊥ c × B = 0. If we then take the cross product of this equation with B we get B × E⊥ + B × v⊥ c × B = 0. Using the triple product rule for cross products A × B × C = B(A · C) − C(A · B) we get B × E⊥ + v⊥ c (B · B) − B( v⊥ c · B) = 0. The last product is equal to zero by definition so that B × E⊥ + v⊥ c B2 = 0. Rewriting this equation gives the drift velocity for E × B drifting v⊥ c = βdrift = E⊥ × B B2 . (7) 3.5 B drifting In this paragraph we will give the relation for the B drift velocity. When a particle is in a magnetic field with B = 0, for example B = (B0 + xdB dx )ˆz, it experiences a changing magnetic field when it gyrates around the uniform field B0. Due to the fact that the magnetic field varies along the x direction, the guiding center of the particle’s trajectory will move. This movement is called a drift. The drift velocity is given by vdrift = − c qB M( ⊥B × ˆb). (8) M is the magnetic moment, which is given by M = p⊥v⊥ 2B = γmv2 ⊥ 2B . The direction of the magnetic field is defined by the unit vector ˆb. For the drift approximation we assume that to lowest order the orbit of the charged particle is still given by the orbit in a uniform magnetic field. The field varies with a typical scale given by L = B B . If we want that the orbit of the particle is the orbit as in a uniform magnetic field we want that the radius of the orbit is much smaller that the typical scale L. We can only use the approximation if 5
  • 12. 3.6 Casting the equations into a dimensionless form 3 ELECTROMAGNETISM | ⊥B | | B | rg (9) with rg given by (5). 3.6 Casting the equations into a dimensionless form In numerical methods it is convenient to use variables that are normalized with the typical values of the problem. First all the lengths are measured in terms of the coherence length lcoh which is the typical length scale for a random magnetic field, so that in a cube with size lcoh the magnetic field roughly is constant. In our numerical modelling we will assume that the field is exactly constant over a correlation length. Also, all velocities are measured in terms of the speed of light c. If we have a length L then it its dimensionless counterpart is ˜L = L/lcoh. For a velocity v we define β = v/c. With this we can write the Lorentz force (3) in an alternative form. Substituting the velocities gives dβ dt = q mcγ (β × B). If the magnetic field has a uniform component B0 in the ˆz direction and a random perturbation δB so that B = B0 ˆz + δB it is possible to scale the magnetic field with the strength of the uniform component by defining h = δB B0 . (10) Substituting this result into the Lorentz force then dβ dt = qB0 mcγ (β × (ˆz + h)). The factor qB0 mcγ is in fact the gyro frequency ωg as defined in (6). A given time t has a dimensionless counterpart ˜t defined as ˜t = ct lcoh . Substituting this gives dβ d˜t = ωg lcoh c (β × (ˆz + h)). The dimensionless gyration frequency then follows as ˜ωg = ωg lcoh c (11) so that dβ d˜t = ˜ωg(β × (ˆz + h)). (12) In these dimensionless variables the gyration radius of the circular motion in the plane perpen- dicular to the uniform magnetic field is 6
  • 13. 3.6 Casting the equations into a dimensionless form 3 ELECTROMAGNETISM ˜r = β ˜ωg (13) which is a relation between the velocity and the gyration radius of the particle in the uniform field. For the B drift speed (8) the following dimensionless relation holds βdrift = − 1 2˜ωg β2 ⊥( ˜ ˜B × ˜b) (14) with ˜B the dimensionless magnetic field defined as ˜B = B B0 and coh the dimensionless gradient. For the E × B drift speed (7) the following dimensionless equation holds βdrift = ˜E⊥ × ˜B ˜B2 (15) with the dimensionless electric field ˜E defined as ˜E = E B0 . For a table with all useful equations and variables see table 1 in the Appendices. 7
  • 14.
  • 15. 4 SIMULATING THE COSMIC MAGNETIC FIELD 4 Simulating the cosmic magnetic field Cosmic magnetic fields are almost never uniform or regular: they show sings of magnetic turbu- lence. Such turbulent magnetic fields with a random component δB can be represented as: B(r) = B0 + δB(r). (16) For this random component a discrete function is used. We take a cube with edges of size L and cut it in N cells which are all equal of size. In these cells we can appoint a different magnetic field δB. If the dimensions of a cell is chosen to be equal to the coherence length then the dimensionless size of a cell is just 1. This choice has its practical reasons because it is then simple to track a particle through the cells. We can give each cell three numbers: ηx, ηy and ηz, these are the integer values of the coordinates the center of a cell. The integer value of the coordinate of the the particle is then just the number of the cell in a specific direction. By using periodic boundary conditions (x = x + L) we can follow particles which go further than a linear distance L. If the particle leaves the cube on one side it enters it at the correspond- ing position on the opposite side. If the cube is big enough, or when the random component in the magnetic field is big enough, all the memory of the initial conditions can be erased in a statistical sense. This is possible if a particle scatters through a large angle. For this to occur it is sufficient that the particle enters a different cell than the one it originated from. It is convenient for numerically generating an isotropically distributed turbulent magnetic field by using spherical coordinates. In that case the average of the magnetic turbulent field is always zero. The vector δB can be represented by, δBx =| δB | 1 − cos2(θ) cos(φ) δBy =| δB | 1 − cos2(θ) sin(φ) δBz =| δB | cos(θ) We can then use a random number generator to produce random values for φ and cos(θ) between 0 < φ < 2π and −1 < cos(θ) < 1. 9
  • 16.
  • 17. 5 CREATING THE COSMIC RAYS 5 Creating the cosmic rays In general particles do not have exactly the same initial conditions. In our simulation N cosmic rays enter our simulation box of linear size L. Each cosmic ray requires initial conditions in position and momentum space, amounting to 6 vector components. The position of each simulated cosmic ray is chosen in the following manner: we randomly place a cosmic ray in a small box. This is done by using a random number generator. The box is chosen to be in the center of a cell. This cell is located in the center of the cube. We make this choice because then the particles does not leave a cell or the cube in the first integration step. The initial velocity in terms of β is distributed isotropically on a sphere, so that we can employ a similar approach as used for generating the random component of the magnetic field. βx =| β | 1 − cos2(θ) cos(φ) (17) βy =| β | 1 − cos2(θ) sin(φ) (18) βz =| β | cos(θ). (19) For the random distribution of φ and cos(θ) a random number generator is used in the same way as it is for δB. 11
  • 18.
  • 19. 6 N-PARTICLE SIMULATIONS 6 N-particle simulations The behavior of N particles , with N 1, can be described in the framework of statistics. Due to the fact that N is a really large number, typically N=10.000, the only way to say something about the system is in terms of averages. In the one dimensional case a bunch of N particles, which are distributed by some function f(x), have an average position < x >, an average position squared < x2 > and an root mean squared deviation called σx, which are defined by [2] < x >= xf(x)dx (20) < x2 >= x2 f(x)dx (21) σ2 x =< x2 > − < x >2 (22) For instance for a stochastic variable x distributed uniformly between x = x0 and x = x1 we have: f(x) = 1 x1 − x0 (23) 6.1 Motions in a uniform magnetic field In the case of a uniform magnetic field we can calculate the averages of the velocities of the particles and the deviation of the velocities. Lets consider the velocity parallel to the magnetic field. The velocity in the ˆz direction of a single particle is given by (19). If we define µ = cos(θ) and 0 ≤ µ ≤ 1. Then using (23), f(µ) = 1 for 0 ≤ µ ≤ 1 and zero otherwise. Using (20) we can calculate the average position β t = 1 0 βtµdµ = βt 2 . We can then use (21) to calculate the average position squared β2 t2 = 1 0 β2 t2 µ2 dµ = β2 t2 3 . Then using this two result we can calculate the deviation by using (22). This gives σ2 β t = β2 t2 12 . (24) So in the case that the magnetic field is chosen to be uniform and in the z-direction then the deviation of z is proportional with t and has a coefficient that can be calculated both numerically and analytically. This is another way to check the accuracy of the integrator, but it is fundamentally different from the situation we are after. In this case the particles velocities are distributed informally and the motions are completely regular. In the case of random magnetic fields the motions become irregular. 13
  • 20.
  • 21. 7 DIFFUSION PROCESSES 7 Diffusion processes In galaxies the magnetic fields have random components. Due to this random components the direction of propagation of a cosmic ray can be inverted. Due to δB the Lorentz force can have a component that changes v . This component will slowdown the particle and if it is strong enough or is anti parallel for a longer time it will even let the cosmic ray move in the opposite direction. The parallel component is not the only component that is disturbed by the random field also the perpendicular motions feels a force. This also results in a diffuse propagation. 7.1 The random walk model for diffusion in one dimension Diffusion is the physical process where particles propagate with a random walk [3]. This model has been solved by Chandrasekhar [4]. He gave a solution for the probability that a particle could reach a point m after N steps. In the case of a unit step size, that probability is given by [5] W(m, N) = N! N+m 2 ! N−m 2 ! 1 2 2 Using Stirling’s approximation [6] on the factorials one can show that for sufficiently large N W(m, N) = 2/πNe −m2 2N In a random walk with step size l, starting at x = 0 at time t = 0, the net displacement x equals x = ml. If a particle scatters n times per second we have N = nt The probability of finding a particle in the interval [x, x + dx] at time t then equals W(x, t)dx with W(x, t) = 1 √ 4πDt e −x2 2Dt . (25) D is the diffusion coefficient defined as D = nl2 , so that the mean displacement is σx = √ 2Dt. The diffusion coefficient is the ”speed” of the diffusion. The bigger it is, the more diffusive the system is. 7.2 The weak scattering limit for scattering by random magnetic fields Another test case is the low scattering limit [7]. This is the case where weak random fields deflect charges in a strong (uniform) guide field, taken to be in the z-direction. Weak scattering applies if the deflection incurred when a particle traverses one cell remains small.. But these deflection add up diffusely. Particles typically reverse their direction and their motions can be described in a statistical sense with the diffusion coefficients as explained in the previous section. In this section we will derive the diffusion coefficients for the low scattering limit. In absence of an electric field the Lorentz force law (3) implies that the velocity of a particle remains constant. We can then define ˆn = β |β| and use the substitution ds = vdt to rewrite the equation of motion dˆn ds = ˆn × (ˆz + h) rg 15
  • 22. 7.2 The weak scattering limit for scattering by random magnetic fields 7 DIFFUSION PROCESSES Due to the isotropic distribution of hrms (10) its average vanishes: hx = hy = hz = 0. The assumption that the random fields are isotropically distributed implies that h2 x = h2 y = h2 z = h2 rms/3, (26) If we look at the z direction, then with nz = cos(θ) = µ: dµ ds = hrms · (ˆz × ˆn) rg In one cell hrms is uniform so that we can integrate it with respect to s to find an expression for ∆µ ∆µ = hrms · (ˆz × ˆn) rg ∆s Taking the absolute value and using the fact that ∆s ∼ lcoh, the change of the pitch angle cosine is given by | ∆µ |= h2 rms lcoh rg . The only condition is |∆µ| 1 (small deflection in one cell) so one must demand hrms coh/rg 1 This is only valid when the deflection in one cell is small |∆µ| 1. So one must demand hrms coh/rg 1. If we then use that h2 rms = h2 rms 3 then | ∆µ |= hrms √ 3 lcoh rg The direction of motion along the z axis is reverted if √ N | ∆µ |= 1. This corresponds to ∆s = Nlcoh = lcoh |∆µ|2 = lmfp with lmfp is the mean free path length. Then using the definition of Dzz this gives the following for the diffusion coefficient Dzz = 1 3 vlmfp = vr2 g lcohh2 rms . This calculation gives the correct scaling, and differs from the exact result by factors of order unity. We can rewrite the equation of Dzz when we define a scattering frequency νs as follows νs = 2h2 rmsvlcoh 3r2 g . (27) This gives for Dzz Dzz = v2 3νs The uniform field in the z-direction limits the amount of diffusion across the field. If one takes the effect of the gyration around the uniform field into account, the diffusion in the x − y plane can be characterized by a diffusion coefficient D⊥. In the weak scattering limit it is given by: D⊥ = νs ωg 2 Dzz The low scattering regime holds if νs ωg. 16
  • 23. 7.2 The weak scattering limit for scattering by random magnetic fields 7 DIFFUSION PROCESSES The diffusion coefficients have a dimensionless counterparts ˜Dzz ≡ Dzz c coh = β˜r2 2h2 rms (28) ˜D⊥ ≡ D⊥ c coh = 2 9 βh2 rms. (29) The dimensionless counterpart of the low scattering limit is ˜rg 2h2 rms/3. We can also define a product between the the diffusion coefficients ˜Dzz ˜D⊥ = 1 9 β2 ˜r2 . (30) It is only valid in the weak scattering limit and is useful because it is independent of hrms. This equation will be used to check the scaling of the values that will be calculated with the integrator. Beside the diffusion coefficients we are also able to predict the diffusion times in the low scattering limit. If a particle needs to traverse N cell before it reverses its direction, then the mean free path length of the particle is lmfp = Nlcoh = lcoh | ∆µ |2 3r2 g lcohh2 rms . So the typical distance to become diffuse is proportional to this mean free path length. The diffusion time is then proportional to tdif Nlcoh v = 3r2 g vlcohh2 rms . The dimensionless diffusion time is then given by ˜tdif 3˜r2 g βh2 rms . (31) 17
  • 24.
  • 25. 8 NUMERICAL METHODS 8 Numerical methods There are several methods to numerically solve N coupled ordinary differential equations, which have the form dyi(x) dt = fi (t, y1, ..., yN ) i = 1, ..., N. The easiest way to solve differential equations is with the Euler method [8] xn+1 = xn + hf (t, xn). with h = tn+1 − tn. This method calculates the derivative once, and takes a step h in time. This results into an unstable and inaccurate method. A better way is to evaluate the derivative n times between xn+1 and xn. With this information the final step is more accurate. A method is called nth order if the error term is O(hn+1 ). 8.1 Runge Kutta Fehlberg Method The Runge Kutta Fehlberg method is developed by the German mathematician Erwin Fehlberg. This method uses a fourth and fifth order Runge Kutta method. The biggest advantage is that we can combine these two methods to evaluate the accuracy of the step that is made. If it is not accurate enough we can change the step size and thereby increase the accuracy to a user defined tolerance. [9] The Runge Kutta Fehlberg uses the following equations k1 = h · f (tn, xn) k2 = h · f (tn + h 4 , xn + k1 4 ) k3 = h · f (tn + 3h 8 , xn + 3 32 k1 + 9 32 k2) k4 = h · f (tn + 12h 13 , xn + 1932 2197 k1 − 7200 2197 k2 + 7296 2197 k3) k5 = h · f (tn + h, xn + 439 216 k1 − 8k2 + 3680 513 k3 − 845 4104 k4) k6 = h · f (tn + h 2 , xn − 8 27 k1 + 2k2 − 3544 2565 k3 + 1859 4104 k4 − 11 40 k5) We can then calculate the steps for the 4th and 5th order with y4th n+1 = yn + 25 216 k1 + 1408 2565 k3 + 2197 4104 k4 − k5 5 y5th n+1 = yn + 16 135 k1 + 6656 12825 k3 + 28561 56430 k4 − 9 50 k5 + 2 55 k6 Using these values we are able to check the accuracy R =| y5th n+1 − y4th n+1 | If R is bigger than a user defined tolerance value TOL, the step has to be adapted. We can choose the following for calculating the scale factor d of h 19
  • 26. 8.1 Runge Kutta Fehlberg Method 8 NUMERICAL METHODS d = TOL 2R 0.25 . The 0.5 is a safety factor to ensure success on the next try. Typically the next try will have a error of TOL/2. Defining a minimum and maximum value for h ensures that h does not grow too big or too small, which would otherwise effects the run time of the method. The condition for the time steps is t << 1 ωg so that we resolve the gyro-motion around the uniform field. 20
  • 27. 9 TESTING THE INTEGRATOR 9 Testing the integrator 9.1 Motion in a uniform magnetic field The first way to check if the integrator is accurate enough is by using analytically solvable problems. This can for example be a uniform magnetic field B0 in the ˆz direction as explained in section 3.2. When the trajectory of the particle is averaged over a full gyration period Pg = 2π/ωg, we expect to see a free particle moving in the z direction with a constant x and y position. In the figures 1-6 the simulated value is compared and scaled to the theoretical value. For the theoretical value we used the following function: x0(t) = x0(t = 0), y0(t) = y0(t = 0) and z0(t) = vzt + z0(t = 0). The initial velocity of the particle was βz = 0.5. The theoretical center of the motion at t = 0 was at x0 = 51.207, y0 = 49.793 and z0 = 50.5. We can identify two types of numerical noise, on small scales in the figures 2 and 4 and on larger scales in the figures 1 and 3. The large scale noise has an order of magnitude up to 10−3 and the small scale an order of magnitude up to 10−6 . In figure 5 and 6 it is clearly visible that there is an asymptotic behavior and the relative error tends to 10−7 . We can conclude that the numerical result and theoretical predictions are almost equal. If we fit a line f(t) = βzt + z0 with the simulated data for z, we get βz = 0.5 ± 3.18 · 10−10 and z0 = 50.5001 ± 9.169 · 10−07 . -0.0012 -0.001 -0.0008 -0.0006 -0.0004 -0.0002 0 0.0002 0.0004 0 1000 2000 3000 4000 5000 (x−x0) x0 t Numerical noise Figure 1: The numerical noise in the x trajectory as a function of time. 21
  • 28. 9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR -8e-06 -7e-06 -6e-06 -5e-06 -4e-06 -3e-06 -2e-06 -1e-06 0 0 1000 2000 3000 4000 5000 (x−x0) x0 t Numerical noise Figure 2: The numerical noise in the x trajectory as a function of time. -0.0025 -0.002 -0.0015 -0.001 -0.0005 0 0.0005 0 1000 2000 3000 4000 5000 (y−y0) y0 t Numerical noise Figure 3: The numerical noise in the y trajectory as a function of time. 22
  • 29. 9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR -8e-06 -7e-06 -6e-06 -5e-06 -4e-06 -3e-06 -2e-06 -1e-06 0 0 1000 2000 3000 4000 5000 (y−y0) y0 t Numerical noise Figure 4: The numerical noise in the y trajectory as a function of time. 0 1e-06 2e-06 3e-06 4e-06 5e-06 6e-06 7e-06 8e-06 0 10 20 30 40 50 60 (z−z0) z0 t Numerical noise Figure 5: The numerical error in the z trajectory as a function of time. 23
  • 30. 9.1 Motion in a uniform magnetic field 9 TESTING THE INTEGRATOR 0 1e-07 2e-07 3e-07 4e-07 5e-07 6e-07 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (z−z0) z0 t Numerical noise Figure 6: The numerical error in the z trajectory as a function of time. 24
  • 31. 9.2 Motions with E × B drifting 9 TESTING THE INTEGRATOR 9.2 Motions with E × B drifting The next test case is the E × B drifting. We can calculate a theoretical value by using eqn. (15). The direction of the electric field is chosen in the ˆx direction and the direction of the magnetic field is chosen in the ˆz direction. Using (15) this gives the following for the drift velocity βdrift = − ˜E ˜B ˆy The values for both ˜E and ˜B are chosen equally large so that the drift velocity is equal to −1 in the ˆy direction. Running the simulation for a single particle we can calculate a numerical value for the drift speed. In the figures 7 and 8 the simulated values are compared and scaled to the theoretical values. For the theoretical value we used the following function: y0(t) = βdriftt + y0(t = 0). With βdrift = −1 and y0(t = 0) = 49.793. In figure 7 we can see that there is noise on larger scales until t = 300. The large scale noise has an order of magnitude up to 10−2 . In figure 8 it is clearly visible that after t = 300 there is an asymptotic behavior and the relative error tends to 10−7 . So that we can conclude that the numerical result and theoretical predictions are almost equal. If we fit a line y(t) = βdriftt + y0 with the simulated data of y, we obtain a drift speed of βdrift = −1 ± 0.000000007021. Which is as predicted by theory. -0.002 0 0.002 0.004 0.006 0.008 0.01 0.012 0 50 100 150 200 250 300 (y−y0) y0 t Numerical noise Figure 7: The numerical noise of the particle’s trajectory. 25
  • 32. 9.2 Motions with E × B drifting 9 TESTING THE INTEGRATOR 0 5e-07 1e-06 1.5e-06 2e-06 2.5e-06 3e-06 3.5e-06 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (y−y0) y0 t Numerical noise Figure 8: The numerical error of the particle’s trajectory. 26
  • 33. 9.3 Motions with B drifting 9 TESTING THE INTEGRATOR 9.3 Motions with B drifting In paragraph 3.5 we gave the equation for the B drift velocity (14). We can use this equation to calculate a theoretical value for the drift speed. First a value for B has to be chosen which is not too big otherwise the approximation is not valid. The direction of the gradient of the magnetic field is chosen to be only in the x direction. We can then find that d ¯B dx 1. A proper value would be in the order of 10−3 . For the frequency and the perpendicular velocity the follow- ing values are chosen: β2 ⊥ = 0.48 and ωg = 0.6917. Using (14) we find that βdrift = 3.4587∗10−4 ˆy. Running the simulation, only considering the change in the ˆy direction and only looking at the average of the motion, we can calculate what the numerical value is. If we fit a line y(t) = βdriftt + y0 with the data, we obtain a drift speed of βdrift = (3.45919 ± 0.00002052)10−4 . In figure 9 the simulated values are compared and scaled to the theoretical values. For the theoretical value we used the following function: y0(t) = βdriftt + y0(t = 0). With βdrift = 3.4587 ∗ 10−4 and y0(t = 0) = 1, 48903. There is some numerical noise visible with an order of magnitude up to 10−3 . So that we can conclude that the numerical result and theoretical predictions are nearly the same. 0.0014 0.0016 0.0018 0.002 0.0022 0.0024 0.0026 0.0028 0.003 0 100 200 300 400 500 (y−y0) y0 t Numerical noise Figure 9: The numerical noise of the particle’s trajectory. 27
  • 34. 9.4 N particles in a uniform magnetic field 9 TESTING THE INTEGRATOR 9.4 N particles in a uniform magnetic field We will now consider the N particles with their velocities distributed over a sphere with radius: | v |. We choose the radii of the motions of the particles as ˜rg = 1.00. Using (13) and a frequency of ˜ωg = 0.6917 we can calculate the velocity of the particles | β |= 0.6917. The deviation is given by equation (24). If we fit a line β√ 3 t with the data, we obtain a numerical value of β = 0.688108 ± 0.000572. In the figures 10 and 11 the simulated values are compared and scaled to the theoretical values. For the theoretical values we used the following function: σ0(t) = β√ 3 t. The numerical noise tends to 10−3 as t grows larger. So that we can conclude that the numerical result and the theoretical predictions are almost the same. -0.02 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0 200 400 600 800 1000 (σ−σ0) σ0 t Numerical noise Figure 10: The numerical error of the N particles deviation in a uniform field. 28
  • 35. 9.5 N particles low scattering limit 9 TESTING THE INTEGRATOR -0.004 -0.0038 -0.0036 -0.0034 -0.0032 -0.003 0 200 400 600 800 1000 (σ−σ0) σ0 t Numerical noise Figure 11: The numerical noise of the N particles deviation in a uniform field. 9.5 N particles low scattering limit The next test case for the integrator is the low scattering limit. The low scattering limit holds when ˜rg 2 3 h2 rms. For ˜rg = 1, β = 0.69 and hrms = 0.1 this is true. Using (28) and (29) we can calculate the theoretical values for the diffusion coefficients. The theoretical values are then ˜Dzz = 34.5, ˜D⊥ = 0, 0015. For 20.000 particles a simulation has been run and it gave the following result ˜Dxx = 0.00115 ± 0.0000004843 ˜Dyy = 0.00129 ± 0.0000006387 ˜Dzz = 46.8702 ± 0.0213 The numerical values differ from the theoretical values. The problem is here that the coherence length is set equal to the box size. But in the case of a cube the average crossing length to one of its faces is not equal to one. The path length through a single cell can very between zero and √ 3 coh 1.73 coh. This has some consequences for the analysis that has been done in the section 3.5. The distances should not scaled by lcoh but by the average path length through a cube with sides coh, which is equal to ξ coh. The average path length of a particle through a cube, which plays the role of the coherence length of the magnetic field, is calculated to be 1.485 in units where the cube size is unity. The diffusion coefficients are then given by ˜Dzz = ξ β˜r2 g 2h2 rms (32) ˜D⊥ = 1 ξ 2 9 βh2 rms. (33) The new theoretical values are then ˜Dzz = 51.22, ˜D⊥ = 0, 00103. If we average the perpendicular diffusion coefficients and calculate the product (30) between them then 29
  • 36. 9.6 Distribution of particles 9 TESTING THE INTEGRATOR ˜D⊥ = 0, 00122 (34) ˜D⊥ · ˜Dzz = 0, 0057. (35) The theoretical value is ˜D⊥ · ˜Dzz = 0, 0052. 9.6 Distribution of particles When the system is indeed diffuse the particles are distributed by a Gaussian curve given by (25). In figure 12 a histogram of the particles as a function of their relative coordinates is plotted. The histogram has a Gaussian shape as predicted by (25). Figure 12: The Gaussian distribution of the particles as function of their relative coordinates. 30
  • 37. 10 SIMULATING THE DIFFERENT CASES 10 Simulating the different cases In our description in terms of dimensionless variables there remain only two free parameters: the gyration radius in units of the box size, rg/ coh (a measure of the strength of the uniform field) and the relative strength hrms = δB/B0 of the random magnetic field component. For these two parameters the following values are used ˜rg = {0.25, 0.5, 0.71, 1.0, 1.41, 2.0, 4.0} and hrms = {0.25, 0.5, 0.71, 1.0, 1.41, 2.0, 4.0}. There are 10.000 particles per simulation. 10.1 Diffusion coefficients The results for different values of hrms are shown in figures 13 and 14. Figure 13: The dimensionless diffusion coefficient in the perpendicular direction as function of the dimensionless gyration radius for a given random magnetic field strength. 31
  • 38. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES Figure 14: The dimensionless diffusion coefficient in the parallel direction as function of the dimensionless radius for a given random magnetic field strength. In the figures 15 and 16 the diffusion coefficients for different radii are shown Figure 15: The dimensionless diffusion coefficient in the perpendicular direction as a function of the random magnetic field strength for a given dimensionless gyration radius. 32
  • 39. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES Figure 16: The dimensionless diffusion coefficient in the parallel direction as a function of the random magnetic field strength for a given dimensionless gyration radius. In figure 17 the product between the diffusion coefficients is shown for different values of hrms and in figure 18 for different radii. Figure 17: The product between the dimensionless diffusion coefficient as a function of the dimensionless gyration radius for a given random magnetic field strength. 33
  • 40. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES Figure 18: The product between the dimensionless diffusion coefficient as a function of the random magnetic field strength for a given dimensionless gyration radius. The data that are used in this section can be found in the tables 2 and 3 in the appendices. 34
  • 41. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES 10.1.1 Weak Scattering The figures 13 and 14 give the diffusion coefficients as a function of ˜rg for a given random mag- netic field strength. In the low scattering limit the following must hold; if the random magnetic field is √ 2 larger then the diffusion coefficient is also two times larger. The distance between the curves is as predicted by eqn. (29). It is clearly visible in figure 13 that the lines up to hrms = 1 satisfy this. Above hrms = 1 the distances between the curves become smaller. Above ˜rg = 1√ 2 the lines flatten. In fig. 14 the lines also meet up with the prediction, above ˜rg = 1√ 2 the lines get a different slope. In the figures 15 and 16 the diffusion coefficients as function of hrms for a given dimensionless gyration raidus are plotted. In figure 15 the distances between the curves meet up with the predictions until ˜rg = 1√ 2 , for larger radii the distances are smaller. After hrms = 1 the lines flatten just as in figure 13 for ˜rg = 1√ 2 . In figure 16 it is also visible that curves are equidistant, the slopes steepen above hrms = 1. If we look at the product of the parallel and perpendicular coefficients we see in figure 17 that as a function of the radius the product is almost constant until hrms = 1. For bigger magnetic fields it gets smaller. In 18 this is also visible, for different radii the products are constant until hrms = 1. So combining these results we can conclude the following. Around hrms = 1 and ˜rg = 1√ 2 there is a change in the diffusion coefficients visible. This is the place where the weak scatter- ing break down starts. The radius ˜rg = 1√ 2 is the radius that corresponds to the coherence length. In the figures 19 and 20 the numerical values of the parallel diffusion coefficients are com- pared with the theoretical value (Dzz0 ) of the weak scattering regime. We plotted the difference between the two values and scaled it with the theoretical value. The same has been done for the perpendicular diffusion coefficients in the figures 21 and 22. For hrms < 0.5 and large values of ˜rg the difference between the theoretical and numerical values drops to 0.1. The diffusion coefficients for the low scattering limit are in the right order of magnitude and have the right scaling. 35
  • 42. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES Figure 19: The difference between the theoretical and numerical values of the parallel diffusion coefficient as a function of the dimensionless gyration radius for a given random magnetic field strength. Figure 20: The difference between the theoretical and numerical values of the parallel diffusion coefficient as a function of the random magnetic field strength for a given dimensionless gyration radius. 36
  • 43. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES Figure 21: The difference between the theoretical and numerical values of the perpendicular diffusion coefficient as a function of the dimensionless gyration radius for a given random magnetic field strength. Figure 22: The difference between the theoretical and numerical values of the perpendicular diffusion coefficient as a function of the random magnetic field strength for a given dimensionless gyration radius. 37
  • 44. 10.1 Diffusion coefficients 10 SIMULATING THE DIFFERENT CASES 10.1.2 Strong scattering regime In the strong scattering regime theory predicts that Dzz = D⊥. In the case of strong scattering we must demand that hrms 1 and ˜rg 1. The difference between the the perpendicular and parallel diffusion coefficient is plotted in figure 23. This difference is given as a function of the dimensionless gyration radius for the random magnetic fields strengths: hrms = 2 and hrms = 4. 0.001 0.01 0.1 1 0.25 0.5 1 2 4 Dzz−D⊥ (Dzz+D⊥)/2 ˜rg h = 4 h = 2 Figure 23: The difference between the perpendicular and parallel diffusion coefficient as a function of the dimensionless gyration radius for a given random magnetic field strength. It is visible that for larger hrms and smaller ˜rg the difference between the coefficient becomes smaller. 38
  • 45. 10.2 Diffusion times 10 SIMULATING THE DIFFERENT CASES 10.2 Diffusion times The diffusion times are calculated in the following way, first the σ(t)2 2t = D(t) is calculated. D(t) is also called the running diffusion coefficient. The diffusion time is then defined as the time tdif where the running diffusion coefficient becomes constant, D(tdiff ) = D. This is due to the fact that when a system is diffuse the deviation is equal to σ2 = 2Dt. If we plot the diffusion coefficient as a function of time we are able to find the point where this is true. This method is then used for the same cases as in paragraph 10.1. The results for different values of hrms are shown in figure 24. Figure 24: Diffusion times as a function of the random magnetic field strength for a given dimensionless gyration radius. 39
  • 46. 10.2 Diffusion times 10 SIMULATING THE DIFFERENT CASES The diffusion times for different radii are shown in figure 25. Figure 25: Diffusion times as a function of the dimensionless gyration radius for a given random magnetic field strength. In figure 24 the diffusion times as a function of ˜rg for a given random magnetic field strength are plotted. As a function of radius we see that for large radii the diffusion time scales with ˜r2 g as predicted by eq. (31). For smaller radii the diffusion time becomes smaller until it has a minimum around ˜rg = 1√ 2 for hrms > 0.5, for radii smaller that 0.71 the diffusion becomes bigger. If hrms < 0.5 the diffusion times scales with ˜r2 g for all ˜rg. In figure 25 the diffusion times are plotted as a function of hrms for a given dimensionless gyration radius. As a function of the random magnetic field strength we see that for small values of hrms or large values of ˜rg the diffusion time scales with h−2 rms as predicted by eqn. (31). For ˜rg = 1√ 2 there is a drop visible around hrms = 1. The diffusion time becomes constant until hrms = 2 and then becomes bigger. So combining these results we can conclude the following. Around hrms = 1 and ˜rg = 1√ 2 there is a change in the diffusion time visible. This is the place where the weak scattering break down starts. The radius ˜rg = 1√ 2 is the radius that corresponds to the coherence length. The data that are used in this section can be found in the table 4 in the appendices. 40
  • 47. 11 CONCLUSION 11 Conclusion The Runge Kutta Fehlberg scheme provides itself as an accurate integrator for this type of dif- ferential equations. In section 9.1. it gave a stable trajectory for the single particle in a uniform magnetic field. It was able to calculate the drift speed for the B drifting (section 9.3) and the E × B drifting (section 9.2). In the N particle cases we were able to calculate the average velocity of N particles in a uniform magnetic field (section 9.4) which was also very accurate. In the low scattering limit (section 9.5) with defining a effective coherence we were able to calculate the diffusion coefficients, these were accurate up to 8.8% and had the right scaling. In section 9.6 it is shown that the particles are Gaussian distributed. In section 10 we simulated for different values of th dimensionless gyration radius and random magnetic field strength, from the data we found the diffusion coefficients and diffusion times. In section 10.1. we looked at the diffusion coefficients, for the low scattering regime we found a break down around hrms = 1 and ˜rg = 1√ 2 . This break down was also found with the diffusion times. To get a better knowledge of what is really happening around hrms = 1 and ˜rg = 1√ 2 more simulations are needed. With more accurate simulations we can fit the data and find a scaling law that describes the behavior of cosmic rays in this regime. The simulations do not deal with radiation effects. When a charged particle gyrates around a magnetic field line it radiates synchrotron radiation. To make the simulations more accurate this effect has to be taken into account, because it is one of the energy loss mechanisms of cosmic rays. Another detail that is not taken into account is dust and gas: in the milky way cosmic rays heath the interstellar medium. In this simulation the particles propagate through vacuum. In molecular clouds the cosmic rays interact with the gas and radiate in the gamma ray regime so that the cosmic rays lose energy. All this types of energy losses were not taken into account yet, but for the longer integration times they are definitely not neglectable. 41
  • 48.
  • 49. REFERENCES 12 Bibliography References [1] D.J. Griffiths. Introduction to Electrodynamics (3rd Edition). Benjamin Cummings, 1999. [2] Vijay Kumar Rohatgi. An introduction to probability theory and mathematical statistics. Wiley series in probability and mathematical statistics. [3] C. Ruhla. The physics of chance: from Blaise Pascal to Niels Bohr. Oxford University Press, 1992. [4] S. Chandrasekhar. Stochastic problems in physics and astronomy. Rev. Mod. Phys., 15:1–89, Jan 1943. [5] T. Stanev. High Energy Cosmic Rays. Springer Praxis Books / Astronomy and Planetary Sciences. Springer, 2010. [6] R. Bowley and M. S´anchez. Introductory statistical mechanics. Oxford science publications. Clarendon Press, 1999. [7] N.A. Krall and A.W. Trivelpiece. Principles of Plasma Physics. International Series in Pure and Applied Physics. San Francisco Press, 1986. [8] W.H. Press. Numerical Recipes in C. Cambridge University Press, 1988. [9] E. Fehlberg. Low-order classical Runge-Kutta formulas with stepsize control and their ap- plication to some heat transfer problems. NASA technical report. National Aeronautics and Space Administration, 1969. 43
  • 50.
  • 51. 13 APPENDICES 13 Appendices symbol physical dimensionless position ˜x x x/l velocity β v v/c time ˜t t tc/l frequency ˜ω ω ωl/c Larmor radius ˜rg rg v/ωg magnetic field ˜ B B B/B0 electric field ˜ E E E/B0 gradient ˜ d/dx = l B drift velocity βdrift − c qB M( ⊥B × ˆb) − 1 2˜ωg β2 ⊥( ˜ ˜B × ˜b) E × B drift velocity βdrift c(E⊥ × B)/(B2 ) ( ˜E⊥ × ˜B)/( ˜B2 ) diffusion coefficient ˜D D D/cl ˜Dzz (v2 )/(3νs) (β˜r2 )/(2h2 rms) ˜D⊥ (νs/ωg) 2 Dzz 2 9 βh2 rms low scattering limit νs ωg ˜rg 2h2 rms/3 Table 1: Useful equations and variables and their dimensionless counterparts 45
  • 52. 13 APPENDICES ˜rghrms ˜D⊥error˜D⊥ ˜Dzzerror˜Dzz ˜D⊥ ˜Dzzerror˜D⊥ ˜Dzz 0,250,250,000861690,0000002570,4390440,00023350,00037830,000000231 0,50,250,0026550550,0000021861,686810,00035450,004478570,00000381 1√ 2 0,250,004060730,0000010393,75720,0015140,0152570,00000728 10,250,0055247850,0000155609,313450,0050360,051454810,000148√ 20,250,005951730,00000281622,9950,0061360,136860,0000743 20,250,0065679050,00000150152,26680,0062150,3432830,0000884 40,250,007203790,000002929229,5470,013111,653610,000679 0,250,50,003054240,0000006820,1294450,00003340,00039540,000000135 0,50,50,0088719050,000004440,5235310,00019420,00464470,00000289 1√ 2 0,50,01416130,00000644051,162790,00048980,0164670,0000102 10,50,018079450,00000856852,734270,00043120,04943410,000025√ 20,50,02137910,00000892956,455720,0018470,1380170,0000699 20,50,02382910,00002175514,2990,009310,34070,000382 40,50,026714350,00001451562,98990,059331,6827340,00183 0,251√ 2 0,00615640,00000160150,07586430,00002780,000467050,000000210 0,51√ 2 0,018021450,00000851650,3028110,00011820,005457090,00000334 1√ 2 1√ 2 0,02702320,000040960,6381740,00047890,01724550,0000292 11√ 2 0,03524440,0000194851,454970,00065850,0512800,000037 √ 21√ 2 0,04149260,00002783,359060,0010240,1393760,000103 21√ 2 0,04671840,000025127,419440,0051750,3466240,000305 41√ 2 0,05155870,00008925532,31680,073441,666210,00476 0,2510,010869750,0000053210,04217230,00001910,0004584020,000000306 0,510,031946850,0000146050,160730,00004010,00513480,00000267 1√ 2 10,04998080,000025280,3495770,00014540,01747210,0000114 110,06781840,0000454450,741760,00043260,0503050,0000447√ 210,081592250,000055151,777780,00004410,1450530,0000981 210,090380950,0000937353,849650,0071130,34793500,000737 410,10348850,0003478516,0040,054711,6560,00794 Table2:Diffusioncoefficients 46
  • 53. 13 APPENDICES ˜rghrms ˜D⊥error˜D⊥ ˜Dzzerror˜Dzz ˜D⊥ ˜Dzzerror˜D⊥ ˜Dzz 0,25 √ 20,01389850,0000079930,02581890,000007940,000358840,000000234 0,5 √ 20,04540240,0000274250,09823470,00002490,004460090,00000292 1√ 2 √ 20,07742360,0000580650,1942190,00012510,01503710,0000149 1 √ 20,11460750,0000487350,4053190,00024760,04645260,0000346√ 2 √ 20,14933550,000064910,9073590,00056660,13550090,000103 2 √ 20,17328450,000138951,912910,0016180,3314780,000386 4 √ 20,197920,00024018,401310,010621,66280,0029 0,2520,012926050,0000054670,01615880,00001850,000208870,000000255 0,520,0443450,000021470,06080240,00003660,0026960,00000208 1√ 2 20,080151250,000032640,1154420,00008710,00925280,00000793 120,1384740,0000868550,2183140,00048140,0302310,0000693√ 220,2104970,0000947850,4555910,00019640,0959010,0000598 220,28166550,000196351,002380,00030820,282340,000215 420,3710940,00026284,312920,0028021,600500,00154 0,2540,0075752850,00000792750,007522190,00001640,0000569830,000000138 0,540,02666980,000017620,02830020,00002140,000754760,000000757 1√ 2 40,048628650,000038010,05343290,00003650,0025983700,00000270 140,084125950,000054120,0926090,0000310,007790820,00000565√ 240,13945350,0000999150,1525130,00016250,02126850,0000273 240,2384080,000289150,2657260,00063930,0633510,000171 440,6614790,000947051,070910,0011670,708380,00127 Table3:Diffusioncoefficients 47
  • 54. 13 APPENDICES ˜rg hrms tdif 0,25 0,25 150 0,25 0,5 60 0,25 1√ 2 350 0,25 1 400 0,25 √ 2 400 0,25 2 1500 0,25 4 2000 0,5 0,25 400 0,5 0,5 100 0,5 1√ 2 100 0,5 1 200 0,5 √ 2 80 0,5 2 200 0,5 4 800 1√ 2 0,25 1350 1√ 2 0,5 400 1√ 2 1√ 2 50 1√ 2 1 60 1√ 2 √ 2 60 1√ 2 2 70 1√ 2 4 150 1 0,25 3850 1 0,5 750 1 1√ 2 400 1 1 100 1 √ 2 100 1 2 100 1 4 175 ˜rg hrms tdif√ 2 0,25 1350√ 2 0,5 400√ 2 1√ 2 50 √ 2 1 60√ 2 √ 2 60√ 2 2 70√ 2 4 150 2 0,25 9000 2 0,5 3000 2 1√ 2 1500 2 1 800 2 √ 2 400 2 2 350 2 4 300 4 0,25 26000 4 0,5 5500 4 1√ 2 3500 4 1 1200 4 √ 2 600 4 2 500 4 4 400 Table 4: Diffusion times 48