Extracting random point in file.
No Integration for Reaction Rate Cross sections.
This commit is contained in:
@@ -12,11 +12,11 @@
|
|||||||
#include "TI_thermal_binary_base.h"
|
#include "TI_thermal_binary_base.h"
|
||||||
|
|
||||||
|
|
||||||
class T3IT2_RadAsc : public TI_thermal_binary_Precomputed_Interaction_Base {
|
class T3IT2_RadAsc : public TI_thermal_Rate_Interaction_Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
T3IT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 3*mT_eV) {
|
T3IT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Interaction_Base(T2Population, rngUni, 1) {
|
||||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
//calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||||
};
|
};
|
||||||
|
|
||||||
double get_microSigma_m2(const double &E_eV) {
|
double get_microSigma_m2(const double &E_eV) {
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
#include "TI_thermal_tenary_base.h"
|
#include "TI_thermal_tenary_base.h"
|
||||||
|
|
||||||
|
|
||||||
class T3IT2_TerAsc : public TI_thermal_tenary_Precomputed_Interaction_Base {
|
class T3IT2_TerAsc : public TI_thermal_Rate_Interaction_Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
T3IT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_tenary_Precomputed_Interaction_Base(T2Population, rngUni, 3*mT_eV) {
|
T3IT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Interaction_Base(T2Population, rngUni, 2) {
|
||||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
//calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||||
};
|
};
|
||||||
|
|
||||||
double get_microSigma_divbyn_m2(const double &E_eV) {
|
double get_microSigma_m2(const double &E_eV) {
|
||||||
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
|
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
|
||||||
return 7e-41*v_ms; // CS from Gerlich:1990aa
|
return 7e-41*v_ms; // CS from Gerlich:1990aa
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
#include "TI_thermal_binary_base.h"
|
#include "TI_thermal_binary_base.h"
|
||||||
|
|
||||||
class TIT2_RadAsc : public TI_thermal_binary_Precomputed_Interaction_Base {
|
class TIT2_RadAsc : public TI_thermal_Rate_Interaction_Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TIT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV) {
|
TIT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Interaction_Base(T2Population, rngUni, 1) {
|
||||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
//calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||||
};
|
};
|
||||||
|
|
||||||
double get_microSigma_m2(const double &E_eV) {
|
double get_microSigma_m2(const double &E_eV) {
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
#include "TI_thermal_tenary_base.h"
|
#include "TI_thermal_tenary_base.h"
|
||||||
|
|
||||||
|
|
||||||
class TIT2_TerAsc : public TI_thermal_tenary_Precomputed_Interaction_Base {
|
class TIT2_TerAsc : public TI_thermal_Rate_Interaction_Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TIT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_tenary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV) {
|
TIT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Interaction_Base(T2Population, rngUni, 2) {
|
||||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
//calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||||
};
|
};
|
||||||
|
|
||||||
double get_microSigma_divbyn_m2(const double &E_eV) {
|
double get_microSigma_m2(const double &E_eV) {
|
||||||
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
|
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
|
||||||
return 2.6e-41/v_ms; // CS from Plasil:2012
|
return 2.6e-41/v_ms; // CS from Plasil:2012
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||||
double calc_microSigma_divbyn_m2(const double &E_eV);
|
double calc_microSigma_divbyn_m2(const double &E_eV);
|
||||||
private:
|
private:
|
||||||
virtual double get_microSigma_divbyn_m2(const double &E_eV) = 0;
|
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline double TI_thermal_tenary_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
inline double TI_thermal_tenary_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||||
@@ -49,7 +49,7 @@ inline double TI_thermal_tenary_Interaction_Base::calc_microSigma_divbyn_m2(cons
|
|||||||
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
||||||
auto integrand = [&](double theta) {
|
auto integrand = [&](double theta) {
|
||||||
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
|
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
|
||||||
return get_microSigma_divbyn_m2(E_eV);
|
return get_microSigma_m2(E_eV);
|
||||||
};
|
};
|
||||||
return integrate(integrand, 0., pi, INT_N_INTPOINTS, simpson())/pi;
|
return integrate(integrand, 0., pi, INT_N_INTPOINTS, simpson())/pi;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ void DCS_Ionization_Container::calc_data(std::string load_path) {
|
|||||||
int num_W_bins = W_scale[0].get_number_bins();
|
int num_W_bins = W_scale[0].get_number_bins();
|
||||||
double *temp;
|
double *temp;
|
||||||
double sum;
|
double sum;
|
||||||
double E_eV;
|
//double E_eV;
|
||||||
for (int i = 0; i<num_T_bins; i++) {
|
for (int i = 0; i<num_T_bins; i++) {
|
||||||
E_eV = T_scale.get_bin_mid(i);
|
//E_eV = T_scale.get_bin_mid(i);
|
||||||
temp = new double[num_W_bins];
|
temp = new double[num_W_bins];
|
||||||
sum = 0;
|
sum = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void DCS_Theta_Container::calc_data(std::string load_path) {
|
|||||||
double sum;
|
double sum;
|
||||||
double E_eV;
|
double E_eV;
|
||||||
for (int i = 0; i<number_E_bins; i++) {
|
for (int i = 0; i<number_E_bins; i++) {
|
||||||
E_eV = E_scale.get_bin_mid(i);
|
//E_eV = E_scale.get_bin_mid(i);
|
||||||
temp = new double[number_theta_bins];
|
temp = new double[number_theta_bins];
|
||||||
sum = 0;
|
sum = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "population_base.h"
|
#include "population_base.h"
|
||||||
|
|
||||||
#include <queue>
|
#include <vector>
|
||||||
#include "random_operations.h"
|
#include "random_operations.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -32,14 +32,14 @@ public:
|
|||||||
this->ions = ions;
|
this->ions = ions;
|
||||||
};
|
};
|
||||||
|
|
||||||
int inject (std::queue<Particle> *particle_queue, const int &last_ID);
|
int inject (std::vector<Particle> *particle_queue, const int &last_ID);
|
||||||
private:
|
private:
|
||||||
double roll_FermiEnergy_eV();
|
double roll_FermiEnergy_eV();
|
||||||
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
||||||
double get_FermiFunction(const double &Z, const double &E_eV);
|
double get_FermiFunction(const double &Z, const double &E_eV);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int Injector::inject (std::queue<Particle> *particle_queue, const int &last_ID) {
|
inline int Injector::inject (std::vector<Particle> *particle_queue, const int &last_ID) {
|
||||||
vec3 loc_m = T2Population->roll_x_ms();
|
vec3 loc_m = T2Population->roll_x_ms();
|
||||||
|
|
||||||
double E_eV;
|
double E_eV;
|
||||||
@@ -58,13 +58,13 @@ inline int Injector::inject (std::queue<Particle> *particle_queue, const int &la
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||||
particle_queue->push(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
|
|
||||||
if (ions == 0) {
|
if (ions == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
vec3 vTI_ms = T2Population->roll_v_ms(loc_m);
|
vec3 vTI_ms = T2Population->roll_v_ms(loc_m);
|
||||||
particle_queue->push(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
particle_queue->push_back(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,4 +56,21 @@ public:
|
|||||||
virtual InteractionOut do_Interaction (Particle *interPart) = 0;
|
virtual InteractionOut do_Interaction (Particle *interPart) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TI_thermal_Rate_Interaction_Base : public Interaction_Base { // Binary interactions of tritium ions with thermal Populations
|
||||||
|
int n;
|
||||||
|
protected:
|
||||||
|
double m1_eV; // energy of kinetic particle for CS measurement : tritium ion
|
||||||
|
|
||||||
|
public:
|
||||||
|
TI_thermal_Rate_Interaction_Base(Population_Base *Population, UniRNG *rngUni, int n) : Interaction_Base(Population, rngUni) {
|
||||||
|
this-> n = n;
|
||||||
|
}
|
||||||
|
double get_macro_sigma_m(const Particle &interPart) {
|
||||||
|
return get_microSigma_m2(interPart.get_E_eV()) * pow (Population->get_density_m3(interPart.get_x_m()), n);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||||
|
};
|
||||||
#endif /* interaction_base_h */
|
#endif /* interaction_base_h */
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void Particle_Looper::init_managers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Particle_Looper::do_loops(int target_decays) {
|
void Particle_Looper::do_loops(int target_decays) {
|
||||||
queue<Particle> particle_queue;
|
vector<Particle> particle_queue;
|
||||||
int number_decays = 0;
|
int number_decays = 0;
|
||||||
while ( (number_decays < target_decays) || (!particle_queue.empty()) ) {
|
while ( (number_decays < target_decays) || (!particle_queue.empty()) ) {
|
||||||
if (particle_queue.empty()) {
|
if (particle_queue.empty()) {
|
||||||
@@ -35,13 +35,15 @@ void Particle_Looper::do_loops(int target_decays) {
|
|||||||
local_decays = local_decays + 1;
|
local_decays = local_decays + 1;
|
||||||
ID_counter = ID_counter + num_new;
|
ID_counter = ID_counter + num_new;
|
||||||
}
|
}
|
||||||
process_first(&particle_queue);
|
process_one(&particle_queue);
|
||||||
}
|
}
|
||||||
pop_loggers.log();
|
pop_loggers.log();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Particle_Looper::process_first(std::queue<Particle> *particle_queue) {
|
void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
||||||
Particle curPart = particle_queue->front();
|
int i = floor(rngUni.random()*particle_queue->size());
|
||||||
|
Particle curPart = particle_queue->at(i);
|
||||||
|
//Particle curPart = particle_queue->front();
|
||||||
Mover_Base *moverPtr = movers.find(curPart.get_species());
|
Mover_Base *moverPtr = movers.find(curPart.get_species());
|
||||||
Interaction_Channel_Base *interactionPtr = interactions.find(curPart.get_species());
|
Interaction_Channel_Base *interactionPtr = interactions.find(curPart.get_species());
|
||||||
Terminator_Base *terminatorPtr = terminators.find(curPart.get_species());
|
Terminator_Base *terminatorPtr = terminators.find(curPart.get_species());
|
||||||
@@ -59,7 +61,7 @@ void Particle_Looper::process_first(std::queue<Particle> *particle_queue) {
|
|||||||
} else {
|
} else {
|
||||||
IntOut = interactionPtr->do_Interaction(&curPart);
|
IntOut = interactionPtr->do_Interaction(&curPart);
|
||||||
for (int i=0; i<IntOut.get_number_new_particles(); i++) {
|
for (int i=0; i<IntOut.get_number_new_particles(); i++) {
|
||||||
particle_queue->push(IntOut.get_new_particles()[i]);
|
particle_queue->push_back(IntOut.get_new_particles()[i]);
|
||||||
particle_queue->back().set_Id(get_new_id());
|
particle_queue->back().set_Id(get_new_id());
|
||||||
}
|
}
|
||||||
if (IntOut.get_delete_current()) {
|
if (IntOut.get_delete_current()) {
|
||||||
@@ -68,7 +70,7 @@ void Particle_Looper::process_first(std::queue<Particle> *particle_queue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
particle_queue->pop();
|
particle_queue->erase(particle_queue->begin() + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
long int Particle_Looper::get_new_id() {
|
long int Particle_Looper::get_new_id() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#ifndef particle_looper_hpp
|
#ifndef particle_looper_hpp
|
||||||
#define particle_looper_hpp
|
#define particle_looper_hpp
|
||||||
|
|
||||||
#include <queue>
|
#include <vector>
|
||||||
|
|
||||||
#include "h5_file.hpp"
|
#include "h5_file.hpp"
|
||||||
#include "timer.hpp"
|
#include "timer.hpp"
|
||||||
@@ -67,7 +67,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
void do_loops(int target_decays);
|
void do_loops(int target_decays);
|
||||||
private:
|
private:
|
||||||
void process_first(std::queue<Particle> *particle_queue);
|
void process_one(std::vector<Particle> *particle_queue);
|
||||||
long int get_new_id();
|
long int get_new_id();
|
||||||
long int get_last_id();
|
long int get_last_id();
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../mc_electron/integrater.h"
|
#include "../mc_electron/integrater.h"
|
||||||
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
double f(double x, double y, double a) { return a*x*y; }
|
double f(double x, double y, double a) { return a*x*y; }
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
double a = 3;
|
std::vector<int> vec;
|
||||||
auto g = [&] (double x) {
|
|
||||||
return f(x,x, a);
|
|
||||||
};
|
|
||||||
|
|
||||||
double s = integrate(g, 0.0, 1.0, 10, simpson());
|
vec.push_back(6);
|
||||||
cout<<s<<endl;
|
vec.push_back(-17);
|
||||||
|
vec.push_back(12);
|
||||||
|
//vec.erase();
|
||||||
|
cout<<vec.size();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user