normalization, elastic center move, density calc.
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
#include "T2IT2_cx.h"
|
||||||
|
#include "janev_T2IT2_cx.h"
|
||||||
|
#include "katrin_fields.hpp"
|
||||||
|
|
||||||
|
T2IT2_CX::T2IT2_CX(
|
||||||
|
Population_Base *T2Population, UniRNG *rngUni) :
|
||||||
|
TI_thermal_binary_Precomputed_Interaction_Base(
|
||||||
|
T2Population, rngUni, 2*mT_eV),
|
||||||
|
kinematics(2*mT_eV, 2*mT_eV)
|
||||||
|
{
|
||||||
|
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||||
|
}
|
||||||
|
|
||||||
|
double T2IT2_CX::get_microSigma_m2(const double &E_eV)
|
||||||
|
{
|
||||||
|
return Janev_T2IT2_CX::get_TCS(E_eV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InteractionOut T2IT2_CX::do_Interaction (Particle *interPart)
|
||||||
|
{
|
||||||
|
const vec3 v1_ms = interPart->get_v_ms();
|
||||||
|
const vec3 loc_m = interPart->get_x_m();
|
||||||
|
const vec3 v2_ms = Population->roll_v_ms(loc_m);
|
||||||
|
const double theta_lab = rngUni->random() * pi;
|
||||||
|
const double phi_lab = rngUni->random() * 2 * pi;
|
||||||
|
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
||||||
|
interPart->set_v_ms(v_new);
|
||||||
|
|
||||||
|
// gyro center move
|
||||||
|
const double v_perp_new_squared = v_new(0)*v_new(0) + v_new(1)*v_new(1);
|
||||||
|
const double v_perp_old_squared = v1_ms(0)*v1_ms(0) + v1_ms(1)*v1_ms(1);
|
||||||
|
|
||||||
|
const double v_perp_new = std::sqrt(v_perp_new_squared);
|
||||||
|
|
||||||
|
const double scalar_product_squared =
|
||||||
|
std::pow(v1_ms(0)*v_new(0) + v1_ms(1)*v_new(1),2)
|
||||||
|
/(v_perp_new_squared*v_perp_old_squared);
|
||||||
|
const double sin_theta = scalar_product_squared >= 1 ?
|
||||||
|
0 : std::sqrt(1-scalar_product_squared); // sin(arcos(x)) = sqrt(1-x^2)
|
||||||
|
|
||||||
|
const double rG_m = v_perp_new*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
||||||
|
const double gyro_centrum_move_m = 2*rG_m * sin_theta;
|
||||||
|
const double phi = rngUni->random() * 2 * pi;
|
||||||
|
const double x_new = loc_m(0) + std::sin(phi)*gyro_centrum_move_m;
|
||||||
|
const double y_new = loc_m(1) + std::cos(phi)*gyro_centrum_move_m;
|
||||||
|
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
||||||
|
|
||||||
|
return InteractionOut();
|
||||||
|
}
|
||||||
|
|
||||||
+9
-30
@@ -1,38 +1,17 @@
|
|||||||
//
|
|
||||||
// T2IT2_cx.h
|
|
||||||
// mc_electron
|
|
||||||
//
|
|
||||||
// Created by Christian Reiling on 12.07.19.
|
|
||||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef T2IT2_cx_h
|
#ifndef T2IT2_CX_H
|
||||||
#define T2IT2_cx_h
|
#define T2IT2_CX_H
|
||||||
|
|
||||||
#include "TI_thermal_binary_base.h"
|
#include "TI_thermal_binary_base.h"
|
||||||
#include "kinematics_base.h"
|
#include "kinematics_base.h"
|
||||||
#include "janev_T2IT2_cx.h"
|
|
||||||
|
|
||||||
|
class T2IT2_CX : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||||
class T2IT2_CX : public TI_thermal_binary_Precomputed_Interaction_Base {
|
public:
|
||||||
Elastic_Kinematic_Base kinematics;
|
T2IT2_CX(Population_Base *T2Population, UniRNG *rngUni);
|
||||||
public:
|
double get_microSigma_m2(const double &E_eV);
|
||||||
T2IT2_CX(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 2*mT_eV), kinematics(2*mT_eV, 2*mT_eV) {
|
|
||||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
|
||||||
}
|
|
||||||
double get_microSigma_m2(const double &E_eV) {return Janev_T2IT2_CX::get_TCS(E_eV);}
|
|
||||||
InteractionOut do_Interaction (Particle *interPart);
|
InteractionOut do_Interaction (Particle *interPart);
|
||||||
|
private:
|
||||||
|
Elastic_Kinematic_Base kinematics;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* T2IT2_CX_H */
|
||||||
inline InteractionOut T2IT2_CX::do_Interaction (Particle *interPart) {
|
|
||||||
vec3 v1_ms = interPart->get_v_ms();
|
|
||||||
vec3 v2_ms = Population->roll_v_ms(interPart->get_x_m());
|
|
||||||
double theta_lab = rngUni->random() * pi;
|
|
||||||
double phi_lab = rngUni->random() * 2 * pi;
|
|
||||||
interPart->set_v_ms(kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab));
|
|
||||||
return InteractionOut();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* T2IT2_cx_h */
|
|
||||||
|
|||||||
@@ -27,12 +27,24 @@ InteractionOut T3IT2_Elastic::do_Interaction (Particle *interPart)
|
|||||||
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
||||||
interPart->set_v_ms(v_new);
|
interPart->set_v_ms(v_new);
|
||||||
|
|
||||||
const double v_perp = std::sqrt(v_new(0)*v_new(0) + v_new(1)*v_new(1));
|
// gyro center move
|
||||||
|
|
||||||
const double rG_m = v_perp*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
const double v_perp_new_squared = v_new(0)*v_new(0) + v_new(1)*v_new(1);
|
||||||
const double gyro_centrum_move_m = 2*rG_m * std::sin(theta_lab);
|
const double v_perp_old_squared = v1_ms(0)*v1_ms(0) + v1_ms(1)*v1_ms(1);
|
||||||
const double x_new = loc_m(0) + std::sin(phi_lab)*gyro_centrum_move_m;
|
|
||||||
const double y_new = loc_m(1) + std::cos(phi_lab)*gyro_centrum_move_m;
|
const double v_perp_new = std::sqrt(v_perp_new_squared);
|
||||||
|
|
||||||
|
const double scalar_product_squared =
|
||||||
|
std::pow(v1_ms(0)*v_new(0) + v1_ms(1)*v_new(1),2)
|
||||||
|
/(v_perp_new_squared*v_perp_old_squared);
|
||||||
|
const double sin_theta = scalar_product_squared >= 1 ?
|
||||||
|
0 : std::sqrt(1-scalar_product_squared); // sin(arcos(x)) = sqrt(1-x^2)
|
||||||
|
|
||||||
|
const double rG_m = v_perp_new*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
||||||
|
const double gyro_centrum_move_m = 2*rG_m * sin_theta;
|
||||||
|
const double phi = rngUni->random() * 2 * pi;
|
||||||
|
const double x_new = loc_m(0) + std::sin(phi)*gyro_centrum_move_m;
|
||||||
|
const double y_new = loc_m(1) + std::cos(phi)*gyro_centrum_move_m;
|
||||||
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
||||||
|
|
||||||
return InteractionOut();
|
return InteractionOut();
|
||||||
|
|||||||
@@ -26,12 +26,23 @@ InteractionOut TIT2_Elastic::do_Interaction (Particle *interPart)
|
|||||||
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
||||||
interPart->set_v_ms(v_new);
|
interPart->set_v_ms(v_new);
|
||||||
|
|
||||||
const double v_perp = std::sqrt(v_new(0)*v_new(0) + v_new(1)*v_new(1));
|
// gyro center move
|
||||||
|
const double v_perp_new_squared = v_new(0)*v_new(0) + v_new(1)*v_new(1);
|
||||||
const double rG_m = v_perp*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
const double v_perp_old_squared = v1_ms(0)*v1_ms(0) + v1_ms(1)*v1_ms(1);
|
||||||
const double gyro_centrum_move_m = 2*rG_m * std::sin(theta_lab);
|
|
||||||
const double x_new = loc_m(0) + std::sin(phi_lab)*gyro_centrum_move_m;
|
const double v_perp_new = std::sqrt(v_perp_new_squared);
|
||||||
const double y_new = loc_m(1) + std::cos(phi_lab)*gyro_centrum_move_m;
|
|
||||||
|
const double scalar_product_squared =
|
||||||
|
std::pow(v1_ms(0)*v_new(0) + v1_ms(1)*v_new(1),2)
|
||||||
|
/(v_perp_new_squared*v_perp_old_squared);
|
||||||
|
const double sin_theta = scalar_product_squared >= 1 ?
|
||||||
|
0 : std::sqrt(1-scalar_product_squared); // sin(arcos(x)) = sqrt(1-x^2)
|
||||||
|
|
||||||
|
const double rG_m = v_perp_new*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
||||||
|
const double gyro_centrum_move_m = 2*rG_m * sin_theta;
|
||||||
|
const double phi = rngUni->random() * 2 * pi;
|
||||||
|
const double x_new = loc_m(0) + std::sin(phi)*gyro_centrum_move_m;
|
||||||
|
const double y_new = loc_m(1) + std::cos(phi)*gyro_centrum_move_m;
|
||||||
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
||||||
|
|
||||||
return InteractionOut();
|
return InteractionOut();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ double TI_e_Interaction_Base::calc_microSigma_m2(
|
|||||||
// frame where ion (m2_eV) is at rest
|
// frame where ion (m2_eV) is at rest
|
||||||
return get_microSigma_m2(E_kin_incident);
|
return get_microSigma_m2(E_kin_incident);
|
||||||
};
|
};
|
||||||
return integrate(integrand, pi/8., 7*pi/8., INT_N, simpson())/pi;
|
return integrate(integrand, pi/8., 7*pi/8., INT_N, simpson())/(6./8.*pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,25 @@ InteractionOut eT2_Elastic::do_Interaction (Particle *interPart) {
|
|||||||
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
const vec3 v_new = kinematics.get_v1_new(v1_ms, v2_ms, theta_lab, phi_lab);
|
||||||
interPart->set_v_ms(v_new);
|
interPart->set_v_ms(v_new);
|
||||||
|
|
||||||
const double v_perp = std::sqrt(v_new(0)*v_new(0) + v_new(1)*v_new(1));
|
|
||||||
|
// gyro center move
|
||||||
|
|
||||||
|
const double v_perp_new_squared = v_new(0)*v_new(0) + v_new(1)*v_new(1);
|
||||||
|
const double v_perp_old_squared = v1_ms(0)*v1_ms(0) + v1_ms(1)*v1_ms(1);
|
||||||
|
|
||||||
|
const double v_perp_new = std::sqrt(v_perp_new_squared);
|
||||||
|
|
||||||
|
const double scalar_product_squared =
|
||||||
|
std::pow(v1_ms(0)*v_new(0) + v1_ms(1)*v_new(1),2)
|
||||||
|
/(v_perp_new_squared*v_perp_old_squared);
|
||||||
|
const double sin_theta = scalar_product_squared >= 1 ?
|
||||||
|
0 : std::sqrt(1-scalar_product_squared); // sin(arcos(x)) = sqrt(1-x^2)
|
||||||
|
|
||||||
const double rG_m = v_perp*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
const double rG_m = v_perp_new*interPart->get_m_eV()/(Katrin_Fields::getMagField_T(loc_m)(2)*c_ms*c_ms);
|
||||||
const double gyro_centrum_move_m = 2*rG_m * std::sin(theta_lab);
|
const double gyro_centrum_move_m = 2*rG_m * sin_theta;
|
||||||
const double x_new = loc_m(0) + std::sin(phi_lab)*gyro_centrum_move_m;
|
const double phi = rngUni->random() * 2 * pi;
|
||||||
const double y_new = loc_m(1) + std::cos(phi_lab)*gyro_centrum_move_m;
|
const double x_new = loc_m(0) + std::sin(phi)*gyro_centrum_move_m;
|
||||||
|
const double y_new = loc_m(1) + std::cos(phi)*gyro_centrum_move_m;
|
||||||
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
interPart->set_x_m(vec3(x_new, y_new, loc_m(2)));
|
||||||
|
|
||||||
return InteractionOut();
|
return InteractionOut();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ double e_thermal_Interaction_Base::calc_microSigma_m2(const double &E_eV)
|
|||||||
const double E_incident = kineticEnergyIncidentRelativistic(
|
const double E_incident = kineticEnergyIncidentRelativistic(
|
||||||
v1_ms, v2_ms, m1_eV, m2_eV, theta);
|
v1_ms, v2_ms, m1_eV, m2_eV, theta);
|
||||||
// frame where ion is at rest
|
// frame where ion is at rest
|
||||||
return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_incident)/pi;
|
return Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_incident)/(6./8.*pi);
|
||||||
};
|
};
|
||||||
return double_simpson_integrate(integrand, 0., 3*v_therm, pi/8., 7./8.*pi, INT_N, INT_N); // 3*v_therm equals 99% of the integral
|
return double_simpson_integrate(integrand, 0., 3*v_therm, pi/8., 7./8.*pi, INT_N, INT_N); // 3*v_therm equals 99% of the integral
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,10 +47,12 @@ blitz::Array<double,3> ElectricFieldFactory::read(
|
|||||||
blitz::Array<double,3> data_3d(nr, nphi, nz);
|
blitz::Array<double,3> data_3d(nr, nphi, nz);
|
||||||
data_3d = 0.;
|
data_3d = 0.;
|
||||||
|
|
||||||
|
const double E_cgs_to_si = 29979.19999934;
|
||||||
|
|
||||||
for(int ri = 0; ri<data_3d.shape()(0); ++ri){
|
for(int ri = 0; ri<data_3d.shape()(0); ++ri){
|
||||||
for(int phii = 0; phii < data_3d.shape()(1); ++phii){
|
for(int phii = 0; phii < data_3d.shape()(1); ++phii){
|
||||||
for(int zi = 0; zi< data_3d.shape()(2); ++zi){
|
for(int zi = 0; zi< data_3d.shape()(2); ++zi){
|
||||||
data_3d(ri, phii, zi) = data[zi][ri];
|
data_3d(ri, phii, zi) = data[zi][ri] * E_cgs_to_si;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef interaction_channel_base_h
|
#ifndef INTERACTION_CHANNEL_BASE_H
|
||||||
#define interaction_channel_base_h
|
#define INTERACTION_CHANNEL_BASE_H
|
||||||
|
|
||||||
#include "process_base.h"
|
#include "process_base.h"
|
||||||
#include "interaction_base.h"
|
#include "interaction_base.h"
|
||||||
@@ -41,9 +41,8 @@ inline InteractionOut Interaction_Channel_Base::do_Interaction(Particle *interPa
|
|||||||
return SubInteractions[i]->do_Interaction(interPart);
|
return SubInteractions[i]->do_Interaction(interPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::stringstream ss;
|
InteractionOut do_nothing;
|
||||||
ss<<"Interaction_Channel_Base::do_Interaction: No Interactions added.\n";
|
return do_nothing;
|
||||||
throw MyException (ss.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -73,4 +72,4 @@ inline void Interaction_Channel_Base::add(Interaction_Base *addSubInteraction) {
|
|||||||
numSubInteractions += 1;
|
numSubInteractions += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* interaction_channel_base_h */
|
#endif /* INTERACTION_CHANNEL_BASE_H */
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ OBJS := particle_looper.o \
|
|||||||
T3Ie_recombination.o \
|
T3Ie_recombination.o \
|
||||||
postive_E_drift.o \
|
postive_E_drift.o \
|
||||||
recombination_counter.o \
|
recombination_counter.o \
|
||||||
|
T2IT2_cx.o \
|
||||||
|
|
||||||
|
|
||||||
CXXFLAGS = $(X_OFLAGS) -I.. $(X_INC) -std=c++11
|
CXXFLAGS = $(X_OFLAGS) -I.. $(X_INC) -std=c++11
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
|||||||
double rnd_number = rngUni.random();
|
double rnd_number = rngUni.random();
|
||||||
rnd_number = (rnd_number == 0.) ? 1E-15 : rnd_number;
|
rnd_number = (rnd_number == 0.) ? 1E-15 : rnd_number;
|
||||||
double rolled_macro_sigma_m = - macro_sigma_m/log(rnd_number);
|
double rolled_macro_sigma_m = - macro_sigma_m/log(rnd_number);
|
||||||
|
rolled_macro_sigma_m = (rolled_macro_sigma_m <= 0.)? 1E-15 : rolled_macro_sigma_m;
|
||||||
|
|
||||||
moverPtr->move(&curPart, rolled_macro_sigma_m);
|
moverPtr->move(&curPart, rolled_macro_sigma_m);
|
||||||
if (terminatorPtr->check_terminlization(curPart)) {
|
if (terminatorPtr->check_terminlization(curPart)) {
|
||||||
break; // Don't double check terminlization, else n_double.
|
break; // Don't double check terminlization, else n_double.
|
||||||
|
|||||||
@@ -12,39 +12,44 @@ def plotTubeCurrentVsZ(filename_current, filename_density, output_folder):
|
|||||||
prop_cycle = plt.rcParams['axes.prop_cycle']
|
prop_cycle = plt.rcParams['axes.prop_cycle']
|
||||||
colors = prop_cycle.by_key()['color']
|
colors = prop_cycle.by_key()['color']
|
||||||
|
|
||||||
e_dict = {"key" : "/e-", "linestyle": '-', "label": "e"}
|
e_dict = {"key" : "/e-", "linestyle": '-', "label": "e$^-$", "charge": -1.602E-19}
|
||||||
T3_dict = {"key" : "/T3+", "linestyle": '--', "label": "T3+"}
|
T3_dict = {"key" : "/T3+", "linestyle": '--', "label": "T$_3^+$", "charge": 1.602E-19}
|
||||||
dicts = [e_dict, T3_dict]
|
T2_dict = {"key" : "/T2+", "linestyle": '--', "label": "T$_2^+$", "charge": 1.602E-19}
|
||||||
|
T_dict = {"key" : "/T+", "linestyle": '--', "label": "T$^+$", "charge": 1.602E-19}
|
||||||
|
dicts = [e_dict, T3_dict, T2_dict, T_dict]
|
||||||
|
|
||||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
||||||
|
|
||||||
for d in dicts:
|
for d in dicts:
|
||||||
j_total = cc.particleCurrentR(filename_current, filename_density, d["key"])
|
j_total = cc.absoluteCurrentR(filename_current, filename_density, d["key"])
|
||||||
z_bins = cc.binBordersZ(filename_current, d["key"])
|
z_bins = cc.binBordersZ(filename_current, d["key"])
|
||||||
|
|
||||||
plot_data = np.sum(j_total,2)[-1,:]
|
plot_data = np.sum(j_total,2)[-1,:] * np.abs(d["charge"])
|
||||||
x_mins = z_bins[:-1]
|
x_mins = z_bins[:-1]
|
||||||
x_maxs = z_bins[1:]
|
x_maxs = z_bins[1:]
|
||||||
plot_bins, plot_datas = cc.makeBarPlotData(plot_data, x_mins, x_maxs)
|
plot_bins, plot_datas = cc.makeBarPlotData(plot_data, x_mins, x_maxs)
|
||||||
|
|
||||||
ax.plot(plot_bins, plot_datas, linestyle=d["linestyle"], label=d["label"])
|
ax.plot(plot_bins - plot_bins[0], plot_datas, linestyle=d["linestyle"], label=d["label"])
|
||||||
|
|
||||||
ax.set_xlabel(r"Position $z$ [m]")
|
ax.set_xlabel(r"Distance to rear wall $z$ [m]")
|
||||||
ax.set_ylabel(r"Particle Current $j_r$ [$m^{-2}s^{-1}$]")
|
ax.set_ylabel(r"Current $I_r$ [A]")
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
ax.set_facecolor('#e7e7e7ff')
|
||||||
ax.grid(color='white')
|
ax.grid(color='white')
|
||||||
|
ax.set_yscale("log")
|
||||||
|
|
||||||
ax.legend(loc="upper right")
|
ax.legend(loc="lower right")
|
||||||
|
|
||||||
filename_output = output_folder + 'tube_current_vs_z.pdf'
|
filename_output = output_folder + 'tube_current_vs_z.pdf'
|
||||||
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
||||||
|
|
||||||
def plotLongitudinalCurrentVsZ(filename_current, filename_density, output_folder):
|
def plotLongitudinalCurrentVsZ(filename_current, filename_density, output_folder):
|
||||||
|
|
||||||
e_dict = {"key" : "/e-", "linestyle": '-', "label": "e"}
|
e_dict = {"key" : "/e-", "linestyle": '-', "label": "e$^-$", "charge": -1.602E-19}
|
||||||
T3_dict = {"key" : "/T3+", "linestyle": '--', "label": "T3+"}
|
T3_dict = {"key" : "/T3+", "linestyle": '--', "label": "T$_3^+$", "charge": 1.602E-19}
|
||||||
dicts = [e_dict, T3_dict]
|
T2_dict = {"key" : "/T2+", "linestyle": '--', "label": "T$_2^+$", "charge": 1.602E-19}
|
||||||
|
T_dict = {"key" : "/T+", "linestyle": '--', "label": "T$^+$", "charge": 1.602E-19}
|
||||||
|
dicts = [e_dict, T3_dict, T2_dict, T_dict]
|
||||||
|
|
||||||
pst.setRcParams()
|
pst.setRcParams()
|
||||||
prop_cycle = plt.rcParams['axes.prop_cycle']
|
prop_cycle = plt.rcParams['axes.prop_cycle']
|
||||||
@@ -53,19 +58,19 @@ def plotLongitudinalCurrentVsZ(filename_current, filename_density, output_folder
|
|||||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
||||||
|
|
||||||
for d in dicts:
|
for d in dicts:
|
||||||
j_total = cc.particleCurrentZ(filename_current, filename_density, d["key"])
|
j_total = cc.absoluteCurrentZ(filename_current, filename_density, d["key"])
|
||||||
z_bins = cc.binBordersZ(filename_current, d["key"])
|
z_bins = cc.binBordersZ(filename_current, d["key"])
|
||||||
|
|
||||||
plot_data = np.sum(np.sum(j_total,2),0)
|
plot_data = np.sum(np.sum(j_total,2),0) * d["charge"]
|
||||||
ax.plot(z_bins, plot_data, linestyle=d["linestyle"], label=d["label"])
|
ax.plot(z_bins- z_bins[0], plot_data, linestyle=d["linestyle"], label=d["label"])
|
||||||
|
|
||||||
ax.set_xlabel(r"Position $z$ [m]")
|
ax.set_xlabel(r"Distance to rear wall $z$ [m]")
|
||||||
ax.set_ylabel(r"Particle Current $j_z$ [$m^{-2}s^{-1}$]")
|
ax.set_ylabel(r"Current $I_z$ [A]")
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
ax.set_facecolor('#e7e7e7ff')
|
||||||
ax.grid(color='white')
|
ax.grid(color='white')
|
||||||
|
|
||||||
ax.legend(loc="lower right")
|
ax.legend(loc="lower right")
|
||||||
|
|
||||||
filename_output = output_folder + 'jz_vs_z.pdf'
|
filename_output = output_folder + 'Iz_vs_z.pdf'
|
||||||
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
||||||
@@ -16,41 +16,20 @@ def makeBarPlotData(data, mins, maxs):
|
|||||||
def plotAllDensityVsZ(filename, filename_output):
|
def plotAllDensityVsZ(filename, filename_output):
|
||||||
keys = ["/Populations/e-/e-", "/Populations/T+/T+", "/Populations/T2+/T2+", "/Populations/T3+/T3+"]
|
keys = ["/Populations/e-/e-", "/Populations/T+/T+", "/Populations/T2+/T2+", "/Populations/T3+/T3+"]
|
||||||
|
|
||||||
print("Get Density: e-")
|
|
||||||
density_e = getDensities(filename, keys[0])
|
|
||||||
print("Get Density: T+")
|
|
||||||
density_T = getDensities(filename, keys[1])
|
|
||||||
print("Get Density: T2+")
|
|
||||||
density_T2 = getDensities(filename, keys[2])
|
|
||||||
print("Get Density: T3+")
|
|
||||||
density_T3 = getDensities(filename, keys[3])
|
|
||||||
|
|
||||||
zmins = getZBinsMin(filename, keys[0])
|
zmins = getZBinsMin(filename, keys[0])
|
||||||
zmaxs = getZBinsMax(filename, keys[0])
|
zmaxs = getZBinsMax(filename, keys[0])
|
||||||
Emins = getEBinsMin(filename, keys[0])
|
Emins = getEBinsMin(filename, keys[0])
|
||||||
Emaxs = getEBinsMax(filename, keys[0])
|
Emaxs = getEBinsMax(filename, keys[0])
|
||||||
|
|
||||||
total_density_e = np.sum(density_e,3)
|
print("Get Density: e-")
|
||||||
total_density_e = np.sum(total_density_e,2)
|
total_density_e = longitudinalDensity(filename, keys[0])
|
||||||
total_density_e = np.sum(total_density_e,1)
|
print("Get Density: T+")
|
||||||
|
total_density_T = longitudinalDensity(filename, keys[1])
|
||||||
|
print("Get Density: T2+")
|
||||||
|
total_density_T2 = longitudinalDensity(filename, keys[2])
|
||||||
|
print("Get Density: T3+")
|
||||||
|
total_density_T3 = longitudinalDensity(filename, keys[3])
|
||||||
|
|
||||||
print("Total density e-: ")
|
|
||||||
print(total_density_e)
|
|
||||||
|
|
||||||
total_density_T = np.sum(density_T,3)
|
|
||||||
total_density_T = np.sum(total_density_T,2)
|
|
||||||
total_density_T = np.sum(total_density_T,1)
|
|
||||||
|
|
||||||
total_density_T2 = np.sum(density_T2,3)
|
|
||||||
total_density_T2 = np.sum(total_density_T2,2)
|
|
||||||
total_density_T2 = np.sum(total_density_T2,1)
|
|
||||||
|
|
||||||
total_density_T3 = np.sum(density_T3,3)
|
|
||||||
total_density_T3 = np.sum(total_density_T3,2)
|
|
||||||
total_density_T3 = np.sum(total_density_T3,1)
|
|
||||||
|
|
||||||
print("Total density T3+: ")
|
|
||||||
print(total_density_T3)
|
|
||||||
|
|
||||||
pst.setRcParams()
|
pst.setRcParams()
|
||||||
prop_cycle = plt.rcParams['axes.prop_cycle']
|
prop_cycle = plt.rcParams['axes.prop_cycle']
|
||||||
@@ -59,24 +38,26 @@ def plotAllDensityVsZ(filename, filename_output):
|
|||||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(total_density_e, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(total_density_e, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data,'-', label="e-")
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6,'-', label="e-")
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(total_density_T3, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(total_density_T3, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data, '--', label=r'T$^+_3$')
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, '--', label=r'T$^+_3$')
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(total_density_T, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(total_density_T, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data, '-.', label=r'T$^+_2$')
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, '-.', label=r'T$^+_2$')
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(total_density_T2, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(total_density_T2, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data, ':', label=r'T$^+$')
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, ':', label=r'T$^+$')
|
||||||
|
|
||||||
ax.set_yscale("log")
|
ax.set_yscale("log")
|
||||||
ax.set_xlabel(r"Position $z$ [m]")
|
ax.set_xlabel(r"Distance to rear wall $z$ [m]")
|
||||||
ax.set_ylabel(r"Density $n$ [$m^{-3}$]")
|
ax.set_ylabel(r"Density $n$ [$cm^{-3}$]")
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
ax.set_facecolor('#e7e7e7ff')
|
||||||
ax.grid(color='white')
|
ax.grid(color='white')
|
||||||
|
|
||||||
ax.legend(loc="lower right")
|
ax.legend(loc=(0.85, 0.15))
|
||||||
|
#ax.legend(loc="lower right")
|
||||||
|
|
||||||
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
||||||
|
plt.show()
|
||||||
@@ -62,4 +62,5 @@ def plotElectronDensityVsE(filename, z_rearwall, z_mid, z_dps, filename_output):
|
|||||||
|
|
||||||
ax.legend()
|
ax.legend()
|
||||||
|
|
||||||
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
fig.savefig(filename_output, format='pdf', bbox_inches='tight')
|
||||||
|
plt.show()
|
||||||
@@ -18,38 +18,38 @@ def plotElectronDensityVsZ(filename, E_th_max, E_beta_min, filename_output):
|
|||||||
keys = ["/Populations/e-/e-", "/Populations/T+/T+", "/Populations/T2+/T2+", "/Populations/T3+/T3+"]
|
keys = ["/Populations/e-/e-", "/Populations/T+/T+", "/Populations/T2+/T2+", "/Populations/T3+/T3+"]
|
||||||
|
|
||||||
k = keys[0]
|
k = keys[0]
|
||||||
density = getDensities(filename, k)
|
|
||||||
|
particles = getParticlesPerBin(filename, k)
|
||||||
|
volumes = getVolumes(filename, k)
|
||||||
|
|
||||||
zmins = getZBinsMin(filename, k)
|
zmins = getZBinsMin(filename, k)
|
||||||
zmaxs = getZBinsMax(filename, k)
|
zmaxs = getZBinsMax(filename, k)
|
||||||
Emins = getEBinsMin(filename, k)
|
Emins = getEBinsMin(filename, k)
|
||||||
Emaxs = getEBinsMax(filename, k)
|
Emaxs = getEBinsMax(filename, k)
|
||||||
|
|
||||||
|
volumes_longitudinal = np.sum(volumes, axis=(1,2))
|
||||||
|
|
||||||
|
print("thermal density: ")
|
||||||
thermal_energy = E_th_max
|
thermal_energy = E_th_max
|
||||||
thermal_energy_index = np.where(Emins <= thermal_energy)[-1][-1]
|
thermal_energy_index = np.where(Emins <= thermal_energy)[-1][-1]
|
||||||
thermal_density = np.sum(density[:,:,:,0:thermal_energy_index],3)
|
thermal_particles = particles[:,:,:,0:thermal_energy_index]
|
||||||
thermal_density = np.sum(thermal_density,2)
|
thermal_particles_longitudinal = np.sum(thermal_particles, axis=(1,2,3))
|
||||||
thermal_density = np.sum(thermal_density,1)
|
|
||||||
|
n_thermal = thermal_particles_longitudinal / volumes_longitudinal
|
||||||
print("thermal density: ")
|
|
||||||
print(thermal_density)
|
|
||||||
|
|
||||||
beta_energy = E_beta_min
|
|
||||||
beta_energy_index = np.where(Emins >= beta_energy)[-1][-1]
|
|
||||||
beta_density = np.sum(density[:,:,:,beta_energy_index:],3)
|
|
||||||
beta_density = np.sum(beta_density, 2)
|
|
||||||
beta_density = np.sum(beta_density, 1)
|
|
||||||
|
|
||||||
print("beta density: ")
|
print("beta density: ")
|
||||||
print(beta_density)
|
beta_energy = E_beta_min
|
||||||
|
beta_energy_index = np.where(Emins >= beta_energy)[-1][-1]
|
||||||
|
beta_particles = particles[:,:,:,beta_energy_index:]
|
||||||
|
beta_particles_longitudinal = np.sum(beta_particles, axis=(1,2,3))
|
||||||
|
n_beta = beta_particles_longitudinal / volumes_longitudinal
|
||||||
|
|
||||||
secondary_density = np.sum(density[:,:,:,thermal_energy_index+1:beta_energy_index-1],3)
|
|
||||||
secondary_density = np.sum(secondary_density, 2)
|
|
||||||
secondary_density = np.sum(secondary_density, 1)
|
|
||||||
|
|
||||||
total_density = np.sum(density,3)
|
secondary_particles = particles[:,:,:,thermal_energy_index+1:beta_energy_index-1]
|
||||||
total_density = np.sum(total_density,2)
|
secondary_particles_longitudinal = np.sum(secondary_particles, axis=(1,2,3))
|
||||||
total_density = np.sum(total_density, 1)
|
n_secondary = secondary_particles_longitudinal / volumes_longitudinal
|
||||||
|
|
||||||
|
n_total = n_thermal + n_beta + n_secondary
|
||||||
|
|
||||||
pst.setRcParams()
|
pst.setRcParams()
|
||||||
prop_cycle = plt.rcParams['axes.prop_cycle']
|
prop_cycle = plt.rcParams['axes.prop_cycle']
|
||||||
@@ -61,18 +61,21 @@ def plotElectronDensityVsZ(filename, E_th_max, E_beta_min, filename_output):
|
|||||||
#plot_bins, plot_data = makeBarPlotData(total_density, zmins, zmaxs)
|
#plot_bins, plot_data = makeBarPlotData(total_density, zmins, zmaxs)
|
||||||
#plt.plot(plot_bins, plot_data)
|
#plt.plot(plot_bins, plot_data)
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(thermal_density, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(n_thermal, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data,'-', label="thermal")
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6,'-', label="thermal")
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(beta_density, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(n_beta, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data, '--', label="beta")
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, '--', label="beta")
|
||||||
|
|
||||||
plot_bins, plot_data = makeBarPlotData(secondary_density, zmins, zmaxs)
|
plot_bins, plot_data = makeBarPlotData(n_secondary, zmins, zmaxs)
|
||||||
ax.plot(plot_bins, plot_data, '-.', label="secondary")
|
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, '-.', label="secondary")
|
||||||
|
|
||||||
|
ax.set_ylim((5E-3, 1E6))
|
||||||
|
|
||||||
ax.set_yscale("log")
|
ax.set_yscale("log")
|
||||||
ax.set_xlabel(r"Position $z$ [m]")
|
|
||||||
ax.set_ylabel(r"Density $n_e$ [$m^{-3}$]")
|
ax.set_xlabel(r"Distance to rear wall $z$ [m]")
|
||||||
|
ax.set_ylabel(r"Density $n_e$ [$cm^{-3}$]")
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
ax.set_facecolor('#e7e7e7ff')
|
||||||
ax.grid(color='white')
|
ax.grid(color='white')
|
||||||
|
|||||||
@@ -95,15 +95,18 @@ def particleCurrentR(filename_current, filename_densities, key):
|
|||||||
bin_borders_r = binBordersR(filename_current, key)
|
bin_borders_r = binBordersR(filename_current, key)
|
||||||
bin_borders_z = binBordersZ(filename_current, key)
|
bin_borders_z = binBordersZ(filename_current, key)
|
||||||
bin_areas_r = binAreasR(bin_borders_r, bin_borders_z)
|
bin_areas_r = binAreasR(bin_borders_r, bin_borders_z)
|
||||||
for iz in np.arange(0, particle_current.shape[2], 1):
|
|
||||||
particle_current[:,:,iz] = particle_current[:,:,iz]/bin_areas_r
|
for ir in np.arange(0, particle_current.shape[0],1):
|
||||||
|
for iz in np.arange(0, particle_current.shape[1],1):
|
||||||
|
for iE in np.arange(0, particle_current.shape[2], 1):
|
||||||
|
particle_current[ir,iz,iE] = particle_current[ir,iz,iE]/bin_areas_r[ir, iz]
|
||||||
|
|
||||||
return particle_current
|
return particle_current
|
||||||
|
|
||||||
def particleCurrentZ(filename_current, filename_densities, key):
|
def particleCurrentZ(filename_current, filename_densities, key):
|
||||||
n_pos = NPosZ(filename_current, key)
|
n_pos = NPosZ(filename_current, key)
|
||||||
n_neg = NNegZ(filename_current, key)
|
n_neg = NNegZ(filename_current, key)
|
||||||
n_total = totalCurrentZ(n_pos, n_neg)[1:, :, :]
|
n_total = totalCurrentZ(n_pos, n_neg)[:-1, :, :]
|
||||||
|
|
||||||
delta_t = lastOutputTime(filename_densities)
|
delta_t = lastOutputTime(filename_densities)
|
||||||
particle_current = n_total/delta_t
|
particle_current = n_total/delta_t
|
||||||
@@ -111,11 +114,57 @@ def particleCurrentZ(filename_current, filename_densities, key):
|
|||||||
bin_borders_r = binBordersR(filename_current, key)
|
bin_borders_r = binBordersR(filename_current, key)
|
||||||
bin_borders_z = binBordersZ(filename_current, key)
|
bin_borders_z = binBordersZ(filename_current, key)
|
||||||
bin_areas_z = binAreasZ(bin_borders_r, bin_borders_z)
|
bin_areas_z = binAreasZ(bin_borders_r, bin_borders_z)
|
||||||
for iz in np.arange(0, particle_current.shape[2], 1):
|
|
||||||
particle_current[:,:,iz] = particle_current[:,:,iz]/bin_areas_z
|
for ir in np.arange(0, particle_current.shape[0],1):
|
||||||
|
for iz in np.arange(0, particle_current.shape[1],1):
|
||||||
|
for iE in np.arange(0, particle_current.shape[2], 1):
|
||||||
|
particle_current[ir,iz,iE] = particle_current[ir,iz,iE]/bin_areas_z[ir, iz]
|
||||||
|
|
||||||
return particle_current
|
return particle_current
|
||||||
|
|
||||||
|
def absoluteCurrentZ(filename_current, filename_densities, key):
|
||||||
|
n_pos = NPosZ(filename_current, key)
|
||||||
|
n_neg = NNegZ(filename_current, key)
|
||||||
|
n_total = totalCurrentZ(n_pos, n_neg)[:-1, :, :]
|
||||||
|
|
||||||
|
delta_t = lastOutputTime(filename_densities)
|
||||||
|
particle_current = n_total/delta_t
|
||||||
|
return particle_current
|
||||||
|
|
||||||
|
def absoluteCurrentR(filename_current, filename_densities, key):
|
||||||
|
n_pos = NPosR(filename_current, key)
|
||||||
|
n_neg = NNegR(filename_current, key)
|
||||||
|
n_total = totalCurrentR(n_pos, n_neg)[:,:-1,:]
|
||||||
|
|
||||||
|
delta_t = lastOutputTime(filename_densities)
|
||||||
|
|
||||||
|
particle_current = n_total/delta_t
|
||||||
|
return particle_current
|
||||||
|
|
||||||
|
def totalCurrentRearwall(filename_current, filename_densities, key):
|
||||||
|
n_pos = NPosZ(filename_current, key)
|
||||||
|
n_neg = NNegZ(filename_current, key)
|
||||||
|
n_total = totalCurrentZ(n_pos, n_neg)[:-1, :, :]
|
||||||
|
|
||||||
|
delta_t = lastOutputTime(filename_densities)
|
||||||
|
|
||||||
|
R = 0.045
|
||||||
|
A_rw = R**2 * np.pi
|
||||||
|
I_rw = np.sum(np.sum(n_total[:,0, :],1),0) /delta_t * 1.602E-19
|
||||||
|
return I_rw
|
||||||
|
|
||||||
|
def totalCurrentTube(filename_current, filename_densities, key):
|
||||||
|
n_pos = NPosR(filename_current, key)
|
||||||
|
n_neg = NNegR(filename_current, key)
|
||||||
|
n_total = totalCurrentR(n_pos, n_neg)[:,1:,:]
|
||||||
|
|
||||||
|
delta_t = lastOutputTime(filename_densities)
|
||||||
|
R = 0.045
|
||||||
|
H = 13
|
||||||
|
|
||||||
|
I_tube = np.sum(np.sum(n_total[4,:,:],1),0) / delta_t * 1.602E-19
|
||||||
|
return I_tube
|
||||||
|
|
||||||
def makeBarPlotData(data, mins, maxs):
|
def makeBarPlotData(data, mins, maxs):
|
||||||
plot_bins = np.dstack((mins,maxs)).flatten()
|
plot_bins = np.dstack((mins,maxs)).flatten()
|
||||||
plot_datas = np.dstack((data,data)).flatten()
|
plot_datas = np.dstack((data,data)).flatten()
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def getOffset(filename, key):
|
|||||||
|
|
||||||
return offsets
|
return offsets
|
||||||
|
|
||||||
def getDensities(filename, key):
|
def getParticlesPerBin(filename, key):
|
||||||
f = h5py.File(filename, 'r')
|
f = h5py.File(filename, 'r')
|
||||||
data = np.array([f[key]])
|
data = np.array([f[key]])
|
||||||
f.close()
|
f.close()
|
||||||
@@ -60,6 +60,40 @@ def getDensities(filename, key):
|
|||||||
last_output_time = np.unique(data[:,0])[-1]
|
last_output_time = np.unique(data[:,0])[-1]
|
||||||
data_last = data[data[:,0] == last_output_time]
|
data_last = data[data[:,0] == last_output_time]
|
||||||
|
|
||||||
|
print("Get Cum times")
|
||||||
|
cum_times = getCumTimes(filename, key)
|
||||||
|
print("Get Offsets")
|
||||||
|
offsets = getOffset(filename, key)
|
||||||
|
|
||||||
|
particles = cum_times/last_output_time - offsets
|
||||||
|
|
||||||
|
return particles
|
||||||
|
|
||||||
|
def getDensities(filename, key):
|
||||||
|
particles = getParticlesPerBin(filename, key)
|
||||||
|
volumes = getVolumes(filename, key)
|
||||||
|
|
||||||
|
[zbins, rbins, phi_bins, E_bins] = getNumBins(filename, key)
|
||||||
|
|
||||||
|
density = np.empty_like(particles)
|
||||||
|
|
||||||
|
for iE in np.arange(0,E_bins,1):
|
||||||
|
density[:,:,:,iE] = particles/volumes
|
||||||
|
|
||||||
|
return density
|
||||||
|
|
||||||
|
def longitudinalDensity(filename, key):
|
||||||
|
particles = getParticlesPerBin(filename, key)
|
||||||
|
volumes = getVolumes(filename, key)
|
||||||
|
|
||||||
|
particles_longitudinal = np.sum(particles, axis=(1,2,3))
|
||||||
|
volumes_longitudinal = np.sum(volumes, axis=(1,2))
|
||||||
|
|
||||||
|
density = particles_longitudinal / volumes_longitudinal
|
||||||
|
|
||||||
|
return density
|
||||||
|
|
||||||
|
def getVolumes(filename, key):
|
||||||
[zbins, rbins, phi_bins, E_bins] = getNumBins(filename, key)
|
[zbins, rbins, phi_bins, E_bins] = getNumBins(filename, key)
|
||||||
zbins_min = getZBinsMin(filename, key)
|
zbins_min = getZBinsMin(filename, key)
|
||||||
zbins_max = getZBinsMax(filename, key)
|
zbins_max = getZBinsMax(filename, key)
|
||||||
@@ -68,31 +102,19 @@ def getDensities(filename, key):
|
|||||||
phibins_min = getPhiBinsMin(filename, key)
|
phibins_min = getPhiBinsMin(filename, key)
|
||||||
phibins_max = getPhiBinsMax(filename, key)
|
phibins_max = getPhiBinsMax(filename, key)
|
||||||
|
|
||||||
print("Get Cum times")
|
volumes = np.empty((zbins, rbins, phi_bins))
|
||||||
cum_times = getCumTimes(filename, key)
|
|
||||||
print("Get Offsets")
|
|
||||||
offsets = getOffset(filename, key)
|
|
||||||
|
|
||||||
densities = np.zeros((zbins, rbins, phi_bins, E_bins))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("Calculate densities")
|
|
||||||
for iz in np.arange(0,zbins,1):
|
for iz in np.arange(0,zbins,1):
|
||||||
print("iz: " + str(iz))
|
|
||||||
for ir in np.arange(0,rbins,1):
|
for ir in np.arange(0,rbins,1):
|
||||||
for iphi in np.arange(0,phi_bins,1):
|
for iphi in np.arange(0,phi_bins,1):
|
||||||
for iE in np.arange(0,E_bins,1):
|
z_bin_min = zbins_min[iz]
|
||||||
z_bin_min = zbins_min[iz]
|
z_bin_max = zbins_max[iz]
|
||||||
z_bin_max = zbins_max[iz]
|
r_bin_min = rbins_min[ir]
|
||||||
r_bin_min = rbins_min[ir]
|
r_bin_max = rbins_max[ir]
|
||||||
r_bin_max = rbins_max[ir]
|
phi_bin_min = phibins_min[iphi]
|
||||||
phi_bin_min = phibins_min[iphi]
|
phi_bin_max = phibins_max[iphi]
|
||||||
phi_bin_max = phibins_max[iphi]
|
volumes[iz, ir, iphi] = getVolume(z_bin_min, z_bin_max, r_bin_min, r_bin_max, phi_bin_min, phi_bin_max)
|
||||||
volume = getVolume(z_bin_min, z_bin_max, r_bin_min, r_bin_max, phi_bin_min, phi_bin_max)
|
return volumes
|
||||||
densities[iz,ir,iphi,iE] = cum_times[iz, ir, iphi, iE]/(last_output_time*volume) - offsets[iz, ir, iphi, iE]/volume
|
|
||||||
|
|
||||||
return densities
|
|
||||||
|
|
||||||
def getZBinsMin(filename, key):
|
def getZBinsMin(filename, key):
|
||||||
meta_key = key + "_meta_data"
|
meta_key = key + "_meta_data"
|
||||||
|
|||||||
Reference in New Issue
Block a user