Removed recalculation of the cross sections
in the interaction step; reuse the ones from the mfp calculation
This commit is contained in:
@@ -40,10 +40,12 @@ class Simulation {
|
||||
std::vector<particle::Particle> determineInjectedParticles(
|
||||
RandomNumbers* random);
|
||||
|
||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random);
|
||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m);
|
||||
|
||||
interaction::InteractionOutput interact(particle::Particle& particle,
|
||||
RandomNumbers* random);
|
||||
RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m);
|
||||
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
||||
tracked_species_;
|
||||
|
||||
@@ -187,8 +187,11 @@ void Simulation::processUntilTermination(
|
||||
auto old_position = particle.position();
|
||||
double old_energy = particle.kineticEnergy_eV();
|
||||
|
||||
std::vector<double> macroscopic_cross_sections_m;
|
||||
|
||||
SimulationTimer::eventStartPoint(std::string("MFP calculation"));
|
||||
const double mfp_m = meanFreePath(particle, random_.get());
|
||||
const double mfp_m = meanFreePath(particle, random_.get(),
|
||||
macroscopic_cross_sections_m);
|
||||
SimulationTimer::eventStopPoint(std::string("MFP calculation"));
|
||||
|
||||
SimulationTimer::eventStartPoint(std::string("Mover"));
|
||||
@@ -243,7 +246,8 @@ void Simulation::processUntilTermination(
|
||||
DEBUG_LEVEL_3(output_ss.str());
|
||||
|
||||
SimulationTimer::eventStartPoint(std::string("Interaction"));
|
||||
interaction::InteractionOutput output = interact(particle, random_.get());
|
||||
interaction::InteractionOutput output = interact(particle, random_.get(),
|
||||
macroscopic_cross_sections_m);
|
||||
SimulationTimer::eventStopPoint(std::string("Interaction"));
|
||||
|
||||
particle.increaseInteractionCounter();
|
||||
@@ -271,11 +275,15 @@ void Simulation::processUntilTermination(
|
||||
}
|
||||
|
||||
double Simulation::meanFreePath(particle::Particle& particle,
|
||||
RandomNumbers* random) {
|
||||
RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m) {
|
||||
double total_macroscopic_cross_section_m = 0.;
|
||||
|
||||
for (auto& interaction : particle.specie()->interactions()) {
|
||||
total_macroscopic_cross_section_m +=
|
||||
interaction->macroscopicCrossSection(particle);
|
||||
double macroscopic_this_interaction = interaction->macroscopicCrossSection(particle);
|
||||
total_macroscopic_cross_section_m += macroscopic_this_interaction;
|
||||
|
||||
macroscopic_cross_sections_m.push_back(macroscopic_this_interaction);
|
||||
}
|
||||
|
||||
if (total_macroscopic_cross_section_m <= 0.) {
|
||||
@@ -292,12 +300,8 @@ double Simulation::meanFreePath(particle::Particle& particle,
|
||||
|
||||
interaction::InteractionOutput Simulation::interact(
|
||||
particle::Particle& particle,
|
||||
RandomNumbers* random) {
|
||||
std::vector<double> macroscopic_cross_sections_m;
|
||||
for (auto& interaction : particle.specie()->interactions()) {
|
||||
macroscopic_cross_sections_m.push_back(
|
||||
interaction->macroscopicCrossSection(particle));
|
||||
}
|
||||
RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m) {
|
||||
const double total_macroscopic_cross_section_m =
|
||||
std::accumulate(macroscopic_cross_sections_m.begin(),
|
||||
macroscopic_cross_sections_m.end(), 0.0);
|
||||
|
||||
Reference in New Issue
Block a user