Many, many more comments

This commit is contained in:
2024-12-04 17:15:04 +01:00
parent 8696517336
commit 03854339ca
100 changed files with 1702 additions and 49 deletions
+18 -5
View File
@@ -24,6 +24,7 @@ InteractionOutput Recombination::performInteraction(
std::vector<double> energyBinBorders = recombination_target_->
dynamicDensityField()->energyBinning()->binBorders();
// calculate the density scaled cross section for each energy bin
if(recombination_target_->type() == species::ImplementedSpecies::electron) {
for (int bin = 0; bin < number_energy_bins - 1; ++bin) {
macroscopic_bin_cross_sections_m.push_back(
@@ -33,14 +34,18 @@ InteractionOutput Recombination::performInteraction(
const blitz::TinyVector<double, 3> v_particle =
particle.velocity().cartesianEntries();
// ion targets need to have a drift velocity defined in the json file
// (a determination is not yet part of the simulation itself)
if(!recombination_target_->driftVelocity()) {
ERROR(recombination_target_->name() + ": does not have a drift velocity!");
}
// drift velocity of the target particle
const blitz::TinyVector<double, 3> v_partner =
recombination_target_->driftVelocity()
->driftVelocity(particle.position()).cartesianEntries();
// velocity of incident particle in the drift frame of the target species
const blitz::TinyVector<double, 3> velocity_target_fixed =
kinematic::velocityTargetFixed(v_particle, v_partner, particle.mass_kg(),
recombination_target_->mass_kg());
@@ -49,7 +54,9 @@ InteractionOutput Recombination::performInteraction(
kinematic::kineticEnergy(velocity_target_fixed, particle.mass_kg()) *
UnitConversion::JouleToeV;
// velocity distribution in the drift frame assumed to be isotropic -> averages out
// so that the density scaled cross section only depends on the kinetic energy
// of the electrons in the drift frame
double energy_eV_bin_center;
for (int bin = 0; bin < number_energy_bins - 1; ++bin) {
energy_eV_bin_center = (energyBinBorders[bin] + energyBinBorders[bin+1])/2.;
@@ -69,18 +76,23 @@ InteractionOutput Recombination::performInteraction(
". But recombination was chosen.");
}
// distribution to choose the energy (bin) of the actual target particle that will
// perform the interaction
std::discrete_distribution<int> energy_bin_decider(
macroscopic_bin_cross_sections_m.begin(),
macroscopic_bin_cross_sections_m.end());
const int energy_bin = energy_bin_decider(*(generator->engine()));
// calculate the energy of the chosen energy bin
const double energy_eV = (energyBinBorders[energy_bin] +
energyBinBorders[energy_bin+1]) / 2.;
// log the deletion in the dynamic density field of the target specie
recombination_target_->dynamicDensityField()->logDeletion(particle.position(),
energy_eV);
InteractionOutput output;
// incident particle is lost
output.deleteCurrentParticle(true);
if (particle.specie()->deletionLogger()) {
@@ -102,13 +114,14 @@ double Recombination::macroscopicCrossSection(particle::Particle& particle) {
}
return macroscopic_cross_section;
}
// if target is not an electron -> cross section independent of Energy of
// the target
// if target is not an electron -> cross section independent of energy of
// the target (electrons are much faster than the ions)
return Interaction::macroscopicCrossSection(particle);
}
// implicitly assumes that the bin index > 0 and < maxBinIndex
// calculates ∫dE_t σ(E_t) dn_t/dE_t (i.e. only applicable if
// cross section is independent of E_i); i: incident, t: target
// calculates ∫dE_t σ(E_t) dn_t/dE_t (only applicable if
// cross section is effectively independent of E_i)
// over the given energy bin; i: incident, t: target
double Recombination::macroscopicCrossSection(const Coordinate& position,
const int energy_bin_index) {
if (energy_bin_index > recombination_target_->dynamicDensityField()