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
+3 -3
View File
@@ -161,9 +161,9 @@ void BorisMover::move(particle::Particle* particle,
? delta_timeresolution*SimConstants::compare_epsilon
: (max_time_alive - timestep);
}
if(died_in_bin && !left_simulation_domain
&& (leftover_time > SimConstants::compare_epsilon ||
changed_energy_bin || changed_mu_bin || changed_position_bin)) {
if(died_in_bin && !left_simulation_domain) {
// && (leftover_time > SimConstants::compare_epsilon ||
// changed_energy_bin || changed_mu_bin || changed_position_bin)) {
// use new values, since that is necessary if died_in_bin and a change in
// bin can occur at the same time
particle->specie()->dynamicDensityField()->logMovement(
+9 -10
View File
@@ -498,8 +498,7 @@ void Simulation::processUntilTermination(
if (particle.specie()->terminator()->reachedMaxTimeAlive(
&particle) &&
!particle.specie()->terminator()->leftSimulationDomain(
&particle) &&
particle.wasDeposited()) {
&particle)) {
#ifdef debug_level3
DEBUG_LEVEL_3("Terminate particle " + particle.specie()->name() +
". Reached timeresolution.");
@@ -574,14 +573,14 @@ void Simulation::processUntilTermination(
// in order to log the position. (Not ideal, but otherwise it would be a bit
// more effort to calculate the pitchangle here again...)
// should work, since the check for died in bin should immediatly happen (hopefully)
if(particle.specie()->terminator()->reachedMaxTimeAlive(&particle)
&& !particle.wasDeposited() && !output.deleteCurrentParticle()) {
particle.specie()->mover()->move(&particle, 1,
electric_field_.get(), magnetic_field_.get(), gravity_field_.get());
if(!particle.wasDeposited()) {
ERROR("particle was not deposited even though it should have been");
}
}
// if(particle.specie()->terminator()->reachedMaxTimeAlive(&particle)
// && !particle.wasDeposited() && !output.deleteCurrentParticle()) {
// particle.specie()->mover()->move(&particle, 1,
// electric_field_.get(), magnetic_field_.get(), gravity_field_.get());
// if(!particle.wasDeposited()) {
// ERROR("particle was not deposited even though it should have been");
// }
// }
particle.increaseInteractionCounter();
+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];