Uploaded by Mutasim gh

fys1120

advertisement
fys1120
16/11/2023, 08:09
In real life, cyclotrons are used for treating
cancer. How much voltage would you need
to achieve the energy to destroy a cancer
cell?
Simulating a Cyclotron
Introduction
In cancer treatment, an ideal radiation source would target the cancer without
affecting surrounding areas, but this is extremely difficult to achieve. Proton therapy
which uses a focused beam of protons to destroy tumor cells, is one effective
method. Cyclotrons used in real-life cancer treatment. We will study how the
particles move in cyclotron accelerators to figure out the required the voltage needed
in particle accelerators to destroy cancer cells effectively while minimizing side
effects. This simulation calculates the particle's final speed, which then needs
conversion to determine the necessary energy for treatment.
Simulation of the Cyclotron
First, we import our standard libraries: Numpy and matplotlib.
In [1]: import numpy as np
import matplotlib.pyplot as plt
Now, we will enter some physical constants. We will give the particle the charge and
mass of a proton.
For the cyclotron itself, we will set the accelerating voltage between the two "D's"
(halves of the accelerator) to 50000V and their separation to 90 micrometers. Using
these two parameters, we define the electric field between the them. Within the "D's"
we will set the B-field to 1.5T. We will give them a radius (r_cyclotron) of 5cm.
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 1 of 7
fys1120
16/11/2023, 08:09
In [ ]: q = 1.6e-19 #Set the charge of the particle to the charge of a proton
m = 1.67e-27 #Set mass of the particle to the mass of a proton
V = 50000 #Set voltage between the plates to 50000V
d = 90e-6 #Set the separation between the plates to 90 micrometers
E_0 = V / d #define the electric field based on voltage between the D's and sep
B = np.array([0, 0, 1.5]) #Set magnetic field to 1.5T in the +Z direction
r_cyclotron = 0.05 #set the radius of the D's to 5cm
Next, we define the cyclotron frequency, which is the frequency that determines
when the electric field should switch to impart maximum speed to the particle.
Assuming the gap between the D's is small, we can find this by setting the magnetic
force equal to the expression for circular motion:
F = qvB =
r=
Mv2
r
mv
qB
And then substituting this expression into the expression for the time for one full
rotation,
T=
2πr
2πm
=
v
qB
v
Converting this into angular frequency (ω = r ), we end up with
ωcyclotron =
qB
m
We define this frequency as a variable as well:
In [3]: w = q * np.linalg.norm(B) / m #define the cyclotron frequency
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 2 of 7
fys1120
16/11/2023, 08:09
Now, we are ready to begin to simulate the motion of the proton, using a cyclotron
function.
We will create numpy arrays for the particle's position and velocity. These will only
ever hold three numbers (the x, y, and z positions/velocities of the particle). We
initialize these to 0, so that the particle starts at the origin with 0 velocity. We will
store the particle's positions in a list so that the last element of the list is the current
position.
We also initialize the time, and set the timestep to 5 picoseconds.
We use a while loop which runs while the magnitude of the proton's position is less
than the radius of the cyclotron. For each itereation we create a vector (numpy array)
that represents the force on the particle, then we use that to update the velocity, and
we use that to update the position.
In [4]: #loop while the magnitude of the proton's position remains within the cyclotron
def cyclotron(r_cyclotron, B, E_0, d, w, q, m):
"""Function to simulate a cyclotron, given its dimensions, fields, and a ch
pos = np.array([0, 0, 0])
vel = np.array([0, 0, 0])
xList = [pos[0]] #We keep track of the x- and y-position for plotting
yList = [pos[1]]
t = 0 #initialize time to 0
dt = 5e-12 #Set timestep to 5 picoseconds
while (np.linalg.norm(pos) < r_cyclotron):
if np.absolute(pos[0]) < d/2: #if the particle is between the two D's c
Fnetx = q * E_0 * np.cos(w*t)
Fnet = np.array([Fnetx, 0, 0])
else: #if the particle is not, calculate the magnetic force
Fnet = q * np.cross(vel, B)
vel = vel + Fnet / m * dt #Update the velocity of the particle
pos = pos + vel * dt #Use velocity to update the position of the partic
xList.append(pos[0]) #Keep track of the x-coordinates
yList.append(pos[1]) #Keep track of the y-coordinates
t = t + dt #update the total time
return t, xList, yList, vel, pos
In [5]: t, xList, yList, vel, pos = cyclotron(r_cyclotron, B, E_0, d, w, q, m)
print(f"The final speed of the particle is {np.linalg.norm(vel):.0f} m/s")
The final speed of the particle is 6409853 m/s
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 3 of 7
fys1120
16/11/2023, 08:09
Now, we will plot the resulting motion of the particle in 2D. We expect that it should
have a spiral shape (for example, see http://hyperphysics.phyastr.gsu.edu/hbase/magnetic/cyclot.html)
In [6]: plt.figure(figsize=(12,12)) #Create the figure
plt.plot(xList, yList) #Create the plot with the x and y components of the posi
plt.plot([d,d],[-r_cyclotron, r_cyclotron], linestyle="--") #Plot the line wher
c = plt.Circle([0,0], r_cyclotron, fill=False) #Plot the edge of the cyclotron
ax=plt.gca()
ax.add_patch(c)
plt.axis('scaled')
plt.title("The path of a particle in a cyclotron")
plt.show()
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 4 of 7
fys1120
16/11/2023, 08:09
Now we need adapt the simulation to calculate the voltage needed.
In the simulation, the final speed of the particle is calculated, but this speed needs to
be converted to energy.
The kinetic energy of a particle is given by the formula:
KE =
1
mv2
2
Where:
KE
represents kinetic energy,
m
is the mass of the particle,
v
is the speed of the particle.
We have defined the mass of the particle as the mass of a proton
m = 1.67e − 27
and we calculated the final speed in the simulation, now can we calculate the kinetic
energy attained by the particle.
In [ ]: # Final speed of the particle obtained from the simulation
final_speed = np.linalg.norm(particlev) # in m/s
# Mass of the proton
mass_proton = 1.67e-27
# in kg
# Calculate the kinetic energy of the particle
kinetic_energy = 0.5 * mass_proton * final_speed**2
# in joules
After obtaining the kinetic energy, we can then equate it to the energy required to
destroy a cancer cell (100−250100−250 MeV). We Use the fact that 11 electronvolt
(eV) is approximately 1.6×10−191.6×10−19 joules to convert the MeV energy to joules.
In [ ]: # Convert MeV to joules for the energy required to destroy a cancer cell
energy_required_mev = 250 # Choose 100 or 250 MeV as needed
energy_required_joules = energy_required_mev * 1e6 * 1.6e-19 # MeV to joules c
Finally, we equate the kinetic energy to the energy needed to solve for the voltage
required to achieve that kinetic energy.
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 5 of 7
fys1120
16/11/2023, 08:09
In [ ]: # Calculate the voltage required to achieve the energy needed for destroying a
required_voltage = energy_required_joules / kinetic_energy
print(f"The voltage required to achieve {energy_required_mev} MeV is approximat
The voltage required to achieve 250 MeV is approximately 1.17e+03 volts.
we can adjust the energy_required_mev variable as needed to check for both energy
levels.
In [22]: energy_required_mev = 100
# Choose 100
The voltage required to achieve 100 MeV is approximately 4.66e+02 volts.
When particles move really fast, like near the speed of light in accelerators, special
rules called "relativistic effects" become important. Regular physics rules, called
classical mechanics, aren't enough at these high speeds. Instead, we use a different
equation to calculate the energy of fast-moving particles.
This equation comes from Einstein's idea that mass and energy are connected. The
relativistic kinetic energy (( KE )) of a particle is determined by the formula:
KE = (γ − 1)mc2
Where:
KE
represents the relativistic kinetic energy.
γ (gamma)
is the Lorentz factor, given by
γ=
1
√1 − v2
2
c
.
c
represents the speed of light in a vacuum.
To incorporate relativistic effects into the calculation of the kinetic energy, we need
to calculate the Lorentz factor ( γ γ) based on the particle's velocity and then use it
to compute the relativistic kinetic energy.
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 6 of 7
fys1120
16/11/2023, 08:09
In [ ]: # Constants
c = 3.0e8 # Speed of light in m/s
# Calculate the Lorentz factor
gamma = 1 / np.sqrt(1 - (final_speed**2 / c**2))
# Calculate relativistic kinetic energy
relativistic_ke = (gamma - 1) * mass_proton * c**2 # in joules
# Calculate the voltage required to achieve the relativistic kinetic energy
required_voltage_rel = energy_required_joules / relativistic_ke
print(f"The voltage required to achieve {energy_required_mev} MeV (with relativ
Conclusion
Particles' speed in cyclotron accelerators was calculated and converted into energy,
matching the levels required (100 to 250 MeV) for destroying cancer cells. The
estimated voltages to reach these energies were around 1.17e+03 volts for 250 MeV
and approximately 4.66e+02 volts for 100 MeV. However, at near-light speeds,
standard physics isn't accurate, so Einstein's equations were used. The adjusted
estimate for 100 MeV aligned with around 4.66e+02 volts, emphasizing the need to
consider these effects at high speeds.
The inclusion of relativistic effects in the calculations for achieving 100 MeV adjusted
the voltage estimate to the same value of approximately 4.66e+02 volts, showcasing
the importance of considering such effects at high particle speeds.
In [ ]:
http://localhost:8888/nbconvert/html/Downloads/Fall%202021/fys1120.ipynb?download=false
Page 7 of 7
Download