Corrections in the comments;

Small code fixes
This commit is contained in:
2024-12-18 15:07:19 +01:00
parent 903423da61
commit 0902d3d7ac
5 changed files with 13 additions and 8 deletions
@@ -19,7 +19,7 @@ namespace generator {
// if "DirectedDistribution" is specified:
// - has to include a json-object "EnergyDistributionFunction" as defined in "generators/energy_distribtion_function_generator.h"
// - has to include a json-object "Mass" as defined in "generators/mass_generator.h"
// - has to include a json-array of size 3, defining the direction in cartesian coordinates (x,y,z)
// - has to include a json-object "Direction", including a json-array "vector" containing the direction in cartesian coordinates
// - returns a DirectedDistribution object (see simulation/energy_distribtion.h)
//
// (example in "simulation_config/velocity_distribution_function_examples.json")
+3 -3
View File
@@ -63,9 +63,9 @@ inline bool json_bool(json_t* object, bool default_value = false) {
}
}
// returns a blitz::TinyVector<double, s> with the values from a json_t pointer which points to
// a json-array; if the json_t pointer is not an array or the array has a different size than
// the specified template parameter s an error is thrown and the execution of the program terminated
// return the json-array "vector" in the given json-object object as a blitz::TinyVector
// if the "vector" json-array does not exist or does not contain the same number of elements as
// specified in the template parameter s an error is thrown
template <int s>
blitz::TinyVector<double, s> json_blitz_vector(json_t* object) {
blitz::TinyVector<double, s> vector;
@@ -24,7 +24,11 @@ std::shared_ptr<VelocityDistribution> buildVelocityDistribution(
DEBUG_LEVEL_2("Creating velocity distribution: null");
return nullptr;
} else {
ERROR("This velocity distribution is not implemented.");
std::string path = "";
for(auto element : path_to_distribution) {
path += element;
}
ERROR("This velocity distribution is not implemented: " + path);
return nullptr;
}
}
+3 -2
View File
@@ -216,8 +216,9 @@ void DriftMover::move(particle::Particle* particle,
const blitz::TinyVector<double, 3> dv_electric =
timestep * particle->charge_C() * E_parallel / particle->mass_kg();
// check if the particle has a gyroradius > 0
if (v_perp_norm > SimConstants::compare_epsilon) {
// if the angle between v and B < epsilon, consider the movement as
// if it had a gyroradius of 0
if (v_perp_norm/v_parallel_norm > SimConstants::compare_epsilon) {
const double gyro_radius = particle->mass_kg() * v_perp_norm /
(B_norm * particle->charge_C());
+1 -1
View File
@@ -296,7 +296,7 @@ double Simulation::meanFreePath(particle::Particle& particle,
if (rnd_number <= 0) {
return std::numeric_limits<double>::max();
} else {
return 1. / total_macroscopic_cross_section_m * log(1. / rnd_number);
return - 1. / total_macroscopic_cross_section_m * log(rnd_number);
}
}
}