Skip to content

Simulations and dynamics of charged particles in a Penning trap

Notifications You must be signed in to change notification settings

ericaloken/Project3-FYS3150

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulations and dynamics of charged particles in a Penning trap

This repository contains the work done by Erica Løken, Mads Mestl and Heine Husdal for Project 3 in the course FYS3150 – Computational Physics at the University of Oslo.

Project introduction

In this project we investigate the dynamics of charged calcium ions (Ca⁺) inside an ideal Penning trap. A Penning trap is a device that utilizes magnetic and electric fields to confine particles, allowing for precise studies of particles, which is used by CERN to confine antimatter.

The objective is to simulate the motion of particles using the Runge-Kutta 4th order method and the Forward Euler method. We compare the two methods to the analytical solutions for a single particle to evaluate the accuracy of the methods. Object-oriented simulations are implemented to study the dynamics of one or more particles. The effects of Coulomb interactions is studied in the case of two interacting particles. Further, we investigate the resonance phenomena by introducing a time-dependent electric potential.

Folder structure

  • src/ - C++ source files
  • include/ - Header files
  • python/ - Python scripts for plotting
  • figures/ - Plots and graphs
  • output/ - Simulation output data
  • report/ - Project pdf report

Compiling and running project code using Makefile

Compiling code

To compile the C++ code, navigate to the project root and run:

make

The above was tested on linux, but it might not work out of the box on other systems due to library paths. You might need to adjust the LIBS and CXXFLAGS variables in the Makefile according to your system setup. For example, on a Mac with Homebrew-installed Armadillo you might use:

# Mac OS with Homebrew-installed Armadillo example
make LIBS='-L/opt/homebrew/Cellar/armadillo/15.0.3/lib -larmadillo' CXXFLAGS='-O3 -std=c++17 -I include'

Running code

To run the compiled C++ code, navigate to the project root and run the corresponding make command.

  • Single-particle simulation: make run-single
  • Two-particle simulation: make run-two
  • Multi-particle simulation: make run-multi
  • Multi-particle simulation zoomed at around 1.39MHz: make run-multi-zoom

Plotting results

For plotting, you need a python environment. To install the required packages, run:

pip install -r requirements.txt

For plotting results after running all simulations, navigate to the python/ directory and run one of the following:

  • Plots from single-particle simulations: python plot_single.py
  • Plots from two-particle simulations: python plot_two.py
  • Plots from multi-particle simulations: python plot_multi.py

Compiler information

The C++ code has been compiled and linked with

  • g++ (Ubuntu 13.3.0-6ubuntu2~24.04)

  • Apple clang version 17.0.0 (clang-1700.0.13.5)

About

Simulations and dynamics of charged particles in a Penning trap

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published