Ion injector and bug fix in stepping
This commit is contained in:
@@ -27,13 +27,13 @@ void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
|
||||
const double distance = 1./macro_sigma_m;
|
||||
|
||||
const int n = std::floor(distance/dz);
|
||||
const double n = std::floor(distance/dz);
|
||||
|
||||
bool left_simulation = false;
|
||||
bool changed_longitudinal_bin = false;
|
||||
|
||||
const double part_macro_sigma_m = 1./dz;
|
||||
for(int step = 0; step < n; ++step){
|
||||
for(double step = 0; step < n; ++step){
|
||||
// move particle to new position
|
||||
double znew_m = get_zNew_m(movePart, part_macro_sigma_m);
|
||||
doWallInteraction(movePart, &oldLoc_m, &znew_m);
|
||||
@@ -42,10 +42,14 @@ void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
|
||||
// calculate additional movement through E/B field
|
||||
do_E_calculus(movePart, oldLoc_m, part_macro_sigma_m);
|
||||
|
||||
Logger->log(*movePart, oldLoc_m);
|
||||
|
||||
Population->increase_density(*movePart, oldLoc_m);
|
||||
|
||||
newLoc_m = movePart->get_x_m();
|
||||
|
||||
|
||||
// stop movement conditions
|
||||
changed_longitudinal_bin = longitudinal_bins.changedBin(
|
||||
calc_z_m(oldLoc_m), calc_z_m(newLoc_m));
|
||||
@@ -54,7 +58,6 @@ void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
if(left_simulation || changed_longitudinal_bin){
|
||||
break;
|
||||
}
|
||||
|
||||
// prepare new loop iteration
|
||||
oldLoc_m = newLoc_m;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ std::unique_ptr<ElectricField> ElectricFieldFactory::build(
|
||||
double cylinder_radius,
|
||||
double cylinder_height)
|
||||
{
|
||||
std::string dataset_path_Er("/Er");
|
||||
std::string dataset_path_Ez("/Ez");
|
||||
std::string dataset_path_Er("/Efield/efield_r");
|
||||
std::string dataset_path_Ez("/Efield/efield_z");
|
||||
|
||||
blitz::Array<double,3> Er = read(filename, dataset_path_Er);
|
||||
blitz::Array<double,3> Ez = read(filename, dataset_path_Ez);
|
||||
@@ -55,7 +55,6 @@ blitz::Array<double,3> ElectricFieldFactory::read(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data_3d.copy();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
#include "injector.h"
|
||||
#include <random/uniform.h>
|
||||
#include "injector_builder.hpp"
|
||||
|
||||
Injector::Injector() :
|
||||
RNG_Base(nullptr, nullptr)
|
||||
{};
|
||||
|
||||
|
||||
Injector::Injector(
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
Population_Base *T2Population,
|
||||
int method,
|
||||
double energy_eV,
|
||||
int ions) :
|
||||
RNG_Base(rngUni, rngNormal)
|
||||
{
|
||||
this->T2Population = T2Population;
|
||||
this->method = method;
|
||||
this->energy_eV = energy_eV;
|
||||
this->ions = ions;
|
||||
};
|
||||
|
||||
|
||||
int Injector::inject (
|
||||
std::vector<Particle> *particle_queue,
|
||||
const int &last_ID)
|
||||
{
|
||||
int num_particles_added = 0;
|
||||
|
||||
vec3 loc_m = T2Population->roll_x_ms();
|
||||
double E_eV;
|
||||
switch(method) {
|
||||
case 0: // Fermi
|
||||
E_eV = roll_FermiEnergy_eV();
|
||||
break;
|
||||
case 1: //Delta
|
||||
E_eV = energy_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
E_eV = roll_MBEnergy(energy_eV/kb_eVK, me_eV, rngNormal);
|
||||
break;
|
||||
default:
|
||||
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
||||
break;
|
||||
}
|
||||
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));
|
||||
num_particles_added += 1;
|
||||
|
||||
if(ions != 0){
|
||||
double ETI_eV;
|
||||
switch(ions) {
|
||||
case 1: //Delta
|
||||
ETI_eV = Injector_Builder::energyTI_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
ETI_eV = roll_MBEnergy(
|
||||
Injector_Builder::energyTI_eV/kb_eVK,
|
||||
2*mT_eV,
|
||||
rngNormal);
|
||||
break;
|
||||
default:
|
||||
throw MyException("Katrin::injectIon: Invalid Injection Method.");
|
||||
break;
|
||||
}
|
||||
|
||||
const double v_abs = calc_v_ms_from_E_eV(ETI_eV,2*mT_eV);
|
||||
|
||||
vec3 direction(0., 0., 0.);
|
||||
if(ions == 1){
|
||||
direction = vec3(0., 0., -1.0);
|
||||
}
|
||||
else{
|
||||
direction = roll_uniform_direction(rngUni);
|
||||
}
|
||||
|
||||
vec3 vTI_ms = direction * v_abs;
|
||||
//vec3 locTI(0., 0.0, 10);
|
||||
vec3 locTI = loc_m;
|
||||
particle_queue->push_back(PartFac.create_T2I(locTI, vTI_ms, last_ID+2, last_ID+2));
|
||||
num_particles_added += 1;
|
||||
}
|
||||
|
||||
return num_particles_added;
|
||||
}
|
||||
|
||||
double Injector::roll_FermiEnergy_eV()
|
||||
{
|
||||
double pmax,E_min_eV, E_max_eV, Ecan_eV,eta1,eta2;
|
||||
pmax = 1.5e-28; // From Plotting EnergyDistributionBetaDecay
|
||||
E_min_eV = scale_start;
|
||||
E_max_eV = TritiumDecayEndpoint_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Ecan_eV = E_min_eV + eta1*(E_max_eV - E_min_eV);
|
||||
} while(eta2*pmax > get_FermiDecaySpectrumDensity(Ecan_eV));
|
||||
return Ecan_eV;
|
||||
}
|
||||
|
||||
double Injector::get_FermiDecaySpectrumDensity(
|
||||
const double &E_eV)
|
||||
{
|
||||
if (E_eV>TritiumDecayEndpoint_eV) {
|
||||
return 0;
|
||||
} else{
|
||||
double p_eV = sqrt(E_eV*E_eV + 2 * E_eV * me_eV);
|
||||
return BetaDecayConst*get_FermiFunction(2, E_eV)*p_eV*(E_eV+me_eV)*pow(TritiumDecayEndpoint_eV-E_eV,2);
|
||||
}
|
||||
}
|
||||
|
||||
double Injector::get_FermiFunction(
|
||||
const double &Z, const double &E_eV)
|
||||
{
|
||||
double gamma = 1+ E_eV/me_eV;
|
||||
double beta = sqrt(1 - pow(gamma,-2));
|
||||
double eta =Z/beta/137.;
|
||||
return 2*pi*eta/(1-exp(-2*pi*eta));
|
||||
}
|
||||
+19
-88
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// injector.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 14.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef injector_h
|
||||
#define injector_h
|
||||
#ifndef INJECTOR_H
|
||||
#define INJECTOR_H
|
||||
|
||||
#include "population_base.h"
|
||||
|
||||
@@ -16,88 +8,27 @@
|
||||
|
||||
|
||||
class Injector : RNG_Base {
|
||||
public:
|
||||
Injector();
|
||||
Injector(
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
Population_Base *T2Population,
|
||||
int method,
|
||||
double energy_eV,
|
||||
int ions);
|
||||
|
||||
int inject (std::vector<Particle> *particle_queue, const int &last_ID);
|
||||
private:
|
||||
double roll_FermiEnergy_eV();
|
||||
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
||||
double get_FermiFunction(const double &Z, const double &E_eV);
|
||||
|
||||
int method;
|
||||
double energy_eV;
|
||||
int ions;
|
||||
Population_Base *T2Population;
|
||||
|
||||
Particle_Builder PartFac;
|
||||
|
||||
public:
|
||||
Injector() : RNG_Base(nullptr, nullptr) {};
|
||||
Injector(UniRNG *rngUni, NormalRNG *rngNormal, Population_Base *T2Population, int method, double energy_eV, int ions) : RNG_Base(rngUni, rngNormal){
|
||||
this->T2Population = T2Population;
|
||||
this->method = method;
|
||||
this->energy_eV = energy_eV;
|
||||
this->ions = ions;
|
||||
};
|
||||
|
||||
int inject (std::vector<Particle> *particle_queue, const int &last_ID);
|
||||
private:
|
||||
double roll_FermiEnergy_eV();
|
||||
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
||||
double get_FermiFunction(const double &Z, const double &E_eV);
|
||||
};
|
||||
|
||||
inline int Injector::inject (std::vector<Particle> *particle_queue, const int &last_ID) {
|
||||
vec3 loc_m = T2Population->roll_x_ms();
|
||||
|
||||
double E_eV;
|
||||
switch(method) {
|
||||
case 0: // Fermi
|
||||
E_eV = roll_FermiEnergy_eV();
|
||||
break;
|
||||
case 1: //Delta
|
||||
E_eV = energy_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
E_eV = roll_MBEnergy(energy_eV/kb_eVK, me_eV, rngNormal);
|
||||
break;
|
||||
default:
|
||||
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
||||
break;
|
||||
}
|
||||
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));
|
||||
|
||||
if (ions == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
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));
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline double Injector::roll_FermiEnergy_eV() {
|
||||
double pmax,E_min_eV, E_max_eV, Ecan_eV,eta1,eta2;
|
||||
pmax = 1.5e-28; // From Plotting EnergyDistributionBetaDecay
|
||||
E_min_eV = scale_start;
|
||||
E_max_eV = TritiumDecayEndpoint_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Ecan_eV = E_min_eV + eta1*(E_max_eV - E_min_eV);
|
||||
} while(eta2*pmax > get_FermiDecaySpectrumDensity(Ecan_eV));
|
||||
return Ecan_eV;
|
||||
}
|
||||
|
||||
inline double Injector::get_FermiDecaySpectrumDensity(const double &E_eV) {
|
||||
if (E_eV>TritiumDecayEndpoint_eV) {
|
||||
return 0;
|
||||
} else{
|
||||
double p_eV = sqrt(E_eV*E_eV + 2 * E_eV * me_eV);
|
||||
return BetaDecayConst*get_FermiFunction(2, E_eV)*p_eV*(E_eV+me_eV)*pow(TritiumDecayEndpoint_eV-E_eV,2);
|
||||
}
|
||||
}
|
||||
|
||||
inline double Injector::get_FermiFunction(const double &Z, const double &E_eV) {
|
||||
double gamma = 1+ E_eV/me_eV;
|
||||
double beta = sqrt(1 - pow(gamma,-2));
|
||||
double eta =Z/beta/137.;
|
||||
return 2*pi*eta/(1-exp(-2*pi*eta));
|
||||
}
|
||||
|
||||
|
||||
#endif /* injector_h */
|
||||
#endif /* INJECTOR_H */
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
const int Injector_Builder::method = load_parameter("INJECTION");
|
||||
const double Injector_Builder::energy_eV = load_parameter("INJ_E");
|
||||
const int Injector_Builder::ions = load_parameter("INJ_TI");
|
||||
const double Injector_Builder::energyTI_eV = load_parameter("INJ_E_TI");
|
||||
|
||||
Injector Injector_Builder::build(UniRNG *rngUni, NormalRNG *rngNormal, Population_Manager *populations) {
|
||||
Injector Injector_Builder::build(
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
Population_Manager *populations)
|
||||
{
|
||||
Population_Base *T2Population = populations->find(tritium2);
|
||||
return Injector(rngUni, rngNormal, T2Population, method, energy_eV, ions);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// injector_builder.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 14.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef injector_builder_hpp
|
||||
#define injector_builder_hpp
|
||||
|
||||
@@ -14,13 +6,17 @@
|
||||
|
||||
|
||||
class Injector_Builder {
|
||||
public:
|
||||
Injector_Builder() {};
|
||||
|
||||
static Injector build(
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
Population_Manager *populations);
|
||||
|
||||
static const int method;
|
||||
static const double energy_eV;
|
||||
static const int ions;
|
||||
|
||||
public:
|
||||
Injector_Builder() {};
|
||||
|
||||
static Injector build(UniRNG *rngUni, NormalRNG *rngNormal, Population_Manager *populations);
|
||||
static const double energyTI_eV;
|
||||
};
|
||||
#endif /* injector_builder_hpp */
|
||||
|
||||
+1
-13
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// kinematics.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 30.04.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef kinematics_h
|
||||
#define kinematics_h
|
||||
|
||||
@@ -64,11 +56,7 @@ inline double calc_r_m(const vec3 &loc_m) {
|
||||
}
|
||||
|
||||
inline double calc_phi(const vec3 &loc_m) {
|
||||
if (loc_m[1] >= 0) {
|
||||
return acos(loc_m[0]/calc_r_m(loc_m));
|
||||
} else {
|
||||
return 2*pi - acos(loc_m[0]/calc_r_m(loc_m));
|
||||
}
|
||||
return std::atan2(loc_m(1),loc_m(1));
|
||||
}
|
||||
|
||||
inline double gamma(double v)
|
||||
|
||||
+4
-1
@@ -35,6 +35,8 @@ OBJS := particle_looper.o \
|
||||
T2IT2_cx.o \
|
||||
tritium2_population.o \
|
||||
LongitudinalBins.o \
|
||||
injector.o \
|
||||
thermal_population.o \
|
||||
|
||||
|
||||
CXXFLAGS = $(X_OFLAGS) -I.. $(X_INC) -std=c++11
|
||||
@@ -45,7 +47,8 @@ MPXFLAGS = $(X_OFLAGS) -I.. $(X_INC) $(X_HDF5P_INC) -std=c++11
|
||||
LDFLAGS = $(X_LIB) $(X_HDF5P_LIBS)
|
||||
|
||||
#LOADLIBES = -lblitz -lm -lhdf5 -lhdf5_hl
|
||||
LOADLIBES = -lblitz -lm -g -DBZ_DEBUG
|
||||
#LOADLIBES = -lblitz -lm -g -DBZ_DEBUG
|
||||
LOADLIBES = -lblitz -lm
|
||||
|
||||
TARGETS = mcelectron
|
||||
|
||||
|
||||
@@ -76,10 +76,16 @@ void Population_Container::init_size_array() {
|
||||
}
|
||||
}
|
||||
|
||||
void Population_Container::increase_cum_time_s(const vec3 &loc1_m, const vec3 &loc2_m, const double &v_ms, const double &E_eV) {
|
||||
void Population_Container::increase_cum_time_s(
|
||||
const vec3 &loc1_m,
|
||||
const vec3 &loc2_m,
|
||||
const double &v_ms,
|
||||
const double &E_eV)
|
||||
{
|
||||
int E_bin = E_scale.calc_index(E_eV);
|
||||
Bins bins_1 = calc_loc_bin(loc1_m);
|
||||
Bins bins_2 = calc_loc_bin(loc2_m);
|
||||
|
||||
if ((!(bins_1.r == bins_2.r && bins_1.phi == bins_2.phi)) && (bins_1.z == bins_2.z)) { // Movement not in z... just ignore it for now...
|
||||
//cout<<"Population_Container: Movement in r-phi-direction. \n.";
|
||||
} else if (bins_1.z == bins_2.z) { // Movement in same bin, most of the times!
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// random_operations.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 30.04.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef random_operations_h
|
||||
#define random_operations_h
|
||||
#ifndef RANDOM_OPERATIONS_H
|
||||
#define RANDOM_OPERATIONS_H
|
||||
|
||||
#include <random/uniform.h>
|
||||
#include <random/normal.h>
|
||||
@@ -67,4 +59,4 @@ inline double roll_Rejectionmethod(double (*pdf)(double), double xmin, double xm
|
||||
}
|
||||
|
||||
|
||||
#endif /* random_operations_h */
|
||||
#endif /* RANDOM_OPERATIONS_H */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
void initCoordinateConversion()
|
||||
{
|
||||
CoordinateConversion::setCylinderOrigin(
|
||||
blitz::TinyVector<double,3>(0., 0., -3.));
|
||||
blitz::TinyVector<double,3>(0., 0., 0.));
|
||||
}
|
||||
|
||||
void initBField(const pugi::xml_node& B_params) {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "thermal_population.h"
|
||||
|
||||
|
||||
Thermal_Population::Thermal_Population(
|
||||
species this_species,
|
||||
Base_Kinematics *kinematics,
|
||||
Timer *timer,
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
int num_z_bins, int num_r_bins, int num_phi_bins) :
|
||||
Population_Base(this_species),
|
||||
RNG_Base(rngUni, rngNormal),
|
||||
container(num_z_bins, num_r_bins, num_phi_bins, 1)
|
||||
{
|
||||
this->timer = timer;
|
||||
this->kinematics = kinematics;
|
||||
}
|
||||
|
||||
void Thermal_Population::increase_density (
|
||||
const Particle &upPart, const vec3 &oldLoc_m)
|
||||
{
|
||||
container.increase_cum_time_s(
|
||||
oldLoc_m,
|
||||
upPart.get_x_m(),
|
||||
calc_vec3_abs(upPart.get_v_ms()),
|
||||
upPart.get_E_eV());
|
||||
}
|
||||
void Thermal_Population::decrease_denisty (
|
||||
const vec3 &loc_m, const double &E_eV)
|
||||
{
|
||||
container.increase_offset(loc_m, E_eV);
|
||||
}
|
||||
|
||||
double Thermal_Population::get_density_m3(
|
||||
const vec3 &loc_m)
|
||||
{
|
||||
return container.get_density_m3(loc_m, 0, timer->get_time_s());
|
||||
}
|
||||
|
||||
double Thermal_Population::get_density_m3(
|
||||
const int &E_bin, const Bins &loc_bins)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
|
||||
int Thermal_Population::get_number_E_bins()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bins Thermal_Population::get_loc_bin(
|
||||
const vec3 & loc_m)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
double Thermal_Population::get_E_bin_mid_eV(
|
||||
const int &E_bin)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
|
||||
|
||||
vec3 Thermal_Population::roll_x_ms()
|
||||
{
|
||||
throw MyException ("Not yet implemented as not needed at this point.");
|
||||
}
|
||||
vec3 Thermal_Population::roll_v_ms (
|
||||
const vec3 &loc_m)
|
||||
{
|
||||
return kinematics->get_v_ms(loc_m);
|
||||
}
|
||||
vec3 Thermal_Population::get_drift_v_ms(
|
||||
const vec3 &loc_m)
|
||||
{
|
||||
return kinematics->get_v_offset_ms(loc_m);
|
||||
}
|
||||
double Thermal_Population::get_thermal_v_ms()
|
||||
{
|
||||
return kinematics->get_thermal_v_ms();
|
||||
}
|
||||
double Thermal_Population::get_v_pdf(
|
||||
const double &v_ms)
|
||||
{
|
||||
return kinematics->get_v_pdf(v_ms);
|
||||
}
|
||||
|
||||
Population_Container *Thermal_Population::access_container()
|
||||
{
|
||||
return &container;
|
||||
}
|
||||
@@ -1,49 +1,44 @@
|
||||
//
|
||||
// Thermal_Population.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 25.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Thermal_Population_h
|
||||
#define Thermal_Population_h
|
||||
#ifndef THERMAL_POPULATION_H
|
||||
#define THERMAL_POPULATION_H
|
||||
|
||||
#include "population_base.h"
|
||||
#include "wgts_kinematics.h"
|
||||
|
||||
|
||||
|
||||
class Thermal_Population : public Population_Base, private RNG_Base {
|
||||
public:
|
||||
Thermal_Population(
|
||||
species this_species,
|
||||
Base_Kinematics *kinematics,
|
||||
Timer *timer,
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal,
|
||||
int num_z_bins,
|
||||
int num_r_bins,
|
||||
int num_phi_bins);
|
||||
|
||||
void increase_density (const Particle &upPart, const vec3 &oldLoc_m);
|
||||
void decrease_denisty (const vec3 &loc_m, const double &E_eV);
|
||||
|
||||
double get_density_m3(const vec3 &loc_m);
|
||||
|
||||
double get_density_m3(const int &E_bin, const Bins &loc_bins);
|
||||
int get_number_E_bins();
|
||||
Bins get_loc_bin(const vec3 & loc_m);
|
||||
double get_E_bin_mid_eV(const int &E_bin);
|
||||
|
||||
|
||||
vec3 roll_x_ms();
|
||||
vec3 roll_v_ms (const vec3 &loc_m);
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m);
|
||||
double get_thermal_v_ms();
|
||||
double get_v_pdf(const double &v_ms);
|
||||
|
||||
Population_Container *access_container();
|
||||
private:
|
||||
Population_Container container;
|
||||
Timer *timer;
|
||||
Base_Kinematics *kinematics;
|
||||
|
||||
public:
|
||||
Thermal_Population(species this_species, Base_Kinematics *kinematics, Timer *timer, UniRNG *rngUni, NormalRNG *rngNormal, int num_z_bins, int num_r_bins, int num_phi_bins) : Population_Base(this_species), RNG_Base(rngUni, rngNormal), container(num_z_bins, num_r_bins, num_phi_bins, 1) {
|
||||
this->timer = timer;
|
||||
this->kinematics = kinematics;
|
||||
}
|
||||
|
||||
void increase_density (const Particle &upPart, const vec3 &oldLoc_m) {container.increase_cum_time_s(oldLoc_m, upPart.get_x_m(), calc_vec3_abs(upPart.get_v_ms()), upPart.get_E_eV());}
|
||||
void decrease_denisty (const vec3 &loc_m, const double &E_eV) {container.increase_offset(loc_m, E_eV);}
|
||||
|
||||
double get_density_m3(const vec3 &loc_m) {return container.get_density_m3(loc_m, 0, timer->get_time_s());}
|
||||
|
||||
double get_density_m3(const int &E_bin, const Bins &loc_bins) {throw MyException("Should not be called.\n.");}
|
||||
int get_number_E_bins() {return 1;}
|
||||
Bins get_loc_bin(const vec3 & loc_m) {throw MyException("Should not be called.\n.");}
|
||||
double get_E_bin_mid_eV(const int &E_bin) {throw MyException("Should not be called.\n.");}
|
||||
|
||||
|
||||
vec3 roll_x_ms() {throw MyException ("Not yet implemented as not needed at this point.");}
|
||||
vec3 roll_v_ms (const vec3 &loc_m) {return kinematics->get_v_ms(loc_m);}
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m) {return kinematics->get_v_offset_ms(loc_m);}
|
||||
double get_thermal_v_ms() {return kinematics->get_thermal_v_ms();}
|
||||
double get_v_pdf(const double &v_ms) {return kinematics->get_v_pdf(v_ms);}
|
||||
|
||||
Population_Container *access_container() {return &container;}
|
||||
};
|
||||
|
||||
|
||||
#endif /* Thermal_Population_h */
|
||||
#endif /* THERMAL_POPULATION_H */
|
||||
|
||||
@@ -70,8 +70,6 @@ def plotElectronDensityVsZ(filename, E_th_max, E_beta_min, filename_output):
|
||||
plot_bins, plot_data = makeBarPlotData(n_secondary, zmins, zmaxs)
|
||||
ax.plot(plot_bins - plot_bins[0], plot_data/1E6, '-.', label="secondary")
|
||||
|
||||
ax.set_ylim((5E-3, 1E6))
|
||||
|
||||
ax.set_yscale("log")
|
||||
|
||||
ax.set_xlabel(r"Distance to rear wall $z$ [m]")
|
||||
|
||||
@@ -13,11 +13,6 @@ namespace IO {
|
||||
|
||||
Fields::Density denstiy(const Parameter& parameter)
|
||||
{
|
||||
//blitz::Array<double,2> data(40,180);
|
||||
//data = 0.;
|
||||
//data(blitz::Range(0,1),blitz::Range(2,7)) = 1.;
|
||||
//return Fields::Density(data);
|
||||
|
||||
std::string filename = std::string(
|
||||
parameter.document.first_element_by_path(
|
||||
"Parameters/Input/Density").child_value("Filename"));
|
||||
@@ -25,6 +20,7 @@ Fields::Density denstiy(const Parameter& parameter)
|
||||
std::string path = std::string(
|
||||
parameter.document.first_element_by_path(
|
||||
"Parameters/Input/Density").child_value("H5Path"));
|
||||
|
||||
std::cout << path << std::endl;
|
||||
HighFive::File f(filename, HighFive::File::ReadOnly);
|
||||
HighFive::DataSet dataset = f.getDataSet(path);
|
||||
|
||||
@@ -38,6 +38,8 @@ int main(int argc, char *argv[]){
|
||||
|
||||
Fields::ElectricField efield_interpolated = Fields::interpolateOnGrid(efield);
|
||||
|
||||
efield_interpolated.data_r_ = 0.;
|
||||
|
||||
IO::save(potential, parameter);
|
||||
IO::save(efield_interpolated, parameter);
|
||||
IO::save(interpolated, parameter);
|
||||
|
||||
Reference in New Issue
Block a user