89 lines
1.6 KiB
C++
89 lines
1.6 KiB
C++
/** @file PenningTrap.cpp
|
|
*
|
|
* @author Cory Alexander Balaton (coryab)
|
|
* @author Janita Ovidie Sandtrøen Willumsen (janitaws)
|
|
*
|
|
* @version 0.1
|
|
*
|
|
* @brief The implementation of the PenningTrap class.
|
|
*
|
|
* @bug No known bugs
|
|
*
|
|
* @todo Implement add_particle
|
|
* @todo Implement external_E_field
|
|
* @todo Implement external_B_field
|
|
* @todo Implement force_on_particle
|
|
* @todo Implement total_force_external
|
|
* @todo Implement total_force_particles
|
|
* @todo Implement total_force
|
|
* @todo Implement evolve_RK4
|
|
* @todo Implement evolve_forward_euler
|
|
* */
|
|
|
|
#include "PenningTrap.hpp"
|
|
|
|
PenningTrap::PenningTrap(double B_0, double V_0, double d)
|
|
{
|
|
this->B_0 = B_0;
|
|
this->V_0 = V_0;
|
|
this->d = d;
|
|
}
|
|
|
|
void PenningTrap::add_particle(Particle particle)
|
|
{
|
|
this->particles.push_back(particle);
|
|
}
|
|
|
|
arma::vec PenningTrap::external_E_field(arma::vec r)
|
|
{
|
|
arma::vec::fixed<3> res;
|
|
double x = r(0), y = r(1), z = r(2);
|
|
double f = this->V_0/2*this->d*this->d;
|
|
res(0) = f*2*x;
|
|
res(1) = f*2*y;
|
|
res(2) = -f*4*z;
|
|
|
|
return res;
|
|
}
|
|
|
|
arma::vec PenningTrap::external_B_field(arma::vec r)
|
|
{
|
|
double x = r(0), y = r(1);
|
|
arma::vec::fixed<3> res;
|
|
res(0) = y*this->B_0;
|
|
res(1) = -x*this->B_0;
|
|
res(2) = 0.;
|
|
|
|
return res;
|
|
}
|
|
|
|
arma::vec PenningTrap::force_on_particle(int i, int j)
|
|
{
|
|
|
|
}
|
|
|
|
arma::vec PenningTrap::total_force_external(int i)
|
|
{
|
|
|
|
}
|
|
|
|
arma::vec PenningTrap::total_force_particles(int i)
|
|
{
|
|
|
|
}
|
|
|
|
arma::vec PenningTrap::total_force(int i)
|
|
{
|
|
|
|
}
|
|
|
|
void PenningTrap::evolve_RK4(double dt)
|
|
{
|
|
|
|
}
|
|
|
|
void PenningTrap::evolve_forward_euler(double dt)
|
|
{
|
|
|
|
}
|