Another week in the life

This week I have been doing a lot of what I love: coding. I have been charged with simulating a beam of particles moving through different magnetic fields, with the initial conditions set by beam parameters outlined in a separate file. In order to simulate a beam of particles I generated a bunch of particles, whose positions were generated according to a given distribution, and individually moved them through a magnetic field. I am doing this to better understand a section near the end of the particle beam accelerator that is undergoing construction at Fermilab. It is in this section that we will build in some diagnostic tools that use a magnet to sweep electrons to a detector. I spent a lot of time simulating electron trajectories, but I also modeled hydrogen ions, which are also present in the accelerator.

This process was rather slow because it takes about an hour for me to send 1000 particles through the field. When I tried doing 100,000 particles, the program crashed, so I will need to find a computer with more horse power when the time comes to do bigger simulations. The goal was to use one of the computers in our lab where I can offload the computational job onto a high-powered computer cluster), but I have yet to actually use them, since I keep encountering kinks in the program, like figuring out how to keep track of all the individual particles.

My favorite part about computational physics is finding different ways of writing a program that does what I want it to. For example, I spent so much time determining how I wanted to orient the system. I also experimented with different ways of saving the individual particle trajectories, as well as displaying the data I needed to. This is a big thing I have learned this summer: the importance being able to effectively communicate my results. Since I will be uploading my program on the lab drive, I need to make sure that everyone can understand what I did so that they can continue to work on what I have been doing. I never realize how sloppy my code can get until I try to see it from someone else’s perspective. know what all my variables mean of course, but that doesn’t mean that it’s clear to everyone.

When I finish cleaning up my code I will make it accessible to everyone in the lab, and hopefully some other undergraduates and I can start collaborating and making things go faster with increased shared computer power. I am looking forward to making this a more collaborative job in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *