Penning Trap Simulation Simulate particle behavior inside a Penning Trap

Loading...
Searching...
No Matches
PenningTrap.hpp
Go to the documentation of this file.
1
12#ifndef __PENNING_TRAP__
13#define __PENNING_TRAP__
14
15#include <armadillo>
16
17#include "constants.hpp"
18#include "Particle.hpp"
19
25 class PenningTrap {
26 private:
27 double B_0;
28 double V_0;
29 double d;
30 std::vector<Particle> particles;
31
32 public:
35 PenningTrap(double B_0 = T, double V_0 = 25.*V/1000., double d = 500.);
36
39 void add_particle(Particle particle);
40
43 arma::vec external_E_field(arma::vec r);
44
47 arma::vec external_B_field(arma::vec r);
48
54 arma::vec force_on_particle(int i, int j);
55
61 arma::vec total_force_external(int i);
62
65 arma::vec total_force_particles(int i);
66
69 arma::vec total_force(int i);
70
73 void evolve_RK4(double dt);
74
77 void evolve_forward_euler(double dt);
78};
79
80#endif
Particle.hpp
A class that holds the properties of a particle.
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:19
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:25
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:30
PenningTrap::total_force_external
arma::vec total_force_external(int i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:51
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:27
PenningTrap::total_force_particles
arma::vec total_force_particles(int i)
Calculate the total force on a particle from other particles.
Definition: PenningTrap.cpp:56
PenningTrap::external_B_field
arma::vec external_B_field(arma::vec r)
Calculate B at point r.
Definition: PenningTrap.cpp:41
PenningTrap::force_on_particle
arma::vec force_on_particle(int i, int j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:46
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:71
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:29
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:31
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:28
PenningTrap::total_force
arma::vec total_force(int i)
calculate the total force on a particle.
Definition: PenningTrap.cpp:61
PenningTrap::external_E_field
arma::vec external_E_field(arma::vec r)
Calculate E at point r.
Definition: PenningTrap.cpp:36
PenningTrap::evolve_RK4
void evolve_RK4(double dt)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:66
constants.hpp
Library of constants.
T
#define T
1 Tesla. unit:
Definition: constants.hpp:17
V
#define V
1 Volt. unit:
Definition: constants.hpp:19