diff --git a/docs/PenningTrap_8cpp_source.html b/docs/PenningTrap_8cpp_source.html index e974bfc..7a2c773 100644 --- a/docs/PenningTrap_8cpp_source.html +++ b/docs/PenningTrap_8cpp_source.html @@ -109,147 +109,147 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
17#include <sys/types.h>
18#include <vector>
19
-
20PenningTrap::PenningTrap(double B_0, double V_0, double d, double t)
+
20vec3 PenningTrap::v_func(uint i, uint j, double dt)
21{
-
22 this->B_0 = B_0;
-
23 this->V_0 = V_0;
-
24 this->d = d;
-
25 this->t = t;
-
26 this->perturbation = [](double t) { return 1.; };
-
27}
-
28
-
29PenningTrap::PenningTrap(uint i, double B_0, double V_0, double d, double t)
-
30 : PenningTrap::PenningTrap(B_0, V_0, d)
-
31{
-
32 for (size_t j = 0; j < i; j++) {
-
33 this->particles.push_back(
-
34 Particle(vec3(vec3().randn() * .1 * this->d),
-
35 vec3(vec3().randn() * .1 * this->d)));
+
22 switch (i) {
+
23 case 0:
+
24 return .5 * dt * this->k_v[0][j];
+
25 case 1:
+
26 return .5 * dt * this->k_v[1][j];
+
27 case 2:
+
28 return dt * this->k_v[2][j];
+
29 case 3:
+
30 return vec3((dt / 6.)
+
31 * (this->k_v[0][j] + 2. * this->k_v[1][j]
+
32 + 2. * this->k_v[2][j] + this->k_v[3][j]));
+
33 default:
+
34 std::cout << "Not valid!" << std::endl;
+
35 abort();
36 }
37}
38
-
39PenningTrap::PenningTrap(std::vector<Particle> particles, double B_0,
-
40 double V_0, double d, double t)
-
41 : PenningTrap::PenningTrap(B_0, V_0, d)
-
42{
-
43 this->particles = particles;
-
44}
-
45
-
46void PenningTrap::set_pertubation(double f, double omega_V)
-
47{
-
48 this->perturbation = [f, omega_V](double t) {
-
49 return 1 + f * std::cos(omega_V * t);
-
50 };
-
51}
-
52
-
53void PenningTrap::reinitialize(double f, double omega_V, double t)
-
54{
-
55 this->t = t;
-
56 this->set_pertubation(f, omega_V);
+
39vec3 PenningTrap::r_func(uint i, uint j, double dt)
+
40{
+
41 switch (i) {
+
42 case 0:
+
43 return .5 * dt * this->k_r[0][j];
+
44 case 1:
+
45 return .5 * dt * this->k_r[1][j];
+
46 case 2:
+
47 return dt * this->k_r[2][j];
+
48 case 3:
+
49 return vec3((dt / 6.)
+
50 * (this->k_r[0][j] + 2. * this->k_r[1][j]
+
51 + 2. * this->k_r[2][j] + this->k_r[3][j]));
+
52 default:
+
53 std::cout << "Not valid!" << std::endl;
+
54 abort();
+
55 }
+
56}
57
-
58 for (size_t i = 0; i < this->particles.size(); i++) {
-
59 this->particles[i].r_vec = vec3().randn() * .1 * this->d;
-
60 }
-
61}
-
62
-
63vec3 PenningTrap::v_func(uint i, uint j, double dt)
-
64{
-
65 switch (i) {
-
66 case 0:
-
67 return .5 * dt * this->k_v[0][j];
-
68 case 1:
-
69 return .5 * dt * this->k_v[1][j];
-
70 case 2:
-
71 return dt * this->k_v[2][j];
-
72 case 3:
-
73 return vec3((dt / 6.)
-
74 * (this->k_v[0][j] + 2. * this->k_v[1][j]
-
75 + 2. * this->k_v[2][j] + this->k_v[3][j]));
-
76 default:
-
77 std::cout << "Not valid!" << std::endl;
-
78 abort();
-
79 }
+
58vec3 PenningTrap::external_E_field(vec3 r)
+
59{
+
60 r(2) *= -2.;
+
61
+
62 return vec3((this->V_0 * this->perturbation(this->t) / (this->d * this->d))
+
63 * r);
+
64}
+
65
+
66vec3 PenningTrap::external_B_field(vec3 r)
+
67{
+
68 return vec3{0., 0., this->B_0};
+
69}
+
70
+
71vec3 PenningTrap::force_on_particle(uint i, uint j)
+
72{
+
73 // Calculate the difference between the particles' position
+
74 vec3 res = this->particles[i].r_vec - this->particles[j].r_vec;
+
75
+
76 // Get the distance between the particles
+
77 double norm = arma::norm(res, 2);
+
78
+
79 return vec3((this->particles[j].q / (norm * norm * norm)) * res);
80}
81
-
82vec3 PenningTrap::r_func(uint i, uint j, double dt)
+
82vec3 PenningTrap::total_force_external(uint i)
83{
-
84 switch (i) {
-
85 case 0:
-
86 return .5 * dt * this->k_r[0][j];
-
87 case 1:
-
88 return .5 * dt * this->k_r[1][j];
-
89 case 2:
-
90 return dt * this->k_r[2][j];
-
91 case 3:
-
92 return vec3((dt / 6.)
-
93 * (this->k_r[0][j] + 2. * this->k_r[1][j]
-
94 + 2. * this->k_r[2][j] + this->k_r[3][j]));
-
95 default:
-
96 std::cout << "Not valid!" << std::endl;
-
97 abort();
-
98 }
-
99}
-
100
-
101void PenningTrap::add_particle(Particle particle)
-
102{
-
103 this->particles.push_back(particle);
-
104}
-
105
-
106vec3 PenningTrap::external_E_field(vec3 r)
-
107{
-
108 r(2) *= -2.;
-
109
-
110 return vec3((this->V_0 * this->perturbation(this->t) / (this->d * this->d))
-
111 * r);
-
112}
-
113
-
114vec3 PenningTrap::external_B_field(vec3 r)
-
115{
-
116 return vec3{0., 0., this->B_0};
-
117}
-
118
-
119vec3 PenningTrap::force_on_particle(uint i, uint j)
-
120{
-
121 // Calculate the difference between the particles' position
-
122 vec3 res = this->particles[i].r_vec - this->particles[j].r_vec;
+
84 Particle *p = &this->particles[i];
+
85
+
86 if (arma::norm(p->r_vec) > this->d) {
+
87 return vec3{0., 0., 0.};
+
88 }
+
89
+
90 return vec3(p->q
+
91 * (this->external_E_field(p->r_vec)
+
92 + arma::cross(p->v_vec, this->external_B_field(p->r_vec))));
+
93}
+
94
+
95vec3 PenningTrap::total_force_particles(uint i)
+
96{
+
97 vec3 res;
+
98
+
99 for (size_t j = 0; j < this->particles.size(); j++) {
+
100 if (i != j)
+
101 res += this->force_on_particle(i, j);
+
102 }
+
103
+
104 return vec3(res * (K_E * this->particles[i].q));
+
105}
+
106
+
107vec3 PenningTrap::total_force(uint i)
+
108{
+
109 if (arma::norm(this->particles[i].r_vec) > this->d) {
+
110 return vec3{0., 0., 0.};
+
111 }
+
112 return vec3(this->total_force_external(i) - this->total_force_particles(i));
+
113}
+
114
+
115PenningTrap::PenningTrap(double B_0, double V_0, double d, double t)
+
116{
+
117 this->B_0 = B_0;
+
118 this->V_0 = V_0;
+
119 this->d = d;
+
120 this->t = t;
+
121 this->perturbation = [](double t) { return 1.; };
+
122}
123
-
124 // Get the distance between the particles
-
125 double norm = arma::norm(res, 2);
-
126
-
127 return vec3((this->particles[j].q / (norm * norm * norm)) * res);
-
128}
-
129
-
130vec3 PenningTrap::total_force_external(uint i)
-
131{
-
132 Particle *p = &this->particles[i];
+
124PenningTrap::PenningTrap(uint i, double B_0, double V_0, double d, double t)
+
125 : PenningTrap::PenningTrap(B_0, V_0, d)
+
126{
+
127 for (size_t j = 0; j < i; j++) {
+
128 this->particles.push_back(
+
129 Particle(vec3(vec3().randn() * .1 * this->d),
+
130 vec3(vec3().randn() * .1 * this->d)));
+
131 }
+
132}
133
-
134 if (arma::norm(p->r_vec) > this->d) {
-
135 return vec3{0., 0., 0.};
-
136 }
-
137
-
138 return vec3(p->q
-
139 * (this->external_E_field(p->r_vec)
-
140 + arma::cross(p->v_vec, this->external_B_field(p->r_vec))));
-
141}
-
142
-
143vec3 PenningTrap::total_force_particles(uint i)
-
144{
-
145 vec3 res;
-
146
-
147 for (size_t j = 0; j < this->particles.size(); j++) {
-
148 if (i != j)
-
149 res += this->force_on_particle(i, j);
-
150 }
-
151
-
152 return vec3(res * (K_E * this->particles[i].q));
-
153}
-
154
-
155vec3 PenningTrap::total_force(uint i)
-
156{
-
157 if (arma::norm(this->particles[i].r_vec) > this->d) {
-
158 return vec3{0., 0., 0.};
-
159 }
-
160 return vec3(this->total_force_external(i) - this->total_force_particles(i));
+
134PenningTrap::PenningTrap(std::vector<Particle> particles, double B_0,
+
135 double V_0, double d, double t)
+
136 : PenningTrap::PenningTrap(B_0, V_0, d)
+
137{
+
138 this->particles = particles;
+
139}
+
140
+
141void PenningTrap::set_pertubation(double f, double omega_V)
+
142{
+
143 this->perturbation = [f, omega_V](double t) {
+
144 return 1 + f * std::cos(omega_V * t);
+
145 };
+
146}
+
147
+
148void PenningTrap::reinitialize(double f, double omega_V, double t)
+
149{
+
150 this->t = t;
+
151 this->set_pertubation(f, omega_V);
+
152
+
153 for (size_t i = 0; i < this->particles.size(); i++) {
+
154 this->particles[i].r_vec = vec3().randn() * .1 * this->d;
+
155 }
+
156}
+
157
+
158void PenningTrap::add_particle(Particle particle)
+
159{
+
160 this->particles.push_back(particle);
161}
162
163void PenningTrap::evolve_RK4(double dt, bool particle_interaction)
@@ -424,31 +424,31 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
Particle::v_vec
vec3 v_vec
velocity
Definition: Particle.hpp:26
Particle::q
double q
Charge.
Definition: Particle.hpp:27
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:32
-
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:39
-
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:34
-
PenningTrap::total_force_external
vec3 total_force_external(uint i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:130
-
PenningTrap::k_r
sim_arr k_r
Definition: PenningTrap.hpp:42
-
PenningTrap::total_force_particles
vec3 total_force_particles(uint i)
Calculate the total force on a particle p_i from other particles.
Definition: PenningTrap.cpp:143
-
PenningTrap::external_B_field
vec3 external_B_field(vec3 r)
Calculate B at point r.
Definition: PenningTrap.cpp:114
+
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:42
+
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:37
+
PenningTrap::total_force_external
vec3 total_force_external(uint i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:82
+
PenningTrap::k_r
sim_arr k_r
A 2D vector containing all where is the index of a particle.
Definition: PenningTrap.hpp:52
+
PenningTrap::total_force_particles
vec3 total_force_particles(uint i)
Calculate the total force on a particle p_i from other particles.
Definition: PenningTrap.cpp:95
+
PenningTrap::external_B_field
vec3 external_B_field(vec3 r)
Calculate B at point r.
Definition: PenningTrap.cpp:66
PenningTrap::evolve_RK4
void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:163
-
PenningTrap::v_func
vec3 v_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:63
-
PenningTrap::external_E_field
vec3 external_E_field(vec3 r)
Calculate E at point r.
Definition: PenningTrap.cpp:106
-
PenningTrap::PenningTrap
PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)
Constructor for the PenningTrap class.
Definition: PenningTrap.cpp:20
-
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:37
-
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:101
-
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:35
+
PenningTrap::v_func
vec3 v_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:20
+
PenningTrap::external_E_field
vec3 external_E_field(vec3 r)
Calculate E at point r.
Definition: PenningTrap.cpp:58
+
PenningTrap::PenningTrap
PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)
Constructor for the PenningTrap class.
Definition: PenningTrap.cpp:115
+
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:40
+
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:158
+
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:38
PenningTrap::simulate
simulation_t simulate(double time, uint steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
Definition: PenningTrap.cpp:228
-
PenningTrap::force_on_particle
vec3 force_on_particle(uint i, uint j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:119
-
PenningTrap::r_func
vec3 r_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:82
-
PenningTrap::t
double t
Current time.
Definition: PenningTrap.hpp:38
-
PenningTrap::total_force
vec3 total_force(uint i)
calculate the total force on a particle p_i.
Definition: PenningTrap.cpp:155
-
PenningTrap::set_pertubation
void set_pertubation(double f, double omega_V)
Time dependent perturbation to V_0.
Definition: PenningTrap.cpp:46
-
PenningTrap::reinitialize
void reinitialize(double f, double omega_V, double t=0.)
Give all particles new positions and velocities, and change t and V_0.
Definition: PenningTrap.cpp:53
+
PenningTrap::force_on_particle
vec3 force_on_particle(uint i, uint j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:71
+
PenningTrap::r_func
vec3 r_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:39
+
PenningTrap::t
double t
Current time.
Definition: PenningTrap.hpp:41
+
PenningTrap::total_force
vec3 total_force(uint i)
calculate the total force on a particle p_i.
Definition: PenningTrap.cpp:107
+
PenningTrap::set_pertubation
void set_pertubation(double f, double omega_V)
Time dependent perturbation to V_0.
Definition: PenningTrap.cpp:141
+
PenningTrap::reinitialize
void reinitialize(double f, double omega_V, double t=0.)
Give all particles new positions and velocities, and change t and V_0.
Definition: PenningTrap.cpp:148
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:201
PenningTrap::fraction_of_particles_left
double fraction_of_particles_left(double time, uint 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 si...
Definition: PenningTrap.cpp:297
PenningTrap::write_simulation_to_dir
void write_simulation_to_dir(std::string path, double time, uint steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
Definition: PenningTrap.cpp:259
-
PenningTrap::perturbation
std::function< double(double)> perturbation
Time-dependent perturbation.
Definition: PenningTrap.hpp:36
-
PenningTrap::k_v
sim_arr k_v
Definition: PenningTrap.hpp:40
+
PenningTrap::perturbation
std::function< double(double)> perturbation
Time-dependent perturbation.
Definition: PenningTrap.hpp:39
+
PenningTrap::k_v
sim_arr k_v
A 2D vector containing all where is the index of a particle.
Definition: PenningTrap.hpp:47
K_E
#define K_E
Coulomb constant. unit: .
Definition: constants.hpp:17
simulation
Typedef for PenningTrap::simulation return value.
Definition: typedefs.hpp:40
typedefs.hpp
Useful typedefs for cleaner code.
diff --git a/docs/PenningTrap_8hpp_source.html b/docs/PenningTrap_8hpp_source.html index fab595d..50f6910 100644 --- a/docs/PenningTrap_8hpp_source.html +++ b/docs/PenningTrap_8hpp_source.html @@ -118,95 +118,97 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp_source.html',''); ini
25
31class PenningTrap
32{
-
33private:
-
34 double B_0;
-
35 double V_0;
-
36 std::function<double(double)> perturbation;
-
37 double d;
-
38 double t;
-
39 std::vector<Particle> particles;
-
40 sim_arr k_v;
-
42 sim_arr k_r;
-
44
-
55 vec3 v_func(uint i, uint j, double dt);
-
56
-
67 vec3 r_func(uint i, uint j, double dt);
-
68
-
75 vec3 external_E_field(vec3 r);
-
76
-
83 vec3 external_B_field(vec3 r);
-
84
-
95 vec3 force_on_particle(uint i, uint j);
-
96
-
106 vec3 total_force_external(uint i);
-
107
-
115 vec3 total_force_particles(uint i);
+
35 friend class PenningTrapTest;
+
36private:
+
37 double B_0;
+
38 double V_0;
+
39 std::function<double(double)> perturbation;
+
40 double d;
+
41 double t;
+
42 std::vector<Particle> particles;
+
43
+
47 sim_arr k_v;
+
48
+
52 sim_arr k_r;
+
53
+
64 vec3 v_func(uint i, uint j, double dt);
+
65
+
76 vec3 r_func(uint i, uint j, double dt);
+
77
+
84 vec3 external_E_field(vec3 r);
+
85
+
92 vec3 external_B_field(vec3 r);
+
93
+
104 vec3 force_on_particle(uint i, uint j);
+
105
+
115 vec3 total_force_external(uint i);
116
-
123 vec3 total_force(uint i);
-
124
-
125public:
-
133 PenningTrap(double B_0 = T, double V_0 = (25. * V) / 1000., double d = 500.,
-
134 double t = 0.);
-
135
-
144 PenningTrap(uint i, double B_0 = T, double V_0 = (25. * V) / 1000.,
-
145 double d = 500., double t = 0.);
-
146
-
155 PenningTrap(std::vector<Particle> particles, double B_0 = T,
-
156 double V_0 = (25. * V) / 1000., double d = 500., double t = 0.);
-
157
-
163 void set_pertubation(double f, double omega_V);
-
164
-
171 void reinitialize(double f, double omega_V, double t = 0.);
-
172
-
177 void add_particle(Particle particle);
-
178
-
184 void evolve_RK4(double dt, bool particle_interaction = true);
-
185
-
191 void evolve_forward_euler(double dt, bool particle_interaction = true);
-
192
-
203 simulation_t simulate(double time, uint steps, std::string method = "rk4",
-
204 bool particle_interaction = true);
-
205
-
214 void write_simulation_to_dir(std::string path, double time, uint steps,
-
215 std::string method = "rk4",
-
216 bool particle_interaction = true);
-
217
-
228 double fraction_of_particles_left(double time, uint steps,
-
229 std::string method = "rk4",
-
230 bool particle_interaction = true);
-
231
-
232 friend class PenningTrapTest;
-
233};
-
234
-
235#endif
+
124 vec3 total_force_particles(uint i);
+
125
+
132 vec3 total_force(uint i);
+
133
+
134public:
+
142 PenningTrap(double B_0 = T, double V_0 = (25. * V) / 1000., double d = 500.,
+
143 double t = 0.);
+
144
+
153 PenningTrap(uint i, double B_0 = T, double V_0 = (25. * V) / 1000.,
+
154 double d = 500., double t = 0.);
+
155
+
164 PenningTrap(std::vector<Particle> particles, double B_0 = T,
+
165 double V_0 = (25. * V) / 1000., double d = 500., double t = 0.);
+
166
+
172 void set_pertubation(double f, double omega_V);
+
173
+
180 void reinitialize(double f, double omega_V, double t = 0.);
+
181
+
186 void add_particle(Particle particle);
+
187
+
193 void evolve_RK4(double dt, bool particle_interaction = true);
+
194
+
200 void evolve_forward_euler(double dt, bool particle_interaction = true);
+
201
+
212 simulation_t simulate(double time, uint steps, std::string method = "rk4",
+
213 bool particle_interaction = true);
+
214
+
223 void write_simulation_to_dir(std::string path, double time, uint steps,
+
224 std::string method = "rk4",
+
225 bool particle_interaction = true);
+
226
+
237 double fraction_of_particles_left(double time, uint steps,
+
238 std::string method = "rk4",
+
239 bool particle_interaction = true);
+
240
+
241};
+
242
+
243#endif
Particle.hpp
A class that holds the properties of a particle.
Particle
A class that holds attributes of a particle.
Definition: Particle.hpp:23
PenningTrapTest
Test class for the Penning trap.
Definition: test_suite.cpp:24
PenningTrap
A class that simulates a Penning trap.
Definition: PenningTrap.hpp:32
-
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:39
-
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:34
-
PenningTrap::total_force_external
vec3 total_force_external(uint i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:130
-
PenningTrap::k_r
sim_arr k_r
Definition: PenningTrap.hpp:42
-
PenningTrap::total_force_particles
vec3 total_force_particles(uint i)
Calculate the total force on a particle p_i from other particles.
Definition: PenningTrap.cpp:143
-
PenningTrap::external_B_field
vec3 external_B_field(vec3 r)
Calculate B at point r.
Definition: PenningTrap.cpp:114
+
PenningTrap::particles
std::vector< Particle > particles
The particles in the Penning trap.
Definition: PenningTrap.hpp:42
+
PenningTrap::B_0
double B_0
Magnetic field strength.
Definition: PenningTrap.hpp:37
+
PenningTrap::total_force_external
vec3 total_force_external(uint i)
Calculate the total external force on a particle.
Definition: PenningTrap.cpp:82
+
PenningTrap::k_r
sim_arr k_r
A 2D vector containing all where is the index of a particle.
Definition: PenningTrap.hpp:52
+
PenningTrap::total_force_particles
vec3 total_force_particles(uint i)
Calculate the total force on a particle p_i from other particles.
Definition: PenningTrap.cpp:95
+
PenningTrap::external_B_field
vec3 external_B_field(vec3 r)
Calculate B at point r.
Definition: PenningTrap.cpp:66
PenningTrap::evolve_RK4
void evolve_RK4(double dt, bool particle_interaction=true)
Go forward one timestep using the RK4 method.
Definition: PenningTrap.cpp:163
-
PenningTrap::v_func
vec3 v_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:63
-
PenningTrap::external_E_field
vec3 external_E_field(vec3 r)
Calculate E at point r.
Definition: PenningTrap.cpp:106
-
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:37
-
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:101
-
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:35
+
PenningTrap::v_func
vec3 v_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:20
+
PenningTrap::external_E_field
vec3 external_E_field(vec3 r)
Calculate E at point r.
Definition: PenningTrap.cpp:58
+
PenningTrap::d
double d
Characteristic dimension.
Definition: PenningTrap.hpp:40
+
PenningTrap::add_particle
void add_particle(Particle particle)
Add a particle to the system.
Definition: PenningTrap.cpp:158
+
PenningTrap::V_0
double V_0
Applied potential.
Definition: PenningTrap.hpp:38
PenningTrap::simulate
simulation_t simulate(double time, uint steps, std::string method="rk4", bool particle_interaction=true)
Simulate the particle system inside the Penning trap over a certain amount of time.
Definition: PenningTrap.cpp:228
-
PenningTrap::force_on_particle
vec3 force_on_particle(uint i, uint j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:119
-
PenningTrap::r_func
vec3 r_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:82
-
PenningTrap::t
double t
Current time.
Definition: PenningTrap.hpp:38
-
PenningTrap::total_force
vec3 total_force(uint i)
calculate the total force on a particle p_i.
Definition: PenningTrap.cpp:155
-
PenningTrap::set_pertubation
void set_pertubation(double f, double omega_V)
Time dependent perturbation to V_0.
Definition: PenningTrap.cpp:46
-
PenningTrap::reinitialize
void reinitialize(double f, double omega_V, double t=0.)
Give all particles new positions and velocities, and change t and V_0.
Definition: PenningTrap.cpp:53
+
PenningTrap::force_on_particle
vec3 force_on_particle(uint i, uint j)
Calculate the force between 2 particles.
Definition: PenningTrap.cpp:71
+
PenningTrap::r_func
vec3 r_func(uint i, uint j, double dt)
Helper for evolve_RK4 when calculating values.
Definition: PenningTrap.cpp:39
+
PenningTrap::t
double t
Current time.
Definition: PenningTrap.hpp:41
+
PenningTrap::total_force
vec3 total_force(uint i)
calculate the total force on a particle p_i.
Definition: PenningTrap.cpp:107
+
PenningTrap::set_pertubation
void set_pertubation(double f, double omega_V)
Time dependent perturbation to V_0.
Definition: PenningTrap.cpp:141
+
PenningTrap::reinitialize
void reinitialize(double f, double omega_V, double t=0.)
Give all particles new positions and velocities, and change t and V_0.
Definition: PenningTrap.cpp:148
PenningTrap::evolve_forward_euler
void evolve_forward_euler(double dt, bool particle_interaction=true)
Go forward one timestep using the forward Euler method.
Definition: PenningTrap.cpp:201
PenningTrap::fraction_of_particles_left
double fraction_of_particles_left(double time, uint 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 si...
Definition: PenningTrap.cpp:297
PenningTrap::write_simulation_to_dir
void write_simulation_to_dir(std::string path, double time, uint steps, std::string method="rk4", bool particle_interaction=true)
Simulate and write the displacement of all particles to files.
Definition: PenningTrap.cpp:259
-
PenningTrap::perturbation
std::function< double(double)> perturbation
Time-dependent perturbation.
Definition: PenningTrap.hpp:36
-
PenningTrap::k_v
sim_arr k_v
Definition: PenningTrap.hpp:40
+
PenningTrap::perturbation
std::function< double(double)> perturbation
Time-dependent perturbation.
Definition: PenningTrap.hpp:39
+
PenningTrap::k_v
sim_arr k_v
A 2D vector containing all where is the index of a particle.
Definition: PenningTrap.hpp:47
constants.hpp
Library of constants.
T
#define T
1 Tesla. unit:
Definition: constants.hpp:21
V
#define V
1 Volt. unit:
Definition: constants.hpp:25
diff --git a/docs/classPenningTrap-members.html b/docs/classPenningTrap-members.html index d4bca01..f7e9ce3 100644 --- a/docs/classPenningTrap-members.html +++ b/docs/classPenningTrap-members.html @@ -119,7 +119,7 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)PenningTrap PenningTrap(uint i, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)PenningTrap PenningTrap(std::vector< Particle > particles, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)PenningTrap - PenningTrapTest (defined in PenningTrap)PenningTrapfriend + PenningTrapTestPenningTrapfriend perturbationPenningTrapprivate r_func(uint i, uint j, double dt)PenningTrapprivate reinitialize(double f, double omega_V, double t=0.)PenningTrap diff --git a/docs/classPenningTrap.html b/docs/classPenningTrap.html index 9be2e3b..3cac359 100644 --- a/docs/classPenningTrap.html +++ b/docs/classPenningTrap.html @@ -197,13 +197,16 @@ Private Attributes  The particles in the Penning trap.
  sim_arr k_v + A 2D vector containing all \(k_{v,i,j}\) where \(j\) is the index of a particle.
  sim_arr k_r + A 2D vector containing all \(k_{r,i,j}\) where \(j\) is the index of a particle.
  +

Friends

class PenningTrapTest
 Make PenningTrapTest a friend of PenningTrap.
 

Detailed Description

@@ -261,7 +264,7 @@ Friends -

Definition at line 20 of file PenningTrap.cpp.

+

Definition at line 115 of file PenningTrap.cpp.

@@ -321,7 +324,7 @@ Friends -

Definition at line 29 of file PenningTrap.cpp.

+

Definition at line 124 of file PenningTrap.cpp.

@@ -381,7 +384,7 @@ Friends -

Definition at line 39 of file PenningTrap.cpp.

+

Definition at line 134 of file PenningTrap.cpp.

@@ -410,7 +413,7 @@ Friends -

Definition at line 101 of file PenningTrap.cpp.

+

Definition at line 158 of file PenningTrap.cpp.

@@ -525,7 +528,7 @@ Friends
Returns
vec3
-

Definition at line 114 of file PenningTrap.cpp.

+

Definition at line 66 of file PenningTrap.cpp.

@@ -562,7 +565,7 @@ Friends
Returns
vec3
-

Definition at line 106 of file PenningTrap.cpp.

+

Definition at line 58 of file PenningTrap.cpp.

@@ -611,7 +614,7 @@ Friends
Returns
vec3
-

Definition at line 119 of file PenningTrap.cpp.

+

Definition at line 71 of file PenningTrap.cpp.

@@ -721,7 +724,7 @@ Friends
Returns
vec3
-

Definition at line 82 of file PenningTrap.cpp.

+

Definition at line 39 of file PenningTrap.cpp.

@@ -766,7 +769,7 @@ Friends -

Definition at line 53 of file PenningTrap.cpp.

+

Definition at line 148 of file PenningTrap.cpp.

@@ -804,7 +807,7 @@ Friends -

Definition at line 46 of file PenningTrap.cpp.

+

Definition at line 141 of file PenningTrap.cpp.

@@ -895,7 +898,7 @@ Friends
Returns
vec3
-

Definition at line 155 of file PenningTrap.cpp.

+

Definition at line 107 of file PenningTrap.cpp.

@@ -933,7 +936,7 @@ Friends
Returns
vec3
-

Definition at line 130 of file PenningTrap.cpp.

+

Definition at line 82 of file PenningTrap.cpp.

@@ -970,7 +973,7 @@ Friends
Returns
vec3
-

Definition at line 143 of file PenningTrap.cpp.

+

Definition at line 95 of file PenningTrap.cpp.

@@ -1026,7 +1029,7 @@ Friends
Returns
vec3
-

Definition at line 63 of file PenningTrap.cpp.

+

Definition at line 20 of file PenningTrap.cpp.

@@ -1111,7 +1114,9 @@ Friends
-

Definition at line 232 of file PenningTrap.hpp.

+

Make PenningTrapTest a friend of PenningTrap.

+ +

Definition at line 35 of file PenningTrap.hpp.

@@ -1138,7 +1143,7 @@ Friends

Magnetic field strength.

-

Definition at line 34 of file PenningTrap.hpp.

+

Definition at line 37 of file PenningTrap.hpp.

@@ -1164,7 +1169,7 @@ Friends

Characteristic dimension.

-

Definition at line 37 of file PenningTrap.hpp.

+

Definition at line 40 of file PenningTrap.hpp.

@@ -1187,9 +1192,10 @@ Friends
-

A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle

-

Definition at line 42 of file PenningTrap.hpp.

+

A 2D vector containing all \(k_{r,i,j}\) where \(j\) is the index of a particle.

+ +

Definition at line 52 of file PenningTrap.hpp.

@@ -1212,9 +1218,10 @@ Friends
-

A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle

-

Definition at line 40 of file PenningTrap.hpp.

+

A 2D vector containing all \(k_{v,i,j}\) where \(j\) is the index of a particle.

+ +

Definition at line 47 of file PenningTrap.hpp.

@@ -1240,7 +1247,7 @@ Friends

The particles in the Penning trap.

-

Definition at line 39 of file PenningTrap.hpp.

+

Definition at line 42 of file PenningTrap.hpp.

@@ -1266,7 +1273,7 @@ Friends

Time-dependent perturbation.

-

Definition at line 36 of file PenningTrap.hpp.

+

Definition at line 39 of file PenningTrap.hpp.

@@ -1292,7 +1299,7 @@ Friends

Current time.

-

Definition at line 38 of file PenningTrap.hpp.

+

Definition at line 41 of file PenningTrap.hpp.

@@ -1318,7 +1325,7 @@ Friends

Applied potential.

-

Definition at line 35 of file PenningTrap.hpp.

+

Definition at line 38 of file PenningTrap.hpp.

diff --git a/docs/classPenningTrap.js b/docs/classPenningTrap.js index 987c84c..6e5d013 100644 --- a/docs/classPenningTrap.js +++ b/docs/classPenningTrap.js @@ -19,6 +19,7 @@ var classPenningTrap = [ "total_force_particles", "classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c", null ], [ "v_func", "classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2", null ], [ "write_simulation_to_dir", "classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b", null ], + [ "PenningTrapTest", "classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae", null ], [ "B_0", "classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716", null ], [ "d", "classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2", null ], [ "k_r", "classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640", null ], diff --git a/docs/functions.html b/docs/functions.html index c2f9801..86b463b 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -144,6 +144,7 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  • Particle() : Particle
  • particles : PenningTrap
  • PenningTrap : Particle, PenningTrap
  • +
  • PenningTrapTest : PenningTrap
  • perturbation : PenningTrap
  • diff --git a/docs/functions_rela.html b/docs/functions_rela.html index 81a1c72..ab3c3e5 100644 --- a/docs/functions_rela.html +++ b/docs/functions_rela.html @@ -100,6 +100,7 @@ $(document).ready(function(){initNavTree('functions_rela.html',''); initResizabl
     
    diff --git a/docs/main_8cpp_source.html b/docs/main_8cpp_source.html index cbf1d30..ecc9633 100644 --- a/docs/main_8cpp_source.html +++ b/docs/main_8cpp_source.html @@ -423,7 +423,7 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
    PenningTrap.hpp
    A class for simulating a Penning trap.
    Particle
    A class that holds attributes of a particle.
    Definition: Particle.hpp:23
    PenningTrap
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:32
    -
    PenningTrap::reinitialize
    void reinitialize(double f, double omega_V, double t=0.)
    Give all particles new positions and velocities, and change t and V_0.
    Definition: PenningTrap.cpp:53
    +
    PenningTrap::reinitialize
    void reinitialize(double f, double omega_V, double t=0.)
    Give all particles new positions and velocities, and change t and V_0.
    Definition: PenningTrap.cpp:148
    PenningTrap::fraction_of_particles_left
    double fraction_of_particles_left(double time, uint 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 si...
    Definition: PenningTrap.cpp:297
    PenningTrap::write_simulation_to_dir
    void write_simulation_to_dir(std::string path, double time, uint steps, std::string method="rk4", bool particle_interaction=true)
    Simulate and write the displacement of all particles to files.
    Definition: PenningTrap.cpp:259
    constants.hpp
    Library of constants.
    diff --git a/docs/navtreeindex0.js b/docs/navtreeindex0.js index 38ecabb..68d8951 100644 --- a/docs/navtreeindex0.js +++ b/docs/navtreeindex0.js @@ -19,24 +19,25 @@ var NAVTREEINDEX0 = "classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[5,0,0,2], "classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4":[5,0,0,0], "classPenningTrap.html":[5,0,1], -"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[5,0,1,23], -"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[5,0,1,19], +"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[5,0,1,24], +"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[5,0,1,20], "classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682":[5,0,1,15], -"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[5,0,1,21], +"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[5,0,1,22], "classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c":[5,0,1,16], "classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655":[5,0,1,6], "classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[5,0,1,5], "classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2":[5,0,1,17], "classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22":[5,0,1,7], "classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8":[5,0,1,0], -"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[5,0,1,20], +"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[5,0,1,21], "classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[5,0,1,3], -"classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89":[5,0,1,26], +"classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89":[5,0,1,27], "classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a":[5,0,1,13], "classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598":[5,0,1,8], "classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08":[5,0,1,10], "classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f":[5,0,1,1], -"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[5,0,1,25], +"classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae":[5,0,1,19], +"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[5,0,1,26], "classPenningTrap.html#a9a301b0540078c36697880ef204afdf3":[5,0,1,14], "classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43":[5,0,1,12], "classPenningTrap.html#aaee129f177657455348d0c8ae1441dea":[5,0,1,11], @@ -44,8 +45,8 @@ var NAVTREEINDEX0 = "classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f":[5,0,1,9], "classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b":[5,0,1,18], "classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f":[5,0,1,2], -"classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5":[5,0,1,24], -"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[5,0,1,22], +"classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5":[5,0,1,25], +"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[5,0,1,23], "classPenningTrapTest.html":[5,0,2], "classPenningTrapTest.html#a5f4f0b150e54ce463bb29f76d49883f9":[5,0,2,2], "classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508":[5,0,2,4], diff --git a/docs/search/all_9.js b/docs/search/all_9.js index 7a16618..8d94e1e 100644 --- a/docs/search/all_9.js +++ b/docs/search/all_9.js @@ -10,7 +10,7 @@ var searchData= ['penningtrap_7',['PenningTrap',['../classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8',1,'PenningTrap::PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f',1,'PenningTrap::PenningTrap(std::vector< Particle > particles, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f',1,'PenningTrap::PenningTrap(uint i, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html',1,'PenningTrap']]], ['penningtrap_2ecpp_8',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]], ['penningtrap_2ehpp_9',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]], - ['penningtraptest_10',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]], + ['penningtraptest_10',['PenningTrapTest',['../classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae',1,'PenningTrap::PenningTrapTest()'],['../classPenningTrapTest.html',1,'PenningTrapTest']]], ['perturbation_11',['perturbation',['../classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5',1,'PenningTrap']]], ['potential_5fresonance_5fnarrow_5fsweep_12',['potential_resonance_narrow_sweep',['../main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'main.cpp']]], ['potential_5fresonance_5fnarrow_5fsweep_5finteraction_13',['potential_resonance_narrow_sweep_interaction',['../main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'main.cpp']]], diff --git a/docs/search/related_0.js b/docs/search/related_0.js index 0d3bc2c..3f7af5a 100644 --- a/docs/search/related_0.js +++ b/docs/search/related_0.js @@ -1,4 +1,5 @@ var searchData= [ - ['penningtrap_0',['PenningTrap',['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle']]] + ['penningtrap_0',['PenningTrap',['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle']]], + ['penningtraptest_1',['PenningTrapTest',['../classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae',1,'PenningTrap']]] ]; diff --git a/docs/test__suite_8cpp_source.html b/docs/test__suite_8cpp_source.html index 8374f2c..0e0fee5 100644 --- a/docs/test__suite_8cpp_source.html +++ b/docs/test__suite_8cpp_source.html @@ -239,12 +239,12 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
    PenningTrapTest::test_external_B_field
    void test_external_B_field()
    Test that the external B field gives correct values.
    Definition: test_suite.cpp:66
    PenningTrapTest::test_total_force_external
    void test_total_force_external()
    Test that the total external force returns expected results.
    Definition: test_suite.cpp:107
    PenningTrap
    A class that simulates a Penning trap.
    Definition: PenningTrap.hpp:32
    -
    PenningTrap::total_force_external
    vec3 total_force_external(uint i)
    Calculate the total external force on a particle.
    Definition: PenningTrap.cpp:130
    -
    PenningTrap::total_force_particles
    vec3 total_force_particles(uint i)
    Calculate the total force on a particle p_i from other particles.
    Definition: PenningTrap.cpp:143
    -
    PenningTrap::external_B_field
    vec3 external_B_field(vec3 r)
    Calculate B at point r.
    Definition: PenningTrap.cpp:114
    -
    PenningTrap::external_E_field
    vec3 external_E_field(vec3 r)
    Calculate E at point r.
    Definition: PenningTrap.cpp:106
    -
    PenningTrap::add_particle
    void add_particle(Particle particle)
    Add a particle to the system.
    Definition: PenningTrap.cpp:101
    -
    PenningTrap::force_on_particle
    vec3 force_on_particle(uint i, uint j)
    Calculate the force between 2 particles.
    Definition: PenningTrap.cpp:119
    +
    PenningTrap::total_force_external
    vec3 total_force_external(uint i)
    Calculate the total external force on a particle.
    Definition: PenningTrap.cpp:82
    +
    PenningTrap::total_force_particles
    vec3 total_force_particles(uint i)
    Calculate the total force on a particle p_i from other particles.
    Definition: PenningTrap.cpp:95
    +
    PenningTrap::external_B_field
    vec3 external_B_field(vec3 r)
    Calculate B at point r.
    Definition: PenningTrap.cpp:66
    +
    PenningTrap::external_E_field
    vec3 external_E_field(vec3 r)
    Calculate E at point r.
    Definition: PenningTrap.cpp:58
    +
    PenningTrap::add_particle
    void add_particle(Particle particle)
    Add a particle to the system.
    Definition: PenningTrap.cpp:158
    +
    PenningTrap::force_on_particle
    vec3 force_on_particle(uint i, uint j)
    Calculate the force between 2 particles.
    Definition: PenningTrap.cpp:71
    constants.hpp
    Library of constants.
    T
    #define T
    1 Tesla. unit:
    Definition: constants.hpp:21
    vec3
    arma::vec::fixed< 3 > vec3
    Typedef for a fixed 3d arma vector.
    Definition: typedefs.hpp:23