Loading...
Searching...
No Matches
PenningTrap.hpp
Go to the documentation of this file.
#ifndef __PENNING_TRAP__
#define __PENNING_TRAP__
#include <armadillo>
#include <omp.h>
#include "Particle.hpp"
#include "constants.hpp"
#pragma omp declare reduction( + : arma::vec : omp_out += omp_in ) \
initializer( omp_priv = omp_orig )
class PenningTrap {
private:
double B_0;
double V_0;
double d;
std::vector<Particle> particles;
public:
PenningTrap(double B_0 = T, double V_0 = 25.*V/1000., double d = 500.);
void add_particle(Particle particle);
arma::vec external_E_field(arma::vec r);
arma::vec external_B_field(arma::vec r);
arma::vec force_on_particle(int i, int j);
arma::vec total_force_external(int i);
arma::vec total_force_particles(int i);
arma::vec total_force(int i);
void evolve_RK4(double dt);
void evolve_forward_euler(double dt);
arma::vec get_particle(int i);
double get_d();
};
#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:29
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:34
PenningTrap::total_force_external
arma::vec total_force_external(int i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:65
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:31
PenningTrap::total_force_particles
arma::vec total_force_particles(int i)
Calculate the total force on a particle from other particles.
Definition: PenningTrap.cpp:80
PenningTrap::external_B_field
arma::vec external_B_field(arma::vec r)
Calculate B at point r.
Definition: PenningTrap.cpp:43
PenningTrap::force_on_particle
arma::vec force_on_particle(int i, int j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:50
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:167
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:33
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:27
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:32
PenningTrap::total_force
arma::vec total_force(int i)
calculate the total force on a particle.
Definition: PenningTrap.cpp:99
PenningTrap::external_E_field
arma::vec external_E_field(arma::vec r)
Calculate E at point r.
Definition: PenningTrap.cpp:32
PenningTrap::evolve_RK4
void evolve_RK4(double dt)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:104
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