Compare commits
1
Commits
divB_mover
..
jrupp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
561131906b |
@@ -1 +0,0 @@
|
|||||||
.vscode
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
COMPILATION OF THE CODE:
|
|
||||||
|
|
||||||
The code requires a C++ compiler (e.g. gcc) and few external libraries (MPI,
|
|
||||||
HDF5, Jansson, Blitz++). All of them are available in Debian and are
|
|
||||||
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:
|
|
||||||
|
|
||||||
$ export HOMEBASE=$(pwd)
|
|
||||||
|
|
||||||
Then simply run
|
|
||||||
|
|
||||||
$ make
|
|
||||||
|
|
||||||
which should build and link all files to produce the binary file "bin/karl"
|
|
||||||
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.
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
build-essential
|
|
||||||
libopenmpi-dev
|
|
||||||
openmpi-bin
|
|
||||||
libhdf5-openmpi-dev
|
|
||||||
libblitz0-dev
|
|
||||||
libjansson-dev
|
|
||||||
pkg-config
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
#from asyncio import open_unix_connection
|
|
||||||
import numpy as np
|
|
||||||
import h5py as h5py
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import matplotlib
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import plot_standards as pst
|
|
||||||
|
|
||||||
|
|
||||||
def getSpecies(filename):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
return list(file.keys())
|
|
||||||
|
|
||||||
|
|
||||||
def outputPeriodKey(output_period):
|
|
||||||
if (output_period == "LastSyncPeriod"):
|
|
||||||
return "/LastSyncPeriod"
|
|
||||||
else:
|
|
||||||
return "/" + output_period
|
|
||||||
|
|
||||||
|
|
||||||
def mass(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_mass = path_to_species + "/Mass"
|
|
||||||
return np.array(file[path_to_mass])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def charge(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_charge = path_to_species + "/Charge"
|
|
||||||
return np.array(file[path_to_charge])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def zBinsDensityField(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_border = path_to_species + "/DensityField/BinBorders/longitudinal"
|
|
||||||
return np.array(file[path_to_border])
|
|
||||||
|
|
||||||
|
|
||||||
def energyBinsDensityfield(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_border = path_to_species + "/DensityField/BinBorders/energy"
|
|
||||||
return np.array(file[path_to_border])
|
|
||||||
|
|
||||||
|
|
||||||
def binVolumes(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_volumes = path_to_species + "/DensityField/BinVolumes"
|
|
||||||
return np.array(file[path_to_volumes])
|
|
||||||
|
|
||||||
|
|
||||||
def deletionsMaxInteractions(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path = path_to_species + "/DeletionLogger" + \
|
|
||||||
outputPeriodKey(output_period) + "/NumDeletions/MaxInteractions"
|
|
||||||
return np.array(file[path])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def deletionsMaxTimeAlive(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path = path_to_species + "/DeletionLogger" + \
|
|
||||||
outputPeriodKey(output_period) + "/NumDeletions/MaxTimeAlive"
|
|
||||||
return np.array(file[path])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def deletionsRecombination(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path = path_to_species + "/DeletionLogger" + \
|
|
||||||
outputPeriodKey(output_period) + "/NumDeletions/Recombination"
|
|
||||||
return np.array(file[path])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def deletionsWall(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path = path_to_species + "/DeletionLogger" + \
|
|
||||||
outputPeriodKey(output_period) + "/NumDeletions/Wall"
|
|
||||||
return np.array(file[path])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def timeInBin(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_time = path_to_species + "/DensityField/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/TimeInBin"
|
|
||||||
return np.array(file[path_to_time])
|
|
||||||
|
|
||||||
|
|
||||||
def physicalTime(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_time = path_to_species + "/DensityField/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/PhysicalTime"
|
|
||||||
return np.array(file[path_to_time])[0]
|
|
||||||
|
|
||||||
|
|
||||||
def spectrum(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_spectrum = path_to_species + "/DensityField/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/Spectrum"
|
|
||||||
return np.array(file[path_to_spectrum])
|
|
||||||
|
|
||||||
|
|
||||||
def density(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_density = path_to_species + "/DensityField/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/Density"
|
|
||||||
return np.array(file[path_to_density])
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalCurrent(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_current = path_to_species + "/CurrentCollector/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/CurrentInZ"
|
|
||||||
return np.array(file[path_to_current])
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalNegativeCrossings(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_current = path_to_species + "/CurrentCollector/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/NegativeCrossingsInZ"
|
|
||||||
return np.array(file[path_to_current])
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalPositiveCrossings(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_current = path_to_species + "/CurrentCollector/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/PositiveCrossingsInZ"
|
|
||||||
return np.array(file[path_to_current])
|
|
||||||
|
|
||||||
|
|
||||||
def radialCurrent(filename, path_to_species, output_period):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_current = path_to_species + "/CurrentCollector/SimulationData" + \
|
|
||||||
outputPeriodKey(output_period) + "/CurrentInR"
|
|
||||||
return np.array(file[path_to_current])
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalAreas(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_areas = path_to_species + "/CurrentCollector/AreaInZ"
|
|
||||||
return np.array(file[path_to_areas])
|
|
||||||
|
|
||||||
|
|
||||||
def radialAreas(filename, path_to_species):
|
|
||||||
file = h5py.File(filename, 'r')
|
|
||||||
path_to_areas = path_to_species + "/CurrentCollector/AreaInR"
|
|
||||||
return np.array(file[path_to_areas])
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalCurrentVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
|
|
||||||
areas_in_z = longitudinalAreas(filename, path_to_species)
|
|
||||||
current_in_z = longitudinalCurrent(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
particles = current_in_z * areas_in_z
|
|
||||||
return np.sum(particles, axis=(0, 1)) / np.sum(areas_in_z, axis=(0, 1))
|
|
||||||
|
|
||||||
|
|
||||||
def longitudinalNegativeCrossingsVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
|
|
||||||
areas_in_z = longitudinalAreas(filename, path_to_species)
|
|
||||||
current_in_z = longitudinalCurrent(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
particles = current_in_z * areas_in_z
|
|
||||||
return np.sum(particles, axis=(0, 1)) / np.sum(areas_in_z, axis=(0, 1))
|
|
||||||
|
|
||||||
|
|
||||||
def tubeCurrentVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
|
|
||||||
areas_in_r = radialAreas(filename, path_to_species)
|
|
||||||
current_in_r = radialCurrent(filename, path_to_species, output_period)
|
|
||||||
particles = current_in_r * areas_in_r
|
|
||||||
return (np.sum(particles, axis=(1)) / np.sum(areas_in_r, axis=(1)))[-2, :]
|
|
||||||
|
|
||||||
|
|
||||||
def densityVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
|
|
||||||
bin_volumes = binVolumes(filename, path_to_species)
|
|
||||||
densities = density(filename, path_to_species, output_period)
|
|
||||||
particles = densities*bin_volumes
|
|
||||||
return np.sum(particles, axis=(0, 1)) / np.sum(bin_volumes, axis=(0, 1))
|
|
||||||
|
|
||||||
|
|
||||||
def findClosestIndex(position, bin_borders):
|
|
||||||
return (np.abs(bin_borders - position)).argmin()
|
|
||||||
|
|
||||||
|
|
||||||
def spectrumAtZ(filename, path_to_species, z_position, output_period="LastSyncPeriod"):
|
|
||||||
bin_volumes = binVolumes(filename, path_to_species)
|
|
||||||
spectrums = spectrum(filename, path_to_species, output_period)
|
|
||||||
particles = spectrums
|
|
||||||
for i in np.arange(0, particles.shape[3]):
|
|
||||||
particles[:, :, :, i] = spectrums[:, :, :, i]*bin_volumes
|
|
||||||
z_index = findClosestIndex(
|
|
||||||
z_position, zBinsDensityField(filename, path_to_species))
|
|
||||||
volume = np.sum(bin_volumes, axis=(0, 1))[z_index]
|
|
||||||
return np.sum(particles, axis=(0, 1))[z_index, :]/volume
|
|
||||||
|
|
||||||
|
|
||||||
def makeBarPlotData(data, mins, maxs):
|
|
||||||
plot_bins = np.dstack((mins, maxs)).flatten()
|
|
||||||
plot_datas = np.dstack((data, data)).flatten()
|
|
||||||
return plot_bins, plot_datas
|
|
||||||
|
|
||||||
|
|
||||||
def plotSpectrumAtZ(filename, path_to_species, z_position, plot_axis, output_period="LastSyncPeriod"):
|
|
||||||
spectrum_at_z = spectrumAtZ(
|
|
||||||
filename, path_to_species, z_position, output_period)
|
|
||||||
E_bins = energyBinsDensityfield(filename, path_to_species)
|
|
||||||
plot_bins, plot_datas = makeBarPlotData(
|
|
||||||
spectrum_at_z[1:-1], E_bins[0:-1], E_bins[1:])
|
|
||||||
plot_axis.plot(plot_bins, plot_datas, label=str(path_to_species))
|
|
||||||
plot_axis.set_xscale("log")
|
|
||||||
plot_axis.set_yscale("log")
|
|
||||||
plot_axis.set_xlabel(r"Energy $E$ (eV)")
|
|
||||||
plot_axis.set_ylabel(
|
|
||||||
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):
|
|
||||||
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()
|
|
||||||
|
|
||||||
fig.savefig(output_folder +
|
|
||||||
"/spectrum_at_z={}_at_period={}.pdf".format(z_position, output_period))
|
|
||||||
|
|
||||||
|
|
||||||
def plotDensityVsZ(filename, path_to_species, plot_axis, output_period="LastSyncPeriod"):
|
|
||||||
density = densityVsZ(filename, path_to_species, output_period)
|
|
||||||
z_bins = zBinsDensityField(filename, path_to_species)
|
|
||||||
|
|
||||||
plot_bins, plot_datas = makeBarPlotData(
|
|
||||||
density[1:-1], z_bins[0:-1], z_bins[1:])
|
|
||||||
plot_axis.plot(plot_bins, plot_datas, label=str(path_to_species))
|
|
||||||
plot_axis.set_yscale("log")
|
|
||||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
|
||||||
plot_axis.set_ylabel(r"Density $n$ ($m^{-3}$)")
|
|
||||||
|
|
||||||
|
|
||||||
def plotAllDensityVsZ(filename, output_period, specie_keys, output_folder):
|
|
||||||
pst.setRcParams()
|
|
||||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
|
||||||
for key in specie_keys:
|
|
||||||
plotDensityVsZ(filename, key, ax, output_period)
|
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
|
||||||
ax.grid(color='white')
|
|
||||||
ax.legend()
|
|
||||||
fig.savefig(output_folder + "/density_vs_z_at_period={}.pdf".format(output_period),
|
|
||||||
format='pdf', bbox_inches='tight')
|
|
||||||
|
|
||||||
|
|
||||||
def plotLongitudinalParticleCurrentVsZ(filename, path_to_species, plot_axis, output_period="LastSyncPeriod"):
|
|
||||||
current_in_z = longitudinalCurrentVsZ(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
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}$)")
|
|
||||||
|
|
||||||
|
|
||||||
def plotAllLongitudinalParticleCurrentVsZ(filename, output_period, specie_keys, output_folder):
|
|
||||||
pst.setRcParams()
|
|
||||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
|
||||||
for key in specie_keys:
|
|
||||||
plotLongitudinalParticleCurrentVsZ(filename, key, ax, output_period)
|
|
||||||
|
|
||||||
ax.set_facecolor('#e7e7e7ff')
|
|
||||||
ax.grid(color='white')
|
|
||||||
ax.legend()
|
|
||||||
fig.savefig(output_folder + "/longitudinal_particle_current_vs_z_at_period={}.pdf".format(output_period),
|
|
||||||
format='pdf', bbox_inches='tight')
|
|
||||||
|
|
||||||
|
|
||||||
def plotLongitudinalElectricCurrentVsZ(filename, path_to_species, plot_axis, output_period="LastSyncPeriod"):
|
|
||||||
current_in_z = longitudinalCurrentVsZ(
|
|
||||||
filename, path_to_species, output_period)*charge(filename, path_to_species)
|
|
||||||
z_bins = zBinsDensityField(filename, path_to_species)
|
|
||||||
plot_axis.plot(z_bins, current_in_z)
|
|
||||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
|
||||||
plot_axis.set_ylabel(r"Electric current $I$ ($A$)")
|
|
||||||
|
|
||||||
|
|
||||||
def printDeletionLoggerStats(filename, path_to_species, output_period="LastSyncPeriod"):
|
|
||||||
max_interactions = deletionsMaxInteractions(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
max_time_alive = deletionsMaxTimeAlive(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
recombinations = deletionsRecombination(
|
|
||||||
filename, path_to_species, output_period)
|
|
||||||
wall = deletionsWall(filename, path_to_species, output_period)
|
|
||||||
|
|
||||||
print("Deletion Logger stats for: " + str(path_to_species))
|
|
||||||
print("MaxTimeAlive: {}".format(max_time_alive))
|
|
||||||
print("MaxInteractions: {}".format(max_interactions))
|
|
||||||
print("Recombinations: {}".format(recombinations))
|
|
||||||
print("Wall hits: {}".format(wall))
|
|
||||||
|
|
||||||
|
|
||||||
def printAllDeletionLoggerStats(filename, specie_keys, output_period):
|
|
||||||
for key in specie_keys:
|
|
||||||
printDeletionLoggerStats(filename, key, output_period)
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
import matplotlib
|
|
||||||
import matplotlib.colors as clr
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from cycler import cycler
|
|
||||||
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
|
|
||||||
|
|
||||||
|
|
||||||
def set_size(width, fraction=1, subplots=(1, 1)):
|
|
||||||
"""Set figure dimensions to avoid scaling in LaTeX.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
width: float or string
|
|
||||||
Document width in points, or string of predined document type
|
|
||||||
fraction: float, optional
|
|
||||||
Fraction of the width which you wish the figure to occupy
|
|
||||||
subplots: array-like, optional
|
|
||||||
The number of rows and columns of subplots.
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
fig_dim: tuple
|
|
||||||
Dimensions of figure in inches
|
|
||||||
"""
|
|
||||||
if width == 'thesis':
|
|
||||||
width_pt = 426.79135
|
|
||||||
elif width == 'beamer':
|
|
||||||
width_pt = 307.28987
|
|
||||||
else:
|
|
||||||
width_pt = width
|
|
||||||
|
|
||||||
# Width of figure (in pts)
|
|
||||||
fig_width_pt = width_pt * fraction
|
|
||||||
# Convert from pt to inches
|
|
||||||
inches_per_pt = 1 / 72.27
|
|
||||||
|
|
||||||
# Golden ratio to set aesthetic figure height
|
|
||||||
# https://disq.us/p/2940ij3
|
|
||||||
golden_ratio = (5**.5 - 1) / 2
|
|
||||||
|
|
||||||
# Figure width in inches
|
|
||||||
fig_width_in = fig_width_pt * inches_per_pt
|
|
||||||
# Figure height in inches
|
|
||||||
fig_height_in = fig_width_in * golden_ratio * (subplots[0] / subplots[1])
|
|
||||||
|
|
||||||
return (fig_width_in, fig_height_in)
|
|
||||||
|
|
||||||
|
|
||||||
def setRcParams():
|
|
||||||
#matplotlib.rcParams['text.usetex'] = True
|
|
||||||
#matplotlib.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}'
|
|
||||||
|
|
||||||
#matplotlib.rcParams['pcolor.shading'] = 'auto'
|
|
||||||
|
|
||||||
matplotlib.rcParams['font.family'] = "serif"
|
|
||||||
matplotlib.rcParams['font.size'] = 10
|
|
||||||
matplotlib.rcParams['axes.labelsize'] = 10
|
|
||||||
|
|
||||||
matplotlib.rcParams['legend.fontsize'] = 8
|
|
||||||
matplotlib.rcParams['xtick.labelsize'] = 8
|
|
||||||
matplotlib.rcParams['ytick.labelsize'] = 8
|
|
||||||
matplotlib.rcParams['figure.autolayout'] = True
|
|
||||||
matplotlib.rcParams['figure.titlesize'] = 4
|
|
||||||
matplotlib.rcParams['axes.titlesize'] = 4
|
|
||||||
matplotlib.rcParams['lines.markersize'] = 4
|
|
||||||
|
|
||||||
# matplotlib.rcParams['axes.facecolor'] = '#e7e7e7ff'
|
|
||||||
#matplotlib.rcParams['axes.grid'] = True
|
|
||||||
#matplotlib.rcParams['grid.color'] = 'white'
|
|
||||||
|
|
||||||
#matplotlib.rcParams['figure.dpi'] = 240
|
|
||||||
|
|
||||||
# lines for colorblind
|
|
||||||
colour_blind_cycle = ['#377eb8', '#ff7f00', '#4daf4a',
|
|
||||||
'#f781bf', '#a65628', '#984ea3',
|
|
||||||
'#999999', '#e41a1c', '#dede00']
|
|
||||||
matplotlib.rcParams['axes.prop_cycle'] = cycler(color=colour_blind_cycle)
|
|
||||||
|
|
||||||
# colorblind cmap
|
|
||||||
colorblind_diverging = ['#ca0020', '#f4a582',
|
|
||||||
'#f7f7f7', '#92c5de', '#0571b0']
|
|
||||||
Cmap_Name = "mymap"
|
|
||||||
try:
|
|
||||||
mymap = plt.get_cmap(name=Cmap_Name)
|
|
||||||
except:
|
|
||||||
mymap = LinearSegmentedColormap.from_list(
|
|
||||||
Cmap_Name, colorblind_diverging)
|
|
||||||
plt.register_cmap(name=Cmap_Name, cmap=mymap)
|
|
||||||
|
|
||||||
matplotlib.rcParams['image.cmap'] = Cmap_Name
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# Compiler
|
|
||||||
SCXX = g++
|
|
||||||
MPICXX = mpic++
|
|
||||||
|
|
||||||
COMPILER=$(MPICXX)
|
|
||||||
|
|
||||||
# Compiler Flags
|
|
||||||
COMPILER_FLAGS = -std=c++11 -O3 -march=native
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# Debugging
|
|
||||||
DO_DEBUGGING = true
|
|
||||||
DEBUG_LEVEL = 3
|
|
||||||
|
|
||||||
# Timer
|
|
||||||
USE_TIMER = true
|
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
BLITZ_INCLUDES = -I$(BLITZ_INC_DIR)
|
|
||||||
BLITZ_LIBS = -L$(BLITZ_LIB_DIR) -lblitz -lm
|
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
HDF5P_INCLUDES = -I$(HDF5P_INC_DIR)
|
|
||||||
HDF5P_LIBRARIES = -L$(HDF5P_LIB_DIR) -lz -lhdf5_hl -lhdf5
|
|
||||||
|
|
||||||
# Janson
|
|
||||||
MAKE_JANSSON = false
|
|
||||||
|
|
||||||
JANSON_DIR = $(HOMEBASE)/external/jansson/
|
|
||||||
JANSON_INC_DIR = $(JANSON_DIR)
|
|
||||||
JANSSON_LIBRARIES = -ljansson
|
|
||||||
JANSSON_INCLUDES = -I$(JANSON_INC_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
import numpy as np
|
|
||||||
import pandas as pd
|
|
||||||
import glob
|
|
||||||
import h5py as h5py
|
|
||||||
|
|
||||||
from os.path import basename
|
|
||||||
|
|
||||||
|
|
||||||
def readElsepaFilenames(folder):
|
|
||||||
data_files = glob.glob(folder + "*.dat")
|
|
||||||
elsepa_files = []
|
|
||||||
for file in data_files:
|
|
||||||
begin_filename = len(folder)
|
|
||||||
if file[begin_filename:begin_filename+3] == "dcs":
|
|
||||||
elsepa_files.append(file)
|
|
||||||
return elsepa_files
|
|
||||||
|
|
||||||
|
|
||||||
def createEnergyFromElsepaFilename(filename):
|
|
||||||
base_name = basename(filename)
|
|
||||||
return float(base_name[4] + "." + base_name[6:12])
|
|
||||||
|
|
||||||
|
|
||||||
def readEnergiesFromElsepaFilenames(filenames):
|
|
||||||
energies = []
|
|
||||||
for filename in filenames:
|
|
||||||
energies.append(createEnergyFromElsepaFilename(filename))
|
|
||||||
return np.sort(energies)
|
|
||||||
|
|
||||||
|
|
||||||
def readAnglesFromElsepaFile(filename):
|
|
||||||
namelist = ["theta", "mu", "sig_tot", "sig_totincoh", "Sherman"]
|
|
||||||
dataframe = pd.read_csv(filename, delim_whitespace=True,
|
|
||||||
header=None, skiprows=24, names=namelist)
|
|
||||||
return dataframe.theta/360*2*np.pi
|
|
||||||
|
|
||||||
|
|
||||||
def readCrossSectionFromElsepaFile(filename):
|
|
||||||
namelist = ["Theta", "Mu", "sig_tot", "sig_totincoh", "Sherman"]
|
|
||||||
dataframe = pd.read_csv(filename, delim_whitespace=True,
|
|
||||||
header=None, skiprows=24, names=namelist)
|
|
||||||
return dataframe.sig_tot*1E-4
|
|
||||||
|
|
||||||
|
|
||||||
def readAllCrossSectionsFromElsepa(filenames, energies, angles):
|
|
||||||
cross_sections = np.zeros(shape=(energies.size, angles.size))
|
|
||||||
|
|
||||||
for filename in filenames:
|
|
||||||
energy = createEnergyFromElsepaFilename(filename)
|
|
||||||
energy_index = np.where(energies == energy)
|
|
||||||
cross_sections[energy_index,
|
|
||||||
:] = readCrossSectionFromElsepaFile(filename)
|
|
||||||
return cross_sections
|
|
||||||
|
|
||||||
|
|
||||||
def writeData(energies, angles, cross_sections, output_filename):
|
|
||||||
file = h5py.File(output_filename, "w")
|
|
||||||
|
|
||||||
file.create_dataset("energies(eV)", data=energies)
|
|
||||||
file.create_dataset("angles(rad)", data=angles)
|
|
||||||
file.create_dataset("cross_sections(m-2)", data=cross_sections)
|
|
||||||
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
elsepa_folder = "./elsepa/simulation_output/"
|
|
||||||
output_filename = "./eT2_elastic_cross_section_scattering_angle.h5"
|
|
||||||
|
|
||||||
filenames = readElsepaFilenames(elsepa_folder)
|
|
||||||
angles = readAnglesFromElsepaFile(filenames[0])
|
|
||||||
energies = readEnergiesFromElsepaFilenames(filenames)
|
|
||||||
cross_sections = readAllCrossSectionsFromElsepa(
|
|
||||||
filenames, energies, angles)
|
|
||||||
|
|
||||||
writeData(energies, angles, cross_sections, output_filename)
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
import numpy as np
|
|
||||||
import scipy.optimize as optimization
|
|
||||||
import pandas as pd
|
|
||||||
import h5py as h5py
|
|
||||||
|
|
||||||
|
|
||||||
def readElsepaData(filename):
|
|
||||||
namelist = ["E", "sig_tot", "sig_1", "sig_2",
|
|
||||||
"sig_tot,corr", "sig_1,corr", "sig_2,corr"]
|
|
||||||
TCS_elsepa = pd.read_csv(
|
|
||||||
filename, delim_whitespace=True, header=None, skiprows=12, names=namelist)
|
|
||||||
TCS_elsepa = TCS_elsepa.iloc[:, 0:2]
|
|
||||||
TCS_elsepa.iloc[:, 1] = TCS_elsepa.iloc[:, 1]*1e-4
|
|
||||||
return TCS_elsepa
|
|
||||||
|
|
||||||
|
|
||||||
def readYoonData(filename):
|
|
||||||
namelist = ["E", "sig_tot"]
|
|
||||||
TCS_yoon = pd.read_csv(filename, sep='\t',
|
|
||||||
header=None, skiprows=3, names=namelist)
|
|
||||||
return TCS_yoon
|
|
||||||
|
|
||||||
|
|
||||||
def fitExpoential(data, upper_energy_limit=1):
|
|
||||||
data = data[data.E < upper_energy_limit]
|
|
||||||
# y = A * x^B
|
|
||||||
# return (A, B)
|
|
||||||
px = np.log10(data.E)
|
|
||||||
py = np.log10(data.sig_tot)
|
|
||||||
par = np.polyfit(px, py, 1)
|
|
||||||
|
|
||||||
def fitted_function(energy):
|
|
||||||
return 10**par[1] * (energy**par[0])
|
|
||||||
|
|
||||||
return fitted_function
|
|
||||||
|
|
||||||
|
|
||||||
def generateEnergies(max_energy):
|
|
||||||
energies = []
|
|
||||||
prefactor = np.array([1, 1.2, 1.4, 1.6, 1.8, 2., 2.5,
|
|
||||||
3., 3.5, 4., 5., 6., 7., 8., 9.])
|
|
||||||
for exponent in range(-5, 3):
|
|
||||||
for x in prefactor:
|
|
||||||
energies.append(x*10**exponent)
|
|
||||||
energies = np.array(energies)
|
|
||||||
energies = energies[energies < max_energy]
|
|
||||||
return energies
|
|
||||||
|
|
||||||
|
|
||||||
def generateCrossSections(energies, fit_function):
|
|
||||||
cross_sections = fit_function(energies)
|
|
||||||
dataframe = {'E': energies, 'sig_tot': cross_sections}
|
|
||||||
return pd.DataFrame(data=dataframe)
|
|
||||||
|
|
||||||
|
|
||||||
def generateConcatinatedTCS(elsepa_filename, yoon_filename):
|
|
||||||
TCS_elsepa = readElsepaData(elsepa_filename)
|
|
||||||
TCS_yoon = readYoonData(yoon_filename)
|
|
||||||
|
|
||||||
yoon_fit = fitExpoential(TCS_yoon, upper_energy_limit=1)
|
|
||||||
|
|
||||||
yoon_fit_energies = generateEnergies(TCS_yoon.E.min())
|
|
||||||
TCS_yoon_extrapolated = generateCrossSections(yoon_fit_energies, yoon_fit)
|
|
||||||
|
|
||||||
TCS_concat = TCS_yoon_extrapolated
|
|
||||||
TCS_concat = TCS_concat.append(TCS_yoon)
|
|
||||||
TCS_concat = TCS_concat.append(TCS_elsepa[TCS_elsepa.E > TCS_yoon.E.max()])
|
|
||||||
return TCS_concat
|
|
||||||
|
|
||||||
|
|
||||||
def writeTCSData(TCS_concat, output_filename):
|
|
||||||
file = h5py.File(output_filename, "w")
|
|
||||||
|
|
||||||
file.create_dataset("energies(eV)", data=TCS_concat.E)
|
|
||||||
file.create_dataset("cross_sections(m-2)", data=TCS_concat.sig_tot)
|
|
||||||
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
elsepa_filename = "./elsepa/simulation_output/tcstable.dat"
|
|
||||||
yoon_filename = "./yoon/yoon_TCS_elastic.dat"
|
|
||||||
output_filename = "./eT2_elastic_cross_section_total.h5"
|
|
||||||
|
|
||||||
TCS_concat = generateConcatinatedTCS(elsepa_filename, yoon_filename)
|
|
||||||
writeTCSData(TCS_concat, output_filename)
|
|
||||||
BIN
Binary file not shown.
Binary file not shown.
@@ -1,58 +0,0 @@
|
|||||||
import numpy as np
|
|
||||||
import h5py as h5py
|
|
||||||
import pandas as pd
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
|
|
||||||
def writeData(data, output_filename):
|
|
||||||
file = h5py.File(output_filename, "w")
|
|
||||||
|
|
||||||
file.create_dataset("z_position(m)", data=data[:, 0])
|
|
||||||
file.create_dataset("n(m3)", data=data[:, 1])
|
|
||||||
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def createApproximateDensity():
|
|
||||||
# katrin z position, n (approximate from Kuckert)
|
|
||||||
# "Modelling of gas dynamical properties of the KATRIN tritium source and
|
|
||||||
# implications for the neutrino mass measurement"
|
|
||||||
# Laura Kuckert, Florian Heizmann, Guido Drexlin, Ferenc Glück,
|
|
||||||
# Markus Hötzel, Marco Kleesiek, Felix Sharipov, Kathrin Valerius
|
|
||||||
|
|
||||||
data = [[-828.5, 2.698571014239288e+17]] # RW
|
|
||||||
# first pumpport left side
|
|
||||||
data = np.vstack([data, [-672.95, 1.0599125362642563e+18]])
|
|
||||||
data = np.vstack([data, [-645.55, 1.186476080774995e+18]]
|
|
||||||
) # first pumpport right side
|
|
||||||
# second pumpport left side
|
|
||||||
data = np.vstack([data, [-529.45, 1.1388358318927706e+19]])
|
|
||||||
# second pumpport right side
|
|
||||||
data = np.vstack([data, [-502.05, 1.6069200896901196e+19]])
|
|
||||||
data = np.vstack([data, [0, 6.382773464569297e+20]]) # Inlet
|
|
||||||
|
|
||||||
# mirrored on the other side
|
|
||||||
data = np.vstack([data, [828.5, 2.698571014239288e+17]]) # DPS
|
|
||||||
data = np.vstack([data, [672.95, 1.0599125362642563e+18]]
|
|
||||||
) # third pumpport left side
|
|
||||||
data = np.vstack([data, [645.55, 1.186476080774995e+18]]
|
|
||||||
) # third pumpport right side
|
|
||||||
data = np.vstack([data, [529.45, 1.1388358318927706e+19]]
|
|
||||||
) # fourth pumpport left side
|
|
||||||
data = np.vstack([data, [502.05, 1.6069200896901196e+19]]
|
|
||||||
) # fourth pumpport right side
|
|
||||||
|
|
||||||
z_rw = -828.5
|
|
||||||
|
|
||||||
data[:, 0] += np.abs(z_rw)
|
|
||||||
data[:, 0] /= 100
|
|
||||||
data[:, 1] /= 6.382773464569297e+20
|
|
||||||
|
|
||||||
data = data[data[:, 0].argsort()]
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
output_filename = "./T2_n_vs_z_kuckert_approximated_relative.h5"
|
|
||||||
writeData(createApproximateDensity(), output_filename)
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
|||||||
import numpy as np
|
|
||||||
import h5py as h5py
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
def writeData(data, output_filename):
|
|
||||||
file = h5py.File(output_filename, "w")
|
|
||||||
|
|
||||||
file.create_dataset("z_position(m)", data=data[:, 0])
|
|
||||||
file.create_dataset("B(T)", data=data[:, 1])
|
|
||||||
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def createApproximateMagneticField(filename_z_position, filename_B_field):
|
|
||||||
z = np.genfromtxt(filename_z_position, dtype=float,
|
|
||||||
delimiter=",", usecols=(0))
|
|
||||||
Bz = np.genfromtxt(filename_B_field, dtype=float,
|
|
||||||
delimiter=",", usecols=(0))
|
|
||||||
|
|
||||||
Bz *= -1
|
|
||||||
|
|
||||||
deltaz = 500 # use only every 500th datapoint
|
|
||||||
position_rw = 47.2
|
|
||||||
z_data = z[0::deltaz] + position_rw
|
|
||||||
Bz_data = Bz[0::deltaz]
|
|
||||||
|
|
||||||
Bz_data = Bz_data[z_data > 0]
|
|
||||||
z_data = z_data[z_data > 0]
|
|
||||||
|
|
||||||
data = np.column_stack((z_data, Bz_data))
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
output_filename = "./B_vs_z_kassiopeia_approximated.h5"
|
|
||||||
filename_z_position = "./z_positions.dat"
|
|
||||||
filename_B_field = "./Bz.dat"
|
|
||||||
writeData(createApproximateMagneticField(
|
|
||||||
filename_z_position, filename_B_field), output_filename)
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,64 +0,0 @@
|
|||||||
import numpy as np
|
|
||||||
import h5py as h5py
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
def writeData(data, output_filename):
|
|
||||||
file = h5py.File(output_filename, "w")
|
|
||||||
|
|
||||||
file.create_dataset("z_position(m)", data=data[:, 0])
|
|
||||||
file.create_dataset("vz(ms)", data=data[:, 1])
|
|
||||||
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def createApproximateVelocity():
|
|
||||||
# katrin z position, vz (approximate from Kuckert)
|
|
||||||
# "Modelling of gas dynamical properties of the KATRIN tritium source and
|
|
||||||
# implications for the neutrino mass measurement"
|
|
||||||
# Laura Kuckert, Florian Heizmann, Guido Drexlin, Ferenc Glück,
|
|
||||||
# Markus Hötzel, Marco Kleesiek, Felix Sharipov, Kathrin Valeriusa
|
|
||||||
|
|
||||||
data = [[-828.5, -5]] # RW
|
|
||||||
data = np.vstack([data, [-672.95, 0]]) # first pumpport left side
|
|
||||||
data = np.vstack([data, [-645.55, -100]]) # first pumpport right side
|
|
||||||
data = np.vstack([data, [-529.45, -5]]) # second pumpport left side
|
|
||||||
data = np.vstack([data, [-502.05, -100]]) # second pumpport right side
|
|
||||||
data = np.vstack([data, [-475, -71.32]])
|
|
||||||
data = np.vstack([data, [-450, -40.47]])
|
|
||||||
data = np.vstack([data, [-425, -29.75]])
|
|
||||||
data = np.vstack([data, [-400, -24.35]])
|
|
||||||
data = np.vstack([data, [-300, -15.680]])
|
|
||||||
data = np.vstack([data, [-200, -12.36]])
|
|
||||||
data = np.vstack([data, [-100, -10.5069]])
|
|
||||||
data = np.vstack([data, [-10, -9.2]])
|
|
||||||
data = np.vstack([data, [0, 0]]) # Inlet
|
|
||||||
|
|
||||||
# mirrored on the other side
|
|
||||||
data = np.vstack([data, [828.5, 5]]) # RW
|
|
||||||
data = np.vstack([data, [672.95, 0]]) # first pumpport left side
|
|
||||||
data = np.vstack([data, [645.55, 100]]) # first pumpport right side
|
|
||||||
data = np.vstack([data, [529.45, 5]]) # second pumpport left side
|
|
||||||
data = np.vstack([data, [502.05, 100]]) # second pumpport right side
|
|
||||||
data = np.vstack([data, [475, 71.32]])
|
|
||||||
data = np.vstack([data, [450, 40.47]])
|
|
||||||
data = np.vstack([data, [425, 29.75]])
|
|
||||||
data = np.vstack([data, [400, 24.35]])
|
|
||||||
data = np.vstack([data, [300, 15.680]])
|
|
||||||
data = np.vstack([data, [200, 12.36]])
|
|
||||||
data = np.vstack([data, [100, 10.5069]])
|
|
||||||
data = np.vstack([data, [10, 9.2]])
|
|
||||||
|
|
||||||
z_rw = -828.5
|
|
||||||
|
|
||||||
data[:, 0] += np.abs(z_rw)
|
|
||||||
data[:, 0] /= 100
|
|
||||||
|
|
||||||
data = data[data[:, 0].argsort()]
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
output_filename = "./T2_vz_vs_z_kuckert_approximated.h5"
|
|
||||||
writeData(createApproximateVelocity(), output_filename)
|
|
||||||
File diff suppressed because it is too large
Load Diff
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
dummy: all
|
|
||||||
# Auf Solaris muss blitz mit dem Sun Studio Compiler gebaut werden
|
|
||||||
# der ist zwar scheisse, funktioniert mit blitz aber. :)
|
|
||||||
ZIP = tar
|
|
||||||
|
|
||||||
|
|
||||||
NAME_TAR = blitz-1.0.2.tar.gz
|
|
||||||
NAME = blitz-1.0.2
|
|
||||||
|
|
||||||
BLITZ_FOLDER=/external/blitz/
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(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) && $(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
|
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
-24
@@ -1,24 +0,0 @@
|
|||||||
dummy: all
|
|
||||||
# Auf Solaris muss blitz mit dem Sun Studio Compiler gebaut werden
|
|
||||||
# der ist zwar scheisse, funktioniert mit blitz aber. :)
|
|
||||||
ZIP = tar
|
|
||||||
|
|
||||||
|
|
||||||
NAME_TAR = jansson-2.13.tar.gz
|
|
||||||
NAME = jansson-2.13
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -rf $(HOMEBASE)$(JANSSON_FOLDER)$(NAME)
|
|
||||||
-rm -rf $(HOMEBASE)$(JANSSON_FOLDER)build
|
|
||||||
Vendored
BIN
Binary file not shown.
@@ -1,20 +0,0 @@
|
|||||||
#ifndef HDF5_READER_H
|
|
||||||
#define HDF5_READER_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
class Hdf5Reader {
|
|
||||||
public:
|
|
||||||
Hdf5Reader(std::string directory, std::string filename);
|
|
||||||
Hdf5Reader(std::string absolute_filename);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> readD3Double(std::string path);
|
|
||||||
blitz::Array<double, 2> readD2Double(std::string path);
|
|
||||||
blitz::Array<double, 1> readD1Double(std::string path);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string absolute_filename_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* HDF5_READER_H */
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef HDF5_WRITER_H
|
|
||||||
#define HDF5_WRITER_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
class Hdf5Writer {
|
|
||||||
public:
|
|
||||||
Hdf5Writer(std::string directory = "./output",
|
|
||||||
std::string filename = "output");
|
|
||||||
|
|
||||||
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);
|
|
||||||
void write(const blitz::Array<double, 4>& data, std::string path);
|
|
||||||
void write(const blitz::Array<long int, 4>& data, std::string path);
|
|
||||||
void write(const blitz::TinyVector<double, 3>& data, std::string path);
|
|
||||||
void write(const blitz::TinyVector<int, 3>& data, std::string path);
|
|
||||||
void write(const std::vector<double>& data, std::string path);
|
|
||||||
void write(int data, std::string path);
|
|
||||||
void write(long int data, std::string path);
|
|
||||||
void write(double data, std::string path);
|
|
||||||
void write(const std::string& data, std::string path);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string absolute_filename_;
|
|
||||||
void createFolder(std::string directory);
|
|
||||||
void createFile(std::string absolute_filename);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* HDF5_WRITER_H */
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
#ifndef SIMULATION_OUTPUT_H
|
|
||||||
#define SIMULATION_OUTPUT_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "IO/hdf5_writer.h"
|
|
||||||
|
|
||||||
class DynamicDensityField;
|
|
||||||
class CurrentBorder;
|
|
||||||
class Parameter;
|
|
||||||
class CurrentCollector;
|
|
||||||
class DeletionLogger;
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class TrackedSpecie;
|
|
||||||
enum class ImplementedSpecies;
|
|
||||||
}; // namespace species
|
|
||||||
|
|
||||||
struct OutputTask {
|
|
||||||
std::string specie_name;
|
|
||||||
bool overwrite_last;
|
|
||||||
int intervall;
|
|
||||||
// selector if each or only first cpu should write can be added here
|
|
||||||
};
|
|
||||||
|
|
||||||
class SimulationOutput {
|
|
||||||
public:
|
|
||||||
SimulationOutput(const std::string& output_folder,
|
|
||||||
const std::string& output_filename);
|
|
||||||
|
|
||||||
void addDensityFieldOutput(OutputTask task);
|
|
||||||
void addCurrentBorderOutput(OutputTask task);
|
|
||||||
void addDeletionLoggerOutput(OutputTask task);
|
|
||||||
|
|
||||||
void writeMetaData(
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species);
|
|
||||||
|
|
||||||
void writeSimulationData(
|
|
||||||
int cpu_sync,
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<OutputTask> tasks_density_fields_;
|
|
||||||
std::vector<OutputTask> tasks_current_collector_;
|
|
||||||
std::vector<OutputTask> tasks_deletion_logger_;
|
|
||||||
|
|
||||||
Hdf5Writer writer;
|
|
||||||
|
|
||||||
void writeSimulationData(DynamicDensityField* density_field,
|
|
||||||
std::string species_path,
|
|
||||||
int cpu_sync,
|
|
||||||
bool overwrite_last);
|
|
||||||
|
|
||||||
void writeSpectrum(DynamicDensityField* density_field, std::string path);
|
|
||||||
void writeDensity(DynamicDensityField* density_field, std::string path);
|
|
||||||
void writeTimeInBin(DynamicDensityField* density_field, std::string path);
|
|
||||||
void writeDeletedParticles(DynamicDensityField* density_field,
|
|
||||||
std::string path);
|
|
||||||
void writePhysicalTime(DynamicDensityField* density_field, std::string path);
|
|
||||||
|
|
||||||
void writeSimulationData(CurrentCollector* current_collector,
|
|
||||||
std::string species_path,
|
|
||||||
int cpu_sync,
|
|
||||||
bool overwrite_last);
|
|
||||||
void writeCurrentCrossings(CurrentCollector* current_collector,
|
|
||||||
std::string path);
|
|
||||||
void writeCurrent(CurrentCollector* current_collector, std::string path);
|
|
||||||
void writePhysicalTime(CurrentCollector* current_collector, std::string path);
|
|
||||||
|
|
||||||
void writeSimulationData(DeletionLogger* logger,
|
|
||||||
std::string species_path,
|
|
||||||
int cpu_sync,
|
|
||||||
bool overwrite_last);
|
|
||||||
void writeNumDeletions(DeletionLogger* logger, std::string path);
|
|
||||||
|
|
||||||
void writeMetaData(species::TrackedSpecie* specie);
|
|
||||||
void writeMetaData(DynamicDensityField* density_field, std::string path);
|
|
||||||
void writeMetaData(CurrentCollector* current_collector, std::string path);
|
|
||||||
// void writeParameterFile(Parameter* parameter);
|
|
||||||
|
|
||||||
void writeCollectorAreas(CurrentCollector* current_collector,
|
|
||||||
std::string path);
|
|
||||||
|
|
||||||
void writeBinVolumes(DynamicDensityField* density_field,
|
|
||||||
std::string path_to_field);
|
|
||||||
void writeNumBins(DynamicDensityField* density_field,
|
|
||||||
std::string path_to_field);
|
|
||||||
void writeBinBorders(DynamicDensityField* density_field,
|
|
||||||
std::string path_to_field);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SIMULATION_OUTPUT_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef T2_BETA_DECAY_H
|
|
||||||
#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
|
|
||||||
static const double spectrum_maximum = 1.5E-28;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* T2_BETA_DECAY_H */
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef IONIZATION_CONSTANTS_H
|
|
||||||
#define IONIZATION_CONSTANTS_H
|
|
||||||
|
|
||||||
namespace ionization {
|
|
||||||
static const double ionization_energy_janev_non_diss = 15.42; // (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
|
|
||||||
|
|
||||||
#endif /* IONIZATION_CONSTANTS_H */
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
#ifndef PHYSICAL_CONSTANTS_H
|
|
||||||
#define PHYSICAL_CONSTANTS_H
|
|
||||||
|
|
||||||
// The default is (Gaussian) CGS units
|
|
||||||
namespace CGS {
|
|
||||||
static const double me = 9.1094e-28; // Electron mass (g)
|
|
||||||
static const double mp = 1.6726231e-24; // Proton mass (g)
|
|
||||||
static const double mpi0 = 2.406175207e-25; // Mass of uncharged pion (g)
|
|
||||||
static const double e = 4.8032068e-10; // Elementary charge (statcoulomb)
|
|
||||||
static const double c = 29979245800.; // Speed of light (cm/s)
|
|
||||||
static const double eps0 = 1; // Permitivity of vacuum
|
|
||||||
static const double mu0 = 1; // Permeability of vacuum
|
|
||||||
static const double thomcs = 6.65245e-25; // Thomson cross section (cm^2)
|
|
||||||
static const double h = 6.6260755e-27; // Planck constant (erg sec)
|
|
||||||
static const double hbar =
|
|
||||||
1.054572669e-27; // reduced Planck constant (erg sec)
|
|
||||||
static const double k = 1.380658e-16; // Boltzmann constant (erg / K)
|
|
||||||
static const double r0 =
|
|
||||||
2.8179e-13; // Classical electron radius / Thomson scattering length (cm)
|
|
||||||
static const double G = 6.67428e-8; // Gravitational constant cm^3/(g sec^2)
|
|
||||||
|
|
||||||
}; // namespace CGS
|
|
||||||
|
|
||||||
// Constants in SI
|
|
||||||
namespace SI {
|
|
||||||
static const double me = 9.1094e-31; // Electron mass (kg)
|
|
||||||
static const double mp = 1.6726e-27; // Proton mass (kg)
|
|
||||||
static const double mpi0 = 2.406176e-28; // Mass of uncharged pion (kg)
|
|
||||||
static const double e = 1.6022e-19; // Elementary charge (C)
|
|
||||||
static const double c = 299792458.; // Speed of light (m/s)
|
|
||||||
static const double eps0 = 8.854187817620e-12; // Permitivity of vacuum (F / m)
|
|
||||||
static const double mu0 = 1.2566370614e-6; // Permeability of vacuum (H / m)
|
|
||||||
static const double thomcs = 6.65245e-29; // Thomson cross section (m^2)
|
|
||||||
static const double h = 6.6260755e-34; // Planck constant (J s)
|
|
||||||
static const double hbar = 1.054572669e-34; // reduced Planck constant (J s)
|
|
||||||
static const double k = 1.380658e-23; // Boltzmann constant (J / K)
|
|
||||||
static const double r0 =
|
|
||||||
2.8179e-15; // Classical electron radius / Thomson scattering length (m)
|
|
||||||
static const double G = 6.67428e-11; // Gravitational constant m^3/(kg s^2)
|
|
||||||
static const double u = 1.66053906660E-27; // atomic mass unit (kg)
|
|
||||||
}; // namespace SI
|
|
||||||
|
|
||||||
// Natural Units with e = c = k = me = 1 (Stoney units)
|
|
||||||
namespace Naturalunits {
|
|
||||||
static const double me = 1; // Electron mass
|
|
||||||
static const double mp = 1836.15; // Proton mass
|
|
||||||
static const double mpi0 = 264.14; // Mass of uncharged pion
|
|
||||||
static const double e = 1; // Elementary charge
|
|
||||||
static const double c = 1; // Speed of light
|
|
||||||
static const double eps0 = .07957747154594766788; // Permitivity of vacuum
|
|
||||||
static const double mu0 = 12.56637061435917295376; // Permeability of vacuum
|
|
||||||
static const double thomcs = 3.488e43; // Thomson cross section
|
|
||||||
static const double h = 861.022579738; // Planck constant
|
|
||||||
static const double hbar = 137.035999679; // reduced Planck constant
|
|
||||||
static const double k = 1; // Boltzmann constant
|
|
||||||
static const double r0 = 2.0405e21; // Classical electron radius
|
|
||||||
static const double G = 1; // Gravitational constant
|
|
||||||
|
|
||||||
// l = e^2 / c^2 me
|
|
||||||
// t = e^2 / c^3 me
|
|
||||||
// T = = me c^2 / k
|
|
||||||
}; // namespace Naturalunits
|
|
||||||
|
|
||||||
namespace HEPunits {
|
|
||||||
static const double me = 511e3; // Electron mass (eV)
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace UnitConversion {
|
|
||||||
const double JouleToeV = 1. / SI::e;
|
|
||||||
const double eVToJoule = SI::e;
|
|
||||||
const double KToeV = 8.61732814974056E-05;
|
|
||||||
}; // namespace UnitConversion
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#ifndef SIM_CONSTANTS_H
|
|
||||||
#define SIM_CONSTANTS_H
|
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace SimConstants {
|
|
||||||
static const double minimal_cross_section =
|
|
||||||
std::numeric_limits<double>::min() * 1E5;
|
|
||||||
static const double minimal_macroscopic_cross_section =
|
|
||||||
std::numeric_limits<double>::min() * 1E5;
|
|
||||||
static const double random_lower_limit = 1E-15;
|
|
||||||
static const double compare_epsilon = 1E-10;
|
|
||||||
|
|
||||||
} // namespace SimConstants
|
|
||||||
|
|
||||||
#endif /* SIM_CONSTANTS_H */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#ifndef FUNCTIONS_H
|
|
||||||
#define FUNCTIONS_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace D1ToD1 {
|
|
||||||
std::function<double(double)> PiecewiseLinear(std::vector<double> positions,
|
|
||||||
std::vector<double> values);
|
|
||||||
|
|
||||||
std::function<double(double)> Constant(double constant);
|
|
||||||
|
|
||||||
std::function<double(double)> Product(
|
|
||||||
std::vector<std::function<double(double)>> functions);
|
|
||||||
}; // namespace D1ToD1
|
|
||||||
|
|
||||||
namespace D3ToD1 {
|
|
||||||
std::function<double(double, double, double)> Constant(double value);
|
|
||||||
|
|
||||||
std::function<double(double, double, double)> Product(
|
|
||||||
std::function<double(double)> fi,
|
|
||||||
std::function<double(double)> fj,
|
|
||||||
std::function<double(double)> fk);
|
|
||||||
|
|
||||||
}; // namespace D3ToD1
|
|
||||||
|
|
||||||
#endif /* FUNCTIONS_H */
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef BINNING_GENERATOR_H
|
|
||||||
#define BINNING_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "blitz/array.h"
|
|
||||||
#include "simulation/energy_binning.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/position_binning.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
CylinderBinning buildPositionBinning(json_t* object);
|
|
||||||
CylinderBinning buildPositionBinningIncludingRedirection(
|
|
||||||
Parameter& parameter,
|
|
||||||
json_path& path_to_binning);
|
|
||||||
|
|
||||||
EnergyBinning buildEnergyBinning(json_t* object);
|
|
||||||
EnergyBinning buildEnergyBinningIncludingRedirection(
|
|
||||||
Parameter& parameter,
|
|
||||||
json_path& path_to_binning);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* BINNING_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef CURRENT_COLLECTOR_GENERATOR_H
|
|
||||||
#define CURRENT_COLLECTOR_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/current_collector.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/timer.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
std::shared_ptr<CurrentCollector> buildCurrentCollector(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_collector,
|
|
||||||
std::shared_ptr<Timer>& timer);
|
|
||||||
};
|
|
||||||
#endif /* CURRENT_COLLECTOR_GENERATOR_H */
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#ifndef DENSITY_FIELD_GENERATOR_H
|
|
||||||
#define DENSITY_FIELD_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/density_field.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/timer.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<ConstantDensityField> buildConstantDensityField(json_t* object);
|
|
||||||
|
|
||||||
std::shared_ptr<DynamicDensityField> buildDynamicDensityField(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_field,
|
|
||||||
std::shared_ptr<Timer>& timer);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* DENSITY_FIELD_GENERATOR_H */
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#ifndef DRIFT_VELOCITY_GENERATOR_H
|
|
||||||
#define DRIFT_VELOCITY_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/drift_velocity.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<DriftVelocity> buildDriftVelocity(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_drift_velocity);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* DRIFT_VELOCITY_GENERATOR_H */
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef ELECTRIC_FIELD_GENERATOR_H
|
|
||||||
#define ELECTRIC_FIELD_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/electromagnetic_field.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<ElectricField> electricField(json_t* object);
|
|
||||||
|
|
||||||
std::shared_ptr<ElectricField> electricField(Parameter& parameter);
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* ELECTRIC_FIELD_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H
|
|
||||||
#define ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/energy_distribution.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_function);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H */
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef FUNCTION_GENERATOR_H
|
|
||||||
#define FUNCTION_GENERATOR_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "functions/functions.h"
|
|
||||||
#include "jansson.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::function<double(double)> function1D(json_t* object);
|
|
||||||
std::function<double(double, double, double)> function3D(json_t* object);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* FUNCTION_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef GEOMETRY_GENERATOR_H
|
|
||||||
#define GEOMETRY_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/geometry.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
|
|
||||||
const json_path& path_to_geometry);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* GEOMETRY_GENERATOR_H */
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef INJECTOR_GENERATOR_H
|
|
||||||
#define INJECTOR_GENERATOR_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include "simulation/injector.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/species.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<Injector> buildInjector(
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
|
||||||
tracked_species,
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
|
|
||||||
background_species,
|
|
||||||
Parameter& parameter);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* INJECTOR_GENERATOR_H */
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#ifndef INTERACTION_GENERATOR_H
|
|
||||||
#define INTERACTION_GENERATOR_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/scattering_angle_distribution.h"
|
|
||||||
#include "simulation/species.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
void addInteractions(
|
|
||||||
std::shared_ptr<species::TrackedSpecie> specie,
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
|
||||||
tracked_species,
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
|
|
||||||
background_species,
|
|
||||||
Parameter& parameter,
|
|
||||||
json_path& path_to_interactions);
|
|
||||||
|
|
||||||
std::function<double(double)> buildTotalCrossSection(json_t* object);
|
|
||||||
|
|
||||||
std::function<double(double, double)> build2DCrossSection(json_t* object);
|
|
||||||
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
|
|
||||||
json_t* object);
|
|
||||||
|
|
||||||
double buildExcitationEnergy(std::string excitation_state);
|
|
||||||
std::function<double(double)> buildExcitationCrossSection(
|
|
||||||
std::string excitation_state);
|
|
||||||
|
|
||||||
std::shared_ptr<species::Specie> findTarget(
|
|
||||||
std::string& target_name,
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
|
||||||
tracked_species,
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
|
|
||||||
background_species);
|
|
||||||
|
|
||||||
std::shared_ptr<species::TrackedSpecie> findTracked(
|
|
||||||
std::string& target_name,
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
|
||||||
tracked_species);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* INTERACTION_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef LOGGER_GENERATOR_H
|
|
||||||
#define LOGGER_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include "simulation/logger.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object);
|
|
||||||
std::shared_ptr<DeletionLogger> buildDeletionLogger(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_logger);
|
|
||||||
|
|
||||||
} // namespace generator
|
|
||||||
|
|
||||||
#endif /* LOGGER_GENERATOR_H */
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef MAGNETIC_FIELD_GENERATOR_H
|
|
||||||
#define MAGNETIC_FIELD_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/electromagnetic_field.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<MagneticField> magneticField(json_t* object);
|
|
||||||
|
|
||||||
std::shared_ptr<MagneticField> magneticField(Parameter& parameter);
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* MAGNETIC_FIELD_GENERATOR_H */
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifndef MASS_GENERATOR_H
|
|
||||||
#define MASS_GENERATOR_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include "jansson.h"
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
enum class ImplementedSpecies;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
class SpeciesMasses {
|
|
||||||
public:
|
|
||||||
static double mass(const species::ImplementedSpecies& species);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static std::map<species::ImplementedSpecies, double> mass_;
|
|
||||||
};
|
|
||||||
|
|
||||||
double buildMass(json_t* object);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* MASS_GENERATOR_H */
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef MOVER_GENERATOR_H
|
|
||||||
#define MOVER_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/mover.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<Mover> buildMover(Parameter& parameter,
|
|
||||||
const json_path& path_to_mover);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MOVER_GENERATOR_H */
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef RANDOM_NUMBERS_GENERATOR_H
|
|
||||||
#define RANDOM_NUMBERS_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/random_numbers.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<RandomNumbers> buildRandomNumbers(Parameter& parameter);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* RANDOM_NUMBERS_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef REFLECTOR_GENERATOR_H
|
|
||||||
#define REFLECTOR_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/reflector.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
|
|
||||||
const json_path& path_to_reflector);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* REFLECTOR_GENERATOR_H */
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef SCALAR_FIELD_GENERATOR_H
|
|
||||||
#define SCALAR_FIELD_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "jansson.h"
|
|
||||||
#include "simulation/scalar_field.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
std::shared_ptr<ScalarField> buildScalarField(json_t* object);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SCALAR_FIELD_GENERATOR_H */
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#ifndef SIMULATION_OUTPUT_GENERATOR_H
|
|
||||||
#define SIMULATION_OUTPUT_GENERATOR_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include "jansson.h"
|
|
||||||
|
|
||||||
class SimulationOutput;
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class TrackedSpecie;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|
||||||
json_t* object,
|
|
||||||
const std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
|
|
||||||
tracked_species);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* SIMULATION_OUTPUT_GENERATOR_H */
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
#ifndef SPECIES_GENERATOR_H
|
|
||||||
#define SPECIES_GENERATOR_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "generators/interaction_generator.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/species.h"
|
|
||||||
|
|
||||||
class Timer;
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
struct TrackedSpeciesBuilderInfo {
|
|
||||||
public:
|
|
||||||
std::shared_ptr<Mover> mover;
|
|
||||||
std::shared_ptr<Terminator> terminator;
|
|
||||||
std::shared_ptr<Reflector> reflector;
|
|
||||||
std::shared_ptr<DynamicDensityField> density_field;
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution;
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity;
|
|
||||||
|
|
||||||
double mass_kg;
|
|
||||||
double charge_C;
|
|
||||||
species::ImplementedSpecies type;
|
|
||||||
std::string name;
|
|
||||||
json_path path_in_json;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BackgroundSpeciesBuilderInfo {
|
|
||||||
public:
|
|
||||||
BackgroundSpeciesBuilderInfo()
|
|
||||||
: density(nullptr),
|
|
||||||
velocity_distribution(nullptr),
|
|
||||||
drift_velocity(nullptr){};
|
|
||||||
std::shared_ptr<ConstantDensityField> density;
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution;
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity;
|
|
||||||
|
|
||||||
double mass_kg;
|
|
||||||
double charge_C;
|
|
||||||
species::ImplementedSpecies type;
|
|
||||||
std::string name;
|
|
||||||
json_path path_in_json;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SpeciesAlias {
|
|
||||||
public:
|
|
||||||
static species::ImplementedSpecies alias(const std::string& name);
|
|
||||||
static std::string name(species::ImplementedSpecies specie);
|
|
||||||
static bool isAlias(const std::string& name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static std::map<std::string, species::ImplementedSpecies> specie_aliases;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SpeciesCharges {
|
|
||||||
public:
|
|
||||||
static double charge(species::ImplementedSpecies species);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static std::map<species::ImplementedSpecies, double> charge_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SpeciesBuilder {
|
|
||||||
public:
|
|
||||||
SpeciesBuilder(Parameter& parameter);
|
|
||||||
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
|
||||||
trackedSpecies();
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
|
|
||||||
backgroundSpecies();
|
|
||||||
std::shared_ptr<Timer> timer();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::map<std::string, BackgroundSpeciesBuilderInfo> background_species_info;
|
|
||||||
std::map<std::string, TrackedSpeciesBuilderInfo> tracked_species_info;
|
|
||||||
std::shared_ptr<Timer> timer_;
|
|
||||||
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
|
||||||
tracked_species;
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
|
|
||||||
background_species;
|
|
||||||
|
|
||||||
void initBackgroundSpecies(Parameter& parameter);
|
|
||||||
void initTrackedSpecies(Parameter& parameter);
|
|
||||||
|
|
||||||
void fillVelocityDistribution(Parameter& parameter);
|
|
||||||
void fillDriftVelocity(Parameter& parameter);
|
|
||||||
void fillMass();
|
|
||||||
void fillCharge();
|
|
||||||
void fillInteractions(Parameter& parameter);
|
|
||||||
|
|
||||||
void fillBackgroundSpecieType(Parameter& parameter);
|
|
||||||
void fillBackgroundDensity(Parameter& parameter);
|
|
||||||
|
|
||||||
void fillTrackedSpecieType(Parameter& parameter);
|
|
||||||
void fillCurrentCollector(Parameter& parameter);
|
|
||||||
void fillLoggers(Parameter& parameter);
|
|
||||||
void fillMover(Parameter& parameter);
|
|
||||||
void fillTerminator(Parameter& parameter);
|
|
||||||
void fillReflector(Parameter& parameter);
|
|
||||||
void fillTrackedDensity(Parameter& parameter);
|
|
||||||
|
|
||||||
void initTimer();
|
|
||||||
void buildSpecies();
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* SPECIES_GENERATOR_H */
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#ifndef TERMINATOR_GENERATOR_H
|
|
||||||
#define TERMINATOR_GENERATOR_H
|
|
||||||
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/terminator.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<Terminator> buildTerminator(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_terminator);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TERMINATOR_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef VECTOR_FIELD_GENERATOR_H
|
|
||||||
#define VECTOR_FIELD_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "jansson.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/vector_field.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
std::shared_ptr<VectorField> buildVectorField(json_t* object);
|
|
||||||
std::string readAbsoluteFilename(json_t* object);
|
|
||||||
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component);
|
|
||||||
blitz::Array<double, 3> readFromFile(json_t* object);
|
|
||||||
} // namespace generator
|
|
||||||
|
|
||||||
#endif /* VECTOR_FIELD_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H
|
|
||||||
#define VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/velocity_distribution_function.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<VelocityDistributionFunction> buildVelocityDistributionFunction(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_distribution);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef VELOCITY_DISTRIBUTION_GENERATOR_H
|
|
||||||
#define VELOCITY_DISTRIBUTION_GENERATOR_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/velocity_distribution.h"
|
|
||||||
|
|
||||||
namespace generator {
|
|
||||||
|
|
||||||
std::shared_ptr<VelocityDistribution> buildVelocityDistribution(
|
|
||||||
Parameter& parameter,
|
|
||||||
const json_path& path_to_distribution);
|
|
||||||
|
|
||||||
}; // namespace generator
|
|
||||||
|
|
||||||
#endif /* VELOCITY_DISTRIBUTION_GENERATOR_H */
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef CHARGE_EXCHANGE_H
|
|
||||||
#define CHARGE_EXCHANGE_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class Specie;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class ChargeExchange : public Interaction {
|
|
||||||
public:
|
|
||||||
ChargeExchange(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target);
|
|
||||||
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* CHARGE_EXCHANGE_H */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#ifndef CLUSTER_FORMATION_H
|
|
||||||
#define CLUSTER_FORMATION_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class Specie;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class ClusterFormation : public Interaction {
|
|
||||||
public:
|
|
||||||
ClusterFormation(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target,
|
|
||||||
std::shared_ptr<species::TrackedSpecie> product);
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<species::TrackedSpecie> product_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* CLUSTER_FORMATION_H */
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#ifndef CROSS_SECTIONS_H
|
|
||||||
#define CROSS_SECTIONS_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
namespace d2CrossSection {
|
|
||||||
std::function<double(double, double)> eT2_ionization_bed();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace totalCrossSection {
|
|
||||||
|
|
||||||
std::function<double(double)> eT2_elastic_scattering_constant();
|
|
||||||
std::function<double(double)> eT2_elastic_scattering();
|
|
||||||
std::function<double(double)> TpT2_elasitc_scattering_tabata();
|
|
||||||
std::function<double(double)> T3pT2_elasitc_scattering_tabata();
|
|
||||||
|
|
||||||
std::function<double(double)> T2pT2_charge_exchange_janev();
|
|
||||||
|
|
||||||
std::function<double(double)> eT2_ionization_bed();
|
|
||||||
std::function<double(double)> eT2_ionization_janev_non_diss();
|
|
||||||
std::function<double(double)> eT2_ionization_janev_diss_ground();
|
|
||||||
std::function<double(double)> eT2_ionization_janev_diss_first();
|
|
||||||
|
|
||||||
std::function<double(double)> TpT2_clustering_radiative_ascendion_pasil();
|
|
||||||
std::function<double(double)> TpT2_clustering_tertiary_ascendion_pasil();
|
|
||||||
std::function<double(double)> T2pT2_clustering_janev();
|
|
||||||
|
|
||||||
std::function<double(double)>
|
|
||||||
eT2_excitation_electric_janev_from_singlet_ground_state(
|
|
||||||
std::string final_state);
|
|
||||||
std::function<double(double)>
|
|
||||||
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
|
|
||||||
std::string final_state);
|
|
||||||
std::function<double(double)>
|
|
||||||
eT2_excitation_electric_janev_from_triplet_ground_state(
|
|
||||||
std::string final_state);
|
|
||||||
|
|
||||||
std::function<double(double)> eT2_excitation_vibrational_janev_first();
|
|
||||||
std::function<double(double)> eT2_excitation_vibrational_janev_second();
|
|
||||||
std::function<double(double)> eT2_excitation_rotational_j0_to_j2_england();
|
|
||||||
std::function<double(double)> eT2_excitation_rotational_j1_to_j3_england();
|
|
||||||
|
|
||||||
std::function<double(double)> eT2p_recombination_janev();
|
|
||||||
std::function<double(double)> eT3p_recombination_janev();
|
|
||||||
|
|
||||||
}; // namespace totalCrossSection
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* CROSS_SECTIONS_H */
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifndef ELASTIC_SCATTERING_H
|
|
||||||
#define ELASTIC_SCATTERING_H
|
|
||||||
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
|
|
||||||
class ScatteringAngleDistribution;
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class ElasticScattering : public Interaction {
|
|
||||||
public:
|
|
||||||
ElasticScattering(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target,
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib);
|
|
||||||
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* ELASTIC_SCATTERING_H */
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#ifndef EXCITATION_H
|
|
||||||
#define EXCITATION_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
#include "simulation/random_numbers.h"
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class Specie;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class Excitation : public Interaction {
|
|
||||||
public:
|
|
||||||
Excitation(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target,
|
|
||||||
double excitation_energy_eV);
|
|
||||||
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const double excitation_energy_eV_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* EXCITATION_H */
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef FREE_MOVEMENT_H
|
|
||||||
#define FREE_MOVEMENT_H
|
|
||||||
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
#include "simulation/random_numbers.h"
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class FreeMovement : public Interaction {
|
|
||||||
public:
|
|
||||||
FreeMovement();
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
double microscopicCrossSection(double energy_eV);
|
|
||||||
double macroscopicCrossSection(particle::Particle& particle);
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* FREE_MOVEMENT_H */
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#ifndef IONIZATION_H
|
|
||||||
#define IONIZATION_H
|
|
||||||
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class IonizationEnergyDistribution {
|
|
||||||
public:
|
|
||||||
IonizationEnergyDistribution(
|
|
||||||
std::function<double(double, double)> d2_cross_section,
|
|
||||||
double ionization_energy_eV);
|
|
||||||
double rollImpactParticleEnergyAfterCollision(double impact_energy,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<double(double, double)> d2_cross_section_;
|
|
||||||
const double ionization_energy_eV_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IonizationScatteringAngleDistribution {
|
|
||||||
public:
|
|
||||||
double rollAzimuthImpactParticleAfterCollision(
|
|
||||||
double impact_energy,
|
|
||||||
double energy_impact_particle_new,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
double rollAzimuthEjectedParticleAfterCollision(
|
|
||||||
double impact_energy,
|
|
||||||
double energy_impactParticle_new,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
};
|
|
||||||
|
|
||||||
class ElectronIonization : public Interaction {
|
|
||||||
public:
|
|
||||||
ElectronIonization(
|
|
||||||
std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target,
|
|
||||||
std::shared_ptr<species::TrackedSpecie> electron,
|
|
||||||
std::shared_ptr<species::TrackedSpecie> ion,
|
|
||||||
std::shared_ptr<IonizationEnergyDistribution> distribution,
|
|
||||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
|
|
||||||
double ionization_energy_eV);
|
|
||||||
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<IonizationEnergyDistribution> energy_distribution_;
|
|
||||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution_;
|
|
||||||
const double ionization_energy_eV_;
|
|
||||||
|
|
||||||
std::shared_ptr<species::TrackedSpecie> electron_;
|
|
||||||
std::shared_ptr<species::TrackedSpecie> ion_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace interaction
|
|
||||||
|
|
||||||
#endif /* IONIZATION_H */
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef RECOMBINATION_H
|
|
||||||
#define RECOMBINATION_H
|
|
||||||
|
|
||||||
#include "simulation/interaction.h"
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class Recombination : public Interaction {
|
|
||||||
public:
|
|
||||||
Recombination(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::TrackedSpecie> target);
|
|
||||||
|
|
||||||
InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<species::TrackedSpecie> recombination_target_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* RECOMBINATION_H */
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef COMPARE_H
|
|
||||||
#define COMPARE_H
|
|
||||||
|
|
||||||
#include "constants/sim_constants.h"
|
|
||||||
|
|
||||||
bool isEqual(double a, double b) {
|
|
||||||
return std::abs(a - b) < SimConstants::compare_epsilon;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* COMPARE_H */
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
#ifndef COORDINATES_H
|
|
||||||
#define COORDINATES_H
|
|
||||||
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
struct BinCoordinate {
|
|
||||||
BinCoordinate(const blitz::TinyVector<int, 3>& bin,
|
|
||||||
const blitz::TinyVector<double, 3>& frac);
|
|
||||||
|
|
||||||
BinCoordinate(blitz::TinyVector<double, 3> position,
|
|
||||||
blitz::TinyVector<double, 3> spacing);
|
|
||||||
|
|
||||||
blitz::TinyVector<int, 3> bin;
|
|
||||||
blitz::TinyVector<double, 3> frac;
|
|
||||||
|
|
||||||
static blitz::TinyVector<int, 3> binValue(
|
|
||||||
blitz::TinyVector<double, 3> position,
|
|
||||||
blitz::TinyVector<double, 3> spacing);
|
|
||||||
|
|
||||||
static blitz::TinyVector<double, 3> binFrac(
|
|
||||||
blitz::TinyVector<double, 3> position,
|
|
||||||
blitz::TinyVector<double, 3> spacing);
|
|
||||||
};
|
|
||||||
|
|
||||||
class Coordinate {
|
|
||||||
public:
|
|
||||||
virtual blitz::TinyVector<double, 3> cartesianEntries() const = 0;
|
|
||||||
virtual blitz::TinyVector<double, 3> cylinderEntries() const = 0;
|
|
||||||
|
|
||||||
virtual void add(const Coordinate& coordinate) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CartesianCoordinate : public Coordinate {
|
|
||||||
public:
|
|
||||||
CartesianCoordinate(const blitz::TinyVector<double, 3>& cartesian_position);
|
|
||||||
CartesianCoordinate(const Coordinate& coordinate);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
|
||||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
|
||||||
|
|
||||||
void add(const Coordinate& coordinate);
|
|
||||||
|
|
||||||
private:
|
|
||||||
blitz::TinyVector<double, 3> cartesian_position;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CylinderCoordinate : public Coordinate {
|
|
||||||
public:
|
|
||||||
CylinderCoordinate(const blitz::TinyVector<double, 3>& cylinder_position);
|
|
||||||
CylinderCoordinate(const Coordinate& coordinate);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
|
||||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
|
||||||
|
|
||||||
void add(const Coordinate& coordinate);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void limitPhi();
|
|
||||||
blitz::TinyVector<double, 3> cylinder_position;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Vector {
|
|
||||||
public:
|
|
||||||
virtual blitz::TinyVector<double, 3> cartesianEntries(
|
|
||||||
const Coordinate& coordinate) const = 0;
|
|
||||||
virtual blitz::TinyVector<double, 3> cylinderEntries(
|
|
||||||
const Coordinate& coordinate) const = 0;
|
|
||||||
|
|
||||||
virtual void add(const Vector& vector, const Coordinate& coordinate) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CylinderVector : public Vector {
|
|
||||||
public:
|
|
||||||
CylinderVector(const CylinderVector& vector);
|
|
||||||
CylinderVector(const blitz::TinyVector<double, 3> cylinder_vector);
|
|
||||||
CylinderVector(const Vector& vector, const Coordinate& coordinate);
|
|
||||||
|
|
||||||
CylinderVector operator+(const CylinderVector& coordinate);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> cartesianEntries(
|
|
||||||
const Coordinate& coordinate) const;
|
|
||||||
blitz::TinyVector<double, 3> cylinderEntries(
|
|
||||||
const Coordinate& coordinate) const;
|
|
||||||
blitz::TinyVector<double, 3> cylinderEntries() const;
|
|
||||||
|
|
||||||
void add(const Vector& vector, const Coordinate& coordinate);
|
|
||||||
|
|
||||||
private:
|
|
||||||
blitz::TinyVector<double, 3> cylinder_vector;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CartesianVector : public Vector {
|
|
||||||
public:
|
|
||||||
CartesianVector(const blitz::TinyVector<double, 3> cartesian_vector);
|
|
||||||
CartesianVector(const CartesianVector& vector);
|
|
||||||
|
|
||||||
CartesianVector(const Vector& vector, const Coordinate& coordinate);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> cartesianEntries(
|
|
||||||
const Coordinate& coordinate) const;
|
|
||||||
blitz::TinyVector<double, 3> cartesianEntries() const;
|
|
||||||
blitz::TinyVector<double, 3> cylinderEntries(
|
|
||||||
const Coordinate& coordinate) const;
|
|
||||||
|
|
||||||
void add(const Vector& vector, const Coordinate& coordinate);
|
|
||||||
|
|
||||||
private:
|
|
||||||
blitz::TinyVector<double, 3> cartesian_vector;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* COORDINATES_H */
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#ifndef CPU_SYNCHRONIZER_H
|
|
||||||
#define CPU_SYNCHRONIZER_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
class DynamicDensityField;
|
|
||||||
class Timer;
|
|
||||||
class CurrentCollector;
|
|
||||||
class DeletionLogger;
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class TrackedSpecie;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CpuSynchronizer {
|
|
||||||
public:
|
|
||||||
// CpuSynchronizer();
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* CPU_SYNCHRONIZER_H */
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#ifndef CURRENT_COLLECTOR_H
|
|
||||||
#define CURRENT_COLLECTOR_H
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/energy_binning.h"
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
#include "simulation/position_binning.h"
|
|
||||||
#include "simulation/timer.h"
|
|
||||||
|
|
||||||
class CurrentCollector {
|
|
||||||
public:
|
|
||||||
CurrentCollector(const CylinderBinning& position_binning,
|
|
||||||
std::shared_ptr<Timer> timer);
|
|
||||||
|
|
||||||
void collect(particle::Particle* particle, const Coordinate& old_position);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> negativeCrossingsInR() const;
|
|
||||||
blitz::Array<double, 3> positiveCrossingsInR() const;
|
|
||||||
blitz::Array<double, 3> areaInR() const;
|
|
||||||
blitz::Array<double, 3> currentInR() const;
|
|
||||||
|
|
||||||
blitz::Array<double, 3> negativeCrossingsInPhi() const;
|
|
||||||
blitz::Array<double, 3> positiveCrossingsInPhi() const;
|
|
||||||
blitz::Array<double, 3> areaInPhi() const;
|
|
||||||
blitz::Array<double, 3> currentInPhi() const;
|
|
||||||
|
|
||||||
blitz::Array<double, 3> negativeCrossingsInZ() const;
|
|
||||||
blitz::Array<double, 3> positiveCrossingsInZ() const;
|
|
||||||
blitz::Array<double, 3> areaInZ() const;
|
|
||||||
blitz::Array<double, 3> currentInZ() const;
|
|
||||||
|
|
||||||
double physicalTime() const;
|
|
||||||
|
|
||||||
friend class CpuSynchronizer;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void collectRadialMovement(const blitz::TinyVector<int, 3>& bin_old,
|
|
||||||
const blitz::TinyVector<int, 3>& bin_new);
|
|
||||||
void collectLongitudinalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
|
||||||
const blitz::TinyVector<int, 3>& bin_new);
|
|
||||||
void collectAzimuthalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
|
||||||
const blitz::TinyVector<int, 3>& bin_new);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> createAreaLongitudinal(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
blitz::Array<double, 3> createCrossingsLongitudinal(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> createAreaRadial(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
blitz::Array<double, 3> createCrossingsRadial(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> createAreaAzimuthal(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
blitz::Array<double, 3> createCrossingsAzimuthal(
|
|
||||||
const CylinderBinning& position_binning);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> z_negative_crossings;
|
|
||||||
blitz::Array<double, 3> z_positive_crossings;
|
|
||||||
|
|
||||||
blitz::Array<double, 3> phi_negative_crossings;
|
|
||||||
blitz::Array<double, 3> phi_positive_crossings;
|
|
||||||
|
|
||||||
blitz::Array<double, 3> r_negative_crossings;
|
|
||||||
blitz::Array<double, 3> r_positive_crossings;
|
|
||||||
|
|
||||||
blitz::Array<double, 3> collector_areas_r;
|
|
||||||
blitz::Array<double, 3> collector_areas_phi;
|
|
||||||
blitz::Array<double, 3> collector_areas_z;
|
|
||||||
|
|
||||||
CylinderBinning position_binning_;
|
|
||||||
std::shared_ptr<Timer> timer_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* CURRENT_COLLECTOR_H */
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
#ifndef DENSITY_FIELD_H
|
|
||||||
#define DENSITY_FIELD_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/cpu_synchronizer.h"
|
|
||||||
#include "simulation/energy_binning.h"
|
|
||||||
#include "simulation/position_binning.h"
|
|
||||||
#include "simulation/timer.h"
|
|
||||||
|
|
||||||
class ScalarField;
|
|
||||||
class EventPositionDistribution;
|
|
||||||
|
|
||||||
class DensityField {
|
|
||||||
public:
|
|
||||||
virtual double density(const Coordinate& position) = 0;
|
|
||||||
virtual double density(const Coordinate& position, double energy_eV) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DynamicDensityField : public DensityField {
|
|
||||||
public:
|
|
||||||
DynamicDensityField(const CylinderBinning& position_binning,
|
|
||||||
const EnergyBinning& energy_binning,
|
|
||||||
std::shared_ptr<Timer> timer);
|
|
||||||
|
|
||||||
bool changedPositionBin(const Coordinate& old_position,
|
|
||||||
const Coordinate& new_position) const;
|
|
||||||
|
|
||||||
bool changedEnergyBin(double old_energy_eV, double new_energy_eV) const;
|
|
||||||
|
|
||||||
void logMovement(const Coordinate& position,
|
|
||||||
double energy_eV,
|
|
||||||
double time_in_bin_s);
|
|
||||||
|
|
||||||
void logDeletion(const Coordinate& position, double energy_eV);
|
|
||||||
|
|
||||||
double density(const Coordinate& position);
|
|
||||||
double density(const Coordinate& position, double energy_eV);
|
|
||||||
|
|
||||||
blitz::Array<double, 3> densityArray();
|
|
||||||
blitz::Array<double, 4> spectrumArray();
|
|
||||||
blitz::Array<double, 4> timeInBinArray() const;
|
|
||||||
blitz::Array<long int, 4> deletedParticlesArray() const;
|
|
||||||
blitz::Array<double, 3> binVolumeArray() const;
|
|
||||||
|
|
||||||
const EnergyBinning* energyBinning() const;
|
|
||||||
const CylinderBinning* positionBinning() const;
|
|
||||||
|
|
||||||
double physicalTime() const;
|
|
||||||
|
|
||||||
friend class CpuSynchronizer;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// coordinate ordering: r, phi, z, E
|
|
||||||
// bin numbering
|
|
||||||
// radial:
|
|
||||||
// 0, ..., num_bin_r-1: r < r_max
|
|
||||||
// num_bin_r: r >= r_max
|
|
||||||
//
|
|
||||||
// azimuthal:
|
|
||||||
// 0, ..., num_bin_phi: all
|
|
||||||
//
|
|
||||||
// longitudinal:
|
|
||||||
// -1: z < 0
|
|
||||||
// 0, ..., num_bin_z-1: 0 <= z < z_max
|
|
||||||
// num_bin_z: z >= z_max
|
|
||||||
BinCoordinate densityBin(const CylinderCoordinate& position) const;
|
|
||||||
void recalculateDensityArray();
|
|
||||||
|
|
||||||
blitz::Array<double, 4> time_in_bin_s_;
|
|
||||||
blitz::Array<long int, 4> deleted_particles_;
|
|
||||||
blitz::Array<double, 4> density_per_m3_;
|
|
||||||
blitz::Array<double, 3> bin_volume_m3_;
|
|
||||||
|
|
||||||
const CylinderBinning position_binning_;
|
|
||||||
const EnergyBinning energy_binning_;
|
|
||||||
|
|
||||||
std::shared_ptr<Timer> timer_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ConstantDensityField : public DensityField {
|
|
||||||
public:
|
|
||||||
ConstantDensityField(std::shared_ptr<ScalarField> density);
|
|
||||||
|
|
||||||
double density(const Coordinate& position);
|
|
||||||
double density(const Coordinate& position, double energy_eV);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<ScalarField> density_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* DENSITY_FIELD_H */
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef DRIFT_VELOCITY_H
|
|
||||||
#define DRIFT_VELOCITY_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/vector_field.h"
|
|
||||||
|
|
||||||
class DriftVelocity {
|
|
||||||
public:
|
|
||||||
DriftVelocity(std::shared_ptr<VectorField> drift_velocity);
|
|
||||||
|
|
||||||
CartesianVector driftVelocity(const Coordinate& position);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<VectorField> drift_velocity_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* DRIFT_VELOCITY_H */
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#ifndef ELECTROMAGNETIC_FIELD_H
|
|
||||||
#define ELECTROMAGNETIC_FIELD_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/scalar_field.h"
|
|
||||||
#include "simulation/vector_field.h"
|
|
||||||
|
|
||||||
class ElectricField {
|
|
||||||
public:
|
|
||||||
ElectricField(std::shared_ptr<VectorField> background,
|
|
||||||
std::shared_ptr<VectorField> dynamic);
|
|
||||||
|
|
||||||
CylinderVector value(const Coordinate& position) const;
|
|
||||||
|
|
||||||
void updateDynamicField(std::shared_ptr<VectorField> field);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<VectorField> background_;
|
|
||||||
std::shared_ptr<VectorField> dynamic_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MagneticField {
|
|
||||||
public:
|
|
||||||
MagneticField(std::shared_ptr<VectorField> field);
|
|
||||||
|
|
||||||
CylinderVector value(const Coordinate& position) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<VectorField> field_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ELECTROMAGNETIC_FIELD_H */
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef ENERGY_BINNING_H
|
|
||||||
#define ENERGY_BINNING_H
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class EnergyBinning {
|
|
||||||
public:
|
|
||||||
EnergyBinning(double minimal_energy, double maximal_energy, int num_bins);
|
|
||||||
EnergyBinning(std::vector<double> energy_bin_borders);
|
|
||||||
|
|
||||||
int bin(double energy_eV) const;
|
|
||||||
int numBins() const;
|
|
||||||
std::vector<double> binBorders() const;
|
|
||||||
int binIndexMin() const;
|
|
||||||
int binIndexMax() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::vector<double> energy_bin_borders_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ENERGY_BINNING_H */
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#ifndef ENERGY_DISTRIBUTION_H
|
|
||||||
#define ENERGY_DISTRIBUTION_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
class EnergyDistributionFunction {
|
|
||||||
public:
|
|
||||||
virtual double rollEnergy(std::mt19937* engine) = 0; // eV
|
|
||||||
};
|
|
||||||
|
|
||||||
class TritiumBetaDecay : public EnergyDistributionFunction {
|
|
||||||
public:
|
|
||||||
TritiumBetaDecay();
|
|
||||||
double rollEnergy(std::mt19937* engine);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::function<double(double)> tritium_spectrum_;
|
|
||||||
std::uniform_real_distribution<double> x_distribution_;
|
|
||||||
std::uniform_real_distribution<double> y_distribution_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MaxwellBoltzmann : public EnergyDistributionFunction {
|
|
||||||
public:
|
|
||||||
MaxwellBoltzmann(double temperature_K);
|
|
||||||
double rollEnergy(std::mt19937* engine); // eV
|
|
||||||
private:
|
|
||||||
std::gamma_distribution<double> distribution_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Constant : public EnergyDistributionFunction {
|
|
||||||
public:
|
|
||||||
Constant(double constant_eV);
|
|
||||||
double rollEnergy(std::mt19937* engine); // eV
|
|
||||||
private:
|
|
||||||
const double constant_eV_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ENERGY_DISTRIBUTION_H */
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
#ifndef ERRORS_H
|
|
||||||
#define ERRORS_H
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
#include "simulation/mpi_communication.h"
|
|
||||||
|
|
||||||
#if defined debug_level3 || defined debug_level2 || defined debug_level1 || \
|
|
||||||
defined debug_level0
|
|
||||||
inline void DEBUG(const std::string& message) {
|
|
||||||
std::cout << "#DEBUG<" << MpiCommunication::mpi_rank << ">: " << message
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined debug_level0
|
|
||||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_1(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
|
||||||
#elif defined debug_level1
|
|
||||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
|
||||||
|
|
||||||
#elif defined debug_level2
|
|
||||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_2(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
|
||||||
|
|
||||||
#else
|
|
||||||
inline void DEBUG_LEVEL_0(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_1(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_2(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
inline void DEBUG_LEVEL_3(const std::string& message) {
|
|
||||||
DEBUG(message);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
inline void DEBUG(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_0(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_1(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_2(const std::string& message) {}
|
|
||||||
inline void DEBUG_LEVEL_3(const std::string& message) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline void SIM_INFO(const std::string& message) {
|
|
||||||
if (MpiCommunication::mpi_rank == 0) {
|
|
||||||
std::cout << "#INFO: " << message << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ERROR(const std::string& message) {
|
|
||||||
fprintf(stderr, "ERROR <%d> %s\n", MpiCommunication::mpi_rank,
|
|
||||||
message.c_str());
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
// throw std::runtime_error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void ASSERT_POSITIVE(T* value, const std::string& message) {
|
|
||||||
if (!(*value > 0)) {
|
|
||||||
ERROR(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void ASSERT_NOTNEGATIVE(T* value, const std::string& message) {
|
|
||||||
if (!(*value >= 0)) {
|
|
||||||
ERROR(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void ASSERT_EXISTS(T* value, const std::string& message) {
|
|
||||||
if (!value) {
|
|
||||||
ERROR(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ASSERT_FINITE(double value, const std::string& message) {
|
|
||||||
if (!std::isfinite(value)) {
|
|
||||||
ERROR(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ASSERT_FINITE(const blitz::TinyVector<double, 3>& value,
|
|
||||||
const std::string& message) {
|
|
||||||
if (!std::isfinite(value(0)) || !std::isfinite(value(1)) ||
|
|
||||||
!std::isfinite(value(2))) {
|
|
||||||
ERROR(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ERRORS_H */
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#ifndef EVENT_POSITION_DISTRIBUTION_H
|
|
||||||
#define EVENT_POSITION_DISTRIBUTION_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/scalar_field.h"
|
|
||||||
|
|
||||||
struct Limit {
|
|
||||||
Limit() : min(0), max(0){};
|
|
||||||
Limit(double min, double max) : min(min), max(max){};
|
|
||||||
double min;
|
|
||||||
double max;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EventPositionDistribution {
|
|
||||||
public:
|
|
||||||
EventPositionDistribution(std::shared_ptr<ScalarField> mother_density,
|
|
||||||
Limit density,
|
|
||||||
Limit r_position,
|
|
||||||
Limit phi_position,
|
|
||||||
Limit z_position);
|
|
||||||
CylinderCoordinate rollPosition(std::mt19937* engine);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<ScalarField> mother_density_;
|
|
||||||
|
|
||||||
// for Rejection method
|
|
||||||
std::uniform_real_distribution<double> r_values;
|
|
||||||
std::uniform_real_distribution<double> z_values;
|
|
||||||
std::uniform_real_distribution<double> phi_values;
|
|
||||||
std::uniform_real_distribution<double> density_values;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* EVENT_POSITION_DISTRIBUTION_H */
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef GEOMETRY_H
|
|
||||||
#define GEOMETRY_H
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
class Geometry {
|
|
||||||
public:
|
|
||||||
virtual bool isInside(const Coordinate& position) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Cylinder : public Geometry {
|
|
||||||
public:
|
|
||||||
Cylinder(double radius, double height);
|
|
||||||
bool isInside(const Coordinate& position) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const double radius_;
|
|
||||||
const double height_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* GEOMETRY_H */
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#ifndef HOMEBASE_H
|
|
||||||
#define HOMEBASE_H
|
|
||||||
|
|
||||||
#define STRINGIZER(arg) #arg
|
|
||||||
#define STR_VALUE(arg) STRINGIZER(arg)
|
|
||||||
#define BUILD_HOMEBASE_STRING STR_VALUE(HOMEBASE)
|
|
||||||
|
|
||||||
#endif /* HOMEBASE_H */
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#ifndef INJECTOR_H
|
|
||||||
#define INJECTOR_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
class DriftVelocity;
|
|
||||||
class VelocityDistribution;
|
|
||||||
|
|
||||||
namespace particle {
|
|
||||||
class Particle;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class Specie;
|
|
||||||
class TrackedSpecie;
|
|
||||||
} // namespace species
|
|
||||||
|
|
||||||
class EventPositionDistribution;
|
|
||||||
|
|
||||||
struct InjectorInfo {
|
|
||||||
public:
|
|
||||||
std::shared_ptr<species::TrackedSpecie> created_specie;
|
|
||||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Injector {
|
|
||||||
public:
|
|
||||||
Injector(std::vector<InjectorInfo>& injector_info,
|
|
||||||
double activity,
|
|
||||||
std::shared_ptr<EventPositionDistribution> position_distribution,
|
|
||||||
std::shared_ptr<DriftVelocity> mother_drift_velocity);
|
|
||||||
|
|
||||||
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine);
|
|
||||||
double timePassed() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<InjectorInfo> injector_infos_;
|
|
||||||
const double activity_;
|
|
||||||
std::shared_ptr<EventPositionDistribution> position_distribution_;
|
|
||||||
std::shared_ptr<DriftVelocity> mother_drift_velocity_;
|
|
||||||
|
|
||||||
particle::Particle rollNewParticle(
|
|
||||||
std::mt19937* engine,
|
|
||||||
const Coordinate& position,
|
|
||||||
std::shared_ptr<species::TrackedSpecie> created_specie,
|
|
||||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* INJECTOR_H */
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef INTERACTION_H
|
|
||||||
#define INTERACTION_H
|
|
||||||
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
#include "simulation/random_numbers.h"
|
|
||||||
#include "simulation/species.h"
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
|
|
||||||
class InteractionOutput {
|
|
||||||
public:
|
|
||||||
InteractionOutput();
|
|
||||||
|
|
||||||
void deleteCurrentParticle(bool new_decider);
|
|
||||||
bool deleteCurrentParticle();
|
|
||||||
void add(const particle::Particle& new_particle);
|
|
||||||
std::vector<particle::Particle> newParticles();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool delete_current_particle_;
|
|
||||||
std::vector<particle::Particle> new_particles_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Interaction {
|
|
||||||
public:
|
|
||||||
Interaction(std::function<double(double)> cross_section,
|
|
||||||
std::shared_ptr<species::Specie> target);
|
|
||||||
|
|
||||||
virtual double microscopicCrossSection(double energy_eV);
|
|
||||||
virtual double macroscopicCrossSection(particle::Particle& particle);
|
|
||||||
|
|
||||||
virtual InteractionOutput performInteraction(particle::Particle& particle,
|
|
||||||
RandomNumbers* generator) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::function<double(double)> cross_section_;
|
|
||||||
std::shared_ptr<species::Specie> target_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace interaction
|
|
||||||
|
|
||||||
#endif /* INTERACTION_H */
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
#ifndef JANSSON_ADDITIONALS_H
|
|
||||||
#define JANSSON_ADDITIONALS_H
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
#include "jansson.h"
|
|
||||||
#include "simulation/errors.h"
|
|
||||||
#include "simulation/unit_converter.h"
|
|
||||||
|
|
||||||
typedef std::vector<std::string> json_path;
|
|
||||||
|
|
||||||
inline json_t* json_object_by_path(json_t* object, const json_path& path) {
|
|
||||||
json_t* j_obj = object;
|
|
||||||
for (auto str : path) {
|
|
||||||
j_obj = json_object_get(j_obj, str.c_str());
|
|
||||||
}
|
|
||||||
return j_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline double json_double(json_t* object, double default_value = 0.) {
|
|
||||||
if (object) {
|
|
||||||
return json_real_value(object);
|
|
||||||
} else {
|
|
||||||
return default_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int json_int(json_t* object, int default_value = 0) {
|
|
||||||
if (object) {
|
|
||||||
return std::floor(json_real_value(object));
|
|
||||||
} else {
|
|
||||||
return default_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string json_string(json_t* object, std::string default_value = "") {
|
|
||||||
if (object) {
|
|
||||||
return std::string(json_string_value(object));
|
|
||||||
} else {
|
|
||||||
return default_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool json_bool(json_t* object, bool default_value = false) {
|
|
||||||
if (object) {
|
|
||||||
return (json_string(object) == "true");
|
|
||||||
} else {
|
|
||||||
return default_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <int s>
|
|
||||||
blitz::TinyVector<double, s> json_blitz_vector(json_t* object) {
|
|
||||||
blitz::TinyVector<double, s> vector;
|
|
||||||
size_t index;
|
|
||||||
json_t* value;
|
|
||||||
json_t* array = json_object_by_path(object, {"vector"});
|
|
||||||
size_t size = json_array_size(array);
|
|
||||||
if (size != s) {
|
|
||||||
std::stringstream error_message;
|
|
||||||
error_message << "The provided vector has size: " << size
|
|
||||||
<< ", but is stated as size " << s;
|
|
||||||
ERROR(error_message.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
json_array_foreach(array, index, value) {
|
|
||||||
vector(index) = json_double(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::vector<double> json_vector(json_t* object) {
|
|
||||||
std::vector<double> vector;
|
|
||||||
size_t index;
|
|
||||||
json_t* value;
|
|
||||||
json_array_foreach(object, index, value) {
|
|
||||||
vector.push_back(json_double(value));
|
|
||||||
}
|
|
||||||
return vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline json_path json_path_get(json_t* object) {
|
|
||||||
json_path path;
|
|
||||||
|
|
||||||
json_t* value;
|
|
||||||
size_t index;
|
|
||||||
json_array_foreach(object, index, value) {
|
|
||||||
path.push_back(json_string(value));
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline json_path json_path_append(const json_path& path,
|
|
||||||
const json_path& append) {
|
|
||||||
json_path result = path;
|
|
||||||
for (auto a : append) {
|
|
||||||
result.push_back(a);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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"}));
|
|
||||||
return unitConvertion::energy(value, unit, output_unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* JANSSON_ADDITIONALS_H */
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#ifndef KINEMATIC_H
|
|
||||||
#define KINEMATIC_H
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
namespace kinematic {
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> rotateVector(const blitz::TinyVector<double, 3>& v,
|
|
||||||
double theta,
|
|
||||||
double phi);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> rotateVelocityInCenterOfMassFrame(
|
|
||||||
const blitz::TinyVector<double, 3>& velocity_1,
|
|
||||||
const blitz::TinyVector<double, 3>& velocity_2,
|
|
||||||
double mass_1,
|
|
||||||
double mass_2,
|
|
||||||
double theta,
|
|
||||||
double phi);
|
|
||||||
|
|
||||||
double kineticEnergy(const blitz::TinyVector<double, 3>& velocity, double mass);
|
|
||||||
double thermalEnergy(double temperature_K);
|
|
||||||
|
|
||||||
double velocity(double energy_eV, double mass_kg);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> relativisticBoost(
|
|
||||||
const blitz::TinyVector<double, 3>& v1,
|
|
||||||
const blitz::TinyVector<double, 3>& v2);
|
|
||||||
|
|
||||||
double relativisticGamma(const blitz::TinyVector<double, 3>& velocity);
|
|
||||||
double relativisticGamma(double kin_energy_eV, double mass_eV);
|
|
||||||
double relativisticBeta(double velocity_ms);
|
|
||||||
double relativisticBeta(double kin_energy_eV, double mass_eV);
|
|
||||||
double relativisticMomentum(double energy_eV, double mass_eV);
|
|
||||||
|
|
||||||
double norm(const blitz::TinyVector<double, 3>& vector);
|
|
||||||
|
|
||||||
double distanceInCylinder(const blitz::TinyVector<double, 3>& position_1,
|
|
||||||
const blitz::TinyVector<double, 3>& position_2);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> perpendicularVector(
|
|
||||||
const blitz::TinyVector<double, 3>& vector,
|
|
||||||
const blitz::TinyVector<double, 3>& direction);
|
|
||||||
blitz::TinyVector<double, 3> parallelVector(
|
|
||||||
const blitz::TinyVector<double, 3>& vector,
|
|
||||||
const blitz::TinyVector<double, 3>& direction);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> rotateVector(
|
|
||||||
const blitz::TinyVector<double, 3>& vector,
|
|
||||||
const blitz::TinyVector<double, 3>& rotation_axis,
|
|
||||||
double angle);
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> velocityVector(
|
|
||||||
double energy_eV,
|
|
||||||
const blitz::TinyVector<double, 3>& random_unit_vector,
|
|
||||||
double mass_kg);
|
|
||||||
|
|
||||||
}; // namespace kinematic
|
|
||||||
|
|
||||||
#endif /* KINEMATIC_H */
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef LOGGER_H
|
|
||||||
#define LOGGER_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
enum class DeletionType {
|
|
||||||
wall,
|
|
||||||
recombination,
|
|
||||||
max_interactions,
|
|
||||||
max_time_alive,
|
|
||||||
cluster_formation
|
|
||||||
};
|
|
||||||
|
|
||||||
class DeletionLogger {
|
|
||||||
public:
|
|
||||||
DeletionLogger(std::vector<DeletionType> used_types);
|
|
||||||
|
|
||||||
virtual void logDeletion(const Coordinate& coordinate, DeletionType type);
|
|
||||||
|
|
||||||
std::map<DeletionType, long int> numDeletions() const;
|
|
||||||
void numDeletions(long int new_value, DeletionType type);
|
|
||||||
long int numDeletions(DeletionType type) const;
|
|
||||||
|
|
||||||
friend class CpuSynchronizer;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::map<DeletionType, long int> num_deletions;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* LOGGER_H */
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#ifndef MOVER_H
|
|
||||||
#define MOVER_H
|
|
||||||
|
|
||||||
#include "simulation/electromagnetic_field.h"
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
|
|
||||||
class Mover {
|
|
||||||
public:
|
|
||||||
virtual void move(particle::Particle* particle,
|
|
||||||
double mfp_m,
|
|
||||||
ElectricField* electric_field,
|
|
||||||
MagneticField* magnetic_field) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BorisMover : public Mover {
|
|
||||||
public:
|
|
||||||
BorisMover(double maximal_time_step_s);
|
|
||||||
|
|
||||||
void move(particle::Particle* particle,
|
|
||||||
double mfp_m,
|
|
||||||
ElectricField* electric_field,
|
|
||||||
MagneticField* magnetic_field);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const double maximal_time_step_s_;
|
|
||||||
|
|
||||||
void movementStep(particle::Particle* particle,
|
|
||||||
const blitz::TinyVector<double, 3>& electric_field,
|
|
||||||
const blitz::TinyVector<double, 3>& magnetic_field,
|
|
||||||
double& moved_distance) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DriftMover : public Mover {
|
|
||||||
public:
|
|
||||||
DriftMover(double maximal_distance);
|
|
||||||
|
|
||||||
void move(particle::Particle* particle,
|
|
||||||
double mfp_m,
|
|
||||||
ElectricField* electric_field,
|
|
||||||
MagneticField* magnetic_field);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const double maximal_distance_m_;
|
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> driftVelocity(
|
|
||||||
const blitz::TinyVector<double, 3>& magnetic_field,
|
|
||||||
const blitz::TinyVector<double, 3>& electric_field) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MOVER_H */
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#ifndef MPI_COMMUNICATION_H
|
|
||||||
#define MPI_COMMUNICATION_H
|
|
||||||
|
|
||||||
class MpiCommunication {
|
|
||||||
public:
|
|
||||||
static int mpi_rank;
|
|
||||||
static int mpi_size;
|
|
||||||
|
|
||||||
static int mpiRank();
|
|
||||||
static int mpiSize();
|
|
||||||
|
|
||||||
static void init(int argc, char* argv[]);
|
|
||||||
static void finalize();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MPI_COMMUNICATION_H */
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#ifndef NEUTRAL_GAS_H
|
|
||||||
#define NEUTRAL_GAS_H
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* NEUTRAL_GAS_H */
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#ifndef PARAMETER_H
|
|
||||||
#define PARAMETER_H
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "jansson.h"
|
|
||||||
#include "simulation/jansson_additionals.h"
|
|
||||||
|
|
||||||
class Parameter {
|
|
||||||
public:
|
|
||||||
Parameter(std::string filename);
|
|
||||||
~Parameter();
|
|
||||||
|
|
||||||
double doubleValue(const json_path& path) const;
|
|
||||||
double doubleValue(const json_path& path, double default_value) const;
|
|
||||||
int intValue(const json_path& path) const;
|
|
||||||
int intValue(const json_path& path, int default_value) const;
|
|
||||||
std::string stringValue(const json_path& path) const;
|
|
||||||
std::string stringValue(const json_path& path,
|
|
||||||
const std::string& default_value) const;
|
|
||||||
bool boolValue(const json_path& path) const;
|
|
||||||
bool boolValue(const json_path& path, bool default_value) const;
|
|
||||||
|
|
||||||
bool pathExists(const json_path& path) const;
|
|
||||||
json_t* jsonFile() const;
|
|
||||||
json_t* jsonObjectFromBase(const json_path& path) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
json_error_t* j_error_;
|
|
||||||
json_t* j_file_;
|
|
||||||
|
|
||||||
json_t* openParameterFile(const std::string& filename) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PARAMETER_H */
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#ifndef PARTICLE_H
|
|
||||||
#define PARTICLE_H
|
|
||||||
|
|
||||||
#include "blitz/array.h"
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/species.h"
|
|
||||||
|
|
||||||
namespace particle {
|
|
||||||
|
|
||||||
class Particle {
|
|
||||||
public:
|
|
||||||
// Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
|
||||||
// Coordinate* position,
|
|
||||||
// Vector* velocity);
|
|
||||||
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
|
||||||
const Coordinate& position,
|
|
||||||
const Vector& velocity);
|
|
||||||
|
|
||||||
void position(const Coordinate& new_position);
|
|
||||||
CartesianCoordinate position() const;
|
|
||||||
|
|
||||||
void velocity(const CartesianVector& new_velocity);
|
|
||||||
CartesianVector velocity() const;
|
|
||||||
|
|
||||||
void move(const Coordinate& distance);
|
|
||||||
|
|
||||||
double kineticEnergy_eV() const;
|
|
||||||
double absoluteVelocity() const;
|
|
||||||
double absoluteVelocitySquared() const;
|
|
||||||
|
|
||||||
double mass_kg() const;
|
|
||||||
double charge_C() const;
|
|
||||||
|
|
||||||
species::TrackedSpecie* specie() const;
|
|
||||||
|
|
||||||
static void lastId(long int id);
|
|
||||||
static long int lastId(); // only local on this cpu
|
|
||||||
|
|
||||||
void increaseInteractionCounter();
|
|
||||||
long int interactionCounter() const;
|
|
||||||
|
|
||||||
void increaseTimeAlive(double time_s);
|
|
||||||
double timeAlive() const;
|
|
||||||
|
|
||||||
void increaseTimeInBin(double time_s);
|
|
||||||
void resetTimeInBin();
|
|
||||||
double timeInBin() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CartesianVector velocity_;
|
|
||||||
CartesianCoordinate position_;
|
|
||||||
|
|
||||||
double time_alive_s_;
|
|
||||||
double time_in_bin_s_;
|
|
||||||
long int interaction_counter_;
|
|
||||||
|
|
||||||
std::shared_ptr<species::TrackedSpecie> specie_;
|
|
||||||
long int id_;
|
|
||||||
|
|
||||||
static long int last_id_; // only local on this cpu
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace particle
|
|
||||||
|
|
||||||
#endif /* PARTICLE_H */
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#ifndef POSITION_BINNING_H
|
|
||||||
#define POSITION_BINNING_H
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
class LowerAndUpperBoundBinning {
|
|
||||||
public:
|
|
||||||
LowerAndUpperBoundBinning(int num_bins, double maximum);
|
|
||||||
|
|
||||||
int bin(double position) const;
|
|
||||||
double stepsize() const;
|
|
||||||
int numBins() const;
|
|
||||||
int binIndexMin() const;
|
|
||||||
int binIndexMax() const;
|
|
||||||
std::vector<double> binBorders() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
int num_bins_;
|
|
||||||
double stepsize_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LowerBoundBinningWithOverflow {
|
|
||||||
public:
|
|
||||||
LowerBoundBinningWithOverflow(int num_bins_excluding_overflow,
|
|
||||||
double maximum);
|
|
||||||
|
|
||||||
int bin(double position) const;
|
|
||||||
double stepsize() const;
|
|
||||||
int numBinsWithOverflow() const;
|
|
||||||
int numBinsWithoutOverflow() const;
|
|
||||||
int binIndexMin() const;
|
|
||||||
int binIndexMax() const;
|
|
||||||
std::vector<double> binBorders() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
int num_bins_;
|
|
||||||
double stepsize_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BinningWithOverAndUnderflow {
|
|
||||||
public:
|
|
||||||
BinningWithOverAndUnderflow(int num_bins_excluding_overunderflow,
|
|
||||||
double maximum);
|
|
||||||
|
|
||||||
int bin(double position) const;
|
|
||||||
double stepsize() const;
|
|
||||||
int numBinsWithOverUnderflow() const;
|
|
||||||
int numBinsWithoutOverUnderflow() const;
|
|
||||||
int binIndexMin() const;
|
|
||||||
int binIndexMax() const;
|
|
||||||
std::vector<double> binBorders() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
int num_bins_;
|
|
||||||
double stepsize_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CylinderBinning {
|
|
||||||
public:
|
|
||||||
CylinderBinning(int num_bins_radial,
|
|
||||||
double radius,
|
|
||||||
int num_bins_azimuthal,
|
|
||||||
int num_bins_longitudinal,
|
|
||||||
double height);
|
|
||||||
|
|
||||||
blitz::TinyVector<int, 3> bin(
|
|
||||||
const blitz::TinyVector<double, 3>& cylinder_position) const;
|
|
||||||
blitz::TinyVector<double, 3> stepsize() const;
|
|
||||||
|
|
||||||
blitz::TinyVector<int, 3> numBins() const;
|
|
||||||
blitz::TinyVector<int, 3> numBinsIncludingOverUnderflow() const;
|
|
||||||
blitz::TinyVector<int, 3> binIndexMin() const;
|
|
||||||
blitz::TinyVector<int, 3> binIndexMax() const;
|
|
||||||
|
|
||||||
const LowerBoundBinningWithOverflow radial_binning;
|
|
||||||
const LowerAndUpperBoundBinning azimuth_binning;
|
|
||||||
const BinningWithOverAndUnderflow longitudinal_binning;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* POSITION_BINNING_H */
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef RANDOM_NUMBERS_H
|
|
||||||
#define RANDOM_NUMBERS_H
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
class RandomNumbers {
|
|
||||||
public:
|
|
||||||
RandomNumbers(int seed);
|
|
||||||
|
|
||||||
int rollUniform(int min, int max);
|
|
||||||
double rollUniform(double min, double max);
|
|
||||||
|
|
||||||
std::mt19937* engine();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<std::mt19937> engine_;
|
|
||||||
std::uniform_real_distribution<double> real_distribution_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* RANDOM_NUMBERS_H */
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#ifndef REFLECTOR_H
|
|
||||||
#define REFLECTOR_H
|
|
||||||
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
|
|
||||||
class Reflector {
|
|
||||||
public:
|
|
||||||
virtual bool needsReflectionBackToDomain(
|
|
||||||
const particle::Particle* particle) const = 0;
|
|
||||||
virtual void reflectBackToDomain(particle::Particle* particle) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ReflectorDPS : public Reflector {
|
|
||||||
public:
|
|
||||||
ReflectorDPS(double z_position_dps);
|
|
||||||
bool needsReflectionBackToDomain(const particle::Particle* particle) const;
|
|
||||||
void reflectBackToDomain(particle::Particle* particle) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const double z_position_dps_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NoReflector : public Reflector {
|
|
||||||
bool needsReflectionBackToDomain(const particle::Particle* particle) const;
|
|
||||||
void reflectBackToDomain(particle::Particle* particle) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* REFLECTOR_H */
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef SCALAR_FIELD_H
|
|
||||||
#define SCALAR_FIELD_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
class ScalarField {
|
|
||||||
public:
|
|
||||||
virtual double value(const Coordinate& coordinate) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ScalarFieldFunctionInZ : public ScalarField {
|
|
||||||
public:
|
|
||||||
ScalarFieldFunctionInZ(std::function<double(double, double, double)> F_z);
|
|
||||||
|
|
||||||
double value(const Coordinate& coordinate) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<double(double, double, double)> F_z_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SCALAR_FIELD_H */
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#ifndef SCATTERING_ANGLE_DISTRIBUTION_H
|
|
||||||
#define SCATTERING_ANGLE_DISTRIBUTION_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "simulation/energy_binning.h"
|
|
||||||
|
|
||||||
class ScatteringAngleDistribution {
|
|
||||||
public:
|
|
||||||
virtual double roll(std::mt19937* engine, double energy_eV) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IsotropicAngleDistribution : public ScatteringAngleDistribution {
|
|
||||||
public:
|
|
||||||
IsotropicAngleDistribution();
|
|
||||||
double roll(std::mt19937* engine, double energy_eV = 0.);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::uniform_real_distribution<double> distribution_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AngleDistributionFromFile : public ScatteringAngleDistribution {
|
|
||||||
public:
|
|
||||||
AngleDistributionFromFile(std::string absolute_filepath);
|
|
||||||
double roll(std::mt19937* engine, double energy_eV);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<EnergyBinning> energy_binning_;
|
|
||||||
std::vector<std::piecewise_linear_distribution<double>> angle_distributions_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CompositeAngleDistribution : public ScatteringAngleDistribution {
|
|
||||||
public:
|
|
||||||
CompositeAngleDistribution(
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> lower_distribution,
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> higher_distribution,
|
|
||||||
double decider_energy);
|
|
||||||
double roll(std::mt19937* engine, double energy_eV);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> lower_distribution_;
|
|
||||||
std::shared_ptr<ScatteringAngleDistribution> higher_distribution_;
|
|
||||||
const double decider_energy_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SCATTERING_ANGLE_DISTRIBUTION_H */
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
#ifndef SIMULATION_H
|
|
||||||
#define SIMULATION_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
|
|
||||||
class RandomNumbers;
|
|
||||||
class InteractionOutput;
|
|
||||||
class MagneticField;
|
|
||||||
class ElectricField;
|
|
||||||
class Timer;
|
|
||||||
class Injector;
|
|
||||||
class SimulationOutput;
|
|
||||||
class CpuSynchronizer;
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
class Specie;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
class InteractionOutput;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Simulation {
|
|
||||||
public:
|
|
||||||
Simulation(std::string parameter_filename);
|
|
||||||
|
|
||||||
void init(Parameter& parameter);
|
|
||||||
void start();
|
|
||||||
void finalize();
|
|
||||||
void processEvents(int events);
|
|
||||||
void processUntilTermination(particle::Particle& particle,
|
|
||||||
std::vector<particle::Particle>& particle_queue);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<particle::Particle> determineInjectedParticles(
|
|
||||||
RandomNumbers* random);
|
|
||||||
|
|
||||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random);
|
|
||||||
|
|
||||||
interaction::InteractionOutput interact(particle::Particle& particle,
|
|
||||||
RandomNumbers* random);
|
|
||||||
|
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
|
|
||||||
tracked_species_;
|
|
||||||
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
|
|
||||||
background_species_;
|
|
||||||
|
|
||||||
std::shared_ptr<Injector> injector_;
|
|
||||||
|
|
||||||
std::shared_ptr<MagneticField> magnetic_field_;
|
|
||||||
std::shared_ptr<ElectricField> electric_field_;
|
|
||||||
|
|
||||||
Parameter parameter_;
|
|
||||||
std::shared_ptr<RandomNumbers> random_;
|
|
||||||
|
|
||||||
std::shared_ptr<Timer> timer_;
|
|
||||||
|
|
||||||
std::shared_ptr<SimulationOutput> output_;
|
|
||||||
std::shared_ptr<CpuSynchronizer> cpu_synchronizer_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SIMULATION_H */
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#ifndef SPECIES_H
|
|
||||||
#define SPECIES_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "simulation/parameter.h"
|
|
||||||
|
|
||||||
class Mover;
|
|
||||||
class Terminator;
|
|
||||||
class Reflector;
|
|
||||||
class Injector;
|
|
||||||
class DensityField;
|
|
||||||
class DynamicDensityField;
|
|
||||||
class ConstantDensityField;
|
|
||||||
class DeletionLogger;
|
|
||||||
class CurrentCollector;
|
|
||||||
class VelocityDistribution;
|
|
||||||
class DriftVelocity;
|
|
||||||
|
|
||||||
namespace interaction {
|
|
||||||
class Interaction;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace species {
|
|
||||||
|
|
||||||
enum class ImplementedSpecies { T2, electron, Tplus, T2plus, T3plus };
|
|
||||||
|
|
||||||
class Specie {
|
|
||||||
public:
|
|
||||||
Specie(ImplementedSpecies type,
|
|
||||||
std::string name,
|
|
||||||
double mass_kg,
|
|
||||||
double charge_C);
|
|
||||||
|
|
||||||
double mass_kg() const;
|
|
||||||
double charge_C() const;
|
|
||||||
ImplementedSpecies type() const;
|
|
||||||
std::string name() const;
|
|
||||||
|
|
||||||
virtual DensityField* densityField() = 0;
|
|
||||||
virtual VelocityDistribution* velocityDistibution() = 0;
|
|
||||||
virtual DriftVelocity* driftVelocity() = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const double mass_kg_;
|
|
||||||
const double charge_C_;
|
|
||||||
const ImplementedSpecies type_;
|
|
||||||
const std::string name_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TrackedSpecie : public Specie {
|
|
||||||
public:
|
|
||||||
TrackedSpecie(ImplementedSpecies type,
|
|
||||||
std::string name,
|
|
||||||
double mass_kg,
|
|
||||||
double charge_C,
|
|
||||||
std::shared_ptr<Mover> mover,
|
|
||||||
std::shared_ptr<Terminator> terminator,
|
|
||||||
std::shared_ptr<Reflector> reflector,
|
|
||||||
std::shared_ptr<DynamicDensityField> density_field,
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity);
|
|
||||||
|
|
||||||
DensityField* densityField();
|
|
||||||
VelocityDistribution* velocityDistibution();
|
|
||||||
DriftVelocity* driftVelocity();
|
|
||||||
|
|
||||||
DynamicDensityField* dynamicDensityField();
|
|
||||||
Mover* mover();
|
|
||||||
Terminator* terminator();
|
|
||||||
Reflector* reflector();
|
|
||||||
|
|
||||||
DeletionLogger* deletionLogger();
|
|
||||||
void deletionLogger(std::shared_ptr<DeletionLogger> new_logger);
|
|
||||||
|
|
||||||
CurrentCollector* currentCollector();
|
|
||||||
void currentCollector(std::shared_ptr<CurrentCollector> new_collector);
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions();
|
|
||||||
void addInteraction(std::shared_ptr<interaction::Interaction> interaction);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<DynamicDensityField> density_field_;
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution_;
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity_;
|
|
||||||
|
|
||||||
std::shared_ptr<Mover> mover_;
|
|
||||||
std::shared_ptr<Terminator> terminator_;
|
|
||||||
std::shared_ptr<Reflector> reflector_;
|
|
||||||
|
|
||||||
std::shared_ptr<DeletionLogger> deletion_logger_;
|
|
||||||
std::shared_ptr<CurrentCollector> current_collector_;
|
|
||||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BackgroundSpecie : public Specie {
|
|
||||||
public:
|
|
||||||
BackgroundSpecie(ImplementedSpecies type,
|
|
||||||
std::string name,
|
|
||||||
double mass_kg,
|
|
||||||
double charge_C,
|
|
||||||
std::shared_ptr<ConstantDensityField> density_field,
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity);
|
|
||||||
|
|
||||||
DensityField* densityField();
|
|
||||||
VelocityDistribution* velocityDistibution();
|
|
||||||
DriftVelocity* driftVelocity();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<ConstantDensityField> density_field_;
|
|
||||||
std::shared_ptr<VelocityDistribution> velocity_distribution_;
|
|
||||||
std::shared_ptr<DriftVelocity> drift_velocity_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace species
|
|
||||||
|
|
||||||
#endif /* SPECIES_H */
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifndef TERMINATOR_H
|
|
||||||
#define TERMINATOR_H
|
|
||||||
|
|
||||||
#include "simulation/particle.h"
|
|
||||||
|
|
||||||
class Geometry;
|
|
||||||
|
|
||||||
class Terminator {
|
|
||||||
public:
|
|
||||||
Terminator(long int max_interactions,
|
|
||||||
double max_time_alive,
|
|
||||||
std::shared_ptr<Geometry> geometry);
|
|
||||||
|
|
||||||
bool isAlive(const particle::Particle* particle) const;
|
|
||||||
bool leftSimulationDomain(const particle::Particle* particle) const;
|
|
||||||
bool reachedMaxInteractions(const particle::Particle* particle) const;
|
|
||||||
bool reachedMaxTimeAlive(const particle::Particle* particle) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const long int max_interactions_;
|
|
||||||
const double max_time_alive_;
|
|
||||||
std::shared_ptr<Geometry> geometry_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TERMINATOR_H */
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef TIMER_H
|
|
||||||
#define TIMER_H
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class Timer {
|
|
||||||
public:
|
|
||||||
Timer();
|
|
||||||
|
|
||||||
double time() const;
|
|
||||||
void increaseTimestep(double time_s);
|
|
||||||
void setTime(double time_s);
|
|
||||||
|
|
||||||
private:
|
|
||||||
double current_time_s_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TIMER_H */
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#ifndef TRITIUM_SPECTRUM_H
|
|
||||||
#define TRITIUM_SPECTRUM_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
std::function<double(double)> tritiumDecayEnergySpectrum(double prefactor);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* TRITIUM_SPECTRUM_H */
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef UNIT_CONVERTER_H
|
|
||||||
#define UNIT_CONVERTER_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace unitConvertion {
|
|
||||||
|
|
||||||
double length(double value,
|
|
||||||
const std::string& unit_from,
|
|
||||||
const std::string& unit_to);
|
|
||||||
|
|
||||||
double lengthPrefactor(const std::string& unit);
|
|
||||||
|
|
||||||
double energy(double value,
|
|
||||||
const std::string& unit_from,
|
|
||||||
const std::string& unit_to);
|
|
||||||
double energyPrefactor(const std::string& unit);
|
|
||||||
|
|
||||||
}; // namespace unitConvertion
|
|
||||||
|
|
||||||
#endif /* UNIT_CONVERTER_H */
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#ifndef VECTOR_FIELD_H
|
|
||||||
#define VECTOR_FIELD_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include "blitz/array.h"
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
#include "simulation/position_binning.h"
|
|
||||||
|
|
||||||
class VectorField {
|
|
||||||
public:
|
|
||||||
virtual CylinderVector value(const Coordinate& coordinate) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VectorFieldFromArray : public VectorField {
|
|
||||||
public:
|
|
||||||
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);
|
|
||||||
|
|
||||||
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_;
|
|
||||||
|
|
||||||
CylinderBinning binning_;
|
|
||||||
CylinderVector value(const blitz::TinyVector<int, 3>& bin) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VectorFieldConstant : public VectorField {
|
|
||||||
public:
|
|
||||||
VectorFieldConstant(const CylinderVector& constant);
|
|
||||||
CylinderVector value(const Coordinate& coordinate) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const CylinderVector constant_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VectorFieldFunctionInZ : public VectorField {
|
|
||||||
public:
|
|
||||||
VectorFieldFunctionInZ(std::function<double(double, double, double)> v_z);
|
|
||||||
CylinderVector value(const Coordinate& coordinate) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<double(double, double, double)> F_z_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* VECTOR_FIELD_H */
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef VELOCITY_DISTRIBUTION_H
|
|
||||||
#define VELOCITY_DISTRIBUTION_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
class VelocityDistributionFunction;
|
|
||||||
|
|
||||||
class VelocityDistribution {
|
|
||||||
public:
|
|
||||||
virtual CartesianVector rollVelocity(const Coordinate& position,
|
|
||||||
std::mt19937* engine) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VelocityDistributionFromFunction : public VelocityDistribution {
|
|
||||||
public:
|
|
||||||
VelocityDistributionFromFunction(
|
|
||||||
std::shared_ptr<VelocityDistributionFunction> fv);
|
|
||||||
|
|
||||||
CartesianVector rollVelocity(const Coordinate& position,
|
|
||||||
std::mt19937* engine);
|
|
||||||
|
|
||||||
private:
|
|
||||||
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 */
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#ifndef VELOCITY_DISTRIBUTION_FUNCTION_H
|
|
||||||
#define VELOCITY_DISTRIBUTION_FUNCTION_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
#include "simulation/coordinates.h"
|
|
||||||
|
|
||||||
class EnergyDistributionFunction;
|
|
||||||
|
|
||||||
class VelocityDistributionFunction {
|
|
||||||
public:
|
|
||||||
virtual CartesianVector rollVelocity(std::mt19937* engine) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IsotropicDistribution : public VelocityDistributionFunction {
|
|
||||||
public:
|
|
||||||
IsotropicDistribution(std::shared_ptr<EnergyDistributionFunction> f_E,
|
|
||||||
double mass_kg);
|
|
||||||
CartesianVector rollVelocity(std::mt19937* engine);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<EnergyDistributionFunction> f_E_;
|
|
||||||
const double mass_kg_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DirectedDistribution : public VelocityDistributionFunction {
|
|
||||||
public:
|
|
||||||
DirectedDistribution(std::shared_ptr<EnergyDistributionFunction> f_E,
|
|
||||||
double mass_kg,
|
|
||||||
const CartesianVector& direction);
|
|
||||||
CartesianVector rollVelocity(std::mt19937* engine);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<EnergyDistributionFunction> f_E_;
|
|
||||||
const blitz::TinyVector<double, 3> direction_normal_;
|
|
||||||
const double mass_kg_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* VELOCITY_DISTRIBUTION_FUNCTION_H */
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef SIMULATION_TIME_H
|
|
||||||
#define SIMULATION_TIME_H
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
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 SimulationTimer {
|
|
||||||
public:
|
|
||||||
static void eventStartPoint(std::string event_name);
|
|
||||||
static void eventStopPoint(std::string event_name);
|
|
||||||
static void printDurations();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static std::map<std::string, TimerEvent> timed_events_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SIMULATION_TIME_H */
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user