Removed decrease density, because already taken into account by initial particle simulation.

This commit is contained in:
Christian
2019-10-21 10:42:43 +02:00
parent 3ddf92fd75
commit 03cfdc606b
17 changed files with 13 additions and 52 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
}
-5
View File
@@ -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";
-1
View File
@@ -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;
+2 -18
View File
@@ -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; i<data_size; i++) {
cum_times_s[i] = other.cum_times_s[i];
offsets[i] = other.offsets[i];
}
delete[] size_data_m3;
@@ -66,10 +62,8 @@ void Population_Container::init_bin_offsets() {
void Population_Container::init_content_arrays() {
cum_times_s = new double[data_size];
offsets = new double[data_size];
for (int i = 0; i<data_size; i++) {
cum_times_s[i] = 0;
offsets[i] = 0;
}
}
@@ -119,15 +113,6 @@ void Population_Container::increase_cum_time_s(const vec3 &loc1_m, const vec3 &l
}
}
void Population_Container::increase_offset(const vec3 &loc_m, const double &E_eV) {
int E_bin = E_scale.calc_index(E_eV);
Bins loc_bins = calc_loc_bin(loc_m);
int bin = calc_data_bin(loc_bins, E_bin);
offsets[bin] += 1;
}
double Population_Container::get_density_m3(const vec3 &loc_m, const double &E_eV, const double &time_s) {
Bins loc_bins = calc_loc_bin(loc_m);
int E_bin = E_scale.calc_index(E_eV);
@@ -139,10 +124,9 @@ double Population_Container::get_density_m3(const vec3 &loc_m, const double &E_e
Content Population_Container::get_density_m3(const int &E_bin, const Bins &loc_bins, const double &time_s) {
int data_bin = calc_data_bin(loc_bins, E_bin);
double cum_time_s = cum_times_s[data_bin];
int offset = offsets[data_bin];
double V_m3 = size_data_m3[loc_bins.r];
double n_m3 = cum_time_s/time_s/V_m3 - offset;
double n_m3 = cum_time_s/time_s/V_m3;
if (n_m3<0) {
n_m3 = 0;
}
-2
View File
@@ -48,7 +48,6 @@ class Population_Container {
Log_Scale E_scale;
double *cum_times_s;
double *offsets;
Bins bin_offsets;
int data_size;
@@ -67,7 +66,6 @@ private:
public:
void increase_cum_time_s(const vec3 &loc1_m, const vec3 &loc2_m, const double &v_ms, const double &E_eV);
void increase_offset(const vec3 &loc_m, const double &E_eV);
public:
double get_density_m3(const vec3 &loc_m, const double &E_eV, const double &time_s);
+2 -3
View File
@@ -79,8 +79,7 @@ void Population_Load_Saver::write_species(ofstream *save_stream, species this_sp
for (int i_E = 0; i_z<cont->E_scale.get_number_bins(); i_z++) {
int bin = cont->calc_data_bin(Bins{i_z, i_r, i_phi}, i_E);
*save_stream<<i_z<<"\t"<<i_r<<"\t"<<i_phi<<"\t"<<i_E<<"\t";
*save_stream<<cont->cum_times_s[bin]<<"\t";
*save_stream<<cont->offsets[bin]<<"\n";
*save_stream<<cont->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;
+1 -1
View File
@@ -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);
}
}
-10
View File
@@ -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; i<number_pop_species; i++) {
container = populations->find(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; j<array_length; j++) {
local_delta_cumulated_time_s[j] = container->cum_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; j<pop_array_lengths[i]; j++) {
global_cum_time_s[i][j] += global_delta_cumulated_time_s[j];
global_offset[i][j] += global_delta_offset[j];
container->cum_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;
}
}
-3
View File
@@ -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());
-1
View File
@@ -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);