From 03cfdc606b648838fe90fe9dffb7a9978b33db21 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 21 Oct 2019 10:42:43 +0200 Subject: [PATCH] Removed decrease density, because already taken into account by initial particle simulation. --- src/mc_electron/T2Ie_recombination.h | 2 +- src/mc_electron/T3Ie_recombination.h | 2 +- src/mc_electron/T5Ie_recombination.h | 2 +- src/mc_electron/eT2I_disexc.h | 2 +- src/mc_electron/eT2I_recombination.h | 2 +- src/mc_electron/eT3I_disexc.h | 2 +- src/mc_electron/eT3I_recombination.h | 2 +- src/mc_electron/eT5I_recombination.h | 2 +- src/mc_electron/kinetic_population.h | 5 ----- src/mc_electron/population_base.h | 1 - src/mc_electron/population_container.cpp | 20 ++------------------ src/mc_electron/population_container.hpp | 2 -- src/mc_electron/population_load_saver.cpp | 5 ++--- src/mc_electron/population_logger_base.h | 2 +- src/mc_electron/simulation.cpp | 10 ---------- src/mc_electron/thermal_population.h | 3 --- src/mc_electron/tritium2_population.h | 1 - 17 files changed, 13 insertions(+), 52 deletions(-) diff --git a/src/mc_electron/T2Ie_recombination.h b/src/mc_electron/T2Ie_recombination.h index 3bf6757..ae43952 100644 --- a/src/mc_electron/T2Ie_recombination.h +++ b/src/mc_electron/T2Ie_recombination.h @@ -24,7 +24,7 @@ inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances. - Population->decrease_denisty(interPart->get_x_m(), E_eV); + //Population->decrease_denisty(interPart->get_x_m(), E_eV); // Maybe add the 2 T atoms. return res; diff --git a/src/mc_electron/T3Ie_recombination.h b/src/mc_electron/T3Ie_recombination.h index 8d8773e..b150079 100644 --- a/src/mc_electron/T3Ie_recombination.h +++ b/src/mc_electron/T3Ie_recombination.h @@ -24,7 +24,7 @@ inline InteractionOut T3Ie_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances. - Population->decrease_denisty(interPart->get_x_m(), E_eV); + //Population->decrease_denisty(interPart->get_x_m(), E_eV); // Maybe add the 3 T atoms. return res; diff --git a/src/mc_electron/T5Ie_recombination.h b/src/mc_electron/T5Ie_recombination.h index ebd098f..f67017d 100644 --- a/src/mc_electron/T5Ie_recombination.h +++ b/src/mc_electron/T5Ie_recombination.h @@ -29,7 +29,7 @@ inline InteractionOut T5Ie_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances. - Population->decrease_denisty(interPart->get_x_m(), E_eV); + //Population->decrease_denisty(interPart->get_x_m(), E_eV); // Maybe add the 5 T atoms. return res; diff --git a/src/mc_electron/eT2I_disexc.h b/src/mc_electron/eT2I_disexc.h index 3ce4eaa..9b9e726 100644 --- a/src/mc_electron/eT2I_disexc.h +++ b/src/mc_electron/eT2I_disexc.h @@ -25,7 +25,7 @@ inline InteractionOut eT2I_DissExc::do_Interaction (Particle *interPart) { InteractionOut res = Excitation_Base::do_Interaction(interPart); vec3 loc_m = interPart->get_x_m(); - Population->decrease_denisty(interPart->get_x_m(), 0); // dummy since thermal population + //Population->decrease_denisty(interPart->get_x_m(), 0); // dummy since thermal population vec3 vTI_ms = Population->roll_v_ms(loc_m); Particle TI = Particle_Builder::create_TI(loc_m, vTI_ms, -1, interPart->get_Id()); diff --git a/src/mc_electron/eT2I_recombination.h b/src/mc_electron/eT2I_recombination.h index 0c12f8b..e4d5234 100644 --- a/src/mc_electron/eT2I_recombination.h +++ b/src/mc_electron/eT2I_recombination.h @@ -24,7 +24,7 @@ public: inline InteractionOut eT2I_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); - Population->decrease_denisty(interPart->get_x_m(), 0); + //Population->decrease_denisty(interPart->get_x_m(), 0); // Maybe add the 2 T atoms. return res; diff --git a/src/mc_electron/eT3I_disexc.h b/src/mc_electron/eT3I_disexc.h index 1e158e1..a42cfdd 100644 --- a/src/mc_electron/eT3I_disexc.h +++ b/src/mc_electron/eT3I_disexc.h @@ -24,7 +24,7 @@ public: inline InteractionOut eT3I_DissExc::do_Interaction (Particle *interPart) { InteractionOut res = Excitation_Base::do_Interaction(interPart); vec3 loc_m = interPart->get_x_m(); - Population->decrease_denisty(interPart->get_x_m(), 0); // dummy since thermal population + //Population->decrease_denisty(interPart->get_x_m(), 0); // dummy since thermal population vec3 vTI_ms = Population->roll_v_ms(loc_m); Particle TI = Particle_Builder::create_TI(loc_m, vTI_ms, -1, interPart->get_Id()); diff --git a/src/mc_electron/eT3I_recombination.h b/src/mc_electron/eT3I_recombination.h index 663c39d..d7ced84 100644 --- a/src/mc_electron/eT3I_recombination.h +++ b/src/mc_electron/eT3I_recombination.h @@ -24,7 +24,7 @@ public: inline InteractionOut eT3I_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); - Population->decrease_denisty(interPart->get_x_m(), 0); + //Population->decrease_denisty(interPart->get_x_m(), 0); // Maybe add the 3 T atoms. return res; diff --git a/src/mc_electron/eT5I_recombination.h b/src/mc_electron/eT5I_recombination.h index 78a36d3..8fd38e2 100644 --- a/src/mc_electron/eT5I_recombination.h +++ b/src/mc_electron/eT5I_recombination.h @@ -26,7 +26,7 @@ public: inline InteractionOut eT5I_Recombination::do_Interaction (Particle *interPart) { InteractionOut res; res.set_delete_current(true); - Population->decrease_denisty(interPart->get_x_m(), 0); + //Population->decrease_denisty(interPart->get_x_m(), 0); return res; } diff --git a/src/mc_electron/kinetic_population.h b/src/mc_electron/kinetic_population.h index 0f1dec0..c4c48aa 100644 --- a/src/mc_electron/kinetic_population.h +++ b/src/mc_electron/kinetic_population.h @@ -28,7 +28,6 @@ public: Kinetic_Population(species this_species, Timer *timer, UniRNG *rngUni, NormalRNG *rngNormal, int num_z_bins, int num_r_bins, int num_phi_bins, int num_E_bins); void increase_density (const Particle &upPart, const vec3 &oldLoc_m); - void decrease_denisty (const vec3 &loc_m, const double &E_eV); double get_density_m3(const vec3 &loc_m); Content get_density_m3(const int &E_bin, const Bins &loc_bins); @@ -49,10 +48,6 @@ inline void Kinetic_Population::increase_density (const Particle &upPart, const container.increase_cum_time_s(oldLoc_m, upPart.get_x_m(), calc_vec3_abs(upPart.get_v_ms()), upPart.get_E_eV()); } -inline void Kinetic_Population::decrease_denisty (const vec3 &loc_m, const double &E_eV) { - container.increase_offset(loc_m, E_eV); -} - inline double Kinetic_Population::get_density_m3(const vec3 &loc_m) { std::stringstream ss; ss<<"Kinetic_Population::get_density_m3: method for non kinetic populations.\n"; diff --git a/src/mc_electron/population_base.h b/src/mc_electron/population_base.h index a97cc41..155fb9e 100644 --- a/src/mc_electron/population_base.h +++ b/src/mc_electron/population_base.h @@ -26,7 +26,6 @@ public: Population_Base(species this_species) : Process_Base(this_species) {}; virtual void increase_density (const Particle &upPart, const vec3 &oldLoc_m) = 0; - virtual void decrease_denisty (const vec3 &loc_m, const double &E_eV) = 0; virtual double get_density_m3(const vec3 &loc_m) = 0; virtual Content get_density_m3(const int &E_bin, const Bins &loc_bins) = 0; diff --git a/src/mc_electron/population_container.cpp b/src/mc_electron/population_container.cpp index 51c7929..758ef83 100644 --- a/src/mc_electron/population_container.cpp +++ b/src/mc_electron/population_container.cpp @@ -22,11 +22,10 @@ Population_Container::Population_Container(int num_z_bins, int num_r_bins, int n Population_Container::~Population_Container() { delete[] cum_times_s; - delete[] offsets; delete[] size_data_m3; } -Population_Container::Population_Container(const Population_Container& other) : cum_times_s(nullptr), offsets(nullptr), size_data_m3(nullptr) { +Population_Container::Population_Container(const Population_Container& other) : cum_times_s(nullptr), size_data_m3(nullptr) { *this = other; } @@ -37,12 +36,9 @@ Population_Container &Population_Container::operator=(const Population_Container data_size = other.data_size; delete[] cum_times_s; - delete[] offsets; cum_times_s = new double[data_size]; - offsets = new double[data_size]; for (int i = 0; iE_scale.get_number_bins(); i_z++) { int bin = cont->calc_data_bin(Bins{i_z, i_r, i_phi}, i_E); *save_stream<cum_times_s[bin]<<"\t"; - *save_stream<offsets[bin]<<"\n"; + *save_stream<cum_times_s[bin]<<"\n"; } } } @@ -243,7 +242,7 @@ void Population_Load_Saver::load_species(ifstream *load_stream, species add_spec ss<<"Population_Load_Saver::load_species: Input Data bin missmatch.\n"; throw MyException(ss.str()); } - *load_stream>>cont->cum_times_s[i]>>cont->offsets[i]; + *load_stream>>cont->cum_times_s[i]; } string end_of_species; *load_stream>>end_of_species; diff --git a/src/mc_electron/population_logger_base.h b/src/mc_electron/population_logger_base.h index 5fdaba3..91ce336 100644 --- a/src/mc_electron/population_logger_base.h +++ b/src/mc_electron/population_logger_base.h @@ -105,7 +105,7 @@ inline void Population_Logger::log() { temp_bin.E_bin = i_E; bin = container->calc_data_bin(Bins{i_z, i_r, i_phi}, i_E); temp_bin.cumulated_time_s = container->cum_times_s[bin]; - temp_bin.offset = container->offsets[bin]; + temp_bin.offset = 0; h5tb.write(temp_bin); } } diff --git a/src/mc_electron/simulation.cpp b/src/mc_electron/simulation.cpp index 02ae40e..e57ec25 100644 --- a/src/mc_electron/simulation.cpp +++ b/src/mc_electron/simulation.cpp @@ -200,9 +200,7 @@ void Simulation::sync_populations() { // Sync new densities for each species and Population_Manager *populations = looper.get_populations(); Population_Container *container; double *global_delta_cumulated_time_s; - double *global_delta_offset; double *local_delta_cumulated_time_s; - double *local_delta_offset; int array_length; for (int i = 0; ifind(pop_species[i])->access_container(); @@ -211,28 +209,20 @@ void Simulation::sync_populations() { // Sync new densities for each species and continue; } global_delta_cumulated_time_s = new double[array_length]; - global_delta_offset = new double[array_length]; local_delta_cumulated_time_s = new double[array_length]; - local_delta_offset = new double[array_length]; for (int j = 0; jcum_times_s[j] - global_cum_time_s[i][j]; - local_delta_offset[j] = container->offsets[j] - global_offset[i][j]; } MPI_Allreduce(local_delta_cumulated_time_s, global_delta_cumulated_time_s, array_length, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(local_delta_offset, global_delta_offset, array_length, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); for (int j = 0; jcum_times_s[j] = global_cum_time_s[i][j]; - container->offsets[j] = global_offset[i][j]; } delete[] global_delta_cumulated_time_s; - delete[] global_delta_offset; delete[] local_delta_cumulated_time_s; - delete[] local_delta_offset; } } diff --git a/src/mc_electron/thermal_population.h b/src/mc_electron/thermal_population.h index bf0ed79..d70a7e2 100644 --- a/src/mc_electron/thermal_population.h +++ b/src/mc_electron/thermal_population.h @@ -31,9 +31,6 @@ public: void increase_density (const Particle &upPart, const vec3 &oldLoc_m) { container.increase_cum_time_s(oldLoc_m, upPart.get_x_m(), calc_vec3_abs(upPart.get_v_ms()), upPart.get_E_eV()); } - void decrease_denisty (const vec3 &loc_m, const double &E_eV) { - container.increase_offset(loc_m, E_eV); - } double get_density_m3(const vec3 &loc_m) { return container.get_density_m3(loc_m, 0, timer->get_time_s()); diff --git a/src/mc_electron/tritium2_population.h b/src/mc_electron/tritium2_population.h index 27fcb80..c171a46 100644 --- a/src/mc_electron/tritium2_population.h +++ b/src/mc_electron/tritium2_population.h @@ -35,7 +35,6 @@ private: public: void increase_density (const Particle &upPart, const vec3 &oldLoc_m) {} - void decrease_denisty (const vec3 &loc_m, const double &E_eV) {} double get_density_m3(const vec3 &loc_m); Content get_density_m3(const int &E_bin, const Bins &loc_bins);