Version 2, position dependent E/B, kinetic ions, boris mover, terminator

This commit is contained in:
Jonas Kellerer
2022-10-21 10:09:19 +02:00
parent acc55cf003
commit 83fd2e5d7e
869 changed files with 1033204 additions and 3634436 deletions
+102
View File
@@ -0,0 +1,102 @@
#include "IO/hdf5_reader.h"
#include <hdf5.h>
#include <hdf5_hl.h>
#include "simulation/errors.h"
Hdf5Reader::Hdf5Reader(std::string directory, std::string filename)
: absolute_filename_((directory + "/" + filename + ".h5").c_str()) {}
Hdf5Reader::Hdf5Reader(std::string absolute_filename)
: absolute_filename_(absolute_filename) {}
blitz::Array<double, 3> Hdf5Reader::readD3Double(std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
hid_t dataspace = H5Dget_space(dataset);
if (dataset < 0) {
ERROR("The given dataset could not be opened");
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
const int ndims = H5Sget_simple_extent_ndims(dataspace);
hsize_t dims[ndims];
if (ndims != 3) {
ERROR("The given dataset is not threedimensional. It has dims: " + ndims);
}
H5Sget_simple_extent_dims(dataspace, dims, NULL);
blitz::Array<double, 3> data(dims[0], dims[1], dims[2]);
H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Fclose(file);
return data.copy();
}
blitz::Array<double, 2> Hdf5Reader::readD2Double(std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
hid_t dataspace = H5Dget_space(dataset);
if (dataset < 0) {
ERROR("The given dataset could not be opened");
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
const int ndims = H5Sget_simple_extent_ndims(dataspace);
hsize_t dims[ndims];
if (ndims != 2) {
ERROR("The given dataset is not two dimensional. It has dims: " + ndims);
}
H5Sget_simple_extent_dims(dataspace, dims, NULL);
blitz::Array<double, 2> data(dims[0], dims[1]);
H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Sclose(dataspace);
H5Dclose(dataset);
H5Fclose(file);
return data.copy();
}
blitz::Array<double, 1> Hdf5Reader::readD1Double(std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
// H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
hid_t dataspace = H5Dget_space(dataset);
if (dataset < 0) {
ERROR("The given dataset could not be opened");
}
// turn error report back onby hdf5 because of check H5Dopen2
// H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
const int ndims = H5Sget_simple_extent_ndims(dataspace);
hsize_t dims[ndims];
if (ndims != 1) {
ERROR("The given dataset is not one dimensional. It has dims: " + ndims);
}
H5Sget_simple_extent_dims(dataspace, dims, NULL);
blitz::Array<double, 1> data(dims[0]);
H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Sclose(dataspace);
H5Dclose(dataset);
H5Fclose(file);
return data.copy();
}
+408
View File
@@ -0,0 +1,408 @@
#include "IO/hdf5_writer.h"
#include <hdf5.h>
#include <hdf5_hl.h>
#include <sys/stat.h>
#include <iostream>
#include "simulation/mpi_communication.h"
Hdf5Writer::Hdf5Writer(std::string directory, std::string filename)
: absolute_filename_((directory + "/" + filename + ".h5").c_str()) {
createFolder(directory);
createFile(absolute_filename_);
}
void Hdf5Writer::createFolder(std::string directory) {
mkdir(directory.c_str(), 0755);
}
void Hdf5Writer::createFile(std::string absolute_filename) {
if (MpiCommunication::mpi_rank == 0) {
hid_t file = H5Fcreate(absolute_filename.c_str(), H5F_ACC_TRUNC,
H5P_DEFAULT, H5P_DEFAULT);
}
}
void Hdf5Writer::write(const blitz::Array<double, 1>& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
blitz::TinyVector<int, 1> size = data.extent();
int start = 0;
hid_t filespace =
H5Screate_simple(1, blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
hid_t memoryspace =
H5Screate_simple(1, blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
// select a part of the disc space
H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
blitz::TinyVector<hsize_t, 1>(start).data(), NULL,
blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
// select a part of the memory space, in this case all
H5Sselect_hyperslab(
memoryspace, H5S_SELECT_SET,
blitz::TinyVector<hsize_t, 1>(blitz::TinyVector<int, 1>(0)).data(), NULL,
blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Sclose(memoryspace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::Array<double, 2>& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
blitz::TinyVector<int, 2> size = data.extent();
blitz::TinyVector<int, 2> start(0, 0);
hid_t filespace =
H5Screate_simple(2, blitz::TinyVector<hsize_t, 2>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::Array<double, 3>& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
blitz::TinyVector<int, 3> size = data.extent();
blitz::TinyVector<int, 3> start(0, 0, 0);
hid_t filespace =
H5Screate_simple(3, blitz::TinyVector<hsize_t, 3>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::Array<double, 4>& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
blitz::TinyVector<int, 4> size = data.extent();
blitz::TinyVector<int, 4> start(0, 0, 0, 0);
hid_t filespace =
H5Screate_simple(4, blitz::TinyVector<hsize_t, 4>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, filespace, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::Array<long int, 4>& data,
std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
blitz::TinyVector<int, 4> size = data.extent();
blitz::TinyVector<int, 4> start(0, 0, 0, 0);
hid_t filespace =
H5Screate_simple(4, blitz::TinyVector<hsize_t, 4>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_LONG, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::TinyVector<double, 3>& data,
std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
int size = 3;
int start = 0;
hid_t filespace =
H5Screate_simple(1, blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const blitz::TinyVector<int, 3>& data,
std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
int size = 3;
int start = 0;
hid_t filespace =
H5Screate_simple(1, blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_INT, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const std::vector<double>& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
int size = data.size();
int start = 0;
hid_t filespace =
H5Screate_simple(1, blitz::TinyVector<hsize_t, 1>(size).data(), NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data.data());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(int data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
hsize_t scalar = 1;
hid_t filespace = H5Screate_simple(1, &scalar, NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_INT, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(long int data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
hsize_t scalar = 1;
hid_t filespace = H5Screate_simple(1, &scalar, NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_LONG, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(double data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
hsize_t scalar = 1;
hid_t filespace = H5Screate_simple(1, &scalar, NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), H5T_NATIVE_DOUBLE, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
void Hdf5Writer::write(const std::string& data, std::string path) {
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
hsize_t scalar = 1;
hid_t filespace = H5Screate_simple(1, &scalar, NULL);
hid_t lcpl = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(lcpl, 1);
hid_t dtype;
dtype = H5Tcreate(H5T_STRING, data.size());
// turn of error report by hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
hid_t dataset;
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
if (dataset < 0) {
dataset = H5Dcreate2(file, path.c_str(), dtype, filespace, lcpl,
H5P_DEFAULT, H5P_DEFAULT);
}
// turn error report back onby hdf5 because of check H5Dopen2
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
H5Dwrite(dataset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data.c_str());
H5Dclose(dataset);
H5Pclose(lcpl);
H5Sclose(filespace);
H5Fclose(file);
}
+267
View File
@@ -0,0 +1,267 @@
#include "IO/simulation_output.h"
#include "IO/hdf5_writer.h"
#include "generators/species_generator.h"
#include "simulation/current_collector.h"
#include "simulation/density_field.h"
#include "simulation/logger.h"
#include "simulation/mpi_communication.h"
#include "simulation/species.h"
SimulationOutput::SimulationOutput(const std::string& output_folder,
const std::string& output_filename)
: writer(Hdf5Writer(output_folder, output_filename)) {}
void SimulationOutput::addDensityFieldOutput(OutputTask task) {
tasks_density_fields_.push_back(task);
}
void SimulationOutput::addCurrentBorderOutput(OutputTask task) {
tasks_current_collector_.push_back(task);
}
void SimulationOutput::addDeletionLoggerOutput(OutputTask task) {
tasks_deletion_logger_.push_back(task);
}
void SimulationOutput::writeMetaData(
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species) {
if (MpiCommunication::mpi_rank == 0) {
for (auto& pair : species) {
writeMetaData(pair.second.get());
}
for (auto& task : tasks_density_fields_) {
std::string specie_path = "/" + task.specie_name;
writeMetaData(species.at(task.specie_name)->dynamicDensityField(),
specie_path);
}
for (auto& task : tasks_current_collector_) {
std::string specie_path = "/" + task.specie_name;
writeMetaData(species.at(task.specie_name)->currentCollector(),
specie_path);
}
}
}
void SimulationOutput::writeSimulationData(
int cpu_sync,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species) {
if (MpiCommunication::mpi_rank == 0) {
DEBUG_LEVEL_2("Write density field data.");
for (auto& task : tasks_density_fields_) {
if (cpu_sync % task.intervall == 0) {
std::string specie_path = "/" + task.specie_name;
writeSimulationData(species.at(task.specie_name)->dynamicDensityField(),
specie_path, cpu_sync, task.overwrite_last);
}
}
DEBUG_LEVEL_2("Write current collector data.");
for (auto& task : tasks_current_collector_) {
if (cpu_sync % task.intervall == 0) {
std::string specie_path = "/" + task.specie_name;
writeSimulationData(species.at(task.specie_name)->currentCollector(),
specie_path, cpu_sync, task.overwrite_last);
}
}
DEBUG_LEVEL_2("Write deletion logger data.");
for (auto& task : tasks_deletion_logger_) {
if (cpu_sync % task.intervall == 0) {
std::string specie_path = "/" + task.specie_name;
writeSimulationData(species.at(task.specie_name)->deletionLogger(),
specie_path, cpu_sync, task.overwrite_last);
}
}
}
}
void SimulationOutput::writeSimulationData(DynamicDensityField* density_field,
std::string species_path,
int cpu_sync,
bool overwrite_last) {
std::string sync_path = "SyncPeriod_" + std::to_string(cpu_sync);
if (overwrite_last) {
sync_path = "LastSyncPeriod";
}
std::string path = species_path + "/DensityField/SimulationData/" + sync_path;
DEBUG_LEVEL_3("Write spectrum.");
writeSpectrum(density_field, path);
DEBUG_LEVEL_3("Write density.");
writeDensity(density_field, path);
DEBUG_LEVEL_3("Write time in bin.");
writeTimeInBin(density_field, path);
DEBUG_LEVEL_3("Write deleted particles.");
writeDeletedParticles(density_field, path);
DEBUG_LEVEL_3("Write physical time.");
writePhysicalTime(density_field, path);
}
void SimulationOutput::writeSimulationData(CurrentCollector* current_collector,
std::string species_path,
int cpu_sync,
bool overwrite_last) {
std::string sync_path = "SyncPeriod_" + std::to_string(cpu_sync);
if (overwrite_last) {
sync_path = "LastSyncPeriod";
}
std::string path =
species_path + "/CurrentCollector/SimulationData/" + sync_path;
DEBUG_LEVEL_3("Write current crossings.");
writeCurrentCrossings(current_collector, path);
DEBUG_LEVEL_3("Write current.");
writeCurrent(current_collector, path);
DEBUG_LEVEL_3("Write physical time.");
writePhysicalTime(current_collector, path);
}
void SimulationOutput::writeSimulationData(DeletionLogger* logger,
std::string species_path,
int cpu_sync,
bool overwrite_last) {
std::string sync_path = "SyncPeriod_" + std::to_string(cpu_sync);
if (overwrite_last) {
sync_path = "LastSyncPeriod";
}
std::string path = species_path + "/DeletionLogger/" + sync_path;
DEBUG_LEVEL_3("Write number of deletions.");
writeNumDeletions(logger, path);
}
void SimulationOutput::writeNumDeletions(DeletionLogger* logger,
std::string path) {
std::string path_to_deletions = path + "/NumDeletions";
auto deletions = logger->numDeletions();
for (auto& pair : deletions) {
if (pair.first == DeletionType::wall) {
writer.write(pair.second, path_to_deletions + "/Wall");
} else if (pair.first == DeletionType::recombination) {
writer.write(pair.second, path_to_deletions + "/Recombination");
} else if (pair.first == DeletionType::max_interactions) {
writer.write(pair.second, path_to_deletions + "/MaxInteractions");
} else if (pair.first == DeletionType::max_time_alive) {
writer.write(pair.second, path_to_deletions + "/MaxTimeAlive");
}
}
}
void SimulationOutput::writeCurrentCrossings(
CurrentCollector* current_collector,
std::string path) {
writer.write(current_collector->positiveCrossingsInR(),
path + "/PositiveCrossingsInR");
writer.write(current_collector->negativeCrossingsInR(),
path + "/NegativeCrossingsInR");
writer.write(current_collector->positiveCrossingsInPhi(),
path + "/PositiveCrossingsInPhi");
writer.write(current_collector->negativeCrossingsInPhi(),
path + "/NegativeCrossingsInPhi");
writer.write(current_collector->positiveCrossingsInZ(),
path + "/PositiveCrossingsInZ");
writer.write(current_collector->negativeCrossingsInZ(),
path + "/NegativeCrossingsInZ");
}
void SimulationOutput::writeCurrent(CurrentCollector* current_collector,
std::string path) {
writer.write(current_collector->currentInR(), path + "/CurrentInR");
writer.write(current_collector->currentInPhi(), path + "/CurrentInPhi");
writer.write(current_collector->currentInZ(), path + "/CurrentInZ");
}
void SimulationOutput::writePhysicalTime(CurrentCollector* current_collector,
std::string path) {
writer.write(current_collector->physicalTime(), path + "/PhysicalTime");
}
void SimulationOutput::writeSpectrum(DynamicDensityField* density_field,
std::string path) {
writer.write(density_field->spectrumArray(), path + "/Spectrum");
}
void SimulationOutput::writeDensity(DynamicDensityField* density_field,
std::string path) {
writer.write(density_field->densityArray(), path + "/Density");
}
void SimulationOutput::writeTimeInBin(DynamicDensityField* density_field,
std::string path) {
writer.write(density_field->timeInBinArray(), path + "/TimeInBin");
}
void SimulationOutput::writeDeletedParticles(DynamicDensityField* density_field,
std::string path) {
writer.write(density_field->deletedParticlesArray(),
path + "/DeletedParticles");
}
void SimulationOutput::writePhysicalTime(DynamicDensityField* density_field,
std::string path) {
writer.write(density_field->physicalTime(), path + "/PhysicalTime");
}
void SimulationOutput::writeMetaData(species::TrackedSpecie* specie) {
std::string specie_path = "/" + specie->name();
writer.write(specie->mass_kg(), specie_path + "/Mass");
writer.write(specie->charge_C(), specie_path + "/Charge");
}
void SimulationOutput::writeMetaData(DynamicDensityField* density_field,
std::string path) {
std::string path_to_field = path + "/DensityField";
writeBinVolumes(density_field, path_to_field);
writeBinBorders(density_field, path_to_field);
writeNumBins(density_field, path_to_field);
}
void SimulationOutput::writeMetaData(CurrentCollector* current_collector,
std::string path) {
std::string path_to_collector = path + "/CurrentCollector";
writeCollectorAreas(current_collector, path_to_collector);
}
void SimulationOutput::writeCollectorAreas(CurrentCollector* current_collector,
std::string path) {
writer.write(current_collector->areaInR(), path + "/AreaInR");
writer.write(current_collector->areaInPhi(), path + "/AreaInPhi");
writer.write(current_collector->areaInZ(), path + "/AreaInZ");
}
void SimulationOutput::writeBinVolumes(DynamicDensityField* density_field,
std::string path_to_field) {
std::string path_to_volume = path_to_field + "/BinVolumes";
writer.write(density_field->binVolumeArray(), path_to_volume);
}
void SimulationOutput::writeNumBins(DynamicDensityField* density_field,
std::string path_to_field) {
std::string path_to_num_bins = path_to_field + "/NumBins";
blitz::TinyVector<double, 4> num_bins = density_field->spectrumArray().size();
writer.write(num_bins(0), path_to_num_bins + "/energy");
writer.write(num_bins(1), path_to_num_bins + "/radial");
writer.write(num_bins(2), path_to_num_bins + "/azimuthal");
writer.write(num_bins(3), path_to_num_bins + "/longitudinal");
}
void SimulationOutput::writeBinBorders(DynamicDensityField* density_field,
std::string path_to_field) {
std::string path_to_bin_borders = path_to_field + "/BinBorders";
std::vector<double> energy_bin_borders =
density_field->energyBinning()->binBorders();
writer.write(energy_bin_borders, path_to_bin_borders + "/energy");
std::vector<double> radial_bin_borders =
density_field->positionBinning()->radial_binning.binBorders();
writer.write(radial_bin_borders, path_to_bin_borders + "/radial");
std::vector<double> azimuth_bin_borders =
density_field->positionBinning()->azimuth_binning.binBorders();
writer.write(azimuth_bin_borders, path_to_bin_borders + "/azimuth");
std::vector<double> longitudinal_bin_borders =
density_field->positionBinning()->longitudinal_binning.binBorders();
writer.write(longitudinal_bin_borders, path_to_bin_borders + "/longitudinal");
}
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
include $(HOMEBASE)/src/makeinclude/first.mak
-29
View File
@@ -1,29 +0,0 @@
include $(HOMEBASE)/src/makeinclude/include.mak
OFLAGS = $(X_OFLAGS)
CXXFLAGS = $(OFLAGS) $(X_INC)
# Auf Solaris muss blitz mit dem Sun Studio Compiler gebaut werden
# der ist zwar scheisse, funktioniert mit blitz aber. :)
ZIP = unzip
NAME = blitz-master
all:
$(ZIP) ../$(NAME).zip
cd $(NAME) && autoreconf -fiv && autoconf && automake --add-missing
$(NAME)/configure --prefix=$(HOMEBASE)/src/blitz/$(X_OSTYPE)/blitz/ --includedir=$(HOMEBASE)/include/ --libdir=$(HOMEBASE)/lib/$(X_OSTYPE)/
$(MAKE) -C $(NAME) lib
install:
make install
rm -rf $(HOMEBASE)/lib/$(X_OSTYPE)/pkgconfig
clean:
-rm -rf $(HOMEBASE)/include/blitz
-rm -rf $(HOMEBASE)/include/random
-rm -rf $(HOMEBASE)/lib/$(X_OSTYPE)/libblitz.a
-rm -rf $(HOMEBASE)/lib/$(X_OSTYPE)/libblitz.la
$(X_CLEAN)
+72
View File
@@ -0,0 +1,72 @@
#include "functions/functions.h"
#include <map>
#include "simulation/errors.h"
namespace D1ToD1 {
std::function<double(double)> PiecewiseLinear(std::vector<double> positions,
std::vector<double> values) {
if (positions.size() != values.size()) {
ERROR("Values and positions must match in size");
}
std::map<double, double> coordinates;
for (size_t i = 0; i < positions.size(); ++i) {
coordinates[positions[i]] = values[i];
}
return [=](double x) {
const auto lb = coordinates.lower_bound(x);
const auto ub = coordinates.upper_bound(x);
if (lb == coordinates.end()) {
return coordinates.rbegin()->second;
}
if (ub == coordinates.begin()) {
return coordinates.begin()->second;
}
if (lb == coordinates.begin()) {
return (*lb).second;
}
const double x1 = (*lb).first;
const double y1 = (*lb).second;
const double x0 = std::prev(lb)->first;
const double y0 = std::prev(lb)->second;
return ((y1 - y0) * x + x1 * y0 - x0 * y1) / (x1 - x0);
};
}
std::function<double(double)> Constant(double constant) {
return [=](double x) { return constant; };
}
std::function<double(double)> Product(
std::vector<std::function<double(double)>> functions) {
if (functions.size() == 0) {
ERROR("The product needs at least one function");
}
return [=](double x) {
double product = 1.;
for (auto it = functions.begin(); it != functions.end(); ++it) {
product *= (*it)(x);
}
return product;
};
}
}; // namespace D1ToD1
namespace D3ToD1 {
std::function<double(double, double, double)> Constant(double value) {
return [=](double x, double y, double z) { return value; };
}
std::function<double(double, double, double)> Product(
std::function<double(double)> fi,
std::function<double(double)> fj,
std::function<double(double)> fk) {
return [=](double x, double y, double z) { return fi(x) * fj(y) * fk(z); };
}
}; // namespace D3ToD1
+121
View File
@@ -0,0 +1,121 @@
#include "generators/binning_generator.h"
#include <sstream>
#include <string>
#include "simulation/errors.h"
#include "simulation/jansson_additionals.h"
#include "simulation/unit_converter.h"
namespace generator {
CylinderBinning buildPositionBinning(json_t* object) {
if (json_object_by_path(object, {"CylinderBinning"})) {
DEBUG_LEVEL_2("Creating position binning: cylinder binning.");
object = json_object_by_path(object, {"CylinderBinning"});
json_t* radial = json_object_by_path(object, {"Radial"});
int number_of_bins_radial =
json_int(json_object_by_path(radial, {"NumberOfBins"}));
ASSERT_POSITIVE(&number_of_bins_radial, "Number of Bins must be positive");
double max_radius =
json_read_length(json_object_by_path(radial, {"MaxRadius"}), "m");
ASSERT_POSITIVE(&max_radius, "Radius must be positive");
json_t* azimuthal = json_object_by_path(object, {"Azimuthal"});
int number_of_bins_azimuthal =
json_int(json_object_by_path(azimuthal, {"NumberOfBins"}));
ASSERT_POSITIVE(&number_of_bins_azimuthal,
"Number of Bins must be positive");
json_t* longitudinal = json_object_by_path(object, {"Longitudinal"});
int number_of_bins_longitudinal =
json_int(json_object_by_path(longitudinal, {"NumberOfBins"}));
ASSERT_POSITIVE(&number_of_bins_longitudinal,
"Number of Bins must be positive");
double max_length =
json_read_length(json_object_by_path(longitudinal, {"MaxLength"}), "m");
ASSERT_POSITIVE(&max_length, "Radius must be positive");
DEBUG_LEVEL_3("with number of bins radial: " +
std::to_string(number_of_bins_radial));
DEBUG_LEVEL_3("with number of bins azimuthal: " +
std::to_string(number_of_bins_azimuthal));
DEBUG_LEVEL_3("with number of bins longitudinal: " +
std::to_string(number_of_bins_longitudinal));
DEBUG_LEVEL_3("with radius: " + std::to_string(max_radius));
DEBUG_LEVEL_3("with height: " + std::to_string(max_length));
return CylinderBinning(number_of_bins_radial, max_radius,
number_of_bins_azimuthal,
number_of_bins_longitudinal, max_length);
} else {
ERROR("This position binning is not implemented.");
return CylinderBinning(0, 0, 0, 0, 0);
}
}
CylinderBinning buildPositionBinningIncludingRedirection(
Parameter& parameter,
json_path& path_to_binning) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"}))) {
DEBUG_LEVEL_2("Creating position binning: CreateSameAs.");
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"})));
std::stringstream path;
for (auto& p : path_to_same) {
path << p << " ";
}
DEBUG_LEVEL_3("From path: " + path.str());
return buildPositionBinningIncludingRedirection(parameter, path_to_same);
} else {
return buildPositionBinning(parameter.jsonObjectFromBase(path_to_binning));
}
}
EnergyBinning buildEnergyBinning(json_t* object) {
std::string energy_type = json_string(json_object_by_path(object, {"Type"}));
if (energy_type == "Logarithmic") {
DEBUG_LEVEL_2("Creating energy binning: logarithmic.");
int number_of_bins =
json_int(json_object_by_path(object, {"NumberOfBins"}));
ASSERT_POSITIVE(&number_of_bins, "Number of Bins must be positive");
double min_energy =
json_read_energy(json_object_by_path(object, {"MinEnergy"}), "eV");
ASSERT_POSITIVE(&min_energy, "Min Energy must be positive");
double max_energy =
json_read_energy(json_object_by_path(object, {"MaxEnergy"}), "eV");
ASSERT_POSITIVE(&max_energy, "Min Energy must be positive");
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
DEBUG_LEVEL_3("with min energy: " + std::to_string(min_energy));
DEBUG_LEVEL_3("with max energy: " + std::to_string(max_energy));
return EnergyBinning(min_energy, max_energy, number_of_bins);
} else {
ERROR("This energy binning is not implemented.");
return EnergyBinning(0, 0, 0);
}
}
EnergyBinning buildEnergyBinningIncludingRedirection(
Parameter& parameter,
json_path& path_to_binning) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"}))) {
DEBUG_LEVEL_2("Creating energy binning: CreateSameAs.");
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"})));
std::stringstream path;
for (auto& p : path_to_same) {
path << p << " ";
}
DEBUG_LEVEL_3("From path: " + path.str());
return buildEnergyBinningIncludingRedirection(parameter, path_to_same);
} else {
return buildEnergyBinning(parameter.jsonObjectFromBase(path_to_binning));
}
}
}; // namespace generator
+21
View File
@@ -0,0 +1,21 @@
#include "generators/current_collector_generator.h"
#include "generators/binning_generator.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<CurrentCollector> buildCurrentCollector(
Parameter& parameter,
const json_path& path_to_collector,
std::shared_ptr<Timer>& timer) {
DEBUG_LEVEL_2("Creating current collector.");
json_path path_binning =
json_path_append(path_to_collector, {"PositionBinning"});
CylinderBinning position_binning =
buildPositionBinningIncludingRedirection(parameter, path_binning);
return std::make_shared<CurrentCollector>(position_binning, timer);
}
}; // namespace generator
+36
View File
@@ -0,0 +1,36 @@
#include "generators/density_field_generator.h"
#include "generators/binning_generator.h"
#include "generators/scalar_field_generator.h"
#include "simulation/position_binning.h"
#include "simulation/scalar_field.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<ConstantDensityField> buildConstantDensityField(
json_t* object) {
DEBUG_LEVEL_2("Creating constant density field.");
json_path path = {"ScalarField"};
std::shared_ptr<ScalarField> field =
buildScalarField(json_object_by_path(object, path));
return std::shared_ptr<ConstantDensityField>(new ConstantDensityField(field));
}
std::shared_ptr<DynamicDensityField> buildDynamicDensityField(
Parameter& parameter,
const json_path& path_to_field,
std::shared_ptr<Timer>& timer) {
DEBUG_LEVEL_2("Creating dynamic density field.");
json_path path_binning = json_path_append(path_to_field, {"PositionBinning"});
CylinderBinning position_binning =
buildPositionBinningIncludingRedirection(parameter, path_binning);
json_path path_energy_binning =
json_path_append(path_to_field, {"EnergyBinning"});
EnergyBinning energy_binning =
buildEnergyBinningIncludingRedirection(parameter, path_energy_binning);
return std::shared_ptr<DynamicDensityField>(
new DynamicDensityField(position_binning, energy_binning, timer));
}
}; // namespace generator
+26
View File
@@ -0,0 +1,26 @@
#include "generators/drift_velocity_generator.h"
#include "generators/vector_field_generator.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<DriftVelocity> buildDriftVelocity(
Parameter& parameter,
const json_path& path_to_drift_velocity) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_drift_velocity, {"VectorField"}))) {
DEBUG_LEVEL_2("Creating drift velocity: Vector field.");
std::shared_ptr<VectorField> field =
buildVectorField(parameter.jsonObjectFromBase(
json_path_append(path_to_drift_velocity, {"VectorField"})));
return std::shared_ptr<DriftVelocity>(new DriftVelocity(field));
} else if (parameter.jsonObjectFromBase(
json_path_append(path_to_drift_velocity, {"null"}))) {
DEBUG_LEVEL_2("Creating drift velocity: null.");
return nullptr;
} else {
ERROR("No drift velocity given.");
return nullptr;
}
}
}; // namespace generator
+37
View File
@@ -0,0 +1,37 @@
#include "generators/electric_field_generator.h"
#include "generators/vector_field_generator.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<ElectricField> electricField(json_t* object) {
DEBUG_LEVEL_2("Generating electric field.");
std::shared_ptr<VectorField> background;
std::shared_ptr<VectorField> dynamic;
if (json_object_by_path(object, {"Background"})) {
DEBUG_LEVEL_2("Generating background electric field.");
background = buildVectorField(
json_object_by_path(object, {"Background", "VectorField"}));
} else {
ERROR("Can not find background for electric field");
}
if (json_object_by_path(object, {"Dynamic"})) {
DEBUG_LEVEL_2("Generating dynamic electric field.");
dynamic = buildVectorField(
json_object_by_path(object, {"Dynamic", "VectorField"}));
} else {
ERROR("Can not find dynamic for electric field");
}
return std::shared_ptr<ElectricField>(new ElectricField(background, dynamic));
}
std::shared_ptr<ElectricField> electricField(Parameter& parameter) {
return electricField(
json_object_by_path(parameter.jsonFile(), {"ElectricField"}));
}
}; // namespace generator
+36
View File
@@ -0,0 +1,36 @@
#include "generators/energy_distribution_function_generator.h"
#include <string>
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
Parameter& parameter,
const json_path& path_to_function) {
json_t* object = parameter.jsonObjectFromBase(path_to_function);
if (json_object_by_path(object, {"TritiumBetaDecay"})) {
DEBUG_LEVEL_2("Creating energy distribution function: tritium beta decay.");
return std::shared_ptr<EnergyDistributionFunction>(new TritiumBetaDecay());
} else if (json_object_by_path(object, {"MaxwellBoltzmann"})) {
DEBUG_LEVEL_2("Creating energy distribution function: Maxwell Boltzmann.");
double temperature_K = json_double(json_object_by_path(
object, {"MaxwellBoltzmann", "Temperature", "value"}));
DEBUG_LEVEL_3("with temperature: " + std::to_string(temperature_K) + " K");
return std::shared_ptr<EnergyDistributionFunction>(
new MaxwellBoltzmann(temperature_K));
} else if (json_object_by_path(object, {"Constant"})) {
DEBUG_LEVEL_2("Creating energy distribution function: Constant.");
double constant_eV = json_double(
json_object_by_path(object, {"Constant", "constant", "value"}));
DEBUG_LEVEL_3("with constant: " + std::to_string(constant_eV) + " eV");
return std::shared_ptr<EnergyDistributionFunction>(
new Constant(constant_eV));
}
ERROR("This Energy Distribution is not implemented");
return nullptr;
}
}; // namespace generator
+101
View File
@@ -0,0 +1,101 @@
#include "generators/function_generator.h"
#include <string>
#include "IO/hdf5_reader.h"
#include "functions/functions.h"
#include "generators/vector_field_generator.h"
#include "simulation/errors.h"
#include "simulation/jansson_additionals.h"
namespace generator {
std::function<double(double)> function1D(json_t* object) {
if (json_object_by_path(object, {"Constant"})) {
DEBUG_LEVEL_2("Creating function1d: constant.");
double constant =
json_double(json_object_by_path(object, {"Constant", "constant"}));
DEBUG_LEVEL_3("with constant: " + std::to_string(constant));
return D1ToD1::Constant(constant);
} else if (json_object_by_path(object, {"PiecewiseLinear"})) {
DEBUG_LEVEL_2("Creating function1d: PiecewiseLinear.");
std::vector<double> x_values = json_vector(
json_object_by_path(object, {"PiecewiseLinear", {"xValues"}}));
std::vector<double> y_values = json_vector(
json_object_by_path(object, {"PiecewiseLinear", {"yValues"}}));
double prefactor = json_double(
json_object_by_path(object, {"PiecewiseLinear", {"prefactor"}}));
for (int i = 0; i < y_values.size(); ++i) {
y_values[i] = y_values[i] * prefactor;
}
return D1ToD1::PiecewiseLinear(x_values, y_values);
} else if (json_object_by_path(object, {"PiecewiseLinearFromFile"})) {
DEBUG_LEVEL_2("Creating function1d: PiecewiseLinear from file.");
std::string absolute_filename = readAbsoluteFilename(
json_object_by_path(object, {"PiecewiseLinearFromFile", "PathToH5"}));
DEBUG_LEVEL_3("with filename: " + absolute_filename);
Hdf5Reader reader(absolute_filename);
std::string x_values_key = json_string(
json_object_by_path(object, {"PiecewiseLinearFromFile", "xValuesKey"}));
blitz::Array<double, 1> x_values_array = reader.readD1Double(x_values_key);
// DEBUG_LEVEL_3("with x values: " + x_values_array);
std::string y_values_key = json_string(
json_object_by_path(object, {"PiecewiseLinearFromFile", "yValuesKey"}));
blitz::Array<double, 1> y_values_array = reader.readD1Double(y_values_key);
// DEBUG_LEVEL_3("with y values: " + y_values_array);
std::vector<double> x_values(x_values_array.begin(), x_values_array.end());
std::vector<double> y_values(y_values_array.begin(), y_values_array.end());
double prefactor = json_double(json_object_by_path(
object, {"PiecewiseLinearFromFile", {"prefactor"}}));
DEBUG_LEVEL_3("with prefactor: " + std::to_string(prefactor));
for (int i = 0; i < y_values.size(); ++i) {
y_values[i] = y_values[i] * prefactor;
}
return D1ToD1::PiecewiseLinear(x_values, y_values);
} else if (json_object_by_path(object, {"Product"})) {
DEBUG_LEVEL_2("Creating function1d: Product.");
json_t* function_array = json_object_by_path(object, {"Product"});
std::vector<std::function<double(double)>> functions;
size_t index;
json_t* value;
json_array_foreach(function_array, index, value) {
functions.push_back(function1D(value));
}
return D1ToD1::Product(functions);
} else {
ERROR("This 1d to 1d function is not implemented.");
return nullptr;
}
}
std::function<double(double, double, double)> function3D(json_t* object) {
if (json_object_by_path(object, {"Constant3D"})) {
DEBUG_LEVEL_2("Creating function3d: Constant3D.");
double constant =
json_double(json_object_by_path(object, {"Constant3D", "constant"}));
return D3ToD1::Constant(constant);
} else if (json_object_by_path(object, {"Product"})) {
DEBUG_LEVEL_2("Creating function3d: Product.");
std::function<double(double)> fi =
function1D(json_object_by_path(object, {"Product", "fi"}));
std::function<double(double)> fj =
function1D(json_object_by_path(object, {"Product", "fj"}));
std::function<double(double)> fk =
function1D(json_object_by_path(object, {"Product", "fk"}));
return D3ToD1::Product(fi, fj, fk);
} else {
ERROR("This 3d to 1d function is not implemented.");
return nullptr;
}
}
}; // namespace generator
+28
View File
@@ -0,0 +1,28 @@
#include "generators/geometry_generator.h"
#include <string>
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
const json_path& path_to_geometry) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_geometry, {"Cylinder"}))) {
DEBUG_LEVEL_2("Creating geometry: cylinder.");
double radius =
json_read_length(parameter.jsonObjectFromBase(json_path_append(
path_to_geometry, {"Cylinder", "Radius"})),
"m");
double height =
json_read_length(parameter.jsonObjectFromBase(json_path_append(
path_to_geometry, {"Cylinder", "Height"})),
"m");
DEBUG_LEVEL_3("with radius: " + std::to_string(radius) + " m");
DEBUG_LEVEL_3("with height: " + std::to_string(height) + " m");
return std::shared_ptr<Geometry>(new Cylinder(radius, height));
} else {
ERROR("This geometry is not implemented.");
return nullptr;
}
}
}; // namespace generator
+91
View File
@@ -0,0 +1,91 @@
#include "generators/injector_generator.h"
#include "generators/drift_velocity_generator.h"
#include "generators/scalar_field_generator.h"
#include "generators/velocity_distribution_generator.h"
#include "simulation/event_position_distribution.h"
#include "simulation/velocity_distribution.h"
namespace generator {
std::shared_ptr<Injector> buildInjector(
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species,
Parameter& parameter) {
json_path path_to_injector = {"Injector"};
json_t* object = parameter.jsonObjectFromBase(path_to_injector);
// InjectorInfos
std::vector<InjectorInfo> injector_infos;
const char* key;
json_t* value;
json_t* array = json_object_by_path(object, {"CreatedSpecies"});
json_object_foreach(array, key, value) {
std::string specie_name =
json_string(json_object_by_path(value, {"TrackedSpecieName"}));
DEBUG_LEVEL_3("Injected specie: " + specie_name);
InjectorInfo info;
info.created_specie = tracked_species[specie_name];
info.creation_velocity_distribution = buildVelocityDistribution(
parameter,
json_path_append(path_to_injector, {"CreatedSpecies", std::string(key),
"CreationVelocityDistribution"}));
injector_infos.push_back(info);
}
// EventPositionDistribution
DEBUG_LEVEL_2("Creating event distribution");
std::shared_ptr<ScalarField> field = buildScalarField(json_object_by_path(
object, {"EventPositionDistribution", "ScalarField"}));
Limit position_limit_r;
position_limit_r.min = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "rPosition", "min"}));
position_limit_r.max = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "rPosition", "max"}));
Limit position_limit_phi;
position_limit_phi.min = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "phiPosition", "min"}));
position_limit_phi.max = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "phiPosition", "max"}));
Limit position_limit_z;
position_limit_z.min = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "zPosition", "min"}));
position_limit_z.max = json_double(json_object_by_path(
object,
{"EventPositionDistribution", "PositionLimits", "zPosition", "max"}));
Limit density_limit;
density_limit.min = json_double(json_object_by_path(
object, {"EventPositionDistribution", "DensityLimit", "min"}));
density_limit.max = json_double(json_object_by_path(
object, {"EventPositionDistribution", "DensityLimit", "max"}));
std::shared_ptr<EventPositionDistribution> event_distribution(
new EventPositionDistribution(field, density_limit, position_limit_r,
position_limit_phi, position_limit_z));
// MotherDriftVelocity
DEBUG_LEVEL_2("Creating mother drift velocity");
std::shared_ptr<DriftVelocity> drift_velocity = buildDriftVelocity(
parameter, json_path_append(path_to_injector, {"MotherDriftVelocity"}));
// Activity
double activity =
json_double(json_object_by_path(object, {"Activity", "value"}));
return std::shared_ptr<Injector>(new Injector(
injector_infos, activity, event_distribution, drift_velocity));
}
}; // namespace generator
+472
View File
@@ -0,0 +1,472 @@
#include "generators/interaction_generator.h"
#include "constants/ionization_constants.h"
#include "generators/function_generator.h"
#include "generators/vector_field_generator.h"
#include "interactions/charge_exchange.h"
#include "interactions/cluster_formation.h"
#include "interactions/cross_sections.h"
#include "interactions/elastic_scattering.h"
#include "interactions/excitation.h"
#include "interactions/free_movement.h"
#include "interactions/ionization.h"
#include "interactions/recombination.h"
#include "simulation/errors.h"
#include "simulation/homebase.h"
#include "simulation/scattering_angle_distribution.h"
#include "simulation/species.h"
namespace generator {
void addInteractions(
std::shared_ptr<species::TrackedSpecie> specie,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species,
Parameter& parameter,
json_path& path_to_interactions) {
const char* key;
json_t* value;
json_t* array = parameter.jsonObjectFromBase(path_to_interactions);
json_object_foreach(array, key, value) {
std::string type = json_string(json_object_by_path(value, {"Type"}));
if (type == "ElasticScattering") {
DEBUG_LEVEL_2("Adding interactions: ElasticScattering");
std::function<double(double)> cross_section =
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
std::shared_ptr<ScatteringAngleDistribution>
scattering_angle_distribution = buildScatteringAngleDistribution(
json_object_by_path(value, {"ScatteringAngleDistribution"}));
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
DEBUG_LEVEL_3("with target" + target_name);
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ElasticScattering(cross_section, target,
scattering_angle_distribution)));
} else if (type == "FreeMovement") {
DEBUG_LEVEL_2("Adding interactions: FreeMovement");
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::FreeMovement()));
} else if (type == "ElectronIonization") {
DEBUG_LEVEL_2("Adding interactions: Ionization");
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
std::string outgoing_electron_name =
json_string(json_object_by_path(value, {"OutgoingElectron"}));
std::shared_ptr<species::TrackedSpecie> electron =
findTracked(outgoing_electron_name, tracked_species);
std::string outgoing_ion_name =
json_string(json_object_by_path(value, {"OutgoingIon"}));
std::shared_ptr<species::TrackedSpecie> ion =
findTracked(outgoing_ion_name, tracked_species);
std::string ionization_model =
json_string(json_object_by_path(value, {"IonizationModel"}));
if (ionization_model == "JanevNonDiss") {
std::function<double(double)> cross_section =
interaction::totalCrossSection::eT2_ionization_janev_non_diss();
const double ionization_energy_eV =
ionization::ionization_energy_janev_non_diss;
auto ionization_energy_distribution =
std::make_shared<interaction::IonizationEnergyDistribution>(
interaction::d2CrossSection::eT2_ionization_bed(),
ionization_energy_eV);
auto scattering_angle_distribution = std::make_shared<
interaction::IonizationScatteringAngleDistribution>();
if (electron->type() != species::ImplementedSpecies::electron) {
ERROR(
"The JanevNonDiss needs electron species as outgoing electrons.");
}
if (ion->type() != species::ImplementedSpecies::T2plus) {
std::cout << ion->name() << std::endl;
ERROR("The JanevNonDiss needs T2+ species as outgoing ions.");
}
specie->addInteraction(
std::make_shared<interaction::ElectronIonization>(
cross_section, target, electron, ion,
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else if (ionization_model == "JanevDissToGround") {
std::function<double(double)> cross_section =
interaction::totalCrossSection::eT2_ionization_janev_diss_ground();
const double ionization_energy_eV =
ionization::ionization_energy_janev_diss_ground;
auto ionization_energy_distribution =
std::make_shared<interaction::IonizationEnergyDistribution>(
interaction::d2CrossSection::eT2_ionization_bed(),
ionization_energy_eV);
auto scattering_angle_distribution = std::make_shared<
interaction::IonizationScatteringAngleDistribution>();
if (electron->type() != species::ImplementedSpecies::electron) {
ERROR(
"The JanevDissToGround needs electron species as outgoing "
"electrons.");
}
if (ion->type() != species::ImplementedSpecies::Tplus) {
ERROR("The JanevDissToGround needs T+ species as outgoing ions.");
}
specie->addInteraction(
std::make_shared<interaction::ElectronIonization>(
cross_section, target, electron, ion,
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else if (ionization_model == "JanevDissToFirstExcited") {
std::function<double(double)> cross_section =
interaction::totalCrossSection::eT2_ionization_janev_diss_first();
const double ionization_energy_eV =
ionization::ionization_energy_janev_diss_first;
auto ionization_energy_distribution =
std::make_shared<interaction::IonizationEnergyDistribution>(
interaction::d2CrossSection::eT2_ionization_bed(),
ionization_energy_eV);
auto scattering_angle_distribution = std::make_shared<
interaction::IonizationScatteringAngleDistribution>();
if (electron->type() != species::ImplementedSpecies::electron) {
ERROR(
"The JanevDissToFirstExcited needs electron species as outgoing "
"electrons.");
}
if (ion->type() != species::ImplementedSpecies::Tplus) {
ERROR(
"The JanevDissToFirstExcited needs T+ species as outgoing "
"ions.");
}
specie->addInteraction(
std::make_shared<interaction::ElectronIonization>(
cross_section, target, electron, ion,
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else {
ERROR("This ionization model is not implemented.");
}
} else if (type == "Excitation") {
DEBUG_LEVEL_2("Adding interactions: Excitation");
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
std::string excitation_state =
json_string(json_object_by_path(value, {"ExcitationState"}));
std::function<double(double)> cross_section =
buildExcitationCrossSection(excitation_state);
double excitation_energy = buildExcitationEnergy(excitation_state);
specie->addInteraction(
std::shared_ptr<interaction::Interaction>(new interaction::Excitation(
cross_section, target, excitation_energy)));
} else if (type == "Clustering") {
DEBUG_LEVEL_2("Adding interactions: Clustering");
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
std::string product_name =
json_string(json_object_by_path(value, {"Product"}));
std::shared_ptr<species::TrackedSpecie> product =
findTracked(product_name, tracked_species);
std::function<double(double)> cross_section =
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ClusterFormation(cross_section, target, product)));
} else if (type == "ChargeExchange") {
DEBUG_LEVEL_2("Adding interactions: ChargeExchange");
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
std::function<double(double)> cross_section =
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ChargeExchange(cross_section, target)));
} else if (type == "Recombination") {
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::TrackedSpecie> target =
findTracked(target_name, tracked_species);
std::function<double(double)> cross_section =
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::Recombination(cross_section, target)));
}
else {
ERROR("This interaction type is not implemented: " + type);
}
}
}
std::function<double(double)> buildTotalCrossSection(json_t* object) {
if (json_object_by_path(object, {"PredefinedFunction"})) {
std::string function_name =
json_string(json_object_by_path(object, {"PredefinedFunction"}));
if (function_name == "eT2_elastic_scattering_constant") {
return interaction::totalCrossSection::eT2_elastic_scattering_constant();
} else if (function_name == "eT2_elastic_scattering") {
return interaction::totalCrossSection::eT2_elastic_scattering();
} else if (function_name == "eT2_elastic_scattering") {
return interaction::totalCrossSection::eT2_elastic_scattering();
} else if (function_name == "TpT2_elasitc_scattering_tabata") {
return interaction::totalCrossSection::TpT2_elasitc_scattering_tabata();
} else if (function_name == "T3pT2_elasitc_scattering_tabata") {
return interaction::totalCrossSection::T3pT2_elasitc_scattering_tabata();
} else if (function_name == "eT2_ionization_janev_diss_ground") {
return interaction::totalCrossSection::eT2_ionization_janev_diss_ground();
} else if (function_name == "eT2_ionization_janev_diss_first") {
return interaction::totalCrossSection::eT2_ionization_janev_diss_first();
} else if (function_name == "TpT2_clustering_radiative_ascendion_pasil") {
return interaction::totalCrossSection::
TpT2_clustering_radiative_ascendion_pasil();
} else if (function_name == "TpT2_clustering_tertiary_ascendion_pasil") {
return interaction::totalCrossSection::
TpT2_clustering_tertiary_ascendion_pasil();
} else if (function_name == "T2pT2_clustering_janev") {
return interaction::totalCrossSection::T2pT2_clustering_janev();
} else if (function_name == "T2pT2_charge_exchange_janev") {
return interaction::totalCrossSection::T2pT2_charge_exchange_janev();
} else if (function_name == "eT2p_recombination_janev") {
return interaction::totalCrossSection::eT2p_recombination_janev();
} else if (function_name == "eT3p_recombination_janev") {
return interaction::totalCrossSection::eT3p_recombination_janev();
}
else {
ERROR("This predefined function does not exist: " + function_name);
return nullptr;
}
} else if (json_object_by_path(object, {"1dFunction"})) {
return function1D(json_object_by_path(object, {"1dFunction"}));
} else if (json_object_by_path(object, {"ExcitationFunction"})) {
std::string excitation_state = json_string(
json_object_by_path(object, {"ExcitationFunction", "ExcitationState"}));
return buildExcitationCrossSection(excitation_state);
} else {
ERROR("This type of cross section is not implemented");
return nullptr;
}
}
double buildExcitationEnergy(std::string excitation_state) {
if (excitation_state == "janev_singlet_B1") {
return 12.754;
} else if (excitation_state == "janev_singlet_B1prime") {
return 14.85;
} else if (excitation_state == "janev_singlet_B1primeprime") {
return 15.47;
} else if (excitation_state == "janev_singlet_C1") {
return 13.29;
} else if (excitation_state == "janev_singlet_D1") {
return 14.996;
} else if (excitation_state == "janev_singlet_D1prime") {
return 15.555;
} else if (excitation_state == "janev_singlet_symmetry_forbidden_EF1") {
return 13.13;
} else if (excitation_state == "janev_singlet_symmetry_forbidden_HHb") {
return 14.98;
} else if (excitation_state == "janev_singlet_symmetry_forbidden_GK1") {
return 14.816;
} else if (excitation_state == "janev_singlet_symmetry_forbidden_I1") {
return 14.824;
} else if (excitation_state == "janev_triplet_A3") {
return 11.71;
} else if (excitation_state == "janev_triplet_B3") {
return 7.93;
} else if (excitation_state == "janev_triplet_C3") {
return 11.71;
} else if (excitation_state == "janev_triplet_E3") {
return 13.0;
} else if (excitation_state == "janev_triplet_D3") {
return 13.6;
} else if (excitation_state == "janev_vibrational_first") {
return 0.516;
} else if (excitation_state == "janev_vibrational_second") {
return 1.003;
} else if (excitation_state == "england_rotational_j0_to_j2") {
return 0.0439;
} else if (excitation_state == "england_rotational_j1_to_j3") {
return 0.0727;
} else {
ERROR(
"This type of cross section ExcitationState is not implemented in "
"buildExcitationEnergy.");
return 0.;
}
}
std::function<double(double)> buildExcitationCrossSection(
std::string excitation_state) {
if (excitation_state == "janev_singlet_B1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("B1");
} else if (excitation_state == "janev_singlet_B1prime") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("B1prime");
} else if (excitation_state == "janev_singlet_B1primeprime") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("B1primeprime");
} else if (excitation_state == "janev_singlet_C1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("C1");
} else if (excitation_state == "janev_singlet_D1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("D1");
} else if (excitation_state == "janev_singlet_D1prime") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state("D1prime");
} else if (excitation_state == "janev_singlet_symmetry_forbidden_EF1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
"EF1");
} else if (excitation_state == "janev_singlet_symmetry_forbidden_HHb") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
"HHb");
} else if (excitation_state == "janev_singlet_symmetry_forbidden_GK1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
"GK1");
} else if (excitation_state == "janev_singlet_symmetry_forbidden_I1") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
"I1");
} else if (excitation_state == "janev_triplet_A3") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_triplet_ground_state("A3");
} else if (excitation_state == "janev_triplet_B3") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_triplet_ground_state("B3");
} else if (excitation_state == "janev_triplet_C3") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_triplet_ground_state("C3");
} else if (excitation_state == "janev_triplet_E3") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_triplet_ground_state("E3");
} else if (excitation_state == "janev_triplet_D3") {
return interaction::totalCrossSection::
eT2_excitation_electric_janev_from_triplet_ground_state("D3");
} else if (excitation_state == "janev_vibrational_first") {
return interaction::totalCrossSection::
eT2_excitation_vibrational_janev_first();
} else if (excitation_state == "janev_vibrational_second") {
return interaction::totalCrossSection::
eT2_excitation_vibrational_janev_second();
} else if (excitation_state == "england_rotational_j0_to_j2") {
return interaction::totalCrossSection::
eT2_excitation_rotational_j0_to_j2_england();
} else if (excitation_state == "england_rotational_j1_to_j3") {
return interaction::totalCrossSection::
eT2_excitation_rotational_j1_to_j3_england();
} else {
ERROR(
"This type of cross section ExcitationState is not implemented in "
"buildExcitationCrossSection.");
return nullptr;
}
}
std::function<double(double, double)> build2DCrossSection(json_t* object) {
if (json_object_by_path(object, {"PredefinedFunction"})) {
std::string function_name =
json_string(json_object_by_path(object, {"PredefinedFunction"}));
if (function_name == "eT2_ionization_bed") {
return interaction::d2CrossSection::eT2_ionization_bed();
} else {
ERROR("This predefined function does not exist");
return nullptr;
}
} else {
ERROR("This type of cross section is not implemented.");
return nullptr;
}
}
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
json_t* object) {
if (json_object_by_path(object, {"Isotropic"})) {
DEBUG_LEVEL_2("Adding ScatteringAngleDistribution: Isotropic");
return std::shared_ptr<ScatteringAngleDistribution>(
new IsotropicAngleDistribution());
} else if (json_object_by_path(object, {"AngleDistributionFromFile"})) {
DEBUG_LEVEL_2(
"Adding ScatteringAngleDistribution: AngleDistributionFromFile");
std::string absolute_filepath = readAbsoluteFilename(
json_object_by_path(object, {"AngleDistributionFromFile", "PathToH5"}));
return std::make_shared<AngleDistributionFromFile>(absolute_filepath);
} else if (json_object_by_path(object, {"CompositeAngleDistribution"})) {
DEBUG_LEVEL_2(
"Adding ScatteringAngleDistribution: CompositeAngleDistribution");
json_t* object_composite =
json_object_by_path(object, {"CompositeAngleDistribution"});
const double decider_energy = json_read_energy(
json_object_by_path(object_composite, {"DeciderEnergy"}));
std::shared_ptr<ScatteringAngleDistribution> lower_distribution =
buildScatteringAngleDistribution(
json_object_by_path(object_composite, {"LowerDistribution"}));
std::shared_ptr<ScatteringAngleDistribution> higher_distribution =
buildScatteringAngleDistribution(
json_object_by_path(object_composite, {"HigherDistribution"}));
return std::make_shared<CompositeAngleDistribution>(
lower_distribution, higher_distribution, decider_energy);
} else {
ERROR("This scattering angle distribution is not implemented.");
return nullptr;
}
}
std::shared_ptr<species::Specie> findTarget(
std::string& target_name,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species) {
if (background_species.count(target_name)) {
return background_species.at(target_name);
} else if (tracked_species.count(target_name)) {
return tracked_species.at(target_name);
} else {
ERROR("The specified target does not exist.");
return nullptr;
}
};
std::shared_ptr<species::TrackedSpecie> findTracked(
std::string& target_name,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species) {
if (tracked_species.count(target_name)) {
return tracked_species.at(target_name);
} else {
ERROR("The specified target does not exist.");
return nullptr;
}
}
}; // namespace generator
+51
View File
@@ -0,0 +1,51 @@
#include "generators/logger_generator.h"
#include "simulation/errors.h"
#include "simulation/logger.h"
namespace generator {
std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object) {
std::vector<DeletionType> used_types;
json_t* type = json_object_by_path(object, {"Type"});
if (json_is_array(type)) {
size_t index;
json_t* value;
json_array_foreach(type, index, value) {
std::string type_alias = json_string(value);
if (type_alias == "wall") {
used_types.push_back(DeletionType::wall);
} else if (type_alias == "recombination") {
used_types.push_back(DeletionType::recombination);
} else if (type_alias == "max_interactions") {
used_types.push_back(DeletionType::max_interactions);
} else if (type_alias == "max_time_alive") {
used_types.push_back(DeletionType::max_time_alive);
} else {
ERROR("This deletion type is not known");
}
}
} else {
if (json_string(type) == "all") {
used_types.push_back(DeletionType::wall);
used_types.push_back(DeletionType::recombination);
used_types.push_back(DeletionType::max_interactions);
used_types.push_back(DeletionType::max_time_alive);
}
}
return std::make_shared<DeletionLogger>(used_types);
}
std::shared_ptr<DeletionLogger> buildDeletionLogger(
Parameter& parameter,
const json_path& path_to_loggers) {
DEBUG_LEVEL_2("Creating deletion logger.");
json_path path_logger = json_path_append(path_to_loggers, {"Deletion"});
json_t* object = parameter.jsonObjectFromBase(path_logger);
return buildDeletionLogger(object);
}
} // namespace generator
+18
View File
@@ -0,0 +1,18 @@
#include "generators/magnetic_field_generator.h"
#include "generators/vector_field_generator.h"
namespace generator {
std::shared_ptr<MagneticField> magneticField(json_t* object) {
DEBUG_LEVEL_2("Generating magnetic field.");
return std::shared_ptr<MagneticField>(new MagneticField(
buildVectorField(json_object_by_path(object, {"VectorField"}))));
}
std::shared_ptr<MagneticField> magneticField(Parameter& parameter) {
return magneticField(
json_object_by_path(parameter.jsonFile(), {"MagneticField"}));
}
}; // namespace generator
+40
View File
@@ -0,0 +1,40 @@
#include "generators/mass_generator.h"
#include "constants/physical_constants.h"
#include "generators/species_generator.h"
#include "simulation/errors.h"
#include "simulation/jansson_additionals.h"
#include "simulation/species.h"
namespace generator {
std::map<species::ImplementedSpecies, double> SpeciesMasses::mass_ = {
{species::ImplementedSpecies::electron, SI::me},
{species::ImplementedSpecies::T2, 6 * SI::mp + 2 * SI::me},
{species::ImplementedSpecies::Tplus, 3 * SI::mp},
{species::ImplementedSpecies::T2plus, 6 * SI::mp + SI::me},
{species::ImplementedSpecies::T3plus, 9 * SI::mp + 2 * SI::me}};
double SpeciesMasses::mass(const species::ImplementedSpecies& species) {
return mass_.at(species);
}
double buildMass(json_t* object) {
if (json_object_by_path(object, {"FromParticleType"})) {
std::string name =
json_string(json_object_by_path(object, {"FromParticleType"}));
if (SpeciesAlias::isAlias(name)) {
return SpeciesMasses::mass(SpeciesAlias::alias(name));
} else {
ERROR("This specie type is not known.");
return 0.;
}
} else if (json_object_by_path(object, {"value"})) {
return json_double(json_object_by_path(object, {"value"}));
} else {
ERROR("The mass is not given correcty.");
return 0.;
}
}
}; // namespace generator
+27
View File
@@ -0,0 +1,27 @@
#include "generators/mover_generator.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<Mover> buildMover(Parameter& parameter,
const json_path& path_to_mover) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_mover, {"Boris"}))) {
DEBUG_LEVEL_2("Creating mover: Boris.");
double max_timestep_length = parameter.doubleValue(json_path_append(
path_to_mover, {"Boris", "MaximalTimestepLength", "value"}));
return std::shared_ptr<Mover>(new BorisMover(max_timestep_length));
} else if (parameter.jsonObjectFromBase(
json_path_append(path_to_mover, {"Drift"}))) {
DEBUG_LEVEL_2("Creating mover: Drift.");
double maximal_moved_distance =
json_read_length(parameter.jsonObjectFromBase(json_path_append(
path_to_mover, {"Drift", "MaximalMovedDistance"})));
return std::make_shared<DriftMover>(maximal_moved_distance);
} else {
ERROR("This mover is not implemented");
return nullptr;
}
}
}; // namespace generator
+23
View File
@@ -0,0 +1,23 @@
#include "generators/random_numbers_generator.h"
#include "simulation/errors.h"
#include "simulation/jansson_additionals.h"
#include "simulation/mpi_communication.h"
namespace generator {
std::shared_ptr<RandomNumbers> buildRandomNumbers(Parameter& parameter) {
if (parameter.jsonObjectFromBase({"RandomNumbers"})) {
int seed =
json_int(parameter.jsonObjectFromBase({"RandomNumbers", "Seed"}));
int local_seed = seed + MpiCommunication::mpi_rank;
return std::shared_ptr<RandomNumbers>(new RandomNumbers(local_seed));
} else {
ERROR("No information given for random numbers.");
return nullptr;
}
}
}; // namespace generator
+27
View File
@@ -0,0 +1,27 @@
#include "generators/reflector_generator.h"
#include "simulation/errors.h"
namespace generator {
std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
const json_path& path_to_reflector) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_reflector, {"ReflectorDPS"}))) {
DEBUG_LEVEL_2("Create reflector: ReflectorDPS");
double position_z = json_read_length(
parameter.jsonObjectFromBase(json_path_append(
path_to_reflector, {"ReflectorDPS", "position_z"})),
"m");
return std::shared_ptr<Reflector>(new ReflectorDPS(position_z));
} else if (parameter.jsonObjectFromBase(
json_path_append(path_to_reflector, {"NoReflector"}))) {
DEBUG_LEVEL_2("Create reflector: NoReflector");
return std::shared_ptr<Reflector>(new NoReflector());
} else {
ERROR("This reflector is not implemented");
return nullptr;
}
}
}; // namespace generator
+20
View File
@@ -0,0 +1,20 @@
#include "generators/scalar_field_generator.h"
#include "functions/functions.h"
#include "generators/function_generator.h"
#include "simulation/errors.h"
#include "simulation/jansson_additionals.h"
namespace generator {
std::shared_ptr<ScalarField> buildScalarField(json_t* object) {
if (json_object_by_path(object, {"ScalarFieldFunctionInZ"})) {
std::function<double(double, double, double)> z_function = function3D(
json_object_by_path(object, {"ScalarFieldFunctionInZ", "zFunction"}));
return std::shared_ptr<ScalarField>(new ScalarFieldFunctionInZ(z_function));
} else {
ERROR("This scalar field is not implemented");
return nullptr;
}
return nullptr;
}
}; // namespace generator
+135
View File
@@ -0,0 +1,135 @@
#include "generators/simulation_output_generator.h"
#include "IO/simulation_output.h"
#include "simulation/jansson_additionals.h"
#include "simulation/species.h"
namespace generator {
std::shared_ptr<SimulationOutput> buildSimulationOutput(
json_t* object,
const std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species) {
std::string output_folder =
json_string(json_object_by_path(object, {"folder"}));
std::string filename = json_string(json_object_by_path(object, {"filename"}));
auto output = std::make_shared<SimulationOutput>(output_folder, filename);
// DensityFields
{
int intervall =
json_int(json_object_by_path(object, {"DensityFields", "Intervall"}));
if (intervall == 0 &&
json_string(json_object_by_path(
object, {"DensityFields", "Intervall"})) == "EachSync") {
intervall = 1;
}
ASSERT_POSITIVE(&intervall,
"The intervall for density field output must be positive");
bool overwrite_last = json_bool(
json_object_by_path(object, {"DensityFields", "OverwriteLast"}));
json_t* species = json_object_by_path(object, {"DensityFields", "Species"});
if (json_is_array(species)) {
size_t index;
json_t* value;
json_array_foreach(species, index, value) {
std::string specie_alias = json_string(value);
OutputTask task = {specie_alias, overwrite_last, intervall};
output->addDensityFieldOutput(task);
}
} else {
std::string all = json_string(species);
if (all == "all") {
for (const auto& pairs : tracked_species) {
OutputTask task = {pairs.first, overwrite_last, intervall};
output->addDensityFieldOutput(task);
}
} else {
ERROR("This species can not be outputted.");
}
}
}
// CurrentBorders
{
int intervall =
json_int(json_object_by_path(object, {"CurrentBorders", "Intervall"}));
if (intervall == 0 &&
json_string(json_object_by_path(
object, {"CurrentBorders", "Intervall"})) == "EachSync") {
intervall = 1;
}
ASSERT_POSITIVE(&intervall,
"The intervall for current border output must be positive");
bool overwrite_last = json_bool(
json_object_by_path(object, {"CurrentBorders", "OverwriteLast"}));
json_t* species =
json_object_by_path(object, {"CurrentBorders", "Species"});
if (json_is_array(species)) {
size_t index;
json_t* value;
json_array_foreach(species, index, value) {
std::string specie_alias = json_string(value);
OutputTask task = {specie_alias, overwrite_last, intervall};
output->addCurrentBorderOutput(task);
}
} else {
std::string all = json_string(species);
if (all == "all") {
for (const auto& pairs : tracked_species) {
OutputTask task = {pairs.first, overwrite_last, intervall};
output->addCurrentBorderOutput(task);
}
} else {
ERROR("This species can not be outputted.");
}
}
}
// DeletionLogger
{
int intervall =
json_int(json_object_by_path(object, {"DeletionLogger", "Intervall"}));
if (intervall == 0 &&
json_string(json_object_by_path(
object, {"DeletionLogger", "Intervall"})) == "EachSync") {
intervall = 1;
}
ASSERT_POSITIVE(
&intervall,
"The intervall for deletion logger output must be positive");
bool overwrite_last = json_bool(
json_object_by_path(object, {"DeletionLogger", "OverwriteLast"}));
json_t* species =
json_object_by_path(object, {"DeletionLogger", "Species"});
if (json_is_array(species)) {
size_t index;
json_t* value;
json_array_foreach(species, index, value) {
std::string specie_alias = json_string(value);
OutputTask task = {specie_alias, overwrite_last, intervall};
output->addDeletionLoggerOutput(task);
}
} else {
std::string all = json_string(species);
if (all == "all") {
for (const auto& pairs : tracked_species) {
OutputTask task = {pairs.first, overwrite_last, intervall};
output->addDeletionLoggerOutput(task);
}
} else {
ERROR("This species can not be outputted.");
}
}
}
return output;
}
}; // namespace generator
+310
View File
@@ -0,0 +1,310 @@
#include "generators/species_generator.h"
#include "constants/physical_constants.h"
#include "generators/current_collector_generator.h"
#include "generators/density_field_generator.h"
#include "generators/drift_velocity_generator.h"
#include "generators/logger_generator.h"
#include "generators/mass_generator.h"
#include "generators/mover_generator.h"
#include "generators/reflector_generator.h"
#include "generators/terminator_generator.h"
#include "generators/velocity_distribution_generator.h"
#include "simulation/errors.h"
#include "simulation/timer.h"
namespace generator {
std::map<std::string, species::ImplementedSpecies>
SpeciesAlias::specie_aliases = {
{"electron", species::ImplementedSpecies::electron},
{"T2+", species::ImplementedSpecies::T2plus},
{"T3+", species::ImplementedSpecies::T3plus},
{"T+", species::ImplementedSpecies::Tplus},
{"T2", species::ImplementedSpecies::T2}};
species::ImplementedSpecies SpeciesAlias::alias(const std::string& name) {
if (isAlias(name)) {
return specie_aliases.at(name);
} else {
ERROR("This specie has no alias." + name);
return specie_aliases.at(name);
}
}
std::string SpeciesAlias::name(species::ImplementedSpecies specie) {
for (auto& pair : specie_aliases) {
if (pair.second == specie) {
return pair.first;
}
}
return std::string("");
}
bool SpeciesAlias::isAlias(const std::string& name) {
return static_cast<bool>(specie_aliases.count(name));
}
std::map<species::ImplementedSpecies, double> SpeciesCharges::charge_ = {
{species::ImplementedSpecies::electron, -SI::e},
{species::ImplementedSpecies::T2, 0.},
{species::ImplementedSpecies::Tplus, SI::e},
{species::ImplementedSpecies::T2plus, SI::e},
{species::ImplementedSpecies::T3plus, SI::e}};
double SpeciesCharges::charge(species::ImplementedSpecies species) {
return charge_.at(species);
}
SpeciesBuilder::SpeciesBuilder(Parameter& parameter) {
initTimer();
initBackgroundSpecies(parameter);
initTrackedSpecies(parameter);
fillBackgroundSpecieType(parameter);
fillTrackedSpecieType(parameter);
// same for all
fillMass();
fillCharge();
fillVelocityDistribution(parameter);
fillDriftVelocity(parameter);
// only background
fillBackgroundDensity(parameter);
// only trackable
fillMover(parameter);
fillTerminator(parameter);
fillReflector(parameter);
fillTrackedDensity(parameter);
buildSpecies();
fillInteractions(parameter);
fillCurrentCollector(parameter);
fillLoggers(parameter);
};
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
SpeciesBuilder::trackedSpecies() {
return tracked_species;
}
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
SpeciesBuilder::backgroundSpecies() {
return background_species;
}
std::shared_ptr<Timer> SpeciesBuilder::timer() {
return timer_;
}
void SpeciesBuilder::initTimer() {
DEBUG_LEVEL_2("Init timer.");
timer_ = std::shared_ptr<Timer>(new Timer());
}
void SpeciesBuilder::initBackgroundSpecies(Parameter& parameter) {
DEBUG_LEVEL_2("Init background species info.");
const char* key;
json_t* value;
json_object_foreach(parameter.jsonObjectFromBase({"Species", "Background"}),
key, value) {
background_species_info[std::string(key)] = BackgroundSpeciesBuilderInfo();
background_species_info[std::string(key)].name = std::string(key);
background_species_info[std::string(key)].path_in_json = {
"Species", "Background", std::string(key)};
}
}
void SpeciesBuilder::initTrackedSpecies(Parameter& parameter) {
DEBUG_LEVEL_2("Init tracked species info.");
const char* key;
json_t* value;
json_object_foreach(parameter.jsonObjectFromBase({"Species", "Tracked"}), key,
value) {
tracked_species_info[std::string(key)] = TrackedSpeciesBuilderInfo();
tracked_species_info[std::string(key)].name = std::string(key);
tracked_species_info[std::string(key)].path_in_json = {"Species", "Tracked",
std::string(key)};
}
}
void SpeciesBuilder::fillBackgroundSpecieType(Parameter& parameter) {
DEBUG_LEVEL_2("Fill background species type.");
for (auto& b : background_species_info) {
std::string type = json_string(parameter.jsonObjectFromBase(
json_path_append(b.second.path_in_json, {"ParticleType"})));
DEBUG_LEVEL_3("Type: " + type);
if (SpeciesAlias::isAlias(type)) {
b.second.type = SpeciesAlias::alias(type);
} else {
ERROR("This specie type is not implemented: " + type);
}
}
}
void SpeciesBuilder::fillTrackedSpecieType(Parameter& parameter) {
DEBUG_LEVEL_2("Fill tracked species type.");
for (auto& b : tracked_species_info) {
std::string type = json_string(parameter.jsonObjectFromBase(
json_path_append(b.second.path_in_json, {"ParticleType"})));
DEBUG_LEVEL_3("Type: " + type);
if (SpeciesAlias::isAlias(type)) {
b.second.type = SpeciesAlias::alias(type);
} else {
ERROR("This specie type is not implemented: " + type);
}
}
}
void SpeciesBuilder::fillBackgroundDensity(Parameter& parameter) {
DEBUG_LEVEL_2("Fill background density.");
for (auto& b : background_species_info) {
b.second.density = buildConstantDensityField(parameter.jsonObjectFromBase(
json_path_append(b.second.path_in_json, {"ConstantDensityField"})));
}
}
void SpeciesBuilder::fillVelocityDistribution(Parameter& parameter) {
DEBUG_LEVEL_2("Fill velocity distributions.");
for (auto& b : background_species_info) {
b.second.velocity_distribution = buildVelocityDistribution(
parameter,
json_path_append(b.second.path_in_json, {"VelocityDistribution"}));
}
for (auto& b : tracked_species_info) {
b.second.velocity_distribution = buildVelocityDistribution(
parameter,
json_path_append(b.second.path_in_json, {"VelocityDistribution"}));
}
}
void SpeciesBuilder::fillDriftVelocity(Parameter& parameter) {
DEBUG_LEVEL_2("Fill drift velocity.");
for (auto& b : background_species_info) {
b.second.drift_velocity = buildDriftVelocity(
parameter, json_path_append(b.second.path_in_json, {"DriftVelocity"}));
}
for (auto& b : tracked_species_info) {
b.second.drift_velocity = buildDriftVelocity(
parameter, json_path_append(b.second.path_in_json, {"DriftVelocity"}));
}
}
void SpeciesBuilder::fillMass() {
DEBUG_LEVEL_2("Fill masses.");
for (auto& b : background_species_info) {
b.second.mass_kg = SpeciesMasses::mass(b.second.type);
}
for (auto& b : tracked_species_info) {
b.second.mass_kg = SpeciesMasses::mass(b.second.type);
}
}
void SpeciesBuilder::fillCharge() {
DEBUG_LEVEL_2("Fill charges");
for (auto& b : background_species_info) {
b.second.charge_C = SpeciesCharges::charge(b.second.type);
}
for (auto& b : tracked_species_info) {
b.second.charge_C = SpeciesCharges::charge(b.second.type);
}
}
void SpeciesBuilder::fillMover(Parameter& parameter) {
DEBUG_LEVEL_2("Fill movers.");
for (auto& b : tracked_species_info) {
if ((b.second.mover == nullptr)) {
b.second.mover = buildMover(
parameter, json_path_append(b.second.path_in_json, {"Mover"}));
}
}
}
void SpeciesBuilder::fillTerminator(Parameter& parameter) {
DEBUG_LEVEL_2("Fill terminators.");
for (auto& b : tracked_species_info) {
if ((b.second.terminator == nullptr)) {
b.second.terminator = buildTerminator(
parameter, json_path_append(b.second.path_in_json, {"Terminator"}));
}
}
}
void SpeciesBuilder::fillReflector(Parameter& parameter) {
DEBUG_LEVEL_2("Fill reflectors.");
for (auto& b : tracked_species_info) {
if ((b.second.reflector == nullptr)) {
b.second.reflector = buildReflector(
parameter, json_path_append(b.second.path_in_json, {"Reflector"}));
}
}
}
void SpeciesBuilder::fillTrackedDensity(Parameter& parameter) {
DEBUG_LEVEL_2("Fill tracked density.");
for (auto& b : tracked_species_info) {
b.second.density_field = buildDynamicDensityField(
parameter,
json_path_append(b.second.path_in_json,
{"DensityField", "DynamicDensityField"}),
timer_);
}
}
void SpeciesBuilder::buildSpecies() {
DEBUG_LEVEL_2("Build species from info.");
for (auto& b : background_species_info) {
background_species[b.first] = std::shared_ptr<species::BackgroundSpecie>(
new species::BackgroundSpecie(
b.second.type, b.second.name, b.second.mass_kg, b.second.charge_C,
b.second.density, b.second.velocity_distribution,
b.second.drift_velocity));
}
for (auto& b : tracked_species_info) {
tracked_species[b.first] =
std::shared_ptr<species::TrackedSpecie>(new species::TrackedSpecie(
b.second.type, b.second.name, b.second.mass_kg, b.second.charge_C,
b.second.mover, b.second.terminator, b.second.reflector,
b.second.density_field, b.second.velocity_distribution,
b.second.drift_velocity));
}
}
void SpeciesBuilder::fillCurrentCollector(Parameter& parameter) {
DEBUG_LEVEL_2("Fill current collectors.");
for (auto& b : tracked_species) {
auto current_collector = buildCurrentCollector(
parameter,
json_path_append(tracked_species_info.at(b.first).path_in_json,
{"CurrentCollector"}),
timer_);
b.second->currentCollector(current_collector);
}
}
void SpeciesBuilder::fillLoggers(Parameter& parameter) {
DEBUG_LEVEL_2("Fill loggers.");
for (auto& b : tracked_species) {
auto deletion_logger = buildDeletionLogger(
parameter,
json_path_append(tracked_species_info.at(b.first).path_in_json,
{"Loggers"}));
b.second->deletionLogger(deletion_logger);
}
}
void SpeciesBuilder::fillInteractions(Parameter& parameter) {
DEBUG_LEVEL_2("Fill interactions.");
for (auto& b : tracked_species) {
json_path path = tracked_species_info[b.first].path_in_json;
path = json_path_append(path, {"Interactions"});
addInteractions(b.second, tracked_species, background_species, parameter,
path);
}
}
}; // namespace generator
+25
View File
@@ -0,0 +1,25 @@
#include "generators/terminator_generator.h"
#include "generators/geometry_generator.h"
namespace generator {
std::shared_ptr<Terminator> buildTerminator(
Parameter& parameter,
const json_path& path_to_terminator) {
DEBUG_LEVEL_2("Creating terminator.");
long int max_interactions = static_cast<long int>(parameter.doubleValue(
json_path_append(path_to_terminator, {"MaximumInteractions"})));
double max_time_alive = parameter.doubleValue(
json_path_append(path_to_terminator, {"MaxTimeAlive", "value"}));
DEBUG_LEVEL_3("with max interactions: " + std::to_string(max_interactions));
DEBUG_LEVEL_3("with max time alive: " + std::to_string(max_time_alive));
std::shared_ptr<Geometry> geometry = buildGeometry(
parameter, json_path_append(path_to_terminator, {"BoundaryGeometry"}));
return std::shared_ptr<Terminator>(
new Terminator(max_interactions, max_time_alive, geometry));
}
}; // namespace generator
+99
View File
@@ -0,0 +1,99 @@
#include "generators/vector_field_generator.h"
#include <functional>
#include "IO/hdf5_reader.h"
#include "generators/binning_generator.h"
#include "generators/function_generator.h"
#include "simulation/errors.h"
#include "simulation/homebase.h"
#include "simulation/jansson_additionals.h"
namespace generator {
std::string readAbsoluteFilename(json_t* object) {
std::string path_type = json_string(json_object_by_path(object, {"Type"}));
if (path_type == "RelativeToHomebase") {
std::string homebase = BUILD_HOMEBASE_STRING;
std::string relative_path_to_homebase =
json_string(json_object_by_path(object, {"RelativePath"}));
std::string filename =
json_string(json_object_by_path(object, {"Filename"}));
return homebase + "/" + relative_path_to_homebase + "/" + filename;
} else if (path_type == "AbsolutPath") {
std::string absolute_path =
json_string(json_object_by_path(object, {"AbsoluteFolderPath"}));
std::string filename =
json_string(json_object_by_path(object, {"Filename"}));
return absolute_path + "/" + filename;
} else {
ERROR("This path type is not supported: " + path_type);
return "";
}
}
blitz::Array<double, 3> readFromFile(json_t* object) {
std::string absolute_filename =
readAbsoluteFilename(json_object_by_path(object, {"PathToH5"}));
std::string key = json_string(json_object_by_path(object, {"Key"}));
Hdf5Reader reader(absolute_filename);
return reader.readD3Double(key);
}
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component) {
std::string absolute_filename =
readAbsoluteFilename(json_object_by_path(object, {"PathToH5"}));
std::string key = json_string(
json_array_get(json_object_by_path(object, {"PathToH5"}), component));
Hdf5Reader reader(absolute_filename);
return reader.readD3Double(key);
}
std::shared_ptr<VectorField> buildVectorField(json_t* object) {
if (json_object_by_path(object, {"VectorFieldConstant"})) {
DEBUG_LEVEL_2("Creating Vector field: VectorFieldConstant");
blitz::TinyVector<double, 3> constant = json_blitz_vector<3>(
json_object_by_path(object, {"VectorFieldConstant", "constant"}));
return std::shared_ptr<VectorField>(
new VectorFieldConstant(CylinderVector(constant)));
} else if (json_object_by_path(object, {"VectorFieldFunctionInZ"})) {
DEBUG_LEVEL_2("Creating Vector field: VectorFieldFunctionInZ");
std::function<double(double, double, double)> z_function = function3D(
json_object_by_path(object, {"VectorFieldFunctionInZ", "zFunction"}));
return std::shared_ptr<VectorField>(new VectorFieldFunctionInZ(z_function));
} else if (json_object_by_path(object, {"VectorFieldFromArray"})) {
DEBUG_LEVEL_2("Creating Vector field: VectorFieldFromArray");
blitz::Array<double, 3> v_radial = readComponentFromFile(
json_object_by_path(object,
{"VectorFieldFromArray", "ReadArrayFromFile"}),
0);
blitz::Array<double, 3> v_azimuthal = readComponentFromFile(
json_object_by_path(object,
{"VectorFieldFromArray", "ReadArrayFromFile"}),
1);
blitz::Array<double, 3> v_longitudinal = readComponentFromFile(
json_object_by_path(object,
{"VectorFieldFromArray", "ReadArrayFromFile"}),
2);
double radius = json_double(
json_object_by_path(object, {"VectorFieldFromArray", "Radius"}));
double length = json_double(
json_object_by_path(object, {"VectorFieldFromArray", "Length"}));
return std::make_shared<VectorFieldFromArray>(
v_radial, v_azimuthal, v_longitudinal, radius, length);
} else {
ERROR("This vector field is not implemented");
return nullptr;
}
return nullptr;
}
} // namespace generator
@@ -0,0 +1,52 @@
#include "generators/velocity_distribution_function_generator.h"
#include "generators/energy_distribution_function_generator.h"
#include "generators/mass_generator.h"
#include "simulation/energy_distribution.h"
namespace generator {
std::shared_ptr<VelocityDistributionFunction> buildVelocityDistributionFunction(
Parameter& parameter,
const json_path& path_to_distribution) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_distribution, {"IsotropicDistribution"}))) {
DEBUG_LEVEL_2(
"Creating velocity distribution function: IsotropicDistribution");
std::shared_ptr<EnergyDistributionFunction> fE =
buildEnergyDistributionFunction(
parameter, json_path_append(path_to_distribution,
{"IsotropicDistribution",
"EnergyDistributionFunction"}));
double mass_kg = buildMass(parameter.jsonObjectFromBase(json_path_append(
path_to_distribution, {"IsotropicDistribution", "Mass"})));
return std::shared_ptr<VelocityDistributionFunction>(
new IsotropicDistribution(fE, mass_kg));
} else if (parameter.jsonObjectFromBase(json_path_append(
path_to_distribution, {"DirectedDistribution"}))) {
DEBUG_LEVEL_2(
"Creating velocity distribution function: DirectedDistribution");
std::shared_ptr<EnergyDistributionFunction> fE =
buildEnergyDistributionFunction(
parameter, json_path_append(path_to_distribution,
{"DirectedDistribution",
"EnergyDistributionFunction"}));
double mass_kg = buildMass(parameter.jsonObjectFromBase(json_path_append(
path_to_distribution, {"DirectedDistribution", "Mass"})));
blitz::TinyVector<double, 3> cartesian_direction =
json_blitz_vector<3>(parameter.jsonObjectFromBase(json_path_append(
path_to_distribution, {"DirectedDistribution", "Direction"})));
return std::shared_ptr<VelocityDistributionFunction>(
new DirectedDistribution(fE, mass_kg,
CartesianVector(cartesian_direction)));
}
ERROR("This velocity distribution function is not implemented.");
return nullptr;
}
}; // namespace generator
+31
View File
@@ -0,0 +1,31 @@
#include "generators/velocity_distribution_generator.h"
#include "generators/velocity_distribution_function_generator.h"
#include "simulation/errors.h"
#include "simulation/velocity_distribution_function.h"
namespace generator {
std::shared_ptr<VelocityDistribution> buildVelocityDistribution(
Parameter& parameter,
const json_path& path_to_distribution) {
if (parameter.jsonObjectFromBase(json_path_append(
path_to_distribution, {"VelocityDistributionFromFunction"}))) {
DEBUG_LEVEL_2(
"Creating velocity distribution: VelocityDistributionFromFunction");
std::shared_ptr<VelocityDistributionFunction> v =
buildVelocityDistributionFunction(
parameter, json_path_append(path_to_distribution,
{"VelocityDistributionFromFunction",
"VelocityDistributionFunction"}));
return std::shared_ptr<VelocityDistribution>(
new VelocityDistributionFromFunction(v));
} else if (parameter.jsonObjectFromBase(
json_path_append(path_to_distribution, {"null"}))) {
DEBUG_LEVEL_2("Creating velocity distribution: null");
return nullptr;
} else {
ERROR("This velocity distribution is not implemented.");
return nullptr;
}
}
}; // namespace generator
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
include $(HOMEBASE)/src/makeinclude/first.mak
-21
View File
@@ -1,21 +0,0 @@
include $(HOMEBASE)/src/makeinclude/include.mak
OFLAGS = $(X_OFLAGS)
CXXFLAGS = $(OFLAGS) $(X_INC)
ZIP = unzip
NAME = HighFive-master
all:
$(ZIP) ../$(NAME).zip
@cp -r $(NAME)/include/highfive $(X_INC_DIR)
install:
make install
clean:
#-rm -rf $(X_INC_DIR)/highfive
#$(X_CLEAN)
+28
View File
@@ -0,0 +1,28 @@
#include "interactions/charge_exchange.h"
#include "constants/physical_constants.h"
#include "simulation/drift_velocity.h"
#include "simulation/velocity_distribution.h"
namespace interaction {
ChargeExchange::ChargeExchange(std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target)
: Interaction(cross_section, target) {}
InteractionOutput ChargeExchange::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform charge exchange.");
const auto x_impact = particle.position();
const blitz::TinyVector<double, 3> v_target =
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
target_->velocityDistibution()
->rollVelocity(x_impact, generator->engine())
.cartesianEntries();
particle.velocity(CartesianVector(v_target));
return InteractionOutput();
}
};
+45
View File
@@ -0,0 +1,45 @@
#include "interactions/cluster_formation.h"
#include "simulation/drift_velocity.h"
#include "simulation/kinematic.h"
#include "simulation/logger.h"
#include "simulation/velocity_distribution.h"
namespace interaction {
ClusterFormation::ClusterFormation(
std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target,
std::shared_ptr<species::TrackedSpecie> product)
: Interaction(cross_section, target), product_(product) {}
InteractionOutput ClusterFormation::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform cluster formation.");
const auto x_impact = particle.position();
const blitz::TinyVector<double, 3> v_target =
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
target_->velocityDistibution()
->rollVelocity(x_impact, generator->engine())
.cartesianEntries();
const double energy_eV =
kinematic::kineticEnergy(v_target, target_->mass_kg());
const blitz::TinyVector<double, 3> v_cluster =
kinematic::velocity(energy_eV, product_->mass_kg()) *
kinematic::norm(v_target);
particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster));
InteractionOutput output;
output.add(cluster);
output.deleteCurrentParticle(true);
if (particle.specie()->deletionLogger()) {
particle.specie()->deletionLogger()->logDeletion(
x_impact, DeletionType::cluster_formation);
}
return output;
}
} // namespace interaction
+484
View File
@@ -0,0 +1,484 @@
#include "interactions/cross_sections.h"
#include <math.h>
#include "IO/hdf5_reader.h"
#include "constants/physical_constants.h"
#include "functions/functions.h"
#include "simulation/errors.h"
#include "simulation/homebase.h"
#include "simulation/kinematic.h"
#include <vector>
namespace interaction {
namespace d2CrossSection {
std::function<double(double, double)> eT2_ionization_bed() {
return [=](double impact_energy, double energy_after_collision) {
const double S_m2 = 5.4721e-20;
const double ionization_energy = 15.43;
const double u = 1.664;
const double N = 2;
const double Ni = 1.173;
const double c[4] = {1.1262, 6.3982, -7.8055, 2.1449};
if (impact_energy <= ionization_energy ||
(energy_after_collision >= (impact_energy - ionization_energy))) {
return 0.;
} else {
const double t = impact_energy / ionization_energy;
const double w = energy_after_collision / ionization_energy;
const double factor = S_m2 / ionization_energy / (t + u + 1);
const double summand_1 =
(Ni / N - 2) / (t + 1) * (1 / (w + 1) + 1 / (t - w));
const double summand_2 =
(2 - Ni / N) * (std::pow(w + 1, -2) + std::pow(t - w, -2));
double y = 1 / (w + 1);
const double dfdw = c[0] * std::pow(y, 3) + c[1] * std::pow(y, 4) +
c[2] * std::pow(y, 5) + c[3] * std::pow(y, 6);
const double summand_3 = std::log(t) / (N * (w + 1)) * dfdw;
return factor * (summand_1 + summand_2 + summand_3);
}
};
}
} // namespace d2CrossSection
namespace totalCrossSection {
std::function<double(double)> eT2_elastic_scattering_constant() {
return [=](double energy) { return 1.4E-19; };
}
std::function<double(double)> eT2_elastic_scattering() {
std::string homebase = BUILD_HOMEBASE_STRING;
std::string absolute_filename = homebase +
"/data/crossSections/eT2_elastic_scattering/"
"eT2_elastic_cross_section_total.h5";
Hdf5Reader reader(absolute_filename);
blitz::Array<double, 1> energies = reader.readD1Double("/energies(eV)");
blitz::Array<double, 1> cross_sections =
reader.readD1Double("/cross_sections(m-2)");
return D1ToD1::PiecewiseLinear(
std::vector<double>(energies.begin(), energies.end()),
std::vector<double>(cross_sections.begin(), cross_sections.end()));
}
std::function<double(double)> T3pT2_elasitc_scattering_tabata() {
return [=](double energy) {
const double sig0c1 = 1.16e-20;
const double c2 = -8.12e-1;
const double c3 = 4.29e-4;
const double c4c2 = (-1.38e-1) - (-8.12e-1);
const double c5 = 1.28e-2;
const double c4c6 = (-1.38e-1) + 1.33;
const double c7 = 8.67e-2;
const double c4c8 = (-1.38e-1) + 2.18;
const double ERyd_eV = 13.605693009;
const double x_keV = energy * 1e-3;
const double factor_1 = sig0c1 * std::pow(energy / ERyd_eV, c2);
const double factor_2 = 1 + std::pow(x_keV / c3, c4c2);
const double divisor =
1 + std::pow(x_keV / c5, c4c6) + std::pow(x_keV / c7, c4c8);
return factor_1 * factor_2 / divisor;
};
}
std::function<double(double)> TpT2_elasitc_scattering_tabata() {
return [=](double energy) {
const double sig0c1 = 5.74e-20;
const double c2 = -5.765e-1;
const double c3 = 2.79e-2;
const double c2c4 = -5.765e-1 + 1.737;
const double ERyd_eV = 13.605693009;
const double x_keV = energy * 1e-3;
const double factor = sig0c1 * std::pow(energy / ERyd_eV, c2);
const double divisor = 1 + std::pow(x_keV / c3, c2c4);
return factor / divisor;
};
}
std::function<double(double)> T2pT2_charge_exchange_janev() {
return [=](double energy) {
const double sig_ll =
6.59 / (std::pow(energy, 0.5) * (1 + 2.29 * std::pow(energy, 1.78))) +
12.85 * std::exp(-1.84 * std::pow(energy, -1.55)) /
(std::pow(energy, 0.0673) * (1 + 2.6E-3 * std::pow(energy, 0.97) +
1.63E-10 * std::pow(energy, 2.76)));
const double sig_gg = 11.38 * std::exp(-61.80 * std::pow(energy, -0.54)) /
(1 + 8.21E-10 * std::pow(energy, 2.08) +
3.80E-26 * std::pow(energy, 5.15));
return (sig_ll + sig_gg) * 1E-20;
};
}
std::function<double(double)> eT2_ionization_bed() {
return [=](double energy) {
const double S_m2 = 5.4721e-20;
const double ionization_energy = 15.43;
const double u = 1.664;
const double N = 2;
const double Ni = 1.173;
const double c[4] = {1.1262, 6.3982, -7.8055, 2.1449};
if (energy < ionization_energy) {
return 0.;
} else {
const double t = energy / ionization_energy;
const double factor = S_m2 / (t + u + 1);
const double yh = 2. / (t + 1);
const double D =
c[0] / 3 * (1 - std::pow(yh, 3)) + c[1] / 4 * (1 - std::pow(yh, 4)) +
c[2] / 5 * (1 - std::pow(yh, 5)) + c[3] / 6 * (1 - std::pow(yh, 6));
const double summand_1 = D * std::log(t);
const double summand_2 =
(2 - Ni / N) * ((t - 1) / t - std::log(t) / (t + 1));
return factor * (summand_1 + summand_2);
}
};
}
std::function<double(double)> eT2_ionization_janev_non_diss() {
return [=](double energy) {
const double deltaE_eV = 15.42;
if (energy < deltaE_eV) {
return 0.;
} else {
const double x = energy / deltaE_eV;
const double C0 = 2.05 * deltaE_eV;
return 1.828 / x * std::pow(1 - std::pow(x, -0.92), 2.19) *
std::log(C0 * x) * 1E-20;
}
};
}
std::function<double(double)> eT2_ionization_janev_diss_ground() {
return [=](double energy) {
const double deltaE_eV = 18.15;
if (energy < deltaE_eV) {
return 0.;
} else {
const double x = energy / deltaE_eV;
return 0.02905 * std::pow(x, -1.25) *
std::pow(1 - std::pow(x, -2.78), 1.886) * 1E-20;
}
};
}
std::function<double(double)> eT2_ionization_janev_diss_first() {
return [=](double energy) {
const double deltaE_eV = 30.6;
if (energy < deltaE_eV) {
return 0.;
} else {
const double x = energy / deltaE_eV;
return 0.5927 * std::pow(x, -1.2) *
std::pow(1 - std::pow(x, -1.22), 3.375) * 1E-20;
}
};
}
std::function<double(double)> TpT2_clustering_radiative_ascendion_pasil() {
return [=](double energy) {
const double velocity = kinematic::velocity(energy, 3 * SI::mp);
return 5E-23 / velocity;
};
}
std::function<double(double)> TpT2_clustering_tertiary_ascendion_pasil() {
return [=](double energy) {
const double velocity = kinematic::velocity(energy, 3 * SI::mp);
return 2.6E-41 / velocity;
};
}
std::function<double(double)> T2pT2_clustering_janev() {
return [=](double energy) {
return 17.76E-20 /
(std::pow(energy, 0.477) * (1 + 0.0291 * std::pow(energy, 3.61) +
1.53E-5 * std::pow(energy, 6.55)));
};
}
std::function<double(double)>
eT2_excitation_electric_janev_from_singlet_ground_state(
std::string final_state) {
std::function<double(double, double, double, double, double, double, double)>
general_cross_section = [=](double energy, double deltaE_eV, double alpha,
double A1, double A2, double A3, double A4) {
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.984E-20 / (deltaE_eV * rel) * std::pow(1 - 1 / rel, alpha) *
(A1 + A2 / rel + A3 / (rel * rel) + A4 * std::log(rel));
};
if (final_state == "B1") {
return [=](double energy) {
const double deltaE_eV = 12.754;
const double alpha = 0.550;
const double A1 = 3.651E-2;
const double A2 = -0.8405;
const double A3 = 1.2365;
const double A4 = 2.5236;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else if (final_state == "B1prime") {
return [=](double energy) {
const double deltaE_eV = 14.85;
const double alpha = 0.550;
const double A1 = 6.827E-3;
const double A2 = -0.1572;
const double A3 = 0.23122;
const double A4 = 0.47191;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else if (final_state == "B1primeprime") {
return [=](double energy) {
const double deltaE_eV = 15.47;
const double alpha = 0.550;
const double A1 = 2.446E-3;
const double A2 = -5.631E-2;
const double A3 = 6.2846E-2;
const double A4 = 0.16908;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else if (final_state == "C1") {
return [=](double energy) {
const double deltaE_eV = 13.29;
const double alpha = 0.552;
const double A1 = 3.653e-2;
const double A2 = -0.8398;
const double A3 = 1.2368;
const double A4 = 2.8740;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else if (final_state == "D1") {
return [=](double energy) {
const double deltaE_eV = 14.996;
const double alpha = 0.552;
const double A1 = 8.913E-3;
const double A2 = -0.2049;
const double A3 = 0.30178;
const double A4 = 0.70126;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else if (final_state == "D1prime") {
return [=](double energy) {
const double deltaE_eV = 15.555;
const double alpha = 0.552;
const double A1 = 3.872E-3;
const double A2 = -8.902E-2;
const double A3 = 0.13110;
const double A4 = 0.30464;
return general_cross_section(energy, deltaE_eV, alpha, A1, A2, A3, A4);
};
} else {
ERROR(
"This final state is not implemented for janve from singlet ground "
"state: " +
final_state);
return nullptr;
}
}
std::function<double(double)>
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
std::string final_state) {
std::function<double(double, double, double, double)> general_cross_section =
[=](double energy, double deltaE_eV, double alpha, double A1) {
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.984E-20 * A1 / (deltaE_eV * rel) *
std::pow(1 - 1 / rel, alpha);
};
if (final_state == "EF1") {
return [=](double energy) {
const double deltaE_eV = 13.13;
const double alpha = 2.71;
const double A1 = 0.8322;
return general_cross_section(energy, deltaE_eV, alpha, A1);
};
} else if (final_state == "HHb") {
return [=](double energy) {
const double deltaE_eV = 14.98;
const double alpha = 2.71;
const double A1 = 2.913E-2;
return general_cross_section(energy, deltaE_eV, alpha, A1);
};
} else if (final_state == "GK1") {
return [=](double energy) {
const double deltaE_eV = 14.816;
const double alpha = 2.75;
const double A1 = 1.43E-2;
return general_cross_section(energy, deltaE_eV, alpha, A1);
};
} else if (final_state == "I1") {
return [=](double energy) {
const double deltaE_eV = 14.824;
const double alpha = 2.80;
const double A1 = 5.409E-2;
return general_cross_section(energy, deltaE_eV, alpha, A1);
};
} else {
ERROR(
"This final state is not implemented for janev from singlet ground "
"state symmetry forbidden: " +
final_state);
return nullptr;
}
}
std::function<double(double)>
eT2_excitation_electric_janev_from_triplet_ground_state(
std::string final_state) {
std::function<double(double, double, double, double, double)>
general_cross_section = [=](double energy, double deltaE_eV, double beta,
double gamma, double A) {
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return A * std::pow(rel, -3) *
std::pow(1 - std::pow(rel, -beta), gamma) * 1E-20;
};
if (final_state == "A3") {
return [=](double energy) {
const double deltaE_eV = 11.71;
const double beta = 4.5;
const double gamma = 1.55;
const double A = 0.544;
return general_cross_section(energy, deltaE_eV, beta, gamma, A);
};
} else if (final_state == "B3") {
return [=](double energy) {
const double deltaE_eV = 7.93;
const double beta = 2.33;
const double gamma = 3.78;
const double A = 11.16;
return general_cross_section(energy, deltaE_eV, beta, gamma, A);
};
} else if (final_state == "C3") {
return [=](double energy) {
const double deltaE_eV = 11.72;
const double beta = 5.5;
const double gamma = 1.65;
const double A = 1.43;
return general_cross_section(energy, deltaE_eV, beta, gamma, A);
};
} else if (final_state == "E3") {
return [=](double energy) {
const double deltaE_eV = 13.0;
const double beta = 4.5;
const double gamma = 1.60;
const double A = 0.190;
return general_cross_section(energy, deltaE_eV, beta, gamma, A);
};
} else if (final_state == "D3") {
return [=](double energy) {
const double deltaE_eV = 13.6;
const double beta = 5.5;
const double gamma = 1.75;
const double A = 0.375;
return general_cross_section(energy, deltaE_eV, beta, gamma, A);
};
} else {
ERROR(
"This final state is not implemented for janev from triplet ground "
"state: " +
final_state);
return nullptr;
}
}
std::function<double(double)> eT2_excitation_vibrational_janev_first() {
return [=](double energy) {
const double deltaE_eV = 0.516;
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.78 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
};
}
std::function<double(double)> eT2_excitation_vibrational_janev_second() {
return [=](double energy) {
const double deltaE_eV = 1.003;
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.78 * 0.628 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
};
}
std::function<double(double)> eT2_excitation_rotational_j0_to_j2_england() {
std::string homebase = BUILD_HOMEBASE_STRING;
// read from homebase
// from Aust. J. Phys., 1988,41, 573-86, J. P. England, M T. Elford and R. W.
// Crompton
// Table 3
std::vector<double> energies = {
0.0439, 0.047, 0.050, 0.055, 0.060, 0.065, 0.070, 0.080, 0.090,
0.10, 0.11, 0.13, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40,
0.45, 0.50, 0.60, 0.70, 0.80, 0.90, 1.0, 1.2, 1.5,
2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 15.0, 16.0};
std::vector<double> cross_sections = {
0.0, 0.0185E-20, 0.027E-20, 0.035E-20, 0.042E-20, 0.048E-20,
0.053E-20, 0.062E-20, 0.068E-20, 0.074E-20, 0.079E-20, 0.088E-20,
0.097E-20, 0.115E-20, 0.132E-20, 0.152E-20, 0.175E-20, 0.200E-20,
0.228E-20, 0.260E-20, 0.323E-20, 0.394E-20, 0.469E-20, 0.555E-20,
0.636E-20, 0.796E-20, 1.036E-20, 1.370E-20, 1.585E-20, 1.704E-20,
1.755E-20, 1.758E-20, 1.732E-20, 1.689E-20, 1.579E-20, 1.462E-20,
1.350E-20, 1.248E-20, 1.156E-20, 0.730E-20, 0.0};
return D1ToD1::PiecewiseLinear(energies, cross_sections);
}
std::function<double(double)> eT2_excitation_rotational_j1_to_j3_england() {
// from Aust. J. Phys., 1988,41, 573-86, J. P. England, M T. Elford and R. W.
// Crompton
// Table 3
std::vector<double> energies = {
0.0727, 0.075, 0.080, 0.085, 0.090, 0.095, 0.10, 0.11, 0.12, 0.13, 0.15,
0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.56, 0.60, 0.66, 0.70,
0.80, 0.90, 1.01, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5,
4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 15.0, 16.0};
std::vector<double> cross_sections = {
0.0, 0.0070E-20, 0.0140E-20, 0.0198E-20, 0.0237E-20, 0.0265E-20,
0.0280E-20, 0.0330E-20, 0.0364E-20, 0.0394E-20, 0.0450E-20, 0.0580E-20,
0.0719E-20, 0.0860E-20, 0.1000E-20, 0.1140E-20, 0.1285E-20, 0.1439E-20,
0.1633E-20, 0.1776E-20, 0.1996E-20, 0.2135E-20, 0.2518E-20, 0.2919E-20,
0.3338E-20, 0.420E-20, 0.510E-20, 0.610E-20, 0.700E-20, 0.786E-20,
0.937E-20, 1.014E-20, 1.046E-20, 1.050E-20, 1.036E-20, 1.011E-20,
0.946E-20, 0.876E-20, 0.809E-20, 0.748E-20, 0.694E-20, 0.450E-20,
0.0};
return D1ToD1::PiecewiseLinear(energies, cross_sections);
}
std::function<double(double)> eT2p_recombination_janev() {
return [=](double energy) {
return 17.3E-20 * (std::pow(std::pow(energy, 0.665) *
(1 + 1.1 * std::pow(energy, 0.512) +
0.011 * std::pow(energy, 3.10)),
-1) +
0.133 * std::exp(-0.35 * std::pow(energy - 6.05, 2)));
};
}
std::function<double(double)> eT3p_recombination_janev() {
return [=](double energy) {
const double sigma_DR_L =
3E-20 / (std::pow(energy, 0.725) * (1 + 4.45 * std::pow(energy, 1.20)));
const double sigma_less = 0.0646E-20 * std::pow(energy, 1.478);
const double sigma_greater = 634.22E-20 / std::pow(energy, 2.605);
const double sigma_DR_H = 1. / (1. / sigma_greater + 1. / sigma_less);
return sigma_DR_L + sigma_DR_H;
};
}
}; // namespace totalCrossSection
}; // namespace interaction
+53
View File
@@ -0,0 +1,53 @@
#include "interactions/elastic_scattering.h"
#include "constants/physical_constants.h"
#include "simulation/drift_velocity.h"
#include "simulation/errors.h"
#include "simulation/kinematic.h"
#include "simulation/scattering_angle_distribution.h"
#include "simulation/velocity_distribution.h"
namespace interaction {
ElasticScattering::ElasticScattering(
std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target,
std::shared_ptr<ScatteringAngleDistribution> theta_distrib)
: Interaction(cross_section, target), theta_distrib_(theta_distrib) {}
InteractionOutput ElasticScattering::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform elastic scattering.");
const blitz::TinyVector<double, 3> v_impact =
particle.velocity().cartesianEntries();
const auto x_impact = particle.position();
const blitz::TinyVector<double, 3> v_target =
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
target_->velocityDistibution()
->rollVelocity(x_impact, generator->engine())
.cartesianEntries();
const blitz::TinyVector<double, 3> v_laboratory =
kinematic::velocityTargetFixed(v_impact, v_target, particle.mass_kg(),
target_->mass_kg());
const double E_kin =
kinematic::kineticEnergy(v_laboratory, particle.mass_kg()) *
UnitConversion::JouleToeV;
const double theta = theta_distrib_->roll(generator->engine(), E_kin);
const double phi = generator->rollUniform(0., 2 * M_PI);
const blitz::TinyVector<double, 3> v_impact_new =
kinematic::rotateVelocityInCenterOfMassFrame(
v_impact, v_target, particle.mass_kg(), target_->mass_kg(), theta,
phi);
particle.velocity(CartesianVector(v_impact_new));
// no Gyrocentrum movement because boris push is used;
return InteractionOutput();
}
}; // namespace interaction
+37
View File
@@ -0,0 +1,37 @@
#include "interactions/excitation.h"
#include "constants/physical_constants.h"
#include "simulation/errors.h"
#include "simulation/kinematic.h"
#include "simulation/species.h"
namespace interaction {
Excitation::Excitation(std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target,
double excitation_energy_eV)
: Interaction(cross_section, target),
excitation_energy_eV_(excitation_energy_eV) {
ASSERT_POSITIVE(&excitation_energy_eV_,
"The exitationenergy must be positive.");
}
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform excitation.");
const blitz::TinyVector<double, 3> v_impact =
particle.velocity().cartesianEntries();
const blitz::TinyVector<double, 3> n_impact =
v_impact / kinematic::norm(v_impact);
const double E_kin = kinematic::kineticEnergy(v_impact, particle.mass_kg()) *
UnitConversion::JouleToeV;
const double E_kin_new = E_kin - excitation_energy_eV_;
const blitz::TinyVector<double, 3> v_impact_new =
kinematic::velocityVector(E_kin_new, n_impact, particle.mass_kg());
particle.velocity(CartesianVector(v_impact_new));
return InteractionOutput();
}
}; // namespace interaction
+26
View File
@@ -0,0 +1,26 @@
#include "interactions/free_movement.h"
#include "constants/sim_constants.h"
namespace interaction {
FreeMovement::FreeMovement()
: Interaction(std::function<double(double)>([](double x) { return 0.; }),
nullptr) {}
InteractionOutput FreeMovement::performInteraction(particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform free movement.");
// do nothing
return InteractionOutput();
}
double FreeMovement::microscopicCrossSection(double energy_eV) {
// returns very small number
return SimConstants::minimal_cross_section;
}
double FreeMovement::macroscopicCrossSection(particle::Particle& particle) {
// returns a very small number, so the interaction will only be
return SimConstants::minimal_macroscopic_cross_section;
}
}; // namespace interaction
+174
View File
@@ -0,0 +1,174 @@
#include "interactions/ionization.h"
#include <math.h>
#include "constants/physical_constants.h"
#include "constants/sim_constants.h"
#include "simulation/drift_velocity.h"
#include "simulation/kinematic.h"
#include "simulation/particle.h"
#include "simulation/velocity_distribution.h"
namespace interaction {
ElectronIonization::ElectronIonization(
std::function<double(double)> cross_section,
std::shared_ptr<species::Specie> target,
std::shared_ptr<species::TrackedSpecie> electron,
std::shared_ptr<species::TrackedSpecie> ion,
std::shared_ptr<IonizationEnergyDistribution> distribution,
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
double ionization_energy_eV)
: Interaction(cross_section, target),
electron_(electron),
ion_(ion),
energy_distribution_(distribution),
angle_distribution_(angle_distribution),
ionization_energy_eV_(ionization_energy_eV) {}
InteractionOutput ElectronIonization::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform ionization.");
const blitz::TinyVector<double, 3> v_impact =
particle.velocity().cartesianEntries();
const auto x_impact = particle.position();
blitz::TinyVector<double, 3> v_target;
blitz::TinyVector<double, 3> v_laboratory;
double E_impact;
do {
v_target =
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
target_->velocityDistibution()
->rollVelocity(x_impact, generator->engine())
.cartesianEntries();
v_laboratory = kinematic::velocityTargetFixed(
v_impact, v_target, particle.mass_kg(), target_->mass_kg());
E_impact = kinematic::kineticEnergy(v_laboratory, particle.mass_kg()) *
UnitConversion::JouleToeV;
} while (E_impact <= ionization_energy_eV_);
const double E_impact_new =
energy_distribution_->rollImpactParticleEnergyAfterCollision(E_impact,
generator);
const double E_ejected =
std::max(0., E_impact - E_impact_new - ionization_energy_eV_);
const double polar_angle_impact_new = generator->rollUniform(0., 2 * M_PI);
const double polar_angle_ejected = (polar_angle_impact_new - M_PI) < 0.
? (polar_angle_impact_new + M_PI)
: (polar_angle_impact_new - M_PI);
const double azimuth_angle_impact_new =
angle_distribution_->rollAzimuthImpactParticleAfterCollision(
E_impact, E_impact_new, generator);
const double azimuth_angle_ejected =
angle_distribution_->rollAzimuthEjectedParticleAfterCollision(
E_impact, E_impact_new, generator);
const double v_lab_impact_new =
kinematic::velocity(E_impact_new, particle.mass_kg());
const double v_lab_ejected =
kinematic::velocity(E_ejected, electron_->mass_kg());
const blitz::TinyVector<double, 3> v_lab_norm =
v_laboratory / kinematic::norm(v_laboratory);
const blitz::TinyVector<double, 3> v_impact_new =
kinematic::rotateVector(v_lab_norm, azimuth_angle_impact_new,
polar_angle_impact_new) *
v_lab_impact_new +
v_target;
const blitz::TinyVector<double, 3> v_ejected =
kinematic::rotateVector(v_lab_norm, azimuth_angle_ejected,
polar_angle_ejected) *
v_lab_ejected +
v_target;
particle.velocity(v_impact_new);
InteractionOutput output;
output.add(
particle::Particle(electron_, x_impact, CartesianVector(v_ejected)));
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target)));
return output;
}
IonizationEnergyDistribution::IonizationEnergyDistribution(
std::function<double(double, double)> d2_cross_section,
double ionization_energy_eV)
: d2_cross_section_(d2_cross_section),
ionization_energy_eV_(ionization_energy_eV) {}
double IonizationEnergyDistribution::rollImpactParticleEnergyAfterCollision(
double impact_energy,
RandomNumbers* generator) {
// using rejection method:
// assuming cross section is highest at smallest numbers
const double energy_after_min = SimConstants::random_lower_limit;
const double energy_after_max = impact_energy - ionization_energy_eV_;
const double cross_section_min = 0;
const double cross_section_max =
d2_cross_section_(impact_energy, energy_after_min);
double energy_after;
double cross_section;
do {
energy_after = generator->rollUniform(energy_after_min, energy_after_max);
cross_section =
generator->rollUniform(cross_section_min, cross_section_max);
} while (cross_section > d2_cross_section_(impact_energy, energy_after));
// outgoing particles are indistiquishable
energy_after = energy_after < (impact_energy - ionization_energy_eV_) / 2.
? energy_after
: (impact_energy - ionization_energy_eV_) - energy_after;
return energy_after;
}
double
IonizationScatteringAngleDistribution::rollAzimuthImpactParticleAfterCollision(
double impact_energy,
double energy_impact_particle_new,
RandomNumbers* generator) {
// "after Transport of low energy electrons in nitrogen and air" B.Grosswendt,
// E.Waibel
if (energy_impact_particle_new > 100) {
return std::asin(
std::sqrt((energy_impact_particle_new / impact_energy) /
((1 - energy_impact_particle_new / impact_energy) *
(impact_energy / (2 * HEPunits::me)) +
1)));
} else {
return generator->rollUniform(0., M_PI / 4.);
}
}
double
IonizationScatteringAngleDistribution::rollAzimuthEjectedParticleAfterCollision(
double impact_energy,
double energy_impactParticle_new,
RandomNumbers* generator) {
// "after Transport of low energy electrons in nitrogen and air" B.Grosswendt,
// E.Waibel
if (energy_impactParticle_new > 200) {
return std::asin(
std::sqrt((1 - energy_impactParticle_new / impact_energy) /
(1 + energy_impactParticle_new / (2 * HEPunits::me))));
} else if (energy_impactParticle_new >= 50) {
if (generator->rollUniform(0., 1.) < 0.9) {
return generator->rollUniform(M_PI / 4, M_PI / 2);
} else {
return generator->rollUniform(0., M_PI);
}
} else {
return generator->rollUniform(0., M_PI);
}
};
}; // namespace interaction
+27
View File
@@ -0,0 +1,27 @@
#include "interactions/recombination.h"
#include "simulation/density_field.h"
namespace interaction {
Recombination::Recombination(std::function<double(double)> cross_section,
std::shared_ptr<species::TrackedSpecie> target)
: Interaction(cross_section, target), recombination_target_(target) {}
InteractionOutput Recombination::performInteraction(
particle::Particle& particle,
RandomNumbers* generator) {
DEBUG_LEVEL_3("Perform recombination.");
// energy dependent deletions in the future
const double energy_eV = 0.;
recombination_target_->dynamicDensityField()->logDeletion(particle.position(),
energy_eV);
InteractionOutput output;
output.deleteCurrentParticle(true);
return output;
}
}; // namespace interaction
-108
View File
@@ -1,108 +0,0 @@
//
// BED_eT2_ionization.cpp
// mc_electron
//
// Created by Christian Reiling on 29.04.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#include "BED_eT2_ionization.hpp"
#include <sstream>
#include <cmath>
#include "constants.h"
#include "error_types.h"
using namespace std;
const double BED_eT2_Ionization::S_m2 = 5.4721e-20;
const double BED_eT2_Ionization::B_eV = EionT2_eV;
const double BED_eT2_Ionization::u = 1.664;
const double BED_eT2_Ionization::N = 2;
const double BED_eT2_Ionization::Ni = 1.173;
const double BED_eT2_Ionization::c[4] = {1.1262 , 6.3982 , -7.8055, 2.1449} ;
double BED_eT2_Ionization::calc_TCS(const double &T_eV) {
if (T_eV<=0) {
stringstream ss;
ss<<"calc_TCS(double T_eV): Input energy T_eV="<<T_eV<<" eV < 0.";
throw MyException(ss.str());
}
if (T_eV<=B_eV) {
return 0;
} else {
double t = calc_t(T_eV);
double fac = S_m2/(t+u+1);
double sum1 = calc_Dt(t)*log(t);
double sum2 = (2-Ni/N)*( (t-1)/t - log(t)/(t+1) );
return fac*(sum1 + sum2);
}
}
double BED_eT2_Ionization::calc_SDCS (const double &T_eV, const double &W_eV) {
if (T_eV<0) {
stringstream ss;
ss<<"getSDCS(double T_eV, double W_eV): Input energy T_eV="<<T_eV<<" eV < 0.";
throw MyException(ss.str());
} else if (W_eV<0) {
stringstream ss;
ss<<"getSDCS(double T_eV, double W_eV): Input energy W_eV="<<W_eV<<" eV < 0.";
throw MyException(ss.str());
}
if ( (T_eV<=B_eV) ||(W_eV >= (T_eV-B_eV) ) ) {
return 0;
} else {
double t = calc_t(T_eV);
double w = calc_w(W_eV);
double fac = S_m2/B_eV/(t+u+1);
double sum1 = (Ni/N - 2)/(t+1) * (1/(w+1) + 1/(t-w));
double sum2 = (2-Ni/N) * (pow(w+1,-2) + pow(t-w,-2));
double sum3 = log(t)/(N*(w+1)) * calc_dfdw(w);
return fac*(sum1 + sum2 + sum3);
}
}
double BED_eT2_Ionization::calc_t(const double &T_eV) {
return T_eV/B_eV;
}
double BED_eT2_Ionization::calc_w(const double &W_eV) {
return W_eV/B_eV;
}
double BED_eT2_Ionization::calc_dfdw(const double &w) {
double y = 1/(w+1);
double res = 0;
for (int i=0;i<4;i++) {
res += c[i]*pow(y,i+3);
}
return res;
}
double BED_eT2_Ionization::calc_Dt(const double &t) {
double yh = 2/(t+1);
double res = 0;
for (int i=0;i<4;i++) {
res += c[i]/(i+3)*(1-pow(yh,i+3));
}
res = res/N;
return res;
}
double BED_eT2_Ionization::roll_W_eV(const double &T_eV, UniRNG *rngUni) {
double pmax, Wmin_eV, Wmax_eV, Wcan_eV, eta1, eta2;
Wmin_eV = 1e-5; // Properly fix this...
Wmax_eV = T_eV-EionT2_eV;
pmax =calc_SDCS(T_eV, Wmin_eV);
do {
eta1 = rngUni->random();
eta2 = rngUni->random();
Wcan_eV = Wmin_eV + eta1*(Wmax_eV - Wmin_eV);
} while(eta2*pmax > calc_SDCS(T_eV, Wcan_eV));
double W_eV = (Wcan_eV< (T_eV-EionT2_eV)/2 ) ? Wcan_eV : (T_eV-EionT2_eV) - Wcan_eV;
return W_eV;
}
-39
View File
@@ -1,39 +0,0 @@
//
// BED_eT2_ionization.hpp
// mc_electron
//
// Created by Christian Reiling on 29.04.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef BED_eT2_ionization_hpp
#define BED_eT2_ionization_hpp
#include "random_operations.h"
// BED Ionization model from Kim, Y.-K. and Rudd, M. E. 1994
class BED_eT2_Ionization {
static const double S_m2;
static const double B_eV;
static const double u;
static const double N;
static const double Ni;
static const double c[4];
public:
BED_eT2_Ionization(){};
static double calc_TCS(const double &T_eV);
static double calc_SDCS(const double &T_eV, const double &W_eV);
static double roll_W_eV(const double &T_eV, UniRNG *rngUni);
private:
static double calc_t(const double &T);
static double calc_w(const double &W);
static double calc_dfdw(const double &w);
static double calc_Dt(const double &t);
};
#endif /* BED_eT2_ionization_hpp */
-49
View File
@@ -1,49 +0,0 @@
#include "CoordinateConversion.h"
//#include <cmath>
#include <math.h>
blitz::TinyVector<int,3> CoordinateConversion::cylinderBin(
const blitz::TinyVector<double,3>& cylinder_coordinate,
const blitz::TinyVector<double,3>& dx)
{
const double r_bin = std::floor(cylinder_coordinate(0)/dx(0));
const double max_phi = 2*M_PI;
const double phi_bin = std::floor(std::fmod(cylinder_coordinate(1),max_phi) /dx(1));
const double z_bin = std::floor(cylinder_coordinate(2)/dx(2));
return blitz::TinyVector<int,3>(r_bin, phi_bin, z_bin);
}
blitz::TinyVector<double,3> CoordinateConversion::cylinderCoordinate(
const blitz::TinyVector<double,3>& cartesian_coordinate)
{
const double x = cartesian_coordinate(0) - cylinder_origin(0);
const double y = cartesian_coordinate(1) - cylinder_origin(1);
const double z = cartesian_coordinate(2) - cylinder_origin(2);
const double radius = std::sqrt(x*x + y*y);
const double phi = std::atan2(y,x);
return blitz::TinyVector<double,3>(
radius,
phi > 0? phi : 2*M_PI+phi,
z);
}
blitz::TinyVector<double,3> CoordinateConversion::cartesianBase(
const blitz::TinyVector<double,3>& cylinder_vector,
const blitz::TinyVector<double,3>& cylinder_coordinate)
{
const double A_rho = std::cos(cylinder_coordinate(1))*cylinder_vector(0)
- std::sin(cylinder_coordinate(1))*cylinder_vector(1);
const double A_phi = std::sin(cylinder_coordinate(1))*cylinder_vector(0)
+ std::cos(cylinder_coordinate(1))*cylinder_vector(1);
const double A_z = cylinder_vector(2);
return blitz::TinyVector<double,3>(A_rho, A_phi, A_z);
}
void CoordinateConversion::setCylinderOrigin(
const blitz::TinyVector<double,3>& cylinder_origin)
{
CoordinateConversion::cylinder_origin = cylinder_origin;
}
-23
View File
@@ -1,23 +0,0 @@
#ifndef COORDINATECONVERSION_H
#define COORDINATECONVERSION_H
#include <blitz/array.h>
namespace CoordinateConversion {
blitz::TinyVector<int,3> cylinderBin(
const blitz::TinyVector<double,3>& position_cylinder,
const blitz::TinyVector<double,3>& dx);
void setCylinderOrigin(const blitz::TinyVector<double,3>& cylinder_origin);
static blitz::TinyVector<double,3> cylinder_origin(0., 0., 0.);
blitz::TinyVector<double,3> cylinderCoordinate(
const blitz::TinyVector<double,3>& cartesian_coordinate);
blitz::TinyVector<double,3> cartesianBase(
const blitz::TinyVector<double,3>& cylinder_vector,
const blitz::TinyVector<double,3>& cylinder_coordinate);
};
#endif /* COORDINATECONVERSION_H */
-122
View File
@@ -1,122 +0,0 @@
#include "CurrentHistogram.h"
#include <exception>
#include <math.h>
#include <algorithm>
double binWidth(int num_bins, double min, double max)
{
return (max-min)/num_bins;
}
std::vector<double> createEnergyBins(int decade_min, int decade_max)
{
std::vector<double> bins;
for(int power = decade_min; power < decade_max; ++power){
for(int num = 1; num < 10; ++num){
bins.push_back(num*std::pow(10,power));
}
}
bins.push_back(std::pow(10,decade_max));
return bins;
}
int numEnergyBins(int energy_decade_min, int energy_decade_max){
return (energy_decade_max-energy_decade_min)*9 + 1;
}
CurrentHistogram::CurrentHistogram(
int num_bin_z, double z_min, double z_max,
int num_bin_r, double r_max,
int energy_decade_min, int energy_decade_max):
dr_(binWidth(num_bin_r, 0., r_max)),
dz_(binWidth(num_bin_z, z_min, z_max)),
z_min_(z_min),
r_min_(0.),
num_bin_z_(num_bin_z),
num_bin_r_(num_bin_r),
energy_bins_(createEnergyBins(energy_decade_min, energy_decade_max)),
hist_data_(
blitz::Range(0, num_bin_r),
blitz::Range(-1, num_bin_z),
blitz::Range(-1, numEnergyBins(energy_decade_min, energy_decade_max)-1))
{
hist_data_=0;
}
int CurrentHistogram::findRadialBin (
const blitz::TinyVector<double,3>& position_cart) const
{
const double r = std::sqrt(position_cart(0)*position_cart(0) + position_cart(1)*position_cart(1));
const int bin_r = std::floor(r/dr_);
return std::min(bin_r, num_bin_r_);
}
int CurrentHistogram::findLongitudinalBin (
const blitz::TinyVector<double,3>& position_cart) const
{
const int bin_z = std::floor((position_cart(2)-z_min_)/dz_);
return std::min(std::max(-1,bin_z),num_bin_z_);
}
int CurrentHistogram::findEnergyBin(double energy) const
{
auto const it = std::lower_bound(energy_bins_.begin(), energy_bins_.end(), energy);
//if (it == energy_bins_.end()) { return energy_bins_.size(); }
//if (it == energy_bins_.begin()){ return -1;};
return (it-energy_bins_.begin())-1;
}
void CurrentHistogram::fill(
const blitz::TinyVector<double,3>& position_cart,
double energy)
{
const int bin_z = findLongitudinalBin(position_cart);
const int bin_r = findRadialBin(position_cart);
const int bin_E = findEnergyBin(energy);
hist_data_(bin_r, bin_z, bin_E) += static_cast<long int>(1);
}
void CurrentHistogram::fill(int bin_r, int bin_z, double energy)
{
const int bin_E = findEnergyBin(energy);
if(hist_data_.isInRange(bin_r, bin_z, bin_E)){
hist_data_(bin_r, bin_z, bin_E) += static_cast<long int>(1);
}
}
blitz::TinyVector<int,2> CurrentHistogram::binDifference(
const blitz::TinyVector<double,3>& new_position_cart,
const blitz::TinyVector<double,3>& old_position_cart)
{
const int bin_z_old = findLongitudinalBin(old_position_cart);
const int bin_r_old = findRadialBin(old_position_cart);
const int bin_z_new = findLongitudinalBin(new_position_cart);
const int bin_r_new = findRadialBin(new_position_cart);
return blitz::TinyVector<int,2>(bin_r_new-bin_r_old, bin_z_new-bin_z_old);
}
std::vector<double> CurrentHistogram::binBordersR() const
{
std::vector<double> bin_border_r;
for(int i = 0; i <= num_bin_r_; ++i){
const double border = r_min_ + i*dr_;
bin_border_r.push_back(border);
}
return bin_border_r;
}
std::vector<double> CurrentHistogram::binBordersZ() const
{
std::vector<double> bin_border_z;
for(int i = 0; i <= num_bin_z_; ++i){
const double border = z_min_ + i*dz_;
bin_border_z.push_back(border);
}
return bin_border_z;
}
std::vector<double> CurrentHistogram::binBordersE() const
{
return energy_bins_;
}
-52
View File
@@ -1,52 +0,0 @@
#ifndef CURRENTHISTOGRAM_H
#define CURRENTHISTOGRAM_H
#include "blitz/array.h"
#include <vector>
class CurrentHistogram {
public:
CurrentHistogram(
int num_bin_z, double z_min, double z_max,
int num_bin_r, double r_max,
int energy_decade_min, int energy_decade_max);
void fill(
const blitz::TinyVector<double,3>& position_cart,
double energy);
void fill(int bin_r, int bin_z, double energy);
int findRadialBin(
const blitz::TinyVector<double,3>& position_cart) const;
int findLongitudinalBin(
const blitz::TinyVector<double,3>& position_cart) const;
int findEnergyBin(
double energy) const;
blitz::TinyVector<int,2> binDifference(
const blitz::TinyVector<double,3>& new_position_cart,
const blitz::TinyVector<double,3>& old_position_cart);
blitz::Array<unsigned long,3> hist_data_;
std::vector<double> binBordersR() const;
std::vector<double> binBordersZ() const;
std::vector<double> binBordersE() const;
private:
const std::vector<double> energy_bins_;
const double dz_;
const double dr_;
const double z_min_;
const double r_min_;
const int num_bin_z_;
const int num_bin_r_;
};
#endif /* CURRENTHISTOGRAM_H */
-191
View File
@@ -1,191 +0,0 @@
#include "CurrentLogger.h"
#include "particle.hpp"
#include "highfive/H5File.hpp"
#include "highfive/H5DataSet.hpp"
#include <hdf5_hl.h>
CurrentLogger::CurrentLogger(
species this_species,
int num_planes_z, double z_min, double z_max,
int num_planes_r, double r_max,
int energy_decade_min, int energy_decade_max,
std::string output_filename):
Particle_Logger_Base(this_species),
N_pos_r(
num_planes_z-1, z_min, z_max, // -1 through |[0,n]| = n+1
num_planes_r, r_max,
energy_decade_min, energy_decade_max ),
N_neg_r(
num_planes_z-1, z_min, z_max, // -1 through |[0,n]| = n+1
num_planes_r, r_max,
energy_decade_min, energy_decade_max ),
N_pos_z(
num_planes_z-1, z_min, z_max, // -1 through |[0,n]| = n+1
num_planes_r, r_max,
energy_decade_min, energy_decade_max ),
N_neg_z(
num_planes_z-1, z_min, z_max, // -1 through |[0,n]| = n+1
num_planes_r, r_max,
energy_decade_min, energy_decade_max ),
output_filename_(output_filename)
{
writeBinBorderData();
}
void CurrentLogger::log(const Particle& logPart, const vec3& old_loc_m)
{
if (!logging) {
return;
}
const vec3 new_loc_m = logPart.get_x_m();
const int bin_r_new = N_pos_r.findRadialBin(new_loc_m);
const int bin_z_new = N_pos_r.findLongitudinalBin(new_loc_m);
const int bin_r_old = N_pos_r.findRadialBin(old_loc_m);
const int bin_z_old = N_pos_r.findLongitudinalBin(old_loc_m);
const int delta_bin_r = bin_r_new - bin_r_old;
const int delta_bin_z = bin_z_new - bin_z_old;
//std::cout << "bin_z_new " << bin_z_new << std::endl;
//std::cout << "bin_z_old " << bin_z_old << std::endl;
//if(std::abs(delta_bin_z) > 1){
// std::cout << "Moved bins: " << delta_bin_z << std::endl;
//}
if((delta_bin_r ==0) && (delta_bin_z == 0)){
// do nothing
}
else{
const double energy = logPart.get_E_eV();
if(delta_bin_z >= 1){
for(int i = 0; i < delta_bin_z; ++i){
N_pos_z.fill(bin_r_old, bin_z_old+i, energy);
}
//N_pos_z.fill(bin_r_old, bin_z_old, energy);
}
else if(delta_bin_z <= -1) {
for(int i = 0; i < std::abs(delta_bin_z); ++i){
N_neg_z.fill(bin_r_old, bin_z_old-i, energy);
}
//N_neg_z.fill(bin_r_old, bin_z_old, energy);
}
if(delta_bin_r == 1){
N_pos_r.fill(bin_r_old, bin_z_old, energy);
}
else if(delta_bin_r == -1) {
N_neg_r.fill(bin_r_old, bin_z_old, energy);
}
}
}
void CurrentLogger::flush()
{
// do nothing
}
void CurrentLogger::writeBinBorderData()
{
std::string filename = output_filename_+"_currents.h5";
std::string group = "/" + get_species_string(this->get_species()) + "/current_bin_borders";
HighFive::File file(
filename,
HighFive::File::ReadWrite | HighFive::File::Create);
if(!file.exist(group)){
file.createGroup(group);
}
auto bin_borders_E = N_pos_z.binBordersE();
std::string path_E = group + "/bin_borders_E";
if(file.exist(path_E)){
HighFive::DataSet dataset = file.getDataSet(path_E);
dataset.write(bin_borders_E);
} else{
HighFive::DataSet dataset =
file.createDataSet<double>(path_E, HighFive::DataSpace::From(bin_borders_E));
dataset.write(bin_borders_E);
}
auto bin_borders_r = N_pos_z.binBordersR();
std::string path_r = group + "/bin_borders_r";
if(file.exist(path_r)){
HighFive::DataSet dataset = file.getDataSet(path_r);
dataset.write(bin_borders_r);
} else{
HighFive::DataSet dataset =
file.createDataSet<double>(path_r, HighFive::DataSpace::From(bin_borders_r));
dataset.write(bin_borders_r);
}
auto bin_borders_z = N_pos_z.binBordersZ();
std::string path_z = group + "/bin_borders_z";
if(file.exist(path_z)){
HighFive::DataSet dataset = file.getDataSet(path_z);
dataset.write(bin_borders_z);
} else{
HighFive::DataSet dataset =
file.createDataSet<double>(path_z, HighFive::DataSpace::From(bin_borders_z));
dataset.write(bin_borders_z);
}
}
void CurrentLogger::output()
{
output("N_pos_z", N_pos_z.hist_data_);
output("N_neg_z", N_neg_z.hist_data_);
output("N_pos_r", N_pos_r.hist_data_);
output("N_neg_r", N_neg_r.hist_data_);
}
void CurrentLogger::output(
std::string dataname, const blitz::Array<unsigned long,3>& data)
{
std::string filename = output_filename_+"_currents.h5";
std::string group = "/" + get_species_string(this->get_species());
std::string path = group+"/"+dataname;
HighFive::File file(
filename,
HighFive::File::ReadWrite | HighFive::File::Create);
if(!file.exist(group)){
file.createGroup(group);
}
blitz::TinyVector<int,3> start = data.lbound();
blitz::TinyVector<int,3> end = data.ubound();
std::vector<std::vector<std::vector<unsigned long>>> data_v;
for(int i = start(0); i<=end(0); ++i){
std::vector<std::vector<unsigned long>> zs;
for(int j = start(1); j<=end(1); ++j){
std::vector<unsigned long> energies;
for(int k = start(2); k<=end(2); ++k){
energies.push_back(data(i,j,k));
}
zs.push_back(energies);
}
data_v.push_back(zs);
}
if(file.exist(path)){
HighFive::DataSet dataset = file.getDataSet(path);
dataset.write(data_v);
} else{
HighFive::DataSet dataset =
file.createDataSet<unsigned long>(path, HighFive::DataSpace::From(data_v));
dataset.write(data_v);
}
}
-36
View File
@@ -1,36 +0,0 @@
#ifndef CURRENTLOGGER_H
#define CURRENTLOGGER_H
#include "particle_logger_base.h"
#include "CurrentHistogram.h"
class CurrentLogger : public Particle_Logger_Base {
public:
CurrentLogger(
species this_species,
int num_planes_z, double z_min, double z_max,
int num_planes_r, double r_max,
int energy_decade_min, int energy_decade_max,
std::string output_filename);
void log(const Particle& logPart, const vec3& old_loc_m);
void flush();
void output();
private:
CurrentHistogram N_pos_r;
CurrentHistogram N_neg_r;
CurrentHistogram N_pos_z;
CurrentHistogram N_neg_z;
const std::string output_filename_;
void output(
std::string dataname,
const blitz::Array<unsigned long,3>& data);
void writeBinBorderData();
};
#endif /* CURRENTLOGGER_H */
-115
View File
@@ -1,115 +0,0 @@
#include "Ion_Mover_Boris.h"
Ion_Mover_Boris::Ion_Mover_Boris(
species this_species,
Particle_Logger_Base *Logger,
Population_Base *Population,
double B_max):
Mover_Base(this_species, Logger, Population)
{
if(B_max == 0.){
dt_s = 1.;
} else{
dt_s = Population->get_m_eV()/(B_max*c_ms*c_ms);
}
};
void Ion_Mover_Boris::move(Particle *movePart, const double &macro_sigma_m)
{
// Prepare detection for change of z direction for logging
double oldzDir = movePart->get_v_ms()[2] < 0 ? -1 : 1;
vec3 oldLoc_m = movePart->get_x_m();
if (macro_sigma_m == 0) { // If infinite movement distance let electron leave at only exit... Prob extremly faulty, but also impossible.
movePart->set_x_m(z_RW_m);
Logger->log(*movePart,oldLoc_m);
return;
}
double distance_m = 1/macro_sigma_m;
double traveledDistance_m = 0;
vec3 loc_m, E_Vm ,B_T;
while (traveledDistance_m < distance_m) {
loc_m = movePart->get_x_m();
E_Vm = Katrin_Fields::getElField_Vm(loc_m);
B_T = Katrin_Fields::getMagField_T(loc_m);
traveledDistance_m += doBoris_singleStep_m(movePart, E_Vm, B_T);
if (doBoris_WallInteraction(movePart) == true) {
Logger->log(*movePart, oldLoc_m);
Population->increase_density(*movePart, oldLoc_m);
return;
}
doBoris_LogzDirChange(movePart, &oldzDir, &oldLoc_m); // Log if z direction changes, and adapt quantities
}
Logger->log(*movePart,oldLoc_m);
Population->increase_density(*movePart, oldLoc_m);
return;
}
double Ion_Mover_Boris::doBoris_singleStep_m(Particle *movePart, const vec3 &E_Vm , const vec3 &B_T)
{
double distance_m;
vec3 x_m = movePart->get_x_m();
vec3 v_ms = movePart->get_v_ms();
x_m += dt_s/2 * v_ms;
distance_m = dt_s/2 * calc_vec3_abs(v_ms);
doBoris_speedChange(movePart, E_Vm , B_T);
x_m += dt_s/2 * v_ms;
distance_m += dt_s/2 * calc_vec3_abs(v_ms);
movePart->set_x_m(x_m);
return distance_m;
}
void Ion_Mover_Boris::doBoris_speedChange(Particle *movePart, const vec3 &E_Vm, const vec3 &B_T) {
double q_C = movePart->get_Z() * e_C;
double m_kg = movePart->get_m_eV() * e_C/c_ms/c_ms;
vec3 v_ms = movePart->get_v_ms();
vec3 t = q_C*dt_s/(2*m_kg) * B_T;
vec3 s = (2*t)/(1+dot(t,t));
vec3 vMinus_ms = v_ms + (q_C*E_Vm*dt_s)/(2*m_kg);
vec3 vPrime_ms = vMinus_ms + cross(vMinus_ms,t);
vec3 vPlus_ms = vMinus_ms + cross(vPrime_ms,s);
v_ms = vPlus_ms + q_C/m_kg*E_Vm*0.5*dt_s;
movePart->set_v_ms(v_ms);
}
bool Ion_Mover_Boris::doBoris_WallInteraction(Particle *movePart) {
vec3 loc_m = movePart->get_x_m();
double r_m = movePart->get_r_m();
if (loc_m[2]<=z_RW_m) { // Rear Wall Termination
vec3 newLoc_m = movePart->get_x_m();
newLoc_m[2] = 0;
movePart->set_x_m(newLoc_m);
return true;
}
if (r_m>=r_WGTS_m) { // WGTS Wall Termination
vec3 newLoc_m = movePart->get_x_m();
double z_m = newLoc_m[2];
newLoc_m[2] = 0;
newLoc_m = (r_WGTS_m * 1.01)/calc_vec3_abs(newLoc_m) * newLoc_m; //1.01 to move Particle slightly out of WGTS
newLoc_m[2] = z_m;
return true;
}
if (loc_m[2]>=z_DPS_m) { // DPS Absorption
vec3 newLoc_m = movePart->get_x_m();
newLoc_m[2] = z_DPS_m;
movePart->set_x_m(newLoc_m);
return true;
}
return false;
}
void Ion_Mover_Boris::doBoris_LogzDirChange(Particle *movePart, double *oldzDir, vec3 *oldLoc_m) {
double zDir = movePart->get_v_ms()[2] < 0 ? -1 : 1;
if (*oldzDir != zDir) {
Logger->log(*movePart, *oldLoc_m);
Population->increase_density(*movePart, *oldLoc_m);
*oldzDir = zDir;
*oldLoc_m = movePart->get_x_m();
}
return;
}
-26
View File
@@ -1,26 +0,0 @@
#ifndef ION_MOVER_BORIS_H
#define ION_MOVER_BORIS_H
#include "mover_base.h"
#include "constants.h"
class Ion_Mover_Boris : public Mover_Base {
double dt_s;
public:
Ion_Mover_Boris(
species this_species,
Particle_Logger_Base *Logger,
Population_Base *Population,
double B_max);
void move(Particle *movePart, const double &macro_sigma_m);
private:
double doBoris_singleStep_m(Particle *movePart, const vec3 &E_Vm , const vec3 &B_T);
void doBoris_speedChange(Particle *movePart, const vec3 &E_Vm, const vec3 &B_T);
bool doBoris_WallInteraction(Particle *movePart);
void doBoris_LogzDirChange(Particle *movePart, double *oldzDir, vec3 *oldLoc_m);
};
#endif /* ION_MOVER_BORIS_H */
-53
View File
@@ -1,53 +0,0 @@
#include "LongitudinalBins.h"
#include <algorithm>
#include <iostream>
namespace Discrete {
std::vector<double> createBins(
double z_min, double z_max,
int num_bins)
{
std::vector<double> bins;
const double dz = (z_max - z_min)/num_bins;
for(int bin = 0; bin <= num_bins; ++bin){
bins.push_back(z_min + bin*dz);
}
return bins;
}
Longitudinal::Longitudinal(
double z_min,
double z_max,
int num_bins):
bins_(createBins(z_min, z_max, num_bins))
{
}
Longitudinal::Longitudinal(const Longitudinal& l):
bins_(l.bins_)
{}
bool Longitudinal::changedBin(double z_start, double z_end) const
{
return !(findBin(z_start) == findBin(z_end));
}
int Longitudinal::findBin(double z) const
{
auto const it = std::lower_bound(bins_.begin(), bins_.end(), z);
return (it-bins_.begin())-1;
}
std::vector<double> Longitudinal::bins() const
{
return bins_;
}
double Longitudinal::minimalBinDistance() const
{
return std::abs(bins_[1]-bins_[0]);
}
}
-26
View File
@@ -1,26 +0,0 @@
#ifndef LONGITUDINALBINS_H
#define LONGITUDINALBINS_H
#include <vector>
namespace Discrete {
class Longitudinal {
public:
Longitudinal(
double z_min,
double z_max,
int num_bins);
Longitudinal(const Longitudinal& l);
bool changedBin(double z_start, double z_end) const;
int findBin(double z) const;
std::vector<double> bins() const;
double minimalBinDistance() const;
private:
const std::vector<double> bins_;
};
};
#endif /* LONGITUDINALBINS_H */
-82
View File
@@ -1,82 +0,0 @@
#include "catch.hpp"
#include "LongitudinalBins.h"
#include <vector>
TEST_CASE("Longitudinal Bins", "[LongitudinalBins]"){
SECTION("Bins are filled correctly"){
int num_bins = 14;
const double z_min = 0.;
const double z_max = 14.;
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
std::vector<double> bins = longitudinal.bins();
REQUIRE(bins.front() == 0.);
REQUIRE(bins.back() == 14.);
REQUIRE(bins[1] == 1.);
}
SECTION("Bin is calculated correctly"){
int num_bins = 14;
const double z_min = 0.;
const double z_max = 14.;
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
SECTION("in bin"){
REQUIRE(longitudinal.findBin(0.5) == 0);
REQUIRE(longitudinal.findBin(1.2) == 1);
REQUIRE(longitudinal.findBin(13.5) == 13);
}
SECTION("at bin borders"){
REQUIRE(longitudinal.findBin(0.0) == -1);
REQUIRE(longitudinal.findBin(1.0) == 0);
REQUIRE(longitudinal.findBin(2.0) == 1);
REQUIRE(longitudinal.findBin(14.0) == 13);
}
SECTION("Outside of bins"){
REQUIRE(longitudinal.findBin(-0.5) == -1);
REQUIRE(longitudinal.findBin(-14.5) == -1);
REQUIRE(longitudinal.findBin(14.5) == 14);
REQUIRE(longitudinal.findBin(20.3) == 14);
}
}
SECTION("Bin changes are found"){
int num_bins = 14;
const double z_min = 0.;
const double z_max = 14.;
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
SECTION("Same bin"){
REQUIRE(!longitudinal.changedBin(0.5, 0.5));
REQUIRE(!longitudinal.changedBin(0.7, 0.5));
REQUIRE(!longitudinal.changedBin(0.5, 0.7));
REQUIRE(!longitudinal.changedBin(1.5, 1.7));
REQUIRE(!longitudinal.changedBin(0.5, 1.0));
}
SECTION("Bin change"){
REQUIRE(longitudinal.changedBin(0.5, 1.5));
REQUIRE(longitudinal.changedBin(1.5, 0.5));
REQUIRE(longitudinal.changedBin(0.5, -0.5));
REQUIRE(longitudinal.changedBin(13.5, 14.5));
}
}
SECTION("Constructor"){
int num_bins = 14;
const double z_min = 0.;
const double z_max = 14.;
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
Discrete::Longitudinal copy_longitudinal(longitudinal);
REQUIRE(copy_longitudinal.bins()[0] == longitudinal.bins()[0]);
REQUIRE(copy_longitudinal.bins()[3] == longitudinal.bins()[3]);
}
}
-39
View File
@@ -1,39 +0,0 @@
//
// T2IT2_cluster.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T2IT2_cluster_h
#define T2IT2_cluster_h
#include "TI_thermal_binary_base.h"
#include "janev_T2IT2_cluster.h"
class T2IT2_Cluster : public TI_thermal_binary_Precomputed_Interaction_Base {
public:
T2IT2_Cluster(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 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_Cluster::get_TCS(E_eV);}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T2IT2_Cluster::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v_ms = interPart->get_v_ms();
Particle T3New = Particle_Builder::create_T3I(loc_m, v_ms, -1, interPart->get_Id());
//InterOut.add_new_particle(TNew);
InterOut.add_new_particle(T3New);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* T2IT2_cluster_h */
-51
View File
@@ -1,51 +0,0 @@
#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_half = scalar_product_squared >= 1 ?
0 : std::sqrt((1-std::sqrt(scalar_product_squared))/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_half;
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();
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef T2IT2_CX_H
#define T2IT2_CX_H
#include "TI_thermal_binary_base.h"
#include "kinematics_base.h"
class T2IT2_CX : public TI_thermal_binary_Precomputed_Interaction_Base {
public:
T2IT2_CX(Population_Base *T2Population, UniRNG *rngUni);
double get_microSigma_m2(const double &E_eV);
InteractionOut do_Interaction (Particle *interPart);
private:
Elastic_Kinematic_Base kinematics;
};
#endif /* T2IT2_CX_H */
-41
View File
@@ -1,41 +0,0 @@
//
// T2Ie_disexc.h
// mc_electron
//
// Created by Christian Reiling on 30.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T2Ie_disexc_h
#define T2Ie_disexc_h
#include "TI_kinetic_base.h"
#include "janev_eT2I_disexc.h"
class T2Ie_DissExc : public Interaction_Base {
public:
T2Ie_DissExc(Population_Base *ePopulation, UniRNG *rngUni) : Interaction_Base(ePopulation, rngUni) {}
double get_microSigma_m2(const double &E_eV) {return Janev_eT2I_DissExc::get_TCS(E_eV);}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T2Ie_DissExc::do_Interaction (Particle *interPart) {
InteractionOut res;
res.set_delete_current(true);
vec3 loc_m = interPart->get_x_m();
vec3 vTI_ms = interPart->get_v_ms();
Particle TI = Particle_Builder::create_TI(loc_m, vTI_ms, -1, interPart->get_Id());
res.add_new_particle(TI);
/*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.
Population->decrease_denisty(loc_m, E_eV);*/
return res;
}
#endif /* T2Ie_disexc_h */
-35
View File
@@ -1,35 +0,0 @@
#include "T2Ie_recombination.h"
#include "janev_eT2I_recombination.h"
#include "kinematics.h"
#include "recombination_counter.h"
T2Ie_Recombination::T2Ie_Recombination(
Population_Base *ePopulation,
UniRNG *rngUni) :
TI_e_Precomputed_Interaction_Base(
ePopulation, rngUni, 2*mT_eV)
{
calc_values(); // need to call here, because, constructor can't call pure virtual function
}
double T2Ie_Recombination::get_microSigma_m2(
const double &E_eV)
{
// ion at rest
return Janev_eT2I_Recombination::get_TCS(E_eV);
}
InteractionOut T2Ie_Recombination::do_Interaction (
Particle *interPart)
{
InteractionOut res;
res.set_delete_current(true);
const vec3 pos_m = interPart->get_x_m();
const double E_eV = calc_E_eV_from_v_ms(
Population->roll_v_ms(pos_m), me_eV); // should be computed properly using chances.
Population->decrease_denisty(pos_m, E_eV);
GlobalCounter::num_T2I_recombinations += 1;
return res;
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef T2IE_RECOMBINATION_H
#define T2IE_RECOMBINATION_H
#include "TI_kinetic_base.h"
class T2Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
public:
T2Ie_Recombination(
Population_Base *ePopulation,
UniRNG *rngUni);
InteractionOut do_Interaction (Particle *interPart);
protected:
double get_microSigma_m2(const double &E_eV);
};
#endif /* T2IE_RECOMBINATION_H */
-52
View File
@@ -1,52 +0,0 @@
#include "T3IT2_elastic.h"
#include "katrin_fields.hpp"
T3IT2_Elastic::T3IT2_Elastic(
Population_Base *T2Population,
UniRNG *rngUni)
: TI_thermal_binary_Precomputed_Interaction_Base(
T2Population, rngUni, 3*mT_eV),
kinematics(3*mT_eV, 2*mT_eV)
{
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double T3IT2_Elastic::get_microSigma_m2(const double &E_eV)
{
return tcs_gen.get_TCS(E_eV);
}
InteractionOut T3IT2_Elastic::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); // = cos(x)^2
const double sin_theta_half = scalar_product_squared >= 1 ?
0 : std::sqrt((1-std::sqrt(scalar_product_squared))/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_half;
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();
}
-21
View File
@@ -1,21 +0,0 @@
#ifndef T3IT2_elastic_h
#define T3IT2_elastic_h
#include "TI_thermal_binary_base.h"
#include "tabata_T3IT2_elastic.h"
#include "kinematics_base.h"
class T3IT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
Tabata_T3IT2_Elastic tcs_gen;
Elastic_Kinematic_Base kinematics;
public:
T3IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni);
double get_microSigma_m2(const double &E_eV);
InteractionOut do_Interaction (Particle *interPart);
};
#endif /* T3IT2_elastic_h */
-40
View File
@@ -1,40 +0,0 @@
//
// T3IT2_radasc.h
// mc_electron
//
// Created by Christian Reiling on 08.10.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T3IT2_radasc_h
#define T3IT2_radasc_h
#include "TI_rate_base.h"
class T3IT2_RadAsc : public TI_thermal_Rate_Precomputed_Interaction_Base {
public:
T3IT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Precomputed_Interaction_Base(T2Population, rngUni, 1) {
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double get_microSigma_m2(const double &E_eV) {
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
return 5e-23/v_ms; // CS from Gerlich:1990aa
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T3IT2_RadAsc::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v_ms = interPart->get_v_ms();
Particle T5INew = Particle_Builder::create_T5I(loc_m, v_ms, -1, interPart->get_Id());
InterOut.add_new_particle(T5INew);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* T3IT2_radasc_h */
-40
View File
@@ -1,40 +0,0 @@
//
// T3IT2_terasc.h
// mc_electron
//
// Created by Christian Reiling on 08.10.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T3IT2_terasc_h
#define T3IT2_terasc_h
#include "TI_rate_base.h"
class T3IT2_TerAsc : public TI_thermal_Rate_Precomputed_Interaction_Base {
public:
T3IT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Precomputed_Interaction_Base(T2Population, rngUni, 2) {
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double get_microSigma_m2(const double &E_eV) {
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
return 7e-41*v_ms; // CS from Gerlich:1990aa
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T3IT2_TerAsc::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v_ms = interPart->get_v_ms();
Particle T5INew = Particle_Builder::create_T5I(loc_m, v_ms, -1, interPart->get_Id());
InterOut.add_new_particle(T5INew);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* T3IT2_terasc_h */
-40
View File
@@ -1,40 +0,0 @@
//
// T3Ie_disexc.h
// mc_electron
//
// Created by Christian Reiling on 30.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T3Ie_disexc_h
#define T3Ie_disexc_h
#include "TI_kinetic_base.h"
#include "janev_eT3I_disexc.h"
class T3Ie_DissExc : public Interaction_Base {
public:
T3Ie_DissExc(Population_Base *ePopulation, UniRNG *rngUni) : Interaction_Base(ePopulation, rngUni) {}
double get_microSigma_m2(const double &E_eV) {return Janev_eT3I_DissExc::get_TCS(E_eV);}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T3Ie_DissExc::do_Interaction (Particle *interPart) {
InteractionOut res;
res.set_delete_current(true);
vec3 loc_m = interPart->get_x_m();
vec3 vTI_ms = interPart->get_v_ms();
Particle TI = Particle_Builder::create_TI(loc_m, vTI_ms, -1, interPart->get_Id());
res.add_new_particle(TI);
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.
Population->decrease_denisty(loc_m, E_eV);
return res;
}
#endif /* T3Ie_disexc_h */
-33
View File
@@ -1,33 +0,0 @@
#include "T3Ie_recombination.h"
#include "janev_eT3I_recombination.h"
#include "kinematics.h"
#include "recombination_counter.h"
T3Ie_Recombination::T3Ie_Recombination(
Population_Base *ePopulation,
UniRNG *rngUni) :
TI_e_Precomputed_Interaction_Base(
ePopulation, rngUni, 3*mT_eV)
{
calc_values(); // need to call here, because, constructor can't call pure virtual function
}
double T3Ie_Recombination::get_microSigma_m2(
const double &E_eV)
{
// ion at rest
return Janev_eT3I_Recombination::get_TCS(E_eV);
}
InteractionOut T3Ie_Recombination::do_Interaction (
Particle *interPart)
{
InteractionOut res;
res.set_delete_current(true);
const vec3 pos_m = interPart->get_x_m();
double E_eV = calc_E_eV_from_v_ms(
Population->roll_v_ms(pos_m), me_eV); // should be computed properly using chances.
Population->decrease_denisty(pos_m, E_eV);
GlobalCounter::num_T3I_recombinations += 1;
return res;
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef T3Ie_recombination_h
#define T3Ie_recombination_h
#include "TI_kinetic_base.h"
class T3Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
public:
T3Ie_Recombination(
Population_Base *ePopulation,
UniRNG *rngUni);
InteractionOut do_Interaction (Particle *interPart);
protected:
double get_microSigma_m2(const double &E_eV);
};
#endif /* T3Ie_recombination_h */
-36
View File
@@ -1,36 +0,0 @@
//
// T5IT2_elastic.h
// mc_electron
//
// Created by Christian Reiling on 16.09.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T5IT2_elastic_h
#define T5IT2_elastic_h
#include "TI_thermal_binary_base.h"
class T5IT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
Tabata_T3IT2_Elastic tcs_gen; // Obviously wrong, but should be good enough.
Elastic_Kinematic_Base kinematics;
public:
T5IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 5*mT_eV), kinematics(5*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 tcs_gen.get_TCS(E_eV);}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut T5IT2_Elastic::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 /* T5IT2_elastic_h */
-41
View File
@@ -1,41 +0,0 @@
//
// T5Ie_recombination.h
// mc_electron
//
// Created by Christian Reiling on 16.09.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T5Ie_recombination_h
#define T5Ie_recombination_h
#include "TI_kinetic_base.h"
#include "petterson_eT5I_recombination.h"
class T5Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
public:
T5Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Precomputed_Interaction_Base(ePopulation, rngUni, 5*mT_eV) {
calc_values(); // need to call here, because, constructor can't call pure virtual function
}
InteractionOut do_Interaction (Particle *interPart);
protected:
double get_microSigma_m2(const double &E_eV) {
return Pettersson_eT5I_Recombination::get_TCS(E_eV);
}
};
inline InteractionOut T5Ie_Recombination::do_Interaction (Particle *interPart) {
InteractionOut res;
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.
Population->decrease_denisty(interPart->get_x_m(), E_eV);
return res;
}
#endif /* T5Ie_recombination_h */
-50
View File
@@ -1,50 +0,0 @@
#include "TIT2_elastic.h"
#include "katrin_fields.hpp"
TIT2_Elastic::TIT2_Elastic(
Population_Base *T2Population,
UniRNG *rngUni)
: TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV),
kinematics(mT_eV, 2*mT_eV)
{
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double TIT2_Elastic::get_microSigma_m2(const double &E_eV)
{
return tcs_gen.get_TCS(E_eV);
}
InteractionOut TIT2_Elastic::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();
}
-20
View File
@@ -1,20 +0,0 @@
#ifndef TIT2_elastic_h
#define TIT2_elastic_h
#include "TI_thermal_binary_base.h"
#include "tabata_TIT2_elastic.h"
#include "kinematics_base.h"
class TIT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
Tabata_TIT2_Elastic tcs_gen;
Elastic_Kinematic_Base kinematics;
public:
TIT2_Elastic(Population_Base *T2Population, UniRNG *rngUni);
double get_microSigma_m2(const double &E_eV);
InteractionOut do_Interaction (Particle *interPart);
};
#endif /* TIT2_elastic_h */
-40
View File
@@ -1,40 +0,0 @@
//
// TIT2_radasc.h
// mc_electron
//
// Created by Christian Reiling on 08.10.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TIT2_radasc_h
#define TIT2_radasc_h
#include "TI_rate_base.h"
class TIT2_RadAsc : public TI_thermal_Rate_Precomputed_Interaction_Base {
public:
TIT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Precomputed_Interaction_Base(T2Population, rngUni, 1) {
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double get_microSigma_m2(const double &E_eV) {
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
return 5e-23/v_ms; // CS from Plasil:2012
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut TIT2_RadAsc::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v_ms = interPart->get_v_ms();
Particle T3INew = Particle_Builder::create_T3I(loc_m, v_ms, -1, interPart->get_Id());
InterOut.add_new_particle(T3INew);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* TIT2_radasc_h */
-40
View File
@@ -1,40 +0,0 @@
//
// TIT2_terasc.h
// mc_electron
//
// Created by Christian Reiling on 08.10.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TIT2_terasc_h
#define TIT2_terasc_h
#include "TI_rate_base.h"
class TIT2_TerAsc : public TI_thermal_Rate_Precomputed_Interaction_Base {
public:
TIT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Rate_Precomputed_Interaction_Base(T2Population, rngUni, 2) {
calc_values(); // need to call here, because, constructor can't call pure virtual function
};
double get_microSigma_m2(const double &E_eV) {
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
return 2.6e-41/v_ms; // CS from Plasil:2012
}
InteractionOut do_Interaction (Particle *interPart);
};
inline InteractionOut TIT2_TerAsc::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v_ms = interPart->get_v_ms();
Particle T3INew = Particle_Builder::create_T3I(loc_m, v_ms, -1, interPart->get_Id());
InterOut.add_new_particle(T3INew);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* TIT2_terasc_h */
-117
View File
@@ -1,117 +0,0 @@
#include "TI_kinetic_base.h"
#include "kinematics.h"
TI_e_Interaction_Base::TI_e_Interaction_Base(
Population_Base *Population,
UniRNG *rngUni, double m_eV) :
Interaction_Base(Population, rngUni)
{
m1_eV = Population->get_m_eV();
m2_eV = m_eV;
num_Ee_bins = Population->get_number_E_bins();
if (num_Ee_bins <= 1) {
throw MyException("Population is not kinetic, when expected kinetic.");
}
ve_mids = new double[num_Ee_bins];
Ee_mids = new double[num_Ee_bins];
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
Ee_mids[Ee_bin] = Population->get_E_bin_mid_eV(Ee_bin);
ve_mids[Ee_bin] = calc_v_ms_from_E_eV(Ee_mids[Ee_bin], m1_eV);
}
}
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());
}
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);
double macro_sigma_m = 0;
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);
}
return macro_sigma_m;
}
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
double v1_ms = ve_mids[Ee_bin]; // electron velocity
double v2_ms = calc_v_ms_from_E_eV(E2_eV, m2_eV); // ion velocity
if (v1_ms > v2_ms*2000 ) { // 2000 represents 1% variation in energy
return get_microSigma_m2(Ee_mids[Ee_bin]);
} else {
auto integrand = [&](double theta) {
const double E_kin_incident =
kineticEnergyIncidentRelativistic(v1_ms, v2_ms, m1_eV, m2_eV, theta);
// frame where ion (m2_eV) is at rest
return get_microSigma_m2(E_kin_incident);
};
return integrate(integrand, pi/8., 7*pi/8., INT_N, simpson())/(6./8.*pi);
}
}
TI_e_Precomputed_Interaction_Base::TI_e_Precomputed_Interaction_Base(
Population_Base *Population,
UniRNG *rngUni,
double m_eV) :
TI_e_Interaction_Base(Population, rngUni, m_eV),
E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N)
{
precomputed_values = new double *[E_scale.get_number_bins()];
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
precomputed_values[EI_bin] = new double[num_Ee_bins];
}
}
void TI_e_Precomputed_Interaction_Base::calc_values()
{
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
precomputed_values[EI_bin][Ee_bin] = calc_microSigma_m2(E_scale.get_bin_mid(EI_bin), Ee_bin);
}
}
}
double TI_e_Precomputed_Interaction_Base::get_macro_sigma_m(
const Particle &interPart)
{
vec3 loc_m = interPart.get_x_m();
double E_eV = interPart.get_E_eV();
if (E_scale.in_scale(E_eV)) {
return lookup_macro_sigma_m(E_eV, loc_m);
} else {
return calc_macro_sigma_m(E_eV, loc_m);
}
}
double TI_e_Precomputed_Interaction_Base::lookup_macro_sigma_m(
const double &E_eV, const vec3 &loc_m)
{
int EI_bin = E_scale.calc_index(E_eV);
double *microSigmas = precomputed_values[EI_bin];
Bins loc_bins = Population->get_loc_bin(loc_m);
double macro_sigma_m = 0;
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
macro_sigma_m += microSigmas[Ee_bin]
* Population->get_density_m3(Ee_bin, loc_bins);
}
return macro_sigma_m;
}
-48
View File
@@ -1,48 +0,0 @@
#ifndef TI_kinetic_base_h
#define TI_kinetic_base_h
#include "interaction_base.h"
// Interactions of ions with kinetic e Populations
class TI_e_Interaction_Base : public Interaction_Base {
public:
TI_e_Interaction_Base(
Population_Base *Population,
UniRNG *rngUni,
double m_eV);
double get_macro_sigma_m(const Particle &interPart);
protected:
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
double calc_microSigma_m2(const double &E1_eV, const int &Ee_bin);
double m1_eV; // energy of kinetic particle for CS measurement : e-
double m2_eV; // energy of massic initial particle : TI
int num_Ee_bins; // number of Ee_bins in Populations
double *Ee_mids; // values for energy mids of Ee_bins in Populations
double *ve_mids; // corresponding v_values
private:
virtual double get_microSigma_m2(const double &E_eV) = 0;
};
// Precompute Interactions of ions with kinetic e Populations
class TI_e_Precomputed_Interaction_Base : public TI_e_Interaction_Base {
public:
TI_e_Precomputed_Interaction_Base(
Population_Base *Population,
UniRNG *rngUni,
double m_eV);
void calc_values();
double get_macro_sigma_m(const Particle &interPart);
private:
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
Log_Scale E_scale; // E_scale for Interpolation calculation
double **precomputed_values;
};
#endif /* TI_kinetic_base_h */
-80
View File
@@ -1,80 +0,0 @@
//
// TI_rate_base.h
// mc_electron
//
// Created by Christian Reiling on 20.11.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TI_rate_base_h
#define TI_rate_base_h
#include "interaction_base.h"
class TI_thermal_Rate_Interaction_Base : public Interaction_Base { // Binary interactions of tritium ions with thermal Populations
protected:
int n;
double m1_eV; // energy of kinetic particle for CS measurement : tritium ion
public:
TI_thermal_Rate_Interaction_Base(Population_Base *Population, UniRNG *rngUni, int n) : Interaction_Base(Population, rngUni) {
this-> n = n;
}
double get_macro_sigma_m(const Particle &interPart);
protected:
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
double calc_microSigma_m2(const double &E_eV);
private:
virtual double get_microSigma_m2(const double &E_eV) = 0;
};
inline double TI_thermal_Rate_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
return calc_macro_sigma_m(interPart.get_E_eV(), interPart.get_x_m());
}
double TI_thermal_Rate_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
return calc_microSigma_m2(E_eV) * pow (Population->get_density_m3(loc_m), n);
}
double TI_thermal_Rate_Interaction_Base::calc_microSigma_m2(const double &E_eV) {
return get_microSigma_m2(E_eV);
}
class TI_thermal_Rate_Precomputed_Interaction_Base : public TI_thermal_Rate_Interaction_Base { // + Using precomputed values
Log_Scale E_scale; // E_scale for Interpolation calculation
double *precomputed_values;
public:
TI_thermal_Rate_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_thermal_Rate_Interaction_Base(Population, rngUni, m_eV), E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N) {
precomputed_values = new double [E_scale.get_number_bins()];
}
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
double get_macro_sigma_m(const Particle &interPart);
private:
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
};
inline void TI_thermal_Rate_Precomputed_Interaction_Base::calc_values() {
for (int i=0; i<E_scale.get_number_bins(); i++) {
precomputed_values[i] = calc_microSigma_m2(E_scale.get_bin_mid(i));
}
}
inline double TI_thermal_Rate_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
vec3 loc_m = interPart.get_x_m();
double E_eV = interPart.get_E_eV();
if (E_scale.in_scale(E_eV)) {
return lookup_macro_sigma_m(E_eV, loc_m);
} else {
return calc_macro_sigma_m(E_eV, loc_m);
}
}
inline double TI_thermal_Rate_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
int i = E_scale.calc_index(E_eV);
return precomputed_values[i] * pow(Population->get_density_m3(loc_m), n);
}
#endif /* TI_rate_base_h */
-104
View File
@@ -1,104 +0,0 @@
//
// TI_thermal_binary_base.h
// mc_electron
//
// Created by Christian Reiling on 18.11.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TI_thermal_binary_base_h
#define TI_thermal_binary_base_h
#include "interaction_base.h"
class TI_thermal_binary_Interaction_Base : public Interaction_Base { // Binary interactions of tritium ions with thermal Populations
protected:
double m1_eV; // energy of kinetic particle for CS measurement : tritium ion
double v_therm; // typical speed for thermal population
public:
TI_thermal_binary_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
if (Population->get_number_E_bins() > 1) {
throw MyException("Population is not thermal, when expected thermal.");
}
m1_eV = m_eV;
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
}
double get_macro_sigma_m(const Particle &interPart);
protected:
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
double calc_microSigma_m2(const double &E_eV);
private:
virtual double get_microSigma_m2(const double &E_eV) = 0;
};
inline double TI_thermal_binary_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
vec3 loc_m = interPart.get_x_m();
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
return calc_macro_sigma_m(E_eV, loc_m);
}
inline double TI_thermal_binary_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m);
}
inline double TI_thermal_binary_Interaction_Base::calc_microSigma_m2(const double &E_eV) {
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
// Integration over theta and v
auto integrand = [&](double v2_ms, 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 Population->get_v_pdf(v2_ms)*get_microSigma_m2(E_eV)/pi;
};
return double_simpson_integrate(integrand, 0., 3*v_therm, pi/8., 7.*pi/8., INT_N, INT_N); // 3*v_therm equals 99% of the integral
/* // Integration over theta
auto integrand = [&](double theta) {
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
return get_microSigma_m2(E_eV);
};
return integrate(integrand, 0., pi, INT_N, simpson())/pi;
*/
}
class TI_thermal_binary_Precomputed_Interaction_Base : public TI_thermal_binary_Interaction_Base { // Precomputed Interactions of electrons with thermal Populations
Log_Scale E_scale; // E_scale for Interpolation calculation
double *precomputed_values;
public:
TI_thermal_binary_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_thermal_binary_Interaction_Base(Population, rngUni, m_eV), E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N) {
precomputed_values = new double [E_scale.get_number_bins()];
}
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
double get_macro_sigma_m(const Particle &interPart);
private:
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
};
inline void TI_thermal_binary_Precomputed_Interaction_Base::calc_values() {
for (int i=0; i<E_scale.get_number_bins(); i++) {
precomputed_values[i] = calc_microSigma_m2(E_scale.get_bin_mid(i));
}
}
inline double TI_thermal_binary_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
vec3 loc_m = interPart.get_x_m();
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
if (E_scale.in_scale(E_eV)) {
return lookup_macro_sigma_m(E_eV, loc_m);
} else {
return calc_macro_sigma_m(E_eV, loc_m);
}
}
inline double TI_thermal_binary_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
int i = E_scale.calc_index(E_eV);
return precomputed_values[i] * Population->get_density_m3(loc_m);
}
#endif /* TI_thermal_binary_base_h */
-93
View File
@@ -1,93 +0,0 @@
//
// TI_thermal_tenary_base.h
// mc_electron
//
// Created by Christian Reiling on 18.11.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TI_thermal_tenary_base_h
#define TI_thermal_tenary_base_h
#include "interaction_base.h"
class TI_thermal_tenary_Interaction_Base : public Interaction_Base { // Tenary interactions of tritium ions with thermal Populations
protected:
double m1_eV; // energy of kinetic particle for CS measurement : tritum ion
double v_therm; // typical spped for thermal population
public:
TI_thermal_tenary_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
if (Population->get_number_E_bins() > 1) {
throw MyException("Population is not thermal, when expected thermal.");
}
m1_eV = m_eV;
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
}
double get_macro_sigma_m(const Particle &interPart);
protected:
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
double calc_microSigma_divbyn_m2(const double &E_eV);
private:
virtual double get_microSigma_m2(const double &E_eV) = 0;
};
inline double TI_thermal_tenary_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
vec3 loc_m = interPart.get_x_m();
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
return calc_macro_sigma_m(E_eV, loc_m);
}
inline double TI_thermal_tenary_Interaction_Base::calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
return calc_microSigma_divbyn_m2(E_eV)*pow(Population->get_density_m3(loc_m), 2);
}
inline double TI_thermal_tenary_Interaction_Base::calc_microSigma_divbyn_m2(const double &E_eV) {
double v1_ms = calc_v_ms_from_E_eV(E_eV, m1_eV);
auto integrand = [&](double theta) {
double E_eV = m1_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
return get_microSigma_m2(E_eV);
};
return integrate(integrand, pi/8., 7.*pi/8., INT_N, simpson())/pi;
}
class TI_thermal_tenary_Precomputed_Interaction_Base : public TI_thermal_tenary_Interaction_Base { // Precomputed Interactions of electrons with thermal Populations
Log_Scale E_scale; // E_scale for Interpolation calculation
double *precomputed_values;
public:
TI_thermal_tenary_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_thermal_tenary_Interaction_Base(Population, rngUni, m_eV), E_scale(INT_PRE_START, INT_PRE_END, INT_PRE_N) {
precomputed_values = new double [E_scale.get_number_bins()];
}
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
double get_macro_sigma_m(const Particle &interPart);
private:
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
};
inline void TI_thermal_tenary_Precomputed_Interaction_Base::calc_values() {
for (int i=0; i<E_scale.get_number_bins(); i++) {
precomputed_values[i] = calc_microSigma_divbyn_m2(E_scale.get_bin_mid(i));
}
}
inline double TI_thermal_tenary_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
vec3 loc_m = interPart.get_x_m();
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
if (E_scale.in_scale(E_eV)) {
return lookup_macro_sigma_m(E_eV, loc_m);
} else {
return calc_macro_sigma_m(E_eV, loc_m);
}
}
inline double TI_thermal_tenary_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
int i = E_scale.calc_index(E_eV);
return precomputed_values[i] * pow(Population->get_density_m3(loc_m),2);
}
#endif /* TI_thermal_tenary_base_h */
-131
View File
@@ -1,131 +0,0 @@
//
// asci_logger.cpp
// mc_electron
//
// Created by Christian Reiling on 06.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#include "asci_logger.hpp"
#include <sstream>
#include "error_types.h"
using namespace std;
// Redundant Code with h5, but ASCI Logger is kept in code as relict.
const int ASCI_Logger::numberZBins = load_parameter("LOG_BARS");
ASCI_Logger::ASCI_Logger() {
if (numberZBins == 0) {
logging = false;
} else if (numberZBins == -1 || numberZBins > 0) {
logging = true;
set_zLogValues();
print_logInfo();
set_outdirName();
create_outdir();
set_outStream();
} else {
stringstream ss;
ss<<"H5_Logger::Parameter numberZBins invalid value.\nnumberZBins:\t"<<numberZBins<<"\n";
throw MyException (ss.str());
}
}
void ASCI_Logger::set_zLogValues() {
zLogValues.clear();
if (logging) {
double start_m = z_RW_m;
double length_m = z_DPS_m - start_m;
double stepLength_m = length_m/(numberZBins-1);
double z_m;
for (int i = 0;i<numberZBins;i++) {
z_m = z_RW_m + stepLength_m*i;
zLogValues.push_back(z_m);
}
}
}
void ASCI_Logger::print_logInfo() {
stringstream ss;
ss<<"Logger\t ";
if (!logging) {
ss<<"Logging disabled.\n";
} else if (numberZBins == -1) {
ss<<"Logging after every Interaction to one file.\n";
} else if (numberZBins == 1) {
ss<<"Only Logging Rearwall Output.\n";
} else {
ss<<"Logging at "<<numberZBins<<" z values.\n";
}
cout<<ss.str();
}
void ASCI_Logger::log_Particle(Particle *logPart, blitz::TinyVector<double,3> oldLoc_m) {
if (!logging) {
return;
}
if (logPart->get_species() != electron) {
return;
}
// Assumption: no change of sign in v_z
if (numberZBins == -1) {
outStream[0]<<*logPart<<endl;
} else {
double zold = oldLoc_m[2];
double znew = logPart->get_x_m()[2];
double zmin = min(zold,znew);
double zmax = max(zold,znew);
for (int i=0;i<numberZBins;i++) {
if (zLogValues[i]>=zmin && zLogValues[i]<=zmax) {
outStream[i]<<*logPart<<endl; // Location wrong, because it s the new Location.
}
}
}
}
void ASCI_Logger::set_outdirName() {
string parname = get_parameter_filenamepath();
stringstream dirname;
int i = 1;
do {
dirname.str(std::string());
dirname << parname << "_" << get_time_string() << "_" << i++;
} while ( is_dir(dirname.str()) );
outdirName = dirname.str();
return;
}
void ASCI_Logger::create_outdir() {
if (mkdir(outdirName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) {
stringstream ss;
ss<<"ASCI_Logger::create_outdir: Could not create output directiory.\n outdirName = "<<outdirName<<endl;
throw MyException(ss.str());
}
return;
}
void ASCI_Logger::set_outStream() {
if (numberZBins == -1) {
outStream = new ofstream [1];
stringstream ss;
ss <<outdirName << "/all" << ".dat";
outStream[0].open(ss.str().c_str());
} else {
outStream = new ofstream [numberZBins];
for (int i = 0; i < numberZBins; i++)
{
stringstream ss;
ss << outdirName << "/z=" << zLogValues[i] << ".dat";
outStream[i].open(ss.str().c_str());
}
}
}
-41
View File
@@ -1,41 +0,0 @@
//
// asci_logger.hpp
// mc_electron
//
// Created by Christian Reiling on 06.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef asci_logger_hpp
#define asci_logger_hpp
#include <vector>
#include "particle.hpp"
#include "read_system.h"
class ASCI_Logger {
static const int numberZBins;
bool logging;
std::vector<double> zLogValues;
std::string outdirName;
std::ofstream *outStream;
public:
ASCI_Logger();
private:
void set_zLogValues();
void print_logInfo();
void set_outdirName();
void create_outdir();
void set_outStream();
public:
void log_Particle(Particle *inPart , vec3 oldLoc_m);
};
#endif /* asci_logger_hpp */
-86
View File
@@ -1,86 +0,0 @@
//
// average_container.h
// mc_electron
//
// Created by Christian Reiling on 10.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef average_container_h
#define average_container_h
#include "edge_container.h"
template <class T_Map>
class Average_Container : public Base_Container<T_Map> {
public:
Average_Container() : Base_Container<T_Map>() {}
Average_Container(std::string load_path) : Base_Container<T_Map>(load_path) {}
Average_Container(const Edge_Container<T_Map> &edgeContainer) {calcMap(edgeContainer);};
public:
void calcMap(const Edge_Container<T_Map> &edgeContainer);
private:
void rec_calcMap(const double &subMap, std::deque<double> Points);
template <typename T> void rec_calcMap(const T &subMapm, std::deque<double> Points);
public:
double get_value(std::deque<double> point);
};
template <class T_Map>
void Average_Container<T_Map>::calcMap(const Edge_Container<T_Map> &edgeContainer) {
T_Map edgeMap = edgeContainer.getMap();
if (edgeMap.empty()) {
std::stringstream ss;
ss<<"Average_Container::calcMap: Input Edge_Container empty.\n";
throw MyException(ss.str());
}
Base_Container<T_Map>::Map.clear();
std::deque<double> Points;
rec_calcMap(edgeMap, Points);
}
template <class T_Map>
void Average_Container<T_Map>::rec_calcMap(const double &subMap, std::deque<double> Points) {
Points.push_back(subMap);
Base_Container<T_Map>::addPoint(Points);
}
template <class T_Map>
template <typename T>
void Average_Container<T_Map>::rec_calcMap(const T &subMap, std::deque<double> Points) {
double curVal, nextVal, avgVal;
typename T::const_iterator curitr, nextitr;
for (nextitr = ++(subMap.cbegin()); nextitr!= subMap.cend(); nextitr++) {
curitr = nextitr;
--curitr;
curVal = curitr->first;
nextVal = nextitr->first;
avgVal = curVal + (nextVal-curVal)/2;
Points.push_back(avgVal);
rec_calcMap(curitr->second, Points);
Points.pop_back();
}
// insert last point as overflow value
curitr = (--subMap.cend());
Points.push_back(curitr->first);
rec_calcMap(curitr->second, Points);
}
template <class T_Map>
double Average_Container<T_Map>::get_value(std::deque <double> Point) {
Base_Container<T_Map>::checkEmpty();
if (Base_Container<T_Map>::Dim != Point.size()) {
std::stringstream ss;
ss<<"EdgeBase_Container::interpolate: deque point dimension missmatch.\n";
throw MyException(ss.str());
}
return Base_Container<T_Map>::get_value(Point, Lower_bound_Over);
}
#endif /* average_container_h */
-321
View File
@@ -1,321 +0,0 @@
//
// base_container.h
// mc_electron
//
// Created by Christian Reiling on 10.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef base_container_h
#define base_container_h
#include <string>
#include <map>
#include <fstream>
#include <sstream>
#include <deque>
#include "blitz/tinyvec2.h"
#include "blitz/array.h"
#include "error_types.h"
#include "read_system.h"
#include "constants.h"
typedef std::deque<double> ddeque;
typedef blitz::TinyVector<double,3> vec3;
typedef std::map<double,double> dim1Map;
typedef std::map<double,dim1Map> dim2Map;
typedef std::map<double,dim2Map> dim3Map;
typedef std::map<double,dim3Map> dim4Map;
enum searchStyle {Find, Lower_bound, Lower_bound_Over};
template <class T_Map>
class Base_Container {
protected:
T_Map Map;
int Dim;
public:
Base_Container() {
Dim = calc_Dim<T_Map>();
}
Base_Container(std::string load_path) {
Dim = calc_Dim<T_Map>();
importFromCSV(load_path);
}
protected:
template <typename T> double calc_Dim();
private:
void inc_Count(dim1Map *subMap, int *count) ;
template <typename T> void inc_Count(std::map<double,T> *subMap, int *count);
public:
void importFromCSV(std::string load_path);
private:
void addPointFromLine(const std::string &csv_line);
public:
void addPoint(std::deque<double> pointIn);
private:
void rec_addPoint(std::map<double,double> *subMap, std::deque<double> pointIn);
template <typename T> void rec_addPoint (std::map<double,T> *subMap, std::deque<double> pointIn);
public:
void exportToCSV(std::string export_path) ;
private:
std::string getExportFileHeader() ;
void rec_exportToCSV (const dim1Map &subMap, std::ofstream &exportStream, std::string preset = "") ;
template <typename T> void rec_exportToCSV(const T &subMap, std::ofstream &exportStream, std::string preset = "") ;
protected:
double get_value(std::deque<double> Points, searchStyle searchMode) ;
template <typename T_target> T_target* getSubMap(std::deque<double> Points, searchStyle searchMode) ;
private:
template <typename T_target> void rec_getSubMap(T_target *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) ;
template <typename T_target, typename T> void rec_getSubMap(T *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) ;
template <class T> typename T::iterator searchitrByStyle(T *subMap, double x, searchStyle searchMode) ;
protected:
void checkEmpty() ;
public:
T_Map getMap() const {return Map;}
};
template <class T_Map>
template <typename T>
double Base_Container<T_Map>::calc_Dim() {
T dummyMap;
int count = 0;
inc_Count(&dummyMap, &count);
return count;
}
template <class T_Map>
void Base_Container<T_Map>::inc_Count(dim1Map *subMap, int *count) {
++(*count);
subMap->insert(std::pair<double,double>(0,0));
}
template <class T_Map>
template <typename T>
void Base_Container<T_Map>::inc_Count(std::map<double,T> *subMap, int *count) {
++(*count);
T tempMap;
inc_Count(&tempMap, count);
subMap->insert(std::pair<double,T>(0,tempMap));
}
template <class T_Map>
void Base_Container<T_Map>::importFromCSV(std::string load_path) {
std::ifstream importStream(load_path);
if (!importStream.good()) {
std::stringstream ss;
ss<<"Base_Container::readFromCSV: Could not open file. \n loadFilePath= "<<load_path<<"\n";
throw MyException(ss.str());
}
std::string csv_line;
while (getline(importStream, csv_line)) {
remove_leading_whites(csv_line);
replace_delimiter(csv_line);
if ( check_ignore_line(csv_line) ) {
continue;
}
addPointFromLine(csv_line);
}
importStream.close();
}
template <class T_Map>
void Base_Container<T_Map>::addPointFromLine(const std::string &csv_line) {
std::stringstream ss;
ss.str(csv_line);
std::deque<double> dequeTemp;
double tempVal;
for (int i = 0;i<=Dim;i++) {
if (ss>>tempVal) {
dequeTemp.push_back(tempVal);
} else {
std::cout<<"Base_Container::addPointFromFile: Warning could not read line in inputFile. \nloadFilePath\t"<<csv_line<<"\n";
}
}
addPoint(dequeTemp);
}
template <class T_Map>
void Base_Container<T_Map>::addPoint(std::deque<double> pointIn) {
if (pointIn.size() != Dim+1) {
std::stringstream ss;
ss<<"Base_Container::addPoint: deque pointIn dimension missmatch.\n";
for (std::deque<double>::iterator itr = pointIn.begin(); itr!=pointIn.end(); itr++) {
std::cout<<*itr<<"\n";
}
throw MyException(ss.str());
}
rec_addPoint(&Map, pointIn);
}
template <class T_Map>
void Base_Container<T_Map>::rec_addPoint(dim1Map *subMap, std::deque<double> pointIn) { //Iteration End
if (pointIn.size()!=2) {
std::stringstream ss;
ss<<"Base_Container::addPoint: Dimension missmatch of pointIn.\nDelta =\t"<<pointIn.size()-2<<"\n";
throw MyException(ss.str());
}
double x = pointIn[0];
double f = pointIn[1];
if (subMap->find(x) != subMap->end()) {
std::stringstream ss;
ss<<"Base_Container::addPoint: Dublicate insertion of key.\n";
throw MyException(ss.str());
}
subMap->insert(std::pair<double,double>(x, f));
}
template <class T_Map>
template <typename T>
void Base_Container<T_Map>::rec_addPoint (std::map<double,T> *subMap, std::deque<double> pointIn) {
double x = *pointIn.begin();
pointIn.pop_front();
if (subMap->find(x) == subMap->end()) { // No such element -> generate new Map and insert
T tempMap;
rec_addPoint(&tempMap, pointIn);
subMap->insert(std::pair<double,T>(x,tempMap));
} else { // Found such element -> Insert to existing map using iteration
rec_addPoint(&subMap->find(x)->second, pointIn);
}
}
template <class T_Map>
void Base_Container<T_Map>::exportToCSV(std::string export_path) {
checkEmpty();
std::ofstream exportStream(export_path);
if (!exportStream.good()) {
std::stringstream ss;
ss<<"Base_Container::exportToCSV: Could not open file.\nexportFilePath\t "<<export_path<<"\n";
throw MyException(ss.str());
}
exportStream<<getExportFileHeader();
rec_exportToCSV(Map, exportStream, "");
exportStream.close();
}
template <class T_Map>
std::string Base_Container<T_Map>::getExportFileHeader() {
std::stringstream ss;
ss<<"# Automatically generated Data of Function2D_Container class by exportToFile().\n";
ss<<"# Generated on "<<get_time_string()<<".\n";
ss<<"#key1 (usually Energy)\tkey2 (angluar distribution or secondary energy)\tparameter (usually SDCS)\n";
return ss.str();
}
template <class T_Map>
void Base_Container<T_Map>::rec_exportToCSV(const dim1Map &subMap, std::ofstream &exportStream, std::string preset) {
for (dim1Map::const_iterator itr = subMap.cbegin();itr!=subMap.cend();itr++) {
exportStream<<preset<<itr->first<<"\t"<<itr->second<<"\n";
}
}
template <class T_Map>
template <typename T>
void Base_Container<T_Map>::rec_exportToCSV(const T &subMap, std::ofstream &exportStream, std::string preset) {
std::stringstream ss;
for (typename T::const_iterator itr = subMap.cbegin();itr!=subMap.cend();itr++) {
ss.clear();
ss.str("");
ss<<preset<<itr->first<<"\t";
rec_exportToCSV(itr->second, exportStream, ss.str());
}
}
template <class T_Map>
double Base_Container<T_Map>::get_value(std::deque<double> Points, searchStyle searchMode) {
double x = Points.back();
Points.pop_back();
dim1Map *subMap = getSubMap<dim1Map>(Points, searchMode);
dim1Map::const_iterator itr = searchitrByStyle(subMap, x, searchMode);
return itr->second;
}
template <class T_Map>
template <typename T_target>
T_target* Base_Container<T_Map>::getSubMap(std::deque<double> Points, searchStyle searchMode) {
checkEmpty();
double T_Dim = calc_Dim<T_target>();
if (Points.size() != Dim - T_Dim) {
std::stringstream ss;
ss<<"Base_Container::getSubMap: Dimension Missmatch of Points\n Missmatch =\t<< "<<Points.size() - (Dim - T_Dim)<<"\n";
throw MyException(ss.str());
}
T_target *targetMap;
rec_getSubMap(&Map, &targetMap, Points, searchMode);
return targetMap;
}
template <class T_Map>
template <typename T_target>
void Base_Container<T_Map>::rec_getSubMap(T_target *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) {
if (Points.size() != 0) {
std::stringstream ss;
ss<<"Base_Container::get_subitr: Dimension Missmatch of Points\n";
throw MyException(ss.str());
}
*targetMapPtr = subMap;
}
template <class T_Map>
template <typename T_target, typename T>
void Base_Container<T_Map>::rec_getSubMap(T *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) {
double x = Points.front();
Points.pop_front();
typename T::iterator itr = searchitrByStyle(subMap, x, searchMode);
rec_getSubMap(&(itr->second), targetMapPtr, Points, searchMode);
}
template <class T_Map>
template <class T>
typename T::iterator Base_Container<T_Map>::searchitrByStyle(T *subMap, double x, searchStyle searchMode) {
typename T::iterator itr;
if (searchMode == Find) {
itr = subMap->find(x);
} else if (searchMode == Lower_bound) {
itr = subMap->lower_bound(x);
} else if (searchMode == Lower_bound_Over) {
itr = subMap->lower_bound(x);
if (itr == subMap->end()) {
--itr;
}
}
if (itr == subMap->end()) {
std::stringstream ss;
ss<<"Base_Container::calcitr: Point is out of bound.\n";
throw MyException(ss.str());
}
return itr;
}
template <class T_Map>
void Base_Container<T_Map>::checkEmpty() {
if (Map.empty()) {
std::stringstream ss;
ss<<"Base_Conainer::checkEmpty: Map is empty.\n";
throw MyException(ss.str());
}
}
#endif /* base_container_h */
-14687
View File
File diff suppressed because it is too large Load Diff
-72
View File
@@ -1,72 +0,0 @@
//
// constants.h
// mc_electron
//
// Created by Christian Reiling on 08.10.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
//
#ifndef constants_h
#define constants_h
#include "read_system.h"
typedef const double constant;
constant scale_start = 1e-7;
constant scale_end = 2e4;
// Natural Constants
constant pi = 3.1415;
constant c_ms = 299792458;
constant kb_eVK = 8.6173303e-5;
constant e_C = 1.602176462e-19;
constant rBohr_m = 0.52917721067e-10;
constant ERyd_eV = 13.605693009;
// Particle Properties
constant me_eV = 0.511e6;
constant mT_eV = 2.8094320212e9;
constant re_m = 2.817940322719e-15;
constant ZT2 = 2.;
constant EionT2_eV = 15.43;
constant decayConstT2_s = 1.78405e-09;
// Beta Decay
constant BetaDecayConst = 1.2072343416696292e-47;
constant TritiumDecayEndpoint_eV = 18.574e3;
// WGTS
constant r_WGTS_m = 0.045;
constant z_RW_m = 0;
constant z_rear_pp1 = 1.43;
constant z_rear_pp2 = 3;
constant z_front_pp1 = 13;
constant z_front_pp2 = 14.57;
constant z_DPS_m = 16;
constant z_inlet_m = 8;
constant l_WGTS_m = z_DPS_m - z_RW_m;
// from Kuckert:2018aa
constant reduction_RW = 5e-4;
constant reduction_rear_pp1 = 0.002;
constant reduction_rear_pp2 = 0.02;
constant reduction_inlet = 1.0;
constant reduction_front_pp1 = 0.02;
constant reduction_front_pp2 = 0.002;
constant reduction_DPS = 5e-4;
// For interaction integration
const int INT_N = load_parameter("INT_N"); // Number of points for theta integration
const double INT_PRE_START = load_parameter("INT_PRE_START"); // Start energy for precomputed cross sections
const double INT_PRE_END = load_parameter("INT_PRE_END"); // End energy for precomputed cross sections
const int INT_PRE_N = load_parameter("INT_PRE_N"); //Number of points for precomputed cross sections
const int long_move_num_bins = load_parameter("LONG_MOVE_NUM_BINS");
#endif /* constants_h */
-151
View File
@@ -1,151 +0,0 @@
#include "catch.hpp"
#include "CurrentHistogram.h"
#include <string>
#include <vector>
#include <memory>
TEST_CASE("Current Histogram", "[CurrentHistogram]"){
SECTION("Bins are calculated correctly"){
int decade_min = -1;
int decade_max = 0;
int num_bin_z = 2;
int num_bin_r = 2;
double z_min = -3;
double z_max = 10;
double r_max = 0.045;
CurrentHistogram hist(
num_bin_z, z_min, z_max,
num_bin_r, r_max,
decade_min, decade_max);
SECTION("Radial bins outside"){
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(1., 0., 0.))
== 2);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(-1., 0., 0.))
== 2);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0., 1., 0.))
== 2);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(-0., -1., 0.))
== 2);
}
SECTION("Radial bins inside"){
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0.04, 0., 0.))
== 1);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(-0.04, 0., 0.))
== 1);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0., 0.04, 0.))
== 1);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0., -0.04, 0.))
== 1);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0.02, 0., 0.))
== 0);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(-0.02, 0., 0.))
== 0);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0., 0.02, 0.))
== 0);
REQUIRE(hist.findRadialBin(
blitz::TinyVector<double,3>(0., -0.02, 0.))
== 0);
}
SECTION("Longitudinal bins outside"){
REQUIRE(hist.findLongitudinalBin(
blitz::TinyVector<double,3>(0., 0., 13.))
== 2);
REQUIRE(hist.findLongitudinalBin(
blitz::TinyVector<double,3>(0., 0., -4.))
== -1);
}
SECTION("Longitudinal bins inside"){
REQUIRE(hist.findLongitudinalBin(
blitz::TinyVector<double,3>(0.04, 0., -2.9))
== 0);
REQUIRE(hist.findLongitudinalBin(
blitz::TinyVector<double,3>(-0.04, 0., 9.5))
== 1);
}
SECTION("Energy bins outside"){
REQUIRE(hist.findEnergyBin(1E-2) == -1);
REQUIRE(hist.findEnergyBin(1E1) == 9);
}
SECTION("Energy bins at boundary"){
REQUIRE(hist.findEnergyBin(1E-1) == 0);
REQUIRE(hist.findEnergyBin(0.99999999999) == 8);
}
SECTION("Energy bins inside"){
REQUIRE(hist.findEnergyBin(1.1E-1) == 0);
REQUIRE(hist.findEnergyBin(2.2E-1) == 1);
REQUIRE(hist.findEnergyBin(3.9E-1) == 2);
REQUIRE(hist.findEnergyBin(8.5E-1) == 7);
REQUIRE(hist.findEnergyBin(9.5E-1) == 8);
}
}
SECTION("Correct value in array is filled"){
int decade_min = -5;
int decade_max = -4;
int num_bin_z = 2;
int num_bin_r = 2;
double z_min = -3;
double z_max = 10;
double r_max = 0.045;
CurrentHistogram hist(
num_bin_z, z_min, z_max,
num_bin_r, r_max,
decade_min, decade_max);
hist.fill(blitz::TinyVector<double,3>(0.04, 0., 0.5), 3.1E-5);
hist.fill(blitz::TinyVector<double,3>(0.02, 0., 9.5), 4.1E-5);
REQUIRE(hist.hist_data_(1,0,2) == 1);
REQUIRE(hist.hist_data_(0,1,3) == 1);
}
SECTION("Bin Borders"){
int decade_min = -5;
int decade_max = -3;
int num_bin_z = 2;
int num_bin_r = 2;
double z_min = -3;
double z_max = 10;
double r_max = 0.045;
CurrentHistogram hist(
num_bin_z, z_min, z_max,
num_bin_r, r_max,
decade_min, decade_max);
auto e_bins = hist.binBordersE();
REQUIRE(e_bins[0] == Approx(std::pow(10,decade_min)));
REQUIRE(e_bins.back() == Approx(std::pow(10,decade_max)));
auto r_bins = hist.binBordersR();
REQUIRE(r_bins[0] == 0);
REQUIRE(r_bins[1] == r_max/num_bin_r);
REQUIRE(r_bins.back() == r_max);
auto z_bins = hist.binBordersZ();
REQUIRE(z_bins[0] == z_min);
REQUIRE(z_bins[1] == z_min + (z_max-z_min)/num_bin_z);
REQUIRE(z_bins.back() == z_max);
}
}
-50
View File
@@ -1,50 +0,0 @@
#include "catch.hpp"
#include "CurrentHistogram.h"
#include "CurrentLogger.h"
#include "particle.hpp"
#include <string>
#include <vector>
#include <memory>
TEST_CASE("Current Logger", "[CurrentLogger]"){
SECTION("Radial bins are filled"){
int numberZBins = 14;
int numberRBins = 5;
int energy_decade_min = -5;
int energy_decade_max = 4;
CurrentLogger logger(
electron,
numberZBins, z_RW_m, z_DPS_m,
numberRBins, r_WGTS_m,
energy_decade_min, energy_decade_max,
"/home/jonas/new_workspace/Coding/Output/KARL/test/output");
SECTION("Radial bins outside"){
double m_eV = 511E3;
double charge_e = -1*e_C;
vec3 v_ms(0., 0., 1.);
double Id = 1.;
double Pid = 1.;
vec3 old_loc_m(0.04, 0., -3.);
vec3 loc_m(0.04,0.0,-2.5);
Particle particle(m_eV, charge_e, loc_m, v_ms, Id, Pid, electron);
logger.log(particle, old_loc_m);
logger.output();
REQUIRE(true);
}
}
}
TEST_CASE("Code", "[Code]"){
}
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-316
View File
@@ -1,316 +0,0 @@
# Automatically generated Data of Function2D_Container class by exportToFile().
# Generated on 20190408.
#key1 (usually Energy) key2 (angluar distribution or secondary energy) parameter (usually SDCS)
15.0244 0
15.3146 0
15.43 0
15.4934 6.84064e-26
15.7398 8.62796e-23
16.1102 3.30713e-22
16.4893 5.73975e-22
16.8773 8.16127e-22
17.2744 1.05721e-21
17.6809 1.29723e-21
18.0969 1.53617e-21
18.5228 1.77401e-21
18.9586 2.01069e-21
19.4048 2.24613e-21
19.8614 2.48025e-21
20.3287 2.71295e-21
20.8071 2.94411e-21
21.2967 3.17358e-21
21.7978 3.40125e-21
22.3108 3.62695e-21
22.8357 3.85053e-21
23.3731 4.07183e-21
23.9231 4.29068e-21
24.486 4.50692e-21
25.0622 4.72036e-21
25.6519 4.93084e-21
26.2556 5.13818e-21
26.8734 5.34222e-21
27.5057 5.54278e-21
28.153 5.73971e-21
28.8154 5.93285e-21
29.4935 6.12203e-21
30.1875 6.30712e-21
30.8979 6.48797e-21
31.6249 6.66445e-21
32.3691 6.83643e-21
33.1308 7.00379e-21
33.9104 7.16643e-21
34.7083 7.32424e-21
35.525 7.47712e-21
36.361 7.62501e-21
37.2166 7.76781e-21
38.0923 7.90547e-21
38.9887 8.03794e-21
39.9061 8.16515e-21
40.8451 8.28709e-21
41.8063 8.40371e-21
42.79 8.515e-21
43.7969 8.62094e-21
44.8275 8.72154e-21
45.8823 8.81679e-21
46.962 8.90671e-21
48.0671 8.99132e-21
49.1981 9.07064e-21
50.3558 9.14471e-21
51.5407 9.21357e-21
52.7535 9.27726e-21
53.9949 9.33584e-21
55.2654 9.38936e-21
56.5659 9.43789e-21
57.8969 9.48149e-21
59.2593 9.52023e-21
60.6537 9.55419e-21
62.081 9.58346e-21
63.5418 9.6081e-21
65.037 9.62821e-21
66.5674 9.64388e-21
68.1338 9.6552e-21
69.7371 9.66226e-21
71.3781 9.66516e-21
73.0577 9.664e-21
74.7768 9.65887e-21
76.5364 9.64988e-21
78.3373 9.63713e-21
80.1807 9.62072e-21
82.0674 9.60075e-21
83.9986 9.57734e-21
85.9751 9.55058e-21
87.9982 9.52057e-21
90.0689 9.48743e-21
92.1883 9.45125e-21
94.3576 9.41214e-21
96.5779 9.3702e-21
98.8505 9.32554e-21
101.177 9.27826e-21
103.557 9.22845e-21
105.994 9.17623e-21
108.488 9.12168e-21
111.041 9.06491e-21
113.654 9.00602e-21
116.328 8.94509e-21
119.066 8.88223e-21
121.868 8.81752e-21
124.735 8.75106e-21
127.67 8.68294e-21
130.675 8.61325e-21
133.749 8.54207e-21
136.897 8.4695e-21
140.118 8.3956e-21
143.415 8.32047e-21
146.79 8.24419e-21
150.244 8.16682e-21
153.779 8.08846e-21
157.398 8.00918e-21
161.102 7.92904e-21
164.893 7.84812e-21
168.773 7.7665e-21
172.744 7.68422e-21
176.809 7.60137e-21
180.969 7.51801e-21
185.228 7.4342e-21
189.586 7.35e-21
194.048 7.26546e-21
198.614 7.18065e-21
203.287 7.09561e-21
208.071 7.01041e-21
212.967 6.9251e-21
217.978 6.83972e-21
223.108 6.75432e-21
228.357 6.66895e-21
233.731 6.58365e-21
239.231 6.49847e-21
244.86 6.41344e-21
250.622 6.32861e-21
256.519 6.24402e-21
262.556 6.1597e-21
268.734 6.07568e-21
275.057 5.992e-21
281.53 5.9087e-21
288.154 5.8258e-21
294.935 5.74333e-21
301.875 5.66132e-21
308.979 5.5798e-21
316.249 5.49878e-21
323.691 5.41831e-21
331.308 5.33839e-21
339.104 5.25905e-21
347.083 5.1803e-21
355.25 5.10218e-21
363.61 5.02469e-21
372.166 4.94785e-21
380.923 4.87169e-21
389.887 4.7962e-21
399.061 4.72141e-21
408.451 4.64733e-21
418.063 4.57397e-21
427.9 4.50134e-21
437.969 4.42944e-21
448.275 4.3583e-21
458.823 4.28792e-21
469.62 4.2183e-21
480.671 4.14945e-21
491.981 4.08138e-21
503.558 4.01409e-21
515.407 3.94759e-21
527.535 3.88188e-21
539.949 3.81695e-21
552.654 3.75283e-21
565.659 3.6895e-21
578.969 3.62697e-21
592.593 3.56524e-21
606.537 3.5043e-21
620.81 3.44417e-21
635.418 3.38483e-21
650.37 3.32628e-21
665.674 3.26854e-21
681.338 3.21158e-21
697.371 3.15541e-21
713.781 3.10003e-21
730.577 3.04544e-21
747.768 2.99162e-21
765.364 2.93857e-21
783.373 2.8863e-21
801.807 2.8348e-21
820.674 2.78405e-21
839.986 2.73407e-21
859.751 2.68483e-21
879.982 2.63634e-21
900.689 2.58859e-21
921.883 2.54158e-21
943.576 2.49529e-21
965.779 2.44972e-21
988.505 2.40487e-21
1011.77 2.36073e-21
1035.57 2.31728e-21
1059.94 2.27453e-21
1084.88 2.23247e-21
1110.41 2.19109e-21
1136.54 2.15039e-21
1163.28 2.11034e-21
1190.66 2.07096e-21
1218.68 2.03223e-21
1247.35 1.99414e-21
1276.7 1.95669e-21
1306.75 1.91986e-21
1337.49 1.88366e-21
1368.97 1.84807e-21
1401.18 1.81308e-21
1434.15 1.77869e-21
1467.9 1.74489e-21
1502.44 1.71168e-21
1537.79 1.67904e-21
1573.98 1.64696e-21
1611.02 1.61544e-21
1648.93 1.58448e-21
1687.73 1.55406e-21
1727.44 1.52417e-21
1768.09 1.49481e-21
1809.69 1.46598e-21
1852.28 1.43766e-21
1895.86 1.40984e-21
1940.48 1.38252e-21
1986.14 1.35569e-21
2032.87 1.32935e-21
2080.71 1.30348e-21
2129.67 1.27808e-21
2179.78 1.25314e-21
2231.08 1.22866e-21
2283.57 1.20462e-21
2337.31 1.18103e-21
2392.31 1.15787e-21
2448.6 1.13513e-21
2506.22 1.11282e-21
2565.19 1.09091e-21
2625.56 1.06942e-21
2687.34 1.04832e-21
2750.57 1.02762e-21
2815.3 1.0073e-21
2881.54 9.87368e-22
2949.35 9.67807e-22
3018.75 9.48613e-22
3089.79 9.29781e-22
3162.49 9.11304e-22
3236.91 8.93177e-22
3313.08 8.75393e-22
3391.04 8.57947e-22
3470.83 8.40833e-22
3552.5 8.24044e-22
3636.1 8.07576e-22
3721.66 7.91423e-22
3809.23 7.75579e-22
3898.87 7.6004e-22
3990.61 7.44798e-22
4084.51 7.2985e-22
4180.63 7.1519e-22
4279 7.00814e-22
4379.69 6.86715e-22
4482.75 6.72889e-22
4588.23 6.59331e-22
4696.2 6.46036e-22
4806.71 6.33e-22
4919.81 6.20217e-22
5035.58 6.07684e-22
5154.07 5.95395e-22
5275.35 5.83347e-22
5399.49 5.71534e-22
5526.54 5.59953e-22
5656.59 5.48599e-22
5789.69 5.37468e-22
5925.93 5.26555e-22
6065.37 5.15858e-22
6208.1 5.05371e-22
6354.18 4.95092e-22
6503.7 4.85015e-22
6656.74 4.75138e-22
6813.38 4.65456e-22
6973.71 4.55966e-22
7137.81 4.46664e-22
7305.77 4.37547e-22
7477.68 4.28611e-22
7653.64 4.19852e-22
7833.73 4.11268e-22
8018.07 4.02855e-22
8206.74 3.9461e-22
8399.86 3.8653e-22
8597.51 3.78611e-22
8799.82 3.7085e-22
9006.89 3.63245e-22
9218.83 3.55792e-22
9435.76 3.48488e-22
9657.79 3.41331e-22
9885.05 3.34318e-22
10117.7 3.27445e-22
10355.7 3.20711e-22
10599.4 3.14112e-22
10848.8 3.07646e-22
11104.1 3.01311e-22
11365.4 2.95103e-22
11632.8 2.89021e-22
11906.6 2.83061e-22
12186.8 2.77222e-22
12473.5 2.71501e-22
12767 2.65896e-22
13067.5 2.60405e-22
13374.9 2.55024e-22
13689.7 2.49753e-22
14011.8 2.44589e-22
14341.5 2.39529e-22
14679 2.34572e-22
15024.4 2.29717e-22
15377.9 2.24959e-22
15739.8 2.20299e-22
16110.2 2.15734e-22
16489.3 2.11261e-22
16877.3 2.0688e-22
17274.4 2.02588e-22
17680.9 1.98384e-22
18096.9 1.94265e-22
18522.8 1.90231e-22
18958.6 1.86279e-22
19404.8 1.82408e-22
19861.4 1.78617e-22
20092.3 1.74902e-22
File diff suppressed because it is too large Load Diff
-316
View File
@@ -1,316 +0,0 @@
# Automatically generated Data of Function2D_Container class by exportToFile().
# Generated on 20190408.
#key1 (usually Energy) key2 (angluar distribution or secondary energy) parameter (usually SDCS)
14.8497 0
15.1991 0
15.43 0
15.4301 6.84064e-26
15.5568 8.62796e-23
15.9228 3.30713e-22
16.2975 5.73975e-22
16.681 8.16127e-22
17.0735 1.05721e-21
17.4753 1.29723e-21
17.8865 1.53617e-21
18.3074 1.77401e-21
18.7382 2.01069e-21
19.1791 2.24613e-21
19.6304 2.48025e-21
20.0923 2.71295e-21
20.5651 2.94411e-21
21.049 3.17358e-21
21.5443 3.40125e-21
22.0513 3.62695e-21
22.5702 3.85053e-21
23.1013 4.07183e-21
23.6449 4.29068e-21
24.2013 4.50692e-21
24.7708 4.72036e-21
25.3536 4.93084e-21
25.9502 5.13818e-21
26.5609 5.34222e-21
27.1859 5.54278e-21
27.8256 5.73971e-21
28.4804 5.93285e-21
29.1505 6.12203e-21
29.8365 6.30712e-21
30.5386 6.48797e-21
31.2572 6.66445e-21
31.9927 6.83643e-21
32.7455 7.00379e-21
33.516 7.16643e-21
34.3047 7.32424e-21
35.1119 7.47712e-21
35.9381 7.62501e-21
36.7838 7.76781e-21
37.6494 7.90547e-21
38.5353 8.03794e-21
39.4421 8.16515e-21
40.3702 8.28709e-21
41.3201 8.40371e-21
42.2924 8.515e-21
43.2876 8.62094e-21
44.3062 8.72154e-21
45.3488 8.81679e-21
46.4159 8.90671e-21
47.5081 8.99132e-21
48.626 9.07064e-21
49.7702 9.14471e-21
50.9414 9.21357e-21
52.1401 9.27726e-21
53.367 9.33584e-21
54.6228 9.38936e-21
55.9081 9.43789e-21
57.2237 9.48149e-21
58.5702 9.52023e-21
59.9484 9.55419e-21
61.3591 9.58346e-21
62.8029 9.6081e-21
64.2807 9.62821e-21
65.7933 9.64388e-21
67.3415 9.6552e-21
68.9261 9.66226e-21
70.548 9.66516e-21
72.2081 9.664e-21
73.9072 9.65887e-21
75.6463 9.64988e-21
77.4264 9.63713e-21
79.2483 9.62072e-21
81.1131 9.60075e-21
83.0218 9.57734e-21
84.9753 9.55058e-21
86.9749 9.52057e-21
89.0215 9.48743e-21
91.1163 9.45125e-21
93.2603 9.41214e-21
95.4548 9.3702e-21
97.701 9.32554e-21
100 9.27826e-21
102.353 9.22845e-21
104.762 9.17623e-21
107.227 9.12168e-21
109.75 9.06491e-21
112.332 9.00602e-21
114.976 8.94509e-21
117.681 8.88223e-21
120.45 8.81752e-21
123.285 8.75106e-21
126.186 8.68294e-21
129.155 8.61325e-21
132.194 8.54207e-21
135.305 8.4695e-21
138.489 8.3956e-21
141.747 8.32047e-21
145.083 8.24419e-21
148.497 8.16682e-21
151.991 8.08846e-21
155.568 8.00918e-21
159.228 7.92904e-21
162.975 7.84812e-21
166.81 7.7665e-21
170.735 7.68422e-21
174.753 7.60137e-21
178.865 7.51801e-21
183.074 7.4342e-21
187.382 7.35e-21
191.791 7.26546e-21
196.304 7.18065e-21
200.923 7.09561e-21
205.651 7.01041e-21
210.49 6.9251e-21
215.443 6.83972e-21
220.513 6.75432e-21
225.702 6.66895e-21
231.013 6.58365e-21
236.449 6.49847e-21
242.013 6.41344e-21
247.708 6.32861e-21
253.536 6.24402e-21
259.502 6.1597e-21
265.609 6.07568e-21
271.859 5.992e-21
278.256 5.9087e-21
284.804 5.8258e-21
291.505 5.74333e-21
298.365 5.66132e-21
305.386 5.5798e-21
312.572 5.49878e-21
319.927 5.41831e-21
327.455 5.33839e-21
335.16 5.25905e-21
343.047 5.1803e-21
351.119 5.10218e-21
359.381 5.02469e-21
367.838 4.94785e-21
376.494 4.87169e-21
385.353 4.7962e-21
394.421 4.72141e-21
403.702 4.64733e-21
413.201 4.57397e-21
422.924 4.50134e-21
432.876 4.42944e-21
443.062 4.3583e-21
453.488 4.28792e-21
464.159 4.2183e-21
475.081 4.14945e-21
486.26 4.08138e-21
497.702 4.01409e-21
509.414 3.94759e-21
521.401 3.88188e-21
533.67 3.81695e-21
546.228 3.75283e-21
559.081 3.6895e-21
572.237 3.62697e-21
585.702 3.56524e-21
599.484 3.5043e-21
613.591 3.44417e-21
628.029 3.38483e-21
642.807 3.32628e-21
657.933 3.26854e-21
673.415 3.21158e-21
689.261 3.15541e-21
705.48 3.10003e-21
722.081 3.04544e-21
739.072 2.99162e-21
756.463 2.93857e-21
774.264 2.8863e-21
792.483 2.8348e-21
811.131 2.78405e-21
830.218 2.73407e-21
849.753 2.68483e-21
869.749 2.63634e-21
890.215 2.58859e-21
911.163 2.54158e-21
932.603 2.49529e-21
954.548 2.44972e-21
977.01 2.40487e-21
1000 2.36073e-21
1023.53 2.31728e-21
1047.62 2.27453e-21
1072.27 2.23247e-21
1097.5 2.19109e-21
1123.32 2.15039e-21
1149.76 2.11034e-21
1176.81 2.07096e-21
1204.5 2.03223e-21
1232.85 1.99414e-21
1261.86 1.95669e-21
1291.55 1.91986e-21
1321.94 1.88366e-21
1353.05 1.84807e-21
1384.89 1.81308e-21
1417.47 1.77869e-21
1450.83 1.74489e-21
1484.97 1.71168e-21
1519.91 1.67904e-21
1555.68 1.64696e-21
1592.28 1.61544e-21
1629.75 1.58448e-21
1668.1 1.55406e-21
1707.35 1.52417e-21
1747.53 1.49481e-21
1788.65 1.46598e-21
1830.74 1.43766e-21
1873.82 1.40984e-21
1917.91 1.38252e-21
1963.04 1.35569e-21
2009.23 1.32935e-21
2056.51 1.30348e-21
2104.9 1.27808e-21
2154.43 1.25314e-21
2205.13 1.22866e-21
2257.02 1.20462e-21
2310.13 1.18103e-21
2364.49 1.15787e-21
2420.13 1.13513e-21
2477.08 1.11282e-21
2535.36 1.09091e-21
2595.02 1.06942e-21
2656.09 1.04832e-21
2718.59 1.02762e-21
2782.56 1.0073e-21
2848.04 9.87368e-22
2915.05 9.67807e-22
2983.65 9.48613e-22
3053.86 9.29781e-22
3125.72 9.11304e-22
3199.27 8.93177e-22
3274.55 8.75393e-22
3351.6 8.57947e-22
3430.47 8.40833e-22
3511.19 8.24044e-22
3593.81 8.07576e-22
3678.38 7.91423e-22
3764.94 7.75579e-22
3853.53 7.6004e-22
3944.21 7.44798e-22
4037.02 7.2985e-22
4132.01 7.1519e-22
4229.24 7.00814e-22
4328.76 6.86715e-22
4430.62 6.72889e-22
4534.88 6.59331e-22
4641.59 6.46036e-22
4750.81 6.33e-22
4862.6 6.20217e-22
4977.02 6.07684e-22
5094.14 5.95395e-22
5214.01 5.83347e-22
5336.7 5.71534e-22
5462.28 5.59953e-22
5590.81 5.48599e-22
5722.37 5.37468e-22
5857.02 5.26555e-22
5994.84 5.15858e-22
6135.91 5.05371e-22
6280.29 4.95092e-22
6428.07 4.85015e-22
6579.33 4.75138e-22
6734.15 4.65456e-22
6892.61 4.55966e-22
7054.8 4.46664e-22
7220.81 4.37547e-22
7390.72 4.28611e-22
7564.63 4.19852e-22
7742.64 4.11268e-22
7924.83 4.02855e-22
8111.31 3.9461e-22
8302.18 3.8653e-22
8497.53 3.78611e-22
8697.49 3.7085e-22
8902.15 3.63245e-22
9111.63 3.55792e-22
9326.03 3.48488e-22
9545.48 3.41331e-22
9770.1 3.34318e-22
10000 3.27445e-22
10235.3 3.20711e-22
10476.2 3.14112e-22
10722.7 3.07646e-22
10975 3.01311e-22
11233.2 2.95103e-22
11497.6 2.89021e-22
11768.1 2.83061e-22
12045 2.77222e-22
12328.5 2.71501e-22
12618.6 2.65896e-22
12915.5 2.60405e-22
13219.4 2.55024e-22
13530.5 2.49753e-22
13848.9 2.44589e-22
14174.7 2.39529e-22
14508.3 2.34572e-22
14849.7 2.29717e-22
15199.1 2.24959e-22
15556.8 2.20299e-22
15922.8 2.15734e-22
16297.5 2.11261e-22
16681 2.0688e-22
17073.5 2.02588e-22
17475.3 1.98384e-22
17886.5 1.94265e-22
18307.4 1.90231e-22
18738.2 1.86279e-22
19179.1 1.82408e-22
19630.4 1.78617e-22
20092.3 1.74902e-22
File diff suppressed because it is too large Load Diff
-316
View File
@@ -1,316 +0,0 @@
# Total Ionization Cross Section from
# BED Theory
# Initial Energy (eV) Cross section (m^2)
14.8497 0
15.1991 0
15.43 0
15.4301 6.84064e-26
15.5568 8.62796e-23
15.9228 3.30713e-22
16.2975 5.73975e-22
16.681 8.16127e-22
17.0735 1.05721e-21
17.4753 1.29723e-21
17.8865 1.53617e-21
18.3074 1.77401e-21
18.7382 2.01069e-21
19.1791 2.24613e-21
19.6304 2.48025e-21
20.0923 2.71295e-21
20.5651 2.94411e-21
21.049 3.17358e-21
21.5443 3.40125e-21
22.0513 3.62695e-21
22.5702 3.85053e-21
23.1013 4.07183e-21
23.6449 4.29068e-21
24.2013 4.50692e-21
24.7708 4.72036e-21
25.3536 4.93084e-21
25.9502 5.13818e-21
26.5609 5.34222e-21
27.1859 5.54278e-21
27.8256 5.73971e-21
28.4804 5.93285e-21
29.1505 6.12203e-21
29.8365 6.30712e-21
30.5386 6.48797e-21
31.2572 6.66445e-21
31.9927 6.83643e-21
32.7455 7.00379e-21
33.516 7.16643e-21
34.3047 7.32424e-21
35.1119 7.47712e-21
35.9381 7.62501e-21
36.7838 7.76781e-21
37.6494 7.90547e-21
38.5353 8.03794e-21
39.4421 8.16515e-21
40.3702 8.28709e-21
41.3201 8.40371e-21
42.2924 8.515e-21
43.2876 8.62094e-21
44.3062 8.72154e-21
45.3488 8.81679e-21
46.4159 8.90671e-21
47.5081 8.99132e-21
48.626 9.07064e-21
49.7702 9.14471e-21
50.9414 9.21357e-21
52.1401 9.27726e-21
53.367 9.33584e-21
54.6228 9.38936e-21
55.9081 9.43789e-21
57.2237 9.48149e-21
58.5702 9.52023e-21
59.9484 9.55419e-21
61.3591 9.58346e-21
62.8029 9.6081e-21
64.2807 9.62821e-21
65.7933 9.64388e-21
67.3415 9.6552e-21
68.9261 9.66226e-21
70.548 9.66516e-21
72.2081 9.664e-21
73.9072 9.65887e-21
75.6463 9.64988e-21
77.4264 9.63713e-21
79.2483 9.62072e-21
81.1131 9.60075e-21
83.0218 9.57734e-21
84.9753 9.55058e-21
86.9749 9.52057e-21
89.0215 9.48743e-21
91.1163 9.45125e-21
93.2603 9.41214e-21
95.4548 9.3702e-21
97.701 9.32554e-21
100 9.27826e-21
102.353 9.22845e-21
104.762 9.17623e-21
107.227 9.12168e-21
109.75 9.06491e-21
112.332 9.00602e-21
114.976 8.94509e-21
117.681 8.88223e-21
120.45 8.81752e-21
123.285 8.75106e-21
126.186 8.68294e-21
129.155 8.61325e-21
132.194 8.54207e-21
135.305 8.4695e-21
138.489 8.3956e-21
141.747 8.32047e-21
145.083 8.24419e-21
148.497 8.16682e-21
151.991 8.08846e-21
155.568 8.00918e-21
159.228 7.92904e-21
162.975 7.84812e-21
166.81 7.7665e-21
170.735 7.68422e-21
174.753 7.60137e-21
178.865 7.51801e-21
183.074 7.4342e-21
187.382 7.35e-21
191.791 7.26546e-21
196.304 7.18065e-21
200.923 7.09561e-21
205.651 7.01041e-21
210.49 6.9251e-21
215.443 6.83972e-21
220.513 6.75432e-21
225.702 6.66895e-21
231.013 6.58365e-21
236.449 6.49847e-21
242.013 6.41344e-21
247.708 6.32861e-21
253.536 6.24402e-21
259.502 6.1597e-21
265.609 6.07568e-21
271.859 5.992e-21
278.256 5.9087e-21
284.804 5.8258e-21
291.505 5.74333e-21
298.365 5.66132e-21
305.386 5.5798e-21
312.572 5.49878e-21
319.927 5.41831e-21
327.455 5.33839e-21
335.16 5.25905e-21
343.047 5.1803e-21
351.119 5.10218e-21
359.381 5.02469e-21
367.838 4.94785e-21
376.494 4.87169e-21
385.353 4.7962e-21
394.421 4.72141e-21
403.702 4.64733e-21
413.201 4.57397e-21
422.924 4.50134e-21
432.876 4.42944e-21
443.062 4.3583e-21
453.488 4.28792e-21
464.159 4.2183e-21
475.081 4.14945e-21
486.26 4.08138e-21
497.702 4.01409e-21
509.414 3.94759e-21
521.401 3.88188e-21
533.67 3.81695e-21
546.228 3.75283e-21
559.081 3.6895e-21
572.237 3.62697e-21
585.702 3.56524e-21
599.484 3.5043e-21
613.591 3.44417e-21
628.029 3.38483e-21
642.807 3.32628e-21
657.933 3.26854e-21
673.415 3.21158e-21
689.261 3.15541e-21
705.48 3.10003e-21
722.081 3.04544e-21
739.072 2.99162e-21
756.463 2.93857e-21
774.264 2.8863e-21
792.483 2.8348e-21
811.131 2.78405e-21
830.218 2.73407e-21
849.753 2.68483e-21
869.749 2.63634e-21
890.215 2.58859e-21
911.163 2.54158e-21
932.603 2.49529e-21
954.548 2.44972e-21
977.01 2.40487e-21
1000 2.36073e-21
1023.53 2.31728e-21
1047.62 2.27453e-21
1072.27 2.23247e-21
1097.5 2.19109e-21
1123.32 2.15039e-21
1149.76 2.11034e-21
1176.81 2.07096e-21
1204.5 2.03223e-21
1232.85 1.99414e-21
1261.86 1.95669e-21
1291.55 1.91986e-21
1321.94 1.88366e-21
1353.05 1.84807e-21
1384.89 1.81308e-21
1417.47 1.77869e-21
1450.83 1.74489e-21
1484.97 1.71168e-21
1519.91 1.67904e-21
1555.68 1.64696e-21
1592.28 1.61544e-21
1629.75 1.58448e-21
1668.1 1.55406e-21
1707.35 1.52417e-21
1747.53 1.49481e-21
1788.65 1.46598e-21
1830.74 1.43766e-21
1873.82 1.40984e-21
1917.91 1.38252e-21
1963.04 1.35569e-21
2009.23 1.32935e-21
2056.51 1.30348e-21
2104.9 1.27808e-21
2154.43 1.25314e-21
2205.13 1.22866e-21
2257.02 1.20462e-21
2310.13 1.18103e-21
2364.49 1.15787e-21
2420.13 1.13513e-21
2477.08 1.11282e-21
2535.36 1.09091e-21
2595.02 1.06942e-21
2656.09 1.04832e-21
2718.59 1.02762e-21
2782.56 1.0073e-21
2848.04 9.87368e-22
2915.05 9.67807e-22
2983.65 9.48613e-22
3053.86 9.29781e-22
3125.72 9.11304e-22
3199.27 8.93177e-22
3274.55 8.75393e-22
3351.6 8.57947e-22
3430.47 8.40833e-22
3511.19 8.24044e-22
3593.81 8.07576e-22
3678.38 7.91423e-22
3764.94 7.75579e-22
3853.53 7.6004e-22
3944.21 7.44798e-22
4037.02 7.2985e-22
4132.01 7.1519e-22
4229.24 7.00814e-22
4328.76 6.86715e-22
4430.62 6.72889e-22
4534.88 6.59331e-22
4641.59 6.46036e-22
4750.81 6.33e-22
4862.6 6.20217e-22
4977.02 6.07684e-22
5094.14 5.95395e-22
5214.01 5.83347e-22
5336.7 5.71534e-22
5462.28 5.59953e-22
5590.81 5.48599e-22
5722.37 5.37468e-22
5857.02 5.26555e-22
5994.84 5.15858e-22
6135.91 5.05371e-22
6280.29 4.95092e-22
6428.07 4.85015e-22
6579.33 4.75138e-22
6734.15 4.65456e-22
6892.61 4.55966e-22
7054.8 4.46664e-22
7220.81 4.37547e-22
7390.72 4.28611e-22
7564.63 4.19852e-22
7742.64 4.11268e-22
7924.83 4.02855e-22
8111.31 3.9461e-22
8302.18 3.8653e-22
8497.53 3.78611e-22
8697.49 3.7085e-22
8902.15 3.63245e-22
9111.63 3.55792e-22
9326.03 3.48488e-22
9545.48 3.41331e-22
9770.1 3.34318e-22
10000 3.27445e-22
10235.3 3.20711e-22
10476.2 3.14112e-22
10722.7 3.07646e-22
10975 3.01311e-22
11233.2 2.95103e-22
11497.6 2.89021e-22
11768.1 2.83061e-22
12045 2.77222e-22
12328.5 2.71501e-22
12618.6 2.65896e-22
12915.5 2.60405e-22
13219.4 2.55024e-22
13530.5 2.49753e-22
13848.9 2.44589e-22
14174.7 2.39529e-22
14508.3 2.34572e-22
14849.7 2.29717e-22
15199.1 2.24959e-22
15556.8 2.20299e-22
15922.8 2.15734e-22
16297.5 2.11261e-22
16681 2.0688e-22
17073.5 2.02588e-22
17475.3 1.98384e-22
17886.5 1.94265e-22
18307.4 1.90231e-22
18738.2 1.86279e-22
19179.1 1.82408e-22
19630.4 1.78617e-22
20092.3 1.74902e-22
File diff suppressed because it is too large Load Diff
-49
View File
@@ -1,49 +0,0 @@
# Total Elastic Scattering Cross Section from
# Yoon et al, Cross Sections for Electron Collisions with Hydrogen Molecules, 2008
# Energy (eV) Cross section (m^2)
0.02 7.41e-20
0.03 7.71e-20
0.04 8.08e-20
0.05 8.32e-20
0.06 8.51e-20
0.07 8.69e-20
0.08 8.84e-20
0.09 8.99e-20
0.1 9.13e-20
0.12 9.33e-20
0.15 9.55e-20
0.2 9.83e-20
0.25 10.04e-20
0.3 10.24e-20
0.4 10.61e-20
0.5 10.95e-20
0.6 11.28e-20
0.7 11.59e-20
0.8 11.88e-20
0.9 12.16e-20
1.0 12.36e-20
1.25 13.00e-20
1.5 13.55e-20
2.0 14.11e-20
3.0 14.12e-20
4.0 13.40e-20
5.0 12.51e-20
6.0 11.45e-20
8.0 9.85e-20
10.0 8.58e-20
12.0 7.61e-20
14.0 6.92e-20
16.0 6.32e-20
18.0 5.78e-20
20.0 5.26e-20
25.0 4.23e-20
30.0 3.40e-20
35.0 2.81e-20
40.0 2.36e-20
50.0 1.73e-20
60.0 1.31e-20
70.0 1.06e-20
80.0 0.89e-20
90.0 0.81e-20
100.0 0.74e-20
@@ -1,61 +0,0 @@
# Total Ionization Cross Section from
# Yoon et al, Cross Sections for Electron Collisions with Hydrogen Molecules, 2008
# Energy (eV) Cross section (m^2)
16.0 0.0299e-20
16.5 0.0607e-20
17.0 0.0924e-20
17.5 0.123e-20
18.0 0.156e-20
18.5 0.187e-20
19.0 0.22e-20
19.5 0.249e-20
20.0 0.28e-20
20.5 0.31e-20
21.0 0.336e-20
21.5 0.362e-20
22.0 0.39e-20
22.5 0.414e-20
23.0 0.439e-20
23.5 0.461e-20
24.0 0.484e-20
24.5 0.505e-20
25.0 0.524e-20
30.0 0.651e-20
35.0 0.76e-20
40.0 0.84e-20
45.0 0.88e-20
50.0 0.908e-20
55.0 0.931e-20
60.0 0.944e-20
65.0 0.948e-20
70.0 0.949e-20
80.0 0.937e-20
85.0 0.928e-20
90.0 0.919e-20
95.0 0.911e-20
100.0 0.9e-20
110.0 0.872e-20
120.0 0.852e-20
140.0 0.806e-20
160.0 0.763e-20
180.0 0.714e-20
200.0 0.676e-20
225.0 0.636e-20
250.0 0.596e-20
275.0 0.556e-20
300.0 0.529e-20
350.0 0.477e-20
400.0 0.436e-20
450.0 0.398e-20
500.0 0.373e-20
550.0 0.339e-20
600.0 0.317e-20
650.0 0.302e-20
700.0 0.283e-20
750.0 0.272e-20
800.0 0.257e-20
850.0 0.248e-20
900.0 0.235e-20
950.0 0.222e-20
1000.0 0.211e-20
File diff suppressed because it is too large Load Diff
-131
View File
@@ -1,131 +0,0 @@
# E sig_tot
1.00000e-05 2.85516e-20
1.20000e-05 2.92114e-20
1.40000e-05 2.97811e-20
1.60000e-05 3.02836e-20
1.80000e-05 3.07339e-20
2.00000e-05 3.11423e-20
2.50000e-05 3.20254e-20
3.00000e-05 3.27655e-20
3.50000e-05 3.34045e-20
4.00000e-05 3.39681e-20
5.00000e-05 3.49313e-20
6.00000e-05 3.57386e-20
7.00000e-05 3.64356e-20
8.00000e-05 3.70504e-20
9.00000e-05 3.76012e-20
1.00000e-04 3.81009e-20
1.20000e-04 3.89814e-20
1.40000e-04 3.97417e-20
1.60000e-04 4.04123e-20
1.80000e-04 4.10131e-20
2.00000e-04 4.15582e-20
2.50000e-04 4.27366e-20
3.00000e-04 4.37242e-20
3.50000e-04 4.45770e-20
4.00000e-04 4.53291e-20
5.00000e-04 4.66144e-20
6.00000e-04 4.76916e-20
7.00000e-04 4.86218e-20
8.00000e-04 4.94422e-20
9.00000e-04 5.01773e-20
1.00000e-03 5.08442e-20
1.20000e-03 5.20191e-20
1.40000e-03 5.30337e-20
1.60000e-03 5.39285e-20
1.80000e-03 5.47303e-20
2.00000e-03 5.54577e-20
2.50000e-03 5.70302e-20
3.00000e-03 5.83481e-20
3.50000e-03 5.94861e-20
4.00000e-03 6.04899e-20
5.00000e-03 6.22051e-20
6.00000e-03 6.36426e-20
7.00000e-03 6.48838e-20
8.00000e-03 6.59786e-20
9.00000e-03 6.69596e-20
1.00000e-02 6.78495e-20
1.20000e-02 6.94174e-20
1.40000e-02 7.07713e-20
1.60000e-02 7.19654e-20
1.80000e-02 7.30354e-20
2.00000e-02 7.41000e-20
3.00000e-02 7.71000e-20
4.00000e-02 8.08000e-20
5.00000e-02 8.32000e-20
6.00000e-02 8.51000e-20
7.00000e-02 8.69000e-20
8.00000e-02 8.84000e-20
9.00000e-02 8.99000e-20
1.00000e-01 9.13000e-20
1.20000e-01 9.33000e-20
1.50000e-01 9.55000e-20
2.00000e-01 9.83000e-20
2.50000e-01 1.00400e-19
3.00000e-01 1.02400e-19
4.00000e-01 1.06100e-19
5.00000e-01 1.09500e-19
6.00000e-01 1.12800e-19
7.00000e-01 1.15900e-19
8.00000e-01 1.18800e-19
9.00000e-01 1.21600e-19
1.00000e+00 1.23600e-19
1.25000e+00 1.30000e-19
1.50000e+00 1.35500e-19
2.00000e+00 1.41100e-19
3.00000e+00 1.41200e-19
4.00000e+00 1.32000e-19
5.00000e+00 1.25100e-19
6.00000e+00 1.14500e-19
8.00000e+00 9.85000e-20
1.00000e+01 8.58000e-20
1.20000e+01 7.61000e-20
1.40000e+01 6.92000e-20
1.60000e+01 6.32000e-20
1.80000e+01 5.78000e-20
2.00000e+01 5.26000e-20
2.50000e+01 4.23000e-20
3.00000e+01 3.40000e-20
3.50000e+01 2.81000e-20
4.00000e+01 2.36000e-20
5.00000e+01 1.73000e-20
6.00000e+01 1.31000e-20
7.00000e+01 1.06000e-20
8.00000e+01 8.90000e-21
9.00000e+01 8.10000e-21
1.00000e+02 7.40000e-21
1.20000e+02 6.61975e-21
1.40000e+02 5.66489e-21
1.60000e+02 4.94945e-21
1.80000e+02 4.39369e-21
2.00000e+02 3.94985e-21
2.50000e+02 3.15371e-21
3.00000e+02 2.62546e-21
3.50000e+02 2.24920e-21
4.00000e+02 1.96732e-21
5.00000e+02 1.57294e-21
6.00000e+02 1.31034e-21
7.00000e+02 1.12305e-21
8.00000e+02 9.82697e-22
9.00000e+02 8.73558e-22
1.00000e+03 7.86271e-22
1.20000e+03 6.55425e-22
1.40000e+03 5.62016e-22
1.60000e+03 4.91973e-22
1.80000e+03 4.37513e-22
2.00000e+03 3.93956e-22
2.50000e+03 3.15568e-22
3.00000e+03 2.63326e-22
3.50000e+03 2.26015e-22
4.00000e+03 1.98036e-22
5.00000e+03 1.58872e-22
6.00000e+03 1.32766e-22
7.00000e+03 1.14121e-22
8.00000e+03 1.00139e-22
9.00000e+03 8.92653e-23
1.00000e+04 8.05667e-23
1.20000e+04 6.75199e-23
1.40000e+04 5.82019e-23
1.60000e+04 5.12142e-23
1.80000e+04 4.57799e-23
2.00000e+04 4.14329e-23
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More