Version 2, position dependent E/B, kinetic ions, boris mover, terminator
This commit is contained in:
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#include "simulation/interaction.h"
|
||||
|
||||
#include "constants/physical_constants.h"
|
||||
#include "simulation/coordinates.h"
|
||||
#include "simulation/density_field.h"
|
||||
#include "simulation/drift_velocity.h"
|
||||
#include "simulation/kinematic.h"
|
||||
#include "simulation/velocity_distribution.h"
|
||||
|
||||
namespace interaction {
|
||||
|
||||
InteractionOutput::InteractionOutput() : delete_current_particle_(false){};
|
||||
|
||||
void InteractionOutput::deleteCurrentParticle(bool new_decider) {
|
||||
delete_current_particle_ = new_decider;
|
||||
}
|
||||
|
||||
bool InteractionOutput::deleteCurrentParticle() {
|
||||
return delete_current_particle_;
|
||||
}
|
||||
|
||||
void InteractionOutput::add(const particle::Particle& new_particle) {
|
||||
new_particles_.push_back(new_particle);
|
||||
}
|
||||
|
||||
std::vector<particle::Particle> InteractionOutput::newParticles() {
|
||||
return new_particles_;
|
||||
}
|
||||
|
||||
Interaction::Interaction(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target)
|
||||
: cross_section_(cross_section), target_(target) {}
|
||||
|
||||
double Interaction::macroscopicCrossSection(particle::Particle& particle) {
|
||||
const auto x_particle = particle.position();
|
||||
const blitz::TinyVector<double, 3> v_particle =
|
||||
particle.velocity().cartesianEntries();
|
||||
const blitz::TinyVector<double, 3> v_partner =
|
||||
target_->driftVelocity()->driftVelocity(x_particle).cartesianEntries();
|
||||
|
||||
const blitz::TinyVector<double, 3> velocity_target_fixed =
|
||||
kinematic::velocityTargetFixed(v_particle, v_partner, particle.mass_kg(),
|
||||
target_->mass_kg());
|
||||
|
||||
const double kinetic_energy_eV =
|
||||
kinematic::kineticEnergy(velocity_target_fixed, particle.mass_kg()) *
|
||||
UnitConversion::JouleToeV;
|
||||
|
||||
const double density = target_->densityField()->density(x_particle);
|
||||
const double cross_section = microscopicCrossSection(kinetic_energy_eV);
|
||||
|
||||
return cross_section * density;
|
||||
};
|
||||
|
||||
double Interaction::microscopicCrossSection(double energy_eV) {
|
||||
return cross_section_(energy_eV);
|
||||
}
|
||||
|
||||
}; // namespace interaction
|
||||
Reference in New Issue
Block a user