# Rail Gun Model

The EJS Rail Gun Model shows a rail gun created by running current through long rods with a cross-rod accelerated due to the external field from the current in the rails. It also shows the magnetic field that the cross-rod experiences. Students can adjust the current in the rails and rod as well as the spacing between the rails. Students can change the model if they have EJS Installed. Information about EJS is available at: <http://www.um.es/fem/Ejs/> and in the OSP ComPADRE collection <http://www.compadre.org/OSP/>.

## Exercises:

1. Run the simulation. The cross-rod initially begins at rest and is accelerated due to the magnetic field. You can zoom in (Shift-Click-Drag), rotate (Click-Drag) or pan (Ctrl-Click-Drag) the 3D views. Pause the simulation before the cross-rod drops leaves the rails and note the magnetic field. For each rail, the simulation uses the value of the magnetic field at the end of a long rail which is equal to half that from a very long wire: B = μ0I/4πR. Explain the direction of the field vectors in the simulation.
2. To calculate the external field experienced by the cross-rod, the simulation uses the value of the magnetic field due to the two rails in the mid-point between the rails. Show that in the mid-point between the rails B = (μ0 I/πL) where L is the separation between the two rails.
3. Click on the Show B(x) check-box. This shows the magnetic field as a funciton of position between the rails. Given that the simulation uses the value of the magnetic field in the middle of the rails, how would you expect the simulation to change if the variation in the magnetic field were taken into account? Specifically, what would happen to the trajectory of the cross-rod?
4. Show that the equation of the field as a function of position between the rails is given by B(x)= (μ0I/4π)(L/(L2-x2)) where x = 0 is in the center between the rails.
5. Make sure you have EJS installed so you can change the model to account for the varying field between the rails:

- Right-click on the simulation and choose Open EJS Model.
- In the Model, click on Initialization. Right now, the InitPage calculates the force using a constant value of B. Right-click on the tab that says InitPage and choose Enable/Disable this page. Then, do the same for InitPage2. You should see that the original InitPage is disabled (D) and InitPage2 is now enabled.
- Run the simulation and Show B(x). What are the dots that now appear on the plot (the line _view.plot.addPoint(x,B*10000) adds points to the plot)?
- Follow the instructions in InitPage2 and enter the appropriate equation for the magnetic field. What was the change in the simulation?
- How would you change the simulation to estimate the force using ten points along the magnetic field instead of just six? Make the necessary change and comment on the change in the simulation.

6. Optional: Add friction between the cross-rod and the rails. Provide a discussion of what parameters you chose and why.

### References:

- Giancoli, Physics for Scientists and Engineers, 4th edition, Chapter 28 (2008).

### Credits:

The Rail Gun Model and Exercises were created by Anne J Cox using the Easy Java Simulations (EJS) authoring and modeling tool.

You can examine and modify a compiled EJS model if you run the program by double clicking on the model's jar file. Right-click within the running program and select "Open EJS Model" from the pop-up menu to copy the model's XML description into EJS. You must, of course, have EJS installed on your computer.

Information about EJS is available at: <http://www.um.es/fem/Ejs/> and in the OSP ComPADRE collection <http://www.compadre.org/OSP/>.