fix in density calculation
This commit is contained in:
@@ -130,7 +130,7 @@ double DynamicDensityField::density(const Coordinate& position) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const double t = timer_->time();
|
||||
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()));
|
||||
const long int deleted_particles = blitz::sum(deleted_particles_(
|
||||
@@ -146,7 +146,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_->time();
|
||||
const double t = timer_->getDeltaT();
|
||||
const double time_in_bin = time_in_bin_s_(position_bin(0), position_bin(1),
|
||||
position_bin(2), energy_bin);
|
||||
const long deleted_particles = deleted_particles_(
|
||||
@@ -177,7 +177,7 @@ void DynamicDensityField::recalculateDensityArray() {
|
||||
blitz::thirdIndex iz;
|
||||
blitz::fourthIndex iE;
|
||||
|
||||
const double t = timer_->time();
|
||||
const double t = timer_->getDeltaT();
|
||||
density_per_m3_ = (time_in_bin_s_(ir, iphi, iz, iE) / t -
|
||||
deleted_particles_(ir, iphi, iz, iE)) /
|
||||
bin_volume_m3_(ir, iphi, iz);
|
||||
|
||||
@@ -237,7 +237,7 @@ void DriftMover::move(particle::Particle* particle,
|
||||
|
||||
if (v_perp_norm > SimConstants::compare_epsilon) {
|
||||
const double gyro_radius = particle->mass_kg() * v_perp_norm /
|
||||
(B_norm * std::abs(particle->charge_C()));
|
||||
(B_norm * particle->charge_C());
|
||||
|
||||
const blitz::TinyVector<double, 3> velocity_normal =
|
||||
(-1) * blitz::cross(B, v_perp);
|
||||
|
||||
@@ -120,6 +120,7 @@ void Simulation::start() {
|
||||
int leftover_events_time_resolution = time_resolution_this_cpu;
|
||||
|
||||
const double delta_t = time_resolution_events*injector_->timePassed();
|
||||
timer_->setDeltaT(delta_t);
|
||||
|
||||
int num_cpu_syncs = 0;
|
||||
bool reset = true;
|
||||
|
||||
@@ -17,3 +17,11 @@ void Timer::setTime(double time_s) {
|
||||
void Timer::resetTime() {
|
||||
setTime(0.);
|
||||
}
|
||||
|
||||
void Timer::setDeltaT(double deltaT) {
|
||||
delta_t_time_resolution_ = deltaT;
|
||||
}
|
||||
|
||||
double Timer::getDeltaT() const {
|
||||
return delta_t_time_resolution_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user