About
Developed by E. Behringer
This set of exercises guides the students to compute and analyze the behavior of a charged particle in a spatial region with mutually perpendicular electric and magnetic fields. It requires the student to determine the Cartesian components of hte forces acting on the particle and to obtain the corresponding equations of motion. The solutions to these equations are obtained through numerical integation, and the capstone exercise is the simulation of the $\overrightarrow{E}\times \overrightarrow{B}$ (Wien) filter.
Subject Area  Electricity & Magnetism 

Levels  First Year and Beyond the First Year 
Available Implementation  Python 
Learning Objectives 
Students who complete this set of exercises will be able to:

Time to Complete  120 min 
EXERCISE 1: FORCES ACTING ON A CHARGED PARTICLE AND THE EQUATIONS OF MOTION
Imagine that we have a particle of mass $m$, charge $q$, and velocity $\overrightarrow{v}=({v}_{x},{v}_{y},{v}_{z})$ with ${v}_{z}>>{v}_{x},{v}_{y}$entering a region of uniform magnetic field $\overrightarrow{B}={B}_{x}\hat{x}$ and uniform electric field $\overrightarrow{E}={E}_{y}\hat{y}$. As shown below, ${B}_{x}>0$ and ${E}_{y}<0$. The length of the field region along the $z$axis is $L$.
Neglecting any other forces (e.g., gravitational forces), show that the Cartesian components of the combined electric and magnetic forces are
resulting in the equations of motion
where the dot accents indicate differentiation with respect to time. Note that the particle will not experience any transverse acceleration if ${v}_{z}={v}_{pass}={E}_{y}/{B}_{x}$.
(a) Assume that ${E}_{y}=105$ V/m and ${B}_{x}=2.00\times {10}^{3}$ T, and that all other field components are zero. Calculate, by hand, the Cartesian components of the acceleration at the instant when a Li${}^{+}$ ion of mass 7 amu and kinetic energy 100 eV enters the field region traveling along the direction $\hat{u}=(\hat{x}+\hat{y}+100\hat{z})/\sqrt{10002}$.
How will these acceleration components compare to those for a doubly ionized nitrogen ion (N${}^{+}$)?
(b) Write a code to perform the calculation in part (a). Note that, as soon as the particle enters the field region, the velocity components will change, and therefore so will the forces. To calculate an accurate trajectory, it is necessary to repeatedly calculate the forces, a task for which the computer is very well suited.
(c) What do you expect the trajectory of this ion to look like as it traverses the field region? Explain your answer.
#
# ExB_Filter_Exercise_1.py
#
# This file is used to calculate
# the Cartesian components of the acceleration of
# a charged particle through
# an E x B velocity filter.
#
# Here, it is assumed that the axis of the filter
# is aligned with the zaxis, that the magnetic field
# is along the +xdirection, and that the electric field
# is along the ydirection.
#
# By:
# Ernest R. Behringer
# Department of Physics and Astronomy
# Eastern Michigan University
# Ypsilanti, MI 48197
# (734) 4878799 (Office)
# This email address is being protected from spambots. You need JavaScript enabled to view it.
#
# Last updated:
#
# 20110309 = March 9, 2011 ERB Initial writing in Matlab.
# 20160616 ERB conversion from Matlab.
#
from numpy import sqrt
import time
#
# Initialize parameter values
#
q = 1.60e19 # particle charge [C]
m = 7.0*1.67e27 # particle mass [kg]
KE_eV = 100.0 # particle kinetic energy [eV]
Ex = 0.0 # Ex = electric field in the +x direction [N/C]
Ey = 105.0 # Ey = electric field in the +y direction [N/C]
Ez = 0.0 # Ez = electric field in the +z direction [N/C]
Bx = 0.002 # Bx = magnetic field in the +x direction [T]
By = 0.0 # By = magnetic field in the +x direction [T]
Bz = 0.0 # Bz = magnetic field in the +x direction [T]
D = 2.0 # D = diameter of the exit aperture [mm]
L = 0.25 # L = length of the crossed field region [mm]
u = [1.0,1.0,100.0]/sqrt(10002.0) # direction of the velocity vector
# Derived quantities
qoverm = q/m # charge to mass ratio [C/kg]
KE = KE_eV*1.602e19 # particle kinetic energy [J]
vmag = sqrt(2.0*KE/m) # particle velocity magnitude [m/s]
v1x = vmag*u[0] # v1x = xcomponent of the initial velocity [m/s]
v1y = vmag*u[1] # v1y = ycomponent of the initial velocity [m/s]
v1z = vmag*u[2] # v1z = zcomponent of the initial velocity [m/s]
#
# Calculate the Cartesian components of the acceleration
#
a_x = qoverm*(Ex + v1y*Bz  v1z*By)
a_y = qoverm*(Ey + v1z*Bx  v1x*Bz)
a_z = qoverm*(Ez + v1x*By  v1y*Bx)
print ("The magnitude of the initial velocity is %.3e"%vmag," m/s.") ##Frem:Added brackets
print ("The xcomponent of the acceleration is %.3e"%a_x," m/s\(^2\).") #Frem:Added brackets
print ("The ycomponent of the acceleration is %.3e"%a_y," m/s\(^2\).") #Frem:Added brackets
print ("The zcomponent of the acceleration is %.3e"%a_z," m/s\(^2\).") #Frem:Added brackets
time.sleep(10)##Frem:Added Time to prevent the program from closing too fast
Translations
Code  Language  Translator  Run  

Software Requirements
Android  iOS  Windows  MacOS  
with best with  Chrome  Chrome  Chrome  Chrome 
support fullscreen?  Yes. Chrome/Opera No. Firefox/ Samsung Internet  Not yet  Yes  Yes 
cannot work on  some mobile browser that don't understand JavaScript such as.....  cannot work on Internet Explorer 9 and below 
Credits
Fremont Teng; Loo Kang Wee; based on codes by E. Behringer
end faq
Sample Learning Goals
[text]
For Teachers
[text]
Research
[text]
Video
[text]
Version:
 https://www.compadre.org/PICUP/exercises/Exercise.cfm?A=ExB_Filter&S=6
 http://weelookang.blogspot.com/2018/06/wienexbfilterexercise123and4.html
Other Resources
[text]