Finite Difference Method
Finite Difference Method
ELECTROMAGNETISM
MOVING CHARGES IN ELECTRIC
AND MAGNETIC FIELDS
Ian Cooper
School of Physics, University of Sydney
[email protected]
em_vBE_01.m
mscript used to calculate the trajectory of charged particles moving in a
constant magnetic field or a constant electric field or constant crossed
magnetic and electric fields. The input parameters are changed within
the mscript.
Introduction
+q
v
+I
F B
out of page
F motion of a
palm face positive charge in a
B fingers magnetic field
v
thumb v q
v (+q) v q thumb
B fingers
v q motion of a
negative charge in
a magnetic field
F palm face
m v2
qvB
R
mv
(2) R
qB
2 R 2 m 1 qB
(3a) T f 2 f
v qB T 2 m
q
(3b) B cyclotron frequency
m
E
(4) v velocity v independent of the mass m
B
In the region of the crossed E and B fields, the trajectory will be a cycloid
if the speed is not too great. The charged particle starts from rest, then,
it tends to migrate in the direction of the vector E B .
(5) a
q
m
E v B
Acceleration a ax , a y , az
Velocity v vx , v y , vz
Displacement s x, y , z
t[n] (n 1) t (n 1) h n 1,2,3, ,N
x[ n 1] 2 x[ n ] x[ n 1]
a x [ n]
h2
y[ n 1] 2 y[ n ] y[( n 1]
(6) a y [n]
h2
z[( n 1] 2 z[ n ] z[ n 1]
az [n]
h2
x[ n 1] x[ n 1]
vx [n]
2h
y[ n 1] y[ n 1]
(7) v y [n]
2h
z[ n 1] z[ n 1]
vz [n]
2h
i j k
v B vx vy vz
0 0 B
v B x
vy B v B y
v x B v B z
0
q q
(8) ax v y B a y E vx B az 0
m m
x[ n 1] 2 x[ n] x[ n 1] q B y[ n 1] y[ n 1]
h2 m 2h
qBh
x[ n 1] 2 x[ n] x[ n 1] y[ n 1] y[ n 1]
2m
y[ n 1] 2 y[ n] y[ n 1] q E q B h x[n 1] x[n 1]
h2 m m 2h
q E h2 q B h
y[ n 1] 2 y[ n] y[ n 1] x[ n 1] x[ n 1]
m 2 m
z[ n 1] z[ n 1]
a z [n] 0 vz [ n]
2h
z[ n 1] z[ n 1] 2 h v z [ n]
Let
qBh q E h2
(9) k1 k2
2m m
then
x[ n 1] 2 x[ n] x[ n 1] k1 y[ n 1]
2k1 y[ n] k1 y[ n 1] k12 x[ n 1] k12 x[ n 1] k1 k 2
1
k3
1 k12
x[ n 1] k3 2 x[ n] k12 1 x[ n 1] 2k1 y[ n] 2k1 y[ n 1] k1 k 2
The initial conditions for the trajectory are
n 1 t[1] 0
x[1] x0 y[1] y0 z[1] z0
(10) vx [1] u x v y [1] u y v z [1] u z
qB q
a x [1] uy a y [1] E u x B a z [1] 0
m m
n 2 t[2] t h
x[2] x0 v x [1] h y[2] y0 v y [1] h z[2] u z t[2]
(11) v x [2] v x [1] a[1] t v y [2] v y [1] ay[1] h v z [2] u z
qB q
a x [2] v y [2] a y [2] E v x [2] B a z [2] 0
m m
x[ n 1] k3 2 x[ n ] k12 1 x[ n 1] 2k1 y[ n ] 2k1 y[ n 1] k1 k 2
(12) y[ n 1] 2 y[ n] y[ n 1] k1 x[ n 1] k1 x[ n 1] k 2
z[ n 1] u z t[ n 1]
Then the following input parameters are specified: the values of the E
and B fields; the initial position and velocity; the charge and mass of the
particle; the time step h; and the number of time steps N. A rough guide
for stability is to set h such that
qBh m
1 h
m qB
It is always good practice to run the program with smaller and smaller
time steps and check that you get convergence in the results.
We can then use equations (7) to (12) to calculate the trajectory of the
charged particle.
The Matlab variables to specify the volume element and field region are
From figure (2) the radius in the X and Y directions and the period
were measured using the Matlab Data Cursor tool.
The numerical model value for the radius and period are in excellent
agreement with the theoretical predictions.
close all
are set as comments when the mscript is executed for the different
values of the B field. When you have finished, then the statements
should be uncommented.
Figures 12 and 13 show the velocity and acceleration graphs. In the zero
field zero the acceleration of the particle is zero and the particle moves
with a constant velocity.
Fig. 12. Velocity vs time graph for the motion of the proton.
Fig. 16. Displacement vs time graph for the motion of the proton.
Fig. 18. Acceleration vs time graph for the motion of the charged.
When the magnetic force balances the electric force, the charged
particle moves with constant velocity
q ux B q E
E ux B
E 8.0 106 (0.1) 8.0 10 5 V.m -1
The theoretical prediction agrees with the result of the numerical
simulation.
Fig. 22. Displacement vs time graph for the motion of the proton.
Fig. 24. Acceleration vs time graph for the motion of the charged.
2 m
T
qB
Figure 25 is a Matlab Figure Window giving the parameters used for the
simulation for the cycloid motion of a proton. Using the parameters
given in figure 25, the theoretical value for the period is
T = 8.19x10-8 s
Fig. 30. The acceleration vs time plots for the motion of the proton.
The period of the cycloid motion can be measured using the Matlab Data
Cursor tool using either the velocity or acceleration time graphs. The
graphical measurement for the period is T = 8.19x10-8 s which is the
same as the theoretical prediction.