Compare commits
51
Commits
master
...
karl_paper
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
375ab23008 | ||
|
|
532bdf7979 | ||
|
|
2439f4fca9 | ||
|
|
90d19b0cb7 | ||
|
|
6c1dd8887b | ||
|
|
14c203c2f2 | ||
|
|
bd867fb788 | ||
|
|
6d5f18222a | ||
|
|
32f882a2c5 | ||
|
|
fb19d9ae83 | ||
|
|
f01ff652c9 | ||
|
|
9c999dabbb | ||
|
|
0902d3d7ac | ||
|
|
903423da61 | ||
|
|
03854339ca | ||
|
|
8696517336 | ||
|
|
36f85ea79f | ||
|
|
2114b93f89 | ||
|
|
dcad5b1e61 | ||
|
|
57b90ddbc8 | ||
|
|
863110a281 | ||
|
|
59acd0c1c3 | ||
|
|
d399706159 | ||
|
|
cbf95aceb6 | ||
|
|
9e50d8bdcf | ||
|
|
3d3eff1bca | ||
|
|
f5e278281c | ||
|
|
ca4fb23423 | ||
|
|
b3bf076c1d | ||
|
|
b9ad0ce666 | ||
|
|
faedddb328 | ||
|
|
4849667211 | ||
|
|
6486cf9da4 | ||
|
|
53a2f90d5f | ||
|
|
d48f917dac | ||
|
|
30982bd4f6 | ||
|
|
93aa336ec9 | ||
|
|
e291b3f880 | ||
|
|
5ac64c4da8 | ||
|
|
80fdfb6dc5 | ||
|
|
e0c0b19b69 | ||
|
|
b8f8110aca | ||
|
|
4cfc7d51c2 | ||
|
|
4afc3382a1 | ||
|
|
26e96df5df | ||
|
|
ad313d25a2 | ||
|
|
5f08b9775c | ||
|
|
f79172b454 | ||
|
|
45d4556394 | ||
|
|
f2d4ad3525 | ||
|
|
b7a65dd8fe |
+6
-1
@@ -1 +1,6 @@
|
||||
.vscode
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
build
|
||||
bin
|
||||
output
|
||||
@@ -6,7 +6,7 @@ listed with package names in the file REQUIRED. Other distributions might have
|
||||
slightly different package names. After installing all external dependencies
|
||||
using the package manager of your distribution the compilation of KARL is
|
||||
straight forward. First provide the path of the current working directory as an
|
||||
environment variable, eg. through:
|
||||
environment variable named "HOMEBASE", eg. through:
|
||||
|
||||
$ export HOMEBASE=$(pwd)
|
||||
|
||||
@@ -19,22 +19,79 @@ in the current working directory. If any library is not available in the system
|
||||
wide include or library path you might have to edit the settings in
|
||||
config/config.mk.
|
||||
|
||||
If either Jansson or Blitz++ are not available via packages the config/config.mk
|
||||
file includes the option for those libraries to be built on their own.
|
||||
To do that, the MAKE_* (e.g. MAKE_BLITZ) variable has to be set to "true" before the
|
||||
make call. Depending on the status of MAKE_BLITZ and MAKE_JANSSON the include
|
||||
and lib paths are set automatically to the self-built libraries or the system
|
||||
libraries.
|
||||
|
||||
Compiling the libraries requires autoconf, automake, libtool and python
|
||||
|
||||
START OF A SIMULATION:
|
||||
|
||||
The simulation needs a JSON file that describes the physical and numerical
|
||||
parameters of the simulation. One such file is provided with the source code
|
||||
(simulation_config/test_parameter.json).
|
||||
The JSON file also contains the location for the simulation output. The default
|
||||
directory for this is /tmp which only works for simulations on a single node.
|
||||
Before running on a cluster you should
|
||||
The JSON file also contains the location for the simulation output. Before
|
||||
running on a cluster you should
|
||||
|
||||
edit the JSON file, adjust "folder" and "filename" in the "Output" section.
|
||||
|
||||
You can then start the simulation using
|
||||
|
||||
$ mpiexec -n 4 bin/karl --parameter_file=simulation_config/test_parameter.json
|
||||
$ mpiexec -n 4 bin/karl --parameter_file simulation_config/test_parameter.json
|
||||
|
||||
You can of course specify some other number of MPI threads or use a different
|
||||
JSON file. If you have to use some non-standard method to start MPI programs
|
||||
(such as poe) instead of mpiexec you might need to check the relevant
|
||||
documentation.
|
||||
|
||||
ANALYSIS OF THE SIMULATION OUTPUT:
|
||||
Python scripts are provided to analyze the output of the simulation. They can be
|
||||
found in the folder "analysis". The script require the python packages
|
||||
numpy, matplotlib, scipy and h5py.
|
||||
|
||||
An example of how to use the analysis scripts is provided in the file "analysis/plot_example.py".
|
||||
|
||||
INPUT OF THE SIMULATION (JSON files):
|
||||
In the simulation_config/ subdirectory some example files for the general input of
|
||||
a simulation are given.
|
||||
|
||||
The two files "parameter_katrin_example.json" and "test_parameter.json" are two
|
||||
complete examples, that can be used to start a simulation.
|
||||
The "parameter_katrin_example.json" file describes the setup for the
|
||||
simulation of the KATRIN WGTS and "test_parameter.json" is a generic test case example.
|
||||
|
||||
The other provided JSON files are meant to explain the structure and show the possible
|
||||
options that can be chosen for some of the more complex elements required in a parameter
|
||||
file and can not be used as input for a simulation.
|
||||
E.g. "scattering_angle_example.json" shows the four different types of
|
||||
scattering angle distributions that can be used in the code and how they are to be
|
||||
structured in a working parameter file.
|
||||
|
||||
INPUT OF THE SIMULATION (HDF5 files):
|
||||
For several groups in the JSON input file it is possible to read data from an external
|
||||
HDF5 file, these groups are those that specify a Vector Field, Function or a Scattering Angle Distribution.
|
||||
|
||||
For the Scattering Angle Distribution it is necessary that the HDF5 files contain the
|
||||
three objects "energies(eV)", "angles(rad)" and "cross_sections(m-2)". The first two
|
||||
both have to be one dimensional arrays, containing the energies in eV and angles in rad
|
||||
where the cross sections are defined respectivley. The thrid key has to contain a
|
||||
two-dimensional array containing the actual values of the cross section in m^2, with the
|
||||
first dimension being the energy and the second dimension being the angle.
|
||||
|
||||
In case of the Vector Field or the Function the structure of the input HDF5 file
|
||||
is not as rigid, since the keys to the specific objects in the file have to be provided
|
||||
in the JSON object.
|
||||
The necessary structure in the JSON file for these two types types
|
||||
of objects can either be found in the provided example JSON files or in the comments
|
||||
in the corresponding generator files (i.e. "include/generators/vector_field_generator.h"
|
||||
and "include/generators/function_generator.h").
|
||||
|
||||
|
||||
NOTES:
|
||||
Kommentare in den files: position_binning.*, current_collector.*, kinematic.*, sim_constants.h, mover.*, simulation_output.*, functions.*, injector_generator.h, ionization.h, recombination.cpp und species_generator überprüfen lassen
|
||||
|
||||
für interactions.cpp: mehr Kommentare zum source code (i.e. zur Berechnung?)
|
||||
für cross_sections.h: Referenzen mit reinschreiben?
|
||||
|
||||
@@ -212,14 +212,19 @@ def plotSpectrumAtZ(filename, path_to_species, z_position, plot_axis, output_per
|
||||
r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}\log_{10}E}$ $\left(\frac{1}{\mathrm{m}^{3} \log_{10}(\mathrm{eV})}\right)$")
|
||||
|
||||
|
||||
def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder):
|
||||
def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder, plot_instructions={}):
|
||||
pst.setRcParams()
|
||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
||||
for key in specie_keys:
|
||||
plotSpectrumAtZ(filename, key, z_position, ax, output_period)
|
||||
ax.set_facecolor('#e7e7e7ff')
|
||||
ax.grid(color='white')
|
||||
|
||||
ax.legend()
|
||||
if "xlim" in plot_instructions.keys():
|
||||
ax.set_xlim(plot_instructions["xlim"])
|
||||
if "ylim" in plot_instructions.keys():
|
||||
ax.set_ylim(plot_instructions["ylim"])
|
||||
|
||||
fig.savefig(output_folder +
|
||||
"/spectrum_at_z={}_at_period={}.pdf".format(z_position, output_period))
|
||||
@@ -256,7 +261,7 @@ def plotLongitudinalParticleCurrentVsZ(filename, path_to_species, plot_axis, out
|
||||
z_bins = zBinsDensityField(filename, path_to_species)
|
||||
plot_axis.plot(z_bins, current_in_z, label=str(path_to_species))
|
||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
||||
plot_axis.set_ylabel(r"Particle current $j$ ($m^{-3}s^{-1}$)")
|
||||
plot_axis.set_ylabel(r"Particle current $j$ ($m^{-2}s^{-1}$)")
|
||||
|
||||
|
||||
def plotAllLongitudinalParticleCurrentVsZ(filename, output_period, specie_keys, output_folder):
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import plot_densities as pd
|
||||
|
||||
if __name__ == '__main__':
|
||||
filename_simulation_output = input("Enter filename of simulation output: ")
|
||||
output_folder = input("Enter output folder: ")
|
||||
|
||||
species = pd.getSpecies(filename_simulation_output)
|
||||
|
||||
pd.plotAllDensityVsZ(filename_simulation_output, "LastSyncPeriod", species, output_folder)
|
||||
pd.plotAllSpectrumAtZ(filename_simulation_output, 8, "LastSyncPeriod", species, output_folder)
|
||||
+25
-18
@@ -1,27 +1,32 @@
|
||||
# Debugging
|
||||
DO_DEBUGGING = true
|
||||
DEBUG_LEVEL = 3
|
||||
DO_DEBUGGING = false
|
||||
DEBUG_LEVEL = 0
|
||||
|
||||
# Timer
|
||||
USE_TIMER = true
|
||||
USE_TIMER = false
|
||||
|
||||
# Catch
|
||||
CATCH_DIR = $(HOMEBASE)/external/catch
|
||||
CATCH_DIR = $(HOMEBASE)/external/catch
|
||||
CATCH_INCLUDES = -I$(CATCH_DIR)
|
||||
|
||||
|
||||
# Blitz
|
||||
MAKE_BLITZ = false
|
||||
|
||||
BLITZ_DIR = $(HOMEBASE)/external/blitz/build/
|
||||
BLITZ_INC_DIR = $(BLITZ_DIR)include/
|
||||
BLITZ_LIB_DIR = $(BLITZ_DIR)lib/
|
||||
ifeq ($(MAKE_BLITZ), true)
|
||||
BLITZ_DIR = $(HOMEBASE)/external/blitz/build
|
||||
BLITZ_INC_DIR = $(BLITZ_DIR)/include
|
||||
BLITZ_LIB_DIR = $(BLITZ_DIR)/lib
|
||||
else
|
||||
BLITZ_INC_DIR = /usr/include
|
||||
BLITZ_LIB_DIR = /usr/lib/x86_64-linux-gnu
|
||||
endif
|
||||
|
||||
|
||||
BLITZ_INCLUDES = -I$(BLITZ_INC_DIR)
|
||||
BLITZ_LIBS = -L$(BLITZ_LIB_DIR) -lblitz -lm
|
||||
BLITZ_LIBS = -lblitz -lm -L$(BLITZ_LIB_DIR)
|
||||
|
||||
# HDF5
|
||||
MAKE_H5 = false
|
||||
|
||||
#HDF5_DIR = /usr/include/hdf5/
|
||||
HDF5P_INC_DIR = /usr/include/hdf5/openmpi/
|
||||
HDF5P_LIB_DIR = /usr/lib/x86_64-linux-gnu/hdf5/openmpi/
|
||||
@@ -29,14 +34,16 @@ HDF5P_LIB_DIR = /usr/lib/x86_64-linux-gnu/hdf5/openmpi/
|
||||
HDF5P_INCLUDES = -I$(HDF5P_INC_DIR)
|
||||
HDF5P_LIBRARIES = -L$(HDF5P_LIB_DIR) -lz -lhdf5_hl -lhdf5
|
||||
|
||||
# Janson
|
||||
# Jansson
|
||||
MAKE_JANSSON = false
|
||||
|
||||
JANSON_DIR = $(HOMEBASE)/external/jansson/
|
||||
JANSON_INC_DIR = $(JANSON_DIR)
|
||||
JANSSON_LIBRARIES = -ljansson
|
||||
JANSSON_INCLUDES = -I$(JANSON_INC_DIR)
|
||||
|
||||
|
||||
|
||||
ifeq ($(MAKE_JANSSON), true)
|
||||
JANSSON_INC_DIR = $(HOMEBASE)/external/jansson/build/include
|
||||
JANSSON_LIB_DIR = $(HOMEBASE)/external/jansson/build/lib
|
||||
else
|
||||
JANSSON_INC_DIR = /usr/include
|
||||
JANSSON_LIB_DIR = /usr/lib/x86_64-linux-gnu
|
||||
endif
|
||||
|
||||
JANSSON_LIBRARIES = -L$(JANSSON_LIB_DIR) -ljansson
|
||||
JANSSON_INCLUDES = -I$(JANSSON_INC_DIR)
|
||||
|
||||
Vendored
+16
-6
@@ -4,22 +4,32 @@ dummy: all
|
||||
ZIP = tar
|
||||
|
||||
|
||||
NAME_TAR = blitz-1.0.2.tar.gz
|
||||
NAME = blitz-1.0.2
|
||||
BLITZ_VERSION = 1.0.2
|
||||
|
||||
NAME_TAR = blitz-$(BLITZ_VERSION).tar.gz
|
||||
NAME = blitz-$(BLITZ_VERSION)
|
||||
|
||||
BLITZ_FOLDER=external/blitz
|
||||
|
||||
BLITZ_FOLDER=/external/blitz/
|
||||
|
||||
all:
|
||||
ifneq ("$(wildcard $(NAME_TAR))","")
|
||||
@echo "Archive already present"
|
||||
else
|
||||
@echo "Downloading"
|
||||
wget https://github.com/blitzpp/blitz/archive/refs/tags/$(BLITZ_VERSION).tar.gz
|
||||
mv $(BLITZ_VERSION).tar.gz $(NAME_TAR)
|
||||
endif
|
||||
$(ZIP) -xf $(NAME_TAR)
|
||||
mkdir -p build
|
||||
mkdir -p build/include
|
||||
mkdir -p build/lib
|
||||
cd $(NAME) && autoreconf -fiv && autoconf && automake --add-missing
|
||||
cd $(NAME) && ./configure --prefix=$(HOMEBASE)$(BLITZ_FOLDER)build/ --includedir=$(HOMEBASE)$(BLITZ_FOLDER)build/include/ --libdir=$(HOMEBASE)$(BLITZ_FOLDER)build/lib/
|
||||
cd $(NAME) && ./configure --prefix=$(HOMEBASE)/$(BLITZ_FOLDER)/build/ --includedir=$(HOMEBASE)/$(BLITZ_FOLDER)/build/include/ --libdir=$(HOMEBASE)/$(BLITZ_FOLDER)/build/lib/
|
||||
cd $(NAME) && $(MAKE)
|
||||
cd $(NAME) && $(MAKE) lib
|
||||
cd $(NAME) && $(MAKE) install
|
||||
|
||||
clean:
|
||||
-rm -rf $(HOMEBASE)$(BLITZ_FOLDER)blitz-1.0.2
|
||||
-rm -rf $(HOMEBASE)$(BLITZ_FOLDER)build
|
||||
-rm -rf $(HOMEBASE)/$(BLITZ_FOLDER)/$(NAME)
|
||||
-rm -rf $(HOMEBASE)/$(BLITZ_FOLDER)/build
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+21
-13
@@ -4,21 +4,29 @@ dummy: all
|
||||
ZIP = tar
|
||||
|
||||
|
||||
NAME_TAR = jansson-2.13.tar.gz
|
||||
NAME = jansson-2.13
|
||||
JANSSON_VERSION = 2.14
|
||||
|
||||
JANSSON_FOLDER=/external/jansson/
|
||||
NAME = jansson-$(JANSSON_VERSION)
|
||||
NAME_TAR = $(NAME).tar.gz
|
||||
|
||||
JANSSON_FOLDER=external/jansson
|
||||
|
||||
all:
|
||||
$(ZIP) -xf $(NAME_TAR)
|
||||
mkdir -p build
|
||||
mkdir -p build/include
|
||||
mkdir -p build/lib
|
||||
#cd $(NAME) && autoreconf -fiv && automake --add-missing
|
||||
cd $(NAME) && ./configure --prefix=$(HOMEBASE)$(JANSSON_FOLDER)build/ --includedir=$(HOMEBASE)$(JANSSON_FOLDER)build/include/ --libdir=$(HOMEBASE)$(JANSSON_FOLDER)build/lib/
|
||||
cd $(NAME) && $(MAKE)
|
||||
cd $(NAME) && $(MAKE) install
|
||||
ifneq ("$(wildcard $(NAME_TAR))","")
|
||||
@echo "Archive already present"
|
||||
else
|
||||
@echo "Downloading"
|
||||
wget https://github.com/akheron/jansson/releases/download/v$(JANSSON_VERSION)/$(NAME_TAR)
|
||||
endif
|
||||
$(ZIP) -xf $(NAME_TAR)
|
||||
mkdir -p build
|
||||
mkdir -p build/include
|
||||
mkdir -p build/lib
|
||||
#cd $(NAME) && autoreconf -fiv && automake --add-missing
|
||||
cd $(NAME) && ./configure --prefix=$(HOMEBASE)/$(JANSSON_FOLDER)/build/ --includedir=$(HOMEBASE)/$(JANSSON_FOLDER)/build/include/ --libdir=$(HOMEBASE)/$(JANSSON_FOLDER)/build/lib/
|
||||
cd $(NAME) && $(MAKE)
|
||||
cd $(NAME) && $(MAKE) install
|
||||
|
||||
clean:
|
||||
-rm -rf $(HOMEBASE)$(JANSSON_FOLDER)$(NAME)
|
||||
-rm -rf $(HOMEBASE)$(JANSSON_FOLDER)build
|
||||
-rm -rf $(HOMEBASE)/$(JANSSON_FOLDER)/$(NAME)
|
||||
-rm -rf $(HOMEBASE)/$(JANSSON_FOLDER)/build
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -4,13 +4,23 @@
|
||||
#include <string>
|
||||
#include "blitz/array.h"
|
||||
|
||||
// class for reading data from a hdf5-file
|
||||
class Hdf5Reader {
|
||||
public:
|
||||
// Constructor: taking a string with the path to the directory and
|
||||
// a string with the name of the file to be read (without the ".h5", which is appended by default)
|
||||
Hdf5Reader(std::string directory, std::string filename);
|
||||
// Constructor: taking a string of the absolute path to the file (string is not changed)
|
||||
Hdf5Reader(std::string absolute_filename);
|
||||
|
||||
// read a 3-dimensional array from the hdf5-file specified at construction of the reader
|
||||
// object at the hdf5-path "path" and return it as a blitz::Array
|
||||
blitz::Array<double, 3> readD3Double(std::string path);
|
||||
// read a 2-dimensional array from the hdf5-file specified at construction of the reader
|
||||
// object at the hdf5-path "path" and return it as a blitz::Array
|
||||
blitz::Array<double, 2> readD2Double(std::string path);
|
||||
// read a 1-dimensional array from the hdf5-file specified at construction of the reader
|
||||
// object at the hdf5-path "path" and return it as a blitz::Array
|
||||
blitz::Array<double, 1> readD1Double(std::string path);
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
#include <vector>
|
||||
#include "blitz/array.h"
|
||||
|
||||
// Class to handle hdf5 output
|
||||
class Hdf5Writer {
|
||||
public:
|
||||
// the ".h5" is appened to the filename by default
|
||||
Hdf5Writer(std::string directory = "./output",
|
||||
std::string filename = "output");
|
||||
|
||||
|
||||
// writing functions to write data to a HDF dataset specified by the path
|
||||
// variable (format: path = "/Group1/Group2/.../GroupN/NameOfDataset")
|
||||
// into the file specified by directory and filename
|
||||
void write(const blitz::Array<double, 1>& data, std::string path);
|
||||
void write(const blitz::Array<double, 2>& data, std::string path);
|
||||
void write(const blitz::Array<double, 3>& data, std::string path);
|
||||
|
||||
@@ -7,36 +7,57 @@
|
||||
#include <vector>
|
||||
#include "IO/hdf5_writer.h"
|
||||
|
||||
// defined in "simulation/density_field.h"
|
||||
class DynamicDensityField;
|
||||
class CurrentBorder;
|
||||
//class CurrentBorder;
|
||||
// defined in "simulation/parameter.h"
|
||||
class Parameter;
|
||||
// defined in "simulation/current_collector.h"
|
||||
class CurrentCollector;
|
||||
// defined in "simulation/logger.h"
|
||||
class DeletionLogger;
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class TrackedSpecie;
|
||||
enum class ImplementedSpecies;
|
||||
}; // namespace species
|
||||
|
||||
// structure to store information about output types
|
||||
struct OutputTask {
|
||||
// name of the particle species that output should be performed for
|
||||
std::string specie_name;
|
||||
// if true earlier output is overwritten
|
||||
bool overwrite_last;
|
||||
// how many cpu synchronization steps are inbetween two output steps
|
||||
int intervall;
|
||||
// selector if each or only first cpu should write can be added here
|
||||
};
|
||||
|
||||
// class to handle output from the simulation
|
||||
class SimulationOutput {
|
||||
public:
|
||||
// Constructor: takes the name of the output directory and
|
||||
// the name of the output file (".h5" appended by default)
|
||||
// directory is created if it does not exist
|
||||
SimulationOutput(const std::string& output_folder,
|
||||
const std::string& output_filename);
|
||||
|
||||
// add OutputTask for the output of the (dynamic) density field
|
||||
void addDensityFieldOutput(OutputTask task);
|
||||
// add OutputTask for the output of the current collector
|
||||
void addCurrentBorderOutput(OutputTask task);
|
||||
// add OutputTask for the output of the deletion logger
|
||||
void addDeletionLoggerOutput(OutputTask task);
|
||||
|
||||
// write data that is initialized once at the beginning of the simulation
|
||||
// for all TrackedSpecies (mass (kg), charge (C), bin volumes, bin borders, number of bins
|
||||
// bin areas)
|
||||
void writeMetaData(
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species);
|
||||
|
||||
// write data that changes during the simulation, output intervalls are defined
|
||||
// wrt the number of cpu synchronization steps cpu_sync
|
||||
void writeSimulationData(
|
||||
int cpu_sync,
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species);
|
||||
@@ -48,45 +69,92 @@ class SimulationOutput {
|
||||
|
||||
Hdf5Writer writer;
|
||||
|
||||
// function for writing simulated data in the dynamic density field
|
||||
// takes the path to the hdf group of the specie the dynamic density field is defined for
|
||||
// takes the number of cpu synchronization steps that have been performed
|
||||
// takes whether earlier output should be overwritten
|
||||
void writeSimulationData(DynamicDensityField* density_field,
|
||||
std::string species_path,
|
||||
int cpu_sync,
|
||||
bool overwrite_last);
|
||||
|
||||
// write the 4d density array of the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeSpectrum(DynamicDensityField* density_field, std::string path);
|
||||
// write the 3d density array of the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeDensity(DynamicDensityField* density_field, std::string path);
|
||||
// write the 4d time in bin array (i.e. the raw data) of the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeTimeInBin(DynamicDensityField* density_field, std::string path);
|
||||
// write the 4d density array of the deleted particles array
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeDeletedParticles(DynamicDensityField* density_field,
|
||||
std::string path);
|
||||
// write the time of the Timer member object
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writePhysicalTime(DynamicDensityField* density_field, std::string path);
|
||||
|
||||
// function for writing simulated data in the current collector
|
||||
// takes the path to the hdf group of the specie the dynamic density field is defined for
|
||||
// takes the number of cpu synchronization steps that have been performed
|
||||
// takes whether earlier output should be overwritten
|
||||
void writeSimulationData(CurrentCollector* current_collector,
|
||||
std::string species_path,
|
||||
int cpu_sync,
|
||||
bool overwrite_last);
|
||||
// write all positive and negative crossing arrays (i.e. raw data)
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeCurrentCrossings(CurrentCollector* current_collector,
|
||||
std::string path);
|
||||
// write all physical particle current arrays (i.e. raw data)
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeCurrent(CurrentCollector* current_collector, std::string path);
|
||||
// write the time of the Timer member object
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writePhysicalTime(CurrentCollector* current_collector, std::string path);
|
||||
|
||||
// function for writing simulated data in the deletion logger
|
||||
// takes the path to the hdf group of the specie the dynamic density field is defined for
|
||||
// takes the number of cpu synchronization steps that have been performed
|
||||
// takes whether earlier output should be overwritten
|
||||
void writeSimulationData(DeletionLogger* logger,
|
||||
std::string species_path,
|
||||
int cpu_sync,
|
||||
bool overwrite_last);
|
||||
// write the deletion trakced by the DeletionLogger
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeNumDeletions(DeletionLogger* logger, std::string path);
|
||||
|
||||
// write the not simulated aspects of the TrackedSpecie
|
||||
// (mass (kg), charge (C))
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeMetaData(species::TrackedSpecie* specie);
|
||||
// write the not simulated aspects of the DynamicDensityField
|
||||
// (bin volumes, bin borders)
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeMetaData(DynamicDensityField* density_field, std::string path);
|
||||
// write the not simulated aspects of the CurrentCollector
|
||||
// (bin areas)
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeMetaData(CurrentCollector* current_collector, std::string path);
|
||||
// void writeParameterFile(Parameter* parameter);
|
||||
|
||||
// write the areas of the bins used by the current collector
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeCollectorAreas(CurrentCollector* current_collector,
|
||||
std::string path);
|
||||
|
||||
// write the volumes of the bins used by the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeBinVolumes(DynamicDensityField* density_field,
|
||||
std::string path_to_field);
|
||||
// write the number of bins used by the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeNumBins(DynamicDensityField* density_field,
|
||||
std::string path_to_field);
|
||||
// write the borders of the bins used by the dynamic density field
|
||||
// in the hdf group defined by string (has to be a total hdf path)
|
||||
void writeBinBorders(DynamicDensityField* density_field,
|
||||
std::string path_to_field);
|
||||
};
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
#define T2_BETA_DECAY_H
|
||||
|
||||
namespace T2BetaDecay {
|
||||
static const double lambda_T2 = 1.78405E-9; // tritium decay constant (1/s)
|
||||
static const double E0_T = 18.573e3; // Tritium endpoint energy (eV)
|
||||
static const double spectrum_prefactor = 1.2072343416696292E-47; // beta decay constant
|
||||
// tritium decay constant (1/s)
|
||||
static const double lambda_T2 = 1.78405E-9;
|
||||
// Tritium endpoint energy (eV)
|
||||
static const double E0_T = 18.573e3;
|
||||
// beta decay constant used in the fermi spectrum
|
||||
static const double spectrum_prefactor = 1.2072343416696292E-47;
|
||||
// maximum value of the fermi spectrum
|
||||
static const double spectrum_maximum = 1.5E-28;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define IONIZATION_CONSTANTS_H
|
||||
|
||||
namespace ionization {
|
||||
static const double ionization_energy_janev_non_diss = 15.42; // (eV)
|
||||
static const double ionization_energy_janev_non_diss = 15.43; // (eV)
|
||||
static const double ionization_energy_janev_diss_first = 30.6; // (eV)
|
||||
static const double ionization_energy_janev_diss_ground = 18.15; // (eV)
|
||||
} // namespace ionization
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef PHYSICAL_CONSTANTS_H
|
||||
#define PHYSICAL_CONSTANTS_H
|
||||
|
||||
// The default is (Gaussian) CGS units
|
||||
// Constants in CGS units
|
||||
namespace CGS {
|
||||
static const double me = 9.1094e-28; // Electron mass (g)
|
||||
static const double mp = 1.6726231e-24; // Proton mass (g)
|
||||
@@ -21,7 +21,7 @@ static const double G = 6.67428e-8; // Gravitational constant cm^3/(g sec^2)
|
||||
|
||||
}; // namespace CGS
|
||||
|
||||
// Constants in SI
|
||||
// Constants in SI (default)
|
||||
namespace SI {
|
||||
static const double me = 9.1094e-31; // Electron mass (kg)
|
||||
static const double mp = 1.6726e-27; // Proton mass (kg)
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
// constants due to numercial accuracy
|
||||
namespace SimConstants {
|
||||
// minimal value for a cross section
|
||||
static const double minimal_cross_section =
|
||||
std::numeric_limits<double>::min() * 1E5;
|
||||
// minimal value for a cross section scaled by density
|
||||
static const double minimal_macroscopic_cross_section =
|
||||
std::numeric_limits<double>::min() * 1E5;
|
||||
// arbitrarily chosen value to serve as the lowest value possible (to exclude 0)
|
||||
static const double random_lower_limit = 1E-15;
|
||||
// double1 == double2 <=> abs(double1 - double2) <= compare_epsilon
|
||||
static const double compare_epsilon = 1E-10;
|
||||
|
||||
} // namespace SimConstants
|
||||
|
||||
@@ -4,19 +4,32 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
// R^1 -> R^1 mappings
|
||||
namespace D1ToD1 {
|
||||
// return a function defined at the vector positions with the vector values
|
||||
// which interpolates linearly between those values
|
||||
// both vectors have to be sorted according to the values in positions
|
||||
std::function<double(double)> PiecewiseLinear(std::vector<double> positions,
|
||||
std::vector<double> values);
|
||||
|
||||
// return a function, that always returns the constant value "constant"
|
||||
std::function<double(double)> Constant(double constant);
|
||||
|
||||
// return a function returning the product of the values defined by the functions
|
||||
// in the vector "functions"
|
||||
std::function<double(double)> Product(
|
||||
std::vector<std::function<double(double)>> functions);
|
||||
}; // namespace D1ToD1
|
||||
|
||||
// R^3 -> R^1 mappings
|
||||
namespace D3ToD1 {
|
||||
// return a function, that always returns the constant value "constant"
|
||||
std::function<double(double, double, double)> Constant(double value);
|
||||
|
||||
// return a function that returns the product of the values of the functions fi, fj and fk
|
||||
// fi calculates its value from the first parameter the function "Product" returns gets,
|
||||
// fj from the second parameter and
|
||||
// fk from the third
|
||||
std::function<double(double, double, double)> Product(
|
||||
std::function<double(double)> fi,
|
||||
std::function<double(double)> fj,
|
||||
|
||||
@@ -9,12 +9,63 @@
|
||||
#include "simulation/position_binning.h"
|
||||
|
||||
namespace generator {
|
||||
// return a CylinderBinning object as described in the json-object object
|
||||
// object has to contain a json-object "CylinderBinning"
|
||||
// "CylinderBinning" has to consist of:
|
||||
// - json-object "Radial" consisting of a json-double (later cast to an integer) "NumberOfBins"
|
||||
// and a json-object "MaxRadius", which has to follow the form described in "json_read_length"
|
||||
// ("simulation/jansson_additionals.h")
|
||||
// - json-object "Longitudinal" consisting of a json-double (later cast to an integer) "NumberOfBins"
|
||||
// and a json-object "MaxLength", which has to follow the form described in "json_read_length"
|
||||
// ("simulation/jansson_additionals.h")
|
||||
// - json-object "Azimuthal" consisting of a json-double (later cast to an integer) "NumberOfBins"
|
||||
// example:
|
||||
// "object" : {
|
||||
// "CylinderBinning": {
|
||||
// "Radial": {"NumberOfBins": 1, "MaxRadius" : {...}},
|
||||
// "Azimuthal": {"NumberOfBins": 1},
|
||||
// "Longitudinal": {"NumberOfBins": 1, "MaxLength" : {...}}
|
||||
// }
|
||||
// }
|
||||
CylinderBinning buildPositionBinning(json_t* object);
|
||||
// return a CylinderBinning object described by the json-object in parameter at the
|
||||
// path "path_to_binning"
|
||||
// if a json-array called "CreateSameAs" exists: has to consist of the path to the PositionBinning
|
||||
// json-object that should be used (e.g. ["Object1", "Object2", ..., "PositionBinning"],
|
||||
// "Object1" has to be located in the root object)
|
||||
// otherwise same specifications as "buildPositionBinning"
|
||||
CylinderBinning buildPositionBinningIncludingRedirection(
|
||||
Parameter& parameter,
|
||||
json_path& path_to_binning);
|
||||
|
||||
// return a EnergyBinning object as defined in the json-object object
|
||||
// object has to contain:
|
||||
// - a json-string "Type", defining the type of the EnergyBinning (right now only "Logarithmic" is valid)
|
||||
// - a json-double "NumberOfBins", defining the number of bins for the binning (will be cast to an int)
|
||||
// - a json-object "MinEnergy" and a json-object "MaxEnergy", defining the lower and upper
|
||||
// value for the binning. Both objects have to follow the structure described in
|
||||
// "json_read_energy" ("simulation/jansson_additionals.h")
|
||||
//
|
||||
// example:
|
||||
// "object": {
|
||||
// "Type": "Logarithmic",
|
||||
// "NumberOfBins": 3,
|
||||
// "MinEnergy": {
|
||||
// "value": 1,
|
||||
// "unit": eV
|
||||
// },
|
||||
// "MaxEnergy": {
|
||||
// "value": 1000,
|
||||
// "unit": eV
|
||||
// }
|
||||
// }
|
||||
EnergyBinning buildEnergyBinning(json_t* object);
|
||||
// return a EnergyBinning object described by the json-object in parameter at the
|
||||
// path "path_to_binning"
|
||||
// if a json-array called "CreateSameAs" exists: has to consist of the path to the EnergyBinning
|
||||
// json-object that should be used (e.g. ["Object1", "Object2", ..., "EnergyBinning"],
|
||||
// "Object1" has to be located in the root object)
|
||||
// otherwise same specifications as "buildEnergy"
|
||||
EnergyBinning buildEnergyBinningIncludingRedirection(
|
||||
Parameter& parameter,
|
||||
json_path& path_to_binning);
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
#include "simulation/timer.h"
|
||||
|
||||
namespace generator {
|
||||
// return a shared_ptr to a CurrentCollector object, defined by the json-object
|
||||
// at "path_to_collector" in the Parameter file using the provied Timer object
|
||||
// the json-object has to contain a json-object called "PositionBinning",
|
||||
// wich has to follow the structure described in "buildPositionBinning"
|
||||
// (in "generators/binning_generator.h")
|
||||
std::shared_ptr<CurrentCollector> buildCurrentCollector(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_collector,
|
||||
|
||||
@@ -8,8 +8,16 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a ConstantDensityField object described by the give json-object
|
||||
// object has to contain a json-object "ScalarField", that has to follow the form
|
||||
// described in "buildScalarField" (defined in "generators/scalar_field_generator.h")
|
||||
std::shared_ptr<ConstantDensityField> buildConstantDensityField(json_t* object);
|
||||
|
||||
// return a shared_ptr to a DynamicDensityField object described by the json-object
|
||||
// at the give path in the Parameter object which uses the given Timer object
|
||||
// the json-object at path_to_field has to contain two json-objects called
|
||||
// "PositionBinning" and "EnergyBinning", which are described in "buildPositionBinning"
|
||||
// and "buildEnergyBinning" respectivley (both defined in "generators/binning_generator.h")
|
||||
std::shared_ptr<DynamicDensityField> buildDynamicDensityField(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_field,
|
||||
|
||||
@@ -7,10 +7,23 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// create a shared_ptr to a DriftVelocity object described by the json-object in parameter at the
|
||||
// path "path_to_drift_velocity"
|
||||
// has to consist of a json-object "VectorField" or "null"
|
||||
// if "VectorField" is specified: has to follow the form described by "buildVectorField" (in "generators/vector_field_generator.h")
|
||||
// if "null" is specified: nothing more has to be specified, simply returns a nullptr
|
||||
// (examples in "simulation_config/drift_velocity_examples.json")
|
||||
std::shared_ptr<DriftVelocity> buildDriftVelocity(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_drift_velocity);
|
||||
|
||||
// create a shared_ptr to a DriftVelocity object described by the json-object in parameter at the
|
||||
// path "path_to_drift_velocity"
|
||||
// if a json-array called "CreateSameAs" exists: has to consist of the path to the DriftVelocity
|
||||
// json-object that should be used (e.g. ["Object1", "Object2", ..., "DriftVelocity"], has to start at the root)
|
||||
// otherwise same specifications as "buildDriftVelocity"
|
||||
std::shared_ptr<DriftVelocity> buildDriftVelocityIncludingRedirection(
|
||||
Parameter& parameter, const json_path& path_to_drift_velocity);
|
||||
};
|
||||
|
||||
#endif /* DRIFT_VELOCITY_GENERATOR_H */
|
||||
|
||||
@@ -6,8 +6,15 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// create an ElectricField object from a json_t pointer to an json object
|
||||
// defining the electric field
|
||||
// has to consist of two json-objects "Background" and "Dynamic" defining the vector fields
|
||||
// as described in "generators/vector_field_generator.h" (function: "buildVectorField")
|
||||
std::shared_ptr<ElectricField> electricField(json_t* object);
|
||||
|
||||
// create an ElectricField object from the given Parameter object
|
||||
// json file has to have a json object called "ElectricField" directly in the json root object
|
||||
// of the parameter file
|
||||
std::shared_ptr<ElectricField> electricField(Parameter& parameter);
|
||||
}; // namespace generator
|
||||
|
||||
|
||||
@@ -9,6 +9,22 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to an EnergyDistributionFunction object at the json-object
|
||||
// with path "path_to_function" (from root) in the Parameter object
|
||||
// has to consist of a json-object called either "TritiumBetaDecay", "MaxwellBoltzmann" or "Constant"
|
||||
// if "TritiumBetaDecay" is specified:
|
||||
// - does not have to contain anything (returns a TritiumBetaDecay object)
|
||||
//
|
||||
// if "MaxwellBoltzmann" is specified:
|
||||
// - has to contain a json-object "Temperature", which has to contain a json-double "value"
|
||||
// that specified the temperature (in K) for the Maxwell-Boltzmann distribution (returns a MaxwellBoltzmann object)
|
||||
//
|
||||
// if "Constant" is specified:
|
||||
// - has to contain a json-object "constant", which has to contain a json-double "value", which
|
||||
// specifies the constant energy in eV (returns a Constant object)
|
||||
//
|
||||
// (examples in "simulation_config_energy_distribution_function_examples.json"; definition of the
|
||||
// objects in "simulatoin/energy_distribution.h")
|
||||
std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_function);
|
||||
|
||||
@@ -6,8 +6,37 @@
|
||||
#include "jansson.h"
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a function1D specified by the json object "object"
|
||||
// consists of a json-object called either "Constant", "PiecewiseLinear", "PiecewiseLinearFromFile" or an json-array called "Product"
|
||||
// if "Constant" is specified:
|
||||
// - has to contain a json-double called "constant" specifying the value of the constant the function should return
|
||||
//
|
||||
// if "PiecewiseLinear" is specified:
|
||||
// - has to contain two json_arrays "xValues" and "yValues" specifying the point between which should be linearly interpolated
|
||||
// - has to contain a json-double "prefactor", with which "yValues" will be scaled
|
||||
//
|
||||
// if "PiecewiseLinearFromFile" is specified:
|
||||
// - has to contain a json-object "PathToH5" as described in "generators/vector_field_generator.h"
|
||||
// - two json-strings "xValuesKey" and "yValuesKey" specifying the path of the x- and y-values in the hdf5 file
|
||||
// - a json-double "prefactor" which scales the read y-values
|
||||
//
|
||||
// if "Product" is specified:
|
||||
// - has to consist of an arbitrary number of json-objects following the format described for this function
|
||||
//
|
||||
// (examples can be found in "simulation_config/function_examples.json")
|
||||
std::function<double(double)> function1D(json_t* object);
|
||||
// return a function3D specified by the json object "object"
|
||||
// has to consist of a json-object called either "Constant3D" or "Product"
|
||||
//
|
||||
// if "Constant3D" is specified:
|
||||
// - has to contain a json-double "constant", defining the constant value that should be returned
|
||||
//
|
||||
// if "Product" is specified:
|
||||
// - has to contain three json-objects called "fi", "fk" and "fj" defining the
|
||||
// functional form in x,y and z direction; objects have to follow the description
|
||||
// of "function1D"
|
||||
//
|
||||
// (examples can be found in "simulation_config/function_examples.json")
|
||||
std::function<double(double, double, double)> function3D(json_t* object);
|
||||
|
||||
}; // namespace generator
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a Geometry object described by the json-object at the given path in the Parameter object
|
||||
// the json-object at the path has to contain a json-object "Cylinder". This json-object has to contain:
|
||||
// two json-objects "Radius" and "Height", which have to follow the form described in "json_read_length"
|
||||
// ("simulation/jansson_additionals.h")
|
||||
std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
|
||||
const json_path& path_to_geometry);
|
||||
|
||||
|
||||
@@ -10,6 +10,29 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to an Injector object described in the Parameter object
|
||||
// the tracked_species should contain all TrackedSpecie objects that are considered in the simulation
|
||||
// (background_species is not used)
|
||||
// Parameter has to have a json-object "Injector" in the root object
|
||||
// - in "Injector" a json-object "CreatedSpecies" has to exist, which
|
||||
// consists of one more arbitrarily named json-objects
|
||||
// these json-objects have to contain:
|
||||
// - a json-string "TrackedSpecieName", which has to correspond to one
|
||||
// of the strings used to describe the TrackedSpecies in the "Tracked" json-object of the same Paramter file
|
||||
// - a json-object "CreationVelocityDistribution" following the description in "generators/velocity_distribution_generator.h"
|
||||
// - a json-object "EventPositionDistribution" has to exit
|
||||
// - therein a json-object "ScalarField" has to exist, which describes the distribution from which positions will be drawn (following the
|
||||
// description in "generators/scalar_field_generator.h")
|
||||
// - a json-object "DensityLimit", which has to contain
|
||||
// - a json-double "min", which described the minimal density value of the used density distribution
|
||||
// - a json-double "max", which described the maximal density value of the used density distribution
|
||||
// - a json-object "PositionLimits" consisting of three json-object "rPosition", "phiPosition" and "zPosition", which
|
||||
// all have the same sturcture:
|
||||
// - a json-double "min", describing the minimum value that a drawn position should have
|
||||
// - a json-double "max", describing the maximum value that a drawn position should have
|
||||
// - a json-object "MotherDriftVelocity", which has a form as described in "generators/drift_velocity_generator.h"
|
||||
//
|
||||
// (example in "simulation_config/parameter_katrin_example.json")
|
||||
std::shared_ptr<Injector> buildInjector(
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
tracked_species,
|
||||
|
||||
@@ -12,6 +12,64 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// create the interactions specified at the "path_to_insteractions" in the Parameter
|
||||
// and add them to the given TrackedSpecie specie
|
||||
// the json-object at "path_to_interactions" has to consist of an arbitrary number
|
||||
// of arbitrarily named json-objects describing the interaction. These objects have to contain:
|
||||
// - a json-string "Type" with a value of either: "ElasticScattering", "FreeMovement", "ElectronIonization", "Excitation"
|
||||
// "Clustering", "ChargeExchange" or "Recombination"
|
||||
//
|
||||
// if the Type "ElasticScattering" is specified (for elastic scattering interactions) the additional elements have to be present:
|
||||
// - a json-object "CrossSection" (as described in "buildTotalCrossSection" function)
|
||||
// - a json-object "ScatteringAngleDistribution" (as described in "buildScatteringAngleDistribution")
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of either a TrackedSpecie or a BackgroundSpecie)
|
||||
//
|
||||
// if the Type "FreeMovement" is specified (for a dummy interaction that does nothing) no additional elements have to be present
|
||||
//
|
||||
// if the Type is "ElectronIonization" the additional elements have to be provided:
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of either a TrackedSpecie or a BackgroundSpecie)
|
||||
// - a json-string "OutgoingElectron", containing the name (given in the json parameter file) of
|
||||
// a TrackedSpecie
|
||||
// - a json-string "OutgoingIon", containing the name (given in the json parameter file) of
|
||||
// a TrackedSpecie
|
||||
// - a json-string "IonizationModel" with a value of either "JanevNonDiss", "JanevDissToGround" or "JanevDissToFirstExcited"
|
||||
// - if the value is "IonizationModel": the "eT2_ionization_janev_non_diss" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
|
||||
// and "OutgoingIon" has to be a T2plus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
|
||||
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
|
||||
// - if the value is "JanevDissToGround": the "eT2_ionization_janev_diss_ground" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
|
||||
// and "OutgoingIon" has to be a Tplus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
|
||||
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
|
||||
// - if the value is "JanevDissToFirstExcited": the "eT2_ionization_janev_diss_first" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
|
||||
// and "OutgoingIon" has to be a Tplus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
|
||||
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
|
||||
//
|
||||
// if the Type is "Excitation" the additiona elements have to be provided:
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of either a TrackedSpecie or a BackgroundSpecie)
|
||||
// - a json-string "ExcitationState" being one of the names defined in "buildExcitationCrossSection"
|
||||
//
|
||||
// if the Type is "Clustering":
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of either a TrackedSpecie or a BackgroundSpecie)
|
||||
// - a json-string "Product" (being a name of a tracked specie as defined in the json parameter file)
|
||||
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
|
||||
// - a json-string "ClusteringType" specifying if the clustering is either a tertiary or radiative process
|
||||
// (if tertiary is chosen the specifed cross section function is only the rate coefficient diveded by the velocity (units: m^6/s / (m/s)))
|
||||
// otherwise it is handled as a "normal" cross section (m^2)
|
||||
//
|
||||
// if the Type is "ChargeExchange" (right now only if the species for which it's defined is the target with a charge of +1):
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of either a TrackedSpecie or a BackgroundSpecie)
|
||||
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
|
||||
//
|
||||
// if the Type is "Recombination" the additional elements have to be present as well:
|
||||
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
|
||||
// of a TrackedSpecie)
|
||||
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
|
||||
//
|
||||
// examples for the usage in a json-file can be found in simulation_config/interactions_examples.json
|
||||
void addInteractions(
|
||||
std::shared_ptr<species::TrackedSpecie> specie,
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
@@ -21,17 +79,62 @@ void addInteractions(
|
||||
Parameter& parameter,
|
||||
json_path& path_to_interactions);
|
||||
|
||||
|
||||
// returns the cross section function defined in the given json-object
|
||||
// the json-object has to either contain a json-string "PredefinedFunction", a json-object "1dFunction" or a json-object "ExcitationFunction"
|
||||
// if the json-string "PredefinedFunction" is defined it has to have a value of one of the following strings:
|
||||
// - "eT2_elastic_scattering_constant", "eT2_elastic_scattering", "TpT2_elastic_scattering_tabata", "T3pT2_elastic_scattering_tabata",
|
||||
// "eT2_ionization_janev_diss_ground", "eT2_ionization_janev_diss_first", "TpT2_clustering_radiative_ascendion_pasil",
|
||||
// "TpT2_clustering_tertiary_ascendion_pasil", "T2pT2_clustering_janev", "T2pT2_charge_exchange_janev", "eT2p_recombination_janev", "eT3p_recombination_janev"
|
||||
// (further explanations can be found in "interactions/cross_sections.h"; the functions have the same name as the corresponding string listed above)
|
||||
//
|
||||
// if the json-object "1dFunction" exists, it has to follow the structure described in "generators/function_generator.h" for function1D
|
||||
//
|
||||
// if the json-object "ExcitationFunction" has to exist, this object has to contain a json-string called "ExcitationState",
|
||||
// which has to be one of the strings defined in "buildExcitationCrossSection"
|
||||
std::function<double(double)> buildTotalCrossSection(json_t* object);
|
||||
|
||||
// return a cross section function depending on two variables (e.g. in-going and out-going particle energies in an ionization)
|
||||
// has to contain a json-string "PredefinedFunction" with a value of "eT2_ionization_bed"
|
||||
// (right now the function is only defined but never used)
|
||||
std::function<double(double, double)> build2DCrossSection(json_t* object);
|
||||
|
||||
// return a shared_ptr to a ScatteringAngleDistribution object that is defined by the given json-object
|
||||
// has to contain a json-object called:
|
||||
// "Isotropic". This object does not need any elements.
|
||||
//
|
||||
// "AngleDistributionFromFile". Has to contain a json-object "PathToH5" following the format as described in "readAbsoluteFilename"
|
||||
// (defined in "generators/vector_field_generator.h")
|
||||
//
|
||||
// "CompositeAngleDistribution". Has to contain a
|
||||
// - json-object "DeciderEnergy" following the description of "json_read_energy" (defined in "simulation/jansson_additionals.h")
|
||||
// - two json-objects "LowerDistribution" and "HigherDisribuiton" as defined for this function
|
||||
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
|
||||
json_t* object);
|
||||
|
||||
// return the value of the excitation energy for the given string defining the final excitation state of the target particle
|
||||
// possible values for the excitation_state are (the numerical values can be found in the interaction_generatior.cpp file):
|
||||
// - janev_singlet_B1, janev_singlet_B1prime, janev_singlet_B1primeprime, janev_singlet_C1, janev_singlet_D1,
|
||||
// janev_singlet_D1prime, janev_singlet_symmetry_forbidden_EF1, janev_singlet_symmetry_forbidden_HHb,
|
||||
// janev_singlet_symmetry_forbidden_GK1, janev_singlet_symmetry_forbidden_I1, janev_triplet_A3, janev_triplet_B3,
|
||||
// janev_triplet_C3, janev_triplet_D3, janev_triplet_E3, janev_vibrational_first, janev_vibrational_second,
|
||||
// england_rotational_j0_to_j2, england_rotational_j1_to_j3
|
||||
double buildExcitationEnergy(std::string excitation_state);
|
||||
|
||||
// return the function for a predefined excitation cross section (see simulation/cross_sections.h)
|
||||
// defined by the string "excitation_state"
|
||||
// possible values for the excitation_state are:
|
||||
// - janev_singlet_B1, janev_singlet_B1prime, janev_singlet_B1primeprime, janev_singlet_C1, janev_singlet_D1,
|
||||
// janev_singlet_D1prime, janev_singlet_symmetry_forbidden_EF1, janev_singlet_symmetry_forbidden_HHb,
|
||||
// janev_singlet_symmetry_forbidden_GK1, janev_singlet_symmetry_forbidden_I1, janev_triplet_A3, janev_triplet_B3,
|
||||
// janev_triplet_C3, janev_triplet_D3, janev_triplet_E3, janev_vibrational_first, janev_vibrational_second,
|
||||
// england_rotational_j0_to_j2, england_rotational_j1_to_j3
|
||||
std::function<double(double)> buildExcitationCrossSection(
|
||||
std::string excitation_state);
|
||||
|
||||
// if the string target_name is used as a key in either the map for the TrackedSpecies or
|
||||
// the map for the BackgroundSpecies returns the corresponding Species
|
||||
// (the keys in the map are defined by the name given in the json parameter file)
|
||||
std::shared_ptr<species::Specie> findTarget(
|
||||
std::string& target_name,
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
@@ -39,6 +142,9 @@ std::shared_ptr<species::Specie> findTarget(
|
||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
|
||||
background_species);
|
||||
|
||||
// if the string target_name is used as a key in either the map for the TrackedSpecies
|
||||
// returns the corresponding TrackedSpecie
|
||||
// (the keys in the map are defined by the name given in the json parameter file)
|
||||
std::shared_ptr<species::TrackedSpecie> findTracked(
|
||||
std::string& target_name,
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
|
||||
@@ -7,7 +7,16 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a DeletionLogger object described by the given json-object
|
||||
// can contain a json-array or a json-string "Type"
|
||||
// - if it's a json-array: list the DeletionTypes that should be counted
|
||||
// during the simulation (json-strings: "wall", "recombination", "max_interactions", "max_time_alive" and "cluster_formation")
|
||||
// - if it's a json-string: has to have the value "all" and then all DeletionTypes are tracked (see list above)
|
||||
// - if not present: no DeletionTypes are tracked
|
||||
std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object);
|
||||
// return a shared_ptr to a DeletionLogger object described at the given path
|
||||
// in the Parameter object, this object has to contain a json-object "Deletion"
|
||||
// following the structure in the overload of this function
|
||||
std::shared_ptr<DeletionLogger> buildDeletionLogger(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_logger);
|
||||
|
||||
@@ -6,8 +6,15 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// create an MagneticField object from a json_t pointer to an json object
|
||||
// defining the magnetic field
|
||||
// has to consist of a json-objects called "VectorField"
|
||||
// as described in "generators/vector_field_generator.h" (function: "buildVectorField")
|
||||
std::shared_ptr<MagneticField> magneticField(json_t* object);
|
||||
|
||||
// create an MagneticField object from the given Parameter object
|
||||
// json file has to have a json object called "MagneticField" directly in the root object
|
||||
// of the parameter file
|
||||
std::shared_ptr<MagneticField> magneticField(Parameter& parameter);
|
||||
}; // namespace generator
|
||||
|
||||
|
||||
@@ -4,20 +4,27 @@
|
||||
#include <map>
|
||||
#include "jansson.h"
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
enum class ImplementedSpecies;
|
||||
};
|
||||
|
||||
namespace generator {
|
||||
|
||||
// class containing a map of the masses (in kg) to the respective ImplementedSpecies
|
||||
class SpeciesMasses {
|
||||
public:
|
||||
// return the mass of the ImplementedSpecies
|
||||
static double mass(const species::ImplementedSpecies& species);
|
||||
|
||||
private:
|
||||
static std::map<species::ImplementedSpecies, double> mass_;
|
||||
};
|
||||
|
||||
// return the mass of the specie at the json-object
|
||||
// has to contain either a json-string "FromParticleType" or a json-double "value"
|
||||
// if "FromParticleType" is specified, it has to be one of the strings defined in the SpecieAlias class in "generators/species_generator.h"
|
||||
// if "value" is specified, it has to be the value in (kg)
|
||||
double buildMass(json_t* object);
|
||||
|
||||
}; // namespace generator
|
||||
|
||||
@@ -7,6 +7,22 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a Mover object described at the given path in the Parameter file
|
||||
// the json-object at path_to_mover has to consist of a json-object called either "Boris", "Drift" or "Euler"
|
||||
// if "Boris" exists:
|
||||
// - has to contain a json-object "MaximalTimestepLength", which has to contain
|
||||
// a json-double called "value" giving the maximum allowed timestep for the BorisMover
|
||||
// in seconds
|
||||
//
|
||||
// if "Drift" is specified:
|
||||
// - has to contain a json-object "MaximalMovedDistance" which has to follow the form
|
||||
// described in json_read_length ("simulation/jansson_additionals.h")
|
||||
// specifies the maximal distance a particle is allowed to move in one timestep
|
||||
//
|
||||
// if "Euler" is specified:
|
||||
// - has to contain a json-object "MaximalMovedDistance" which has to follow the form
|
||||
// described in json_read_length ("simulation/jansson_additionals.h")
|
||||
// specifies the maximal distance a particle is allowed to move in one timestep
|
||||
std::shared_ptr<Mover> buildMover(Parameter& parameter,
|
||||
const json_path& path_to_mover);
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a RandomNumbers object
|
||||
// parameter has to have a json-object "RandomNumbers" in its root object
|
||||
// "RandomNumbers" has to contain a json-double "Seed" which specifies the seed
|
||||
// on mpi-process 0 (a different seed is calculated for all other mpi-processes)
|
||||
std::shared_ptr<RandomNumbers> buildRandomNumbers(Parameter& parameter);
|
||||
|
||||
};
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a Reflector object described at the given path in the Parameter object
|
||||
// the object at the path has to consist of a json-object called either "ReflectorDPS"
|
||||
// or "NoReflector"
|
||||
// if "ReflectorDPS" exists, a json-object "position_z" has to exist following the structure
|
||||
// described in json_read_length ("simulation/jansson_additionals.h")
|
||||
// if "NoReflector" is specified, it can be an empty object
|
||||
std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
|
||||
const json_path& path_to_reflector);
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#include "simulation/scalar_field.h"
|
||||
|
||||
namespace generator {
|
||||
// return a shared_ptr to a ScalarField object described in the json-object "object"
|
||||
// has to contain a json-object "ScalarFieldFunctionInZ"
|
||||
// - has to contain a json-object "zFunction" defined as in "function3D" (in "generators/function_generator.h")
|
||||
// (example in "simulation_config/scalar_fields_examples.json")
|
||||
std::shared_ptr<ScalarField> buildScalarField(json_t* object);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,33 @@
|
||||
#include <string>
|
||||
#include "jansson.h"
|
||||
|
||||
// defined in "IO/simulation_output.h"
|
||||
class SimulationOutput;
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class TrackedSpecie;
|
||||
};
|
||||
|
||||
namespace generator {
|
||||
// return a shared_ptr to a SimulationOutput object defined in the given json-object
|
||||
// the json-object has to consist of:
|
||||
// - a json-string "folder" containing the path to where the ouput file is supposed to be written
|
||||
// (relative to where the program was started from)
|
||||
// - a json-string "filename": with the name of the file (a ".h5" is always appended)
|
||||
// - a json-object "DensityFields", which has to contain:
|
||||
// - a json-double (interpreted as an int) or a json-string called "Intervall":
|
||||
// - if it's a json_double it has to > 0
|
||||
// - if it's a json_string it has to have the value "EachSync", which means that after each cpu-synchronization step
|
||||
// the ouput is written
|
||||
// - a json-string "OverwriteLast" with value either "true" or "false" (defaults to false)
|
||||
// if "true" old data is overwritten each step
|
||||
// - a json-array or a json-string "Species":
|
||||
// - if its a json-string it has to have the value "all" (density information is written for each tracked specie)
|
||||
// - if its a json-array has to be an array of the names used in the "Tracked" object for which
|
||||
// density output should be written
|
||||
// - two more json-objects "CurrentBorders" and "DeletionLogger", which follow the same structure
|
||||
// as the "DensityFields" object
|
||||
std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
||||
json_t* object,
|
||||
const std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
#include "simulation/parameter.h"
|
||||
#include "simulation/species.h"
|
||||
|
||||
// defined in "simulation/timer.h"
|
||||
class Timer;
|
||||
|
||||
namespace generator {
|
||||
|
||||
// structure to store various variables neccessary for the creation
|
||||
// of TrackedSpecies objects
|
||||
struct TrackedSpeciesBuilderInfo {
|
||||
public:
|
||||
std::shared_ptr<Mover> mover;
|
||||
@@ -23,6 +26,7 @@ struct TrackedSpeciesBuilderInfo {
|
||||
std::shared_ptr<DynamicDensityField> density_field;
|
||||
std::shared_ptr<VelocityDistribution> velocity_distribution;
|
||||
std::shared_ptr<DriftVelocity> drift_velocity;
|
||||
std::shared_ptr<DynamicDensityField> last_sync_density_field;
|
||||
|
||||
double mass_kg;
|
||||
double charge_C;
|
||||
@@ -31,6 +35,8 @@ struct TrackedSpeciesBuilderInfo {
|
||||
json_path path_in_json;
|
||||
};
|
||||
|
||||
// structure to store various variables neccessary for the creation
|
||||
// of BackgroundSpecies objects
|
||||
struct BackgroundSpeciesBuilderInfo {
|
||||
public:
|
||||
BackgroundSpeciesBuilderInfo()
|
||||
@@ -48,65 +54,179 @@ struct BackgroundSpeciesBuilderInfo {
|
||||
json_path path_in_json;
|
||||
};
|
||||
|
||||
// class for mapping between certain strings and ImplementedSpecies enums
|
||||
class SpeciesAlias {
|
||||
public:
|
||||
// return the ImplementedSpecies enum for the given string. If the
|
||||
// name is not defined as an alias an error is thrown
|
||||
static species::ImplementedSpecies alias(const std::string& name);
|
||||
// return the string defined as an alias for the given ImplemetedSpecies enum
|
||||
// if no alias has been defined returns an empty string
|
||||
// (if it were to be defined multiple times return the first found instance)
|
||||
static std::string name(species::ImplementedSpecies specie);
|
||||
// check if the string name is defined as an alias
|
||||
static bool isAlias(const std::string& name);
|
||||
|
||||
private:
|
||||
// mapping between the string and enum
|
||||
static std::map<std::string, species::ImplementedSpecies> specie_aliases;
|
||||
};
|
||||
|
||||
// class mapping between ImplementedSpecies enum and the charge corresponding to
|
||||
// the physical particle
|
||||
class SpeciesCharges {
|
||||
public:
|
||||
// return the charge of the ImplementedSpecies enum
|
||||
static double charge(species::ImplementedSpecies species);
|
||||
|
||||
private:
|
||||
static std::map<species::ImplementedSpecies, double> charge_;
|
||||
};
|
||||
|
||||
// class for creation of the TrackedSpecies map and the BackgroudSpecies map
|
||||
class SpeciesBuilder {
|
||||
public:
|
||||
// Constructor: takes the Parameter object created by the input json file
|
||||
SpeciesBuilder(Parameter& parameter);
|
||||
|
||||
// function to create a map of TrackedSpecies and an arbitrary string used to
|
||||
// identify the TrackedSpecies within the map
|
||||
// description for the json-object structure can be found in the private functions of
|
||||
// this class (examples e.g. in "simulation_config/parameter_katrin_example")
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
||||
trackedSpecies();
|
||||
// function to create a map of BackgroundSpecies and an arbitrary string used to
|
||||
// identify the BackgroundSpecies within the map
|
||||
// description for the json-object structure can be found in the private functions of
|
||||
// this class (examples e.g. in "simulation_config/parameter_katrin_example")
|
||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
|
||||
backgroundSpecies();
|
||||
// function to create a shared_ptr to a Timer object
|
||||
std::shared_ptr<Timer> timer();
|
||||
// function to create a shared_ptr to a Timer object (to be used as a copy of the
|
||||
// main timer object during cpu synchronization)
|
||||
std::shared_ptr<Timer> lastSyncTimer();
|
||||
|
||||
private:
|
||||
std::map<std::string, BackgroundSpeciesBuilderInfo> background_species_info;
|
||||
std::map<std::string, TrackedSpeciesBuilderInfo> tracked_species_info;
|
||||
std::shared_ptr<Timer> timer_;
|
||||
std::shared_ptr<Timer> last_sync_timer_;
|
||||
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
||||
tracked_species;
|
||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
|
||||
background_species;
|
||||
|
||||
// checks all json-objects (with an aribtrary name used as the name of the corresponding
|
||||
// BackgroundSpecie) in the json-object "Background", which is located in the json-object
|
||||
// "Species" (which is in the root) and creates new entries in the background_species_info
|
||||
// map (and sets the name and path_in_json members)
|
||||
//
|
||||
// example:
|
||||
// {
|
||||
// "Species":{
|
||||
// "Background": {
|
||||
// "background1": {...},
|
||||
// ...
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
// }
|
||||
// in this example the name is set to "background1" and path_in_json to ["Species", "Background", "background1"]
|
||||
void initBackgroundSpecies(Parameter& parameter);
|
||||
// checks all json-objects (with an aribtrary name used as the name of the corresponding
|
||||
// BackgroundSpecie) in the json-object "Tracked", which is located in the json-object
|
||||
// "Species" (which is in the root) and creates new entries in the background_species_info
|
||||
// map (and sets the name and path_in_json members)
|
||||
//
|
||||
// example:
|
||||
// {
|
||||
// "Species":{
|
||||
// "Tracked": {
|
||||
// "tracked1": {...},
|
||||
// ...
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
// }
|
||||
// in this example the name is set to "tracked1" and path_in_json to ["Species", "Tracked", "tracked1"]
|
||||
void initTrackedSpecies(Parameter& parameter);
|
||||
|
||||
// for each element of the background_species_info element and for each tracked_species_info element
|
||||
// fill the velocity_distribution member with a VelocityDistribution object
|
||||
// described in a json-object called "VelocityDistribution", that has to follow the
|
||||
// format described in "buildVelocityDistribution" (generators/velocity_distribution_generator.h)
|
||||
void fillVelocityDistribution(Parameter& parameter);
|
||||
// for each element of the background_species_info element and for each tracked_species_info element
|
||||
// fill the drift_velocity member with a DirftVelocity object
|
||||
// described in a json-object called "DriftVelocity", that has to follow the
|
||||
// format described in "buildDriftVelocity" (generators/drift_velocity_generator.h)
|
||||
void fillDriftVelocity(Parameter& parameter);
|
||||
// for each element of the background_species_info element and for each tracked_species_info element
|
||||
// fill the mass_kg member with the value defined in the SpeciesMasses class (defined in
|
||||
// "generators/mass_generator.h")
|
||||
void fillMass();
|
||||
// for each element of the background_species_info element and for each tracked_species_info element
|
||||
// fill the charge_C member with the value defined in the SpeciesCharges class (defined here in
|
||||
// "generators/species_generator.h")
|
||||
void fillCharge();
|
||||
// for all elements in the tracked_species map add the defined interactions
|
||||
// in the path stored in the corresponding tracked_species_info element (i.e. ["Species", "Tracked", name of the tracked specie])
|
||||
// a json-object "Interactions" has to exist, this object has to follow the
|
||||
// format described for the "addInteractions" function (defined in "generators/interaction_generator.h")
|
||||
void fillInteractions(Parameter& parameter);
|
||||
|
||||
// read the json-string "ParticleType" in the json-object at the path stored in
|
||||
// path_in_json in the BackgroundSpeciesBuilderInfo map for all elements
|
||||
// "ParticleType" has to be one of the strings defined as an alias in
|
||||
// the SpeciesAlias class ("generators/species_generator.h")
|
||||
void fillBackgroundSpecieType(Parameter& parameter);
|
||||
// for all elements in the BackgroundSpeciesBuilderInfo map create the
|
||||
// density member with the density field described in the json-object "ConstantDensityField"
|
||||
// (in the json-object at path_in_json)
|
||||
// "ConstantDensityField" has to follow the structure described in "buildConstantDensityField"
|
||||
// (defined in "generators/density_field_generator.h")
|
||||
void fillBackgroundDensity(Parameter& parameter);
|
||||
|
||||
// read the json-string "ParticleType" in the json-object at the path stored in
|
||||
// path_in_json in the TrackedSpeciesBuilderInfo map for all elements
|
||||
// "ParticleType" has to be one of the strings defined as an alias in
|
||||
// the SpeciesAlias class ("generators/species_generator.h")
|
||||
void fillTrackedSpecieType(Parameter& parameter);
|
||||
// fill current_collector and last_sync_current_collector members of the
|
||||
// TrackedSpecies map, created according to the json-object
|
||||
// "CurrentCollector" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildCurrentCollector" ("generators/current_collector_generator.h")
|
||||
void fillCurrentCollector(Parameter& parameter);
|
||||
// fill deletion_logger and last_sync_deletion_logger members of the
|
||||
// TrackedSpecies map, created according to the json-object
|
||||
// "Loggers" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildDeletionLogger" ("generators/logger_generator.h")
|
||||
void fillLoggers(Parameter& parameter);
|
||||
// fill mover member of the TrackedSpeciesBuilderInfo map,
|
||||
// created according to the json-object "Mover" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildMover" ("generators/mover_generator.h")
|
||||
void fillMover(Parameter& parameter);
|
||||
// fill terminator member of the TrackedSpeciesBuilderInfo map,
|
||||
// created according to the json-object "Terminator" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildTerminator" ("generators/mover_generator.h")
|
||||
void fillTerminator(Parameter& parameter);
|
||||
// fill reflector member of the TrackedSpeciesBuilderInfo map,
|
||||
// created according to the json-object "Reflector" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildReflector" ("generators/mover_generator.h")
|
||||
void fillReflector(Parameter& parameter);
|
||||
// fill density_field and last_sync_density_field members of the
|
||||
// TrackedSpeciesBuilderInfo map, created according to the json-object
|
||||
// "DynamicDensityField" (located in at the path_in_json member)
|
||||
// has to follow the form described in "buildDyamicDensityField"
|
||||
void fillTrackedDensity(Parameter& parameter);
|
||||
|
||||
// fill timer_ and last_sync_timer_ objects (no json-specifications needed)
|
||||
void initTimer();
|
||||
// create the TrackedSpecies and BackgroundSpecies maps from the data contained in
|
||||
// the corresponding entries of the TrackedSpeciesBuilderInfo and BackgroundSpeciesBuilderInfo
|
||||
// maps
|
||||
void buildSpecies();
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a Terminator object described by the given json-object in the Parameter object
|
||||
// the object at the path has to contain:
|
||||
// - a json-double (later cast to an integer) "MaximumInteractions"
|
||||
// - a json-object "MaxTimeAlive", which has to contain a json-double "value", giving the
|
||||
// maximum time a particle is allowed to live in seconds
|
||||
// - a json-object "BoundaryGeometry", which has to follow the structure given in buildGeometry
|
||||
// ("generators/geometry_generator.h")
|
||||
std::shared_ptr<Terminator> buildTerminator(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_terminator);
|
||||
|
||||
@@ -8,9 +8,57 @@
|
||||
#include "simulation/vector_field.h"
|
||||
|
||||
namespace generator {
|
||||
// create an VectorField object from a json_t pointer to an json object
|
||||
// defining the vector field:
|
||||
// has to contain a json-object with key either: "VectorFieldConstant", "VectorFieldFunctionInZ" or "VectorFieldFromArray"
|
||||
// if neither of those is specified an error is thrown
|
||||
// if "VectorFieldConstant" is specified:
|
||||
// - has to contain a json-object called "constant" containing a json-array of size 3 (r,phi and z component in this ordering)
|
||||
// with an arbitrary key
|
||||
// if "VectorFieldFunctionInZ" is specifid:
|
||||
// - has to contain a json-object with key "zFunction", that defines a function3D (see "generators/function_generator.h")
|
||||
// if "VectorFieldFromArray" is specified:
|
||||
// - has to contain a json-object called "ReadArrayFromFile" (see readComponentFromFile)
|
||||
// - a json-double "Radius" specifying the radial extent for which the read in vector field is defined
|
||||
// - a json-double "Length" specifying the longitudinal extent for which the read in vector field is defined
|
||||
// examples for the look in a json file can be found in "simulation_config/vector_field_examples.json"
|
||||
std::shared_ptr<VectorField> buildVectorField(json_t* object);
|
||||
|
||||
// read a path to a file from a json-object consisting of three json-string objects:
|
||||
// - "Type": acceptable value either "AbsolutePath" or "RelativeToHomebase", if neither is specified throw an error
|
||||
// - if "Type" is "AbsolutePath", the json-string with key "AbsoluteFolderPath" has to be defined, containing
|
||||
// the absolute path to the directory the file that should be read is located in
|
||||
// - if "Type" is "RelativeToHomebase", the json-string with key "RelativePath" has to be defined, containing
|
||||
// the path relative (wrt the shell variable "HOMEBASE") to the directory the file that should be read is located in
|
||||
// - the json-string with key "Filename", containing the name of the file to be read
|
||||
//
|
||||
// "key_of_object": {
|
||||
// "Type": "RelativeToHomebase" or "AbsolutePath",
|
||||
// "RelativePath" or "AbsoluteFolderPath": path to directory
|
||||
// "Filename": name of file in the path to the directory
|
||||
// }
|
||||
std::string readAbsoluteFilename(json_t* object);
|
||||
|
||||
// read a single component (radial, azimuthal or longitudinal) into a blitz::Array
|
||||
// has to consist of:
|
||||
// - a json_object called "PathToH5" in the format described for the function "readAbsoluteFilename"
|
||||
// - a json_array "Keys" consisting of the keys of the absolute path to groups that should be read from the given hdf5 file
|
||||
//
|
||||
// "key_to_object": {
|
||||
// "PathToH5" : { ... },
|
||||
// "Keys": [path to component of vector field in r-dir, path to component of vector field in phi-dir, path to component of vector field in z-dir]
|
||||
// }
|
||||
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component);
|
||||
|
||||
// read a single 3d array into a blitz::Array
|
||||
// has to consist of:
|
||||
// - a json_object called "PathToH5" in the format described for the function "readAbsoluteFilename"
|
||||
// - a json_string "Key" specifying the path to the array within the hdf5 file
|
||||
//
|
||||
// "key_to_object": {
|
||||
// "PathToH5" : { ... },
|
||||
// "Key": path within hdf5 file
|
||||
// }
|
||||
blitz::Array<double, 3> readFromFile(json_t* object);
|
||||
} // namespace generator
|
||||
|
||||
|
||||
@@ -8,6 +8,21 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a VelocityDistributionFunction object described by the json-object
|
||||
// at the given json_path in the Parameter object
|
||||
// has to contain a json-object called either "IsotropicDistribution" or "DirectedDistribution"
|
||||
// if "IsotropicDistribution" is specified:
|
||||
// - has to include a json-object "EnergyDistributionFunction" as defined in "generators/energy_distribtion_function_generator.h"
|
||||
// - has to include a json-object "Mass" as defined in "generators/mass_generator.h"
|
||||
// - returns a IsotropicDistribution object (see simulation/energy_distribtion.h)
|
||||
//
|
||||
// if "DirectedDistribution" is specified:
|
||||
// - has to include a json-object "EnergyDistributionFunction" as defined in "generators/energy_distribtion_function_generator.h"
|
||||
// - has to include a json-object "Mass" as defined in "generators/mass_generator.h"
|
||||
// - has to include a json-object "Direction", including a json-array "vector" containing the direction in cartesian coordinates
|
||||
// - returns a DirectedDistribution object (see simulation/energy_distribtion.h)
|
||||
//
|
||||
// (example in "simulation_config/velocity_distribution_function_examples.json")
|
||||
std::shared_ptr<VelocityDistributionFunction> buildVelocityDistributionFunction(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_distribution);
|
||||
|
||||
@@ -8,6 +8,25 @@
|
||||
|
||||
namespace generator {
|
||||
|
||||
// return a shared_ptr to a VelocityDistribution object described by the json-object
|
||||
// at the path "path_to_distribution" (from root object) in the Parameter object
|
||||
// consisting of a json-object either called "VelocityDistributionFromFunction" or "null"
|
||||
// if "VelocityDistributionFromFunction" is specified:
|
||||
// - has to consist of a json-object "VelocityDistributionFunction", as defined in "generators/velocity_distribution_function_generator.h"
|
||||
//
|
||||
// if "null" is specified:
|
||||
// - no further information has to be specified
|
||||
//
|
||||
// example:
|
||||
// "path_to_distribution" : {
|
||||
// "VelocityDistributionFromFunction": {
|
||||
// "VelocityDistributionFunction" : { ... }
|
||||
// }
|
||||
// }
|
||||
// or
|
||||
// "path_to_distribution" : {
|
||||
// "null": {}
|
||||
// }
|
||||
std::shared_ptr<VelocityDistribution> buildVelocityDistribution(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_distribution);
|
||||
|
||||
@@ -4,17 +4,23 @@
|
||||
#include <functional>
|
||||
#include "simulation/interaction.h"
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class Specie;
|
||||
};
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for charge exchange interactions e.g. T2+ + T2 --> T2 + T2+
|
||||
// only for symmetric charge exchange processes (i.e. A+ + A --> A + A+)
|
||||
class ChargeExchange : public Interaction {
|
||||
public:
|
||||
// Constructor: takes the function describing the cross section (dependent on the energy of the incident particle)
|
||||
// and a shared_ptr to the Species that is the target in the interaction
|
||||
ChargeExchange(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target);
|
||||
|
||||
// return the result of the interaction as an InteractionOutput object
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
};
|
||||
|
||||
@@ -4,24 +4,46 @@
|
||||
#include <functional>
|
||||
#include "simulation/interaction.h"
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class Specie;
|
||||
};
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for cluster formation interactions (A + B --> AB) or (A + BC --> AB + C)
|
||||
class ClusterFormation : public Interaction {
|
||||
public:
|
||||
// Constructor: takes the function describing the cross section (dependent on the energy of the incident particle)
|
||||
// and a shared_ptr to the Species that is the target in the interaction
|
||||
// and a shared_ptr to the TrackedSpecie that is the product of the interaction
|
||||
ClusterFormation(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<species::TrackedSpecie> product);
|
||||
// return an InteractionOutput object with the results of the interaction
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
|
||||
private:
|
||||
protected:
|
||||
std::shared_ptr<species::TrackedSpecie> product_;
|
||||
};
|
||||
|
||||
// class for tertiary association (A + B + B --> AB + B)
|
||||
class ClusterFormationTertiary : public ClusterFormation {
|
||||
public:
|
||||
// Constructor: takes the function describing the cross section (dependent on the energy of the incident particle)
|
||||
// and a shared_ptr to the Species that is the target in the interaction
|
||||
// and a shared_ptr to the TrackedSpecie that is the product of the interaction
|
||||
ClusterFormationTertiary(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<species::TrackedSpecie> product);
|
||||
|
||||
// due to only the rate coefficients being available the cross section is
|
||||
// approximated as sigma = rate_coefficient * density / velocity
|
||||
// (units of the tertiary rate coefficient m^6/s)
|
||||
double microscopicCrossSection(double energy_eV, const Coordinate& position);
|
||||
};
|
||||
|
||||
}; // namespace interaction
|
||||
|
||||
#endif /* CLUSTER_FORMATION_H */
|
||||
|
||||
@@ -7,43 +7,102 @@
|
||||
namespace interaction {
|
||||
|
||||
namespace d2CrossSection {
|
||||
// returns a function dependent on the initial energy of the electron ionization
|
||||
// of T2 and the final energy of (one of) the resulting electrons
|
||||
// function defines the energy distribution of the energy distribution of
|
||||
// the secondary electron
|
||||
// (functional form from Kim and Rudd 1994)
|
||||
std::function<double(double, double)> eT2_ionization_bed();
|
||||
}
|
||||
|
||||
// ? mention how data was obtained ?
|
||||
namespace totalCrossSection {
|
||||
|
||||
// returns function that returns a constant value of 1.4e-19 m²
|
||||
std::function<double(double)> eT2_elastic_scattering_constant();
|
||||
// returns a function that linearly interpolates between the values
|
||||
// defined in the file "data/crossSections/eT2_elastic_scattering/eT2_elastic_cross_section_total.h5"
|
||||
// (relative to the HOMEBASE variable)
|
||||
// data for e + T2 elastic scattering
|
||||
std::function<double(double)> eT2_elastic_scattering();
|
||||
std::function<double(double)> TpT2_elasitc_scattering_tabata();
|
||||
std::function<double(double)> T3pT2_elasitc_scattering_tabata();
|
||||
// return function that describes the total elastic scattering cross section
|
||||
// for T⁺ + T₂
|
||||
std::function<double(double)> TpT2_elastic_scattering_tabata();
|
||||
// return function that describes the total elastic scattering cross section
|
||||
// for T₃⁺ + T₂
|
||||
std::function<double(double)> T3pT2_elastic_scattering_tabata();
|
||||
|
||||
// return a function that describes the cross section for charge exchange
|
||||
// T₂⁺ + T₂ --> T₂ + T₂⁺
|
||||
std::function<double(double)> T2pT2_charge_exchange_janev();
|
||||
|
||||
// return a function describing the cross section for electron ionization of
|
||||
// T₂: T₂ + e¯ --> T₂⁺ + 2e¯ (?)
|
||||
std::function<double(double)> eT2_ionization_bed();
|
||||
// return a function describing the non-dissociative cross section for electron ionization of
|
||||
// T₂: T₂ + e¯ --> T₂⁺ + 2e¯
|
||||
std::function<double(double)> eT2_ionization_janev_non_diss();
|
||||
// return a function describing the cross section for dissociative electron ionization of
|
||||
// T₂, where the products are in the ground state: T₂ + e¯ --> T⁺ + T + 2e¯ (?)
|
||||
std::function<double(double)> eT2_ionization_janev_diss_ground();
|
||||
// return a function describing the cross section for dissociative electron ionization of
|
||||
// T₂, where the products are in the first excited state: T₂ + e¯ --> T⁺ + T* + 2e¯ (?)
|
||||
std::function<double(double)> eT2_ionization_janev_diss_first();
|
||||
|
||||
// return a function describing the cross section for radiative clustering of T⁺ and T₂:
|
||||
// T⁺ + T₂ --> T₃⁺ + h\nu
|
||||
std::function<double(double)> TpT2_clustering_radiative_ascendion_pasil();
|
||||
// return a function describing the cross section up to the density of the T₂ at
|
||||
// the position of the interaction for tertiary clustering of T⁺ and T₂:
|
||||
// T⁺ + 2T₂ --> T₃⁺ + T₂
|
||||
// cross section = k_tertiary / velocity * density_target
|
||||
// return only a function calculating k_tertiary / velocity (k_tertiary: tertiary rate coefficient)
|
||||
std::function<double(double)> TpT2_clustering_tertiary_ascendion_pasil();
|
||||
// return a function describing the cross section for clustering of T₂⁺ and T₂:
|
||||
// T₂⁺ + T₂ --> T₃⁺ + T
|
||||
std::function<double(double)> T2pT2_clustering_janev();
|
||||
|
||||
// return a function describing the cross section for electronic excitation of T₂ by
|
||||
// the impact of an electron from the singlet ground state to the final state
|
||||
// specified in the string "final_state". final_state has to have one of the following
|
||||
// values: "B1", "B1prime", "B1primeprime", "C1", "D1", "D1prime"
|
||||
std::function<double(double)>
|
||||
eT2_excitation_electric_janev_from_singlet_ground_state(
|
||||
std::string final_state);
|
||||
// return a function describing the cross section for electronic excitation of T₂ by
|
||||
// the impact of an electron from the singlet ground state to the final state that is
|
||||
// forbidden by the symmetry of the system specified in the string "final_state".
|
||||
// final_state has to have one of the following values:
|
||||
// "EF1", "HHb", "GK1", "I1"
|
||||
std::function<double(double)>
|
||||
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
|
||||
std::string final_state);
|
||||
// return a function describing the cross section for electronic excitation of T₂ by
|
||||
// the impact of an electron from the triplet ground state to the final state
|
||||
// specified in the string "final_state". final_state has to have one of the following
|
||||
// values: "A3", "B3", "C3", "D3", "E3"
|
||||
std::function<double(double)>
|
||||
eT2_excitation_electric_janev_from_triplet_ground_state(
|
||||
std::string final_state);
|
||||
|
||||
// return a function describing the cross section for vibrational excitation of T₂
|
||||
// from ground to first excited state by electron impact.
|
||||
std::function<double(double)> eT2_excitation_vibrational_janev_first();
|
||||
// return a function describing the cross section for vibrational excitation of T₂
|
||||
// from ground to second excited state by electron impact.
|
||||
std::function<double(double)> eT2_excitation_vibrational_janev_second();
|
||||
// return a function describing the cross section for rotational excitation of T₂
|
||||
// from ground to second excited state by electron impact.
|
||||
std::function<double(double)> eT2_excitation_rotational_j0_to_j2_england();
|
||||
// return a function describing the cross section for rotational excitation of T₂
|
||||
// from first to third excited state by electron impact.
|
||||
std::function<double(double)> eT2_excitation_rotational_j1_to_j3_england();
|
||||
|
||||
// return a function describing the cross section for recombination of T₂⁺ with an
|
||||
// electron: T₂⁺ + e⁼ --> T₂
|
||||
std::function<double(double)> eT2p_recombination_janev();
|
||||
// return a function describing the cross section for recombination of T₃⁺ with an
|
||||
// electron: T₃⁺ + e⁼ --> T₂ + T
|
||||
std::function<double(double)> eT3p_recombination_janev();
|
||||
|
||||
}; // namespace totalCrossSection
|
||||
|
||||
@@ -7,12 +7,16 @@ class ScatteringAngleDistribution;
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for handling elastic scattering interactions (A + B --> A + B)
|
||||
class ElasticScattering : public Interaction {
|
||||
public:
|
||||
// Constructor: takes a function for the cross section, a shared_ptr with the Specie of the target of the interaction
|
||||
// and a shared_ptr to a scatteringAngleDistribution object
|
||||
ElasticScattering(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib);
|
||||
|
||||
// return the interaction outcome as an InteractionOutput object
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
|
||||
|
||||
@@ -6,18 +6,24 @@
|
||||
#include "simulation/particle.h"
|
||||
#include "simulation/random_numbers.h"
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class Specie;
|
||||
};
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for handling processes consisting of the excitation (rotational, vibrational or
|
||||
// electronic) of the target particle (e.g. A + B --> A + B*)
|
||||
class Excitation : public Interaction {
|
||||
public:
|
||||
// Constructor: takes the function for the cross section, a shared_ptr to the Specie of the
|
||||
// the threshold energy of the specific excitation type
|
||||
Excitation(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
double excitation_energy_eV);
|
||||
|
||||
// return the output of the interaction as an InteractionOutput object
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for dummy interaction "free movement" (i.e. no interaction)
|
||||
class FreeMovement : public Interaction {
|
||||
public:
|
||||
// Constructor: does not need anything
|
||||
FreeMovement();
|
||||
// return the result of the interaction as an InteractionOutput object
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
|
||||
double microscopicCrossSection(double energy_eV);
|
||||
// return the value of the cross section at the given energy (eV) (units: m^2)
|
||||
double microscopicCrossSection(double energy_eV, const Coordinate& position);
|
||||
// return the density scaled cross section value for the energy of the
|
||||
// Particle (units m^{-1})
|
||||
double macroscopicCrossSection(particle::Particle& particle);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,11 +5,18 @@
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for drawing the energy of the outgoing electron (i.e. the slower one of the
|
||||
// two electrons that exist after the interaction)
|
||||
class IonizationEnergyDistribution {
|
||||
public:
|
||||
// Constructor: takes a function dependent on the energy of the incident particle
|
||||
// and the energy of the ejected electron. Function should describe
|
||||
// the energy distribution of the ejected electron.
|
||||
// takes the ionization threshold energy in eV
|
||||
IonizationEnergyDistribution(
|
||||
std::function<double(double, double)> d2_cross_section,
|
||||
double ionization_energy_eV);
|
||||
// draw the energy (always < (impact_energy - ionization_energy)/2) of the ejected particle
|
||||
double rollImpactParticleEnergyAfterCollision(double impact_energy,
|
||||
RandomNumbers* generator);
|
||||
|
||||
@@ -18,20 +25,37 @@ class IonizationEnergyDistribution {
|
||||
const double ionization_energy_eV_;
|
||||
};
|
||||
|
||||
// function handling the azimuthal angle distribution for
|
||||
// electron ionization
|
||||
class IonizationScatteringAngleDistribution {
|
||||
public:
|
||||
// draw the azimuthal angle of the faster electron after collision
|
||||
// impact_energy is the kinetic energy of the particle in the rest frame of the target in eV before the collision
|
||||
// impact_energy is the kinetic energy of the particle (the faster of the two electrons) in the rest frame of the target in eV after the collision
|
||||
double rollAzimuthImpactParticleAfterCollision(
|
||||
double impact_energy,
|
||||
double energy_impact_particle_new,
|
||||
RandomNumbers* generator);
|
||||
// draw the azimuthal angle of the slower electron after collision
|
||||
// impact_energy is the kinetic energy of the particle in the rest frame of the target in eV before the collision
|
||||
// impact_energy is the kinetic energy of the particle (the slower of the two electrons) in the rest frame of the target in eV after the collision
|
||||
double rollAzimuthEjectedParticleAfterCollision(
|
||||
double impact_energy,
|
||||
double energy_impactParticle_new,
|
||||
RandomNumbers* generator);
|
||||
};
|
||||
|
||||
// class for handling electron impact ionization
|
||||
class ElectronIonization : public Interaction {
|
||||
public:
|
||||
// Constructor: takes a function describing the cross section for the interaction
|
||||
// a shared_ptr to the Specie of the target particle
|
||||
// a shared_ptr to the TrackedSpecie electron describing the incident electron
|
||||
// a shared_ptr to the TrackedSpecie ion describing the positive ion type that is created
|
||||
// a shared_ptr to the IonizationEnergyDistribution, descibing the energy distribution of either
|
||||
// of the two electrons after the interaction
|
||||
// a shared_ptr to the IonizationScatterinAngleDistribution, which describes the
|
||||
// azimuthal angle distribution of both final electrons
|
||||
ElectronIonization(
|
||||
std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
@@ -41,6 +65,8 @@ class ElectronIonization : public Interaction {
|
||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
|
||||
double ionization_energy_eV);
|
||||
|
||||
// perform the interaction and return an InteractionOutput object
|
||||
// containing the corresponding information (new particles)
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
|
||||
|
||||
@@ -5,15 +5,23 @@
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class for handling recombination between two simulated species (TrackedSpecies)
|
||||
class Recombination : public Interaction {
|
||||
public:
|
||||
// Constructor: takes a function describing the energy dependent cross section
|
||||
// and a shared_ptr to the TrackedSpecie that is the target in the interaction
|
||||
Recombination(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::TrackedSpecie> target);
|
||||
|
||||
// return the result of the interaction as an InteractionOutput object
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
// return the cross section scaled by the density of the target at the position
|
||||
// of the incident particle (units: m^{-1})
|
||||
double macroscopicCrossSection(particle::Particle& particle);
|
||||
|
||||
private:
|
||||
double macroscopicCrossSection(const Coordinate& position, const int bin_index);
|
||||
std::shared_ptr<species::TrackedSpecie> recombination_target_;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "constants/sim_constants.h"
|
||||
|
||||
// check if a and b are the same up to an accuracy eps defined in constants/sim_constants.h
|
||||
// isEqual(a,b) = true <=> abs(a - b) < eps
|
||||
bool isEqual(double a, double b) {
|
||||
return std::abs(a - b) < SimConstants::compare_epsilon;
|
||||
}
|
||||
|
||||
@@ -3,41 +3,72 @@
|
||||
|
||||
#include "blitz/array.h"
|
||||
|
||||
// Note: seems to be deprecated
|
||||
// structure to store a coordinate wrt the binning of the simulation domain
|
||||
struct BinCoordinate {
|
||||
// Constructor using a blitz::TinyVector<int,3> containing the values defining a bin
|
||||
// and the position frac within that bin
|
||||
BinCoordinate(const blitz::TinyVector<int, 3>& bin,
|
||||
const blitz::TinyVector<double, 3>& frac);
|
||||
|
||||
// Constructor using a blitz::TinyVector<double,3> containing the position and the spacing
|
||||
// to calculate the bin and frac values
|
||||
BinCoordinate(blitz::TinyVector<double, 3> position,
|
||||
blitz::TinyVector<double, 3> spacing);
|
||||
|
||||
blitz::TinyVector<int, 3> bin;
|
||||
blitz::TinyVector<double, 3> frac;
|
||||
|
||||
// return the blitz::TinyVector<int, 3> containing the bin of the variable
|
||||
// position using the specified "spacing"
|
||||
static blitz::TinyVector<int, 3> binValue(
|
||||
blitz::TinyVector<double, 3> position,
|
||||
blitz::TinyVector<double, 3> spacing);
|
||||
|
||||
// return the blitz::TinyVector<int, 3> containing the fractional value within a bin
|
||||
// of the variable position using the specified "spacing"
|
||||
static blitz::TinyVector<double, 3> binFrac(
|
||||
blitz::TinyVector<double, 3> position,
|
||||
blitz::TinyVector<double, 3> spacing);
|
||||
};
|
||||
|
||||
// parent class for different Coordinate types (cartesian, cylinder)
|
||||
// cannot be instantiated
|
||||
class Coordinate {
|
||||
public:
|
||||
// return the value of the stored coordinate transformed to Cartesian space
|
||||
virtual blitz::TinyVector<double, 3> cartesianEntries() const = 0;
|
||||
// return the value of the stored coordinate transformed to Cylinder space
|
||||
virtual blitz::TinyVector<double, 3> cylinderEntries() const = 0;
|
||||
|
||||
// return cos(phi) with phi the second variable of the coordinate in cylinder
|
||||
// coordinates
|
||||
virtual double cosAzimuth() const = 0;
|
||||
// return cos(phi) with phi the second variable of the coordinate in cylinder
|
||||
// coordinates
|
||||
virtual double sinAzimuth() const = 0;
|
||||
|
||||
// add the values of the parameter coordinate to the value stored in this variable
|
||||
virtual void add(const Coordinate& coordinate) = 0;
|
||||
};
|
||||
|
||||
// class for storing and handling of coordinates in cartesian space
|
||||
class CartesianCoordinate : public Coordinate {
|
||||
public:
|
||||
// Constructor using a blitz::TinyVector that holds the values of a cartesian coordinate (x,y,z)
|
||||
CartesianCoordinate(const blitz::TinyVector<double, 3>& cartesian_position);
|
||||
// Constructor using an arbitrary Coordinate object
|
||||
CartesianCoordinate(const Coordinate& coordinate);
|
||||
|
||||
// return the value of the stored coordinate transformed to Cartesian space
|
||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
||||
// return the value of the stored coordinate transformed to Cylider space
|
||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
||||
|
||||
double cosAzimuth() const;
|
||||
double sinAzimuth() const;
|
||||
|
||||
// add the values of the parameter coordinate to the value stored in this variable
|
||||
void add(const Coordinate& coordinate);
|
||||
|
||||
private:
|
||||
@@ -46,62 +77,107 @@ class CartesianCoordinate : public Coordinate {
|
||||
|
||||
class CylinderCoordinate : public Coordinate {
|
||||
public:
|
||||
// Constructor using a blitz::TinyVector that holds the values of a cylinder coordinate (r,phi,z)
|
||||
CylinderCoordinate(const blitz::TinyVector<double, 3>& cylinder_position);
|
||||
// Constructor using an arbitrary Coordinate object
|
||||
CylinderCoordinate(const Coordinate& coordinate);
|
||||
|
||||
// return the value of the stored coordinate transformed to Cartesian space
|
||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
||||
// return the value of the stored coordinate transformed to Cylinder space
|
||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
||||
|
||||
double cosAzimuth() const;
|
||||
double sinAzimuth() const;
|
||||
|
||||
// add the values of the parameter coordinate to the value stored in this variable
|
||||
void add(const Coordinate& coordinate);
|
||||
|
||||
private:
|
||||
// transform phi to be in the interval [0, 2pi]
|
||||
void limitPhi();
|
||||
blitz::TinyVector<double, 3> cylinder_position;
|
||||
};
|
||||
|
||||
// parent class for different types of vectors (cartesian vector, cylinder vector)
|
||||
class Vector {
|
||||
public:
|
||||
// return the stored value as a cartesian vector, the transformation depends on
|
||||
// the Coordinate, where the Vector is defined
|
||||
virtual blitz::TinyVector<double, 3> cartesianEntries(
|
||||
const Coordinate& coordinate) const = 0;
|
||||
// return the stored value as a cylinder vector, the transformation depends on
|
||||
// the Coordinate, where the Vector is defined
|
||||
virtual blitz::TinyVector<double, 3> cylinderEntries(
|
||||
const Coordinate& coordinate) const = 0;
|
||||
|
||||
// Add the Vector vector to the value stored in this object; for the addition both
|
||||
// Vectors have to be in the same space (i.e. Cartesian or Cylinder) therefore
|
||||
// the Coordinate is necessary for potential transformations
|
||||
virtual void add(const Vector& vector, const Coordinate& coordinate) = 0;
|
||||
};
|
||||
|
||||
// class for storing and handling of Cylinder Vectors (v_r, v_phi, v_z)
|
||||
class CylinderVector : public Vector {
|
||||
public:
|
||||
// copy constructor
|
||||
CylinderVector(const CylinderVector& vector);
|
||||
// constructor using a blitz::TinyVector containing the cylinder vector components
|
||||
// of a vector
|
||||
CylinderVector(const blitz::TinyVector<double, 3> cylinder_vector);
|
||||
// constructor using an arbitrary vector, needs the Coordinate of the vector
|
||||
// to transform into cylinder space
|
||||
CylinderVector(const Vector& vector, const Coordinate& coordinate);
|
||||
|
||||
// overwrite the "+"-Operator for the addtion of two CylinderVector objects
|
||||
CylinderVector operator+(const CylinderVector& coordinate);
|
||||
|
||||
// return the stored value as a cartesian vector, the transformation depends on
|
||||
// the Coordinate, where the CylinderVector is defined
|
||||
blitz::TinyVector<double, 3> cartesianEntries(
|
||||
const Coordinate& coordinate) const;
|
||||
// return the stored values as a cylinder vector; overwrite of the pure virtual
|
||||
// function in the Vector class
|
||||
blitz::TinyVector<double, 3> cylinderEntries(
|
||||
const Coordinate& coordinate) const;
|
||||
// returns the entries of the CylinderVector without the need for the Coordinate
|
||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
||||
|
||||
// Add the Vector vector to the value stored in this object; for the addition both
|
||||
// Vectors have to be in the same space (i.e. Cartesian or Cylinder) therefore
|
||||
// the Coordinate is necessary for potential transformations
|
||||
void add(const Vector& vector, const Coordinate& coordinate);
|
||||
|
||||
private:
|
||||
blitz::TinyVector<double, 3> cylinder_vector;
|
||||
};
|
||||
|
||||
// class for storing and handling of Cylinder Vectors (v_x, v_y, v_z)
|
||||
class CartesianVector : public Vector {
|
||||
public:
|
||||
// constructor using a blitz::TinyVector containing the cartesian vector components
|
||||
// of a vector
|
||||
CartesianVector(const blitz::TinyVector<double, 3> cartesian_vector);
|
||||
// copy constructor
|
||||
CartesianVector(const CartesianVector& vector);
|
||||
|
||||
// constructor using an arbitrary vector, needs the Coordinate of the vector
|
||||
// to transform into cartesian space
|
||||
CartesianVector(const Vector& vector, const Coordinate& coordinate);
|
||||
|
||||
// return the stored values as a cartesian vector; overwrite of the pure virtual
|
||||
// function in the Vector class
|
||||
blitz::TinyVector<double, 3> cartesianEntries(
|
||||
const Coordinate& coordinate) const;
|
||||
// returns the entries of the CartesianVector without the need for the Coordinate
|
||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
||||
// return the stored value as a cylinder vector, the transformation depends on
|
||||
// the Coordinate, where the CartesianVector is defined
|
||||
blitz::TinyVector<double, 3> cylinderEntries(
|
||||
const Coordinate& coordinate) const;
|
||||
|
||||
// Add the Vector vector to the value stored in this object; for the addition both
|
||||
// Vectors have to be in the same space (i.e. Cartesian or Cylinder) therefore
|
||||
// the Coordinate is necessary for potential transformations
|
||||
void add(const Vector& vector, const Coordinate& coordinate);
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,33 +6,86 @@
|
||||
#include <string>
|
||||
#include "blitz/array.h"
|
||||
|
||||
// defined in "simulation/density_field.h"
|
||||
class DynamicDensityField;
|
||||
// defined in "simulation/timer.h"
|
||||
class Timer;
|
||||
// defined in "simulation/current_collector.h"
|
||||
class CurrentCollector;
|
||||
// defined in "simulation/logger.h"
|
||||
class DeletionLogger;
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class TrackedSpecie;
|
||||
};
|
||||
|
||||
// class to synchronize states between mpi-processes
|
||||
class CpuSynchronizer {
|
||||
public:
|
||||
// CpuSynchronizer();
|
||||
|
||||
// function to handle synchronization of the map of TrackedSpecie
|
||||
// synchronizes the timer, all CurrentCollectors, DynamicDensityFields and DeletionLoggers
|
||||
void synchronize(
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
||||
tracked_species);
|
||||
|
||||
void synchronize(DynamicDensityField* field);
|
||||
void synchronize(CurrentCollector* collector);
|
||||
void synchronize(DeletionLogger* logger);
|
||||
void synchronize(Timer* timer);
|
||||
// function to synchronize a DynamicDensityField;
|
||||
// last_sync_field includes the state of the DynamicDensityField after the last
|
||||
// synchronization, neccessary to calculate changes that have to be communicated
|
||||
// after the synchronization both field and last_sync_field contain the same data
|
||||
// but are different objects
|
||||
void synchronize(DynamicDensityField* field,
|
||||
DynamicDensityField* last_sync_field);
|
||||
// function to synchronize a CurrentCollector;
|
||||
// last_sync_collector includes the state of the CurrentCollector after the last
|
||||
// synchronization, neccessary to calculate changes that have to be communicated
|
||||
// after the synchronization both collector and last_sync_collector contain the same data
|
||||
// but are different objects
|
||||
void synchronize(CurrentCollector* collector,
|
||||
CurrentCollector* last_sync_collector);
|
||||
// function to synchronize a DeletionLogger;
|
||||
// last_sync_logger includes the state of the DeletionLogger after the last
|
||||
// synchronization, neccessary to calculate changes that have to be communicated
|
||||
// after the synchronization both logger and last_sync_logger contain the same data
|
||||
// but are different objects
|
||||
void synchronize(DeletionLogger* logger,
|
||||
DeletionLogger* last_sync_logger);
|
||||
// function to synchronize a Timer;
|
||||
// last_sync_timer includes the state of the Timer after the last
|
||||
// synchronization, neccessary to calculate changes that have to be communicated
|
||||
// after the synchronization both timer and last_sync_timer contain the same data
|
||||
// but are different objects
|
||||
void synchronize(Timer* timer, Timer* last_sync_timer);
|
||||
|
||||
void sumToAll(blitz::Array<double, 4>& array);
|
||||
void sumToAll(blitz::Array<double, 3>& array);
|
||||
void sumToAll(blitz::Array<long int, 4>& array);
|
||||
void sumToAll(double& value);
|
||||
void sumToAll(long int& value);
|
||||
|
||||
// calculates delta = array - last_sync_array, then collects all deltas of all
|
||||
// mpi-processes and adds them to last_sync_array (i.e. array does not get modified)
|
||||
void sumToAll(blitz::Array<double, 4>& array,
|
||||
blitz::Array<double, 4>& last_sync_array);
|
||||
// calculates delta = array - last_sync_array, then collects all deltas of all
|
||||
// mpi-processes and adds them to last_sync_array so that
|
||||
// afterwards last_sync_array has the same values on each mpi-process
|
||||
// (i.e. array does not get modified)
|
||||
void sumToAll(blitz::Array<double, 3>& array,
|
||||
blitz::Array<double, 3>& last_sync_array);
|
||||
// calculates delta = array - last_sync_array, then collects all deltas of all
|
||||
// mpi-processes and adds them to last_sync_array so that
|
||||
// afterwards last_sync_array has the same values on each mpi-process
|
||||
// (i.e. array does not get modified)
|
||||
void sumToAll(blitz::Array<long int, 4>& array,
|
||||
blitz::Array<long int, 4>& last_sync_array);
|
||||
// calculates delta = value - last_sync_value, then collects all deltas of all
|
||||
// mpi-processes and adds them to last_sync_value so that
|
||||
// afterwards last_sync_value has the same value on each mpi-process
|
||||
// (i.e. array does not get modified)
|
||||
void sumToAll(double& value, double& last_sync_value);
|
||||
// calculates delta = array - last_sync_array, then collects all deltas of all
|
||||
// mpi-processes and adds them to last_sync_value so that
|
||||
// afterwards last_sync_value has the same value on each mpi-process
|
||||
// (i.e. array does not get modified)
|
||||
void sumToAll(long int& value, long int& last_sync_value);
|
||||
};
|
||||
|
||||
#endif /* CPU_SYNCHRONIZER_H */
|
||||
|
||||
@@ -7,55 +7,117 @@
|
||||
#include "simulation/position_binning.h"
|
||||
#include "simulation/timer.h"
|
||||
|
||||
// class to store and calculate particle currents
|
||||
class CurrentCollector {
|
||||
public:
|
||||
// Constructor: takes a CylinderBinning object to create the crossing and area arrays
|
||||
// a shared_ptr of a timer object (object be shared between all
|
||||
// CurrentCollectors and DensityFields regardless of specie)
|
||||
CurrentCollector(const CylinderBinning& position_binning,
|
||||
std::shared_ptr<Timer> timer);
|
||||
|
||||
// from the pointer to the particle and the Coordinate of an old position (e.g. before movement)
|
||||
// crossings over bin boundaries are determined and stored
|
||||
void collect(particle::Particle* particle, const Coordinate& old_position);
|
||||
|
||||
// returns the blitz::Array containing the crossings out of the bins in radial direction
|
||||
blitz::Array<double, 3> negativeCrossingsInR() const;
|
||||
// returns the blitz::Array containing the crossins into the bins in radial direction
|
||||
blitz::Array<double, 3> positiveCrossingsInR() const;
|
||||
// return a blitz::Array with the areas of the bin borders in radial direction
|
||||
blitz::Array<double, 3> areaInR() const;
|
||||
// return a blitz::Array with the particle current in radial direction (in m^-2s^-1)
|
||||
blitz::Array<double, 3> currentInR() const;
|
||||
|
||||
// returns the blitz::Array containing the crossings out of the bins in azimuthal direction
|
||||
blitz::Array<double, 3> negativeCrossingsInPhi() const;
|
||||
// returns the blitz::Array containing the crossins into the bins in azimuthal direction
|
||||
blitz::Array<double, 3> positiveCrossingsInPhi() const;
|
||||
// return a blitz::Array with the areas of the bin borders in azimuthal direction
|
||||
blitz::Array<double, 3> areaInPhi() const;
|
||||
// return a blitz::Array with the particle current in azimuthal direction (in m^-2s^-1)
|
||||
blitz::Array<double, 3> currentInPhi() const;
|
||||
|
||||
// returns the blitz::Array containing the crossings out of the bins in longitudinal direction
|
||||
blitz::Array<double, 3> negativeCrossingsInZ() const;
|
||||
// returns the blitz::Array containing the crossins into the bins in longitudinal direction
|
||||
blitz::Array<double, 3> positiveCrossingsInZ() const;
|
||||
// return a blitz::Array with the areas of the bin borders in longitudinal direction
|
||||
blitz::Array<double, 3> areaInZ() const;
|
||||
// return a blitz::Array with the particle current in longitudinal direction (in m^-2s^-1)
|
||||
blitz::Array<double, 3> currentInZ() const;
|
||||
|
||||
// return the time from the Timer object
|
||||
double physicalTime() const;
|
||||
|
||||
// give the CpuSynchronizer class access to the private member variables to
|
||||
// make synchronization between processes simpler
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
// determine whether the particle moves out of or into a bin in radial direction from two TinyVectors containing
|
||||
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
|
||||
// is then updated at the closest boundary position of the new bin; if multiple bins would
|
||||
// be crossed only the boundary described above will receive an update
|
||||
void collectRadialMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
// determine whether the particle moves out of or into a bin in longitudinal direction from two TinyVectors containing
|
||||
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
|
||||
// is then updated at the closest boundary position of the new bin; if multiple bins would
|
||||
// be crossed only the boundary described above will receive an update
|
||||
void collectLongitudinalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
// determine whether the particle moves out of or into a bin in azimuthal direction from two TinyVectors containing
|
||||
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
|
||||
// is then updated at the closest boundary position of the new bin (periodic nature is accouted for); if multiple bins would
|
||||
// be crossed only the boundary described above will receive an update
|
||||
void collectAzimuthalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
|
||||
/*
|
||||
schematics for the numbering of the bins and the corresponding borders
|
||||
|
||||
longitudinal:
|
||||
underflow bin 0 bin 1 bin 2 ... bin N-1 overflow
|
||||
---------|------------|------------|------------| ... |------------|--------
|
||||
border_0 border_1 border_2 border_3 ... border_N-1 border_N
|
||||
|
||||
radial:
|
||||
bin 0 bin 1 bin 2 ... bin N-1 overflow
|
||||
----------|------------|------------| ... |------------|--------
|
||||
border_0 border_1 border_2 ... border_N-2 border_N-1
|
||||
|
||||
azimuthal:
|
||||
bin N-1 bin 0 bin 1 bin 2 ... bin N-1 bin 0
|
||||
---------|------------|------------|------------| ... |------------|--------
|
||||
border_0 border_1 border_2 border_3 ... border_N-1 border_0
|
||||
*/
|
||||
|
||||
// create the array containing the areas of the different boundary sections between bins in longitudinal direction
|
||||
// uses the provided CylinderBinning for the spacings of the bins
|
||||
blitz::Array<double, 3> createAreaLongitudinal(
|
||||
const CylinderBinning& position_binning);
|
||||
// return an array for the counting of crossings across the bin borders in longitudinal direction
|
||||
blitz::Array<double, 3> createCrossingsLongitudinal(
|
||||
const CylinderBinning& position_binning);
|
||||
|
||||
// return an array containing the areas of the different boundary sections between bins in radial direction
|
||||
// uses the provided CylinderBinning for the spacings of the bins
|
||||
blitz::Array<double, 3> createAreaRadial(
|
||||
const CylinderBinning& position_binning);
|
||||
// return an array for the counting of crossings across the bin borders in radial direction
|
||||
blitz::Array<double, 3> createCrossingsRadial(
|
||||
const CylinderBinning& position_binning);
|
||||
|
||||
// create the array containing the areas of the different boundary sections between bins in azimuthal direction
|
||||
// uses the provided CylinderBinning for the spacings of the bins
|
||||
blitz::Array<double, 3> createAreaAzimuthal(
|
||||
const CylinderBinning& position_binning);
|
||||
// return an array for the counting of crossings across the bin borders in azimuthal direction
|
||||
blitz::Array<double, 3> createCrossingsAzimuthal(
|
||||
const CylinderBinning& position_binning);
|
||||
|
||||
// Arrays for the storage of boundary crossings
|
||||
blitz::Array<double, 3> z_negative_crossings;
|
||||
blitz::Array<double, 3> z_positive_crossings;
|
||||
|
||||
@@ -65,6 +127,7 @@ class CurrentCollector {
|
||||
blitz::Array<double, 3> r_negative_crossings;
|
||||
blitz::Array<double, 3> r_positive_crossings;
|
||||
|
||||
// Arrays with the size area of the boundary segments
|
||||
blitz::Array<double, 3> collector_areas_r;
|
||||
blitz::Array<double, 3> collector_areas_phi;
|
||||
blitz::Array<double, 3> collector_areas_z;
|
||||
|
||||
@@ -9,46 +9,79 @@
|
||||
#include "simulation/position_binning.h"
|
||||
#include "simulation/timer.h"
|
||||
|
||||
// defined in "simulation/scalar_field.h"
|
||||
class ScalarField;
|
||||
// defined in "simulation/event_position_dirstribution.h"
|
||||
class EventPositionDistribution;
|
||||
|
||||
// class for a generic density field, specifying the minimum requirements
|
||||
class DensityField {
|
||||
public:
|
||||
// pure virtual function requiring that a function to obtain the density (m^-3) at
|
||||
// the Coordinate position is returned
|
||||
virtual double density(const Coordinate& position) = 0;
|
||||
// pure virtual function requiring that a function to obtain the density (m^-3) at
|
||||
// the Coordinate position and energy energy_eV is returned
|
||||
virtual double density(const Coordinate& position, double energy_eV) = 0;
|
||||
};
|
||||
|
||||
// class for the density field for TrackedSpecies, i.e. simulated species
|
||||
class DynamicDensityField : public DensityField {
|
||||
public:
|
||||
// Constructor: create the necessary array storing the time particles (4d r,phi,z,E) have spent in a bin,
|
||||
// a corresponding array that stores the number of deletions (4d r,phi,z,E) in a bin
|
||||
// as well as the 4d array for the actual density (in m^-3) and the
|
||||
// array with the volumes of the individual bins from the CylinderBinning and EnergyBinnig
|
||||
DynamicDensityField(const CylinderBinning& position_binning,
|
||||
const EnergyBinning& energy_binning,
|
||||
std::shared_ptr<Timer> timer);
|
||||
|
||||
// returns true if the bin of the old_position Coordinate and the bin of the
|
||||
// new_position Coordinate are different otherwise returns false
|
||||
bool changedPositionBin(const Coordinate& old_position,
|
||||
const Coordinate& new_position) const;
|
||||
|
||||
// returns true if the bin of old_energy_eV is different than the bin of new_energy_eV
|
||||
// otherwise returns false
|
||||
bool changedEnergyBin(double old_energy_eV, double new_energy_eV) const;
|
||||
|
||||
// increases the value of the time_in_bin array by time_in_bin_s at the bin index
|
||||
// determined by the Coordinate position and energy_eV
|
||||
void logMovement(const Coordinate& position,
|
||||
double energy_eV,
|
||||
double time_in_bin_s);
|
||||
|
||||
// increases the value of the deleted_particles array by 1 at the bin index determined
|
||||
// by position and energy_eV
|
||||
void logDeletion(const Coordinate& position, double energy_eV);
|
||||
|
||||
// return the value of the density_per_m3 array at the bin index
|
||||
// determined by the Coordinate position summed over all energy bins
|
||||
double density(const Coordinate& position);
|
||||
// return the value of the density_per_m3 array at the bin index
|
||||
// determined by the Coordinate position and energy_eV
|
||||
double density(const Coordinate& position, double energy_eV);
|
||||
|
||||
// calculate and return the 3d density array (m^-3), no resolution in the energy direction
|
||||
blitz::Array<double, 3> densityArray();
|
||||
// calculate and return the 4d density array (m^-3), with a resolution in energy direction
|
||||
blitz::Array<double, 4> spectrumArray();
|
||||
// getter for the time_in_bin array
|
||||
blitz::Array<double, 4> timeInBinArray() const;
|
||||
// getter for the deleted_particles array
|
||||
blitz::Array<long int, 4> deletedParticlesArray() const;
|
||||
// getter for the bin_volume_m3 array
|
||||
blitz::Array<double, 3> binVolumeArray() const;
|
||||
|
||||
// return a raw pointer to the EnergyBinning member object
|
||||
const EnergyBinning* energyBinning() const;
|
||||
// return a raw pointer to the CylinderBinning member object
|
||||
const CylinderBinning* positionBinning() const;
|
||||
|
||||
// return the time from the timer member
|
||||
double physicalTime() const;
|
||||
|
||||
// make the private member variables accessable by the CpuSynchronizer
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
@@ -66,11 +99,17 @@ class DynamicDensityField : public DensityField {
|
||||
// 0, ..., num_bin_z-1: 0 <= z < z_max
|
||||
// num_bin_z: z >= z_max
|
||||
BinCoordinate densityBin(const CylinderCoordinate& position) const;
|
||||
// uses time_in_bin, deleted_particles (4d), bin_volume_m3 (3d) and the timer to
|
||||
// recalculate the density_per_m3 array (4d)
|
||||
void recalculateDensityArray();
|
||||
|
||||
// array storing the cumulative time particles of a species have spent in certain bins
|
||||
blitz::Array<double, 4> time_in_bin_s_;
|
||||
// array storing the cumulative time particles of a species have been deleted due to recombination
|
||||
blitz::Array<long int, 4> deleted_particles_;
|
||||
// array storing the physical density (units: m^-3), histogram in energy dimension
|
||||
blitz::Array<double, 4> density_per_m3_;
|
||||
// arrya storing the volumes of the individual bins of the time_in_bin array (or rather the CylinderBinning object)
|
||||
blitz::Array<double, 3> bin_volume_m3_;
|
||||
|
||||
const CylinderBinning position_binning_;
|
||||
@@ -79,11 +118,16 @@ class DynamicDensityField : public DensityField {
|
||||
std::shared_ptr<Timer> timer_;
|
||||
};
|
||||
|
||||
// class for the density field for BackgroundSpecies, i.e. non-simulated species
|
||||
class ConstantDensityField : public DensityField {
|
||||
public:
|
||||
// Constructor: making the shared_ptr density a member variable
|
||||
ConstantDensityField(std::shared_ptr<ScalarField> density);
|
||||
|
||||
// return the value of the of the ScalarField density at the position Coordinate position
|
||||
double density(const Coordinate& position);
|
||||
// return the value of the of the ScalarField density at the position Coordinate position
|
||||
// (energy_eV is ignored, since ScalarField does not have an energy resolution)
|
||||
double density(const Coordinate& position, double energy_eV);
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,11 +6,17 @@
|
||||
#include "simulation/coordinates.h"
|
||||
#include "simulation/vector_field.h"
|
||||
|
||||
// class to handle the drift veloctiy
|
||||
class DriftVelocity {
|
||||
public:
|
||||
// Constructor: takes a VectorField that describes the direction of the drift velocity
|
||||
DriftVelocity(std::shared_ptr<VectorField> drift_velocity);
|
||||
|
||||
// returns the drift velocity value at the Coordinate position as a CartesianVector
|
||||
CartesianVector driftVelocity(const Coordinate& position);
|
||||
// overload using both the cartesian and cylinder coordinate version of the position
|
||||
CartesianVector driftVelocity(const CartesianCoordinate& cartpos,
|
||||
const CylinderCoordinate& cylpos);
|
||||
|
||||
private:
|
||||
std::shared_ptr<VectorField> drift_velocity_;
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
#include "simulation/scalar_field.h"
|
||||
#include "simulation/vector_field.h"
|
||||
|
||||
// class for an electric field; consists of two VectorField objects
|
||||
// one for the dynamic electric field, i.e. calculated during the simulation (not yet implemented, right now behaves the same as the background field)
|
||||
// one for the background field, i.e. a field read in from an input file
|
||||
class ElectricField {
|
||||
public:
|
||||
// Constructor: setting the background and dynamic field to the provided VectorFields
|
||||
ElectricField(std::shared_ptr<VectorField> background,
|
||||
std::shared_ptr<VectorField> dynamic);
|
||||
|
||||
// return the value of the electric field at the Coordinate position (sum of the background and dynamic field values)
|
||||
// as a CylinderVector
|
||||
CylinderVector value(const Coordinate& position) const;
|
||||
|
||||
// set the dynamic field to the provided field
|
||||
void updateDynamicField(std::shared_ptr<VectorField> field);
|
||||
|
||||
private:
|
||||
@@ -21,10 +28,13 @@ class ElectricField {
|
||||
std::shared_ptr<VectorField> dynamic_;
|
||||
};
|
||||
|
||||
// class for a magnetic field
|
||||
class MagneticField {
|
||||
public:
|
||||
// Constructor: takes the VectorField describing the magnetic field
|
||||
MagneticField(std::shared_ptr<VectorField> field);
|
||||
|
||||
// return the value of the magnetic field at Coordinate position as a CylinderVector
|
||||
CylinderVector value(const Coordinate& position) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,18 +3,34 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
// class defining the grid for the energy-direction (includes an over- and underflow bin)
|
||||
class EnergyBinning {
|
||||
public:
|
||||
// Constructor: create the EnergyBinning by using the minimal_energy (has to be positive and in eV units)
|
||||
// as the lower boundary and the maximal_energy (in eV) as the upper boundary with num_bins bins
|
||||
// the bin borders are created using a log10-spacing
|
||||
EnergyBinning(double minimal_energy, double maximal_energy, int num_bins);
|
||||
// Constructor: create an EnergyBinning with the bin borders being defined in the
|
||||
// vector energy_bin_borders (has to contain the values of the edges of the energy-bins;
|
||||
// for the lowest energy bin the left boundary has to be given as well, similar for the
|
||||
// highest energy bin the upper boundary value has to be given as well)
|
||||
EnergyBinning(std::vector<double> energy_bin_borders);
|
||||
|
||||
// return the index of the energy bin that contains the given energy_eV (in eV)
|
||||
// if energy_eV < minimal_energy then -1 is returned (underflow bin)
|
||||
// if energy_eV > maximal_energy then numBins is returned (overflow bin)
|
||||
int bin(double energy_eV) const;
|
||||
// returns the number of bins (not the number of bin borders!)
|
||||
int numBins() const;
|
||||
// returns the vector containing the energy bin borders
|
||||
std::vector<double> binBorders() const;
|
||||
// return the index of the underflow bin
|
||||
int binIndexMin() const;
|
||||
// return the index of the overflow bin
|
||||
int binIndexMax() const;
|
||||
|
||||
private:
|
||||
// vector containing the values of the bin edges
|
||||
const std::vector<double> energy_bin_borders_;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,14 +4,20 @@
|
||||
#include <functional>
|
||||
#include <random>
|
||||
|
||||
// class defining the minimum requirements of an EnergyDistributionFunction child class
|
||||
class EnergyDistributionFunction {
|
||||
public:
|
||||
virtual double rollEnergy(std::mt19937* engine) = 0; // eV
|
||||
// draw an energy value using the provided engine in eV
|
||||
virtual double rollEnergy(std::mt19937* engine) = 0;
|
||||
};
|
||||
|
||||
// class for drawing an energy value from the Fermi spectrum of the Tritium beta decay
|
||||
// using the rejection method
|
||||
class TritiumBetaDecay : public EnergyDistributionFunction {
|
||||
public:
|
||||
// Constructor: initializes the random distributions
|
||||
TritiumBetaDecay();
|
||||
// draw an energy (eV) from the Fermi spectrum of the Tritium beta decay
|
||||
double rollEnergy(std::mt19937* engine);
|
||||
|
||||
private:
|
||||
@@ -20,18 +26,24 @@ class TritiumBetaDecay : public EnergyDistributionFunction {
|
||||
std::uniform_real_distribution<double> y_distribution_;
|
||||
};
|
||||
|
||||
// class for drawing an energy value from the Maxwell Boltzmann energy distribution
|
||||
class MaxwellBoltzmann : public EnergyDistributionFunction {
|
||||
public:
|
||||
// initialize the distribution with the temperature (in K)
|
||||
MaxwellBoltzmann(double temperature_K);
|
||||
double rollEnergy(std::mt19937* engine); // eV
|
||||
// draw an energy (in eV) from the Maxwell Boltzmann energy distribtion
|
||||
double rollEnergy(std::mt19937* engine);
|
||||
private:
|
||||
std::gamma_distribution<double> distribution_;
|
||||
};
|
||||
|
||||
// class for returnig a constant energy value
|
||||
class Constant : public EnergyDistributionFunction {
|
||||
public:
|
||||
// Constructor: takes the energy value (in eV) that will be returned later
|
||||
Constant(double constant_eV);
|
||||
double rollEnergy(std::mt19937* engine); // eV
|
||||
// return the energy (in eV) set at construction of the object
|
||||
double rollEnergy(std::mt19937* engine);
|
||||
private:
|
||||
const double constant_eV_;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "simulation/mpi_communication.h"
|
||||
|
||||
// if any debug is defined, define the main function to print the debugging message
|
||||
#if defined debug_level3 || defined debug_level2 || defined debug_level1 || \
|
||||
defined debug_level0
|
||||
inline void DEBUG(const std::string& message) {
|
||||
@@ -16,45 +17,78 @@ inline void DEBUG(const std::string& message) {
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// depending on the debug level, activate the corresponding debugging function
|
||||
#if defined debug_level0
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 0
|
||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 1
|
||||
inline void DEBUG_LEVEL_1(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 2
|
||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 3
|
||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
||||
#elif defined debug_level1
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 0
|
||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 1
|
||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 2
|
||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 3
|
||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
||||
|
||||
#elif defined debug_level2
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 0
|
||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 1
|
||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 2
|
||||
inline void DEBUG_LEVEL_2(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 3
|
||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
||||
|
||||
#else
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 0
|
||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 1
|
||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 2
|
||||
inline void DEBUG_LEVEL_2(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 3
|
||||
inline void DEBUG_LEVEL_3(const std::string& message) {
|
||||
DEBUG(message);
|
||||
}
|
||||
@@ -62,18 +96,28 @@ inline void DEBUG_LEVEL_3(const std::string& message) {
|
||||
|
||||
#else
|
||||
inline void DEBUG(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 0
|
||||
inline void DEBUG_LEVEL_0(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 1
|
||||
inline void DEBUG_LEVEL_1(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 2
|
||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
||||
// prints the message string to stdout if the code has been compiled with a
|
||||
// DEBUG_LEVEL > 3
|
||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
||||
#endif
|
||||
|
||||
// for MPI process 0 print the message string to stdout
|
||||
inline void SIM_INFO(const std::string& message) {
|
||||
if (MpiCommunication::mpi_rank == 0) {
|
||||
std::cout << "#INFO: " << message << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// writes message string to stderr and exits the program with an EXIT_FAILURE
|
||||
inline void ERROR(const std::string& message) {
|
||||
fprintf(stderr, "ERROR <%d> %s\n", MpiCommunication::mpi_rank,
|
||||
message.c_str());
|
||||
@@ -81,6 +125,7 @@ inline void ERROR(const std::string& message) {
|
||||
// throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
// assert if value is positive otherwise exit the program and print the message to stderr
|
||||
template <class T>
|
||||
void ASSERT_POSITIVE(T* value, const std::string& message) {
|
||||
if (!(*value > 0)) {
|
||||
@@ -88,6 +133,7 @@ void ASSERT_POSITIVE(T* value, const std::string& message) {
|
||||
}
|
||||
}
|
||||
|
||||
// assert if value is not negative otherwise exit the program and print the message to stderr
|
||||
template <class T>
|
||||
void ASSERT_NOTNEGATIVE(T* value, const std::string& message) {
|
||||
if (!(*value >= 0)) {
|
||||
@@ -95,6 +141,7 @@ void ASSERT_NOTNEGATIVE(T* value, const std::string& message) {
|
||||
}
|
||||
}
|
||||
|
||||
// assert if value exists otherwise exit the program and print the message to stderr
|
||||
template <class T>
|
||||
void ASSERT_EXISTS(T* value, const std::string& message) {
|
||||
if (!value) {
|
||||
@@ -102,12 +149,15 @@ void ASSERT_EXISTS(T* value, const std::string& message) {
|
||||
}
|
||||
}
|
||||
|
||||
// assert if value is finite otherwise exit the program and print the message to stderr
|
||||
inline void ASSERT_FINITE(double value, const std::string& message) {
|
||||
if (!std::isfinite(value)) {
|
||||
ERROR(message);
|
||||
}
|
||||
}
|
||||
|
||||
// assert if the blitz::TinyVector is finite otherwise
|
||||
// exit the program and print the message to stderr
|
||||
inline void ASSERT_FINITE(const blitz::TinyVector<double, 3>& value,
|
||||
const std::string& message) {
|
||||
if (!std::isfinite(value(0)) || !std::isfinite(value(1)) ||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "simulation/coordinates.h"
|
||||
#include "simulation/scalar_field.h"
|
||||
|
||||
// structure for storing a minimum and maximum value
|
||||
struct Limit {
|
||||
Limit() : min(0), max(0){};
|
||||
Limit(double min, double max) : min(min), max(max){};
|
||||
@@ -14,19 +15,28 @@ struct Limit {
|
||||
double max;
|
||||
};
|
||||
|
||||
// class for drawing positions
|
||||
class EventPositionDistribution {
|
||||
public:
|
||||
// Constructor: takes a shared_ptr to a ScalarField used as the distribution to be drawn from
|
||||
// a Limit density containing the maximum value of the mother_density within the position limits (used for rejection method)
|
||||
// a Limit r_position defining the region in r-direction, where positions are drawn from
|
||||
// a Limit z_position defining the region in z-direction, where positions are drawn from
|
||||
// a Limit phi_position defining the region in phi-direction, where positions are drawn from
|
||||
EventPositionDistribution(std::shared_ptr<ScalarField> mother_density,
|
||||
Limit density,
|
||||
Limit r_position,
|
||||
Limit phi_position,
|
||||
Limit z_position);
|
||||
// draw a position from the ScalarField using the given mt19937 engine pointer as a CylinderCoordinate
|
||||
// using the rejection method
|
||||
CylinderCoordinate rollPosition(std::mt19937* engine);
|
||||
|
||||
private:
|
||||
// ScalarField defining the distribution
|
||||
std::shared_ptr<ScalarField> mother_density_;
|
||||
|
||||
// for Rejection method
|
||||
// distribution functions drawn to be drawn from in the rejection method
|
||||
std::uniform_real_distribution<double> r_values;
|
||||
std::uniform_real_distribution<double> z_values;
|
||||
std::uniform_real_distribution<double> phi_values;
|
||||
|
||||
@@ -3,14 +3,21 @@
|
||||
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// class defining the miminmum requirement of a Geometry class
|
||||
class Geometry {
|
||||
public:
|
||||
// check if Coordinate position is contained in the Geometry
|
||||
virtual bool isInside(const Coordinate& position) const = 0;
|
||||
};
|
||||
|
||||
// Geometry class for a cylinder
|
||||
class Cylinder : public Geometry {
|
||||
public:
|
||||
// Constructor: takes the radius and height of the cylinder
|
||||
// z always starts at 0
|
||||
Cylinder(double radius, double height);
|
||||
// check whether Coordinate position lies within the Cylinder
|
||||
// i.e. z in (0,height), r in (0,radius)
|
||||
bool isInside(const Coordinate& position) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef HOMEBASE_H
|
||||
#define HOMEBASE_H
|
||||
|
||||
// BUILD_HOMEBASE_STRING returns the string of the path stored in the HOMEBASE shell variable
|
||||
#define STRINGIZER(arg) #arg
|
||||
#define STR_VALUE(arg) STRINGIZER(arg)
|
||||
#define BUILD_HOMEBASE_STRING STR_VALUE(HOMEBASE)
|
||||
|
||||
@@ -8,34 +8,48 @@
|
||||
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// defined in "simulation/drift_velocity.h"
|
||||
class DriftVelocity;
|
||||
// defined in "simulation/veloctiy_distribution.h"
|
||||
class VelocityDistribution;
|
||||
|
||||
// defined in "simulation/particle.h"
|
||||
namespace particle {
|
||||
class Particle;
|
||||
}
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class Specie;
|
||||
class TrackedSpecie;
|
||||
} // namespace species
|
||||
|
||||
// defined in "simulation/event_position_distribution.h"
|
||||
class EventPositionDistribution;
|
||||
|
||||
// structure storing information about particles that are injected by the injector
|
||||
// conains the TrackedSpecie of the particle and its veloctiy distribution
|
||||
struct InjectorInfo {
|
||||
public:
|
||||
std::shared_ptr<species::TrackedSpecie> created_specie;
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution;
|
||||
};
|
||||
|
||||
// class handling injection of event particles (i.e. particles from the tritium beta decay)
|
||||
class Injector {
|
||||
public:
|
||||
// Constructor: takes a vector of InjectorInfo objects defining the particles that are supposed to be injected at invocation of the Injector object
|
||||
// the activity of the simulation volume (units 1/s) defines the "timestep" (i.e. 1/activity)
|
||||
// an EventPositionDistribution defining the valid space of the simulation domain where particles can be created
|
||||
// a DriftVelocity object defining the bulk motion the injected particles are created with (regardless of specie), can be null
|
||||
Injector(std::vector<InjectorInfo>& injector_info,
|
||||
double activity,
|
||||
std::shared_ptr<EventPositionDistribution> position_distribution,
|
||||
std::shared_ptr<DriftVelocity> mother_drift_velocity);
|
||||
|
||||
// return a vector with the particles defined in the InjectorInfo vector using the random engine object
|
||||
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine);
|
||||
// return average time between events (1/activity)
|
||||
double timePassed() const;
|
||||
|
||||
private:
|
||||
@@ -44,6 +58,8 @@ class Injector {
|
||||
std::shared_ptr<EventPositionDistribution> position_distribution_;
|
||||
std::shared_ptr<DriftVelocity> mother_drift_velocity_;
|
||||
|
||||
// draw a single particle of species created_specie with a velocity distribution creation_velocity_distribution
|
||||
// at the Coordinate position using the random engine engine
|
||||
particle::Particle rollNewParticle(
|
||||
std::mt19937* engine,
|
||||
const Coordinate& position,
|
||||
|
||||
@@ -11,28 +11,48 @@
|
||||
|
||||
namespace interaction {
|
||||
|
||||
// class to define the output of an interaction
|
||||
class InteractionOutput {
|
||||
public:
|
||||
// Constructor: incident particle is not flagged for deletion
|
||||
InteractionOutput();
|
||||
|
||||
// if new_decider is true then the incident particle of the interaction is
|
||||
// flagged for deletion
|
||||
void deleteCurrentParticle(bool new_decider);
|
||||
// return if the incident particle is flagged for deletion
|
||||
bool deleteCurrentParticle();
|
||||
// add particles that are created (not the incident) particles to the InteractionOutput
|
||||
void add(const particle::Particle& new_particle);
|
||||
// return the vector of particles that have been created by an interactoin
|
||||
std::vector<particle::Particle> newParticles();
|
||||
|
||||
private:
|
||||
// flag if the incident particle should be deleted
|
||||
bool delete_current_particle_;
|
||||
// vector for the interaction products (no including the incident particle even if it's not
|
||||
// destroyed by the interaction)
|
||||
std::vector<particle::Particle> new_particles_;
|
||||
};
|
||||
|
||||
// parent class for all interactions (cannot be instantiated)
|
||||
class Interaction {
|
||||
public:
|
||||
// Constructor: takes a function describing the cross section of used for the interaction as a function of energy (in eV)
|
||||
// a shared_ptr to the Specie of the target species
|
||||
Interaction(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target);
|
||||
|
||||
virtual double microscopicCrossSection(double energy_eV);
|
||||
// return the value of the cross section at the energy (in eV) energy_eV in m^2
|
||||
// Coordinate position necessary for three body processes in which the
|
||||
// cross section depends on the density at the position (see "interactions/cluster_formation.h")
|
||||
virtual double microscopicCrossSection(double energy_eV, const Coordinate& position);
|
||||
// calculate the density scaled cross section for the Particle particle
|
||||
// interacting with the defined target Specie (returns cross section * target density) (units: m^-1)
|
||||
// assumes that v_particle >> v_target
|
||||
virtual double macroscopicCrossSection(particle::Particle& particle);
|
||||
|
||||
// pure virtual function defining the specifics of the actual interaction
|
||||
virtual InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator) = 0;
|
||||
|
||||
|
||||
@@ -10,8 +10,12 @@
|
||||
#include "simulation/errors.h"
|
||||
#include "simulation/unit_converter.h"
|
||||
|
||||
// define the json_path type; contains the keys of the nested json-objects
|
||||
// as the elements in the vector e.g. ["Root", "Group1", "Group2", ..., "GroupN"]
|
||||
typedef std::vector<std::string> json_path;
|
||||
|
||||
// return the value specified by "path" as a json_t pointer
|
||||
// (can point to a json-object, json-array, etc.)
|
||||
inline json_t* json_object_by_path(json_t* object, const json_path& path) {
|
||||
json_t* j_obj = object;
|
||||
for (auto str : path) {
|
||||
@@ -20,6 +24,7 @@ inline json_t* json_object_by_path(json_t* object, const json_path& path) {
|
||||
return j_obj;
|
||||
}
|
||||
|
||||
// return the value of the json_t pointer "object" as an double; defaults "default value"
|
||||
inline double json_double(json_t* object, double default_value = 0.) {
|
||||
if (object) {
|
||||
return json_real_value(object);
|
||||
@@ -28,6 +33,8 @@ inline double json_double(json_t* object, double default_value = 0.) {
|
||||
}
|
||||
}
|
||||
|
||||
// return the value of the json_t pointer "object" as an int; defaults to "default value"
|
||||
// if the pointer is not a json-real value
|
||||
inline int json_int(json_t* object, int default_value = 0) {
|
||||
if (object) {
|
||||
return std::floor(json_real_value(object));
|
||||
@@ -36,6 +43,8 @@ inline int json_int(json_t* object, int default_value = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// return the value of the json_t pointer "object" as a string; defaults "default value"
|
||||
// if the pointer is not a json-string
|
||||
inline std::string json_string(json_t* object, std::string default_value = "") {
|
||||
if (object) {
|
||||
return std::string(json_string_value(object));
|
||||
@@ -44,6 +53,8 @@ inline std::string json_string(json_t* object, std::string default_value = "") {
|
||||
}
|
||||
}
|
||||
|
||||
// return the value of the json_t pointer "object" as a bool; defaults to default_value
|
||||
// if the pointer is not a json-string or the string has a value different from "true" or "false"
|
||||
inline bool json_bool(json_t* object, bool default_value = false) {
|
||||
if (object) {
|
||||
return (json_string(object) == "true");
|
||||
@@ -52,6 +63,9 @@ inline bool json_bool(json_t* object, bool default_value = false) {
|
||||
}
|
||||
}
|
||||
|
||||
// return the json-array "vector" in the given json-object object as a blitz::TinyVector
|
||||
// if the "vector" json-array does not exist or does not contain the same number of elements as
|
||||
// specified in the template parameter s an error is thrown
|
||||
template <int s>
|
||||
blitz::TinyVector<double, s> json_blitz_vector(json_t* object) {
|
||||
blitz::TinyVector<double, s> vector;
|
||||
@@ -73,6 +87,8 @@ blitz::TinyVector<double, s> json_blitz_vector(json_t* object) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
// returns a vector<double> containing the values of a json-array pointed to by
|
||||
// json_t* object; if json_t* object is not a json-array returns an empty vector
|
||||
inline std::vector<double> json_vector(json_t* object) {
|
||||
std::vector<double> vector;
|
||||
size_t index;
|
||||
@@ -83,6 +99,7 @@ inline std::vector<double> json_vector(json_t* object) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
// return the json-array in "object" as a json_path variable
|
||||
inline json_path json_path_get(json_t* object) {
|
||||
json_path path;
|
||||
|
||||
@@ -94,6 +111,8 @@ inline json_path json_path_get(json_t* object) {
|
||||
return path;
|
||||
}
|
||||
|
||||
// returns a json_path variable, that consists of the path appended by the
|
||||
// json_path append
|
||||
inline json_path json_path_append(const json_path& path,
|
||||
const json_path& append) {
|
||||
json_path result = path;
|
||||
@@ -103,12 +122,24 @@ inline json_path json_path_append(const json_path& path,
|
||||
return result;
|
||||
}
|
||||
|
||||
// returns the value of a json-object, which should consist of a json-real with the key
|
||||
// "value" and a json-string with the key "unit" transformed to the specified length
|
||||
// "output_unit" (supported units: "mm", "cm", "m"). If the key "unit" does not exist or is not
|
||||
// a json-string an error will be thrown and the program will terminate. If the key "value"
|
||||
// does not exist or not a json-real it will default to 0.0
|
||||
inline double json_read_length(json_t* object, std::string output_unit = "m") {
|
||||
double value = json_double(json_object_by_path(object, {"value"}));
|
||||
std::string unit = json_string(json_object_by_path(object, {"unit"}));
|
||||
return unitConvertion::length(value, unit, output_unit);
|
||||
}
|
||||
|
||||
/*
|
||||
returns the value of a json-object, which should consist of a json-real with the key
|
||||
"value" and a json-string with the key "unit" transformed to the specified energy
|
||||
"output_unit" (supported units: "eV", "J"). If the key "unit" does not exist or is not
|
||||
a json-string an error will be thrown and the program will terminate. If the key "value"
|
||||
does not exist or not a json-real it will default to 0.0
|
||||
*/
|
||||
inline double json_read_energy(json_t* object, std::string output_unit = "eV") {
|
||||
double value = json_double(json_object_by_path(object, {"value"}));
|
||||
std::string unit = json_string(json_object_by_path(object, {"unit"}));
|
||||
|
||||
@@ -4,22 +4,38 @@
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
namespace kinematic {
|
||||
// calculate the velocity of the center off mass, where velocity_1 (cartesian vector, m/s) and
|
||||
// mass_1 (kg) belong to the same particle and velocity_2 (cartesian vector, m/s) and mass_2 (kg) belong
|
||||
// to the same particle
|
||||
blitz::TinyVector<double, 3> velocityOfCenterOfMass(
|
||||
const blitz::TinyVector<double, 3>& velocity_1,
|
||||
const blitz::TinyVector<double, 3>& velocity_2,
|
||||
double mass_1,
|
||||
double mass_2);
|
||||
|
||||
// Galileo transformation to the rest frame of the second particle
|
||||
// both velocities are in m/s and both masses in kg
|
||||
blitz::TinyVector<double, 3> velocityTargetFixed(
|
||||
const blitz::TinyVector<double, 3>& velocity_1,
|
||||
const blitz::TinyVector<double, 3>& velocity_2,
|
||||
double mass_1,
|
||||
double mass_2);
|
||||
|
||||
// rotates the vector (cartesian) v by the polar angle theta and the azimuthal angle phi
|
||||
// in the frame where v is aligned with the z-axis
|
||||
// returns the rotated vector as a blitz::TinyVector in cartesian coordinates in the
|
||||
// original frame where v is not (not neccessarily) aligned with the z-axis (all in SI units)
|
||||
blitz::TinyVector<double, 3> rotateVector(const blitz::TinyVector<double, 3>& v,
|
||||
double theta,
|
||||
double phi);
|
||||
|
||||
// transform velocity_1 into the center of mass frame defined by
|
||||
// velocity_1, mass_1 and velocity_2 and mass_2 (vectors are cartesian)
|
||||
// velocity_1_centerOfMass is then rotated by the polar angle theta and the
|
||||
// azimuthal angle phi in the frame in which velocity_1_centerOfMass is aligned with
|
||||
// the z-axis
|
||||
// returns the rotated velocity_1 vector in the original non-center of mass frame (cartesian coordinates)
|
||||
// (all in SI units)
|
||||
blitz::TinyVector<double, 3> rotateVelocityInCenterOfMassFrame(
|
||||
const blitz::TinyVector<double, 3>& velocity_1,
|
||||
const blitz::TinyVector<double, 3>& velocity_2,
|
||||
@@ -28,38 +44,73 @@ blitz::TinyVector<double, 3> rotateVelocityInCenterOfMassFrame(
|
||||
double theta,
|
||||
double phi);
|
||||
|
||||
// return the non-relativistic kinetic energy (J) defined by the cartesian velocity (m/s)
|
||||
// and the mass (kg)
|
||||
double kineticEnergy(const blitz::TinyVector<double, 3>& velocity, double mass);
|
||||
// transform the temperature (K) into an energy in eV
|
||||
double thermalEnergy(double temperature_K);
|
||||
|
||||
// returns the modulus of the velocity (m/s) of the kinetic energy (eV)
|
||||
// and the mass (kg) (non-relativistic)
|
||||
double velocity(double energy_eV, double mass_kg);
|
||||
|
||||
// transform the cartesian velocity v2 in the frame moving with cartesian velocity v1
|
||||
// into the laboratory frame (both velocities in m/s)
|
||||
// returns the boosted vector in cartesian coordinates
|
||||
blitz::TinyVector<double, 3> relativisticBoost(
|
||||
const blitz::TinyVector<double, 3>& v1,
|
||||
const blitz::TinyVector<double, 3>& v2);
|
||||
|
||||
// calculate gamma from velocity from the given cartesian velocity (in SI units)
|
||||
// where the velocity is the realtivistic 3 momentum divided by the rest mass of the particle
|
||||
double relativisticGamma(const blitz::TinyVector<double, 3>& velocity);
|
||||
// calculates the Lorentz factor given the kinetic energy in eV and the
|
||||
// rest mass of the particle transformed to eV
|
||||
double relativisticGamma(double kin_energy_eV, double mass_eV);
|
||||
// return the cartesian velocity (m/s) devided by the speed of light
|
||||
double relativisticBeta(double velocity_ms);
|
||||
// calculates the relativistic beta (velocity/speed of light) given the kinetic energy in eV and the
|
||||
// rest mass of the particle transformed to eV
|
||||
double relativisticBeta(double kin_energy_eV, double mass_eV);
|
||||
|
||||
// Note: what units does the relativisitvMomentum function "return"?
|
||||
|
||||
// calculate the modulus of the realtivistic momentum from the kinetic energy in eV
|
||||
// and the mass in eV
|
||||
double relativisticMomentum(double energy_eV, double mass_eV);
|
||||
|
||||
// returns the norm of the vector
|
||||
double norm(const blitz::TinyVector<double, 3>& vector);
|
||||
|
||||
// calculates the distance between the two points position_1 and position_2
|
||||
// which are both in cylinder coordinates (r, phi, z)
|
||||
double distanceInCylinder(const blitz::TinyVector<double, 3>& position_1,
|
||||
const blitz::TinyVector<double, 3>& position_2);
|
||||
|
||||
|
||||
// calculate v_perp, s.t. vector = v_perp + v_parallel, with
|
||||
// v_perp perpendicular to the vector direction and v_parallel parallel to the vector direction
|
||||
// (both vectors cartesian)
|
||||
blitz::TinyVector<double, 3> perpendicularVector(
|
||||
const blitz::TinyVector<double, 3>& vector,
|
||||
const blitz::TinyVector<double, 3>& direction);
|
||||
// calculate v_parallel, s.t. vector = v_perp + v_parallel, with
|
||||
// v_perp perpendicular to the vector direction and v_parallel parallel to the vector direction
|
||||
// (both vectors cartesian)
|
||||
blitz::TinyVector<double, 3> parallelVector(
|
||||
const blitz::TinyVector<double, 3>& vector,
|
||||
const blitz::TinyVector<double, 3>& direction);
|
||||
|
||||
// rotate vector around rotation_axis about the angle angle
|
||||
// (vectors cartesian) according to the right hand rule
|
||||
// using Rogrigues' formula
|
||||
blitz::TinyVector<double, 3> rotateVector(
|
||||
const blitz::TinyVector<double, 3>& vector,
|
||||
const blitz::TinyVector<double, 3>& rotation_axis,
|
||||
double angle);
|
||||
|
||||
// return the random_unit_vector scaled by the modulus of the non-relativistic velocity
|
||||
// defined by the kinetic energy energy_eV (eV) and mass mass_kg (kg)
|
||||
blitz::TinyVector<double, 3> velocityVector(
|
||||
double energy_eV,
|
||||
const blitz::TinyVector<double, 3>& random_unit_vector,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// enum that defines the different types of deletions that can be counted
|
||||
enum class DeletionType {
|
||||
wall,
|
||||
recombination,
|
||||
@@ -13,19 +14,35 @@ enum class DeletionType {
|
||||
cluster_formation
|
||||
};
|
||||
|
||||
// class that keeps track of the DeletionType that caused a particle to be deleted
|
||||
class DeletionLogger {
|
||||
public:
|
||||
// Constructor: vector used_types defines for which DeletionType elements the
|
||||
// deletion is supposed to be tracked (i.e. if recombination is not
|
||||
// specified in the used_types vector, then particles that are
|
||||
// removed due to recombination are not counted)
|
||||
DeletionLogger(std::vector<DeletionType> used_types);
|
||||
|
||||
// increase the count corresponding to DeletionType by 1
|
||||
// Coordinate coordinate is not used (i.e. can be chosen arbitrarily)
|
||||
virtual void logDeletion(const Coordinate& coordinate, DeletionType type);
|
||||
|
||||
// returns the map with the keys being the tracked DeletionTypes and the
|
||||
// value the long int count of how many particles have been logged by the
|
||||
// corresponding key
|
||||
std::map<DeletionType, long int> numDeletions() const;
|
||||
// set the count for DeletionType type to new_value
|
||||
void numDeletions(long int new_value, DeletionType type);
|
||||
// return the count for DeletionType type; if the type was not specified
|
||||
// as used in the creation of the object return 0
|
||||
long int numDeletions(DeletionType type) const;
|
||||
|
||||
// make private member variable accessable for the cpu synchronization
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
// map with keys being the used DeletionTypes and the value being the count
|
||||
// of how many particles have been deleted due to the DeletionType of the key
|
||||
std::map<DeletionType, long int> num_deletions;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "simulation/electromagnetic_field.h"
|
||||
#include "simulation/particle.h"
|
||||
|
||||
// class defining the minimum requirements of a mover class
|
||||
class Mover {
|
||||
public:
|
||||
virtual void move(particle::Particle* particle,
|
||||
@@ -12,10 +13,18 @@ class Mover {
|
||||
MagneticField* magnetic_field) = 0;
|
||||
};
|
||||
|
||||
// Mover class using the Boris push algorithm for propagation
|
||||
class BorisMover : public Mover {
|
||||
public:
|
||||
// Constructor: sets the maximal timestep acceptable for the Boris puhs algorithm
|
||||
// (should at the very least resolve the gyro timescale of the particle)
|
||||
BorisMover(double maximal_time_step_s);
|
||||
|
||||
// propagate the Particle particle using the electric and magnetic fields
|
||||
// until the particle has moved a distance of mfp_m or until it changes
|
||||
// either its energy or position bin or it reaches the maximal time the
|
||||
// particle is allowed to live
|
||||
// also updates the density, deletion logger and current collector of the particle species
|
||||
void move(particle::Particle* particle,
|
||||
double mfp_m,
|
||||
ElectricField* electric_field,
|
||||
@@ -24,16 +33,29 @@ class BorisMover : public Mover {
|
||||
private:
|
||||
const double maximal_time_step_s_;
|
||||
|
||||
// single update step of the Boris push algorithm
|
||||
// updates moved_distance by the distance the particle moved during the update step
|
||||
// the electric_field and magnetic_field TinyVectors have to contain the electric and
|
||||
// magnetic fields in Cartesian coordinates
|
||||
void movementStep(particle::Particle* particle,
|
||||
const blitz::TinyVector<double, 3>& electric_field,
|
||||
const blitz::TinyVector<double, 3>& magnetic_field,
|
||||
const double timestep,
|
||||
double& moved_distance) const;
|
||||
};
|
||||
|
||||
// Mover class using the drift approximation for propagation
|
||||
class DriftMover : public Mover {
|
||||
public:
|
||||
// Constructor: takes the maximal distance the particle is allowed to move during one step
|
||||
// (should be smaller than the length scale defined by the gradient of the modulus of the magnetic field)
|
||||
DriftMover(double maximal_distance);
|
||||
|
||||
// propagate the Particle particle using the electric and magnetic fields
|
||||
// until the particle has moved a distance of mfp_m or until it changes
|
||||
// either its energy or position bin or it reaches the maximal time the
|
||||
// particle is allowed to live
|
||||
// also updates the density, deletion logger and current collector of the particle species
|
||||
void move(particle::Particle* particle,
|
||||
double mfp_m,
|
||||
ElectricField* electric_field,
|
||||
@@ -42,9 +64,28 @@ class DriftMover : public Mover {
|
||||
private:
|
||||
const double maximal_distance_m_;
|
||||
|
||||
// single update step using the drift approximation
|
||||
// updates moved_distance by the distance the particle moved during the update step
|
||||
blitz::TinyVector<double, 3> driftVelocity(
|
||||
const blitz::TinyVector<double, 3>& magnetic_field,
|
||||
const blitz::TinyVector<double, 3>& electric_field) const;
|
||||
};
|
||||
|
||||
// Mover for the case of no magnetic field. Simply ignores electric and magnetic field
|
||||
// for the movement step, i.e. velocity doesn't change.
|
||||
class EulerMover : public Mover {
|
||||
public:
|
||||
// Constructor: takes the maxium distance the particle is allowed to move during
|
||||
// one update step (used to limit the distance a particle can move
|
||||
// into a neighboring bin before the check can be performed if the bin has been changed)
|
||||
EulerMover(double maximal_distance);
|
||||
|
||||
void move(particle::Particle* particle,
|
||||
double mfp_m,
|
||||
ElectricField* electric_field,
|
||||
MagneticField* magnetic_field);
|
||||
private:
|
||||
const double maximal_distance_m_;
|
||||
};
|
||||
|
||||
#endif /* MOVER_H */
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
#ifndef MPI_COMMUNICATION_H
|
||||
#define MPI_COMMUNICATION_H
|
||||
|
||||
// class to handle MPI communication
|
||||
class MpiCommunication {
|
||||
public:
|
||||
static int mpi_rank;
|
||||
static int mpi_size;
|
||||
|
||||
// returns the MPI-rank of the process
|
||||
static int mpiRank();
|
||||
// returns the number of MPI processes
|
||||
static int mpiSize();
|
||||
|
||||
// initialize the two member variables
|
||||
static void init(int argc, char* argv[]);
|
||||
// wrapper for MPI_Finalize()
|
||||
static void finalize();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#ifndef NEUTRAL_GAS_H
|
||||
#define NEUTRAL_GAS_H
|
||||
|
||||
|
||||
#endif /* NEUTRAL_GAS_H */
|
||||
@@ -7,23 +7,37 @@
|
||||
#include "jansson.h"
|
||||
#include "simulation/jansson_additionals.h"
|
||||
|
||||
// class to handle the json-parameter file and read it's data
|
||||
class Parameter {
|
||||
public:
|
||||
Parameter(std::string filename);
|
||||
~Parameter();
|
||||
|
||||
// read the value at the json path and return it as a double; defaults to 0.0
|
||||
double doubleValue(const json_path& path) const;
|
||||
// read the value at the json path and return it as a double; defaults to the default value
|
||||
double doubleValue(const json_path& path, double default_value) const;
|
||||
// read the value at the json path and return it as a int; defaults to 0
|
||||
int intValue(const json_path& path) const;
|
||||
// read the value at the json path and return it as a int; defaults to default value
|
||||
int intValue(const json_path& path, int default_value) const;
|
||||
// read the value at the json path and return it as a string; defaults to the empty string
|
||||
std::string stringValue(const json_path& path) const;
|
||||
// read the value at the json path and return it as a string; defaults to the default value
|
||||
std::string stringValue(const json_path& path,
|
||||
const std::string& default_value) const;
|
||||
// read the value at the json path and return it as a string;
|
||||
// the string "true" in the json file results in true, everything else in false
|
||||
bool boolValue(const json_path& path) const;
|
||||
// read the value at the json path and return it as a string;
|
||||
// the string "true" in the json file results in true, everything else in the default value
|
||||
bool boolValue(const json_path& path, bool default_value) const;
|
||||
|
||||
// check if "path" exists in the json-parameter file
|
||||
bool pathExists(const json_path& path) const;
|
||||
// return a pointer to the json_t object of the json-parameter_file
|
||||
json_t* jsonFile() const;
|
||||
// return a pointer to the json_t object of the group specified by "path"
|
||||
json_t* jsonObjectFromBase(const json_path& path) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -7,48 +7,79 @@
|
||||
|
||||
namespace particle {
|
||||
|
||||
// class for the simulated particles
|
||||
class Particle {
|
||||
public:
|
||||
// Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
// Coordinate* position,
|
||||
// Vector* velocity);
|
||||
// Constructor: takes shared_ptr to the TrackedSpecies object that describes the particle
|
||||
// the Coordinate containing the position the particle should be created at
|
||||
// the Vector containing the velocity the particle should be created with
|
||||
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity);
|
||||
|
||||
// set the position of the particle to the provided Coordinate new_position
|
||||
void position(const Coordinate& new_position);
|
||||
// return the position of the particle as a CartesianCoordinate
|
||||
CartesianCoordinate position() const;
|
||||
// return the cylinder position of the particle
|
||||
CylinderCoordinate cylinderPosition() const;
|
||||
|
||||
// set the velocity of the particle to the provided CartesianVector new_velocity
|
||||
void velocity(const CartesianVector& new_velocity);
|
||||
// return the velocity of the particle as a CartesianVector
|
||||
CartesianVector velocity() const;
|
||||
|
||||
// ads the Coordinate distance to the position of the particle
|
||||
// x_new = x_old + distance
|
||||
void move(const Coordinate& distance);
|
||||
|
||||
// return the kinetic energy of the particle in eV
|
||||
double kineticEnergy_eV() const;
|
||||
// return the modulus of the particle velocity in m/s
|
||||
double absoluteVelocity() const;
|
||||
// return the squared modulus of the particle velocity in (m/s)^2
|
||||
double absoluteVelocitySquared() const;
|
||||
|
||||
// return the mass of the particle in kg (i.e. the mass of the particles specie)
|
||||
double mass_kg() const;
|
||||
// return the charge of the particle in C (i.e. the charge of the particles specie)
|
||||
double charge_C() const;
|
||||
|
||||
// get a raw pointer to the TrackedSpecie object of the particle
|
||||
species::TrackedSpecie* specie() const;
|
||||
|
||||
// set the static variable (only local to the mpi process) from which
|
||||
// the particle ids are generated
|
||||
static void lastId(long int id);
|
||||
static long int lastId(); // only local on this cpu
|
||||
// get the static variable (only local to the mpi process) from which
|
||||
// the particle ids are generated
|
||||
static long int lastId();
|
||||
|
||||
// increase member variable that counts the number of interactions performed
|
||||
// by the particle by 1
|
||||
void increaseInteractionCounter();
|
||||
// return the value of the number of interactions performed by the particle
|
||||
long int interactionCounter() const;
|
||||
|
||||
// increase member variable counting the total time (in s) that the
|
||||
// particle has been alive
|
||||
void increaseTimeAlive(double time_s);
|
||||
// return the time the particle has been alive (in s)
|
||||
double timeAlive() const;
|
||||
|
||||
// increase member variable counting the time the particle has bin alive
|
||||
// without chaingin any bin (i.e. spatial or energy) by the given time (in s).
|
||||
// equivalent to the time the particle has spent in its current bin
|
||||
void increaseTimeInBin(double time_s);
|
||||
// reset the time in bin variable (i.e. set to 0)
|
||||
void resetTimeInBin();
|
||||
// return the time the particle has not changed any bin
|
||||
double timeInBin() const;
|
||||
|
||||
private:
|
||||
CartesianVector velocity_;
|
||||
CartesianCoordinate position_;
|
||||
CylinderCoordinate position_cyl_;
|
||||
|
||||
double time_alive_s_;
|
||||
double time_in_bin_s_;
|
||||
|
||||
@@ -4,15 +4,25 @@
|
||||
#include <vector>
|
||||
#include "blitz/array.h"
|
||||
|
||||
// class for a linear binning without under- or overflow bins
|
||||
class LowerAndUpperBoundBinning {
|
||||
public:
|
||||
// Constructor: create binning with num_bins bins and
|
||||
// an upper boundary of maximum (the lower boundary is always chosen as 0)
|
||||
// the spacing between bins is always linear
|
||||
LowerAndUpperBoundBinning(int num_bins, double maximum);
|
||||
|
||||
// return the bin index, that includes the value position
|
||||
int bin(double position) const;
|
||||
// return the spacing between the bin borders
|
||||
double stepsize() const;
|
||||
// getter for the number of bins
|
||||
int numBins() const;
|
||||
// returns the index for the first bin (0)
|
||||
int binIndexMin() const;
|
||||
// returns the index for the last bin (num_bins - 1)
|
||||
int binIndexMax() const;
|
||||
// return a vector containing the edges of the bins
|
||||
std::vector<double> binBorders() const;
|
||||
|
||||
private:
|
||||
@@ -20,17 +30,27 @@ class LowerAndUpperBoundBinning {
|
||||
double stepsize_;
|
||||
};
|
||||
|
||||
// class for a linear binning with an overflow but no underflow bin
|
||||
class LowerBoundBinningWithOverflow {
|
||||
public:
|
||||
// Constructor: creates a linear binning between 0 and maximum with num_bins_excluding_overflow
|
||||
// (number of bins without the overflow bin)
|
||||
LowerBoundBinningWithOverflow(int num_bins_excluding_overflow,
|
||||
double maximum);
|
||||
|
||||
// return the bin index, that includes the value position
|
||||
int bin(double position) const;
|
||||
// return the spacing between the bin borders
|
||||
double stepsize() const;
|
||||
// returns the number of bins including the overflow bin
|
||||
int numBinsWithOverflow() const;
|
||||
// returns the number of bins excluding the overflow bin
|
||||
int numBinsWithoutOverflow() const;
|
||||
// returns the index for the first bin (0)
|
||||
int binIndexMin() const;
|
||||
// returns the index for the last bin (i.e. the overflow bin)
|
||||
int binIndexMax() const;
|
||||
// return the values of the borders of the bins (the overflow bin does not have an upper boundary)
|
||||
std::vector<double> binBorders() const;
|
||||
|
||||
private:
|
||||
@@ -38,17 +58,28 @@ class LowerBoundBinningWithOverflow {
|
||||
double stepsize_;
|
||||
};
|
||||
|
||||
// class for a linear binning with an under- and overflow bin
|
||||
class BinningWithOverAndUnderflow {
|
||||
public:
|
||||
// Constructor: creates a linear binning between 0 and maximum with num_bins_excluding_overflow
|
||||
// (number of bins without the overflow and underflow bin)
|
||||
BinningWithOverAndUnderflow(int num_bins_excluding_overunderflow,
|
||||
double maximum);
|
||||
|
||||
// return the bin index, that includes the value position
|
||||
int bin(double position) const;
|
||||
// return the spacing between the bin borders
|
||||
double stepsize() const;
|
||||
// returns the number of bins including both the overflow and underflow bin
|
||||
int numBinsWithOverUnderflow() const;
|
||||
// returns the number of bins excluding both the overflow and underflow bin
|
||||
int numBinsWithoutOverUnderflow() const;
|
||||
// returns the index for the first (underflow) bin (-1)
|
||||
int binIndexMin() const;
|
||||
// returns the index for the last bin (i.e. the overflow bin)
|
||||
int binIndexMax() const;
|
||||
// return the values of the borders of the bins (the overflow bin does not have an upper
|
||||
// and the underflow bin does not have a lower boundary)
|
||||
std::vector<double> binBorders() const;
|
||||
|
||||
private:
|
||||
@@ -56,23 +87,48 @@ class BinningWithOverAndUnderflow {
|
||||
double stepsize_;
|
||||
};
|
||||
|
||||
// class for handling the segmentation of a cylindrical domain
|
||||
class CylinderBinning {
|
||||
public:
|
||||
// Constructor: takes the number of bins for the radial direction,
|
||||
// the radius of the cylinder,
|
||||
// the number of bins in azimuthal direction,
|
||||
// the number of bins in longitudinal (i.e. z) direction,
|
||||
// the height of the cylinder
|
||||
// creates a LowerBoundBinninigWithOverflow for the radial direction (no boundary at r=0),
|
||||
// a LowerAndUpperBoundBinning for the azimuthal direction (no boundary at all),
|
||||
// and a BinningWithOverAndUnderflow in longitudinal direction
|
||||
CylinderBinning(int num_bins_radial,
|
||||
double radius,
|
||||
int num_bins_azimuthal,
|
||||
int num_bins_longitudinal,
|
||||
double height);
|
||||
|
||||
// return a blitz::TinyVector containing the indeces for each of the three binnings
|
||||
// (bin_r, bin_azimuthal, bin_longitudinal), in which the blitz::TinyVector cylinder_position
|
||||
// (containing (r, phi,z)) is contained in
|
||||
blitz::TinyVector<int, 3> bin(
|
||||
const blitz::TinyVector<double, 3>& cylinder_position) const;
|
||||
// return a blitz::TinyVector with the spacings of the three binnings
|
||||
// (spacing_radial, spacing_azimuthal, spacing_longitudinal)
|
||||
blitz::TinyVector<double, 3> stepsize() const;
|
||||
|
||||
// return a blitz::TinyVector with the number of bins of each binning (excludes all over- and underflow bins)
|
||||
// (numBins_radial, numBins_azimuthal, numBins_longitudinal)
|
||||
blitz::TinyVector<int, 3> numBins() const;
|
||||
// return a blitz::TinyVector with the number of bins of each binning (includes all over- and underflow bins)
|
||||
// (numBins_radial, numBins_azimuthal, numBins_longitudinal)
|
||||
blitz::TinyVector<int, 3> numBinsIncludingOverUnderflow() const;
|
||||
// return a blitz::TinyVector with the indices of the first bins of each binning
|
||||
// (binIndexMin_radial, binIndexMin_azimuthal, binIndexMin_longitudinal)
|
||||
// includes the underflow bin in longitudinal direction
|
||||
blitz::TinyVector<int, 3> binIndexMin() const;
|
||||
// return a blitz::TinyVector with the indices of the last bins of each binning
|
||||
// (binIndexMin_radial, binIndexMin_azimuthal, binIndexMin_longitudinal)
|
||||
// includes the overflow bin in radial and longitudinal direction
|
||||
blitz::TinyVector<int, 3> binIndexMax() const;
|
||||
|
||||
// binnings for each of the three directions (radial, azimuthal, longitudinal)
|
||||
const LowerBoundBinningWithOverflow radial_binning;
|
||||
const LowerAndUpperBoundBinning azimuth_binning;
|
||||
const BinningWithOverAndUnderflow longitudinal_binning;
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
#include <memory>
|
||||
#include <random>
|
||||
|
||||
// class to handle a random generator object
|
||||
class RandomNumbers {
|
||||
public:
|
||||
// Constructor: takes the seed for the random engine
|
||||
RandomNumbers(int seed);
|
||||
|
||||
// draw a uniformly distributed integer number between min, max
|
||||
int rollUniform(int min, int max);
|
||||
// draw a uniformly distributed double number between min, max
|
||||
double rollUniform(double min, double max);
|
||||
|
||||
// getter for the pointer to the mersenne twister 19937 engine
|
||||
std::mt19937* engine();
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "simulation/particle.h"
|
||||
|
||||
// class defining the minimum requirements of a Reflector class
|
||||
class Reflector {
|
||||
public:
|
||||
virtual bool needsReflectionBackToDomain(
|
||||
@@ -10,18 +11,27 @@ class Reflector {
|
||||
virtual void reflectBackToDomain(particle::Particle* particle) const = 0;
|
||||
};
|
||||
|
||||
// class for Reflectrion at the DPS section of KATRIN
|
||||
// (i.e. reflection at the z=L end of the cylinder)
|
||||
class ReflectorDPS : public Reflector {
|
||||
public:
|
||||
// Constructor: takes the position in longitudinal direction where particles should
|
||||
// be reflected at (reflects particles back to lower z values)
|
||||
ReflectorDPS(double z_position_dps);
|
||||
// check if Particle particle needs to be reflected
|
||||
bool needsReflectionBackToDomain(const particle::Particle* particle) const;
|
||||
// perform the reflection of the particle back to the left
|
||||
void reflectBackToDomain(particle::Particle* particle) const;
|
||||
|
||||
private:
|
||||
const double z_position_dps_;
|
||||
};
|
||||
|
||||
// class for particles that are not reflected anywhere
|
||||
class NoReflector : public Reflector {
|
||||
// always returns false
|
||||
bool needsReflectionBackToDomain(const particle::Particle* particle) const;
|
||||
// does nothing
|
||||
void reflectBackToDomain(particle::Particle* particle) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,15 +6,22 @@
|
||||
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// class for a scalar field
|
||||
class ScalarField {
|
||||
public:
|
||||
// returns the value of the scalar field at the Coordinate coordinate
|
||||
virtual double value(const Coordinate& coordinate) const = 0;
|
||||
};
|
||||
|
||||
// class for a scalar field that has an arbitrary form in longitudinal direction
|
||||
// and is constant in radial in azimuthal directoin
|
||||
class ScalarFieldFunctionInZ : public ScalarField {
|
||||
public:
|
||||
// Constructor: gets the function F_z defining the form of the scalar field
|
||||
// in longitudinal direction
|
||||
ScalarFieldFunctionInZ(std::function<double(double, double, double)> F_z);
|
||||
|
||||
// return the value of the scalar field at Coordinate coordinate
|
||||
double value(const Coordinate& coordinate) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,23 +9,33 @@
|
||||
|
||||
#include "simulation/energy_binning.h"
|
||||
|
||||
// class defining the minimum requirements of a scattering angle distribution
|
||||
class ScatteringAngleDistribution {
|
||||
public:
|
||||
// draw a value for the scattering angle depending on the energy (in eV) and
|
||||
// the random engine
|
||||
virtual double roll(std::mt19937* engine, double energy_eV) = 0;
|
||||
};
|
||||
|
||||
// class for an isotropic scattering angle distribution
|
||||
class IsotropicAngleDistribution : public ScatteringAngleDistribution {
|
||||
public:
|
||||
// Constructor: initializes a uniform distribution between (o,2pi)
|
||||
IsotropicAngleDistribution();
|
||||
// draw from a uniform distribution
|
||||
double roll(std::mt19937* engine, double energy_eV = 0.);
|
||||
|
||||
private:
|
||||
std::uniform_real_distribution<double> distribution_;
|
||||
};
|
||||
|
||||
// class for drawing from a piecewise linear scattering angle distribution
|
||||
class AngleDistributionFromFile : public ScatteringAngleDistribution {
|
||||
public:
|
||||
// Constructor: takes string containing the absolute path (including the file)
|
||||
// that contains the data of the scattering angle distribution
|
||||
AngleDistributionFromFile(std::string absolute_filepath);
|
||||
// draw a value from the distribution
|
||||
double roll(std::mt19937* engine, double energy_eV);
|
||||
|
||||
private:
|
||||
@@ -33,12 +43,17 @@ class AngleDistributionFromFile : public ScatteringAngleDistribution {
|
||||
std::vector<std::piecewise_linear_distribution<double>> angle_distributions_;
|
||||
};
|
||||
|
||||
// class for a composition of two scattering angle distibutions
|
||||
class CompositeAngleDistribution : public ScatteringAngleDistribution {
|
||||
public:
|
||||
// Constructor: takes two ScatteringAngleDistributions and a decider energy (eV)
|
||||
// if energy_eV < decider energy use lower_distribution
|
||||
// otherwise use the higher_distribution
|
||||
CompositeAngleDistribution(
|
||||
std::shared_ptr<ScatteringAngleDistribution> lower_distribution,
|
||||
std::shared_ptr<ScatteringAngleDistribution> higher_distribution,
|
||||
double decider_energy);
|
||||
// draw a value from the distribution
|
||||
double roll(std::mt19937* engine, double energy_eV);
|
||||
|
||||
private:
|
||||
|
||||
@@ -8,42 +8,73 @@
|
||||
#include "simulation/parameter.h"
|
||||
#include "simulation/particle.h"
|
||||
|
||||
// defined in "simulation/random_numbers.h"
|
||||
class RandomNumbers;
|
||||
// defined in "simulation/interaction.h"
|
||||
class InteractionOutput;
|
||||
// defined in "simulation/electromagnetic_field.h"
|
||||
class MagneticField;
|
||||
class ElectricField;
|
||||
// defined in "simulation/timer.h"
|
||||
class Timer;
|
||||
// defined in "simulation/injector.h"
|
||||
class Injector;
|
||||
// defined in "IO/simulation_output.h"
|
||||
class SimulationOutput;
|
||||
// defined in "simulation/cpu_synchronizer.h"
|
||||
class CpuSynchronizer;
|
||||
|
||||
// defined in "simulation/species.h"
|
||||
namespace species {
|
||||
class Specie;
|
||||
};
|
||||
|
||||
// defined in "simulation/interaction.h"
|
||||
namespace interaction {
|
||||
class InteractionOutput;
|
||||
};
|
||||
|
||||
class Simulation {
|
||||
public:
|
||||
// Constructor: initialize everything using the json file at the path in parameter_filename
|
||||
Simulation(std::string parameter_filename);
|
||||
|
||||
// function for initialization from Parameter object
|
||||
void init(Parameter& parameter);
|
||||
// function for main simulation loop
|
||||
void start();
|
||||
// function to finalize simulation
|
||||
void finalize();
|
||||
// process events until "events" number of beta decay chains have been
|
||||
// simulated until completion
|
||||
void processEvents(int events);
|
||||
// process the Particle particle until it is terminated
|
||||
// any interaction product created during the interactions during the propagation of
|
||||
// particle are appened to the vector particle_queue
|
||||
void processUntilTermination(particle::Particle& particle,
|
||||
std::vector<particle::Particle>& particle_queue);
|
||||
|
||||
private:
|
||||
// function to create particles from the injector (i.e. the event particles)
|
||||
// also increases the time in the Timer object
|
||||
std::vector<particle::Particle> determineInjectedParticles(
|
||||
RandomNumbers* random);
|
||||
|
||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random);
|
||||
// calculate the mean free path for the Particle particle
|
||||
// the calculated target density scaled cross sections are then
|
||||
// appened to the vector macroscopic_cross_sections_m to be used
|
||||
// later in the interact function (to avoid an unneccessary recalculation)
|
||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m);
|
||||
|
||||
// randomly chooses the interaction the particle will experience by
|
||||
// using the values in the macroscopic_cross_sections_m vector (does NOT have to be normalized)
|
||||
// as the relative weight for the corresponding interaction to occur
|
||||
// afterwards perform the interaction and return the
|
||||
// output of the as an InteractionOutput object
|
||||
interaction::InteractionOutput interact(particle::Particle& particle,
|
||||
RandomNumbers* random);
|
||||
RandomNumbers* random,
|
||||
std::vector<double>& macroscopic_cross_sections_m);
|
||||
|
||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
||||
tracked_species_;
|
||||
|
||||
@@ -7,51 +7,91 @@
|
||||
|
||||
#include "simulation/parameter.h"
|
||||
|
||||
// defined in "simulation/mover.h"
|
||||
class Mover;
|
||||
// defined in "simulation/terminator.h"
|
||||
class Terminator;
|
||||
// defined in "simulation/reflector.h"
|
||||
class Reflector;
|
||||
// defined in "simulation/injector.h"
|
||||
class Injector;
|
||||
// defined in "simulation/density_field.h"
|
||||
class DensityField;
|
||||
class DynamicDensityField;
|
||||
class ConstantDensityField;
|
||||
// defined in "simulation/logger.h"
|
||||
class DeletionLogger;
|
||||
// defined in "simulation/current_collector.h"
|
||||
class CurrentCollector;
|
||||
// defined in "simulation/velocity_distribution.h"
|
||||
class VelocityDistribution;
|
||||
// defined in "simulation/drift_velocity.h"
|
||||
class DriftVelocity;
|
||||
|
||||
// defined in "simulation/interaction.h"
|
||||
namespace interaction {
|
||||
class Interaction;
|
||||
};
|
||||
|
||||
namespace species {
|
||||
|
||||
// enum that lists all implemented specie types (Tritium molecule T2, electron,
|
||||
// Tritium ion T+, Tritium molecule ion T2+ and Trtitium cluster ion T3+)
|
||||
enum class ImplementedSpecies { T2, electron, Tplus, T2plus, T3plus };
|
||||
|
||||
// general specie, defining the minimum requirements for all other specie classes
|
||||
class Specie {
|
||||
public:
|
||||
// Constructor, taking one of the implemented speices in the ImplementedSpecies enum,
|
||||
// an arbitrary string defining the name of the species (e.g. if multiple electron species
|
||||
// are required), the mass of the particle type in kg and it's charge in Coulomb
|
||||
Specie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
double charge_C);
|
||||
|
||||
// getter for the mass of the species (in kg)
|
||||
double mass_kg() const;
|
||||
// getter for the charge of the species (in Coulomb)
|
||||
double charge_C() const;
|
||||
// getter for the type of the species (ImplementedSpecies enum)
|
||||
ImplementedSpecies type() const;
|
||||
// getter for the name of the species
|
||||
std::string name() const;
|
||||
|
||||
// getter for the DensityField pointer
|
||||
virtual DensityField* densityField() = 0;
|
||||
// getter for the VelocityDistribution pointer
|
||||
virtual VelocityDistribution* velocityDistibution() = 0;
|
||||
// getter for the DriftVelocity pointer
|
||||
virtual DriftVelocity* driftVelocity() = 0;
|
||||
|
||||
protected:
|
||||
// mass of species in kg
|
||||
const double mass_kg_;
|
||||
// charge of species in C
|
||||
const double charge_C_;
|
||||
// type of species defined by ImplementedSpecies enum
|
||||
const ImplementedSpecies type_;
|
||||
// arbitrary name of the species
|
||||
const std::string name_;
|
||||
};
|
||||
|
||||
// class for particle species that are simulated
|
||||
class TrackedSpecie : public Specie {
|
||||
public:
|
||||
// Constructor; takes an ImplemetedSpecies enum to define the type of the species,
|
||||
// an arbitrary string to name the species,
|
||||
// the mass of the particles of the species in kg,
|
||||
// the charge of the particles of the species in C,
|
||||
// a shared_ptr of a Mover object (defines the propagation algorithm),
|
||||
// a shared_ptr of a Terminator object (defines when a particle is deleted),
|
||||
// a shared_ptr of a Reflector object (defines if, where and how a particle of the specie is reflected),
|
||||
// a shared_ptr of a DynamicDensityField object (collects the density of the species),
|
||||
// a shared_ptr of a DriftVelocity object (can be a nullptr but only if no interactions between simulated species are present),
|
||||
// a shared_ptr of a second DynamicDensityField object (essentially a copy of the first DynamicDensityField; necessary for cpu-synchronization)
|
||||
// the deletion logger and the current collector (as well as their synchronization equivalents) are initialized
|
||||
// with a null pointer
|
||||
TrackedSpecie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
@@ -61,24 +101,53 @@ class TrackedSpecie : public Specie {
|
||||
std::shared_ptr<Reflector> reflector,
|
||||
std::shared_ptr<DynamicDensityField> density_field,
|
||||
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
||||
std::shared_ptr<DriftVelocity> drift_velocity);
|
||||
std::shared_ptr<DriftVelocity> drift_velocity,
|
||||
std::shared_ptr<DynamicDensityField> last_sync_density_field);
|
||||
|
||||
// getter for a raw pointer to the DynamicDensityField member as its parent class DensityField
|
||||
DensityField* densityField();
|
||||
// getter for a raw pointer to the VelocityDistribution member
|
||||
VelocityDistribution* velocityDistibution();
|
||||
// getter for a raw pointer to the driftVelocity member
|
||||
DriftVelocity* driftVelocity();
|
||||
|
||||
// getter for a raw pointer to the DynamicDensityField member
|
||||
DynamicDensityField* dynamicDensityField();
|
||||
// getter for a raw pointer to the DynamicDensityField member used for the synchronization between processes
|
||||
DynamicDensityField* lastSyncDensityField();
|
||||
// getter for a raw pointer to the Mover member
|
||||
Mover* mover();
|
||||
// getter for a raw pointer to the Terminator member
|
||||
Terminator* terminator();
|
||||
// getter for a raw pointer to the Reflector member
|
||||
Reflector* reflector();
|
||||
|
||||
// getter for a raw pointer to the DeletionLogger member
|
||||
DeletionLogger* deletionLogger();
|
||||
|
||||
// setter for the DeletionLogger member
|
||||
void deletionLogger(std::shared_ptr<DeletionLogger> new_logger);
|
||||
|
||||
// getter for a raw pointer to the DeletionLogger member used for cpu-synchronization
|
||||
DeletionLogger* lastSyncDeletionLogger();
|
||||
// setter for the DeletionLogger member used for cpu-synchronization
|
||||
void lastSyncDeletionLogger(std::shared_ptr<DeletionLogger> new_logger);
|
||||
|
||||
// getter for a raw pointer to the CurrentCollector member
|
||||
CurrentCollector* currentCollector();
|
||||
// setter for the CurrentCollector member
|
||||
void currentCollector(std::shared_ptr<CurrentCollector> new_collector);
|
||||
|
||||
// getter for a raw pointer to the CurrentCollector member used for cpu-synchronization
|
||||
CurrentCollector* lastSyncCurrentCollector();
|
||||
// setter for the CurrentCollector member used for cpu-synchronization
|
||||
void lastSyncCurrentCollector(
|
||||
std::shared_ptr<CurrentCollector> new_collector);
|
||||
|
||||
// vector of shared_ptr to Interaction objects, defines the different types
|
||||
// of interactions that the specie can take part in
|
||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions();
|
||||
// adds the shared_ptr of the Interaction object "interaction" to the vector
|
||||
// of possible interactions
|
||||
void addInteraction(std::shared_ptr<interaction::Interaction> interaction);
|
||||
|
||||
private:
|
||||
@@ -90,13 +159,29 @@ class TrackedSpecie : public Specie {
|
||||
std::shared_ptr<Terminator> terminator_;
|
||||
std::shared_ptr<Reflector> reflector_;
|
||||
|
||||
// object to keep track of how particles of the specie are removed from the simulation
|
||||
std::shared_ptr<DeletionLogger> deletion_logger_;
|
||||
std::shared_ptr<CurrentCollector> current_collector_;
|
||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions_;
|
||||
|
||||
// fields to store the data of the last synchronization
|
||||
// (immediately after a synchronization the last_sync field and the non-last_sync field
|
||||
// contain the same data)
|
||||
std::shared_ptr<DynamicDensityField> last_sync_density_field_;
|
||||
std::shared_ptr<DeletionLogger> last_sync_deletion_logger_;
|
||||
std::shared_ptr<CurrentCollector> last_sync_current_collector_;
|
||||
};
|
||||
|
||||
// class for particle types that are not simulated
|
||||
class BackgroundSpecie : public Specie {
|
||||
public:
|
||||
// Constructor: takes the type of the species as one of the implemented species defined in the ImplementedSpecies enum,
|
||||
// an arbirtary name for the species,
|
||||
// the mass of the particles of the species in kg,
|
||||
// the charge of the particles of the species in C,
|
||||
// a shared_ptr to a ConstantDensityField object,
|
||||
// a shared_ptr to a VelocityDistribution object (defines the velocity distribution of the particles realtive to their drift veloctiy)
|
||||
// a shared_ptr to a DriftVelocity object (defines the drift velocity of the particles)
|
||||
BackgroundSpecie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
@@ -105,8 +190,11 @@ class BackgroundSpecie : public Specie {
|
||||
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
||||
std::shared_ptr<DriftVelocity> drift_velocity);
|
||||
|
||||
// getter for a raw pointer to the ConstantDensityField member as its parent type
|
||||
DensityField* densityField();
|
||||
// getter for a raw pointer to the VelocityDistribution member
|
||||
VelocityDistribution* velocityDistibution();
|
||||
// getter for a raw pointer to the driftVelocity member
|
||||
DriftVelocity* driftVelocity();
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,18 +3,31 @@
|
||||
|
||||
#include "simulation/particle.h"
|
||||
|
||||
// defined in "simulation/geometry.h"
|
||||
class Geometry;
|
||||
|
||||
// class for checking if a paricle has to be terminated due to
|
||||
// any reason except interaction effects
|
||||
class Terminator {
|
||||
public:
|
||||
// Constructor: takes the maximum number of interactions a particle is allowed to perform
|
||||
// the maximum amount of time a paticle is allowed to live
|
||||
// a Geometry object defining the boundaries of the volume particles are allowed to exist in
|
||||
Terminator(long int max_interactions,
|
||||
double max_time_alive,
|
||||
std::shared_ptr<Geometry> geometry);
|
||||
|
||||
// check if particle has not reached the maximum interaction count, the maximal time its allowed to live
|
||||
// and that it has not reached a geometry boundary
|
||||
bool isAlive(const particle::Particle* particle) const;
|
||||
// check if particle has crossed any boundary of the Geometry
|
||||
bool leftSimulationDomain(const particle::Particle* particle) const;
|
||||
// check if particle has reached the maximum interaction count
|
||||
bool reachedMaxInteractions(const particle::Particle* particle) const;
|
||||
// check if the particle has reached its maximum lifetime
|
||||
bool reachedMaxTimeAlive(const particle::Particle* particle) const;
|
||||
// return the maximum lifetime
|
||||
double maxTimeAlive() const;
|
||||
|
||||
private:
|
||||
const long int max_interactions_;
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// class to keep track of the "simulation time" (i.e. number of processed events * Activity)
|
||||
class Timer {
|
||||
public:
|
||||
// Constructor; initializes time to 0
|
||||
Timer();
|
||||
|
||||
// getter for the time
|
||||
double time() const;
|
||||
// increase the time by time_s (time in s)
|
||||
void increaseTimestep(double time_s);
|
||||
// set time to time_s
|
||||
void setTime(double time_s);
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
// return a function calculating the fermi distribution with the given prefactor
|
||||
std::function<double(double)> tritiumDecayEnergySpectrum(double prefactor);
|
||||
|
||||
|
||||
|
||||
@@ -5,15 +5,26 @@
|
||||
|
||||
namespace unitConvertion {
|
||||
|
||||
// transforms the value from current lenght unit "unit_from" to "unit_to"
|
||||
// possible values for both "unit_from" and "unit_to": "mm", "cm", "m" otherwise
|
||||
// an error is thrown and the program terminates
|
||||
double length(double value,
|
||||
const std::string& unit_from,
|
||||
const std::string& unit_to);
|
||||
|
||||
// returns the value of unit/meter, supports "mm", "cm", "m" for any other value
|
||||
// an error is thrown and the program terminates
|
||||
double lengthPrefactor(const std::string& unit);
|
||||
|
||||
// transforms the value from current energy unit "unit_from" to "unit_to"
|
||||
// possible values for both "unit_from" and "unit_to": "eV", "J" otherwise
|
||||
// an error is thrown and the program terminates
|
||||
double energy(double value,
|
||||
const std::string& unit_from,
|
||||
const std::string& unit_to);
|
||||
|
||||
// returns the value of unit/eV, supports "eV", "J" for any other value
|
||||
// an error is thrown and the program terminates
|
||||
double energyPrefactor(const std::string& unit);
|
||||
|
||||
}; // namespace unitConvertion
|
||||
|
||||
@@ -7,43 +7,61 @@
|
||||
#include "simulation/coordinates.h"
|
||||
#include "simulation/position_binning.h"
|
||||
|
||||
// class for vector fields
|
||||
class VectorField {
|
||||
public:
|
||||
// return the value of the vector field at the Coordinate coordinate as a
|
||||
// CylinderVector object
|
||||
virtual CylinderVector value(const Coordinate& coordinate) const = 0;
|
||||
};
|
||||
|
||||
// class for vector fields that are defined by an array (e.g. from data that was used as input)
|
||||
class VectorFieldFromArray : public VectorField {
|
||||
public:
|
||||
// Constructor: takes the radial, azimuthal and longitudinal component of the vector field
|
||||
// as 3d arrays; all three arrays have to have the same size (not checked)
|
||||
// also takes the radius and length of the domain, where the vector field is defined
|
||||
VectorFieldFromArray(const blitz::Array<double, 3>& radial_component,
|
||||
const blitz::Array<double, 3>& azimuthal_component,
|
||||
const blitz::Array<double, 3>& longitudial_component,
|
||||
double radius,
|
||||
double length);
|
||||
|
||||
// return the value at the Coordinate coordinate, if the coordinate does not fall into
|
||||
// the region where the vector field is defined in return (0,0,0)
|
||||
CylinderVector value(const Coordinate& coordinate) const;
|
||||
|
||||
private:
|
||||
// todo: make sure we use fast axis on z to reduce acess time
|
||||
const blitz::Array<double, 3> Fr_;
|
||||
const blitz::Array<double, 3> Fphi_;
|
||||
const blitz::Array<double, 3> Fz_;
|
||||
|
||||
// used to determine which array element is neccessary in the value() function
|
||||
CylinderBinning binning_;
|
||||
CylinderVector value(const blitz::TinyVector<int, 3>& bin) const;
|
||||
};
|
||||
|
||||
|
||||
// class for spatially constant vector fields
|
||||
class VectorFieldConstant : public VectorField {
|
||||
public:
|
||||
// Constructor: takes the value of the constant cylinder vector for the vector field
|
||||
VectorFieldConstant(const CylinderVector& constant);
|
||||
// return the value of the vector field at the Coordinate coordinate as a CylinderVector
|
||||
CylinderVector value(const Coordinate& coordinate) const;
|
||||
|
||||
private:
|
||||
const CylinderVector constant_;
|
||||
};
|
||||
|
||||
// class for a vector field that has a z-dependence that can be described by an
|
||||
// analytic function and is 0 for the radial and azimuthal component
|
||||
class VectorFieldFunctionInZ : public VectorField {
|
||||
public:
|
||||
// Constructor: takes a function that describes the value of the longitudinal
|
||||
// component as a function of r,phi,z
|
||||
VectorFieldFunctionInZ(std::function<double(double, double, double)> v_z);
|
||||
// return the value of the vector field at the Coordinate coordinate as a CylinderVector
|
||||
CylinderVector value(const Coordinate& coordinate) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,19 +5,30 @@
|
||||
#include <random>
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// defined in "velocity_distribution_function.h"
|
||||
class VelocityDistributionFunction;
|
||||
|
||||
// class to define the minimum requirements of a velocity distribution function
|
||||
// (in the frame center of mass frame)
|
||||
class VelocityDistribution {
|
||||
public:
|
||||
// draw a randomly oriented Cartesian velocity vector at the Coordinate position
|
||||
// using the random engine
|
||||
virtual CartesianVector rollVelocity(const Coordinate& position,
|
||||
std::mt19937* engine) = 0;
|
||||
};
|
||||
|
||||
// class that defines a velocity distribution by the usage of a VelocityDistributionFunction
|
||||
// object
|
||||
class VelocityDistributionFromFunction : public VelocityDistribution {
|
||||
public:
|
||||
// Constructor: takes a shared_ptr to the VelocityDistributionFunction, that defines the
|
||||
// distribution to be drawn from
|
||||
VelocityDistributionFromFunction(
|
||||
std::shared_ptr<VelocityDistributionFunction> fv);
|
||||
|
||||
// returns a radnomly oriented CartesianVector drawn from the VelocityDistribution
|
||||
// given at creation of the object
|
||||
CartesianVector rollVelocity(const Coordinate& position,
|
||||
std::mt19937* engine);
|
||||
|
||||
@@ -25,22 +36,4 @@ class VelocityDistributionFromFunction : public VelocityDistribution {
|
||||
std::shared_ptr<VelocityDistributionFunction> fv_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
todo: implement this for direct interactions of simulated particles
|
||||
|
||||
class DensityField;
|
||||
|
||||
class VelocityDistributionFromDensityField : public VelocityDistribution {
|
||||
public:
|
||||
VelocityDistributionFromDensityField(
|
||||
std::shared_ptr<DensityField> density_field);
|
||||
CartesianVector driftVelocity_ms(const CylinderVector& position);
|
||||
CartesianVector rollVelocity_ms(
|
||||
const CylinderVector& position, std::mt19937* engine);
|
||||
private:
|
||||
std::shared_ptr<DensityField> density_field_;
|
||||
};
|
||||
*/
|
||||
|
||||
#endif /* VELOCITY_DISTRIBUTION_H */
|
||||
|
||||
@@ -6,17 +6,27 @@
|
||||
|
||||
#include "simulation/coordinates.h"
|
||||
|
||||
// defined in "simulation/energy_distribution.h"
|
||||
class EnergyDistributionFunction;
|
||||
|
||||
// class to define minimum requirements for a VelocityDistributionFunction child class
|
||||
class VelocityDistributionFunction {
|
||||
public:
|
||||
virtual CartesianVector rollVelocity(std::mt19937* engine) = 0;
|
||||
};
|
||||
|
||||
// class for a velocity distribution, that has a isotropically distributed
|
||||
// direction of the velocity vector and an modulus that is inferred from
|
||||
// an energy distribution
|
||||
class IsotropicDistribution : public VelocityDistributionFunction {
|
||||
public:
|
||||
// Constructor: takes a shared_ptr to an EnergyDistributionFunction that describes
|
||||
// the distribution of the energy and the mass of the particle
|
||||
// to transform the drawn energy to the corresponding velocity
|
||||
IsotropicDistribution(std::shared_ptr<EnergyDistributionFunction> f_E,
|
||||
double mass_kg);
|
||||
// draw an isotropically directed velocity vector with a modulus determined by the
|
||||
// EnergyDistributionFunction given at construction of the object
|
||||
CartesianVector rollVelocity(std::mt19937* engine);
|
||||
|
||||
private:
|
||||
@@ -24,11 +34,19 @@ class IsotropicDistribution : public VelocityDistributionFunction {
|
||||
const double mass_kg_;
|
||||
};
|
||||
|
||||
// class for a velocity distribution, that has a fixed direction of the velocity vector
|
||||
// and an modulus that is inferred from an energy distribution
|
||||
class DirectedDistribution : public VelocityDistributionFunction {
|
||||
public:
|
||||
// Constructor: takes a shared_ptr to an EnergyDistributionFunction that describes
|
||||
// the distribution of the energy and the mass of the particle
|
||||
// to transform the drawn energy to the corresponding velocity
|
||||
// and the direction of the velocity vector
|
||||
DirectedDistribution(std::shared_ptr<EnergyDistributionFunction> f_E,
|
||||
double mass_kg,
|
||||
const CartesianVector& direction);
|
||||
// draw a directed velocity vector with a modulus determined by the
|
||||
// EnergyDistributionFunction given at construction of the object
|
||||
CartesianVector rollVelocity(std::mt19937* engine);
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,19 +5,30 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// structure to measure a timing (stores begin and endpoint and the corresponding timespan)
|
||||
struct TimerEvent {
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> start;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> stop;
|
||||
std::chrono::duration<double, std::nano> total_timespan;
|
||||
};
|
||||
|
||||
// class to time between a start and endpoint if the code has been compiled with
|
||||
// USE_TIMER = true, otherwise does nothing
|
||||
class SimulationTimer {
|
||||
public:
|
||||
// if first invocation of eventStartPoint with a specific event_name, adds a
|
||||
// TimerEvent at the time it was called; otherwise sets the value to
|
||||
// the time it has been invoked
|
||||
static void eventStartPoint(std::string event_name);
|
||||
// sets the endpoint in the TimerEvent struct to the time the function was called
|
||||
// the event_name has to match with an eventStartPoint invocation (not checked)
|
||||
// calculates the timedifference
|
||||
static void eventStopPoint(std::string event_name);
|
||||
// print a formatted string containing all event_names and their respective timing to stdout
|
||||
static void printDurations();
|
||||
|
||||
private:
|
||||
// map to store all event_names with their TimerEvent structs
|
||||
static std::map<std::string, TimerEvent> timed_events_;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ dummy: all
|
||||
|
||||
# Directories
|
||||
PROJECT_DIR = $(HOMEBASE)
|
||||
|
||||
TEST_DIR = $(PROJECT_DIR)/test
|
||||
CONFIG_DIR = $(PROJECT_DIR)/config
|
||||
BUILD_DIR = $(PROJECT_DIR)/build
|
||||
BIN_DIR = $(PROJECT_DIR)/bin
|
||||
@@ -47,20 +45,18 @@ LIBS += $(HDF5P_LIBRARIES)
|
||||
CXXFLAGS += $(JANSSON_INCLUDES)
|
||||
LIBS += $(JANSSON_LIBRARIES)
|
||||
|
||||
CXXFLAGS += -g
|
||||
|
||||
ifeq ($(DO_DEBUGGING),true)
|
||||
CXXFLAGS += -ftemplate-depth-30 -g -DBZ_DEBUG
|
||||
CXXFLAGS += -ftemplate-depth-30 #-DBZ_DEBUG
|
||||
CXXFLAGS += -Ddebug
|
||||
CXXFLAGS += -Ddebug_level$(DEBUG_LEVEL)
|
||||
endif
|
||||
|
||||
# Catch2
|
||||
CXXFLAGS += $(CATCH_INCLUDES)
|
||||
|
||||
ifeq ($(USE_TIMER),true)
|
||||
CXXFLAGS += -DTIMER
|
||||
endif
|
||||
|
||||
CXXFLAGS_TEST = $(CXXFLAGS)
|
||||
|
||||
# Sources
|
||||
SRC_SUBDIRS = $(foreach sdir, $(SUB_DIRS), $(wildcard $(sdir)/*.cpp))
|
||||
@@ -68,20 +64,16 @@ SRC_SUBDIRS = $(foreach sdir, $(SUB_DIRS), $(wildcard $(sdir)/*.cpp))
|
||||
SOURCES = $(SRC_DIR)/main.cpp
|
||||
SOURCES += $(SRC_SUBDIRS)
|
||||
|
||||
SOURCES_TEST = $(wildcard $(TEST_DIR)/*.cpp) $(SRC_SUBDIRS)
|
||||
|
||||
# Objects
|
||||
OBJECTS=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES:.cpp=.o)) )
|
||||
OBJECTS_TEST=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES_TEST:.cpp=.o)) )
|
||||
|
||||
# Target
|
||||
# put the exe file in bin/
|
||||
TARGET=$(BIN_DIR)/karl
|
||||
TARGET_TEST=$(BIN_DIR)/karl_test
|
||||
|
||||
# Compile logic
|
||||
|
||||
all: blitz hdf5 jansson karl
|
||||
all: blitz jansson karl
|
||||
|
||||
check_homebase:
|
||||
ifeq ($(HOMEBASE),)
|
||||
@@ -99,12 +91,6 @@ endif
|
||||
blitz: check_homebase
|
||||
ifeq ($(MAKE_BLITZ), true)
|
||||
$(MAKE) -C external/blitz
|
||||
$(MAKE) -C external/blitz install
|
||||
endif
|
||||
|
||||
hdf5: check_homebase
|
||||
ifeq ($(MAKE_H5), true)
|
||||
$(MAKE) -C external/h5
|
||||
endif
|
||||
|
||||
jansson: check_homebase
|
||||
@@ -112,9 +98,7 @@ ifeq ($(MAKE_JANSSON), true)
|
||||
$(MAKE) -C external/jansson
|
||||
endif
|
||||
|
||||
|
||||
karl: check_abspath check_homebase $(TARGET)
|
||||
test: check_abspath check_homebase $(TARGET_TEST)
|
||||
|
||||
$(TARGET): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS)
|
||||
$(CXX) $(OBJECTS) $(LIBS) -o $(TARGET)
|
||||
@@ -122,12 +106,6 @@ $(TARGET): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS)
|
||||
@echo "Linking done"
|
||||
@echo
|
||||
|
||||
$(TARGET_TEST): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS_TEST)
|
||||
@echo "Start linking"
|
||||
$(CXX) $(OBJECTS_TEST) $(LIBS) -o $(TARGET_TEST)
|
||||
@echo
|
||||
@echo "Linking done"
|
||||
@echo
|
||||
|
||||
$(BIN_DIR):
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@@ -176,9 +154,6 @@ $(BUILD_DIR)/%.o : $(SRC_DIR)/tools/%.cpp
|
||||
@echo
|
||||
$(CXX) $(CXXFLAGS) $< -c -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o : $(TEST_DIR)/%.cpp
|
||||
@echo "Create $@ from $<"
|
||||
$(CXX) $(CXXFLAGS_TEST) $< -c -o $@
|
||||
|
||||
# All build instructions for all src cpp are put here
|
||||
$(BUILD_DIR)/main.o : $(SRC_DIR)/main.cpp
|
||||
@@ -189,4 +164,4 @@ clean:
|
||||
|
||||
clean_all: clean
|
||||
-$(MAKE) -C external/blitz clean
|
||||
|
||||
-$(MAKE) -C external/jansson clean
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"DriftVelocityExample1": {
|
||||
"DriftVelocity": {
|
||||
"VectorField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Product": {
|
||||
"fi": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fj": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
"DriftVelocityExample2": {
|
||||
"null": {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"EnergyDistributionFunctionExample1": {
|
||||
"MaxwellBoltzmann": {
|
||||
"Temperature": {
|
||||
"value": 80,
|
||||
"unit": "K"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnergyDistributionFunctionExample2": {
|
||||
"TritiumBetaDecay": {}
|
||||
},
|
||||
"EnergyDistributionFunctionExample3": {
|
||||
"Constant": {
|
||||
"constant": {
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +1,74 @@
|
||||
{
|
||||
"Functions": {
|
||||
"1Dto1D examples": {
|
||||
"f1": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
1.43,
|
||||
3,
|
||||
8,
|
||||
13,
|
||||
14.57,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
5E-4,
|
||||
0.002,
|
||||
0.02,
|
||||
1,
|
||||
0.02,
|
||||
0.002,
|
||||
5E-4
|
||||
],
|
||||
"prefactor": 1
|
||||
}
|
||||
},
|
||||
"f2": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"f3": {
|
||||
"Product": [
|
||||
{
|
||||
"Constant": {
|
||||
"constant": 2
|
||||
"Functions": {
|
||||
"1Dto1D examples": {
|
||||
"f1": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [0, 1.43, 3],
|
||||
"yValues": [5E-4, 0.002, 0.02],
|
||||
"prefactor": 1
|
||||
}
|
||||
},
|
||||
"f2": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"f3": {
|
||||
"Product": [
|
||||
{
|
||||
"Constant": {
|
||||
"constant": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"Constant": {
|
||||
"constant": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Constant": {
|
||||
"constant": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"f4": {
|
||||
"PiecewiseLinearFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "path/relative",
|
||||
"Filename": "data.h5"
|
||||
},
|
||||
"xValuesKey": "/xvalues",
|
||||
"yValuesKey": "/yvalues",
|
||||
"prefactor": 1
|
||||
}
|
||||
},
|
||||
"f5": {
|
||||
"PiecewiseLinearFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "AbsolutPath",
|
||||
"RelativePath": "/some/absolut/path",
|
||||
"Filename": "data.h5"
|
||||
},
|
||||
"xValuesKey": "/xvalues",
|
||||
"yValuesKey": "/yvalues",
|
||||
"prefactor": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"f4": {
|
||||
"PiecewiseLinearFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/velocityDistributions/T2_vz/KuckertPaper",
|
||||
"Filename": "T2_vz_vs_z_kuckert_approximated.h5"
|
||||
},
|
||||
"xValuesKey": "/z_position(m)",
|
||||
"yValuesKey": "/vz(ms)",
|
||||
"prefactor": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"3dto1D examples": {
|
||||
"f1": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
},
|
||||
"f2": {
|
||||
"Product": {
|
||||
"fi": {
|
||||
"Constant": {
|
||||
"constant": 2
|
||||
}
|
||||
},
|
||||
"fj": {
|
||||
"Constant": {
|
||||
"constant": 2
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
1.43,
|
||||
3,
|
||||
8,
|
||||
13,
|
||||
14.57,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
5E-4,
|
||||
0.002,
|
||||
0.02,
|
||||
1,
|
||||
0.02,
|
||||
0.002,
|
||||
5E-4
|
||||
],
|
||||
"prefactor": 1
|
||||
"3dto1D examples": {
|
||||
"f1": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
},
|
||||
"f2": {
|
||||
"Product": {
|
||||
"fi": { "Constant": {"constant": 2 }},
|
||||
"fj": { "Constant": {"constant": 2 }},
|
||||
"fk": { "PiecewiseLinear": {
|
||||
"xValues": [0, 1.43, 3],
|
||||
"yValues": [5E-4, 0.002, 0.02],
|
||||
"prefactor": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"e- standart interactions":
|
||||
"e- standard interactions":
|
||||
{
|
||||
"elastic_example1": {
|
||||
"Type": "ElasticScattering",
|
||||
@@ -145,12 +145,12 @@
|
||||
"Type": "FreeMovement"
|
||||
}
|
||||
},
|
||||
"T+ standart interactions": {
|
||||
"elasitc scattering": {
|
||||
"T+ standard interactions": {
|
||||
"elastic scattering": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "T2",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_elasitc_scattering_tabata"
|
||||
"PredefinedFunction": "TpT2_elastic_scattering_tabata"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
@@ -160,6 +160,7 @@
|
||||
"Type": "Clustering",
|
||||
"Target": "T2",
|
||||
"Product": "T3+",
|
||||
"ClusteringType": "radiative",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_radiative_ascendion_pasil"
|
||||
}
|
||||
@@ -168,6 +169,7 @@
|
||||
"Type": "Clustering",
|
||||
"Target": "T2",
|
||||
"Product": "T3+",
|
||||
"ClusteringType": "tertiary",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
|
||||
}
|
||||
@@ -176,7 +178,7 @@
|
||||
"Type": "FreeMovement"
|
||||
}
|
||||
},
|
||||
"T2+ standart interactions": {
|
||||
"T2+ standard interactions": {
|
||||
"charge exchange": {
|
||||
"Type": "ChargeExchange",
|
||||
"Target": "T2",
|
||||
@@ -188,6 +190,7 @@
|
||||
"Type": "Clustering",
|
||||
"Target": "T2",
|
||||
"Product": "T3+",
|
||||
"ClusteringType": "radiative",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "T2pT2_clustering_janev"
|
||||
}
|
||||
@@ -196,12 +199,12 @@
|
||||
"Type": "FreeMovement"
|
||||
}
|
||||
},
|
||||
"T3+ standart interactions":{
|
||||
"T3+ standard interactions":{
|
||||
"elastic scattering": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "T2",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "T3pT2_elasitc_scattering_tabata"
|
||||
"PredefinedFunction": "T3pT2_elastic_scattering_tabata"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"MoverExample1":{
|
||||
"Boris": {
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MoverExample2":{
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+134
-142
@@ -2,21 +2,21 @@
|
||||
"GlobalPositionBinning": {
|
||||
"CylinderBinning": {
|
||||
"Radial": {
|
||||
"NumberOfBins": 15,
|
||||
"NumberOfBins": 5,
|
||||
"MaxRadius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
}
|
||||
},
|
||||
"Longitudinal": {
|
||||
"NumberOfBins": 1657,
|
||||
"NumberOfBins": 166,
|
||||
"MaxLength": {
|
||||
"value": 1657,
|
||||
"unit": "cm"
|
||||
}
|
||||
},
|
||||
"Azimuthal": {
|
||||
"NumberOfBins": 4
|
||||
"NumberOfBins": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -56,11 +56,11 @@
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/densityDistributions/T2",
|
||||
"Filename": "T2_n_vs_z_kuckert_approximated.h5"
|
||||
"Filename": "T2_n_vs_z_kuckert_approximated_relative.h5"
|
||||
},
|
||||
"xValuesKey": "/z_position(m)",
|
||||
"yValuesKey": "/n(m3)",
|
||||
"prefactor": 1E20
|
||||
"prefactor": 6.337599E19
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,11 +125,10 @@
|
||||
"e-": {
|
||||
"ParticleType": "electron",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-12,
|
||||
"unit": "s"
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -210,7 +209,7 @@
|
||||
"CompositeAngleDistribution": {
|
||||
"LowerDistribution": {
|
||||
"Isotropic": {}
|
||||
},
|
||||
},
|
||||
"HigherDistribution": {
|
||||
"AngleDistributionFromFile": {
|
||||
"PathToH5": {
|
||||
@@ -348,18 +347,17 @@
|
||||
"T2+": {
|
||||
"ParticleType": "T2+",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"value": 10,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
@@ -428,6 +426,7 @@
|
||||
"clustering": {
|
||||
"Type": "Clustering",
|
||||
"Target": "TritiumGas",
|
||||
"ClusteringType": "radiative",
|
||||
"Product": "T3+",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "T2pT2_clustering_janev"
|
||||
@@ -441,122 +440,17 @@
|
||||
"T+": {
|
||||
"ParticleType": "T+",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 1657,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reflector": {
|
||||
"NoReflector": {}
|
||||
},
|
||||
"DensityField": {
|
||||
"DynamicDensityField": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
},
|
||||
"EnergyBinning": {
|
||||
"Type": "Logarithmic",
|
||||
"NumberOfBins": 100,
|
||||
"MinEnergy": {
|
||||
"value": 1E-6,
|
||||
"unit": "eV"
|
||||
},
|
||||
"MaxEnergy": {
|
||||
"value": 1E3,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"VelocityDistribution": {
|
||||
"null": {}
|
||||
},
|
||||
"DriftVelocity": {
|
||||
"null": {}
|
||||
},
|
||||
"Loggers": {
|
||||
"Deletion": {
|
||||
"Type": "all"
|
||||
}
|
||||
},
|
||||
"CurrentCollector": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Interactions": {
|
||||
"elasitc scattering": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "TritiumGas",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_elasitc_scattering_tabata"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
},
|
||||
"clustering1": {
|
||||
"Type": "Clustering",
|
||||
"Target": "TritiumGas",
|
||||
"Product": "T3+",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_radiative_ascendion_pasil"
|
||||
}
|
||||
},
|
||||
"clustering2": {
|
||||
"Type": "Clustering",
|
||||
"Target": "TritiumGas",
|
||||
"Product": "T3+",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
|
||||
}
|
||||
},
|
||||
"free_movement_example": {
|
||||
"Type": "FreeMovement"
|
||||
}
|
||||
}
|
||||
},
|
||||
"T3+": {
|
||||
"ParticleType": "T3+",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"value": 10,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
@@ -619,7 +513,112 @@
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "TritiumGas",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "T3pT2_elasitc_scattering_tabata"
|
||||
"PredefinedFunction": "TpT2_elastic_scattering_tabata"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
},
|
||||
"clustering1": {
|
||||
"Type": "Clustering",
|
||||
"Target": "TritiumGas",
|
||||
"ClusteringType": "radiative",
|
||||
"Product": "T3+",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_radiative_ascendion_pasil"
|
||||
}
|
||||
},
|
||||
"clustering2": {
|
||||
"Type": "Clustering",
|
||||
"Target": "TritiumGas",
|
||||
"ClusteringType": "tertiary",
|
||||
"Product": "T3+",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
|
||||
}
|
||||
},
|
||||
"free_movement_example": {
|
||||
"Type": "FreeMovement"
|
||||
}
|
||||
}
|
||||
},
|
||||
"T3+": {
|
||||
"ParticleType": "T3+",
|
||||
"Mover": {
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 10,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 1657,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reflector": {
|
||||
"NoReflector": {}
|
||||
},
|
||||
"DensityField": {
|
||||
"DynamicDensityField": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
},
|
||||
"EnergyBinning": {
|
||||
"Type": "Logarithmic",
|
||||
"NumberOfBins": 100,
|
||||
"MinEnergy": {
|
||||
"value": 1E-6,
|
||||
"unit": "eV"
|
||||
},
|
||||
"MaxEnergy": {
|
||||
"value": 1E3,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"VelocityDistribution": {
|
||||
"null": {}
|
||||
},
|
||||
"DriftVelocity": {
|
||||
"null": {}
|
||||
},
|
||||
"Loggers": {
|
||||
"Deletion": {
|
||||
"Type": "all"
|
||||
}
|
||||
},
|
||||
"CurrentCollector": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Interactions": {
|
||||
"elastic scattering": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "TritiumGas",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "T3pT2_elastic_scattering_tabata"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
@@ -694,7 +693,7 @@
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/densityDistributions/T2",
|
||||
"Filename": "T2_n_vs_z_kuckert_approximated.h5"
|
||||
"Filename": "T2_n_vs_z_kuckert_approximated_relative.h5"
|
||||
},
|
||||
"xValuesKey": "/z_position(m)",
|
||||
"yValuesKey": "/n(m3)",
|
||||
@@ -757,7 +756,7 @@
|
||||
}
|
||||
},
|
||||
"Activity": {
|
||||
"value": 1E15,
|
||||
"value": 3.7e9,
|
||||
"unit": "Bq"
|
||||
}
|
||||
},
|
||||
@@ -795,15 +794,8 @@
|
||||
"VectorField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"PiecewiseLinearFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/magneticField/Kassiopeia",
|
||||
"Filename": "B_vs_z_kassiopeia_approximated.h5"
|
||||
},
|
||||
"xValuesKey": "/z_position(m)",
|
||||
"yValuesKey": "/B(T)",
|
||||
"prefactor": 1
|
||||
"Constant3D": {
|
||||
"constant": 2.5
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -813,12 +805,12 @@
|
||||
"UseInSimulation": "false"
|
||||
},
|
||||
"Simulation": {
|
||||
"SimulatedEvents": 1000000,
|
||||
"EventStride": 10
|
||||
"SimulatedEvents": 10000000,
|
||||
"EventStride": 1000
|
||||
},
|
||||
"Output": {
|
||||
"folder": "output",
|
||||
"filename": "karl_output",
|
||||
"filename": "katrin",
|
||||
"DensityFields": {
|
||||
"Species": "all",
|
||||
"Intervall": 1,
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ReflectorExample1": {
|
||||
"Reflector": {
|
||||
"ReflectorDPS": {
|
||||
"position_z": {
|
||||
"value": 1657,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ReflectorExample2": {
|
||||
"Reflector": {
|
||||
"NoReflector": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"Example1": {
|
||||
"Reflector": {
|
||||
"NoReflector": {}
|
||||
}
|
||||
},
|
||||
"Example2": {
|
||||
"ReflectorDPS": {
|
||||
"position_z": {
|
||||
"value": 1600,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
{
|
||||
"ScalarFields": {
|
||||
"field1": {
|
||||
"ScalarFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
"ScalarFieldsExample1": {
|
||||
"ScalarFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"TerminatorExample1": {
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 1657,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"GlobalPositionBinning": {
|
||||
"CylinderBinning": {
|
||||
"Radial": {
|
||||
"NumberOfBins": 15,
|
||||
"NumberOfBins": 1,
|
||||
"MaxRadius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
},
|
||||
"Azimuthal": {
|
||||
"NumberOfBins": 4
|
||||
"NumberOfBins": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -55,23 +55,21 @@
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
1.43,
|
||||
3,
|
||||
8,
|
||||
13,
|
||||
14.57,
|
||||
7.4999,
|
||||
7.5,
|
||||
8.5,
|
||||
8.5001,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
5E-4,
|
||||
0.002,
|
||||
0.02,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0.02,
|
||||
0.002,
|
||||
5E-4
|
||||
1,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"prefactor": 1E20
|
||||
"prefactor": 1E22
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,20 +112,8 @@
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
7.99,
|
||||
8.01,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
-100,
|
||||
-100,
|
||||
100,
|
||||
100
|
||||
],
|
||||
"prefactor": 1
|
||||
"Constant": {
|
||||
"constant": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,122 +127,10 @@
|
||||
"e-": {
|
||||
"ParticleType": "electron",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-12,
|
||||
"unit": "s"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 4.5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 1600,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reflector": {
|
||||
"ReflectorDPS": {
|
||||
"position_z": {
|
||||
"value": 1600,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DensityField": {
|
||||
"DynamicDensityField": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
},
|
||||
"EnergyBinning": {
|
||||
"Type": "Logarithmic",
|
||||
"NumberOfBins": 100,
|
||||
"MinEnergy": {
|
||||
"value": 1E-6,
|
||||
"unit": "eV"
|
||||
},
|
||||
"MaxEnergy": {
|
||||
"value": 20E3,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"VelocityDistribution": {
|
||||
"null": {}
|
||||
},
|
||||
"DriftVelocity": {
|
||||
"null": {}
|
||||
},
|
||||
"Loggers": {
|
||||
"Deletion": {
|
||||
"Type": "all"
|
||||
}
|
||||
},
|
||||
"CurrentCollector": {
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Interactions": {
|
||||
"elastic": {
|
||||
"Type": "ElasticScattering",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "eT2_elastic_scattering_constant"
|
||||
},
|
||||
"Target": "TritiumGas",
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
},
|
||||
"janev_non_diss": {
|
||||
"Type": "ElectronIonization",
|
||||
"IonizationModel": "JanevNonDiss",
|
||||
"Target": "TritiumGas",
|
||||
"OutgoingElectron": "e-",
|
||||
"OutgoingIon": "T2+"
|
||||
},
|
||||
"janev_diss_to_ground": {
|
||||
"Type": "ElectronIonization",
|
||||
"IonizationModel": "JanevDissToGround",
|
||||
"Target": "TritiumGas",
|
||||
"OutgoingElectron": "e-",
|
||||
"OutgoingIon": "T+"
|
||||
},
|
||||
"janev_diss_to_first_excited": {
|
||||
"Type": "ElectronIonization",
|
||||
"IonizationModel": "JanevDissToFirstExcited",
|
||||
"Target": "TritiumGas",
|
||||
"OutgoingElectron": "e-",
|
||||
"OutgoingIon": "T+"
|
||||
}
|
||||
}
|
||||
},
|
||||
"T2+": {
|
||||
"ParticleType": "T2+",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -297,7 +171,7 @@
|
||||
"unit": "eV"
|
||||
},
|
||||
"MaxEnergy": {
|
||||
"value": 1E3,
|
||||
"value": 1E2,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
@@ -322,19 +196,32 @@
|
||||
}
|
||||
},
|
||||
"Interactions": {
|
||||
"name1": {
|
||||
"free": {
|
||||
"Type": "FreeMovement"
|
||||
},
|
||||
"elastic": {
|
||||
"Type": "ElasticScattering",
|
||||
"CrossSection": {
|
||||
"1dFunction": {
|
||||
"Constant": {
|
||||
"constant": 1.412E-19
|
||||
}
|
||||
}
|
||||
},
|
||||
"Target": "TritiumGas",
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"T+": {
|
||||
"ParticleType": "T+",
|
||||
"Mover": {
|
||||
"Boris": {
|
||||
"BorisStepsPerMovementCylce": 10,
|
||||
"MaximalTimestepLength": {
|
||||
"value": 1E-8,
|
||||
"unit": "s"
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 0.001,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -400,8 +287,22 @@
|
||||
}
|
||||
},
|
||||
"Interactions": {
|
||||
"name1": {
|
||||
"free": {
|
||||
"Type": "FreeMovement"
|
||||
},
|
||||
"elastic": {
|
||||
"Type": "ElasticScattering",
|
||||
"CrossSection": {
|
||||
"1dFunction": {
|
||||
"Constant": {
|
||||
"constant": 1.412E-19
|
||||
}
|
||||
}
|
||||
},
|
||||
"Target": "TritiumGas",
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,12 +315,24 @@
|
||||
"CreationVelocityDistribution": {
|
||||
"VelocityDistributionFromFunction": {
|
||||
"VelocityDistributionFunction": {
|
||||
"IsotropicDistribution": {
|
||||
"DirectedDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"TritiumBetaDecay": {}
|
||||
"Constant": {
|
||||
"constant": {
|
||||
"value": 8E-3,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "electron"
|
||||
},
|
||||
"Direction": {
|
||||
"vector": [
|
||||
0,
|
||||
0,
|
||||
-1
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,21 +340,28 @@
|
||||
}
|
||||
},
|
||||
"specie2": {
|
||||
"TrackedSpecieName": "T2+",
|
||||
"TrackedSpecieName": "T+",
|
||||
"CreationVelocityDistribution": {
|
||||
"VelocityDistributionFromFunction": {
|
||||
"VelocityDistributionFunction": {
|
||||
"IsotropicDistribution": {
|
||||
"DirectedDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"MaxwellBoltzmann": {
|
||||
"Temperature": {
|
||||
"value": 80,
|
||||
"unit": "K"
|
||||
"Constant": {
|
||||
"constant": {
|
||||
"value": 20E-2,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "T2"
|
||||
"FromParticleType": "T+"
|
||||
},
|
||||
"Direction": {
|
||||
"vector": [
|
||||
0,
|
||||
0,
|
||||
-1
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,26 +385,8 @@
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
1.43,
|
||||
3,
|
||||
8,
|
||||
13,
|
||||
14.57,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
5E-4,
|
||||
0.002,
|
||||
0.02,
|
||||
1,
|
||||
0.02,
|
||||
0.002,
|
||||
5E-4
|
||||
],
|
||||
"prefactor": 1E15
|
||||
"Constant": {
|
||||
"constant": 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -493,7 +395,7 @@
|
||||
},
|
||||
"DensityLimit": {
|
||||
"min": 0,
|
||||
"max": 1E15
|
||||
"max": 1
|
||||
},
|
||||
"PositionLimits": {
|
||||
"rPosition": {
|
||||
@@ -505,8 +407,8 @@
|
||||
"max": 6.28318530718
|
||||
},
|
||||
"zPosition": {
|
||||
"min": 0,
|
||||
"max": 16.0
|
||||
"min": 7.94,
|
||||
"max": 7.96
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -574,8 +476,8 @@
|
||||
"UseInSimulation": "false"
|
||||
},
|
||||
"Simulation": {
|
||||
"SimulatedEvents": 1,
|
||||
"EventStride": 1
|
||||
"SimulatedEvents": 100,
|
||||
"EventStride": 100
|
||||
},
|
||||
"Output": {
|
||||
"folder": "output",
|
||||
@@ -588,15 +490,13 @@
|
||||
"CurrentBorders": {
|
||||
"Species": [
|
||||
"e-",
|
||||
"T2+"
|
||||
"T+"
|
||||
],
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "true"
|
||||
},
|
||||
"DeletionLogger": {
|
||||
"Species": [
|
||||
"all"
|
||||
],
|
||||
"Species": "all",
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "true"
|
||||
}
|
||||
|
||||
@@ -1,45 +1,39 @@
|
||||
{
|
||||
"VectorFields": {
|
||||
"field1": {
|
||||
"VectorFieldConstant": {
|
||||
"Constant": {
|
||||
"vector": [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"field2": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"field3": {
|
||||
"VectorFieldFromArray": {
|
||||
"ReadArrayFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/velocity/distributions",
|
||||
"Filename": "drift_velocity.h5"
|
||||
},
|
||||
"Keys": [
|
||||
"/vr",
|
||||
"/vphi",
|
||||
"/vz"
|
||||
]
|
||||
},
|
||||
"Radius": 0.045,
|
||||
"Length": 16
|
||||
"VectorfieldExample1": {
|
||||
"VectorFieldConstant": {
|
||||
"constant": {
|
||||
"vector": [ 1, 2, 3]
|
||||
}
|
||||
}
|
||||
},
|
||||
"field4": {
|
||||
"VectorfieldExample2": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"VectorfieldExample3": {
|
||||
"VectorFieldFromArray": {
|
||||
"ReadArrayFromFile": {
|
||||
"PathToH5": {
|
||||
"Type": "RelativeToHomebase",
|
||||
"RelativePath": "data/velocity/distributions",
|
||||
"Filename": "drift_velocity.h5"
|
||||
},
|
||||
"Keys": [
|
||||
"/vr",
|
||||
"/vphi",
|
||||
"/vz"
|
||||
]
|
||||
},
|
||||
"Radius": 0.045,
|
||||
"Length": 16
|
||||
}
|
||||
},
|
||||
"VectorfieldExample4": {
|
||||
"VectorFieldFromArray": {
|
||||
"ReadArrayFromFile": {
|
||||
"PathToH5": {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"VelocityDistributionFunctionExample1": {
|
||||
"IsotropicDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"MaxwellBoltzmann": {
|
||||
"Temperature": {
|
||||
"value": 80,
|
||||
"unit": "K"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "T2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"VelocityDistributionFunctionExample2": {
|
||||
"DirectedDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"MaxwellBoltzmann": {
|
||||
"Temperature": {
|
||||
"value": 80,
|
||||
"unit": "K"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Direction": {
|
||||
"vector": [0,0,1]
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "T2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user