Applied correction to cluster formation

from karl_paper
This commit is contained in:
2025-09-09 10:42:17 +02:00
parent bea8751f1d
commit c57dd44dde
9 changed files with 69 additions and 31 deletions
+7 -21
View File
@@ -53,16 +53,19 @@ double Interaction::macroscopicCrossSection(particle::Particle& particle) {
UnitConversion::JouleToeV;
const double density = target_->densityField()->density(x_particle);
const double cross_section = microscopicCrossSection(kinetic_energy_eV);
const double cross_section = microscopicCrossSection(kinetic_energy_eV,
particle.cylinderPosition());
return cross_section * density;
};
double Interaction::microscopicCrossSection(double energy_eV) {
double Interaction::microscopicCrossSection(double energy_eV,
const Coordinate& position) {
return cross_section_(energy_eV);
}
// think i need to include the magnetic field for it to be really correct
// also sets the velocity of the interaction partner
double Interaction::drawCollisionTime(particle::Particle& particle,
RandomNumbers* generator) {
CartesianVector particle_velocity = particle.velocity();
@@ -94,13 +97,6 @@ double Interaction::drawCollisionTime(particle::Particle& particle,
const double relative_velocity = kinematic::norm(velocity_target_fixed);
// std::stringstream out;
// out << "particle "<< particle.specie()->name() <<" velocity: "
// << particle_velocity.cartesianEntries();
// out << "\ntarget "<< target_->name() <<" velocity: "
// << target_velocity_.cartesianEntries();
// out << "\nabsolute relative velocity: " << relative_velocity;
// check if the relative velocity is smaller than an epsilon compared to the larger
// of the two present velocities (to avoid division by 0 if either is 0) probably
// a better version possible
@@ -115,15 +111,10 @@ double Interaction::drawCollisionTime(particle::Particle& particle,
kinematic::kineticEnergy(velocity_target_fixed, particle.mass_kg())*
UnitConversion::JouleToeV;
// out << "energy collision time: " << energy_eV;
const double crosssection = microscopicCrossSection(energy_eV);
// out << "\ncross section: " << crosssection;
const double crosssection = microscopicCrossSection(energy_eV,
particle.cylinderPosition());
const double density = target_->densityField()->density(particle.cylinderPosition());
// out << "\ninverse mfp: " << crosssection*density << ", sigma: " << crosssection;
// out << ", density: " << density;
const double random_number = generator->rollUniform(0.,1.);
if (random_number == 0) {
return std::numeric_limits<double>::max();
@@ -132,12 +123,7 @@ double Interaction::drawCollisionTime(particle::Particle& particle,
const double distance_target_fixed =
- 1./(crosssection * density) * log(random_number);
// out << "\ndistance in target fixed frame: " << distance_target_fixed;
const double time = distance_target_fixed / relative_velocity;
// out << "\ntime before collision: " << time;
// if(density != 0)
// DEBUG_LEVEL_1(out.str());
return time;
}