fix in density calculation

This commit is contained in:
2024-05-27 11:00:52 +02:00
parent fea00f9a0a
commit f82cbf4c47
5 changed files with 16 additions and 4 deletions
+3
View File
@@ -11,9 +11,12 @@ class Timer {
void increaseTimestep(double time_s);
void setTime(double time_s);
void resetTime();
void setDeltaT(double deltaT);
double getDeltaT() const;
private:
double current_time_s_;
double delta_t_time_resolution_;
};
#endif /* TIMER_H */
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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);
+1
View File
@@ -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;
+8
View File
@@ -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_;
}