Removed last integrations during runtime -> Increased speed by factor 3.

This commit is contained in:
Christian
2019-11-18 13:17:34 +01:00
parent ae6deb64bc
commit cabafc7757
3 changed files with 58 additions and 6 deletions
+4 -4
View File
@@ -14,11 +14,11 @@
#include "janev_eT2_vibexc0102.h" #include "janev_eT2_vibexc0102.h"
class eT2_VibExc01 : public Excitation_Base { class eT2_VibExc01 : public Excitation_Precomputed_Base {
Janev_eT2_VibExc calculator; Janev_eT2_VibExc calculator;
public: public:
eT2_VibExc01(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(1), eT2_VibExc01(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(1),
Excitation_Base(T2Population, rngUni, me_eV, 0.516, dcs_gen) {}; Excitation_Precomputed_Base(T2Population, rngUni, me_eV, 0.516, dcs_gen) {};
private: private:
double get_microSigma_m2(const double &E_eV) { double get_microSigma_m2(const double &E_eV) {
@@ -27,11 +27,11 @@ private:
}; };
class eT2_VibExc02 : public Excitation_Base { class eT2_VibExc02 : public Excitation_Precomputed_Base {
Janev_eT2_VibExc calculator; Janev_eT2_VibExc calculator;
public: public:
eT2_VibExc02(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(2), eT2_VibExc02(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(2),
Excitation_Base(T2Population, rngUni, me_eV, 1.003, dcs_gen) {}; Excitation_Precomputed_Base(T2Population, rngUni, me_eV, 1.003, dcs_gen) {};
private: private:
double get_microSigma_m2(const double &E_eV) { double get_microSigma_m2(const double &E_eV) {
+52
View File
@@ -68,4 +68,56 @@ private:
}; };
class Excitation_Precomputed_Base : public e_thermal_Precomputed_Interaction_Base {
DCS_Base *dcs_gen;
protected:
double deltaE_eV;
public:
Excitation_Precomputed_Base(Population_Base *Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen) : e_thermal_Precomputed_Interaction_Base(Population, rngUni, m_eV) {
this->deltaE_eV = deltaE_eV;
this->dcs_gen = dcs_gen;
}
double get_macro_sigma_m(const Particle &interPart) {
if (interPart.get_E_eV() < deltaE_eV) {
return 0;
} else {
return e_thermal_Precomputed_Interaction_Base::get_macro_sigma_m(interPart);
}
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut Excitation_Precomputed_Base::do_Interaction (Particle *interPart) {
vec3 vOff_ms = get_vOff_ms(*interPart, deltaE_eV);
vec3 vLab_ms = interPart->get_v_ms() - vOff_ms;
double EkinLab_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
double EkinLabNew_eV = EkinLab_eV - deltaE_eV;
double theta_lab = dcs_gen->get_theta(EkinLab_eV);
double phi_lab = rngUni->random() * 2 * pi;
vec3 n0 = calc_n_new(vLab_ms, theta_lab, phi_lab);
vec3 vnew_ms = n0 * calc_v_ms_from_E_eV(EkinLabNew_eV, me_eV) + vOff_ms;
interPart->set_v_ms(vnew_ms);
return InteractionOut();
}
class Exp_Excitation_Precomputed_Base : public Excitation_Precomputed_Base {
TCS_Container tcs_data;
public:
Exp_Excitation_Precomputed_Base(Population_Base *T2Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen, std::string load_file_name) : Excitation_Precomputed_Base(T2Population, rngUni, m_eV, deltaE_eV, dcs_gen),
tcs_data(scale_start, scale_end, 1e3, get_data_path() + load_file_name) {};
private:
double get_microSigma_m2(const double &E_eV) {
if (E_eV < deltaE_eV) {
return 0;
} else {
return tcs_data.get_value(E_eV);
}
}
};
#endif /* exc_base_h */ #endif /* exc_base_h */
+2 -2
View File
@@ -94,7 +94,7 @@ Interaction_Channel_Base* Interaction_Builder::build_electron(Population_Manager
if (load_parameter("eT2_ROT") == 2) { if (load_parameter("eT2_ROT") == 2) {
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 4.41e-4, exc_dcs, "rot_exc_j02.dat")); eInteraction->add(new Exp_Excitation_Precomputed_Base(T2Population, rngUni, me_eV, 4.41e-4, exc_dcs, "rot_exc_j02.dat"));
} else if (load_parameter("eT2_ROT") != 0) { } else if (load_parameter("eT2_ROT") != 0) {
throw MyException ("eT2_ROT invalid."); throw MyException ("eT2_ROT invalid.");
} }
@@ -103,7 +103,7 @@ Interaction_Channel_Base* Interaction_Builder::build_electron(Population_Manager
eInteraction->add(new eT2_VibExc01(T2Population, rngUni, exc_dcs)); eInteraction->add(new eT2_VibExc01(T2Population, rngUni, exc_dcs));
eInteraction->add(new eT2_VibExc02(T2Population, rngUni, exc_dcs)); eInteraction->add(new eT2_VibExc02(T2Population, rngUni, exc_dcs));
} else if (load_parameter("eT2_VIB") == 2) { } else if (load_parameter("eT2_VIB") == 2) {
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 0.516, exc_dcs, "vib_exc_v01.dat")); eInteraction->add(new Exp_Excitation_Precomputed_Base(T2Population, rngUni, me_eV, 0.516, exc_dcs, "vib_exc_v01.dat"));
} else if (load_parameter("eT2_VIB") != 0) { } else if (load_parameter("eT2_VIB") != 0) {
throw MyException ("eT2_VIB invalid."); throw MyException ("eT2_VIB invalid.");
} }