Energy split drawing implemented;

Debugging output still present, energy split hard coded
This commit is contained in:
2025-02-28 17:13:34 +01:00
parent 62e3c27ba4
commit 51877687b1
10 changed files with 482 additions and 23 deletions
+12 -7
View File
@@ -169,6 +169,8 @@ void Simulation::start() {
timer_->setDeltaT(delta_t);
injector_->initInjectionTimeDistribution(delta_t);
for(auto element: tracked_species_)
injector_->fillParticleNumbers(element.second);
int num_cpu_syncs = 0;
bool reset = true;
@@ -251,6 +253,10 @@ void Simulation::start() {
// the density from which new particles are drawn is only updated after a timestep
pair.second->positionDistributionFromDensity()->setMaximumDensity();
pair.second->positionDistributionFromDensity()
->setMaximumDensityAboveAndBelow(injector_->energySplit());
injector_->fillParticleNumbers(pair.second);
}
leftover_events_time_resolution = beta_decay_events;
@@ -328,6 +334,7 @@ void Simulation::processDensityEvents(int events, const double weight_factor) {
std::map<std::string, double> particleNumbers;
for(auto& pair: tracked_species_) {
particleNumbers[pair.first] = (pair.second->densityForDrawing()->particleNumber());
// injector_->fillParticleNumbers(pair.second);
}
while ((current_event < events) || (!queue_.empty())) {
@@ -550,21 +557,19 @@ std::vector<particle::Particle> Simulation::determineInjectedDensityParticles(
continue;
}
#if defined debug_level3
if (current == 0) {
#if defined debug_level2
// if (current == 0) {
std::stringstream out;
out << pair.second->name();
out << "particle number from density: ";
out << particleNumbers[pair.first];
DEBUG_LEVEL_3(out.str());
}
DEBUG_LEVEL_2(out.str());
// }
#endif
double weight = particleNumbers[pair.first]*weight_factor;
injector_->drawNewParticleFromDensityField(random->engine(),
pair.second, new_particles, magnetic_field_,
weight, injection_time);
weight_factor, injection_time);
}
return new_particles;
}