From b7a65dd8fe57e8896a0f7e80d7027092a7988375 Mon Sep 17 00:00:00 2001 From: Jonas Kellerer Date: Fri, 11 Nov 2022 13:48:04 +0100 Subject: [PATCH] Prepare code for publication --- config/config.mk | 12 +- .../interactions/drift_velocity_examples.json | 34 + ...energy_distribution_function_examples.json | 20 + include/interactions/function_examples.json | 74 ++ .../interactions/interactions_examples.json | 214 +++++ include/interactions/mover_examples.json | 13 + include/interactions/parameter_katrin.json | 841 ++++++++++++++++++ include/interactions/reflector_examples.json | 17 + include/interactions/reflectors_examples.json | 15 + .../interactions/scalar_fields_examples.json | 13 + .../scattering_angle_example.json | 44 + include/interactions/terminator_examples.json | 23 + include/interactions/test_parameter.json | 607 +++++++++++++ .../interactions/vector_field_examples.json | 52 ++ ...locity_distribution_function_examples.json | 35 + .../interactions/velocity_field_examples.json | 24 + makefile | 36 +- src/interactions/elastic_scattering.cpp | 1 - test/test_binning_generator.cpp | 26 - test/test_coordinates.cpp | 66 -- test/test_function_generator.cpp | 67 -- test/test_functions.cpp | 56 -- test/test_hdf.cpp | 32 - test/test_main.cpp | 5 - test/test_scripts/test_movement.json | 434 --------- 25 files changed, 2030 insertions(+), 731 deletions(-) create mode 100755 include/interactions/drift_velocity_examples.json create mode 100755 include/interactions/energy_distribution_function_examples.json create mode 100755 include/interactions/function_examples.json create mode 100755 include/interactions/interactions_examples.json create mode 100755 include/interactions/mover_examples.json create mode 100755 include/interactions/parameter_katrin.json create mode 100755 include/interactions/reflector_examples.json create mode 100755 include/interactions/reflectors_examples.json create mode 100755 include/interactions/scalar_fields_examples.json create mode 100755 include/interactions/scattering_angle_example.json create mode 100755 include/interactions/terminator_examples.json create mode 100755 include/interactions/test_parameter.json create mode 100755 include/interactions/vector_field_examples.json create mode 100755 include/interactions/velocity_distribution_function_examples.json create mode 100755 include/interactions/velocity_field_examples.json delete mode 100755 test/test_binning_generator.cpp delete mode 100755 test/test_coordinates.cpp delete mode 100755 test/test_function_generator.cpp delete mode 100755 test/test_functions.cpp delete mode 100755 test/test_hdf.cpp delete mode 100755 test/test_main.cpp delete mode 100755 test/test_scripts/test_movement.json diff --git a/config/config.mk b/config/config.mk index 40114e2..6a7be54 100755 --- a/config/config.mk +++ b/config/config.mk @@ -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 diff --git a/include/interactions/drift_velocity_examples.json b/include/interactions/drift_velocity_examples.json new file mode 100755 index 0000000..1d238d4 --- /dev/null +++ b/include/interactions/drift_velocity_examples.json @@ -0,0 +1,34 @@ +{ + "DriftVelocity1": { + "DriftVelocity": { + "VectorField": { + "VectorFieldFunctionInZ": { + "zFunction": { + "Product": { + "fi": { + "Constant": { + "constant": 1 + } + }, + "fj": { + "Constant": { + "constant": 1 + } + }, + "fk": { + "Constant": { + "constant": 1 + } + } + } + } + } + } + } + + }, + "DriftVelocity2": { + "null": {} + } + +} \ No newline at end of file diff --git a/include/interactions/energy_distribution_function_examples.json b/include/interactions/energy_distribution_function_examples.json new file mode 100755 index 0000000..a7078c9 --- /dev/null +++ b/include/interactions/energy_distribution_function_examples.json @@ -0,0 +1,20 @@ +{ + "EnergyDistributionFunction1": { + "MaxwellBoltzmann": { + "Temperature": { + "value": 80, + "unit": "K" + } + } + }, + "EnergyDistributionFunction2": { + "TritiumBetaDecay": {} + }, + "EnergyDistributionFunction3": { + "Constant": { + "constant": { + "value": 1 + } + } + } +} \ No newline at end of file diff --git a/include/interactions/function_examples.json b/include/interactions/function_examples.json new file mode 100755 index 0000000..393baf9 --- /dev/null +++ b/include/interactions/function_examples.json @@ -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 } + } + } + } + } + } +} \ No newline at end of file diff --git a/include/interactions/interactions_examples.json b/include/interactions/interactions_examples.json new file mode 100755 index 0000000..21d7c7b --- /dev/null +++ b/include/interactions/interactions_examples.json @@ -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" + } + } +} \ No newline at end of file diff --git a/include/interactions/mover_examples.json b/include/interactions/mover_examples.json new file mode 100755 index 0000000..da12dcd --- /dev/null +++ b/include/interactions/mover_examples.json @@ -0,0 +1,13 @@ +{ + "MoverExample1":{ + "Boris": { + "MaximalTimestepLength": { + "value": 1E-8, + "unit": "s" + } + } + }, + "MoverExample2":{ + + } +} \ No newline at end of file diff --git a/include/interactions/parameter_katrin.json b/include/interactions/parameter_katrin.json new file mode 100755 index 0000000..612c989 --- /dev/null +++ b/include/interactions/parameter_katrin.json @@ -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 + } +} \ No newline at end of file diff --git a/include/interactions/reflector_examples.json b/include/interactions/reflector_examples.json new file mode 100755 index 0000000..c662d64 --- /dev/null +++ b/include/interactions/reflector_examples.json @@ -0,0 +1,17 @@ +{ + "ReflectorExample1": { + "Reflector": { + "ReflectorDPS": { + "position_z": { + "value": 1657, + "unit": "cm" + } + } + } + }, + "ReflectorExample2": { + "Reflector": { + "NoReflector": {} + } + } +} \ No newline at end of file diff --git a/include/interactions/reflectors_examples.json b/include/interactions/reflectors_examples.json new file mode 100755 index 0000000..cd1dd07 --- /dev/null +++ b/include/interactions/reflectors_examples.json @@ -0,0 +1,15 @@ +{ + "Example1": { + "Reflector": { + "NoReflector": {} + } + }, + "Example2": { + "ReflectorDPS": { + "position_z": { + "value": 1600, + "unit": "cm" + } + } + } +} \ No newline at end of file diff --git a/include/interactions/scalar_fields_examples.json b/include/interactions/scalar_fields_examples.json new file mode 100755 index 0000000..5104db4 --- /dev/null +++ b/include/interactions/scalar_fields_examples.json @@ -0,0 +1,13 @@ +{ + "ScalarFields": { + "field1": { + "ScalarFieldFunctionInZ": { + "zFunction": { + "Constant3D": { + "constant": 2 + } + } + } + } + } +} \ No newline at end of file diff --git a/include/interactions/scattering_angle_example.json b/include/interactions/scattering_angle_example.json new file mode 100755 index 0000000..161aecc --- /dev/null +++ b/include/interactions/scattering_angle_example.json @@ -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" + } + } + } + +} \ No newline at end of file diff --git a/include/interactions/terminator_examples.json b/include/interactions/terminator_examples.json new file mode 100755 index 0000000..e857910 --- /dev/null +++ b/include/interactions/terminator_examples.json @@ -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" + } + } + } + } + } +} \ No newline at end of file diff --git a/include/interactions/test_parameter.json b/include/interactions/test_parameter.json new file mode 100755 index 0000000..e0c0bc5 --- /dev/null +++ b/include/interactions/test_parameter.json @@ -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 + } +} \ No newline at end of file diff --git a/include/interactions/vector_field_examples.json b/include/interactions/vector_field_examples.json new file mode 100755 index 0000000..4cbdcc8 --- /dev/null +++ b/include/interactions/vector_field_examples.json @@ -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 + } + } +} \ No newline at end of file diff --git a/include/interactions/velocity_distribution_function_examples.json b/include/interactions/velocity_distribution_function_examples.json new file mode 100755 index 0000000..50af901 --- /dev/null +++ b/include/interactions/velocity_distribution_function_examples.json @@ -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" + } + } + } +} \ No newline at end of file diff --git a/include/interactions/velocity_field_examples.json b/include/interactions/velocity_field_examples.json new file mode 100755 index 0000000..33ba11a --- /dev/null +++ b/include/interactions/velocity_field_examples.json @@ -0,0 +1,24 @@ +{ + "VelocityDistribution 1": { + "VelocityDistributionFromFunction": { + "VelocityDistributionFunction": { + "IsotropicDistribution": { + "EnergyDistributionFunction": { + "MaxwellBoltzmann": { + "Temperature": { + "value": 80, + "unit": "K" + } + } + }, + "Mass": { + "FromParticleType": "T2" + } + } + } + } + }, + "VelocityDistribution2": { + "null" : {} + } +} \ No newline at end of file diff --git a/makefile b/makefile index 1c91e30..1e343e1 100755 --- a/makefile +++ b/makefile @@ -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 diff --git a/src/interactions/elastic_scattering.cpp b/src/interactions/elastic_scattering.cpp index 80f7093..08afc6c 100755 --- a/src/interactions/elastic_scattering.cpp +++ b/src/interactions/elastic_scattering.cpp @@ -45,7 +45,6 @@ InteractionOutput ElasticScattering::performInteraction( phi); particle.velocity(CartesianVector(v_impact_new)); - // no Gyrocentrum movement because boris push is used; return InteractionOutput(); } diff --git a/test/test_binning_generator.cpp b/test/test_binning_generator.cpp deleted file mode 100755 index cb78443..0000000 --- a/test/test_binning_generator.cpp +++ /dev/null @@ -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()); - } - } - } -} diff --git a/test/test_coordinates.cpp b/test/test_coordinates.cpp deleted file mode 100755 index 3edd763..0000000 --- a/test/test_coordinates.cpp +++ /dev/null @@ -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 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 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 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 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)); - } - } - } -} \ No newline at end of file diff --git a/test/test_function_generator.cpp b/test/test_function_generator.cpp deleted file mode 100755 index bf2947b..0000000 --- a/test/test_function_generator.cpp +++ /dev/null @@ -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 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 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 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 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 product = - generator::function3D(obj); - - REQUIRE(product(-1., 1., 0.) == 20E-4); - REQUIRE(product(0., 2., 3.) == 0.08); - } - } - } -} \ No newline at end of file diff --git a/test/test_functions.cpp b/test/test_functions.cpp deleted file mode 100755 index 2a1c000..0000000 --- a/test/test_functions.cpp +++ /dev/null @@ -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 positions = {0, 1, 2, 3}; - std::vector values = {-1, 1, 1, 2}; - std::function 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 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 positions = {0, 1, 2, 3}; - std::vector values = {-1, 1, 1, 2}; - std::function pw = - D1ToD1::PiecewiseLinear(positions, values); - - std::function 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])); - } - } - } - } - } -} \ No newline at end of file diff --git a/test/test_hdf.cpp b/test/test_hdf.cpp deleted file mode 100755 index 791e910..0000000 --- a/test/test_hdf.cpp +++ /dev/null @@ -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 data(4); - data = 0.1, -0.1, 1.2, 3.0; - std::string path_1d = "/1d_double"; - - writer.write(data, path_1d); - - blitz::Array 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)); - } - } -} \ No newline at end of file diff --git a/test/test_main.cpp b/test/test_main.cpp deleted file mode 100755 index afd92aa..0000000 --- a/test/test_main.cpp +++ /dev/null @@ -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]") {} \ No newline at end of file diff --git a/test/test_scripts/test_movement.json b/test/test_scripts/test_movement.json deleted file mode 100755 index 471579f..0000000 --- a/test/test_scripts/test_movement.json +++ /dev/null @@ -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 - } - } - } - } - } -} \ No newline at end of file