Included possibility for electron as
target for recombination; Added energy dependent deletions in recombination
This commit is contained in:
@@ -13,7 +13,10 @@ class Recombination : public Interaction {
|
|||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
InteractionOutput performInteraction(particle::Particle& particle,
|
||||||
RandomNumbers* generator);
|
RandomNumbers* generator);
|
||||||
|
|
||||||
|
double macroscopicCrossSection(particle::Particle& particle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
double macroscopicCrossSection(const Coordinate& position, const int bin_index);
|
||||||
std::shared_ptr<species::TrackedSpecie> recombination_target_;
|
std::shared_ptr<species::TrackedSpecie> recombination_target_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
#include "simulation/density_field.h"
|
#include "simulation/density_field.h"
|
||||||
#include "simulation/logger.h"
|
#include "simulation/logger.h"
|
||||||
|
#include "simulation/species.h"
|
||||||
|
#include "simulation/kinematic.h"
|
||||||
|
#include "constants/physical_constants.h"
|
||||||
|
#include "simulation/drift_velocity.h"
|
||||||
|
|
||||||
namespace interaction {
|
namespace interaction {
|
||||||
|
|
||||||
@@ -14,8 +18,65 @@ InteractionOutput Recombination::performInteraction(
|
|||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
DEBUG_LEVEL_3("Perform recombination.");
|
DEBUG_LEVEL_3("Perform recombination.");
|
||||||
|
|
||||||
// energy dependent deletions in the future
|
std::vector<double> macroscopic_bin_cross_sections_m;
|
||||||
const double energy_eV = 0.;
|
const int number_energy_bins = recombination_target_->dynamicDensityField()
|
||||||
|
->energyBinning()->binIndexMax();
|
||||||
|
std::vector<double> energyBinBorders = recombination_target_->
|
||||||
|
dynamicDensityField()->energyBinning()->binBorders();
|
||||||
|
|
||||||
|
if(recombination_target_->type() == species::ImplementedSpecies::electron) {
|
||||||
|
for (int bin = 0; bin < number_energy_bins - 1; ++bin) {
|
||||||
|
macroscopic_bin_cross_sections_m.push_back(
|
||||||
|
macroscopicCrossSection(particle.position(), bin));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const blitz::TinyVector<double, 3> v_particle =
|
||||||
|
particle.velocity().cartesianEntries();
|
||||||
|
|
||||||
|
if(!recombination_target_->driftVelocity()) {
|
||||||
|
ERROR(recombination_target_->name() + ": does not have a drift velocity!");
|
||||||
|
}
|
||||||
|
|
||||||
|
const blitz::TinyVector<double, 3> v_partner =
|
||||||
|
recombination_target_->driftVelocity()
|
||||||
|
->driftVelocity(particle.position()).cartesianEntries();
|
||||||
|
|
||||||
|
const blitz::TinyVector<double, 3> velocity_target_fixed =
|
||||||
|
kinematic::velocityTargetFixed(v_particle, v_partner, particle.mass_kg(),
|
||||||
|
recombination_target_->mass_kg());
|
||||||
|
|
||||||
|
const double kinetic_energy_eV =
|
||||||
|
kinematic::kineticEnergy(velocity_target_fixed, particle.mass_kg()) *
|
||||||
|
UnitConversion::JouleToeV;
|
||||||
|
|
||||||
|
|
||||||
|
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.;
|
||||||
|
macroscopic_bin_cross_sections_m.push_back(
|
||||||
|
microscopicCrossSection(kinetic_energy_eV) *
|
||||||
|
recombination_target_->dynamicDensityField()
|
||||||
|
->density(particle.position(), energy_eV_bin_center));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const double total_macroscopic_cross_section_m =
|
||||||
|
std::accumulate(macroscopic_bin_cross_sections_m.begin(),
|
||||||
|
macroscopic_bin_cross_sections_m.end(), 0.0);
|
||||||
|
|
||||||
|
if(total_macroscopic_cross_section_m <= 0.) {
|
||||||
|
ERROR("Total cross section is " + std::to_string(total_macroscopic_cross_section_m) +
|
||||||
|
". But recombination was chosen.");
|
||||||
|
}
|
||||||
|
|
||||||
|
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()));
|
||||||
|
const double energy_eV = (energyBinBorders[energy_bin] +
|
||||||
|
energyBinBorders[energy_bin+1]) / 2.;
|
||||||
|
|
||||||
recombination_target_->dynamicDensityField()->logDeletion(particle.position(),
|
recombination_target_->dynamicDensityField()->logDeletion(particle.position(),
|
||||||
energy_eV);
|
energy_eV);
|
||||||
|
|
||||||
@@ -30,4 +91,46 @@ InteractionOutput Recombination::performInteraction(
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Recombination::macroscopicCrossSection(particle::Particle& particle) {
|
||||||
|
if(recombination_target_->type() == species::ImplementedSpecies::electron) {
|
||||||
|
const int numBins = recombination_target_->dynamicDensityField()->
|
||||||
|
energyBinning()->binIndexMax();
|
||||||
|
double macroscopic_cross_section = 0.;
|
||||||
|
const auto position = particle.position();
|
||||||
|
for (int bin = 0; bin < numBins - 1; ++bin) {
|
||||||
|
macroscopic_cross_section += macroscopicCrossSection(position, bin);
|
||||||
|
}
|
||||||
|
return macroscopic_cross_section;
|
||||||
|
}
|
||||||
|
// if target is not an electron -> cross section independent of Energy of
|
||||||
|
// the target
|
||||||
|
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
|
||||||
|
double Recombination::macroscopicCrossSection(const Coordinate& position,
|
||||||
|
const int energy_bin_index) {
|
||||||
|
if (energy_bin_index > recombination_target_->dynamicDensityField()
|
||||||
|
->energyBinning()->binIndexMax()) {
|
||||||
|
return 0.;
|
||||||
|
}
|
||||||
|
const double lower_bound = recombination_target_->dynamicDensityField()
|
||||||
|
->energyBinning()->binBorders()[energy_bin_index];
|
||||||
|
const double upper_bound = recombination_target_->dynamicDensityField()
|
||||||
|
->energyBinning()->binBorders()[energy_bin_index + 1];
|
||||||
|
const double intermediate_value = (upper_bound + lower_bound)/2.;
|
||||||
|
const double differential_density_value = recombination_target_->
|
||||||
|
dynamicDensityField()->density(position, intermediate_value) /
|
||||||
|
(upper_bound - lower_bound);
|
||||||
|
//Simpson's rule
|
||||||
|
const double integrated_microscopic_cross_section =
|
||||||
|
(upper_bound - lower_bound)/6. *
|
||||||
|
(microscopicCrossSection(upper_bound) +
|
||||||
|
4*microscopicCrossSection(intermediate_value) +
|
||||||
|
microscopicCrossSection(lower_bound));
|
||||||
|
// assumption, that the differential density is constant within a cell
|
||||||
|
return differential_density_value * integrated_microscopic_cross_section;
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace interaction
|
}; // namespace interaction
|
||||||
@@ -31,10 +31,15 @@ Interaction::Interaction(std::function<double(double)> cross_section,
|
|||||||
std::shared_ptr<species::Specie> target)
|
std::shared_ptr<species::Specie> target)
|
||||||
: cross_section_(cross_section), target_(target) {}
|
: cross_section_(cross_section), target_(target) {}
|
||||||
|
|
||||||
|
// assumes that v_particle >> v_target
|
||||||
double Interaction::macroscopicCrossSection(particle::Particle& particle) {
|
double Interaction::macroscopicCrossSection(particle::Particle& particle) {
|
||||||
const auto x_particle = particle.position();
|
const auto x_particle = particle.position();
|
||||||
const blitz::TinyVector<double, 3> v_particle =
|
const blitz::TinyVector<double, 3> v_particle =
|
||||||
particle.velocity().cartesianEntries();
|
particle.velocity().cartesianEntries();
|
||||||
|
if(!target_->driftVelocity()) {
|
||||||
|
ERROR(target_->name() + ": does not have a drift velocity!");
|
||||||
|
}
|
||||||
|
|
||||||
const blitz::TinyVector<double, 3> v_partner =
|
const blitz::TinyVector<double, 3> v_partner =
|
||||||
target_->driftVelocity()->driftVelocity(x_particle).cartesianEntries();
|
target_->driftVelocity()->driftVelocity(x_particle).cartesianEntries();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user