Changed density calculation to only log particle
in the bin its movement ends; timestep changed to double
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user