Compare commits
1
Commits
divB_mover
...
jrupp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
561131906b |
@@ -23,15 +23,53 @@ public:
|
|||||||
InteractionOut do_Interaction (Particle *interPart);
|
InteractionOut do_Interaction (Particle *interPart);
|
||||||
protected:
|
protected:
|
||||||
double get_microSigma_m2(const double &E_eV) {
|
double get_microSigma_m2(const double &E_eV) {
|
||||||
return Janev_eT2I_Recombination::get_TCS(E_eV);
|
double twoEam2 = (E_eV + m2_eV) * 2 * m1_eV;
|
||||||
|
double E_kin_incident = twoEam2 / (2 * m2_eV) - m1_eV;
|
||||||
|
if(E_kin_incident == 0.0){
|
||||||
|
std::cout << "ACHTUNG Energie ist 0" << "\n";
|
||||||
|
}
|
||||||
|
//std::cout << "E_kin_incident " << E_kin_incident << "\n";
|
||||||
|
return Janev_eT2I_Recombination::get_TCS(E_kin_incident);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) {
|
inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||||
InteractionOut res;
|
InteractionOut res;
|
||||||
res.set_delete_current(true);
|
res.set_delete_current(true);
|
||||||
double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances.
|
|
||||||
|
std::cout <<interPart->get_species() << " RECO mit " <<Population->get_species()<<"\n";
|
||||||
|
//std::cout << "Energie von teilchen " << interPart->get_E_eV() <<"\n";
|
||||||
|
//std::cout << "sigma von interaction T2+ mit e- " << get_microSigma_m2(interPart->get_E_eV())<<"\n";
|
||||||
|
|
||||||
|
|
||||||
|
//std::cout << "v_ms von pop e- = " << Population->roll_v_ms(interPart->get_x_m())[0]<<"\n";
|
||||||
|
//std::cout << "v_ms von pop e- = " << Population->roll_v_ms(interPart->get_x_m())[0]<<"\n";
|
||||||
|
//double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances.
|
||||||
|
//double E_eV = calc_E_eV_from_v_ms_richtig(Population->roll_v_ms(interPart->get_x_m()));
|
||||||
|
double E_eV = Population->roll_v_ms(interPart->get_x_m())(0);
|
||||||
|
//fehler? roll_v_ms gibt eine energie
|
||||||
|
std::cout << "Energie aus e- pop " << E_eV <<"\n";
|
||||||
|
//std::cout << "Ort des interpart = " << interPart->get_x_m()<<"\n";
|
||||||
|
|
||||||
|
//E_eV = 1.0; //damit es mal geht, komischer Fehler
|
||||||
|
|
||||||
|
double E_min_eV = 1e-7;
|
||||||
|
double E_max_eV = 2e4;
|
||||||
|
int number_E_bins = 50;
|
||||||
|
Log_Scale E_scale;
|
||||||
|
E_scale = Log_Scale(E_min_eV, E_max_eV, number_E_bins);
|
||||||
|
int Ee_bin = E_scale.calc_index(E_eV);
|
||||||
|
std::cout<<"Ee_bin = " << Ee_bin<<"\n";
|
||||||
|
//std::cout << "E_eV = " << E_eV<<"\n";
|
||||||
|
Bins loc_bin = Population->get_loc_bin(interPart->get_x_m());
|
||||||
|
|
||||||
|
//std::cout<<"E aus roll v = "<<E_eV<<"\n";
|
||||||
|
double n1 = Population->get_density_m3(Ee_bin, loc_bin); //nur zum schauen
|
||||||
|
//std::cout<<"Population vor Recombination = "<<n1<<"\n";
|
||||||
Population->decrease_denisty(interPart->get_x_m(), E_eV);
|
Population->decrease_denisty(interPart->get_x_m(), E_eV);
|
||||||
|
double n2 = Population->get_density_m3(Ee_bin, loc_bin); //nur zum schauen
|
||||||
|
//std::cout<<"Population nach Recombination = "<<n2<<"\n";
|
||||||
|
//std::cout<<"T2+ wurde gelöscht"<<"\n";
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+157
-2
@@ -50,28 +50,183 @@ 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());
|
return calc_macro_sigma_m(interPart.get_E_eV(), interPart.get_x_m());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double gammafaktor(double v) {
|
||||||
|
return 1/sqrt(1-pow(v/c_ms, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline double TI_e_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_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);
|
Bins loc_bins = Population->get_loc_bin(loc_m);
|
||||||
|
|
||||||
|
std::cout << "Energie von T2+ in calc macro sigma also in mirco sigma: " << E_eV << "\n";
|
||||||
|
|
||||||
|
//get_microSigma_m2(0.0); gucken
|
||||||
|
|
||||||
double macro_sigma_m = 0;
|
double macro_sigma_m = 0;
|
||||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
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);
|
macro_sigma_m += calc_microSigma_m2(E_eV, Ee_bin) * Population->get_density_m3(Ee_bin, loc_bins);
|
||||||
|
if(Population->get_density_m3(Ee_bin, loc_bins) > 0 ){
|
||||||
|
|
||||||
|
double v1_ms = ve_mids[Ee_bin]; //ist nährungsweise die richitge geschwindigkeit für elektorn
|
||||||
|
double v2_ms = calc_v_ms_from_E_eV(E_eV, m2_eV); //ist die richtige geschwindigkeit für ion
|
||||||
|
std::cout << "Energie von elektron hier: " << Ee_mids[Ee_bin] << "\n";
|
||||||
|
std::cout << "v von elektron hier: " << v1_ms << "\n";
|
||||||
|
if (v1_ms > v2_ms*2000 ) { // 2000 represents 1% variation in energy
|
||||||
|
//std::cout << "machen wir das?" << "\n";
|
||||||
|
//std::cout << Ee_mids[Ee_bin] << "\n";
|
||||||
|
//std::cout << get_microSigma_m2(Ee_mids[Ee_bin]) << "\n";
|
||||||
|
//std::cout << "wird das gemacht? " << "\n";
|
||||||
|
return get_microSigma_m2(Ee_mids[Ee_bin]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//neu
|
||||||
|
|
||||||
|
double v1_ms = ve_mids[Ee_bin];
|
||||||
|
double v2_ms = calc_v_ms_from_E_eV(E_eV, m2_eV);
|
||||||
|
//std::cout << "v1 " << v1_ms <<"\n";
|
||||||
|
//std::cout << "v2 " << v2_ms <<"\n";
|
||||||
|
auto integrand = [&](double theta) {
|
||||||
|
|
||||||
|
|
||||||
|
double p1 = gammafaktor(v2_ms) * m2_eV * v2_ms / c_ms;
|
||||||
|
double p2 = gammafaktor(v1_ms) * m1_eV * v1_ms / c_ms;
|
||||||
|
|
||||||
|
double E1 = sqrt(pow(m2_eV, 2) + pow(p1, 2)); // so ist es wie im python skyript
|
||||||
|
double E2 = sqrt(pow(m1_eV, 2) + pow(p2, 2)); // wie im skrpt
|
||||||
|
|
||||||
|
|
||||||
|
//std::cout << "E1 " << E1 << "\n"; // ion
|
||||||
|
//std::cout << "E2 " << E2 << "\n"; // elektron
|
||||||
|
//std::cout << "v1 " << v1_ms << "\n"; // elektron
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n"; // ion
|
||||||
|
//std::cout << "p1 " << p1 << "\n"; // p von ion
|
||||||
|
//std::cout << "p2 " << p2 << "\n"; // p von elektorn
|
||||||
|
//std::cout << "m1 " << m1_eV << "\n"; // elektron
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n"; // ion
|
||||||
|
|
||||||
|
double s = pow(m1_eV,2) + pow(m2_eV,2) + 2 * E1 * E2 - 2 * p1 * p2 * cos(theta);
|
||||||
|
//std::cout << "s " << s << "\n";
|
||||||
|
double E_cm_eV = sqrt(s) - m1_eV - m2_eV;
|
||||||
|
//std::cout << "theta " << theta << "\n";
|
||||||
|
//std::cout << "E_cm_eV " << E_cm_eV << "\n";
|
||||||
|
double twoEam2 = s - pow(m1_eV, 2) - pow(m2_eV, 2);
|
||||||
|
double E_incident = twoEam2/(2*m1_eV);
|
||||||
|
double E_kin_incident = E_incident - m2_eV;
|
||||||
|
|
||||||
|
|
||||||
|
//double E_eV = m2_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2); // m1_eV equals reduced mass
|
||||||
|
|
||||||
|
//std::cout << "Energie für microsigma berechnung " << E_eV <<"\n";
|
||||||
|
return get_microSigma_m2(E_kin_incident);
|
||||||
|
};
|
||||||
|
|
||||||
|
double integralergebnis = integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
std::cout << "integral gibt: " << integralergebnis <<"\n";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
//alt
|
||||||
|
auto integrand = [&](double theta) {
|
||||||
|
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||||
|
return get_microSigma_m2(E_eV);
|
||||||
|
};
|
||||||
|
|
||||||
|
double integralergebnis = integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
std::cout << "integral gibt: " << integralergebnis <<"\n";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "sigma einfach eingeseitzt " << get_microSigma_m2(E_eV) << "\n";
|
||||||
|
std::cout << "monte carlo micro sigma " << calc_microSigma_m2(E_eV, Ee_bin) << "\n";
|
||||||
|
std::cout << "Monte carlo macro sigma " << macro_sigma_m << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
//std::cout << "micro sigma in calcmacrosigma in ohne precomputed" << calc_microSigma_m2(E_eV, Ee_bin) <<"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return macro_sigma_m;
|
return macro_sigma_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double TI_e_Interaction_Base::calc_microSigma_m2(const double &E2_eV, const int &Ee_bin) {
|
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
|
//return get_microSigma_m2(Ee_mids[Ee_bin]); // No Integration... Only e- energy
|
||||||
double v1_ms = ve_mids[Ee_bin];
|
double v1_ms = ve_mids[Ee_bin]; //ist nährungsweise die richitge geschwindigkeit für elektorn
|
||||||
double v2_ms = calc_v_ms_from_E_eV(E2_eV, m2_eV);
|
double v2_ms = calc_v_ms_from_E_eV(E2_eV, m2_eV); //ist die richtige geschwindigkeit für ion
|
||||||
|
|
||||||
if (v1_ms > v2_ms*2000 ) { // 2000 represents 1% variation in energy
|
if (v1_ms > v2_ms*2000 ) { // 2000 represents 1% variation in energy
|
||||||
|
//std::cout << "machen wir das?" << "\n";
|
||||||
|
//std::cout << Ee_mids[Ee_bin] << "\n";
|
||||||
|
//std::cout << get_microSigma_m2(Ee_mids[Ee_bin]) << "\n";
|
||||||
|
//std::cout << "wird das gemacht? " << "\n";
|
||||||
return get_microSigma_m2(Ee_mids[Ee_bin]);
|
return get_microSigma_m2(Ee_mids[Ee_bin]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//neu
|
||||||
|
|
||||||
|
double v1_ms = ve_mids[Ee_bin];
|
||||||
|
double v2_ms = calc_v_ms_from_E_eV(E2_eV, m2_eV);
|
||||||
|
//std::cout << "v1 " << v1_ms <<"\n";
|
||||||
|
//std::cout << "v2 " << v2_ms <<"\n";
|
||||||
|
auto integrand = [&](double theta) {
|
||||||
|
|
||||||
|
|
||||||
|
double p1 = gammafaktor(v2_ms) * m2_eV * v2_ms / c_ms;
|
||||||
|
double p2 = gammafaktor(v1_ms) * m1_eV * v1_ms / c_ms;
|
||||||
|
|
||||||
|
double E1 = sqrt(pow(m2_eV, 2) + pow(p1, 2)); // so ist es wie im python skyript
|
||||||
|
double E2 = sqrt(pow(m1_eV, 2) + pow(p2, 2)); // wie im skrpt
|
||||||
|
|
||||||
|
|
||||||
|
//std::cout << "E1 " << E1 << "\n"; // ion
|
||||||
|
//std::cout << "E2 " << E2 << "\n"; // elektron
|
||||||
|
//std::cout << "v1 " << v1_ms << "\n"; // elektron
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n"; // ion
|
||||||
|
//std::cout << "p1 " << p1 << "\n"; // p von ion
|
||||||
|
//std::cout << "p2 " << p2 << "\n"; // p von elektorn
|
||||||
|
//std::cout << "m1 " << m1_eV << "\n"; // elektron
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n"; // ion
|
||||||
|
|
||||||
|
double s = pow(m1_eV,2) + pow(m2_eV,2) + 2 * E1 * E2 - 2 * p1 * p2 * cos(theta);
|
||||||
|
//std::cout << "s " << s << "\n";
|
||||||
|
double E_cm_eV = sqrt(s) - m1_eV - m2_eV;
|
||||||
|
//std::cout << "theta " << theta << "\n";
|
||||||
|
//std::cout << "E_cm_eV " << E_cm_eV << "\n";
|
||||||
|
double twoEam2 = s - pow(m1_eV, 2) - pow(m2_eV, 2);
|
||||||
|
double E_incident = twoEam2/(2*m1_eV);
|
||||||
|
double E_kin_incident = E_incident - m2_eV;
|
||||||
|
|
||||||
|
|
||||||
|
//double E_eV = m2_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2); // m1_eV equals reduced mass
|
||||||
|
|
||||||
|
//std::cout << "Energie für microsigma berechnung " << E_eV <<"\n";
|
||||||
|
return get_microSigma_m2(E_kin_incident);
|
||||||
|
};
|
||||||
|
|
||||||
|
double integralergebnis = integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
return integralergebnis;
|
||||||
|
//std::cout << "integral gibt: " << integralergebnis <<"\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
//alt
|
||||||
auto integrand = [&](double theta) {
|
auto integrand = [&](double theta) {
|
||||||
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||||
return get_microSigma_m2(E_eV);
|
return get_microSigma_m2(E_eV);
|
||||||
};
|
};
|
||||||
return integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
return integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,121 @@ inline void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
|||||||
movePart->set_x_m(newLoc_m);
|
movePart->set_x_m(newLoc_m);
|
||||||
do_E_calculus(movePart, oldLoc_m, macro_sigma_m);
|
do_E_calculus(movePart, oldLoc_m, macro_sigma_m);
|
||||||
Logger->log(*movePart, oldLoc_m);
|
Logger->log(*movePart, oldLoc_m);
|
||||||
|
|
||||||
|
double E_min_eV = 1e-7;
|
||||||
|
double E_max_eV = 2e4;
|
||||||
|
int number_E_bins = 50;
|
||||||
|
|
||||||
|
Log_Scale E_scale;
|
||||||
|
E_scale = Log_Scale(E_min_eV, E_max_eV, number_E_bins);
|
||||||
|
double E_eV = movePart->get_E_eV();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double n = Population->get_density_m3(oldLoc_m);
|
||||||
|
//std::cout << "Pop vor Erhöhung: " << Population->get_species() << " "<< n <<"\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(const MyException& e)
|
||||||
|
{
|
||||||
|
double E_eV = movePart->get_E_eV();
|
||||||
|
int Ee_bin = E_scale.calc_index(E_eV);
|
||||||
|
Bins loc_bin = Population->get_loc_bin(oldLoc_m);
|
||||||
|
double n = Population->get_density_m3(Ee_bin, loc_bin);
|
||||||
|
//std::cout << "Pop vor Erhöhung: " << Population->get_species() << " " << n << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bins dummyloc0 = Population->get_loc_bin(vec3(0,0,0));
|
||||||
|
Bins dummyloc1 = Population->get_loc_bin(vec3(0,0,1));
|
||||||
|
Bins dummyloc2 = Population->get_loc_bin(vec3(0,0,2));
|
||||||
|
Bins dummyloc3 = Population->get_loc_bin(vec3(0,0,3));
|
||||||
|
Bins dummyloc4 = Population->get_loc_bin(vec3(0,0,4));
|
||||||
|
Bins dummyloc5 = Population->get_loc_bin(vec3(0,0,5));
|
||||||
|
Bins dummyloc6 = Population->get_loc_bin(vec3(0,0,6));
|
||||||
|
Bins dummyloc7 = Population->get_loc_bin(vec3(0,0,7));
|
||||||
|
Bins dummyloc8 = Population->get_loc_bin(vec3(0,0,8));
|
||||||
|
Bins dummyloc9 = Population->get_loc_bin(vec3(0,0,9));
|
||||||
|
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc0) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc1) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc2) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc3) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc4) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc5) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc6) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc7) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc8) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc9) << "\n";
|
||||||
|
*/
|
||||||
|
//std::cerr << e.what() << '\n';
|
||||||
|
/*
|
||||||
|
for (int Ee_bin = 0; Ee_bin<number_E_bins; Ee_bin++) {
|
||||||
|
if(Population->get_density_m3(Ee_bin, loc_bin) > 0){
|
||||||
|
std::cout << "Dichte die einen Beitrag liefert: " << Population->get_density_m3(Ee_bin, loc_bin) <<"\n";
|
||||||
|
//std::cout << macro_sigma_m<<"\n";
|
||||||
|
//std::cout << Ee_bin <<"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
//std::cout << "hier gehts rein?" << "\n";
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Population->get_density_m3()
|
||||||
Population->increase_density(*movePart, oldLoc_m);
|
Population->increase_density(*movePart, oldLoc_m);
|
||||||
|
//Population->get_density_m3()
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double n = Population->get_density_m3(oldLoc_m);
|
||||||
|
//std::cout << "Pop nach Erhöhung: " << Population->get_species() << " " << n <<"\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(const MyException& e)
|
||||||
|
{
|
||||||
|
double E_eV = movePart->get_E_eV();
|
||||||
|
int Ee_bin = E_scale.calc_index(E_eV);
|
||||||
|
Bins loc_bin = Population->get_loc_bin(oldLoc_m);
|
||||||
|
double n = Population->get_density_m3(Ee_bin, loc_bin);
|
||||||
|
//std::cout << "Pop nach Erhöhung: " << Population->get_species() << " " << n << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bins dummyloc0 = Population->get_loc_bin(vec3(0,0,0));
|
||||||
|
Bins dummyloc1 = Population->get_loc_bin(vec3(0,0,1));
|
||||||
|
Bins dummyloc2 = Population->get_loc_bin(vec3(0,0,2));
|
||||||
|
Bins dummyloc3 = Population->get_loc_bin(vec3(0,0,3));
|
||||||
|
Bins dummyloc4 = Population->get_loc_bin(vec3(0,0,4));
|
||||||
|
Bins dummyloc5 = Population->get_loc_bin(vec3(0,0,5));
|
||||||
|
Bins dummyloc6 = Population->get_loc_bin(vec3(0,0,6));
|
||||||
|
Bins dummyloc7 = Population->get_loc_bin(vec3(0,0,7));
|
||||||
|
Bins dummyloc8 = Population->get_loc_bin(vec3(0,0,8));
|
||||||
|
Bins dummyloc9 = Population->get_loc_bin(vec3(0,0,9));
|
||||||
|
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc0) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc1) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc2) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc3) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc4) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc5) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc6) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc7) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc8) << "\n";
|
||||||
|
std::cout << "pop: " << Population->get_density_m3(Ee_bin, dummyloc9) << "\n";
|
||||||
|
*/
|
||||||
|
//std::cerr << e.what() << '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯o_sigma_m) {
|
inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯o_sigma_m) {
|
||||||
double zold_m = movePart->get_x_m()[2];
|
double zold_m = movePart->get_x_m()[2];
|
||||||
|
|
||||||
@@ -56,6 +168,14 @@ inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯o_sig
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double distance_m = 1/macro_sigma_m;
|
double distance_m = 1/macro_sigma_m;
|
||||||
|
//distance * e^x mit mu=1
|
||||||
|
//std::cout<<"Distanz ohne random = " << distance_m<<"\n";
|
||||||
|
UniRNG rngUni;
|
||||||
|
double number = rngUni.random();
|
||||||
|
//double number = distribution(generator);
|
||||||
|
//std::cout << "rngUni " << x <<"\n";
|
||||||
|
distance_m = - distance_m * log(number);
|
||||||
|
//std::cout<<"Distanz mit random = " << distance_m<<"\n";
|
||||||
znew_m = zold_m + zDir*vForwardAbs_ms/vTotAbs_ms * distance_m;
|
znew_m = zold_m + zDir*vForwardAbs_ms/vTotAbs_ms * distance_m;
|
||||||
}
|
}
|
||||||
return znew_m;
|
return znew_m;
|
||||||
|
|||||||
@@ -30,7 +30,15 @@ inline InteractionOut eT2I_Recombination::do_Interaction (Particle *interPart) {
|
|||||||
InteractionOut res;
|
InteractionOut res;
|
||||||
res.set_delete_current(true);
|
res.set_delete_current(true);
|
||||||
//std::cout<<"eT2I:\t"<<*interPart<<"\n";
|
//std::cout<<"eT2I:\t"<<*interPart<<"\n";
|
||||||
//Population->decrease_denisty(interPart->get_x_m(), 0);
|
std::cout<<interPart->get_species()<<" RECO mit " << Population->get_species() << "\n";
|
||||||
|
//std::cout << "Energie von teilchen " << interPart->get_E_eV() <<"\n";
|
||||||
|
//std::cout << "sigma von interaction e- mit T2+ " << get_microSigma_m2(interPart->get_E_eV())<< "\n";
|
||||||
|
//Bins loc_bin = Population->get_loc_bin(interPart->get_x_m());
|
||||||
|
double n1 = Population->get_density_m3(interPart->get_x_m()); //nur zum schauen
|
||||||
|
//std::cout<<"Population vor Recombination = "<< n1<<"\n";
|
||||||
|
Population->decrease_denisty(interPart->get_x_m(), 0);
|
||||||
|
double n2 = Population->get_density_m3(interPart->get_x_m());
|
||||||
|
//std::cout<<"Population nach Recombination = " <<n2<<"\n";
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+190
-4
@@ -25,7 +25,9 @@ public:
|
|||||||
throw MyException("Population is not thermal, when expected thermal.");
|
throw MyException("Population is not thermal, when expected thermal.");
|
||||||
}
|
}
|
||||||
m1_eV = m_eV;
|
m1_eV = m_eV;
|
||||||
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
//v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||||
|
//v_therm = calc_v_ms_from_E_eV(0.1, 2*mT_eV); //gleiche energie
|
||||||
|
v_therm = calc_v_ms_from_E_eV(0.0018, me_eV); // gleiche geschwidingkeit
|
||||||
E_limit = calc_E_eV_from_v_ms(v_therm * 2000, m1_eV); // 2000 represents 1% variation in energy
|
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);
|
double get_macro_sigma_m(const Particle &interPart);
|
||||||
@@ -45,7 +47,93 @@ inline double e_thermal_Interaction_Base::get_macro_sigma_m(const Particle &inte
|
|||||||
return calc_macro_sigma_m(E_eV, loc_m);
|
return calc_macro_sigma_m(E_eV, loc_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double gammafaktor2(double v) {
|
||||||
|
return 1/sqrt(1-pow(v/c_ms, 2));
|
||||||
|
}
|
||||||
|
|
||||||
inline double e_thermal_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
inline double e_thermal_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||||
|
//std::cout <<"calc"<<"\n";
|
||||||
|
//std::cout << "Dichte für get sigma: " << Population->get_density_m3(loc_m)<<"\n";
|
||||||
|
//std::cout << "calc macro_sigma in e_thermal interaction base macht was "<< "\n";
|
||||||
|
//std::cout << "Dichte die verwednet wird: "<<Population->get_density_m3(loc_m)<<"\n"; //die dichte ist falsch?, also sollte sich halt verkleinern
|
||||||
|
//std::cout << "macro sigma von calc macro sigma in e_thermal interaction base " << 1e15 * calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m)<<"\n";
|
||||||
|
//std::cout << "microsigma = " << get_microSigma_m2(E_eV) << "\n";
|
||||||
|
std::cout << "Energie = " << E_eV << "\n";
|
||||||
|
|
||||||
|
if (E_eV > E_limit) {
|
||||||
|
//std::cout << " microsigma = " << get_microSigma_m2(E_eV) << "\n";
|
||||||
|
std::cout << "wird das gemacht? " << "\n";
|
||||||
|
return get_microSigma_m2(E_eV);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
||||||
|
|
||||||
|
double m2_eV = Population->get_m_eV();
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
double v2_ms = v_therm;
|
||||||
|
//double v2_ms = v_therm + Population->get_drift_v_ms();
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n";
|
||||||
|
|
||||||
|
//double E1 = E_eV; //unnötig
|
||||||
|
//double E2 = calc_E_eV_from_v_ms(v2_ms, m2_eV);
|
||||||
|
|
||||||
|
//auto integrand = [&](double v2_ms, double theta)
|
||||||
|
auto integrand = [&](double theta) {
|
||||||
|
//double v2_ms = calc_v_ms_from_E_eV(E_eV, m2_eV);
|
||||||
|
|
||||||
|
//std::cout << "v1 " << v1_ms <<"\n";
|
||||||
|
//std::cout << "v2 " << v2_ms <<"\n";
|
||||||
|
|
||||||
|
double p1 = gammafaktor2(v1_ms) * m1_eV * v1_ms / c_ms; // e-
|
||||||
|
double p2 = gammafaktor2(v2_ms) * m2_eV * v2_ms / c_ms; // ion
|
||||||
|
double E1 = sqrt(pow(m1_eV, 2) + pow(p1, 2)); // e-
|
||||||
|
double E2 = sqrt(pow(m2_eV, 2) + pow(p2, 2)); // ion
|
||||||
|
|
||||||
|
//std::cout << "E1 " << E1 << "\n"; //elektron
|
||||||
|
//std::cout << "E2 " << E2 << "\n"; // ion
|
||||||
|
//std::cout << "v1 " << v1_ms << "\n"; // elektron
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n"; // ion
|
||||||
|
//std::cout << "p1 " << p1 << "\n"; // p von elektron
|
||||||
|
//std::cout << "p2 " << p2 << "\n"; // p von ion
|
||||||
|
//std::cout << "m1 " << m1_eV << "\n"; // elektron
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n"; // ion
|
||||||
|
|
||||||
|
double s = pow(m1_eV,2) + pow(m2_eV,2) + 2 * E1 * E2 - 2 * p1 * p2 * cos(theta);
|
||||||
|
//std::cout << "s " << s << "\n";
|
||||||
|
double E_cm_eV = sqrt(s) - m1_eV - m2_eV;
|
||||||
|
//std::cout << "theta " << theta << "\n";
|
||||||
|
//std::cout << "E_cm_eV " << E_cm_eV << "\n";
|
||||||
|
double twoEam2 = s - pow(m1_eV, 2) - pow(m2_eV, 2);
|
||||||
|
double E_incident = twoEam2/(2*m2_eV);
|
||||||
|
double E_kin_incident = E_incident - m1_eV;
|
||||||
|
|
||||||
|
|
||||||
|
//double E_eV_kin = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2); // m1_eV equals reduced mass
|
||||||
|
//std::cout << "geschwindigkeit pop " << v2_ms << "\n";
|
||||||
|
//std::cout << "Energie " << E_eV <<"\n";
|
||||||
|
//return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_eV)/pi;
|
||||||
|
return get_microSigma_m2(E_kin_incident);
|
||||||
|
};
|
||||||
|
//std::cout << "Masse m1 " << m1_eV << "\n";
|
||||||
|
//std::cout << "Masse m2 " << m2_eV << "\n";
|
||||||
|
//std::cout << "thermal v " << v_therm << "\n";
|
||||||
|
//std::cout << "integral für e- ergebnis: " << double_simpson_integrate(integrand, 0., 3*v_therm, 0., pi, INT_N, INT_N) << "\n";
|
||||||
|
double integralergebnis = integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
std::cout << "integral gibt: " << integralergebnis <<"\n";
|
||||||
|
}
|
||||||
|
//std::cout << "integral für e- ergebnis: " << double_simpson_integrate(integrand, 0., 3*v_therm, 0., pi, INT_N, INT_N) << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "Energie? " << E_eV << "\n";
|
||||||
|
//std::cout << "E_limit? " << E_limit << "\n";
|
||||||
|
std::cout << "get microsigma ohne integral (wird nicht verwendet) " << get_microSigma_m2(E_eV) << "\n";
|
||||||
|
std::cout << "Monte Carlo micro sigma = " << calc_microSigma_m2(E_eV) << "\n";
|
||||||
|
|
||||||
|
|
||||||
return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m);
|
return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,13 +142,74 @@ inline double e_thermal_Interaction_Base::calc_microSigma_m2(const double &E_eV)
|
|||||||
if (E_eV > E_limit) {
|
if (E_eV > E_limit) {
|
||||||
return get_microSigma_m2(E_eV);
|
return get_microSigma_m2(E_eV);
|
||||||
} else {
|
} else {
|
||||||
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
|
||||||
|
|
||||||
|
double m2_eV = Population->get_m_eV();
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
double v2_ms = v_therm;
|
||||||
|
//double v2_ms = v_therm + Population->get_drift_v_ms();
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n";
|
||||||
|
|
||||||
|
//double E1 = E_eV; //unnötig
|
||||||
|
//double E2 = calc_E_eV_from_v_ms(v2_ms, m2_eV);
|
||||||
|
|
||||||
|
//auto integrand = [&](double v2_ms, double theta)
|
||||||
|
auto integrand = [&](double theta) {
|
||||||
|
//double v2_ms = calc_v_ms_from_E_eV(E_eV, m2_eV);
|
||||||
|
|
||||||
|
//std::cout << "v1 " << v1_ms <<"\n";
|
||||||
|
//std::cout << "v2 " << v2_ms <<"\n";
|
||||||
|
|
||||||
|
double p1 = gammafaktor2(v1_ms) * m1_eV * v1_ms / c_ms; // e-
|
||||||
|
double p2 = gammafaktor2(v2_ms) * m2_eV * v2_ms / c_ms; // ion
|
||||||
|
double E1 = sqrt(pow(m1_eV, 2) + pow(p1, 2)); // e-
|
||||||
|
double E2 = sqrt(pow(m2_eV, 2) + pow(p2, 2)); // ion
|
||||||
|
|
||||||
|
//std::cout << "E1 " << E1 << "\n"; //elektron
|
||||||
|
//std::cout << "E2 " << E2 << "\n"; // ion
|
||||||
|
//std::cout << "v1 " << v1_ms << "\n"; // elektron
|
||||||
|
//std::cout << "v2 " << v2_ms << "\n"; // ion
|
||||||
|
//std::cout << "p1 " << p1 << "\n"; // p von elektron
|
||||||
|
//std::cout << "p2 " << p2 << "\n"; // p von ion
|
||||||
|
//std::cout << "m1 " << m1_eV << "\n"; // elektron
|
||||||
|
//std::cout << "m2 " << m2_eV << "\n"; // ion
|
||||||
|
|
||||||
|
double s = pow(m1_eV,2) + pow(m2_eV,2) + 2 * E1 * E2 - 2 * p1 * p2 * cos(theta);
|
||||||
|
//std::cout << "s " << s << "\n";
|
||||||
|
double E_cm_eV = sqrt(s) - m1_eV - m2_eV;
|
||||||
|
//std::cout << "theta " << theta << "\n";
|
||||||
|
//std::cout << "E_cm_eV " << E_cm_eV << "\n";
|
||||||
|
double twoEam2 = s - pow(m1_eV, 2) - pow(m2_eV, 2);
|
||||||
|
double E_incident = twoEam2/(2*m2_eV);
|
||||||
|
double E_kin_incident = E_incident - m1_eV;
|
||||||
|
|
||||||
|
|
||||||
|
//double E_eV_kin = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2); // m1_eV equals reduced mass
|
||||||
|
//std::cout << "geschwindigkeit pop " << v2_ms << "\n";
|
||||||
|
//std::cout << "Energie " << E_eV <<"\n";
|
||||||
|
//return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_eV)/pi;
|
||||||
|
return get_microSigma_m2(E_kin_incident);
|
||||||
|
};
|
||||||
|
//std::cout << "Masse m1 " << m1_eV << "\n";
|
||||||
|
//std::cout << "Masse m2 " << m2_eV << "\n";
|
||||||
|
//std::cout << "thermal v " << v_therm << "\n";
|
||||||
|
//std::cout << "integral für e- ergebnis: " << double_simpson_integrate(integrand, 0., 3*v_therm, 0., pi, INT_N, INT_N) << "\n";
|
||||||
|
double integralergebnis = integrate(integrand, 0., pi, INT_N, simpson())/pi;
|
||||||
|
return integralergebnis;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* //alt
|
||||||
// Integration over theta and v
|
// Integration over theta and v
|
||||||
auto integrand = [&](double v2_ms, double theta) {
|
auto integrand = [&](double v2_ms, double theta) {
|
||||||
|
v2_ms = v2_ms + Population->get_drift()
|
||||||
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||||
return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_eV)/pi;
|
return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_eV)/pi;
|
||||||
};
|
};
|
||||||
return double_simpson_integrate(integrand, 0., 3*v_therm, 0., pi, INT_N, INT_N); // 3*v_therm equals 99% of the integral
|
return double_simpson_integrate(integrand, 0., 3*v_therm, 0., pi, INT_N, INT_N); // 3*v_therm equals 99% of the integral
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,18 +252,55 @@ inline void e_thermal_Precomputed_Interaction_Base::calc_values() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline double e_thermal_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
inline double e_thermal_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||||
|
//std::cout << "wird das verwendet e_termal_precomputed_interaciton_base::get_macro_sigma_m "<<"\n"; //wird verwendet, ok gut -> hier suchen!
|
||||||
|
|
||||||
vec3 loc_m = interPart.get_x_m();
|
vec3 loc_m = interPart.get_x_m();
|
||||||
|
//std::cout << "Pop in e_thermal_precomputed_interaction_base: " << Population->get_species() << "\n";
|
||||||
|
//std::cout << "verwendete Dichte für get_macro_sigma_m in e_thermal_precomputed_interaction_base: " << Population->get_species() << " "<<Population->get_density_m3(loc_m)<<"\n";
|
||||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
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
|
//std::cout << Population->get_species() << "\n";
|
||||||
|
//double v_ms = calc_vec3_abs(interPart.get_v_ms()); //test ohne shift
|
||||||
|
//std::cout << "verwendete geschwindigkeit: " << v_ms << "\n";
|
||||||
|
//std::cout << "thermal dirft v = " << Population->get_drift_v_ms(loc_m) << "\n";
|
||||||
|
double E_eV = calc_E_eV_from_v_ms(v_ms, m1_eV); // Lab energy without thermal
|
||||||
|
//E_eV = interPart.get_E_eV(); // warum nicht so?
|
||||||
|
//double microsigma_montecarlo = calc_microSigma_m2(E_eV);
|
||||||
|
//std::cout << "Monte Carlo Micro Sigma = " << microsigma_montecarlo << "\n";
|
||||||
|
//std::cout << "pop in get_macro_sigma_m in e_thermal_precomputed_interaction_base: " << Population->get_species()<<"\n";
|
||||||
|
|
||||||
|
|
||||||
|
//return calc_macro_sigma_m(E_eV, loc_m);
|
||||||
|
|
||||||
|
std::cout << "Energie die in calc_macro_sigma oder lookup_macro_sigma reinkommt: " << E_eV << "\n";
|
||||||
|
|
||||||
if (E_scale.in_scale(E_eV)) {
|
if (E_scale.in_scale(E_eV)) {
|
||||||
return lookup_macro_sigma_m(E_eV, loc_m);
|
//double a;
|
||||||
|
//a = lookup_macro_sigma_m(E_eV, loc_m);
|
||||||
|
//std::cout << " lookup_macro_sigma in get_macro_sigma in e_thermal_precomputed_base gibt: " << a <<"\n";
|
||||||
|
//std::cout << "look_up" << "\n";
|
||||||
|
//return lookup_macro_sigma_m(E_eV, loc_m);
|
||||||
|
return calc_macro_sigma_m(E_eV, loc_m); // zum testen
|
||||||
} else {
|
} else {
|
||||||
|
//double a;
|
||||||
|
//a = calc_macro_sigma_m(E_eV, loc_m);
|
||||||
|
//std::cout << "calc_macro_sigma in get_macro_sigma in e_thermal_precomputed_base: " << a << "\n";
|
||||||
|
//std::cout<< "calc" <<"\n";
|
||||||
return calc_macro_sigma_m(E_eV, loc_m);
|
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) {
|
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);
|
int i = E_scale.calc_index(E_eV);
|
||||||
|
|
||||||
|
std::cout << "Energie? " << E_scale.get_bin_mid(i) << "\n";
|
||||||
|
//std::cout <<"E index = "<<i<<"\n";
|
||||||
|
//std::cout <<"precomputed_values[i] = " << precomputed_values[i]<< "\n";
|
||||||
|
//std::cout << "pop denisity = " << Population->get_density_m3(loc_m)<<"\n";
|
||||||
|
//std::cout << "pop denisity species = " << Population->get_species()<<"\n";
|
||||||
|
//std::cout <<"look up"<<"\n";
|
||||||
|
//std::cout << "Dichte für get sigma in e_thermal_precomuputed_interaction_base: " << Population->get_density_m3(loc_m)<<"\n";
|
||||||
|
std::cout << "precomputaed value der verwendet wird (Monte Carlo Sigma): " << precomputed_values[i] <<"\n";
|
||||||
return precomputed_values[i] * Population->get_density_m3(loc_m);
|
return precomputed_values[i] * Population->get_density_m3(loc_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+28
-3
@@ -41,27 +41,52 @@ private:
|
|||||||
|
|
||||||
inline int Injector::inject (std::vector<Particle> *particle_queue, const int &last_ID) {
|
inline int Injector::inject (std::vector<Particle> *particle_queue, const int &last_ID) {
|
||||||
vec3 loc_m = T2Population->roll_x_ms();
|
vec3 loc_m = T2Population->roll_x_ms();
|
||||||
|
vec3 v_ms;
|
||||||
|
vec3 vTI_ms;
|
||||||
|
|
||||||
double E_eV;
|
double E_eV;
|
||||||
switch(method) {
|
switch(method) {
|
||||||
case 0: // Fermi
|
case 0: // Fermi
|
||||||
E_eV = roll_FermiEnergy_eV();
|
E_eV = roll_FermiEnergy_eV();
|
||||||
|
v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||||
|
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
break;
|
break;
|
||||||
case 1: //Delta
|
case 1: //Delta
|
||||||
E_eV = energy_eV;
|
E_eV = energy_eV;
|
||||||
|
v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||||
|
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
break;
|
break;
|
||||||
case 2: //Maxwell Boltzman
|
case 2: //Maxwell Boltzman
|
||||||
E_eV = roll_MBEnergy(energy_eV/kb_eVK, me_eV, rngNormal);
|
E_eV = roll_MBEnergy(energy_eV/kb_eVK, me_eV, rngNormal);
|
||||||
|
v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||||
|
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
|
break;
|
||||||
|
case 3: // Delta Injection for Recombination Testing
|
||||||
|
std::cout << "injecte e-" <<"\n";
|
||||||
|
loc_m = vec3(0.,0.,9.99);
|
||||||
|
E_eV = energy_eV;
|
||||||
|
//std::cout<<"E = "<< E_eV<<"\n";
|
||||||
|
//direction = vec3(0,0,-1);
|
||||||
|
v_ms = vec3(0.,0.,-1.) * calc_v_ms_from_E_eV(E_eV, me_eV);
|
||||||
|
std::cout << "Geschwindigkeit e-: " << v_ms << "\n";
|
||||||
|
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
//vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||||
particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
//particle_queue->push_back(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||||
|
|
||||||
if (ions == 0) {
|
if (ions == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
|
if (ions == 2) { // 2: Delta Injection for Testing Recombination
|
||||||
|
vec3 direction = vec3(0.,0.,-1.);
|
||||||
|
vec3 loc_m = vec3(0.,0.,9.99);
|
||||||
|
vec3 vTI_ms = direction * calc_v_ms_from_E_eV(E_eV, me_eV); //gleiche geschwindigkeit
|
||||||
|
//vec3 vTI_ms = direction * calc_v_ms_from_E_eV(E_eV, 2*mT_eV); // gleiche energie
|
||||||
|
particle_queue->push_back(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
||||||
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
vec3 vTI_ms = T2Population->roll_v_ms(loc_m);
|
vec3 vTI_ms = T2Population->roll_v_ms(loc_m);
|
||||||
particle_queue->push_back(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
particle_queue->push_back(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
||||||
|
|||||||
@@ -42,23 +42,43 @@ void Particle_Looper::do_loops(int target_decays) {
|
|||||||
|
|
||||||
void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
||||||
int i = floor(rngUni.random()*particle_queue->size());
|
int i = floor(rngUni.random()*particle_queue->size());
|
||||||
|
//int i = particle_queue->size();
|
||||||
|
//i = 0;
|
||||||
|
//std::cout << i << "\n";
|
||||||
Particle curPart = particle_queue->at(i);
|
Particle curPart = particle_queue->at(i);
|
||||||
|
; std::cout<<"################################################"<<"\n";
|
||||||
|
std::cout<<"Current Particle: "<< curPart.get_species() <<"\n";
|
||||||
|
std::cout<<"current particle energy "<< curPart.get_E_eV()<<"\n";
|
||||||
//Particle curPart = particle_queue->front();
|
//Particle curPart = particle_queue->front();
|
||||||
Mover_Base *moverPtr = movers.find(curPart.get_species());
|
Mover_Base *moverPtr = movers.find(curPart.get_species());
|
||||||
Interaction_Channel_Base *interactionPtr = interactions.find(curPart.get_species());
|
Interaction_Channel_Base *interactionPtr = interactions.find(curPart.get_species());
|
||||||
Terminator_Base *terminatorPtr = terminators.find(curPart.get_species());
|
Terminator_Base *terminatorPtr = terminators.find(curPart.get_species());
|
||||||
|
|
||||||
InteractionOut IntOut;
|
InteractionOut IntOut;
|
||||||
double macro_sigma_m;
|
double macro_sigma_m;
|
||||||
vec3 oldLoc_m;
|
vec3 oldLoc_m;
|
||||||
while (!terminatorPtr->check_terminlization(curPart)) {
|
while (!terminatorPtr->check_terminlization(curPart)) {
|
||||||
oldLoc_m = curPart.get_x_m();
|
oldLoc_m = curPart.get_x_m();
|
||||||
|
std::cout << "Wo sind wir gerade? " << oldLoc_m << "\n";
|
||||||
|
//std::cout << "noch nichts passiert, richtig?"<< "\n";
|
||||||
macro_sigma_m = interactionPtr->get_macro_sigma_m(curPart);
|
macro_sigma_m = interactionPtr->get_macro_sigma_m(curPart);
|
||||||
|
//macro_sigma_m = macro_sigma_m * 1e21;
|
||||||
|
//std::cout<<"MacroSigma in particle_looper wird für move verwendet: "<< macro_sigma_m<<"\n";
|
||||||
|
|
||||||
|
//macro_sigma_m = 1; //nur test
|
||||||
|
//std::cout<<"Test macro_sigma auf 1 gesetzt -> also Interaktion "<<"\n";
|
||||||
|
std::cout << "Move: " << "\n";
|
||||||
moverPtr->move(&curPart, macro_sigma_m);
|
moverPtr->move(&curPart, macro_sigma_m);
|
||||||
|
|
||||||
|
std::cout << "Wo sind wir nach move? " << curPart.get_x_m() << "\n";
|
||||||
|
|
||||||
if (terminatorPtr->check_terminlization(curPart)) {
|
if (terminatorPtr->check_terminlization(curPart)) {
|
||||||
|
std::cout<<"Keine Interaktion."<<"\n";
|
||||||
|
|
||||||
break; // Don't double check terminlization, else n_double.
|
break; // Don't double check terminlization, else n_double.
|
||||||
} else {
|
} else {
|
||||||
|
std::cout<<"Interaktion: "<<"\n";
|
||||||
|
//curPart.set_x_m(oldLoc_m);
|
||||||
IntOut = interactionPtr->do_Interaction(&curPart);
|
IntOut = interactionPtr->do_Interaction(&curPart);
|
||||||
for (int i=0; i<IntOut.get_number_new_particles(); i++) {
|
for (int i=0; i<IntOut.get_number_new_particles(); i++) {
|
||||||
particle_queue->push_back(IntOut.get_new_particles()[i]);
|
particle_queue->push_back(IntOut.get_new_particles()[i]);
|
||||||
@@ -70,8 +90,7 @@ void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
particle_queue->erase(particle_queue->begin() + i);
|
particle_queue->erase(particle_queue->begin() + i );}
|
||||||
}
|
|
||||||
|
|
||||||
long int Particle_Looper::get_new_id() {
|
long int Particle_Looper::get_new_id() {
|
||||||
ID_counter++;
|
ID_counter++;
|
||||||
|
|||||||
@@ -137,11 +137,27 @@ double Population_Container::get_density_m3(const int &E_bin, const Bins &loc_bi
|
|||||||
int data_bin = calc_data_bin(loc_bins, E_bin);
|
int data_bin = calc_data_bin(loc_bins, E_bin);
|
||||||
double cum_time_s = cum_times_s[data_bin];
|
double cum_time_s = cum_times_s[data_bin];
|
||||||
int offset = offsets[data_bin];
|
int offset = offsets[data_bin];
|
||||||
|
//std::cout<< "Offset = " << offset<<"\n";
|
||||||
double V_m3 = size_data_m3[loc_bins.r];
|
double V_m3 = size_data_m3[loc_bins.r];
|
||||||
|
|
||||||
|
//std::cout<<"cum_time/time = "<<cum_time_s/time_s<<"\n";
|
||||||
|
//std::cout<<"offset = " <<offset<<"\n";
|
||||||
|
|
||||||
double n_m3 = cum_time_s/time_s/V_m3 - offset;
|
double n_m3 = cum_time_s/time_s/V_m3 - offset/V_m3;
|
||||||
|
//double n_m3 = cum_time_s/time_s/V_m3 ;
|
||||||
|
|
||||||
|
|
||||||
if (n_m3<0) {
|
if (n_m3<0) {
|
||||||
|
std::cout<<"Offset größer als n"<<"\n";
|
||||||
n_m3 = 0;
|
n_m3 = 0;
|
||||||
|
cum_times_s[data_bin] = 0;
|
||||||
|
offsets[data_bin] = 0;
|
||||||
|
//std::cout << "cumtime in data bin " << cum_times_s[data_bin] << "\n";
|
||||||
|
//std::cout << "cumtime in data bin+1 " << cum_times_s[data_bin+1] << "\n";
|
||||||
|
//std::cout << "offset in data bin " << offsets[data_bin] << "\n";
|
||||||
|
//std::cout << "offset in data bin+1 " << offsets[data_bin+1] << "\n";
|
||||||
|
//cumtime = 0
|
||||||
|
//offset = 0
|
||||||
}
|
}
|
||||||
return n_m3;
|
return n_m3;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user