Reverted last commit.

Changed powerlaw drawing from left to right
cell for power calculation
This commit is contained in:
2025-06-25 17:50:58 +02:00
parent 87ffe087b8
commit b8a4631676
3 changed files with 23 additions and 16 deletions
+11 -3
View File
@@ -225,11 +225,19 @@ CartesianVector VelocityDistributionFromDensityField::drawVelocity(
// DEBUG(out.str());
// #endif
} else {
double nl = density_field_->particleNumber(index -
blitz::TinyVector<int, 5>(0,0,0,0,1));
double nr = density_field_->particleNumber(index);
// check missing for if nl or nr = 0! -> what alpha to choose?
double nl = density_field_->particleNumber(index);
double nr = density_field_->particleNumber(index+
blitz::TinyVector<int,5>(0,0,0,0,1));
double alpha = std::log(nr/nl)/std::log(energyBinBorders_[index(4) + 2]/
energyBinBorders_[index(4) + 1]);
// no reason for specific values, just to avoid these cases
if(nl == 0) {
alpha = 1;
} else if (nr == 0) {
alpha = -1;
}
if(alpha == -1) {
energy_eV = (std::pow(2, theta_distribution_(*engine)) - 1)*energy_step
+ energyBinBorders_[index(4) + 1];