Files
karl/src/interactions/ionization.cpp
T
csendlinger c9a8b511f9 removed scaling of the ion again, since the
ion only inherits the velocity of the neutral particle
not its energy
2026-02-04 13:48:09 +01:00

200 lines
7.6 KiB
C++
Executable File

#include "interactions/ionization.h"
#include <math.h>
#include "constants/physical_constants.h"
#include "constants/sim_constants.h"
#include "simulation/drift_velocity.h"
#include "simulation/kinematic.h"
#include "simulation/particle.h"
#include "simulation/velocity_distribution.h"
namespace interaction {
ElectronIonization::ElectronIonization(
std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target,
std::shared_ptr<species::TrackedSpecie> electron,
std::shared_ptr<species::TrackedSpecie> ion,
std::shared_ptr<IonizationEnergyDistribution> distribution,
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
double ionization_energy_eV)
: Interaction(cross_section, target),
electron_(electron),
ion_(ion),
energy_distribution_(distribution),
angle_distribution_(angle_distribution),
ionization_energy_eV_(ionization_energy_eV) {}
InteractionOutput ElectronIonization::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
#ifdef debug_level3
DEBUG_LEVEL_3("Perform ionization.");
#endif
const blitz::TinyVector<double, 3> v_impact =
particle.velocity().cartesianEntries();
const auto x_impact = particle.cartesianPosition();
blitz::TinyVector<double, 3> v_target = target_->velocityDistribution()->
rollVelocity(particle.cylinderPosition(),
generator->engine()).cartesianEntries();
if(target_->driftVelocity()) {
v_target += target_->driftVelocity()
->driftVelocity(x_impact, particle.cylinderPosition())
.cartesianEntries();
}
// don't think is quite right, since there is no energy transfer to the ion,
// and in the case of a dissociative event, the energy of the parent particle
// is split between the child particles -> no rescaling required, since
// the neutral child particle also carries some of the energy
// v_target *= std::sqrt(target_->mass_kg()/ion_->mass_kg());
blitz::TinyVector<double, 3> v_laboratory = kinematic::velocityTargetFixed(
v_impact, target_velocity_.cartesianEntries(), particle.mass_kg(), target_->mass_kg()
);
double E_impact = kinematic::kineticEnergy(v_laboratory, particle.mass_kg()) *
UnitConversion::JouleToeV;
// do {
// v_target =
// target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
// target_->velocityDistribution()
// ->rollVelocity(x_impact, generator->engine())
// .cartesianEntries();
// v_laboratory = kinematic::velocityTargetFixed(
// v_impact, v_target, particle.mass_kg(), target_->mass_kg());
// E_impact = kinematic::kineticEnergy(v_laboratory, particle.mass_kg()) *
// UnitConversion::JouleToeV;
// } while (E_impact <= ionization_energy_eV_);
const double E_impact_new =
energy_distribution_->rollImpactParticleEnergyAfterCollision(E_impact,
generator);
const double E_ejected =
std::max(0., E_impact - E_impact_new - ionization_energy_eV_);
const double polar_angle_impact_new = generator->rollUniform(0., 2 * M_PI);
const double polar_angle_ejected = (polar_angle_impact_new - M_PI) < 0.
? (polar_angle_impact_new + M_PI)
: (polar_angle_impact_new - M_PI);
const double azimuth_angle_impact_new =
angle_distribution_->rollAzimuthImpactParticleAfterCollision(
E_impact, E_impact_new, generator);
const double azimuth_angle_ejected =
angle_distribution_->rollAzimuthEjectedParticleAfterCollision(
E_impact, E_ejected, generator);
const double v_lab_impact_new =
kinematic::velocity(E_impact_new, particle.mass_kg());
const double v_lab_ejected =
kinematic::velocity(E_ejected, electron_->mass_kg());
const blitz::TinyVector<double, 3> v_lab_norm =
v_laboratory / kinematic::norm(v_laboratory);
const blitz::TinyVector<double, 3> v_impact_new =
kinematic::rotateVector(v_lab_norm, azimuth_angle_impact_new,
polar_angle_impact_new) *
v_lab_impact_new +
target_velocity_.cartesianEntries();
const blitz::TinyVector<double, 3> v_ejected =
kinematic::rotateVector(v_lab_norm, azimuth_angle_ejected,
polar_angle_ejected) *
v_lab_ejected +
target_velocity_.cartesianEntries();
particle.velocity(v_impact_new);
const double time_birth = particle.timeAlive();
const double weight_parent = particle.weight();
InteractionOutput output;
output.add(
particle::Particle(electron_, x_impact, CartesianVector(v_ejected),
time_birth, weight_parent));
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target),
time_birth, weight_parent));
return output;
}
IonizationEnergyDistribution::IonizationEnergyDistribution(
std::function<double(double, double)> d2_cross_section,
double ionization_energy_eV)
: d2_cross_section_(d2_cross_section),
ionization_energy_eV_(ionization_energy_eV) {}
double IonizationEnergyDistribution::rollImpactParticleEnergyAfterCollision(
double impact_energy,
RandomNumbers* generator) {
// using rejection method:
// assuming cross section is highest at smallest numbers
const double energy_after_min = SimConstants::random_lower_limit;
const double energy_after_max = impact_energy - ionization_energy_eV_;
const double cross_section_min = 0;
const double cross_section_max =
d2_cross_section_(impact_energy, energy_after_min);
double energy_after;
double cross_section;
do {
energy_after = generator->rollUniform(energy_after_min, energy_after_max);
cross_section =
generator->rollUniform(cross_section_min, cross_section_max);
} while (cross_section > d2_cross_section_(impact_energy, energy_after));
// outgoing particles are indistiquishable
energy_after = energy_after > (impact_energy - ionization_energy_eV_) / 2.
? energy_after
: (impact_energy - ionization_energy_eV_) - energy_after;
return energy_after;
}
double
IonizationScatteringAngleDistribution::rollAzimuthImpactParticleAfterCollision(
double impact_energy,
double energy_impact_particle_new,
RandomNumbers* generator) {
// "after Transport of low energy electrons in nitrogen and air" B.Grosswendt,
// E.Waibel
if (energy_impact_particle_new > 100) {
return std::asin(
std::sqrt((energy_impact_particle_new / impact_energy) /
((1 - energy_impact_particle_new / impact_energy) *
(impact_energy / (2 * HEPunits::me)) +
1)));
} else {
return generator->rollUniform(0., M_PI / 4.);
}
}
double
IonizationScatteringAngleDistribution::rollAzimuthEjectedParticleAfterCollision(
double impact_energy,
double energy_impactParticle_new,
RandomNumbers* generator) {
// "after Transport of low energy electrons in nitrogen and air" B.Grosswendt,
// E.Waibel
if (energy_impactParticle_new > 200) {
return std::asin(
std::sqrt((1 - energy_impactParticle_new / impact_energy) /
(1 + energy_impactParticle_new / (2 * HEPunits::me))));
} else if (energy_impactParticle_new >= 50) {
if (generator->rollUniform(0., 1.) < 0.9) {
return generator->rollUniform(M_PI / 4, M_PI / 2);
} else {
return generator->rollUniform(0., M_PI);
}
} else {
return generator->rollUniform(0., M_PI);
}
};
}; // namespace interaction