Prepare code for publication

This commit is contained in:
Jonas Kellerer
2022-11-11 13:48:04 +01:00
parent 71dc3f4ada
commit b7a65dd8fe
25 changed files with 2030 additions and 731 deletions
+3 -9
View File
@@ -1,17 +1,15 @@
# Debugging
DO_DEBUGGING = true
DEBUG_LEVEL = 3
DO_DEBUGGING = false
DEBUG_LEVEL = 0
# Timer
USE_TIMER = true
USE_TIMER = false
# Catch
CATCH_DIR = $(HOMEBASE)/external/catch
CATCH_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/
@@ -20,8 +18,6 @@ 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/
@@ -30,8 +26,6 @@ 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
+34
View File
@@ -0,0 +1,34 @@
{
"DriftVelocity1": {
"DriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"Constant": {
"constant": 1
}
}
}
}
}
}
}
},
"DriftVelocity2": {
"null": {}
}
}
@@ -0,0 +1,20 @@
{
"EnergyDistributionFunction1": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"EnergyDistributionFunction2": {
"TritiumBetaDecay": {}
},
"EnergyDistributionFunction3": {
"Constant": {
"constant": {
"value": 1
}
}
}
}
+74
View File
@@ -0,0 +1,74 @@
{
"Functions": {
"1Dto1D examples": {
"f1": {
"PiecewiseLinear": {
"xValues": [0, 1.43, 3],
"yValues": [5E-4, 0.002, 0.02],
"prefactor": 1
}
},
"f2": {
"Constant": {
"constant": 1
}
},
"f3": {
"Product": [
{
"Constant": {
"constant": 2
}
},
{
"Constant": {
"constant": 3
}
}
]
},
"f4": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "path/relative",
"Filename": "data.h5"
},
"xValuesKey": "/xvalues",
"yValuesKey": "/yvalues",
"prefactor": 1
}
},
"f5": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "AbsolutPath",
"RelativePath": "/some/absolut/path",
"Filename": "data.h5"
},
"xValuesKey": "/xvalues",
"yValuesKey": "/yvalues",
"prefactor": 1
}
}
},
"3dto1D examples": {
"f1": {
"Constant3D": {
"constant": 2
}
},
"f2": {
"Product": {
"fi": { "Constant": {"constant": 2 }},
"fj": { "Constant": {"constant": 2 }},
"fk": { "PiecewiseLinear": {
"xValues": [0, 1.43, 3],
"yValues": [5E-4, 0.002, 0.02],
"prefactor": 1 }
}
}
}
}
}
}
+214
View File
@@ -0,0 +1,214 @@
{
"e- standart interactions":
{
"elastic_example1": {
"Type": "ElasticScattering",
"Target": "T2",
"CrossSection": {
"PredefinedFunction": "eT2_elastic_scattering"
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"elastic_example2": {
"Type": "ElasticScattering",
"Target": "T2",
"CrossSection": {
"1dFunction": {
"Constant":{
"constant": 1E-20
}
}
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"ionization_example1": {
"Type": "ElectronIonization",
"IonizationModel": "JanevNonDiss",
"Target": "T2",
"OutgoingElectron": "e-",
"OutgoingIon": "T2+"
},
"ionization_example2": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToGround",
"Target": "T2",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
},
"ionization_example3": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToFirstExcited",
"Target": "T2",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
},
"excitation_example0": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_B1"
},
"excitation_example1": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_B1prime"
},
"excitation_example2": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_B1primeprime"
},
"excitation_example3": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_C1"
},
"excitation_example4": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_D1"
},
"excitation_example5": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_D1prime"
},
"excitation_example6": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_symmetry_forbidden_EF1"
},
"excitation_example7": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_symmetry_forbidden_HHb"
},
"excitation_example8": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_symmetry_forbidden_GK1"
},
"excitation_example9": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_singlet_symmetry_forbidden_I1"
},
"excitation_example10": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_triplet_A3"
},
"excitation_example11": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_triplet_B3"
},
"excitation_example12": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_triplet_C3"
},
"excitation_example13": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_triplet_E3"
},
"excitation_example14": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_triplet_D3"
},
"excitation_example15": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_vibrational_first"
},
"excitation_example16": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "janev_vibrational_second"
},
"excitation_example17": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "england_rotational_j0_to_j2"
},
"excitation_example18": {
"Type": "Excitation",
"Target": "T2",
"ExcitationState": "england_rotational_j1_to_j3"
},
"free_movement_example": {
"Type": "FreeMovement"
}
},
"T+ standart interactions": {
"elasitc scattering": {
"Type": "ElasticScattering",
"Target": "T2",
"CrossSection": {
"PredefinedFunction": "TpT2_elasitc_scattering_tabata"
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"clustering1": {
"Type": "Clustering",
"Target": "T2",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "TpT2_clustering_radiative_ascendion_pasil"
}
},
"clustering2": {
"Type": "Clustering",
"Target": "T2",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
},
"T2+ standart interactions": {
"charge exchange": {
"Type": "ChargeExchange",
"Target": "T2",
"CrossSection": {
"PredefinedFunction": "T2pT2_charge_exchange_janev"
}
},
"clustering": {
"Type": "Clustering",
"Target": "T2",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "T2pT2_clustering_janev"
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
},
"T3+ standart interactions":{
"elastic scattering": {
"Type": "ElasticScattering",
"Target": "T2",
"CrossSection": {
"PredefinedFunction": "T3pT2_elasitc_scattering_tabata"
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"MoverExample1":{
"Boris": {
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"MoverExample2":{
}
}
+841
View File
@@ -0,0 +1,841 @@
{
"GlobalPositionBinning": {
"CylinderBinning": {
"Radial": {
"NumberOfBins": 15,
"MaxRadius": {
"value": 4.5,
"unit": "cm"
}
},
"Longitudinal": {
"NumberOfBins": 1657,
"MaxLength": {
"value": 1657,
"unit": "cm"
}
},
"Azimuthal": {
"NumberOfBins": 4
}
}
},
"SourceGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
},
"Species": {
"Background": {
"TritiumGas": {
"ParticleType": "T2",
"ConstantDensityField": {
"ScalarField": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/densityDistributions/T2",
"Filename": "T2_n_vs_z_kuckert_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)",
"prefactor": 1E20
}
}
}
}
}
}
},
"VelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
},
"DriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocityDistributions/T2_vz/KuckertPaper",
"Filename": "T2_vz_vs_z_kuckert_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/vz(ms)",
"prefactor": 1
}
}
}
}
}
}
}
}
},
"Tracked": {
"e-": {
"ParticleType": "electron",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-12,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
},
"Reflector": {
"ReflectorDPS": {
"position_z": {
"value": 1657,
"unit": "cm"
}
}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 20E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"elastic": {
"Type": "ElasticScattering",
"Target": "TritiumGas",
"CrossSection": {
"PredefinedFunction": "eT2_elastic_scattering"
},
"ScatteringAngleDistribution": {
"CompositeAngleDistribution": {
"LowerDistribution": {
"Isotropic": {}
},
"HigherDistribution": {
"AngleDistributionFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/crossSections/eT2_elastic_scattering",
"Filename": "eT2_elastic_cross_section_scattering_angle.h5"
}
}
},
"DeciderEnergy": {
"value": 10,
"unit": "eV"
}
}
}
},
"ionization1": {
"Type": "ElectronIonization",
"IonizationModel": "JanevNonDiss",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T2+"
},
"ionization2": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToGround",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
},
"ionization3": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToFirstExcited",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
},
"excitation0": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_B1"
},
"excitation1": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_B1prime"
},
"excitation2": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_B1primeprime"
},
"excitation3": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_C1"
},
"excitation4": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_D1"
},
"excitation5": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_D1prime"
},
"excitation6": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_symmetry_forbidden_EF1"
},
"excitation7": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_symmetry_forbidden_HHb"
},
"excitation8": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_symmetry_forbidden_GK1"
},
"excitation9": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_singlet_symmetry_forbidden_I1"
},
"excitation10": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_triplet_A3"
},
"excitation11": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_triplet_B3"
},
"excitation12": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_triplet_C3"
},
"excitation13": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_triplet_E3"
},
"excitation14": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_triplet_D3"
},
"excitation15": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_vibrational_first"
},
"excitation16": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "janev_vibrational_second"
},
"excitation17": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "england_rotational_j0_to_j2"
},
"excitation18": {
"Type": "Excitation",
"Target": "TritiumGas",
"ExcitationState": "england_rotational_j1_to_j3"
}
}
},
"T2+": {
"ParticleType": "T2+",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
},
"Reflector": {
"NoReflector": {}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 1E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"charge exchange": {
"Type": "ChargeExchange",
"Target": "TritiumGas",
"CrossSection": {
"PredefinedFunction": "T2pT2_charge_exchange_janev"
}
},
"clustering": {
"Type": "Clustering",
"Target": "TritiumGas",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "T2pT2_clustering_janev"
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
}
},
"T+": {
"ParticleType": "T+",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
},
"Reflector": {
"NoReflector": {}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 1E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"elasitc scattering": {
"Type": "ElasticScattering",
"Target": "TritiumGas",
"CrossSection": {
"PredefinedFunction": "TpT2_elasitc_scattering_tabata"
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"clustering1": {
"Type": "Clustering",
"Target": "TritiumGas",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "TpT2_clustering_radiative_ascendion_pasil"
}
},
"clustering2": {
"Type": "Clustering",
"Target": "TritiumGas",
"Product": "T3+",
"CrossSection": {
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
}
},
"T3+": {
"ParticleType": "T3+",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
},
"Reflector": {
"NoReflector": {}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 1E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"elastic scattering": {
"Type": "ElasticScattering",
"Target": "TritiumGas",
"CrossSection": {
"PredefinedFunction": "T3pT2_elasitc_scattering_tabata"
},
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"free_movement_example": {
"Type": "FreeMovement"
}
}
}
}
},
"Injector": {
"CreatedSpecies": {
"specie1": {
"TrackedSpecieName": "e-",
"CreationVelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"TritiumBetaDecay": {}
},
"Mass": {
"FromParticleType": "electron"
}
}
}
}
}
},
"specie2": {
"TrackedSpecieName": "T2+",
"CreationVelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
}
}
},
"EventPositionDistribution": {
"ScalarField": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/densityDistributions/T2",
"Filename": "T2_n_vs_z_kuckert_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)",
"prefactor": 1
}
}
}
}
}
},
"DensityLimit": {
"min": 0,
"max": 1
},
"PositionLimits": {
"rPosition": {
"min": 0,
"max": 0.045
},
"phiPosition": {
"min": 0,
"max": 6.28318530718
},
"zPosition": {
"min": 0,
"max": 16.57
}
}
},
"MotherDriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocityDistributions/T2_vz/KuckertPaper",
"Filename": "T2_vz_vs_z_kuckert_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/vz(ms)",
"prefactor": 1
}
}
}
}
}
}
},
"Activity": {
"value": 1E15,
"unit": "Bq"
}
},
"ElectricField": {
"Background": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
},
"Dynamic": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
}
},
"MagneticField": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/magneticField/Kassiopeia",
"Filename": "B_vs_z_kassiopeia_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/B(T)",
"prefactor": 1
}
}
}
}
},
"PoissonSolver": {
"UseInSimulation": "false"
},
"Simulation": {
"SimulatedEvents": 1000000,
"EventStride": 10
},
"Output": {
"folder": "output",
"filename": "karl_output",
"DensityFields": {
"Species": "all",
"Intervall": 1,
"OverwriteLast": "true"
},
"CurrentBorders": {
"Species": "all",
"Intervall": "EachSync",
"OverwriteLast": "true"
},
"DeletionLogger": {
"Species": "all",
"Intervall": "EachSync",
"OverwriteLast": "true"
}
},
"RandomNumbers": {
"Seed": 1337
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"ReflectorExample1": {
"Reflector": {
"ReflectorDPS": {
"position_z": {
"value": 1657,
"unit": "cm"
}
}
}
},
"ReflectorExample2": {
"Reflector": {
"NoReflector": {}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"Example1": {
"Reflector": {
"NoReflector": {}
}
},
"Example2": {
"ReflectorDPS": {
"position_z": {
"value": 1600,
"unit": "cm"
}
}
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"ScalarFields": {
"field1": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
}
}
}
+44
View File
@@ -0,0 +1,44 @@
{
"Distribution1": {
"Isotropic": {}
},
"Distribution2": {
"AngleDistributionFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocity/distributions",
"Filename": "drift_velocity.h5"
}
}
},
"Distribution3":{
"AngleDistributionFromFile": {
"PathToH5": {
"Type": "AbsolutePath",
"AbsoluteFolderPath": "/data/velocity/distributions",
"Filename": "drift_velocity.h5"
}
}
},
"Distribution4": {
"CompositeAngleDistribution": {
"LowerDistribution": {
"Isotropic": {}
},
"HigherDistribution": {
"AngleDistributionFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocity/distributions",
"Filename": "drift_velocity.h5"
}
}
},
"DeciderEnergy": {
"value": 10,
"unit": "eV"
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"TerminatorExample1": {
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
}
}
}
+607
View File
@@ -0,0 +1,607 @@
{
"GlobalPositionBinning": {
"CylinderBinning": {
"Radial": {
"NumberOfBins": 15,
"MaxRadius": {
"value": 4.5,
"unit": "cm"
}
},
"Longitudinal": {
"NumberOfBins": 160,
"MaxLength": {
"value": 1600,
"unit": "cm"
}
},
"Azimuthal": {
"NumberOfBins": 4
}
}
},
"SourceGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
},
"Species": {
"Background": {
"TritiumGas": {
"ParticleType": "T2",
"ConstantDensityField": {
"ScalarField": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinear": {
"xValues": [
0,
1.43,
3,
8,
13,
14.57,
16
],
"yValues": [
5E-4,
0.002,
0.02,
1,
0.02,
0.002,
5E-4
],
"prefactor": 1E20
}
}
}
}
}
}
},
"VelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
},
"DriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinear": {
"xValues": [
0,
7.99,
8.01,
16
],
"yValues": [
-100,
-100,
100,
100
],
"prefactor": 1
}
}
}
}
}
}
}
}
},
"Tracked": {
"e-": {
"ParticleType": "electron",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-12,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
}
},
"Reflector": {
"ReflectorDPS": {
"position_z": {
"value": 1600,
"unit": "cm"
}
}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 20E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"elastic": {
"Type": "ElasticScattering",
"CrossSection": {
"PredefinedFunction": "eT2_elastic_scattering_constant"
},
"Target": "TritiumGas",
"ScatteringAngleDistribution": {
"Isotropic": {}
}
},
"janev_non_diss": {
"Type": "ElectronIonization",
"IonizationModel": "JanevNonDiss",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T2+"
},
"janev_diss_to_ground": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToGround",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
},
"janev_diss_to_first_excited": {
"Type": "ElectronIonization",
"IonizationModel": "JanevDissToFirstExcited",
"Target": "TritiumGas",
"OutgoingElectron": "e-",
"OutgoingIon": "T+"
}
}
},
"T2+": {
"ParticleType": "T2+",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
}
},
"Reflector": {
"NoReflector": {}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 1E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"name1": {
"Type": "FreeMovement"
}
}
},
"T+": {
"ParticleType": "T+",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
}
},
"Reflector": {
"NoReflector": {}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 1E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"name1": {
"Type": "FreeMovement"
}
}
}
}
},
"Injector": {
"CreatedSpecies": {
"specie1": {
"TrackedSpecieName": "e-",
"CreationVelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"TritiumBetaDecay": {}
},
"Mass": {
"FromParticleType": "electron"
}
}
}
}
}
},
"specie2": {
"TrackedSpecieName": "T2+",
"CreationVelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
}
}
},
"EventPositionDistribution": {
"ScalarField": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinear": {
"xValues": [
0,
1.43,
3,
8,
13,
14.57,
16
],
"yValues": [
5E-4,
0.002,
0.02,
1,
0.02,
0.002,
5E-4
],
"prefactor": 1E15
}
}
}
}
}
},
"DensityLimit": {
"min": 0,
"max": 1E15
},
"PositionLimits": {
"rPosition": {
"min": 0,
"max": 0.045
},
"phiPosition": {
"min": 0,
"max": 6.28318530718
},
"zPosition": {
"min": 0,
"max": 16.0
}
}
},
"MotherDriftVelocity": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "m/s"
}
}
},
"Activity": {
"value": 1E15,
"unit": "Bq"
}
},
"ElectricField": {
"Background": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
},
"Dynamic": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
}
},
"MagneticField": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2.5
}
}
}
}
},
"PoissonSolver": {
"UseInSimulation": "false"
},
"Simulation": {
"SimulatedEvents": 1,
"EventStride": 1
},
"Output": {
"folder": "output",
"filename": "test",
"DensityFields": {
"Species": "all",
"Intervall": 1,
"OverwriteLast": "true"
},
"CurrentBorders": {
"Species": [
"e-",
"T2+"
],
"Intervall": "EachSync",
"OverwriteLast": "true"
},
"DeletionLogger": {
"Species": [
"all"
],
"Intervall": "EachSync",
"OverwriteLast": "true"
}
},
"RandomNumbers": {
"Seed": 1337
}
}
+52
View File
@@ -0,0 +1,52 @@
{
"VectorFields": {
"field1": {
"VectorFieldConstant": {
"Constant": {
"vector": [
1,
2,
3
]
}
}
},
"field2": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
},
"field3": {
"VectorFieldFromArray": {
"ReadArrayFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "path/relative",
"Filename": "filename.h5"
},
"Keys": ["/vr", "/vphi", "/vz"]
},
"Radius": 0.045,
"Length": 16
}
}
},
"field4": {
"VectorFieldFromArray": {
"ReadArrayFromFile": {
"PathToH5": {
"Type": "AbsolutePath",
"AbsoluteFolderPath": "/path/absolut",
"Filename": "gilesabe.h5"
},
"Keys": ["/vr", "/vphi", "/vz"]
},
"Radius": 0.045,
"Length": 16
}
}
}
@@ -0,0 +1,35 @@
{
"VelocityDistributionFunction1": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
},
"VelocityDistributionFunction2": {
"DirectedDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Direction": {
"vector": [0,0,1]
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"VelocityDistribution 1": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
},
"VelocityDistribution2": {
"null" : {}
}
}
+1 -35
View File
@@ -53,14 +53,10 @@ ifeq ($(DO_DEBUGGING),true)
CXXFLAGS += -Ddebug_level$(DEBUG_LEVEL)
endif
# Catch2
CXXFLAGS += $(CATCH_INCLUDES)
ifeq ($(USE_TIMER),true)
CXXFLAGS += -DTIMER
endif
CXXFLAGS_TEST = $(CXXFLAGS)
# Sources
SRC_SUBDIRS = $(foreach sdir, $(SUB_DIRS), $(wildcard $(sdir)/*.cpp))
@@ -68,20 +64,16 @@ SRC_SUBDIRS = $(foreach sdir, $(SUB_DIRS), $(wildcard $(sdir)/*.cpp))
SOURCES = $(SRC_DIR)/main.cpp
SOURCES += $(SRC_SUBDIRS)
SOURCES_TEST = $(wildcard $(TEST_DIR)/*.cpp) $(SRC_SUBDIRS)
# Objects
OBJECTS=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES:.cpp=.o)) )
OBJECTS_TEST=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES_TEST:.cpp=.o)) )
# Target
# put the exe file in bin/
TARGET=$(BIN_DIR)/karl
TARGET_TEST=$(BIN_DIR)/karl_test
# Compile logic
all: blitz hdf5 jansson karl
all: karl
check_homebase:
ifeq ($(HOMEBASE),)
@@ -96,25 +88,8 @@ ifneq ($(IS_ABSPATH), yes)
@exit 1
endif
blitz: check_homebase
ifeq ($(MAKE_BLITZ), true)
$(MAKE) -C external/blitz
$(MAKE) -C external/blitz install
endif
hdf5: check_homebase
ifeq ($(MAKE_H5), true)
$(MAKE) -C external/h5
endif
jansson: check_homebase
ifeq ($(MAKE_JANSSON), true)
$(MAKE) -C external/jansson
endif
karl: check_abspath check_homebase $(TARGET)
test: check_abspath check_homebase $(TARGET_TEST)
$(TARGET): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS)
$(CXX) $(OBJECTS) $(LIBS) -o $(TARGET)
@@ -122,12 +97,6 @@ $(TARGET): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS)
@echo "Linking done"
@echo
$(TARGET_TEST): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS_TEST)
@echo "Start linking"
$(CXX) $(OBJECTS_TEST) $(LIBS) -o $(TARGET_TEST)
@echo
@echo "Linking done"
@echo
$(BIN_DIR):
@mkdir -p $(BIN_DIR)
@@ -176,9 +145,6 @@ $(BUILD_DIR)/%.o : $(SRC_DIR)/tools/%.cpp
@echo
$(CXX) $(CXXFLAGS) $< -c -o $@
$(BUILD_DIR)/%.o : $(TEST_DIR)/%.cpp
@echo "Create $@ from $<"
$(CXX) $(CXXFLAGS_TEST) $< -c -o $@
# All build instructions for all src cpp are put here
$(BUILD_DIR)/main.o : $(SRC_DIR)/main.cpp
-1
View File
@@ -45,7 +45,6 @@ InteractionOutput ElasticScattering::performInteraction(
phi);
particle.velocity(CartesianVector(v_impact_new));
// no Gyrocentrum movement because boris push is used;
return InteractionOutput();
}
-26
View File
@@ -1,26 +0,0 @@
#include "blitz/array.h"
#include "catch.hpp"
#include "generators/binning_generator.h"
#include "simulation/parameter.h"
TEST_CASE("Binning Generator", "[BinningGenerator]") {
SECTION("EnergyBinning") {
std::string filename = "simulation_config/test_parameter.json";
Parameter p(filename);
GIVEN("An parameter file") {
json_path path_to_binning = {"Binning"};
EnergyBinning energy =
generator::buildEnergyBinningIncludingRedirection(p, path_to_binning);
THEN("The correct lower bin is set") {
REQUIRE(energy.bin(1.1E-6) == 0);
REQUIRE(energy.bin(1.0E-7) == -1);
}
THEN("The correct upper bin is set") {
REQUIRE(energy.bin(16000) == energy.numBins() - 1);
REQUIRE(energy.bin(21E4) == energy.numBins());
}
}
}
}
-66
View File
@@ -1,66 +0,0 @@
#include "catch.hpp"
#include "simulation/coordinates.h"
TEST_CASE("Coordinates", "[Coordinates]") {
SECTION("Cartesian Coordinates") {
WHEN("A cartesian Cordinate is created") {
blitz::TinyVector<double, 3> c_blitz(0., 1., 3.);
CartesianCoordinate c(c_blitz);
THEN("The correct cartesian entries can be reported") {
REQUIRE(c.cartesianEntries()[0] == c_blitz(0));
REQUIRE(c.cartesianEntries()[1] == c_blitz(1));
REQUIRE(c.cartesianEntries()[2] == c_blitz(2));
}
THEN("The correct cylinder entries can be reported") {
REQUIRE(c.cylinderEntries()[0] == 1.);
REQUIRE(c.cylinderEntries()[1] == M_PI / 2.);
REQUIRE(c.cylinderEntries()[2] == c_blitz(2));
}
}
WHEN("A cordinate is added to itself") {
blitz::TinyVector<double, 3> c_blitz(0., 1., 3.);
CartesianCoordinate c(c_blitz);
c.add(c);
THEN("double the original cartesian entries are reported") {
REQUIRE(c.cartesianEntries()[0] == 2 * c_blitz(0));
REQUIRE(c.cartesianEntries()[1] == 2 * c_blitz(1));
REQUIRE(c.cartesianEntries()[2] == 2 * c_blitz(2));
}
}
}
SECTION("Cylinder Coordinates") {
WHEN("A cylinder Cordinate is created") {
blitz::TinyVector<double, 3> c_blitz(1., M_PI / 2., 3.);
CylinderCoordinate c(c_blitz);
THEN("The correct cylinder entries can be reported") {
REQUIRE(c.cylinderEntries()[0] == c_blitz(0));
REQUIRE(c.cylinderEntries()[1] == c_blitz(1));
REQUIRE(c.cylinderEntries()[2] == c_blitz(2));
}
THEN("The correct cartesian entries can be reported") {
REQUIRE(c.cartesianEntries()[0] == Approx(0).margin(0.0001));
REQUIRE(c.cartesianEntries()[1] == Approx(1.));
REQUIRE(c.cartesianEntries()[2] == c_blitz(2));
}
}
WHEN("A cordinate is added to itself") {
blitz::TinyVector<double, 3> c_blitz(1., 3 * M_PI / 2., 3.);
CylinderCoordinate c(c_blitz);
c.add(c);
THEN(
"double the original cartesian entries are reported, exept in "
"angle") {
REQUIRE(c.cylinderEntries()[0] == 2 * c_blitz(0));
REQUIRE(c.cylinderEntries()[1] == Approx(M_PI));
REQUIRE(c.cylinderEntries()[2] == 2 * c_blitz(2));
}
}
}
}
-67
View File
@@ -1,67 +0,0 @@
#include "catch.hpp"
#include "generators/function_generator.h"
#include "simulation/parameter.h"
TEST_CASE("Function Generator", "[FunctionGenerator]") {
SECTION("function1D") {
std::string filename = "simulation_config/test_parameter.json";
Parameter p(filename);
GIVEN("An parameter file and a path to a piecewise linear function") {
json_t* obj = p.jsonObjectFromBase({"Functions", "1Dto1D", "f1"});
THEN("the correct function is created") {
std::function<double(double)> pw = generator::function1D(obj);
REQUIRE(pw(-1) == 5E-4);
REQUIRE(pw(3) == 0.02);
}
}
GIVEN("An parameter file and a path to a constant function") {
json_t* obj = p.jsonObjectFromBase({"Functions", "1Dto1D", "f2"});
THEN("the correct function is created") {
std::function<double(double)> co = generator::function1D(obj);
REQUIRE(co(-1) == 1.);
REQUIRE(co(3) == 1.);
}
}
GIVEN("An parameter file and a path to a product function") {
json_t* obj = p.jsonObjectFromBase({"Functions", "1Dto1D", "f3"});
THEN("the correct function is created") {
std::function<double(double)> product = generator::function1D(obj);
REQUIRE(product(-1) == 6);
REQUIRE(product(3) == 6);
}
}
}
SECTION("function3D") {
std::string filename = "simulation_config/test_parameter.json";
Parameter p(filename);
GIVEN("An parameter file and a path to a Constant function") {
json_t* obj = p.jsonObjectFromBase({"Functions", "3dto1D", "f1"});
THEN("the correct function is created") {
std::function<double(double, double, double)> co =
generator::function3D(obj);
REQUIRE(co(-1., 1., 0.) == 2.);
REQUIRE(co(0., 2., -1.) == 2);
}
}
GIVEN("An parameter file and a path to a Product function") {
json_t* obj = p.jsonObjectFromBase({"Functions", "3dto1D", "f2"});
THEN("the correct function is created") {
std::function<double(double, double, double)> product =
generator::function3D(obj);
REQUIRE(product(-1., 1., 0.) == 20E-4);
REQUIRE(product(0., 2., 3.) == 0.08);
}
}
}
}
-56
View File
@@ -1,56 +0,0 @@
#include "catch.hpp"
#include "functions/functions.h"
TEST_CASE("Functions Generator", "[Functions]") {
SECTION("D1ToD1") {
SECTION("PiecewiseLinear") {
GIVEN("A piecewise linear function") {
std::vector<double> positions = {0, 1, 2, 3};
std::vector<double> values = {-1, 1, 1, 2};
std::function<double(double)> pw =
D1ToD1::PiecewiseLinear(positions, values);
THEN("Positions below give last value") { REQUIRE(pw(-1) == -1); }
THEN("Positions above gile last value") { REQUIRE(pw(5) == 2); }
THEN("Positions at given values give given values") {
for (int i = 0; i < positions.size(); i++) {
REQUIRE(pw(positions[i]) == values[i]);
}
}
THEN("The points in between are calculated correctly") {
REQUIRE(pw(0.5) == 0);
REQUIRE(pw(1.5) == 1);
REQUIRE(pw(2.5) == 1.5);
}
}
}
SECTION("Constant") {
GIVEN("A constant function") {
const double constant = 1.;
std::function<double(double)> co = D1ToD1::Constant(constant);
THEN("The constant is given back for all values") {
REQUIRE(co(1.) == constant);
REQUIRE(co(0.4) == constant);
REQUIRE(co(-11.) == constant);
REQUIRE(co(1E4) == constant);
}
}
}
SECTION("Product") {
GIVEN("A function product") {
std::vector<double> positions = {0, 1, 2, 3};
std::vector<double> values = {-1, 1, 1, 2};
std::function<double(double)> pw =
D1ToD1::PiecewiseLinear(positions, values);
std::function<double(double)> prod = D1ToD1::Product({pw, pw});
THEN("The product of the functions is returned") {
for (int i = 0; i < positions.size(); i++) {
REQUIRE(prod(positions[i]) == pw(positions[i]) * pw(positions[i]));
}
}
}
}
}
}
-32
View File
@@ -1,32 +0,0 @@
#include "catch.hpp"
#include "IO/hdf5_reader.h"
#include "IO/hdf5_writer.h"
#include "simulation/homebase.h"
TEST_CASE("Hdf5", "[Hdf5]") {
SECTION("Reader and Writing the same data") {
std::string directory = BUILD_HOMEBASE_STRING + std::string("/test");
std::string filename = "test_output";
std::string absolute_filename = directory + filename;
Hdf5Writer writer(directory, filename);
Hdf5Reader reader(directory, filename);
SECTION("1d data") {
blitz::Array<double, 1> data(4);
data = 0.1, -0.1, 1.2, 3.0;
std::string path_1d = "/1d_double";
writer.write(data, path_1d);
blitz::Array<double, 1> read_data = reader.readD1Double(path_1d);
REQUIRE(read_data.size() == 4);
REQUIRE(read_data(0) == data(0));
REQUIRE(read_data(1) == data(1));
REQUIRE(read_data(2) == data(2));
REQUIRE(read_data(3) == data(3));
}
}
}
-5
View File
@@ -1,5 +0,0 @@
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
TEST_CASE("1: All tests cases reside in other .cpp files (empty)",
"[multi-file:1]") {}
-434
View File
@@ -1,434 +0,0 @@
{
"GlobalPositionBinning": {
"CylinderBinning": {
"Radial": {
"NumberOfBins": 15,
"MaxRadius": {
"value": 4.5,
"unit": "cm"
}
},
"Longitudinal": {
"NumberOfBins": 160,
"MaxLength": {
"value": 1600,
"unit": "cm"
}
},
"Azimuthal": {
"NumberOfBins": 4
}
}
},
"SourceGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
},
"Species": {
"Tracked": {
"e-": {
"ParticleType": "electron",
"Mover": {
"Boris": {
"BorisStepsPerMovementCylce": 10,
"MaximalTimestepLength": {
"value": 1E-12,
"unit": "s"
}
}
},
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1600,
"unit": "cm"
}
}
}
},
"Reflector": {
"ReflectorDPS": {
"position_z": {
"value": 1600,
"unit": "cm"
}
}
},
"DensityField": {
"DynamicDensityField": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
},
"EnergyBinning": {
"Type": "Logarithmic",
"NumberOfBins": 100,
"MinEnergy": {
"value": 1E-6,
"unit": "eV"
},
"MaxEnergy": {
"value": 20E3,
"unit": "eV"
}
}
}
},
"VelocityDistribution": {
"null": {}
},
"DriftVelocity": {
"null": {}
},
"Loggers": {
"Deletion": {
"Type": "all"
}
},
"CurrentCollector": {
"PositionBinning": {
"CreateSameAs": [
"GlobalPositionBinning"
]
}
},
"Interactions": {
"free": {
"Type": "FreeMovement"
}
}
}
}
},
"Injector": {
"CreatedSpecies": {
"specie1": {
"TrackedSpecieName": "e-",
"CreationVelocityDistribution": {
"VelocityDistributionFromFunction": {
"VelocityDistributionFunction": {
"DirectedDistribution": {
"EnergyDistributionFunction": {
"Constant": {
"constant": {
"value": 1,
"unit": "eV"
}
}
},
"Mass": {
"FromParticleType": "electron"
},
"Direction": {
"vector": [0,0,1]
}
}
}
}
}
}
},
"EventPositionDistribution": {
"ScalarField": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"PiecewiseLinear": {
"xValues": [
0,
1.43,
3,
8,
13,
14.57,
16
],
"yValues": [
5E-4,
0.002,
0.02,
1,
0.02,
0.002,
5E-4
],
"prefactor": 1E15
}
}
}
}
}
},
"DensityLimit": {
"min": 0,
"max": 1E15
},
"PositionLimits": {
"rPosition": {
"min": 0,
"max": 0.045
},
"phiPosition": {
"min": 0,
"max": 6.28318530718
},
"zPosition": {
"min": 8,
"max": 8.01
}
}
},
"MotherDriftVelocity": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "m/s"
}
}
},
"Activity": {
"value": 1E15,
"unit": "Bq"
}
},
"ElectricField": {
"Background": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
},
"Dynamic": {
"VectorField": {
"VectorFieldConstant": {
"constant": {
"vector": [
0,
0,
0
]
},
"unit": "V/m"
}
}
}
},
"MagneticField": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2.5
}
}
}
}
},
"PoissonSolver": {
"UseInSimulation": "false"
},
"Simulation": {
"SimulatedEvents": 1,
"EventStride": 1
},
"Output": {
"folder": "output",
"filename": "test",
"DensityFields": {
"Species": "all",
"Intervall": 1,
"OverwriteLast": "true"
},
"CurrentBorders": {
"Species": [
"e-",
"T2+"
],
"Intervall": "EachSync",
"OverwriteLast": "true"
},
"DeletionLogger": {
"Species": [
"all"
],
"Intervall": "EachSync",
"OverwriteLast": "true"
}
},
"RandomNumbers": {
"Seed": 1337
},
"Functions": {
"1Dto1D": {
"f1": {
"PiecewiseLinear": {
"xValues": [
0,
1.43,
3,
8,
13,
14.57,
16
],
"yValues": [
5E-4,
0.002,
0.02,
1,
0.02,
0.002,
5E-4
],
"prefactor": 1
}
},
"f2": {
"Constant": {
"constant": 1
}
},
"f3": {
"Product": [
{
"Constant": {
"constant": 2
}
},
{
"Constant": {
"constant": 3
}
}
]
}
},
"3dto1D": {
"f1": {
"Constant3D": {
"constant": 2
}
},
"f2": {
"Product": {
"fi": {
"Constant": {
"constant": 2
}
},
"fj": {
"Constant": {
"constant": 2
}
},
"fk": {
"PiecewiseLinear": {
"xValues": [
0,
1.43,
3,
8,
13,
14.57,
16
],
"yValues": [
5E-4,
0.002,
0.02,
1,
0.02,
0.002,
5E-4
],
"prefactor": 1
}
}
}
}
}
},
"VectorFields": {
"field1": {
"VectorFieldConstant": {
"Constant": {
"vector": [
1,
2,
3
]
}
}
},
"field2": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
},
"field3": {
"VectorFieldFromArray": {},
"stepSize": {
"SameAs": "Binning"
}
}
},
"ScalarFields": {
"field1": {
"ScalarFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
}
}
}