Added more deletionLogger elements (for debugging)
This commit is contained in:
@@ -10,7 +10,12 @@ enum class DeletionType {
|
|||||||
recombination,
|
recombination,
|
||||||
max_interactions,
|
max_interactions,
|
||||||
max_time_alive,
|
max_time_alive,
|
||||||
cluster_formation
|
cluster_formation,
|
||||||
|
creation_beta,
|
||||||
|
creation_density,
|
||||||
|
creation_interaction,
|
||||||
|
creation_above_2keV,
|
||||||
|
loss_above_2keV
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeletionLogger {
|
class DeletionLogger {
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void Hdf5Writer::write(const blitz::Array<float, 5>& data, std::string path) {
|
|||||||
// turn error report back onby hdf5 because of check H5Dopen2
|
// turn error report back onby hdf5 because of check H5Dopen2
|
||||||
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
|
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
|
||||||
|
|
||||||
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, filespace, H5P_DEFAULT,
|
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, filespace, H5P_DEFAULT,
|
||||||
data.data());
|
data.data());
|
||||||
|
|
||||||
H5Dclose(dataset);
|
H5Dclose(dataset);
|
||||||
|
|||||||
@@ -242,6 +242,16 @@ void SimulationOutput::writeNumDeletions(DeletionLogger* logger,
|
|||||||
writer.write(pair.second, path_to_deletions + "/MaxTimeAlive");
|
writer.write(pair.second, path_to_deletions + "/MaxTimeAlive");
|
||||||
} else if (pair.first == DeletionType::cluster_formation) {
|
} else if (pair.first == DeletionType::cluster_formation) {
|
||||||
writer.write(pair.second, path_to_deletions + "/ClusterFormation");
|
writer.write(pair.second, path_to_deletions + "/ClusterFormation");
|
||||||
|
} else if (pair.first == DeletionType::creation_beta) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/CreationBeta");
|
||||||
|
} else if (pair.first == DeletionType::creation_density) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/CreationDensity");
|
||||||
|
} else if (pair.first == DeletionType::creation_interaction) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/CreationInteraction");
|
||||||
|
} else if (pair.first == DeletionType::creation_above_2keV) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/CreationAbove2keV");
|
||||||
|
} else if (pair.first == DeletionType::loss_above_2keV) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/LossAbove2keV");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object) {
|
|||||||
used_types.push_back(DeletionType::max_interactions);
|
used_types.push_back(DeletionType::max_interactions);
|
||||||
used_types.push_back(DeletionType::max_time_alive);
|
used_types.push_back(DeletionType::max_time_alive);
|
||||||
used_types.push_back(DeletionType::cluster_formation);
|
used_types.push_back(DeletionType::cluster_formation);
|
||||||
|
// Debugging types, not yet able to be specified on their own, just
|
||||||
|
// in when "all" is used
|
||||||
|
used_types.push_back(DeletionType::creation_beta);
|
||||||
|
used_types.push_back(DeletionType::creation_density);
|
||||||
|
used_types.push_back(DeletionType::creation_interaction);
|
||||||
|
used_types.push_back(DeletionType::creation_above_2keV);
|
||||||
|
used_types.push_back(DeletionType::loss_above_2keV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ InteractionOutput ClusterFormation::performInteraction(
|
|||||||
x_impact, DeletionType::cluster_formation);
|
x_impact, DeletionType::cluster_formation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
product_->deletionLogger()->logDeletion(x_impact, DeletionType::creation_interaction);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "simulation/kinematic.h"
|
#include "simulation/kinematic.h"
|
||||||
#include "simulation/particle.h"
|
#include "simulation/particle.h"
|
||||||
#include "simulation/velocity_distribution.h"
|
#include "simulation/velocity_distribution.h"
|
||||||
|
#include "simulation/logger.h"
|
||||||
|
|
||||||
namespace interaction {
|
namespace interaction {
|
||||||
|
|
||||||
@@ -117,6 +118,10 @@ InteractionOutput ElectronIonization::performInteraction(
|
|||||||
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target),
|
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target),
|
||||||
time_birth, weight_parent));
|
time_birth, weight_parent));
|
||||||
|
|
||||||
|
ion_->deletionLogger()->logDeletion(x_impact, DeletionType::creation_interaction);
|
||||||
|
electron_->deletionLogger()
|
||||||
|
->logDeletion(x_impact, DeletionType::creation_interaction);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "simulation/velocity_distribution.h"
|
#include "simulation/velocity_distribution.h"
|
||||||
#include "simulation/electromagnetic_field.h"
|
#include "simulation/electromagnetic_field.h"
|
||||||
#include "simulation/random_numbers.h"
|
#include "simulation/random_numbers.h"
|
||||||
|
#include "simulation/logger.h"
|
||||||
|
#include "constants/physical_constants.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
Injector::Injector(
|
Injector::Injector(
|
||||||
@@ -48,6 +50,12 @@ particle::Particle Injector::rollNewParticle(
|
|||||||
DEBUG_LEVEL_3(out.str());
|
DEBUG_LEVEL_3(out.str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
created_specie->deletionLogger()->logDeletion(position, DeletionType::creation_beta);
|
||||||
|
if(kinematic::kineticEnergy(velocity, created_specie->mass_kg())
|
||||||
|
*UnitConversion::JouleToeV > 2000) {
|
||||||
|
created_specie->deletionLogger()->logDeletion(position, DeletionType::creation_above_2keV);
|
||||||
|
}
|
||||||
|
|
||||||
return particle::Particle(created_specie, position,
|
return particle::Particle(created_specie, position,
|
||||||
CartesianVector(velocity), time_birth, weight);
|
CartesianVector(velocity), time_birth, weight);
|
||||||
}
|
}
|
||||||
@@ -135,7 +143,11 @@ void Injector::drawNewParticleFromDensityField(std::mt19937* engine,
|
|||||||
|
|
||||||
particle::Particle drawn_particle(specie, position,
|
particle::Particle drawn_particle(specie, position,
|
||||||
velocity, injection_time, weight_factor*num_part_in_bin);
|
velocity, injection_time, weight_factor*num_part_in_bin);
|
||||||
|
// debugging
|
||||||
|
specie->deletionLogger()->logDeletion(position, DeletionType::creation_density);
|
||||||
|
if(drawn_particle.kineticEnergy_eV() > 2000) {
|
||||||
|
specie->deletionLogger()->logDeletion(position, DeletionType::creation_above_2keV);
|
||||||
|
}
|
||||||
queue.push_back(drawn_particle);
|
queue.push_back(drawn_particle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void RandomIndex::reshuffle(std::mt19937* engine) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RandomIndex::visited_all() {
|
bool RandomIndex::visited_all() {
|
||||||
return current_index_in_vector_ == total_bin_number_ - 1;
|
return current_index_in_vector_ == total_bin_number_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the next index in the shuffled index vector. Returns the last
|
// return the next index in the shuffled index vector. Returns the last
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ void Simulation::start() {
|
|||||||
|
|
||||||
// process both density and beta events before a cpu synchronization
|
// process both density and beta events before a cpu synchronization
|
||||||
processDensityEvents(particles_per_bin, density_weight_factor);
|
processDensityEvents(particles_per_bin, density_weight_factor);
|
||||||
|
if(num_cpu_syncs == 0)
|
||||||
processEvents(events_of_cycle, beta_particle_weight);
|
processEvents(events_of_cycle, beta_particle_weight);
|
||||||
|
|
||||||
#ifdef debug_level1
|
#ifdef debug_level1
|
||||||
@@ -479,6 +480,10 @@ void Simulation::processUntilTermination(
|
|||||||
if(particle.specie()->deletionLogger()) {
|
if(particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
||||||
DeletionType::max_time_alive);
|
DeletionType::max_time_alive);
|
||||||
|
if(particle.kineticEnergy_eV() > 2000) {
|
||||||
|
particle.specie()->deletionLogger()->logDeletion(particle.cartesianPosition(),
|
||||||
|
DeletionType::loss_above_2keV);
|
||||||
|
}
|
||||||
#ifdef debug
|
#ifdef debug
|
||||||
if(!particle.wasDeposited()) {
|
if(!particle.wasDeposited()) {
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
@@ -503,6 +508,10 @@ void Simulation::processUntilTermination(
|
|||||||
if (particle.specie()->deletionLogger()) {
|
if (particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
||||||
DeletionType::wall);
|
DeletionType::wall);
|
||||||
|
if(particle.kineticEnergy_eV() > 2000) {
|
||||||
|
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
||||||
|
DeletionType::loss_above_2keV);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef debug
|
#ifdef debug
|
||||||
if(particle.wasDeposited()) {
|
if(particle.wasDeposited()) {
|
||||||
@@ -558,6 +567,10 @@ void Simulation::processUntilTermination(
|
|||||||
if (particle.specie()->deletionLogger()) {
|
if (particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(
|
particle.specie()->deletionLogger()->logDeletion(
|
||||||
particle.cylinderPosition(), DeletionType::max_interactions);
|
particle.cylinderPosition(), DeletionType::max_interactions);
|
||||||
|
if(particle.kineticEnergy_eV() > 2000) {
|
||||||
|
particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(),
|
||||||
|
DeletionType::loss_above_2keV);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user