|
|
|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
|
|
|
|
#include "interaction_base.h"
|
|
|
|
|
|
|
|
|
|
class E_kinetic_Interaction_Base : public Interaction_Base { // Interactions of electrons with kinetic resolved TI (but thermal)
|
|
|
|
|
class e_kinetic_Interaction_Base : public Interaction_Base { // Interactions of electrons with kinetic resolved TI (but thermal)
|
|
|
|
|
protected:
|
|
|
|
|
double m1_eV; // energy of kinetic particle for CS measurement : e-
|
|
|
|
|
double m2_eV; // energy of massive: TI
|
|
|
|
@@ -20,7 +20,7 @@ protected:
|
|
|
|
|
double *vI_mids; // corresponding v_values
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
E_kinetic_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
|
|
|
|
|
e_kinetic_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
|
|
|
|
|
m1_eV = m_eV;
|
|
|
|
|
m2_eV = Population->get_m_eV();
|
|
|
|
|
|
|
|
|
@@ -41,15 +41,16 @@ public:
|
|
|
|
|
protected:
|
|
|
|
|
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
|
|
|
|
double calc_microSigma_m2(const double &E_eV, const int &EI_bin);
|
|
|
|
|
vec3 get_vOff_ms(const Particle &interPart, const double &minE_eV); // For derived class -> Roll energy loss
|
|
|
|
|
private:
|
|
|
|
|
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline double E_kinetic_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
|
|
|
|
inline double e_kinetic_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
|
|
|
|
return calc_macro_sigma_m(interPart.get_E_eV(), interPart.get_x_m());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline double E_kinetic_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
|
|
|
|
inline double e_kinetic_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
|
|
|
|
Bins loc_bins = Population->get_loc_bin(loc_m);
|
|
|
|
|
double macro_sigma_m = 0;
|
|
|
|
|
for (int EI_bin = 0; EI_bin<num_EI_bins; EI_bin++) {
|
|
|
|
@@ -58,7 +59,7 @@ inline double E_kinetic_Interaction_Base::calc_macro_sigma_m(const double &E_eV,
|
|
|
|
|
return macro_sigma_m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline double E_kinetic_Interaction_Base::calc_microSigma_m2(const double &E_eV, const int &EI_bin) {
|
|
|
|
|
inline double e_kinetic_Interaction_Base::calc_microSigma_m2(const double &E_eV, const int &EI_bin) {
|
|
|
|
|
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
|
|
|
|
double v2_ms = vI_mids[EI_bin];
|
|
|
|
|
|
|
|
|
@@ -73,12 +74,30 @@ inline double E_kinetic_Interaction_Base::calc_microSigma_m2(const double &E_eV,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class E_kinetic_Precomputed_Interaction_Base : public E_kinetic_Interaction_Base { // Precompute Interactions of ions with kinetic e Populations
|
|
|
|
|
inline vec3 e_kinetic_Interaction_Base::get_vOff_ms(const Particle &interPart, const double &minE_eV) {
|
|
|
|
|
vec3 v1_ms = interPart.get_v_ms();
|
|
|
|
|
vec3 v2_ms = Population->roll_v_ms(interPart.get_x_m());
|
|
|
|
|
vec3 v1Lab_ms = v1_ms - v2_ms;
|
|
|
|
|
double T_eV = calc_E_eV_from_v_ms(v1Lab_ms, m1_eV);
|
|
|
|
|
if (T_eV < minE_eV) {
|
|
|
|
|
T_eV = calc_E_eV_from_v_ms(v1_ms, m1_eV);
|
|
|
|
|
if (T_eV < minE_eV) {
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss<<"Interaction_Base::get_vOff_ms: T_eV < minE_eV.\nT_eV= "<< T_eV<<"\t minE_eV= "<<minE_eV<<"\n";
|
|
|
|
|
throw MyException (ss.str());
|
|
|
|
|
}
|
|
|
|
|
return vec3(0,0,0);
|
|
|
|
|
}
|
|
|
|
|
return v2_ms;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class e_kinetic_Precomputed_Interaction_Base : public e_kinetic_Interaction_Base { // Precompute Interactions of ions with kinetic e Populations
|
|
|
|
|
Log_Scale E_scale; // E_scale for Interpolation calculation
|
|
|
|
|
double **precomputed_values;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
E_kinetic_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : E_kinetic_Interaction_Base(Population, rngUni, m_eV), E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N) {
|
|
|
|
|
e_kinetic_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : e_kinetic_Interaction_Base(Population, rngUni, m_eV), E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N) {
|
|
|
|
|
precomputed_values = new double *[E_scale.get_number_bins()];
|
|
|
|
|
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
|
|
|
|
|
precomputed_values[EI_bin] = new double[num_EI_bins];
|
|
|
|
@@ -91,7 +110,7 @@ private:
|
|
|
|
|
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline void E_kinetic_Precomputed_Interaction_Base::calc_values() {
|
|
|
|
|
inline void e_kinetic_Precomputed_Interaction_Base::calc_values() {
|
|
|
|
|
for (int Ee_bin=0; Ee_bin<E_scale.get_number_bins(); Ee_bin++) {
|
|
|
|
|
for (int EI_bin = 0; EI_bin<num_EI_bins; EI_bin++) {
|
|
|
|
|
precomputed_values[Ee_bin][EI_bin] = calc_microSigma_m2(E_scale.get_bin_mid(Ee_bin), EI_bin);
|
|
|
|
@@ -99,7 +118,7 @@ inline void E_kinetic_Precomputed_Interaction_Base::calc_values() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline double E_kinetic_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
|
|
|
|
inline double e_kinetic_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
|
|
|
|
vec3 loc_m = interPart.get_x_m();
|
|
|
|
|
double E_eV = interPart.get_E_eV();
|
|
|
|
|
|
|
|
|
@@ -110,7 +129,7 @@ inline double E_kinetic_Precomputed_Interaction_Base::get_macro_sigma_m(const Pa
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline double E_kinetic_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
|
|
|
|
inline double e_kinetic_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
|
|
|
|
int Ee_bin = E_scale.calc_index(E_eV);
|
|
|
|
|
double *microSigmas = precomputed_values[Ee_bin];
|
|
|
|
|
|
|
|
|
|