From ea7248868fecec29644adc13c316e1e08f4351ba Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 30 Nov 2019 09:50:25 +0100 Subject: [PATCH] Prelimary final --- src/mc_electron/TI_kinetic_base.h | 107 ++---------------------------- src/mc_electron/eT2_ionization.h | 1 + src/mc_electron/e_thermal_base.h | 98 +-------------------------- 3 files changed, 7 insertions(+), 199 deletions(-) diff --git a/src/mc_electron/TI_kinetic_base.h b/src/mc_electron/TI_kinetic_base.h index 0b36c10..894bcf4 100644 --- a/src/mc_electron/TI_kinetic_base.h +++ b/src/mc_electron/TI_kinetic_base.h @@ -12,7 +12,7 @@ #include "interaction_base.h" -/*class TI_e_Interaction_Base : public Interaction_Base { // Interactions of ions with kinetic e Populations +class TI_e_Interaction_Base : public Interaction_Base { // Interactions of ions with kinetic e Populations protected: double m1_eV; // energy of kinetic particle for CS measurement : e- double m2_eV; // energy of massic initial particle : TI @@ -60,6 +60,7 @@ inline double TI_e_Interaction_Base::calc_macro_sigma_m(const double &E_eV, cons } inline double TI_e_Interaction_Base::calc_microSigma_m2(const double &E2_eV, const int &Ee_bin) { + //return get_microSigma_m2(Ee_mids[Ee_bin]); No Integration... ONly e- energy double v1_ms = ve_mids[Ee_bin]; double v2_ms = calc_v_ms_from_E_eV(E2_eV, m2_eV); @@ -111,108 +112,6 @@ inline double TI_e_Precomputed_Interaction_Base::get_macro_sigma_m(const Particl } } -inline double TI_e_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) { - int EI_bin = E_scale.calc_index(E_eV); - double *microSigmas = precomputed_values[EI_bin]; - - Bins loc_bins = Population->get_loc_bin(loc_m); - double macro_sigma_m = 0; - - for (int Ee_bin = 0; Ee_binget_density_m3(Ee_bin, loc_bins); - } - return macro_sigma_m; -} */ - - -class TI_e_Interaction_Base : public Interaction_Base { // Interactions of ions with kinetic e Populations -protected: - double m1_eV; // energy of kinetic particle for CS measurement : e- - double m2_eV; // energy of massic initial particle : TI - int num_Ee_bins; // number of Ee_bins in Populations - double *Ee_mids; // values for energy mids of Ee_bins in Populations - double *ve_mids; // corresponding v_values - -public: - TI_e_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) { - m1_eV = Population->get_m_eV(); - m2_eV = m_eV; - - num_Ee_bins = Population->get_number_E_bins(); - if (num_Ee_bins <= 1) { - throw MyException("Population is not kinetic, when expected kinetic."); - } - ve_mids = new double[num_Ee_bins]; - Ee_mids = new double[num_Ee_bins]; - - for (int Ee_bin = 0; Ee_binget_E_bin_mid_eV(Ee_bin); - ve_mids[Ee_bin] = calc_v_ms_from_E_eV(Ee_mids[Ee_bin], m1_eV); - } - } - double get_macro_sigma_m(const Particle &interPart); - -protected: - double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m); - double calc_microSigma_m2(const double &E1_eV, const int &Ee_bin); -private: - virtual double get_microSigma_m2(const double &E_eV) = 0; -}; - -inline double TI_e_Interaction_Base::get_macro_sigma_m(const Particle &interPart) { - return calc_macro_sigma_m(interPart.get_E_eV(), interPart.get_x_m()); -} - -inline double TI_e_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 Ee_bin = 0; Ee_binget_density_m3(Ee_bin, loc_bins); - } - return macro_sigma_m; -} - -inline double TI_e_Interaction_Base::calc_microSigma_m2(const double &E2_eV, const int &Ee_bin) { - return get_microSigma_m2(Ee_mids[Ee_bin]); -} - -class TI_e_Precomputed_Interaction_Base : public TI_e_Interaction_Base { // Precompute Interactions of ions with kinetic e Populations - Log_Scale E_scale; // E_scale for Interpolation calculation - double **precomputed_values; - -public: - TI_e_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_e_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_binadd_new_particle(newPart); } }; + #endif /* eT2_ionization_h */ diff --git a/src/mc_electron/e_thermal_base.h b/src/mc_electron/e_thermal_base.h index f48efbe..c8797f7 100644 --- a/src/mc_electron/e_thermal_base.h +++ b/src/mc_electron/e_thermal_base.h @@ -11,7 +11,7 @@ #include "interaction_base.h" -/* + class e_thermal_Interaction_Base : public Interaction_Base { // Interactions of electrons with thermal Populations protected: double m1_eV; // energy of kinetic particle in CS measurement : e- @@ -50,6 +50,7 @@ inline double e_thermal_Interaction_Base::calc_macro_sigma_m(const double &E_eV, } inline double e_thermal_Interaction_Base::calc_microSigma_m2(const double &E_eV) { + //return get_microSigma_m2(E_eV); No Integration... ONly e- energy if (E_eV > E_limit) { return get_microSigma_m2(E_eV); } else { @@ -116,101 +117,6 @@ inline double e_thermal_Precomputed_Interaction_Base::lookup_macro_sigma_m(const int i = E_scale.calc_index(E_eV); return precomputed_values[i] * Population->get_density_m3(loc_m); } -*/ -class e_thermal_Interaction_Base : public Interaction_Base { // Interactions of electrons with thermal Populations -protected: - double m1_eV; // energy of kinetic particle in CS measurement : e- - - double E_limit; // limit for integration calculation - double v_therm; // typical spped for thermal population - -public: - e_thermal_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) { - if (Population->get_number_E_bins() > 1) { - throw MyException("Population is not thermal, when expected thermal."); - } - m1_eV = m_eV; - v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur" - E_limit = calc_E_eV_from_v_ms(v_therm * 2000, m1_eV); // 2000 represents 1% variation in energy - } - double get_macro_sigma_m(const Particle &interPart); - -protected: - double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m); - double calc_microSigma_m2(const double &E_eV); - 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_thermal_Interaction_Base::get_macro_sigma_m(const Particle &interPart) { - vec3 loc_m = interPart.get_x_m(); - double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur" - double E_eV = calc_E_eV_from_v_ms(v_ms, m1_eV); // Lab energy without thermal integration - return calc_macro_sigma_m(E_eV, loc_m); -} - -inline double e_thermal_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) { - return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m); -} - -inline double e_thermal_Interaction_Base::calc_microSigma_m2(const double &E_eV) { - return get_microSigma_m2(E_eV); -} - -inline vec3 e_thermal_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= "<get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur" - double E_eV = calc_E_eV_from_v_ms(v_ms, m1_eV); // Lab energy without thermal integration - if (E_scale.in_scale(E_eV)) { - return lookup_macro_sigma_m(E_eV, loc_m); - } else { - return calc_macro_sigma_m(E_eV, loc_m); - } -} - -inline double e_thermal_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) { - int i = E_scale.calc_index(E_eV); - return precomputed_values[i] * Population->get_density_m3(loc_m); -} #endif /* e_thermal_base_h */