Fixed to state that drawing from density works.
Some debugging elements not removed.
This commit is contained in:
@@ -186,8 +186,9 @@ void DriftMover::move(particle::Particle* particle,
|
||||
bool left_simulation_domain = false;
|
||||
// if particle too slow -> timestep > maximum time the particle lives
|
||||
// -> add maximal timestep to time in bin and stop moving the particle
|
||||
bool died_in_bin = false;
|
||||
const double max_time_alive =
|
||||
bool died_in_bin = false;
|
||||
// DEBUG_LEVEL_3("Mover: timealive before moving: " + std::to_string(particle->timeAlive()));
|
||||
double max_time_alive =
|
||||
particle->specie()->dynamicDensityField()->physicalTime() -
|
||||
particle->timeAlive();
|
||||
|
||||
@@ -308,6 +309,22 @@ void DriftMover::move(particle::Particle* particle,
|
||||
|
||||
particle->increaseTimeAlive(timestep);
|
||||
particle->increaseTimeInBin(timestep);
|
||||
// if instead of eps*deltaT 0.0 is used the integral would be conserved if no particles were lost
|
||||
// however in that case the terminator does not return the correct value if the time the
|
||||
// particle is alive is identical to the physical time... -> increases computation time alot
|
||||
// The version below means that each timestep the density can grow by (at most) a factor
|
||||
// of (1 + eps) (if no particles are lost)
|
||||
// TODO:
|
||||
// - check if it's not better to change the terminator such that is uses the
|
||||
// compare function from /include/simulation/compare.h
|
||||
max_time_alive = ((max_time_alive - timestep) <= 0)
|
||||
? particle->specie()->dynamicDensityField()
|
||||
->timeResolution()*SimConstants::compare_epsilon
|
||||
: (max_time_alive - timestep);
|
||||
if (max_time_alive == 0) {
|
||||
DEBUG_LEVEL_3("Mover: max_time_alive is 0.");
|
||||
DEBUG_LEVEL_3("Mover: particle time alive: " + std::to_string(particle->timeAlive()));
|
||||
}
|
||||
|
||||
const auto new_position = particle->position();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user