Version for "Ignore Ion energy, just used electron energy for mcs-calculation"
This commit is contained in:
@@ -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
|
||||
@@ -122,6 +122,107 @@ inline double TI_e_Precomputed_Interaction_Base::lookup_macro_sigma_m(const doub
|
||||
macro_sigma_m += microSigmas[Ee_bin] * Population->get_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_bin<num_Ee_bins; Ee_bin++) {
|
||||
Ee_mids[Ee_bin] = Population->get_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_bin<num_Ee_bins; Ee_bin++) {
|
||||
macro_sigma_m += calc_microSigma_m2(E_eV, Ee_bin) * Population->get_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_bin<E_scale.get_number_bins(); EI_bin++) {
|
||||
precomputed_values[EI_bin] = new double[num_Ee_bins];
|
||||
}
|
||||
}
|
||||
void calc_values();
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
|
||||
private:
|
||||
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||
};
|
||||
|
||||
inline void TI_e_Precomputed_Interaction_Base::calc_values() {
|
||||
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
|
||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
||||
precomputed_values[EI_bin][Ee_bin] = calc_microSigma_m2(E_scale.get_bin_mid(EI_bin), Ee_bin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_e_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double E_eV = interPart.get_E_eV();
|
||||
|
||||
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 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_bin<num_Ee_bins; Ee_bin++) {
|
||||
macro_sigma_m += microSigmas[Ee_bin] * Population->get_density_m3(Ee_bin, loc_bins);
|
||||
}
|
||||
return macro_sigma_m;
|
||||
}
|
||||
#endif /* TI_kinetic_base_h */
|
||||
|
||||
Reference in New Issue
Block a user