# Plotting the motion of a positive charge in a cylindrically symmetric magnetic field

I want to plot the motion of a positive charge in a cylindrically symmetric magnetic field.

I am assuming a cylinder around the z-axis, with the magnetic field going in clockwise direction. The B-field has magnitude of 6 T and the distance R from the z-axis is 3 m. The charged particle is launched in positive direction along the z-axis and has the energy 2 MeV.

I am uncertain of how to simulate this B-field correctly. I was thinking to create the B-field in cylindrical coordinates, cylinder from 0 to 2pi:

theta = numpy.linspace(0, 2*numpy.pi, 360)
x = R*numpy.cos(theta)
y = R*numpy.sin(theta)

Bx = B0*(numpy.cos(numpy.arctan2(y,x)
By = B0*(-numpy.sin(numpy.arctan2(y,x)))
Bz = 0

And then create a vector B=[Bx, By, Bz] from which I would calculate the acceleration using Lorentz force for a timespan t.

But I think I am going in circles with this. Is there another way to create a cylindrically symmetric magnetic field?

• There are two properties of magnetic field: 1) div(B)=0 always true, 2) rot(B)=0 true in your case (find out why). What those things mean is that the component of B in the azimuthal (toroidal) angle direction theta has 1/R dependence (find out why). Of course on top of it you could add some field in the Z direction which would not violate cylindrical symmetry, for example uniform Bz. On the other hand, adding a cylindrically symmetric radial component B_R would not be possible (find out why). But from the statement of the problem it sounds like only B_theta should be included. Aug 4, 2021 at 20:14
• You can write down the force for the particle and use a finite difference, such as Verlet integration, to integrate the equations of motion. Aug 4, 2021 at 21:25