Minor Changes

Time Calculation changed to based on 1e11 with 100%CD
This commit is contained in:
Christian
2019-11-05 11:12:00 +01:00
parent 6c91842702
commit fb20c896eb
20 changed files with 70 additions and 18 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ public:
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.
//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);
// Maybe add the 2 T atoms.
+1 -1
View File
@@ -28,7 +28,7 @@ public:
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.
//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);
// Maybe add the 5 T atoms.
+1
View File
@@ -27,6 +27,7 @@ public:
hid_t *get_h5f() {return &h5f;}
std::string get_h5g_particles_path() {return h5g_particles_path;}
std::string get_h5g_populations_path() {return h5g_populations_path;}
private:
void create(std::string output_path);
//std::string get_file_name();
+7 -1
View File
@@ -63,8 +63,14 @@ void H5TB_Particle_Interface::write(const Particle &logPart) {
buffer_count = 0;
}
}
H5TB_Particle_Interface::~H5TB_Particle_Interface() {
void H5TB_Particle_Interface::flush() {
H5TBappend_records(*loc_id, table_name.c_str() , buffer_count, size, offset, sizes, &buffer);
buffer_count = 0;
}
H5TB_Particle_Interface::~H5TB_Particle_Interface() {
flush();
}
loggerParticle H5TB_Particle_Interface::transform(const Particle &logPart) {
@@ -54,6 +54,7 @@ private:
public:
void write(const Particle &logPart);
void flush();
private:
loggerParticle transform(const Particle &logPart);
};
@@ -70,6 +70,12 @@ void H5TB_Population_Interface::write(const pop_bin &log_bin) {
}
}
H5TB_Population_Interface::~H5TB_Population_Interface() {
void H5TB_Population_Interface::flush() {
H5TBappend_records(*loc_id, table_name.c_str() , buffer_count, size, offset, sizes, &buffer);
buffer_count = 0;
}
H5TB_Population_Interface::~H5TB_Population_Interface() {
flush();
}
@@ -55,7 +55,7 @@ private:
public:
void write(const pop_bin &log_bin);
void flush();
};
@@ -92,6 +92,11 @@ void H5TB_Population_Meta_Interface::write(const pop_bin_meta_info &log_meta_bin
}
}
H5TB_Population_Meta_Interface::~H5TB_Population_Meta_Interface() {
void H5TB_Population_Meta_Interface::flush() {
H5TBappend_records(*loc_id, table_name.c_str() , buffer_count, size, offset, sizes, &buffer);
buffer_count = 0;
}
H5TB_Population_Meta_Interface::~H5TB_Population_Meta_Interface() {
flush();
}
@@ -62,6 +62,7 @@ private:
public:
void write(const pop_bin_meta_info &log_meta_bin);
void flush();
};
+6
View File
@@ -38,6 +38,7 @@ private:
public:
void log(const Particle &logPart, const vec3 &oldLoc_m);
void flush();
};
@@ -74,4 +75,9 @@ inline void MultiZ_Particle_Logger::log(const Particle &logPart, const vec3 &old
}
}
inline void MultiZ_Particle_Logger::flush() {
for (int i = 0; i < numberZBins; i++) {
h5tb[i].flush();
}
}
#endif /* multiz_particle_logger_h */
+1
View File
@@ -14,6 +14,7 @@ class Off_Particle_Logger : public Particle_Logger_Base {
public:
Off_Particle_Logger(species this_species) : Particle_Logger_Base(this_species) {};
void log(const Particle &logPart, const vec3 &oldLoc_m) {};
void flush() {};
};
+1
View File
@@ -18,6 +18,7 @@ protected:
public:
Particle_Logger_Base(species this_species) : Process_Base(this_species) {};
virtual void log(const Particle &logPart, const vec3 &oldLoc_m) = 0;
virtual void flush() = 0;
void set_logging(const bool &logging) {
this->logging = logging;
}
+13
View File
@@ -93,3 +93,16 @@ void Particle_Looper::set_logging(bool logging) {
}
}
}
void Particle_Looper::flush() {
// Dirty workaround since deconstructors are not properly called due to bad pointer situation.
vector<species> all_species = get_all_species_vector();
species current_species;
for (vector<species>::iterator itr = all_species.begin(); itr != all_species.end(); itr++) {
current_species = *itr;
if (part_loggers.exists(current_species)) {
part_loggers.find(current_species)->flush();
}
pop_loggers.flush();
}
}
+2
View File
@@ -91,6 +91,8 @@ public:
Terminator_Manager *get_terminators() {
return &terminators;
}
void flush();
};
+1 -4
View File
@@ -71,12 +71,11 @@ void Population_Container::init_size_array() {
double bin_length_m = scales.z.get_delta();
size_data_m3 = new double[scales.r.get_number_bins()];
for (int r_bin = 0; r_bin<scales.r.get_number_bins(); r_bin++) {
double A_m2 = pi * (pow(scales.r.get_upper_bin_bound(r_bin), 2) - pow(scales.r.get_lower_bin_bound(r_bin), 2));
double A_m2 = pi/scales.phi.get_number_bins() * (pow(scales.r.get_upper_bin_bound(r_bin), 2) - pow(scales.r.get_lower_bin_bound(r_bin), 2));
size_data_m3[r_bin] = A_m2 * bin_length_m;
}
}
void Population_Container::increase_cum_time_s(const vec3 &loc1_m, const vec3 &loc2_m, const double &v_ms, const double &E_eV) {
int E_bin = E_scale.calc_index(E_eV);
Bins bins_1 = calc_loc_bin(loc1_m);
@@ -117,8 +116,6 @@ double Population_Container::get_density_m3(const vec3 &loc_m, const double &E_e
Bins loc_bins = calc_loc_bin(loc_m);
int E_bin = E_scale.calc_index(E_eV);
return get_density_m3(E_bin, loc_bins, time_s).n_m3;
}
Content Population_Container::get_density_m3(const int &E_bin, const Bins &loc_bins, const double &time_s) {
+11
View File
@@ -35,6 +35,7 @@ private:
public:
void log();
void flush();
};
inline Population_Logger::Population_Logger(Population_Base *pop, Timer *timer, H5_File *h5_file) {
@@ -113,6 +114,10 @@ inline void Population_Logger::log() {
}
}
inline void Population_Logger::flush() {
h5tb.flush();
h5tb_meta.flush();
}
class Population_Logger_Manager {
Population_Logger **population_loggers;
@@ -123,6 +128,7 @@ public:
void add(Population_Logger *new_population_logger);
void log();
void flush();
};
inline void Population_Logger_Manager::add(Population_Logger *new_population_logger) {
@@ -149,5 +155,10 @@ inline void Population_Logger_Manager::log() {
}
}
inline void Population_Logger_Manager::flush() {
for (int i=0; i<num_loggers; i++) {
population_loggers[i]->flush();
}
}
#endif /* Population_Logger_h */
+5
View File
@@ -27,6 +27,7 @@ private:
void create(H5_File *h5_file, species this_species);
public:
void log(const Particle &logPart, const vec3 &oldLoc_m);
void flush();
};
@@ -44,5 +45,9 @@ inline void SF_Particle_Logger::log(const Particle &logPart, const vec3 &oldLoc_
h5tb.write(logPart);
}
inline void SF_Particle_Logger::flush() {
h5tb.flush();
}
#endif /* sf_particle_logger_h */
+2 -7
View File
@@ -39,7 +39,6 @@ void Simulation::init_pop_arrays() { // Init C-arrays used for MPI-Allgather com
pop_species = new species[number_pop_species];
pop_array_lengths = new int[number_pop_species];
global_cum_time_s = new double *[number_pop_species];
global_offset = new double *[number_pop_species];
Population_Base *population;
@@ -51,10 +50,8 @@ void Simulation::init_pop_arrays() { // Init C-arrays used for MPI-Allgather com
pop_array_lengths[i] = population->access_container()->data_size;
global_cum_time_s[i] = new double[pop_array_lengths[i]];
global_offset[i] = new double[pop_array_lengths[i]];
for (int j = 0; j<pop_array_lengths[i]; j++) {
global_cum_time_s[i][j] = 0;
global_offset[i][j] = 0;
}
i++;
}
@@ -132,10 +129,8 @@ void Simulation::deconstruct_pop_arrays() { // Deallocate memory properly
delete[] pop_array_lengths;
for (int i = 0; i<number_pop_species; i++) {
delete[] global_cum_time_s[i];
delete[] global_offset[i];
}
delete[] global_cum_time_s;
delete[] global_offset;
}
@@ -145,6 +140,7 @@ void Simulation::doit() { // 2 Phase: 1. calc average densities, 2. actual simul
cout<<"Population calculation done.\n";
}
do_cycle(numberTotalDecays, simulationStepWidth, true);
looper.flush();
print_term_stats();
};
@@ -187,7 +183,6 @@ void Simulation::do_decays(const long int &number_decays, const bool &logging) {
number_local_decays += number_decays;
sync_cpus();
do_statusUpdate();
}
void Simulation::sync_cpus() { // Sync populations among MPI World
@@ -217,7 +212,7 @@ void Simulation::sync_populations() { // Sync new densities for each species and
MPI_Allreduce(local_delta_cumulated_time_s, global_delta_cumulated_time_s, array_length, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
for (int j = 0; j<pop_array_lengths[i]; j++) {
for (int j = 0; j<array_length; j++) {
global_cum_time_s[i][j] += global_delta_cumulated_time_s[j];
container->cum_times_s[j] = global_cum_time_s[i][j];
}
+1 -1
View File
@@ -32,7 +32,7 @@ class Simulation {
int number_pop_species;
species *pop_species;
int *pop_array_lengths;
double **global_cum_time_s, **global_offset;
double **global_cum_time_s;
public:
Simulation();
+1
View File
@@ -40,6 +40,7 @@ void Timer::set_T2_activity_s() {
double V_m3 = pi*r_m*r_m*l_m;
double NT2 = (wgtsT2MaxDensity_m3/2)*V_m3;
T2_activity_s = NT2*decayConstT2_s;
T2_activity_s = wgtsT2MaxDensity_m3/1e21*1e11; // Analytical calculation 1e21 = 100% CD, 1e11 = Activity at 1e21.
}
double Timer::get_time_s() {