Files
katrin-plasma/src/mc_electron/exc_base.h
T

124 lines
3.7 KiB
C++

//
// exc_base.h
// mc_electron
//
// Created by Christian Reiling on 18.06.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef exc_base_h
#define exc_base_h
#include "e_thermal_base.h"
#include "tcs_container.hpp"
#include "dcs_base.h"
class Excitation_Base : public e_thermal_Interaction_Base {
DCS_Base *dcs_gen;
protected:
double deltaE_eV;
public:
Excitation_Base(Population_Base *Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen) : e_thermal_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_Interaction_Base::get_macro_sigma_m(interPart);
}
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut Excitation_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_Base : public Excitation_Base {
TCS_Container tcs_data;
public:
Exp_Excitation_Base(Population_Base *T2Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen, std::string load_file_name) : Excitation_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);
}
}
};
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 */