Minor changes in debug output, added information
to error messages
This commit is contained in:
@@ -85,7 +85,7 @@ EnergyBinning buildEnergyBinning(json_t* object) {
|
|||||||
ASSERT_POSITIVE(&min_energy, "Min Energy must be positive");
|
ASSERT_POSITIVE(&min_energy, "Min Energy must be positive");
|
||||||
double max_energy =
|
double max_energy =
|
||||||
json_read_energy(json_object_by_path(object, {"MaxEnergy"}), "eV");
|
json_read_energy(json_object_by_path(object, {"MaxEnergy"}), "eV");
|
||||||
ASSERT_POSITIVE(&max_energy, "Min Energy must be positive");
|
ASSERT_POSITIVE(&max_energy, "Max Energy must be positive");
|
||||||
|
|
||||||
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
|
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
|
||||||
DEBUG_LEVEL_3("with min energy: " + std::to_string(min_energy));
|
DEBUG_LEVEL_3("with min energy: " + std::to_string(min_energy));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ std::shared_ptr<DriftVelocity> buildDriftVelocityIncludingRedirection(
|
|||||||
std::stringstream cpath;
|
std::stringstream cpath;
|
||||||
if (parameter.jsonObjectFromBase(
|
if (parameter.jsonObjectFromBase(
|
||||||
json_path_append(path_to_drift_velocity, {"CreateSameAs"}))) {
|
json_path_append(path_to_drift_velocity, {"CreateSameAs"}))) {
|
||||||
DEBUG_LEVEL_2("Creating Drift velocity: CreateSameAs.");
|
DEBUG_LEVEL_2("Creating drift velocity: CreateSameAs.");
|
||||||
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
|
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
|
||||||
json_path_append(path_to_drift_velocity, {"CreateSameAs"})));
|
json_path_append(path_to_drift_velocity, {"CreateSameAs"})));
|
||||||
std::stringstream path;
|
std::stringstream path;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ std::shared_ptr<ElectricField> electricField(json_t* object) {
|
|||||||
background = buildVectorField(
|
background = buildVectorField(
|
||||||
json_object_by_path(object, {"Background", "VectorField"}));
|
json_object_by_path(object, {"Background", "VectorField"}));
|
||||||
} else {
|
} else {
|
||||||
ERROR("Can not find background for electric field");
|
ERROR("Can not find background for electric field.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json_object_by_path(object, {"Dynamic"})) {
|
if (json_object_by_path(object, {"Dynamic"})) {
|
||||||
@@ -23,7 +23,7 @@ std::shared_ptr<ElectricField> electricField(json_t* object) {
|
|||||||
dynamic = buildVectorField(
|
dynamic = buildVectorField(
|
||||||
json_object_by_path(object, {"Dynamic", "VectorField"}));
|
json_object_by_path(object, {"Dynamic", "VectorField"}));
|
||||||
} else {
|
} else {
|
||||||
ERROR("Can not find dynamic for electric field");
|
ERROR("Can not find dynamic for electric field.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::shared_ptr<ElectricField>(new ElectricField(background, dynamic));
|
return std::shared_ptr<ElectricField>(new ElectricField(background, dynamic));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
|
|||||||
return std::shared_ptr<EnergyDistributionFunction>(
|
return std::shared_ptr<EnergyDistributionFunction>(
|
||||||
new Constant(constant_eV));
|
new Constant(constant_eV));
|
||||||
}
|
}
|
||||||
ERROR("This Energy Distribution is not implemented");
|
ERROR("This Energy Distribution is not implemented.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ std::shared_ptr<Injector> buildInjector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EventPositionDistribution
|
// EventPositionDistribution
|
||||||
DEBUG_LEVEL_2("Creating event distribution");
|
DEBUG_LEVEL_2("Creating event distribution.");
|
||||||
std::shared_ptr<ScalarField> field = buildScalarField(json_object_by_path(
|
std::shared_ptr<ScalarField> field = buildScalarField(json_object_by_path(
|
||||||
object, {"EventPositionDistribution", "ScalarField"}));
|
object, {"EventPositionDistribution", "ScalarField"}));
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ std::shared_ptr<Injector> buildInjector(
|
|||||||
position_limit_phi, position_limit_z));
|
position_limit_phi, position_limit_z));
|
||||||
|
|
||||||
// MotherDriftVelocity
|
// MotherDriftVelocity
|
||||||
DEBUG_LEVEL_2("Creating mother drift velocity");
|
DEBUG_LEVEL_2("Creating mother drift velocity.");
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity = buildDriftVelocity(
|
std::shared_ptr<DriftVelocity> drift_velocity = buildDriftVelocity(
|
||||||
parameter, json_path_append(path_to_injector, {"MotherDriftVelocity"}));
|
parameter, json_path_append(path_to_injector, {"MotherDriftVelocity"}));
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void addInteractions(
|
|||||||
|
|
||||||
std::string target_name =
|
std::string target_name =
|
||||||
json_string(json_object_by_path(value, {"Target"}));
|
json_string(json_object_by_path(value, {"Target"}));
|
||||||
DEBUG_LEVEL_3("with target" + target_name);
|
DEBUG_LEVEL_3("with target " + target_name);
|
||||||
|
|
||||||
std::shared_ptr<species::Specie> target =
|
std::shared_ptr<species::Specie> target =
|
||||||
findTarget(target_name, tracked_species, background_species);
|
findTarget(target_name, tracked_species, background_species);
|
||||||
@@ -180,7 +180,7 @@ void addInteractions(
|
|||||||
ionization_energy_distribution, scattering_angle_distribution,
|
ionization_energy_distribution, scattering_angle_distribution,
|
||||||
ionization_energy_eV));
|
ionization_energy_eV));
|
||||||
} else {
|
} else {
|
||||||
ERROR("This ionization model is not implemented.");
|
ERROR("This ionization model is not implemented: " + ionization_model);
|
||||||
}
|
}
|
||||||
} else if (type == "Excitation") {
|
} else if (type == "Excitation") {
|
||||||
DEBUG_LEVEL_2("Adding interactions: Excitation");
|
DEBUG_LEVEL_2("Adding interactions: Excitation");
|
||||||
@@ -228,6 +228,7 @@ void addInteractions(
|
|||||||
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
|
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
|
||||||
new interaction::ChargeExchange(cross_section, target)));
|
new interaction::ChargeExchange(cross_section, target)));
|
||||||
} else if (type == "Recombination") {
|
} else if (type == "Recombination") {
|
||||||
|
DEBUG_LEVEL_2("Adding interactions: Recombination");
|
||||||
std::string target_name =
|
std::string target_name =
|
||||||
json_string(json_object_by_path(value, {"Target"}));
|
json_string(json_object_by_path(value, {"Target"}));
|
||||||
std::shared_ptr<species::TrackedSpecie> target =
|
std::shared_ptr<species::TrackedSpecie> target =
|
||||||
@@ -305,7 +306,7 @@ std::function<double(double)> buildTotalCrossSection(json_t* object) {
|
|||||||
json_object_by_path(object, {"ExcitationFunction", "ExcitationState"}));
|
json_object_by_path(object, {"ExcitationFunction", "ExcitationState"}));
|
||||||
return buildExcitationCrossSection(excitation_state);
|
return buildExcitationCrossSection(excitation_state);
|
||||||
} else {
|
} else {
|
||||||
ERROR("This type of cross section is not implemented");
|
ERROR("This type of cross section is not implemented.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,7 +444,7 @@ std::function<double(double)> buildExcitationCrossSection(
|
|||||||
} else {
|
} else {
|
||||||
ERROR(
|
ERROR(
|
||||||
"This type of cross section ExcitationState is not implemented in "
|
"This type of cross section ExcitationState is not implemented in "
|
||||||
"buildExcitationCrossSection.");
|
"buildExcitationCrossSection: " + excitation_state);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,7 +514,7 @@ std::shared_ptr<species::Specie> findTarget(
|
|||||||
} else if (tracked_species.count(target_name)) {
|
} else if (tracked_species.count(target_name)) {
|
||||||
return tracked_species.at(target_name);
|
return tracked_species.at(target_name);
|
||||||
} else {
|
} else {
|
||||||
ERROR("The specified target does not exist.");
|
ERROR("The specified target " + target_name + " does not exist.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -525,7 +526,7 @@ std::shared_ptr<species::TrackedSpecie> findTracked(
|
|||||||
if (tracked_species.count(target_name)) {
|
if (tracked_species.count(target_name)) {
|
||||||
return tracked_species.at(target_name);
|
return tracked_species.at(target_name);
|
||||||
} else {
|
} else {
|
||||||
ERROR("The specified target does not exist.");
|
ERROR("The specified target " + target_name + " does not exist.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object) {
|
|||||||
} else if (type_alias == "cluster_formation") {
|
} else if (type_alias == "cluster_formation") {
|
||||||
used_types.push_back(DeletionType::cluster_formation);
|
used_types.push_back(DeletionType::cluster_formation);
|
||||||
} else {
|
} else {
|
||||||
ERROR("This deletion type is not known");
|
ERROR("This deletion type " + type_alias + " is not known.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ double buildMass(json_t* object) {
|
|||||||
if (SpeciesAlias::isAlias(name)) {
|
if (SpeciesAlias::isAlias(name)) {
|
||||||
return SpeciesMasses::mass(SpeciesAlias::alias(name));
|
return SpeciesMasses::mass(SpeciesAlias::alias(name));
|
||||||
} else {
|
} else {
|
||||||
ERROR("This specie type is not known.");
|
ERROR("The specie type " + name + " is not known.");
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
} else if (json_object_by_path(object, {"value"})) {
|
} else if (json_object_by_path(object, {"value"})) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
|
|||||||
DEBUG_LEVEL_2("Create reflector: NoReflector");
|
DEBUG_LEVEL_2("Create reflector: NoReflector");
|
||||||
return std::shared_ptr<Reflector>(new NoReflector());
|
return std::shared_ptr<Reflector>(new NoReflector());
|
||||||
} else {
|
} else {
|
||||||
ERROR("This reflector is not implemented");
|
ERROR("This reflector is not implemented.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ std::shared_ptr<ScalarField> buildScalarField(json_t* object) {
|
|||||||
json_object_by_path(object, {"ScalarFieldFunctionInZ", "zFunction"}));
|
json_object_by_path(object, {"ScalarFieldFunctionInZ", "zFunction"}));
|
||||||
return std::shared_ptr<ScalarField>(new ScalarFieldFunctionInZ(z_function));
|
return std::shared_ptr<ScalarField>(new ScalarFieldFunctionInZ(z_function));
|
||||||
} else {
|
} else {
|
||||||
ERROR("This scalar field is not implemented");
|
ERROR("This scalar field is not implemented.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|||||||
output->addDensityFieldOutput(task);
|
output->addDensityFieldOutput(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERROR("This species can not be outputted.");
|
ERROR("DensityFields: Species to be outputted have to be "
|
||||||
|
"given as an array or using the keyword \"all\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,7 +85,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|||||||
output->addCurrentBorderOutput(task);
|
output->addCurrentBorderOutput(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERROR("This species can not be outputted.");
|
ERROR("CurrentBorders: Species to be outputted have to be "
|
||||||
|
"given as an array or using the keyword \"all\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +126,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|||||||
output->addDeletionLoggerOutput(task);
|
output->addDeletionLoggerOutput(task);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERROR("This species can not be outputted.");
|
ERROR("DeletionLogger: Species to be outputted have to be "
|
||||||
|
"given as an array or using the keyword \"all\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +143,7 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|||||||
intervall = 1;
|
intervall = 1;
|
||||||
}
|
}
|
||||||
ASSERT_POSITIVE(&intervall,
|
ASSERT_POSITIVE(&intervall,
|
||||||
"The intervall for the potential must be positive");
|
"The intervall for the poisson solver output must be positive");
|
||||||
|
|
||||||
bool overwrite_last = json_bool(
|
bool overwrite_last = json_bool(
|
||||||
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
|
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ void SpeciesBuilder::fillMass() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpeciesBuilder::fillCharge() {
|
void SpeciesBuilder::fillCharge() {
|
||||||
DEBUG_LEVEL_2("Fill charges");
|
DEBUG_LEVEL_2("Fill charges.");
|
||||||
for (auto& b : background_species_info) {
|
for (auto& b : background_species_info) {
|
||||||
b.second.charge_C = SpeciesCharges::charge(b.second.type);
|
b.second.charge_C = SpeciesCharges::charge(b.second.type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Excitation::Excitation(std::function<double(double)> cross_section,
|
|||||||
: Interaction(cross_section, target),
|
: Interaction(cross_section, target),
|
||||||
excitation_energy_eV_(excitation_energy_eV) {
|
excitation_energy_eV_(excitation_energy_eV) {
|
||||||
ASSERT_POSITIVE(&excitation_energy_eV_,
|
ASSERT_POSITIVE(&excitation_energy_eV_,
|
||||||
"The exitationenergy must be positive.");
|
"The exitation energy must be positive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
|
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ InteractionOutput Recombination::performInteraction(
|
|||||||
macroscopic_bin_cross_sections_m.end(), 0.0);
|
macroscopic_bin_cross_sections_m.end(), 0.0);
|
||||||
|
|
||||||
if(total_macroscopic_cross_section_m <= 0.) {
|
if(total_macroscopic_cross_section_m <= 0.) {
|
||||||
ERROR("Total cross section is " + std::to_string(total_macroscopic_cross_section_m) +
|
ERROR("Total cross section is " +
|
||||||
". But recombination was chosen.");
|
std::to_string(total_macroscopic_cross_section_m) +
|
||||||
|
". But recombination was chosen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::discrete_distribution<int> energy_bin_decider(
|
std::discrete_distribution<int> energy_bin_decider(
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
|||||||
potential_(i,j,k) = {BoundaryType::no_boundary, 0.};
|
potential_(i,j,k) = {BoundaryType::no_boundary, 0.};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// include position in output
|
||||||
ERROR("Something went terribly wrong. Position is nowhere.");
|
ERROR("Something went terribly wrong. Position is nowhere.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -246,9 +247,11 @@ blitz::Array<double, 3> PoissonSolver::potential() {
|
|||||||
return potentialValues;
|
return potentialValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
blitz::Array<double, 3> PoissonSolver::interpolateDensityToPotentialGrid(const blitz::Array<double, 3> density) {
|
blitz::Array<double, 3> PoissonSolver::interpolateDensityToPotentialGrid(
|
||||||
if((potential_.extent(0) - 1 != density.extent(0)) || (potential_.extent(1) != density.extent(1))
|
const blitz::Array<double, 3> density) {
|
||||||
|| (potential_.extent(2) - 1 != density.extent(2))) {
|
if((potential_.extent(0) - 1 != density.extent(0)) ||
|
||||||
|
(potential_.extent(1) != density.extent(1)) ||
|
||||||
|
(potential_.extent(2) - 1 != density.extent(2))) {
|
||||||
ERROR("Extent of the cylinder binning and the provided chargedensity do not match.");
|
ERROR("Extent of the cylinder binning and the provided chargedensity do not match.");
|
||||||
}
|
}
|
||||||
//probably include a check for the lowerbound of the provided chargedensity
|
//probably include a check for the lowerbound of the provided chargedensity
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void CpuSynchronizer::sumToAll(long int& value, long int& last_sync_value) {
|
|||||||
|
|
||||||
void CpuSynchronizer::synchronize(Timer* timer, Timer* last_sync_timer) {
|
void CpuSynchronizer::synchronize(Timer* timer, Timer* last_sync_timer) {
|
||||||
if(timer == last_sync_timer) {
|
if(timer == last_sync_timer) {
|
||||||
ERROR("Synchronization of timers cannot work, point to same object");
|
ERROR("Synchronization of timers cannot work, point to same object.");
|
||||||
}
|
}
|
||||||
double time_s = timer->time();
|
double time_s = timer->time();
|
||||||
double last_sync_time_s = last_sync_timer->time();
|
double last_sync_time_s = last_sync_timer->time();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
// probably rename to indicate what type of borders are created
|
||||||
std::vector<double> generateBinBorders(double bin_min,
|
std::vector<double> generateBinBorders(double bin_min,
|
||||||
double bin_max,
|
double bin_max,
|
||||||
int num_bins) {
|
int num_bins) {
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ blitz::Array<double,3> Simulation::chargedensity() {
|
|||||||
std::shared_ptr<species::TrackedSpecie> firstTracked = tracked_species_.begin()->second;
|
std::shared_ptr<species::TrackedSpecie> firstTracked = tracked_species_.begin()->second;
|
||||||
DEBUG_LEVEL_3("shared pointer extracted, key: " + tracked_species_.begin()->first);
|
DEBUG_LEVEL_3("shared pointer extracted, key: " + tracked_species_.begin()->first);
|
||||||
if(!firstTracked)
|
if(!firstTracked)
|
||||||
ERROR("extracted pointer is null");
|
ERROR("Extracted pointer is null.");
|
||||||
blitz::Array<double,3> init = firstTracked->dynamicDensityField()->densityArray();
|
blitz::Array<double,3> init = firstTracked->dynamicDensityField()->densityArray();
|
||||||
blitz::Array<double, 3> chargeden(init.lbound(), init.extent());
|
blitz::Array<double, 3> chargeden(init.lbound(), init.extent());
|
||||||
chargeden = 0.;
|
chargeden = 0.;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ double lengthPrefactor(const std::string& unit) {
|
|||||||
} else if (unit == "mm") {
|
} else if (unit == "mm") {
|
||||||
return 1E-3;
|
return 1E-3;
|
||||||
} else {
|
} else {
|
||||||
ERROR("I dont know this length unit.");
|
ERROR("I dont know this length unit: " + unit);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ double energyPrefactor(const std::string& unit) {
|
|||||||
} else if (unit == "J") {
|
} else if (unit == "J") {
|
||||||
return 1 / SI::e;
|
return 1 / SI::e;
|
||||||
} else {
|
} else {
|
||||||
ERROR("I dont know this energy unit.");
|
ERROR("I dont know this energy unit: " + unit);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user