Format file
This commit is contained in:
parent
a24635ede0
commit
8a2100a334
@ -42,10 +42,7 @@ arma::vec PenningTrap::external_E_field(arma::vec r)
|
|||||||
|
|
||||||
arma::vec PenningTrap::external_B_field(arma::vec r)
|
arma::vec PenningTrap::external_B_field(arma::vec r)
|
||||||
{
|
{
|
||||||
arma::vec::fixed<3> res;
|
arma::vec::fixed<3> res{0., 0., this->B_0};
|
||||||
res(0) = 0.;
|
|
||||||
res(1) = 0.;
|
|
||||||
res(2) = this->B_0;
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -53,8 +50,8 @@ arma::vec PenningTrap::external_B_field(arma::vec r)
|
|||||||
arma::vec PenningTrap::force_on_particle(int i, int j)
|
arma::vec PenningTrap::force_on_particle(int i, int j)
|
||||||
{
|
{
|
||||||
// Calculate the difference between the particles' position
|
// Calculate the difference between the particles' position
|
||||||
arma::vec::fixed<3> res = this->particles.at(i).r_vec
|
arma::vec::fixed<3> res =
|
||||||
- this->particles.at(j).r_vec;
|
this->particles.at(i).r_vec - this->particles.at(j).r_vec;
|
||||||
|
|
||||||
// Get the distance between the particles
|
// Get the distance between the particles
|
||||||
double norm = arma::norm(res);
|
double norm = arma::norm(res);
|
||||||
@ -69,16 +66,13 @@ arma::vec PenningTrap::total_force_external(int i)
|
|||||||
{
|
{
|
||||||
Particle p = this->particles.at(i);
|
Particle p = this->particles.at(i);
|
||||||
|
|
||||||
arma::vec::fixed<3> v_cross_B;
|
|
||||||
|
|
||||||
arma::vec::fixed<3> B = this->external_B_field(p.r_vec);
|
arma::vec::fixed<3> B = this->external_B_field(p.r_vec);
|
||||||
|
|
||||||
v_cross_B(0) = p.v_vec(1)*B(2) - p.v_vec(2)*B(1);
|
arma::vec::fixed<3> v_cross_B{p.v_vec(1) * B(2) - p.v_vec(2) * B(1),
|
||||||
v_cross_B(1) = p.v_vec(2)*B(0) - p.v_vec(0)*B(2);
|
p.v_vec(2) * B(0) - p.v_vec(0) * B(2),
|
||||||
v_cross_B(2) = p.v_vec(0)*B(1) - p.v_vec(1)*B(0);
|
p.v_vec(0) * B(1) - p.v_vec(1) * B(0)};
|
||||||
|
|
||||||
arma::vec force = p.q
|
arma::vec force = p.q * (this->external_E_field(p.r_vec) + v_cross_B);
|
||||||
*(this->external_E_field(p.r_vec) + v_cross_B);
|
|
||||||
|
|
||||||
return force;
|
return force;
|
||||||
}
|
}
|
||||||
@ -109,7 +103,6 @@ arma::vec PenningTrap::total_force(int i)
|
|||||||
|
|
||||||
void PenningTrap::evolve_RK4(double dt)
|
void PenningTrap::evolve_RK4(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenningTrap::evolve_forward_euler(double dt)
|
void PenningTrap::evolve_forward_euler(double dt)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user