reduction of std::pow calls; stronger usage of
Cartesian- and CylinderCoordinate objects
This commit is contained in:
@@ -34,7 +34,7 @@ Interaction::Interaction(std::function<double(double)> cross_section,
|
||||
|
||||
// assumes that v_particle >> v_target
|
||||
double Interaction::macroscopicCrossSection(particle::Particle& particle) {
|
||||
const auto x_particle = particle.position();
|
||||
const auto x_particle = particle.cylinderPosition();
|
||||
const blitz::TinyVector<double, 3> v_particle =
|
||||
particle.velocity().cartesianEntries();
|
||||
if(!target_->driftVelocity()) {
|
||||
@@ -66,17 +66,23 @@ double Interaction::microscopicCrossSection(double energy_eV) {
|
||||
double Interaction::drawCollisionTime(particle::Particle& particle,
|
||||
RandomNumbers* generator) {
|
||||
CartesianVector particle_velocity = particle.velocity();
|
||||
CylinderCoordinate particle_cylinderPosition(particle.position().cylinderEntries());
|
||||
|
||||
target_velocity_ = target_->velocityDistribution()->
|
||||
rollVelocity(particle.position(), generator->engine());
|
||||
|
||||
// // if no drift velocity is present, then assume target at rest otherwise
|
||||
// // use the drift velocity
|
||||
if(target_->driftVelocity()) {
|
||||
// auto tmp = target_->driftVelocity()->driftVelocity(particle.position());
|
||||
target_velocity_.add(target_->driftVelocity()->driftVelocity(particle_cylinderPosition),
|
||||
particle.position());
|
||||
// approximation for electrons: v_e >> v_t
|
||||
if(particle.specie()->type() == species::ImplementedSpecies::electron) {
|
||||
target_velocity_ = CartesianVector(blitz::TinyVector<double, 3>(0,0,0));
|
||||
} else {
|
||||
target_velocity_ = target_->velocityDistribution()->
|
||||
rollVelocity(particle.cylinderPosition(),
|
||||
generator->engine());
|
||||
|
||||
// // if no drift velocity is present, then assume target at rest otherwise
|
||||
// // use the drift velocity
|
||||
if(target_->driftVelocity()) {
|
||||
// auto tmp = target_->driftVelocity()->driftVelocity(particle.position());
|
||||
target_velocity_.add(target_->driftVelocity()->driftVelocity(
|
||||
particle.cartesianPosition(), particle.cylinderPosition()),
|
||||
particle.cartesianPosition());
|
||||
}
|
||||
}
|
||||
|
||||
// target_velocity_ = CartesianVector(blitz::TinyVector<double, 3>(0.,0.,0.));
|
||||
@@ -113,7 +119,7 @@ double Interaction::drawCollisionTime(particle::Particle& particle,
|
||||
|
||||
const double crosssection = microscopicCrossSection(energy_eV);
|
||||
// out << "\ncross section: " << crosssection;
|
||||
const double density = target_->densityField()->density(particle_cylinderPosition);
|
||||
const double density = target_->densityField()->density(particle.cylinderPosition());
|
||||
|
||||
// out << "\ninverse mfp: " << crosssection*density << ", sigma: " << crosssection;
|
||||
// out << ", density: " << density;
|
||||
|
||||
Reference in New Issue
Block a user