495 lines
13 KiB
Groff
495 lines
13 KiB
Groff
.TH "PenningTrap" 3 "Sat Oct 14 2023" "Penning Trap Simulation" \" -*- nroff -*-
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
PenningTrap \- A class that simulates a Penning trap\&.
|
|
|
|
.SH SYNOPSIS
|
|
.br
|
|
.PP
|
|
.PP
|
|
\fC#include <PenningTrap\&.hpp>\fP
|
|
.SS "Public Member Functions"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "\fBPenningTrap\fP (double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)"
|
|
.br
|
|
.RI "Constructor for the \fBPenningTrap\fP class\&. "
|
|
.ti -1c
|
|
.RI "\fBPenningTrap\fP (unsigned int i, double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)"
|
|
.br
|
|
.RI "Constructor for the \fBPenningTrap\fP class\&. "
|
|
.ti -1c
|
|
.RI "\fBPenningTrap\fP (std::vector< \fBParticle\fP > \fBparticles\fP, double \fBB_0\fP=\fBT\fP, std::function< double(double)> \fBV_0\fP=[](double \fBt\fP) { return 25\&. *\fBV\fP/1000\&.;}, double \fBd\fP=500\&., double \fBt\fP=0\&.)"
|
|
.br
|
|
.RI "Constructor for the \fBPenningTrap\fP class\&. "
|
|
.ti -1c
|
|
.RI "void \fBadd_particle\fP (\fBParticle\fP particle)"
|
|
.br
|
|
.RI "Add a particle to the system\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBexternal_E_field\fP (\fBvec_3d\fP r)"
|
|
.br
|
|
.RI "Calculate E at point r\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBexternal_B_field\fP (\fBvec_3d\fP r)"
|
|
.br
|
|
.RI "Calculate B at point r\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBforce_on_particle\fP (unsigned int i, unsigned int j)"
|
|
.br
|
|
.RI "Calculate the force between 2 particles\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBtotal_force_external\fP (unsigned int i)"
|
|
.br
|
|
.RI "Calculate the total external force on a particle\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBtotal_force_particles\fP (unsigned int i)"
|
|
.br
|
|
.RI "Calculate the total force on a particle p_i from other particles\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBtotal_force\fP (unsigned int i)"
|
|
.br
|
|
.RI "calculate the total force on a particle p_i\&. "
|
|
.ti -1c
|
|
.RI "void \fBevolve_RK4\fP (double dt, bool particle_interaction=true)"
|
|
.br
|
|
.RI "Go forward one timestep using the RK4 method\&. "
|
|
.ti -1c
|
|
.RI "void \fBevolve_forward_euler\fP (double dt, bool particle_interaction=true)"
|
|
.br
|
|
.RI "Go forward one timestep using the forward Euler method\&. "
|
|
.ti -1c
|
|
.RI "\fBsim_arr\fP \fBsimulate\fP (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)"
|
|
.br
|
|
.RI "Simulate the particle system inside the Penning trap over a certain amount of time\&. "
|
|
.ti -1c
|
|
.RI "void \fBwrite_simulation_to_dir\fP (std::string path, double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)"
|
|
.br
|
|
.RI "Simulate and write the displacement of all particles to files\&. "
|
|
.ti -1c
|
|
.RI "double \fBfraction_of_particles_left\fP (double time, unsigned int steps, std::string method='rk4', bool particle_interaction=true)"
|
|
.br
|
|
.RI "Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation\&. "
|
|
.in -1c
|
|
.SS "Private Member Functions"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBv_func\fP (unsigned int i, unsigned int j, double dt)"
|
|
.br
|
|
.RI "Helper for evolve_RK4 when calculating $k_{v,i,j}$ values\&. "
|
|
.ti -1c
|
|
.RI "\fBvec_3d\fP \fBr_func\fP (unsigned int i, unsigned int j, double dt)"
|
|
.br
|
|
.RI "Helper for evolve_RK4 when calculating $k_{r,i,j}$ values\&. "
|
|
.in -1c
|
|
.SS "Private Attributes"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "double \fBB_0\fP"
|
|
.br
|
|
.RI "Magnetic field strength\&. "
|
|
.ti -1c
|
|
.RI "std::function< double(double)> \fBV_0\fP"
|
|
.br
|
|
.RI "Applied potential\&. "
|
|
.ti -1c
|
|
.RI "double \fBd\fP"
|
|
.br
|
|
.RI "Characteristic dimension\&. "
|
|
.ti -1c
|
|
.RI "double \fBt\fP"
|
|
.br
|
|
.RI "Current time\&. "
|
|
.ti -1c
|
|
.RI "std::vector< \fBParticle\fP > \fBparticles\fP"
|
|
.br
|
|
.RI "The particles in the Penning trap\&. "
|
|
.ti -1c
|
|
.RI "\fBsim_arr\fP \fBk_v\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "\fBsim_arr\fP \fBk_r\fP"
|
|
.br
|
|
.in -1c
|
|
.SH "Detailed Description"
|
|
.PP
|
|
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\&.
|
|
.PP
|
|
Definition at line \fB30\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SH "Constructor & Destructor Documentation"
|
|
.PP
|
|
.SS "PenningTrap::PenningTrap (double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)"
|
|
|
|
.PP
|
|
Constructor for the \fBPenningTrap\fP class\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIB_0\fP The magnetic field strength
|
|
.br
|
|
\fIV_0\fP The time dependent applied potential
|
|
.br
|
|
\fId\fP The characteristic dimension
|
|
.br
|
|
\fIt\fP The starting time
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB18\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "PenningTrap::PenningTrap (unsigned int i, double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)"
|
|
|
|
.PP
|
|
Constructor for the \fBPenningTrap\fP class\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP The number of particles to generate
|
|
.br
|
|
\fIB_0\fP The magnetic field strength
|
|
.br
|
|
\fIV_0\fP The time dependent applied potential
|
|
.br
|
|
\fId\fP The characteristic dimension
|
|
.br
|
|
\fIt\fP The starting time
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB27\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "PenningTrap::PenningTrap (std::vector< \fBParticle\fP > particles, double B_0 = \fC\fBT\fP\fP, std::function< double(double)> V_0 = \fC[](double \fBt\fP) { return 25\&. * \fBV\fP / 1000\&.; }\fP, double d = \fC500\&.\fP, double t = \fC0\&.\fP)"
|
|
|
|
.PP
|
|
Constructor for the \fBPenningTrap\fP class\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIparticles\fP The starting particles
|
|
.br
|
|
\fIB_0\fP The magnetic field strength
|
|
.br
|
|
\fIV_0\fP The time dependent applied potential
|
|
.br
|
|
\fId\fP The characteristic dimension
|
|
.br
|
|
\fIt\fP The starting time
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB39\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SH "Member Function Documentation"
|
|
.PP
|
|
.SS "void PenningTrap::add_particle (\fBParticle\fP particle)"
|
|
|
|
.PP
|
|
Add a particle to the system\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIparticle\fP The particle to add to the Penning trap
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB82\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "void PenningTrap::evolve_forward_euler (double dt, bool particle_interaction = \fCtrue\fP)"
|
|
|
|
.PP
|
|
Go forward one timestep using the forward Euler method\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIdt\fP The step length
|
|
.br
|
|
\fIparticle_interaction\fP Turn particle interactions on/off
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB186\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "void PenningTrap::evolve_RK4 (double dt, bool particle_interaction = \fCtrue\fP)"
|
|
|
|
.PP
|
|
Go forward one timestep using the RK4 method\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIdt\fP The step length
|
|
.br
|
|
\fIparticle_interaction\fP Turn particle interactions on/off
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB151\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::external_B_field (\fBvec_3d\fP r)"
|
|
|
|
.PP
|
|
Calculate B at point r\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIr\fP The position where we want to calculate the B field
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB95\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::external_E_field (\fBvec_3d\fP r)"
|
|
|
|
.PP
|
|
Calculate E at point r\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIr\fP The position where we want to calculate the E field
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB87\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::force_on_particle (unsigned int i, unsigned int j)"
|
|
|
|
.PP
|
|
Calculate the force between 2 particles\&. Calculate the force exhibited on particle p_i from particle p_j\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP The index of particle p_i
|
|
.br
|
|
\fIj\fP The index of particle p_j
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB100\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "double PenningTrap::fraction_of_particles_left (double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)"
|
|
|
|
.PP
|
|
Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fItime\fP The time to simulate in microseconds
|
|
.br
|
|
\fIsteps\fP The amount of steps for the whole simulation
|
|
.br
|
|
\fImethod\fP The method to use when moving forward a timestep
|
|
.br
|
|
\fIparticle_interaction\fP Turn particle interactions on/off
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
double
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB266\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::r_func (unsigned int i, unsigned int j, double dt)\fC [private]\fP"
|
|
|
|
.PP
|
|
Helper for evolve_RK4 when calculating $k_{r,i,j}$ values\&. Something
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP Index i for $k_{r,i,j}$
|
|
.br
|
|
\fIj\fP Index j for $k_{r,i,j}$
|
|
.br
|
|
\fIdt\fP the step length (delta time)
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB64\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBsim_arr\fP PenningTrap::simulate (double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)"
|
|
|
|
.PP
|
|
Simulate the particle system inside the Penning trap over a certain amount of time\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fItime\fP The time to simulate in microseconds
|
|
.br
|
|
\fIsteps\fP The amount of steps for the whole simulation
|
|
.br
|
|
\fImethod\fP The method to use when moving forward a timestep
|
|
.br
|
|
\fIparticle_interaction\fP Turn particle interactions on/off
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB211\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::total_force (unsigned int i)"
|
|
|
|
.PP
|
|
calculate the total force on a particle p_i\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP The index of particle p_i
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB146\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::total_force_external (unsigned int i)"
|
|
|
|
.PP
|
|
Calculate the total external force on a particle\&. Calculate the total amount of force that E and B exhibits on particle p_i\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP The index of particle p_i
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB114\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::total_force_particles (unsigned int i)"
|
|
|
|
.PP
|
|
Calculate the total force on a particle p_i from other particles\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP The index of particle p_i
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB129\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "\fBvec_3d\fP PenningTrap::v_func (unsigned int i, unsigned int j, double dt)\fC [private]\fP"
|
|
|
|
.PP
|
|
Helper for evolve_RK4 when calculating $k_{v,i,j}$ values\&. Something
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIi\fP Index i for $k_{v,i,j}$
|
|
.br
|
|
\fIj\fP Index j for $k_{v,i,j}$
|
|
.br
|
|
\fIdt\fP the step length (delta time)
|
|
.RE
|
|
.PP
|
|
\fBReturns\fP
|
|
.RS 4
|
|
vec_3d
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB46\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SS "void PenningTrap::write_simulation_to_dir (std::string path, double time, unsigned int steps, std::string method = \fC'rk4'\fP, bool particle_interaction = \fCtrue\fP)"
|
|
|
|
.PP
|
|
Simulate and write the displacement of all particles to files\&.
|
|
.PP
|
|
\fBParameters\fP
|
|
.RS 4
|
|
\fIpath\fP The directory to save the data
|
|
.br
|
|
\fItime\fP The time to simulate in microseconds
|
|
.br
|
|
\fIsteps\fP The amount of steps for the whole simulation
|
|
.br
|
|
\fImethod\fP The method to use when moving forward a timestep
|
|
.br
|
|
\fIparticle_interaction\fP Turn particle interactions on/off
|
|
.RE
|
|
.PP
|
|
|
|
.PP
|
|
Definition at line \fB240\fP of file \fBPenningTrap\&.cpp\fP\&.
|
|
.SH "Member Data Documentation"
|
|
.PP
|
|
.SS "double PenningTrap::B_0\fC [private]\fP"
|
|
|
|
.PP
|
|
Magnetic field strength\&.
|
|
.PP
|
|
Definition at line \fB32\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "double PenningTrap::d\fC [private]\fP"
|
|
|
|
.PP
|
|
Characteristic dimension\&.
|
|
.PP
|
|
Definition at line \fB34\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "\fBsim_arr\fP PenningTrap::k_r\fC [private]\fP"
|
|
A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle
|
|
.PP
|
|
Definition at line \fB39\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "\fBsim_arr\fP PenningTrap::k_v\fC [private]\fP"
|
|
A 2D vector containing all $k_{i,j}$ where $j$ is the index of a particle
|
|
.PP
|
|
Definition at line \fB37\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "std::vector<\fBParticle\fP> PenningTrap::particles\fC [private]\fP"
|
|
|
|
.PP
|
|
The particles in the Penning trap\&.
|
|
.PP
|
|
Definition at line \fB36\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "double PenningTrap::t\fC [private]\fP"
|
|
|
|
.PP
|
|
Current time\&.
|
|
.PP
|
|
Definition at line \fB35\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
.SS "std::function<double(double)> PenningTrap::V_0\fC [private]\fP"
|
|
|
|
.PP
|
|
Applied potential\&.
|
|
.PP
|
|
Definition at line \fB33\fP of file \fBPenningTrap\&.hpp\fP\&.
|
|
|
|
.SH "Author"
|
|
.PP
|
|
Generated automatically by Doxygen for Penning Trap Simulation from the source code\&.
|