Version 2, position dependent E/B, kinetic ions, boris mover, terminator
This commit is contained in:
Executable
+113
@@ -0,0 +1,113 @@
|
||||
#include "simulation/particle.h"
|
||||
#include "constants/physical_constants.h"
|
||||
#include "simulation/species.h"
|
||||
|
||||
namespace particle {
|
||||
/*
|
||||
Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
Coordinate* position,
|
||||
Vector* velocity)
|
||||
: specie_(specie),
|
||||
position_(CylinderCoordinate(*position)),
|
||||
velocity_(CartesianVector(*velocity, *position)),
|
||||
id_(this->last_id_),
|
||||
time_alive_s_(0.),
|
||||
time_in_bin_s_(0.),
|
||||
interaction_counter_(0) {
|
||||
last_id_++;
|
||||
}
|
||||
*/
|
||||
|
||||
Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity)
|
||||
: specie_(specie),
|
||||
position_(position),
|
||||
velocity_(velocity, position),
|
||||
id_(this->last_id_),
|
||||
time_alive_s_(0.),
|
||||
time_in_bin_s_(0.),
|
||||
interaction_counter_(0) {
|
||||
last_id_++;
|
||||
}
|
||||
|
||||
long int Particle::last_id_ = 0;
|
||||
|
||||
double Particle::mass_kg() const {
|
||||
return specie_->mass_kg();
|
||||
}
|
||||
double Particle::charge_C() const {
|
||||
return specie_->charge_C();
|
||||
}
|
||||
|
||||
void Particle::lastId(long int id) {
|
||||
last_id_ = id;
|
||||
}
|
||||
|
||||
long int Particle::lastId() {
|
||||
return last_id_;
|
||||
}
|
||||
|
||||
void Particle::velocity(const CartesianVector& new_velocity) {
|
||||
velocity_ = new_velocity;
|
||||
}
|
||||
|
||||
CartesianVector Particle::velocity() const {
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
species::TrackedSpecie* Particle::specie() const {
|
||||
return specie_.get();
|
||||
}
|
||||
|
||||
void Particle::position(const Coordinate& new_position) {
|
||||
position_ = CartesianCoordinate(new_position);
|
||||
}
|
||||
|
||||
CartesianCoordinate Particle::position() const {
|
||||
return position_;
|
||||
}
|
||||
|
||||
void Particle::move(const Coordinate& distance) {
|
||||
position_.add(distance);
|
||||
}
|
||||
|
||||
double Particle::kineticEnergy_eV() const {
|
||||
return mass_kg() * absoluteVelocitySquared() * UnitConversion::JouleToeV / 2.;
|
||||
}
|
||||
|
||||
double Particle::absoluteVelocity() const {
|
||||
return std::sqrt(absoluteVelocitySquared());
|
||||
}
|
||||
|
||||
double Particle::absoluteVelocitySquared() const {
|
||||
return blitz::dot(velocity_.cartesianEntries(), velocity_.cartesianEntries());
|
||||
}
|
||||
|
||||
void Particle::increaseInteractionCounter() {
|
||||
interaction_counter_++;
|
||||
}
|
||||
long int Particle::interactionCounter() const {
|
||||
return interaction_counter_;
|
||||
}
|
||||
|
||||
void Particle::increaseTimeAlive(double time_s) {
|
||||
time_alive_s_ += time_s;
|
||||
}
|
||||
double Particle::timeAlive() const {
|
||||
return time_alive_s_;
|
||||
}
|
||||
|
||||
void Particle::increaseTimeInBin(double time_s) {
|
||||
time_in_bin_s_ += time_s;
|
||||
}
|
||||
|
||||
void Particle::resetTimeInBin() {
|
||||
time_in_bin_s_ = 0.;
|
||||
}
|
||||
|
||||
double Particle::timeInBin() const {
|
||||
return time_in_bin_s_;
|
||||
}
|
||||
|
||||
} // namespace particle
|
||||
Reference in New Issue
Block a user