Minor Changes
Time Calculation changed to based on 1e11 with 100%CD
This commit is contained in:
@@ -23,7 +23,7 @@ public:
|
|||||||
inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) {
|
inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||||
InteractionOut res;
|
InteractionOut res;
|
||||||
res.set_delete_current(true);
|
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);
|
//Population->decrease_denisty(interPart->get_x_m(), E_eV);
|
||||||
|
|
||||||
// Maybe add the 2 T atoms.
|
// Maybe add the 2 T atoms.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
inline InteractionOut T5Ie_Recombination::do_Interaction (Particle *interPart) {
|
inline InteractionOut T5Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||||
InteractionOut res;
|
InteractionOut res;
|
||||||
res.set_delete_current(true);
|
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);
|
//Population->decrease_denisty(interPart->get_x_m(), E_eV);
|
||||||
|
|
||||||
// Maybe add the 5 T atoms.
|
// Maybe add the 5 T atoms.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
hid_t *get_h5f() {return &h5f;}
|
hid_t *get_h5f() {return &h5f;}
|
||||||
std::string get_h5g_particles_path() {return h5g_particles_path;}
|
std::string get_h5g_particles_path() {return h5g_particles_path;}
|
||||||
std::string get_h5g_populations_path() {return h5g_populations_path;}
|
std::string get_h5g_populations_path() {return h5g_populations_path;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void create(std::string output_path);
|
void create(std::string output_path);
|
||||||
//std::string get_file_name();
|
//std::string get_file_name();
|
||||||
|
|||||||
@@ -63,8 +63,14 @@ void H5TB_Particle_Interface::write(const Particle &logPart) {
|
|||||||
buffer_count = 0;
|
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);
|
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) {
|
loggerParticle H5TB_Particle_Interface::transform(const Particle &logPart) {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void write(const Particle &logPart);
|
void write(const Particle &logPart);
|
||||||
|
void flush();
|
||||||
private:
|
private:
|
||||||
loggerParticle transform(const Particle &logPart);
|
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);
|
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:
|
public:
|
||||||
void write(const pop_bin &log_bin);
|
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);
|
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:
|
public:
|
||||||
void write(const pop_bin_meta_info &log_meta_bin);
|
void write(const pop_bin_meta_info &log_meta_bin);
|
||||||
|
void flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void log(const Particle &logPart, const vec3 &oldLoc_m);
|
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 */
|
#endif /* multiz_particle_logger_h */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class Off_Particle_Logger : public Particle_Logger_Base {
|
|||||||
public:
|
public:
|
||||||
Off_Particle_Logger(species this_species) : Particle_Logger_Base(this_species) {};
|
Off_Particle_Logger(species this_species) : Particle_Logger_Base(this_species) {};
|
||||||
void log(const Particle &logPart, const vec3 &oldLoc_m) {};
|
void log(const Particle &logPart, const vec3 &oldLoc_m) {};
|
||||||
|
void flush() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
Particle_Logger_Base(species this_species) : Process_Base(this_species) {};
|
Particle_Logger_Base(species this_species) : Process_Base(this_species) {};
|
||||||
virtual void log(const Particle &logPart, const vec3 &oldLoc_m) = 0;
|
virtual void log(const Particle &logPart, const vec3 &oldLoc_m) = 0;
|
||||||
|
virtual void flush() = 0;
|
||||||
void set_logging(const bool &logging) {
|
void set_logging(const bool &logging) {
|
||||||
this->logging = logging;
|
this->logging = logging;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ public:
|
|||||||
Terminator_Manager *get_terminators() {
|
Terminator_Manager *get_terminators() {
|
||||||
return &terminators;
|
return &terminators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,12 +71,11 @@ void Population_Container::init_size_array() {
|
|||||||
double bin_length_m = scales.z.get_delta();
|
double bin_length_m = scales.z.get_delta();
|
||||||
size_data_m3 = new double[scales.r.get_number_bins()];
|
size_data_m3 = new double[scales.r.get_number_bins()];
|
||||||
for (int r_bin = 0; r_bin<scales.r.get_number_bins(); r_bin++) {
|
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;
|
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) {
|
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);
|
int E_bin = E_scale.calc_index(E_eV);
|
||||||
Bins bins_1 = calc_loc_bin(loc1_m);
|
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);
|
Bins loc_bins = calc_loc_bin(loc_m);
|
||||||
int E_bin = E_scale.calc_index(E_eV);
|
int E_bin = E_scale.calc_index(E_eV);
|
||||||
return get_density_m3(E_bin, loc_bins, time_s).n_m3;
|
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) {
|
Content Population_Container::get_density_m3(const int &E_bin, const Bins &loc_bins, const double &time_s) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void log();
|
void log();
|
||||||
|
void flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Population_Logger::Population_Logger(Population_Base *pop, Timer *timer, H5_File *h5_file) {
|
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 {
|
class Population_Logger_Manager {
|
||||||
Population_Logger **population_loggers;
|
Population_Logger **population_loggers;
|
||||||
@@ -123,6 +128,7 @@ public:
|
|||||||
|
|
||||||
void add(Population_Logger *new_population_logger);
|
void add(Population_Logger *new_population_logger);
|
||||||
void log();
|
void log();
|
||||||
|
void flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Population_Logger_Manager::add(Population_Logger *new_population_logger) {
|
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 */
|
#endif /* Population_Logger_h */
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ private:
|
|||||||
void create(H5_File *h5_file, species this_species);
|
void create(H5_File *h5_file, species this_species);
|
||||||
public:
|
public:
|
||||||
void log(const Particle &logPart, const vec3 &oldLoc_m);
|
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);
|
h5tb.write(logPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void SF_Particle_Logger::flush() {
|
||||||
|
h5tb.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* sf_particle_logger_h */
|
#endif /* sf_particle_logger_h */
|
||||||
|
|||||||
@@ -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_species = new species[number_pop_species];
|
||||||
pop_array_lengths = new int[number_pop_species];
|
pop_array_lengths = new int[number_pop_species];
|
||||||
global_cum_time_s = new double *[number_pop_species];
|
global_cum_time_s = new double *[number_pop_species];
|
||||||
global_offset = new double *[number_pop_species];
|
|
||||||
|
|
||||||
Population_Base *population;
|
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;
|
pop_array_lengths[i] = population->access_container()->data_size;
|
||||||
global_cum_time_s[i] = new double[pop_array_lengths[i]];
|
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++) {
|
for (int j = 0; j<pop_array_lengths[i]; j++) {
|
||||||
global_cum_time_s[i][j] = 0;
|
global_cum_time_s[i][j] = 0;
|
||||||
global_offset[i][j] = 0;
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -132,10 +129,8 @@ void Simulation::deconstruct_pop_arrays() { // Deallocate memory properly
|
|||||||
delete[] pop_array_lengths;
|
delete[] pop_array_lengths;
|
||||||
for (int i = 0; i<number_pop_species; i++) {
|
for (int i = 0; i<number_pop_species; i++) {
|
||||||
delete[] global_cum_time_s[i];
|
delete[] global_cum_time_s[i];
|
||||||
delete[] global_offset[i];
|
|
||||||
}
|
}
|
||||||
delete[] global_cum_time_s;
|
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";
|
cout<<"Population calculation done.\n";
|
||||||
}
|
}
|
||||||
do_cycle(numberTotalDecays, simulationStepWidth, true);
|
do_cycle(numberTotalDecays, simulationStepWidth, true);
|
||||||
|
looper.flush();
|
||||||
print_term_stats();
|
print_term_stats();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -187,7 +183,6 @@ void Simulation::do_decays(const long int &number_decays, const bool &logging) {
|
|||||||
number_local_decays += number_decays;
|
number_local_decays += number_decays;
|
||||||
sync_cpus();
|
sync_cpus();
|
||||||
do_statusUpdate();
|
do_statusUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulation::sync_cpus() { // Sync populations among MPI World
|
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);
|
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];
|
global_cum_time_s[i][j] += global_delta_cumulated_time_s[j];
|
||||||
container->cum_times_s[j] = global_cum_time_s[i][j];
|
container->cum_times_s[j] = global_cum_time_s[i][j];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class Simulation {
|
|||||||
int number_pop_species;
|
int number_pop_species;
|
||||||
species *pop_species;
|
species *pop_species;
|
||||||
int *pop_array_lengths;
|
int *pop_array_lengths;
|
||||||
double **global_cum_time_s, **global_offset;
|
double **global_cum_time_s;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Simulation();
|
Simulation();
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ void Timer::set_T2_activity_s() {
|
|||||||
double V_m3 = pi*r_m*r_m*l_m;
|
double V_m3 = pi*r_m*r_m*l_m;
|
||||||
double NT2 = (wgtsT2MaxDensity_m3/2)*V_m3;
|
double NT2 = (wgtsT2MaxDensity_m3/2)*V_m3;
|
||||||
T2_activity_s = NT2*decayConstT2_s;
|
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() {
|
double Timer::get_time_s() {
|
||||||
|
|||||||
Reference in New Issue
Block a user