Changed density calculation to only log particle
in the bin its movement ends; timestep changed to double
This commit is contained in:
@@ -39,8 +39,8 @@ class DynamicDensityField : public DensityField {
|
||||
|
||||
void logMovement(const Coordinate& position,
|
||||
double energy_eV,
|
||||
double pitch_angle,
|
||||
double time_in_bin_s);
|
||||
double pitch_angle,
|
||||
double weight);
|
||||
|
||||
void logDeletion(const Coordinate& position,
|
||||
double energy_eV,
|
||||
|
||||
@@ -131,7 +131,7 @@ double DynamicDensityField::density(const Coordinate& position) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
// const double t = timer_->getDeltaT();
|
||||
const double time_in_bin = blitz::sum(time_in_bin_s_(
|
||||
position_bin(0), position_bin(1), position_bin(2),
|
||||
blitz::Range::all(), blitz::Range::all()));
|
||||
@@ -139,7 +139,7 @@ double DynamicDensityField::density(const Coordinate& position) {
|
||||
position_bin(0), position_bin(1), position_bin(2),
|
||||
blitz::Range::all(), blitz::Range::all()));
|
||||
|
||||
return (time_in_bin / t - deleted_particles) /
|
||||
return (time_in_bin - deleted_particles) /
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ double DynamicDensityField::density(const Coordinate& position,
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const int energy_bin = energy_binning_.bin(energy_eV);
|
||||
const double t = timer_->getDeltaT();
|
||||
// const double t = timer_->getDeltaT();
|
||||
const double time_in_bin = blitz::sum(time_in_bin_s_(
|
||||
position_bin(0), position_bin(1), position_bin(2),
|
||||
blitz::Range::all(), energy_bin));
|
||||
@@ -157,7 +157,7 @@ double DynamicDensityField::density(const Coordinate& position,
|
||||
position_bin(0), position_bin(1), position_bin(2),
|
||||
blitz::Range::all(), energy_bin));
|
||||
|
||||
return (time_in_bin / t - deleted_particles) /
|
||||
return (time_in_bin - deleted_particles) /
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ bool DynamicDensityField::changedPitchAngleBin(double old_mu,
|
||||
void DynamicDensityField::logMovement(const Coordinate& position,
|
||||
double energy_eV,
|
||||
double pitch_angle,
|
||||
double time_in_bin_s) {
|
||||
double weight) {
|
||||
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
@@ -207,7 +207,7 @@ void DynamicDensityField::logMovement(const Coordinate& position,
|
||||
const int pitch_angle_bin = pitch_angle_binning_.bin(pitch_angle);
|
||||
|
||||
time_in_bin_s_(position_bin(0), position_bin(1), position_bin(2),
|
||||
pitch_angle_bin, energy_bin) += time_in_bin_s;
|
||||
pitch_angle_bin, energy_bin) += weight;
|
||||
}
|
||||
|
||||
void DynamicDensityField::logDeletion(const Coordinate& position,
|
||||
@@ -287,14 +287,14 @@ void DynamicDensityField::recalculateDensityArray() {
|
||||
blitz::fourthIndex ipitch;
|
||||
blitz::fifthIndex iE;
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
// const double t = timer_->getDeltaT();
|
||||
|
||||
// reduction only seems to work for the last dimension (iE)
|
||||
// -> first reorder (by exchanging iE and ipitch) and afterwards doing
|
||||
// the reduction over iE (which now contains the pitch dimension)
|
||||
// blitz::Array<double, 5> temp((time_in_bin_s_(ir, iphi, iz, ipitch, iE)));
|
||||
|
||||
density_per_m3_ = blitz::sum((time_in_bin_s_(ir, iphi, iz, iE, ipitch) / t -
|
||||
density_per_m3_ = blitz::sum((time_in_bin_s_(ir, iphi, iz, iE, ipitch) -
|
||||
deleted_particles_(ir, iphi, iz, iE, ipitch)), iE) /
|
||||
bin_volume_m3_(ir, iphi, iz);
|
||||
// SimulationTimer::eventStopPoint("recalcDensityArray");
|
||||
|
||||
@@ -145,9 +145,9 @@ void BorisMover::move(particle::Particle* particle,
|
||||
? delta_timeresolution*SimConstants::compare_epsilon
|
||||
: (max_time_alive - timestep);
|
||||
}
|
||||
|
||||
particle->specie()->dynamicDensityField()->logMovement(
|
||||
old_position, old_kinetic_energy, old_mu, particle->timeInBin());
|
||||
if(died_in_bin)
|
||||
particle->specie()->dynamicDensityField()->logMovement(
|
||||
old_position, old_kinetic_energy, old_mu, particle->weight());
|
||||
particle->resetTimeInBin();
|
||||
particle->specie()->currentCollector()->collect(particle, old_position);
|
||||
}
|
||||
@@ -455,10 +455,11 @@ void DriftMover::move(particle::Particle* particle,
|
||||
leftover_distance -= stepsize;
|
||||
}
|
||||
|
||||
// particle->specie()->dynamicDensityField()->logMovement(
|
||||
// old_position, old_kinetic_energy, particle->timeInBin());
|
||||
particle->specie()->dynamicDensityField()->logMovement(
|
||||
old_position, old_kinetic_energy, old_mu, particle->timeInBin());
|
||||
// only log a particle in the bin where its movement ends, i.e. if
|
||||
// the particle reached the end of the timestep
|
||||
if(died_in_bin)
|
||||
particle->specie()->dynamicDensityField()->logMovement(
|
||||
old_position, old_kinetic_energy, old_mu, particle->weight());
|
||||
particle->resetTimeInBin();
|
||||
particle->specie()->currentCollector()->collect(particle, old_position);
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ void Simulation::start() {
|
||||
|
||||
// number of physical beta events defining the timescale through
|
||||
// time_resolution_events/Activity
|
||||
const int time_resolution_events =
|
||||
parameter_.intValue(json_path({"Simulation", "TimeResolutionEvents"}),
|
||||
const double time_resolution_events =
|
||||
parameter_.doubleValue(json_path({"Simulation", "TimeResolutionEvents"}),
|
||||
MpiCommunication::mpiSize());
|
||||
|
||||
// number of beta decay events per timestep and CPU (will get normalized s.t.
|
||||
|
||||
Reference in New Issue
Block a user