PenningTrap(3)

NAME
PenningTrap - A class that simulates a Penning trap.

SYNOPSIS

#include <PenningTrap.hpp>

  Public Member Functions
PenningTrap (double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)
Constructor for the PenningTrap class.
PenningTrap (unsigned int i, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)
Constructor for the PenningTrap class.
PenningTrap (std::vector< Particle > particles, double B_0=T, std::function< double(double)> V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)
Constructor for the PenningTrap class.
void add_particle (Particle particle)
Add a particle to the system.
vec_3d external_E_field (vec_3d r)
Calculate E at point r.
vec_3d external_B_field (vec_3d r)
Calculate B at point r.
vec_3d force_on_particle (unsigned int i, unsigned int j)
Calculate the force between 2 particles.
vec_3d total_force_external (unsigned int i)
Calculate the total external force on a particle.
vec_3d total_force_particles (unsigned int i)
Calculate the total force on a particle p_i from other particles.
vec_3d total_force (unsigned int i)
calculate the total force on a particle p_i.
void evolve_RK4 (double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
void evolve_forward_euler (double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
sim_arr simulate (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
void write_simulation_to_dir (std::string path, double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
double fraction_of_particles_left (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)
Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation.

  Private Member Functions
vec_3d v_func (unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating $k_{v,i,j}$ values.
vec_3d r_func (unsigned int i, unsigned int j, double dt)
Helper for evolve_RK4 when calculating $k_{r,i,j}$ values.

  Private Attributes
double B_0
Magnetic field strength.
std::function< double(double)> V_0
Applied potential.
double d
Characteristic dimension.
double t
Current time.
std::vector< Particle > particles
The particles in the Penning trap.
sim_arr k_v
sim_arr k_r

Detailed Description

A class that simulates a Penning trap. This class simulates a Penning trap. It can take in a number of particles and simulate how they would behave inside a Penning trap.

Definition at line 30 of file PenningTrap.hpp.

Constructor & Destructor Documentation

  PenningTrap::PenningTrap (double B_0 = T, std::function< double(double)> V_0 = [](double t) { return 25. * V / 1000.; }, double d = 500., double t = 0.)

Constructor for the PenningTrap class.

Parameters
    B_0 The magnetic field strength
    V_0 The time dependent applied potential
    d The characteristic dimension
    t The starting time

Definition at line 18 of file PenningTrap.cpp.

  PenningTrap::PenningTrap (unsigned int i, double B_0 = T, std::function< double(double)> V_0 = [](double t) { return 25. * V / 1000.; }, double d = 500., double t = 0.)

Constructor for the PenningTrap class.

Parameters
    i The number of particles to generate
    B_0 The magnetic field strength
    V_0 The time dependent applied potential
    d The characteristic dimension
    t The starting time

Definition at line 27 of file PenningTrap.cpp.

  PenningTrap::PenningTrap (std::vector< Particle > particles, double B_0 = T, std::function< double(double)> V_0 = [](double t) { return 25. * V / 1000.; }, double d = 500., double t = 0.)

Constructor for the PenningTrap class.

Parameters
    particles The starting particles
    B_0 The magnetic field strength
    V_0 The time dependent applied potential
    d The characteristic dimension
    t The starting time

Definition at line 39 of file PenningTrap.cpp.

Member Function Documentation

  void PenningTrap::add_particle (Particle particle)

Add a particle to the system.

Parameters
    particle The particle to add to the Penning trap

Definition at line 82 of file PenningTrap.cpp.

  void PenningTrap::evolve_forward_euler (double dt, bool particle_interaction = true)

Go forward one timestep using the forward Euler method.

Parameters
    dt The step length
    particle_interaction Turn particle interactions on/off

Definition at line 186 of file PenningTrap.cpp.

  void PenningTrap::evolve_RK4 (double dt, bool particle_interaction = true)

Go forward one timestep using the RK4 method.

Parameters
    dt The step length
    particle_interaction Turn particle interactions on/off

Definition at line 151 of file PenningTrap.cpp.

  vec_3d PenningTrap::external_B_field (vec_3d r)

Calculate B at point r.

Parameters
    r The position where we want to calculate the B field

Returns
    vec_3d

Definition at line 95 of file PenningTrap.cpp.

  vec_3d PenningTrap::external_E_field (vec_3d r)

Calculate E at point r.

Parameters
    r The position where we want to calculate the E field

Returns
    vec_3d

Definition at line 87 of file PenningTrap.cpp.

  vec_3d PenningTrap::force_on_particle (unsigned int i, unsigned int j)

Calculate the force between 2 particles. Calculate the force exhibited on particle p_i from particle p_j.

Parameters
    i The index of particle p_i
    j The index of particle p_j

Returns
    vec_3d

Definition at line 100 of file PenningTrap.cpp.

  double PenningTrap::fraction_of_particles_left (double time, unsigned int steps, std::string method = 'rk4', bool particle_interaction = true)

Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation.

Parameters
    time The time to simulate in microseconds
    steps The amount of steps for the whole simulation
    method The method to use when moving forward a timestep
    particle_interaction Turn particle interactions on/off

Returns
    double

Definition at line 266 of file PenningTrap.cpp.

  vec_3d PenningTrap::r_func (unsigned int i, unsigned int j, double dt) [private]

Helper for evolve_RK4 when calculating $k_{r,i,j}$ values. Something

Parameters
    i Index i for $k_{r,i,j}$
    j Index j for $k_{r,i,j}$
    dt the step length (delta time)

Returns
    vec_3d

Definition at line 64 of file PenningTrap.cpp.

  sim_arr PenningTrap::simulate (double time, unsigned int steps, std::string method = 'rk4', bool particle_interaction = true)

Simulate the particle system inside the Penning trap over a certain amount of time.

Parameters
    time The time to simulate in microseconds
    steps The amount of steps for the whole simulation
    method The method to use when moving forward a timestep
    particle_interaction Turn particle interactions on/off

Definition at line 211 of file PenningTrap.cpp.

  vec_3d PenningTrap::total_force (unsigned int i)

calculate the total force on a particle p_i.

Parameters
    i The index of particle p_i

Returns
    vec_3d

Definition at line 146 of file PenningTrap.cpp.

  vec_3d PenningTrap::total_force_external (unsigned int i)

Calculate the total external force on a particle. Calculate the total amount of force that E and B exhibits on particle p_i.

Parameters
    i The index of particle p_i

Returns
    vec_3d

Definition at line 114 of file PenningTrap.cpp.

  vec_3d PenningTrap::total_force_particles (unsigned int i)

Calculate the total force on a particle p_i from other particles.

Parameters
    i The index of particle p_i

Returns
    vec_3d

Definition at line 129 of file PenningTrap.cpp.

  vec_3d PenningTrap::v_func (unsigned int i, unsigned int j, double dt) [private]

Helper for evolve_RK4 when calculating $k_{v,i,j}$ values. Something

Parameters
    i Index i for $k_{v,i,j}$
    j Index j for $k_{v,i,j}$
    dt the step length (delta time)

Returns
    vec_3d

Definition at line 46 of file PenningTrap.cpp.

  void PenningTrap::write_simulation_to_dir (std::string path, double time, unsigned int steps, std::string method = 'rk4', bool particle_interaction = true)

Simulate and write the displacement of all particles to files.

Parameters
    path The directory to save the data
    time The time to simulate in microseconds
    steps The amount of steps for the whole simulation
    method The method to use when moving forward a timestep
    particle_interaction Turn particle interactions on/off

Definition at line 240 of file PenningTrap.cpp.

Member Data Documentation

  double PenningTrap::B_0 [private]

Magnetic field strength.

Definition at line 32 of file PenningTrap.hpp.

  double PenningTrap::d [private]

Characteristic dimension.

Definition at line 34 of file PenningTrap.hpp.

  sim_arr PenningTrap::k_r [private]
A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle

Definition at line 39 of file PenningTrap.hpp.

  sim_arr PenningTrap::k_v [private]
A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle

Definition at line 37 of file PenningTrap.hpp.

  std::vector<Particle> PenningTrap::particles [private]

The particles in the Penning trap.

Definition at line 36 of file PenningTrap.hpp.

  double PenningTrap::t [private]

Current time.

Definition at line 35 of file PenningTrap.hpp.

  std::function<double(double)> PenningTrap::V_0 [private]

Applied potential.

Definition at line 33 of file PenningTrap.hpp.

Author

Generated automatically by Doxygen for Penning Trap Simulation from the source code.