Reworked Katrin Geometrics.
Added creation of T3+ clusters. Added diss. recombination fo T3+ + e-
This commit is contained in:
@@ -15,56 +15,96 @@ class T2_Population : public Population_Base, public RNG_Base {
|
||||
static const double wgtsTemp_K;
|
||||
static const double wgtsT2FlowSpeed_ms;
|
||||
|
||||
public:
|
||||
T2_Population(UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal){};
|
||||
int n_regimes;
|
||||
double *reduction_min;
|
||||
double *z_min_m;
|
||||
double *slopes;
|
||||
|
||||
public:
|
||||
T2_Population(UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal){
|
||||
set_regimes();
|
||||
};
|
||||
~T2_Population() {
|
||||
delete[] reduction_min;
|
||||
delete[] z_min_m;
|
||||
delete[] slopes;
|
||||
};
|
||||
private:
|
||||
void set_regimes();
|
||||
public:
|
||||
double get_density_m3 (const vec3 &loc_m);
|
||||
void increase_density (const Particle &upPart, const vec3 &oldLoc_m) {};
|
||||
void decrease_denisty (const vec3 &oldLoc_m, const double &energy_eV) {};
|
||||
|
||||
vec3 get_average_speed_ms (const vec3 &loc_m);
|
||||
vec3 roll_speed_ms (const vec3 &loc_m);
|
||||
|
||||
public:
|
||||
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:
|
||||
meta_vec get_bins_meta_info();
|
||||
bin_content_vec get_bins_content();
|
||||
bin_count4 get_bin_count4();
|
||||
void set_bins(bin_count4 bin_counts, bin_content_vec bin_contents) {};
|
||||
private:
|
||||
double calc_DensityTriangle(const double &z_m);
|
||||
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
|
||||
|
||||
double interpolate_red(const double &z_m, const double &z_min_m, const double &z_max_m, const double &red_min, const double &red_max);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const double T2_Population::wgtsT2MaxDensity_m3 = load_parameter("wgtsT2MaxDensity_m3");
|
||||
const double T2_Population::wgtsTemp_K = load_parameter("wgtsTemp_K");
|
||||
const double T2_Population::wgtsT2FlowSpeed_ms = load_parameter("wgtsT2FlowSpeed_ms");
|
||||
|
||||
inline double T2_Population::get_density_m3(const vec3 &loc_m) {
|
||||
Katrin_Geo::check_inKatrin(loc_m);
|
||||
if (!Katrin_Geo::inWGTS(loc_m)) {
|
||||
return 0; // Prob change to some realisitc value -> search for one
|
||||
} else {
|
||||
return calc_DensityTriangle(loc_m[2]);
|
||||
inline void T2_Population::set_regimes() {
|
||||
n_regimes = 4;
|
||||
double reds[5] = {reduction_tot_rear, reduction_WGTS_rear, 1, reduction_WGTS_front, reduction_tot_front};
|
||||
double zs[5] = {z_RW_m, z_WGTS_start_m, z_WGTS_mid_m, z_WGTS_end_m, z_DPS_end_m};
|
||||
reduction_min = new double[n_regimes];
|
||||
double reduction_max;
|
||||
z_min_m = new double[n_regimes];
|
||||
double z_max_m;
|
||||
slopes = new double[n_regimes];
|
||||
for (int i = 0; i<n_regimes; i++) {
|
||||
reduction_min[i] = reds[i];
|
||||
reduction_max = reds[i+1];
|
||||
z_min_m[i] = zs[i];
|
||||
z_max_m = zs[i+1];
|
||||
slopes[i] = (reduction_max-reduction_min[i])/(z_max_m-z_min_m[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline double T2_Population::calc_DensityTriangle(const double &z_m) {
|
||||
double z_wgts_m = z_m - Katrin_Geo::get_z_WGTSstart_m(); // Cords with z=0 at beginning of WGTS
|
||||
double wgtsLength_m = Katrin_Geo::get_wgtsLength_m();
|
||||
double wgtsHalfLength_m = wgtsLength_m/2;
|
||||
double zProjection_m = (z_wgts_m < wgtsHalfLength_m) ? z_wgts_m : wgtsLength_m - z_wgts_m;
|
||||
double reduction_Factor = zProjection_m/wgtsHalfLength_m; //Correction since reflection
|
||||
return reduction_Factor * wgtsT2MaxDensity_m3;
|
||||
inline double T2_Population::get_density_m3(const vec3 &loc_m) {
|
||||
if (!in_Katrin(loc_m)) {
|
||||
std::stringstream ss;
|
||||
ss<<"T2_Population::get_density_m3: loc_m outside of Katrin.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
return calc_DensityTriangle(loc_m[2]);
|
||||
|
||||
}
|
||||
|
||||
inline vec3 T2_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 double T2_Population::calc_DensityTriangle(const double &z_m) {
|
||||
for (int i = (n_regimes-1); i>=0; i--) {
|
||||
if (z_m>z_min_m[i]) {
|
||||
double reduction_factor = reduction_min[i] + (z_m-z_min_m[i])*slopes[i];
|
||||
return reduction_factor * wgtsT2MaxDensity_m3;
|
||||
}
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss<<"T2_Population::calc_DensityTriangle: z_m outside of Katrin.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
|
||||
inline vec3 T2_Population::roll_v_ms(const vec3 &loc_m) {
|
||||
if (!in_Katrin(loc_m)) {
|
||||
std::stringstream ss;
|
||||
ss<<"T2_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 meta_vec T2_Population::get_bins_meta_info() {
|
||||
@@ -85,9 +125,9 @@ inline bin_count4 T2_Population::get_bin_count4() {
|
||||
throw MyException (ss.str());
|
||||
}
|
||||
|
||||
inline vec3 T2_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 T2_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);
|
||||
@@ -97,10 +137,10 @@ inline vec3 T2_Population::get_average_speed_ms(const vec3 &loc_m) {
|
||||
}
|
||||
|
||||
inline vec3 T2_Population::roll_thermSpeed_ms(const vec3 &loc_m) {
|
||||
double Ekin_eV = roll_MBEnergy(wgtsTemp_K,mT2_eV,rngNormal);
|
||||
double Speed_ms = calc_Speed_from_Ekin_eV(Ekin_eV, mT2_eV);
|
||||
vec3 speed_ms = roll_uniform_direction(rngUni)*Speed_ms;
|
||||
return speed_ms;
|
||||
double E_eV = roll_MBEnergy(wgtsTemp_K, 2*mT_eV, rngNormal);
|
||||
double Speed_ms = calc_v_ms_from_E_eV(E_eV, 2*mT_eV);
|
||||
vec3 v_ms = roll_uniform_direction(rngUni)*Speed_ms;
|
||||
return v_ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user