Reworked Katrin Geometrics.

Added creation of T3+ clusters.
Added diss. recombination fo T3+ + e-
This commit is contained in:
Christian
2019-07-12 15:15:23 +02:00
parent 194d3eaf77
commit 6f288bb0c1
72 changed files with 811 additions and 589 deletions
+31 -23
View File
@@ -9,7 +9,7 @@
#ifndef Thermal_Population_h
#define Thermal_Population_h
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include <fstream>
@@ -44,9 +44,9 @@ public:
void decrease_denisty (const vec3 &loc_m, const double &energy_eV);
public:
vec3 get_average_speed_ms (const vec3 &loc_m);
vec3 roll_speed_ms (const vec3 &loc_m);
vec3 roll_v_ms (const vec3 &loc_m);
private:
vec3 get_average_v_ms (const vec3 &loc_m);
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
public:
@@ -57,7 +57,7 @@ public:
private:
Lin_Scale get_z_scale();
Lin_Scale get_r_scale();
Lin_Scale get_phi_scale();
Lin_Scale calc_phi_scale();
};
@@ -81,7 +81,11 @@ void Thermal_Population::init_containers(int num_z_bins, int num_r_bins, int num
}*/
inline double Thermal_Population::get_density_m3(const vec3 &loc_m) {
//Katrin_Geo::check_inKatrin(loc_m);
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Thermal_Population::get_density_m3: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
double physical_time_s = timer->get_physTime_s();
double cumulated_time_s_s = cumulated_times_s.get_value(loc_m);
double offset = number_annhilated.get_value(loc_m);
@@ -92,8 +96,8 @@ inline double Thermal_Population::get_density_m3(const vec3 &loc_m) {
}
inline void Thermal_Population::increase_density(const Particle &upPart, const vec3 &oldLoc_m) {
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_SpeedAbs_ms();
cumulated_times_s.increase_value(cell_time_s, upPart.get_Location_m(), oldLoc_m);
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_vAbs_ms();
cumulated_times_s.increase_value(cell_time_s, upPart.get_x_m(), oldLoc_m);
}
inline void Thermal_Population::decrease_denisty (const vec3 &loc_m, const double &energy_eV) {
@@ -101,9 +105,9 @@ inline void Thermal_Population::decrease_denisty (const vec3 &loc_m, const doubl
}
inline vec3 Thermal_Population::get_average_speed_ms(const vec3 &loc_m) {
if (Katrin_Geo::inWGTS(loc_m)) {
double z_wgtsHalf_m = Katrin_Geo::get_z_WGTSstart_m() + (Katrin_Geo::get_z_WGTSend_m() - Katrin_Geo::get_z_WGTSstart_m())/2;
inline vec3 Thermal_Population::get_average_v_ms(const vec3 &loc_m) {
if (in_WGTS(loc_m)) {
double z_wgtsHalf_m = z_WGTS_start_m + (z_WGTS_end_m - z_WGTS_start_m)/2;
double sign = (loc_m[2] < z_wgtsHalf_m) ? -1 : 1;
double zSpeed_ms = sign*wgtsT2FlowSpeed_ms;
return vec3(0,0,zSpeed_ms);
@@ -112,23 +116,27 @@ inline vec3 Thermal_Population::get_average_speed_ms(const vec3 &loc_m) {
}
}
inline vec3 Thermal_Population::roll_speed_ms(const vec3 &loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
return get_average_speed_ms(loc_m) + roll_thermSpeed_ms(loc_m);
inline vec3 Thermal_Population::roll_v_ms(const vec3 &loc_m) {
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Thermal_Population::roll_v_ms: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return get_average_v_ms(loc_m) + roll_thermSpeed_ms(loc_m);
}
inline vec3 Thermal_Population::roll_thermSpeed_ms(const vec3 &loc_m) {
double E_eV = roll_MBEnergy(wgtsTemp_K, m_eV, rngNormal);
double abs_speed_ms = calc_Speed_from_Ekin_eV(E_eV, m_eV);
vec3 speed_ms = roll_uniform_direction(rngUni)*abs_speed_ms;
return speed_ms;
double abs_v_ms = calc_v_ms_from_E_eV(E_eV, m_eV);
vec3 v_ms = roll_uniform_direction(rngUni)*abs_v_ms;
return v_ms;
}
inline meta_vec Thermal_Population::get_bins_meta_info() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
meta_vec res;
pop_bin_meta_info temp_bin = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -160,7 +168,7 @@ inline meta_vec Thermal_Population::get_bins_meta_info() {
inline bin_content_vec Thermal_Population::get_bins_content() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
bin_content_vec res;
pop_bin_content temp_bin = {0, 0, 0, 0, 0, 0};
@@ -184,7 +192,7 @@ inline bin_count4 Thermal_Population::get_bin_count4() {
bin_count4 res;
res[0] = get_z_scale().get_number_bins();
res[1] = get_r_scale().get_number_bins();
res[2] = get_phi_scale().get_number_bins();
res[2] = calc_phi_scale().get_number_bins();
res[3] = 0;
return res;
}
@@ -235,12 +243,12 @@ inline Lin_Scale Thermal_Population::get_r_scale() {
}
}
inline Lin_Scale Thermal_Population::get_phi_scale() {
if (cumulated_times_s.get_phi_scale() == number_annhilated.get_phi_scale()) {
return cumulated_times_s.get_phi_scale();
inline Lin_Scale Thermal_Population::calc_phi_scale() {
if (cumulated_times_s.calc_phi_scale() == number_annhilated.calc_phi_scale()) {
return cumulated_times_s.calc_phi_scale();
} else {
std::stringstream ss;
ss<<"Thermal_Population::get_phi_scale: Missmatch in scales.\n";
ss<<"Thermal_Population::calc_phi_scale: Missmatch in scales.\n";
throw MyException(ss.str());
}
}