28 lines
932 B
C++
Executable File
28 lines
932 B
C++
Executable File
#include "interactions/charge_exchange.h"
|
|
|
|
#include "constants/physical_constants.h"
|
|
#include "simulation/drift_velocity.h"
|
|
#include "simulation/velocity_distribution.h"
|
|
|
|
namespace interaction {
|
|
|
|
ChargeExchange::ChargeExchange(std::function<double(double)> cross_section,
|
|
std::shared_ptr<species::Specie> target)
|
|
: Interaction(cross_section, target) {}
|
|
|
|
InteractionOutput ChargeExchange::performInteraction(
|
|
particle::Particle& particle,
|
|
RandomNumbers* generator) {
|
|
DEBUG_LEVEL_3("Perform charge exchange.");
|
|
|
|
const auto x_impact = particle.position();
|
|
const blitz::TinyVector<double, 3> v_target =
|
|
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
|
|
target_->velocityDistibution()
|
|
->rollVelocity(x_impact, generator->engine())
|
|
.cartesianEntries();
|
|
|
|
particle.velocity(CartesianVector(v_target));
|
|
return InteractionOutput();
|
|
}
|
|
}; |