4 Commits
15 changed files with 426 additions and 433 deletions
+7 -2
View File
@@ -166,7 +166,7 @@ def tubeCurrentVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
areas_in_r = radialAreas(filename, path_to_species) areas_in_r = radialAreas(filename, path_to_species)
current_in_r = radialCurrent(filename, path_to_species, output_period) current_in_r = radialCurrent(filename, path_to_species, output_period)
particles = current_in_r * areas_in_r particles = current_in_r * areas_in_r
return (np.sum(particles, axis=(1)) / np.sum(areas_in_r, axis=(1)))[-2, :] return (np.sum(particles, axis=(1)) / np.sum(areas_in_r, axis=(1)))[-1, :]
def densityVsZ(filename, path_to_species, output_period="LastSyncPeriod"): def densityVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
@@ -212,14 +212,19 @@ def plotSpectrumAtZ(filename, path_to_species, z_position, plot_axis, output_per
r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}\log_{10}E}$ $\left(\frac{1}{\mathrm{m}^{3} \log_{10}(\mathrm{eV})}\right)$") r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}\log_{10}E}$ $\left(\frac{1}{\mathrm{m}^{3} \log_{10}(\mathrm{eV})}\right)$")
def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder): def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder, plot_instructions={}):
pst.setRcParams() pst.setRcParams()
fig, ax = plt.subplots(figsize=pst.set_size('thesis')) fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
for key in specie_keys: for key in specie_keys:
plotSpectrumAtZ(filename, key, z_position, ax, output_period) plotSpectrumAtZ(filename, key, z_position, ax, output_period)
ax.set_facecolor('#e7e7e7ff') ax.set_facecolor('#e7e7e7ff')
ax.grid(color='white') ax.grid(color='white')
ax.legend() ax.legend()
if "xlim" in plot_instructions.keys():
ax.set_xlim(plot_instructions["xlim"])
if "ylim" in plot_instructions.keys():
ax.set_ylim(plot_instructions["ylim"])
fig.savefig(output_folder + fig.savefig(output_folder +
"/spectrum_at_z={}_at_period={}.pdf".format(z_position, output_period)) "/spectrum_at_z={}_at_period={}.pdf".format(z_position, output_period))
+34
View File
@@ -0,0 +1,34 @@
{
"DriftVelocityExample1": {
"DriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"Constant": {
"constant": 1
}
}
}
}
}
}
}
},
"DriftVelocityExample2": {
"null": {}
}
}
@@ -0,0 +1,20 @@
{
"EnergyDistributionFunctionExample1": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"EnergyDistributionFunctionExample2": {
"TritiumBetaDecay": {}
},
"EnergyDistributionFunctionExample3": {
"Constant": {
"constant": {
"value": 1
}
}
}
}
+64 -94
View File
@@ -1,104 +1,74 @@
{ {
"Functions": { "Functions": {
"1Dto1D examples": { "1Dto1D examples": {
"f1": { "f1": {
"PiecewiseLinear": { "PiecewiseLinear": {
"xValues": [ "xValues": [0, 1.43, 3],
0, "yValues": [5E-4, 0.002, 0.02],
1.43, "prefactor": 1
3, }
8, },
13, "f2": {
14.57, "Constant": {
16 "constant": 1
], }
"yValues": [ },
5E-4, "f3": {
0.002, "Product": [
0.02, {
1, "Constant": {
0.02, "constant": 2
0.002, }
5E-4 },
], {
"prefactor": 1 "Constant": {
} "constant": 3
}, }
"f2": {
"Constant": {
"constant": 1
}
},
"f3": {
"Product": [
{
"Constant": {
"constant": 2
} }
}, ]
{ },
"Constant": { "f4": {
"constant": 3 "PiecewiseLinearFromFile": {
} "PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "path/relative",
"Filename": "data.h5"
},
"xValuesKey": "/xvalues",
"yValuesKey": "/yvalues",
"prefactor": 1
}
},
"f5": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "AbsolutPath",
"RelativePath": "/some/absolut/path",
"Filename": "data.h5"
},
"xValuesKey": "/xvalues",
"yValuesKey": "/yvalues",
"prefactor": 1
} }
]
},
"f4": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocityDistributions/T2_vz/KuckertPaper",
"Filename": "T2_vz_vs_z_kuckert_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/vz(ms)",
"prefactor": 1
}
}
},
"3dto1D examples": {
"f1": {
"Constant3D": {
"constant": 2
} }
}, },
"f2": { "3dto1D examples": {
"Product": { "f1": {
"fi": { "Constant3D": {
"Constant": { "constant": 2
"constant": 2 }
} },
}, "f2": {
"fj": { "Product": {
"Constant": { "fi": { "Constant": {"constant": 2 }},
"constant": 2 "fj": { "Constant": {"constant": 2 }},
} "fk": { "PiecewiseLinear": {
}, "xValues": [0, 1.43, 3],
"fk": { "yValues": [5E-4, 0.002, 0.02],
"PiecewiseLinear": { "prefactor": 1 }
"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
} }
} }
} }
} }
} }
} }
}
@@ -141,6 +141,16 @@
"Target": "T2", "Target": "T2",
"ExcitationState": "england_rotational_j1_to_j3" "ExcitationState": "england_rotational_j1_to_j3"
}, },
"recombination_example1": {
"Type": "Recombination",
"Target": "T2+",
"CrossSection": "eT2p_recombination_janev"
},
"recombination_example2": {
"Type": "Recombination",
"Target": "T3+",
"CrossSection": "eT3p_recombination_janev"
},
"free_movement_example": { "free_movement_example": {
"Type": "FreeMovement" "Type": "FreeMovement"
} }
@@ -172,6 +182,11 @@
"PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil" "PredefinedFunction": "TpT2_clustering_tertiary_ascendion_pasil"
} }
}, },
"recombination_example1": {
"Type": "Recombination",
"Target": "e-",
"CrossSection": "eT2p_recombination_janev"
},
"free_movement_example": { "free_movement_example": {
"Type": "FreeMovement" "Type": "FreeMovement"
} }
@@ -207,6 +222,11 @@
"Isotropic": {} "Isotropic": {}
} }
}, },
"recombination_example1": {
"Type": "Recombination",
"Target": "e-",
"CrossSection": "eT3p_recombination_janev"
},
"free_movement_example": { "free_movement_example": {
"Type": "FreeMovement" "Type": "FreeMovement"
} }
+18
View File
@@ -0,0 +1,18 @@
{
"MoverExample1":{
"Boris": {
"MaximalTimestepLength": {
"value": 1E-8,
"unit": "s"
}
}
},
"MoverExample2":{
"Drift": {
"MaximalMovedDistance": {
"value": 0.001,
"unit": "m"
}
}
}
}
@@ -2,21 +2,21 @@
"GlobalPositionBinning": { "GlobalPositionBinning": {
"CylinderBinning": { "CylinderBinning": {
"Radial": { "Radial": {
"NumberOfBins": 15, "NumberOfBins": 5,
"MaxRadius": { "MaxRadius": {
"value": 4.5, "value": 4.5,
"unit": "cm" "unit": "cm"
} }
}, },
"Longitudinal": { "Longitudinal": {
"NumberOfBins": 1657, "NumberOfBins": 166,
"MaxLength": { "MaxLength": {
"value": 1657, "value": 1657,
"unit": "cm" "unit": "cm"
} }
}, },
"Azimuthal": { "Azimuthal": {
"NumberOfBins": 4 "NumberOfBins": 1
} }
} }
}, },
@@ -56,11 +56,11 @@
"PathToH5": { "PathToH5": {
"Type": "RelativeToHomebase", "Type": "RelativeToHomebase",
"RelativePath": "data/densityDistributions/T2", "RelativePath": "data/densityDistributions/T2",
"Filename": "T2_n_vs_z_kuckert_approximated.h5" "Filename": "T2_n_vs_z_kuckert_approximated_relative.h5"
}, },
"xValuesKey": "/z_position(m)", "xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)", "yValuesKey": "/n(m3)",
"prefactor": 1E20 "prefactor": 6.337599E19
} }
} }
} }
@@ -125,11 +125,10 @@
"e-": { "e-": {
"ParticleType": "electron", "ParticleType": "electron",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-12, "unit": "m"
"unit": "s"
} }
} }
}, },
@@ -210,7 +209,7 @@
"CompositeAngleDistribution": { "CompositeAngleDistribution": {
"LowerDistribution": { "LowerDistribution": {
"Isotropic": {} "Isotropic": {}
}, },
"HigherDistribution": { "HigherDistribution": {
"AngleDistributionFromFile": { "AngleDistributionFromFile": {
"PathToH5": { "PathToH5": {
@@ -348,18 +347,17 @@
"T2+": { "T2+": {
"ParticleType": "T2+", "ParticleType": "T2+",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-8, "unit": "m"
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 1, "value": 10,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -441,18 +439,17 @@
"T+": { "T+": {
"ParticleType": "T+", "ParticleType": "T+",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-8, "unit": "m"
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 1, "value": 10,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -545,18 +542,17 @@
"T3+": { "T3+": {
"ParticleType": "T3+", "ParticleType": "T3+",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-8, "unit": "m"
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 1, "value": 10,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -694,7 +690,7 @@
"PathToH5": { "PathToH5": {
"Type": "RelativeToHomebase", "Type": "RelativeToHomebase",
"RelativePath": "data/densityDistributions/T2", "RelativePath": "data/densityDistributions/T2",
"Filename": "T2_n_vs_z_kuckert_approximated.h5" "Filename": "T2_n_vs_z_kuckert_approximated_relative.h5"
}, },
"xValuesKey": "/z_position(m)", "xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)", "yValuesKey": "/n(m3)",
@@ -757,7 +753,7 @@
} }
}, },
"Activity": { "Activity": {
"value": 1E15, "value": 1E14,
"unit": "Bq" "unit": "Bq"
} }
}, },
@@ -795,15 +791,8 @@
"VectorField": { "VectorField": {
"VectorFieldFunctionInZ": { "VectorFieldFunctionInZ": {
"zFunction": { "zFunction": {
"PiecewiseLinearFromFile": { "Constant3D": {
"PathToH5": { "constant": 2.5
"Type": "RelativeToHomebase",
"RelativePath": "data/magneticField/Kassiopeia",
"Filename": "B_vs_z_kassiopeia_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/B(T)",
"prefactor": 1
} }
} }
} }
@@ -813,12 +802,12 @@
"UseInSimulation": "false" "UseInSimulation": "false"
}, },
"Simulation": { "Simulation": {
"SimulatedEvents": 1000000, "SimulatedEvents": 10000000,
"EventStride": 10 "EventStride": 1000
}, },
"Output": { "Output": {
"folder": "output", "folder": "output",
"filename": "karl_output", "filename": "katrin",
"DensityFields": { "DensityFields": {
"Species": "all", "Species": "all",
"Intervall": 1, "Intervall": 1,
+17
View File
@@ -0,0 +1,17 @@
{
"ReflectorExample1": {
"Reflector": {
"ReflectorDPS": {
"position_z": {
"value": 1657,
"unit": "cm"
}
}
}
},
"ReflectorExample2": {
"Reflector": {
"NoReflector": {}
}
}
}
@@ -1,15 +0,0 @@
{
"Example1": {
"Reflector": {
"NoReflector": {}
}
},
"Example2": {
"ReflectorDPS": {
"position_z": {
"value": 1600,
"unit": "cm"
}
}
}
}
@@ -1,11 +1,9 @@
{ {
"ScalarFields": { "ScalarFieldsExample1": {
"field1": { "ScalarFieldFunctionInZ": {
"ScalarFieldFunctionInZ": { "zFunction": {
"zFunction": { "Constant3D": {
"Constant3D": { "constant": 2
"constant": 2
}
} }
} }
} }
+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"
}
}
}
}
}
}
+90 -190
View File
@@ -2,7 +2,7 @@
"GlobalPositionBinning": { "GlobalPositionBinning": {
"CylinderBinning": { "CylinderBinning": {
"Radial": { "Radial": {
"NumberOfBins": 15, "NumberOfBins": 1,
"MaxRadius": { "MaxRadius": {
"value": 4.5, "value": 4.5,
"unit": "cm" "unit": "cm"
@@ -16,7 +16,7 @@
} }
}, },
"Azimuthal": { "Azimuthal": {
"NumberOfBins": 4 "NumberOfBins": 1
} }
} }
}, },
@@ -55,23 +55,21 @@
"PiecewiseLinear": { "PiecewiseLinear": {
"xValues": [ "xValues": [
0, 0,
1.43, 7.4999,
3, 7.5,
8, 8.5,
13, 8.5001,
14.57,
16 16
], ],
"yValues": [ "yValues": [
5E-4, 0,
0.002, 0,
0.02,
1, 1,
0.02, 1,
0.002, 0,
5E-4 0
], ],
"prefactor": 1E20 "prefactor": 1E22
} }
} }
} }
@@ -114,20 +112,8 @@
} }
}, },
"fk": { "fk": {
"PiecewiseLinear": { "Constant": {
"xValues": [ "constant": 0
0,
7.99,
8.01,
16
],
"yValues": [
-100,
-100,
100,
100
],
"prefactor": 1
} }
} }
} }
@@ -141,122 +127,10 @@
"e-": { "e-": {
"ParticleType": "electron", "ParticleType": "electron",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-12, "unit": "m"
"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"
} }
} }
}, },
@@ -297,7 +171,7 @@
"unit": "eV" "unit": "eV"
}, },
"MaxEnergy": { "MaxEnergy": {
"value": 1E3, "value": 1E2,
"unit": "eV" "unit": "eV"
} }
} }
@@ -322,19 +196,32 @@
} }
}, },
"Interactions": { "Interactions": {
"name1": { "free": {
"Type": "FreeMovement" "Type": "FreeMovement"
},
"elastic": {
"Type": "ElasticScattering",
"CrossSection": {
"1dFunction": {
"Constant": {
"constant": 1.412E-19
}
}
},
"Target": "TritiumGas",
"ScatteringAngleDistribution": {
"Isotropic": {}
}
} }
} }
}, },
"T+": { "T+": {
"ParticleType": "T+", "ParticleType": "T+",
"Mover": { "Mover": {
"Boris": { "Drift": {
"BorisStepsPerMovementCylce": 10, "MaximalMovedDistance": {
"MaximalTimestepLength": { "value": 0.001,
"value": 1E-8, "unit": "m"
"unit": "s"
} }
} }
}, },
@@ -400,8 +287,22 @@
} }
}, },
"Interactions": { "Interactions": {
"name1": { "free": {
"Type": "FreeMovement" "Type": "FreeMovement"
},
"elastic": {
"Type": "ElasticScattering",
"CrossSection": {
"1dFunction": {
"Constant": {
"constant": 1.412E-19
}
}
},
"Target": "TritiumGas",
"ScatteringAngleDistribution": {
"Isotropic": {}
}
} }
} }
} }
@@ -414,12 +315,24 @@
"CreationVelocityDistribution": { "CreationVelocityDistribution": {
"VelocityDistributionFromFunction": { "VelocityDistributionFromFunction": {
"VelocityDistributionFunction": { "VelocityDistributionFunction": {
"IsotropicDistribution": { "DirectedDistribution": {
"EnergyDistributionFunction": { "EnergyDistributionFunction": {
"TritiumBetaDecay": {} "Constant": {
"constant": {
"value": 8E-3,
"unit": "eV"
}
}
}, },
"Mass": { "Mass": {
"FromParticleType": "electron" "FromParticleType": "electron"
},
"Direction": {
"vector": [
0,
0,
-1
]
} }
} }
} }
@@ -427,21 +340,28 @@
} }
}, },
"specie2": { "specie2": {
"TrackedSpecieName": "T2+", "TrackedSpecieName": "T+",
"CreationVelocityDistribution": { "CreationVelocityDistribution": {
"VelocityDistributionFromFunction": { "VelocityDistributionFromFunction": {
"VelocityDistributionFunction": { "VelocityDistributionFunction": {
"IsotropicDistribution": { "DirectedDistribution": {
"EnergyDistributionFunction": { "EnergyDistributionFunction": {
"MaxwellBoltzmann": { "Constant": {
"Temperature": { "constant": {
"value": 80, "value": 20E-2,
"unit": "K" "unit": "eV"
} }
} }
}, },
"Mass": { "Mass": {
"FromParticleType": "T2" "FromParticleType": "T+"
},
"Direction": {
"vector": [
0,
0,
-1
]
} }
} }
} }
@@ -465,26 +385,8 @@
} }
}, },
"fk": { "fk": {
"PiecewiseLinear": { "Constant": {
"xValues": [ "constant": 0.5
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
} }
} }
} }
@@ -493,7 +395,7 @@
}, },
"DensityLimit": { "DensityLimit": {
"min": 0, "min": 0,
"max": 1E15 "max": 1
}, },
"PositionLimits": { "PositionLimits": {
"rPosition": { "rPosition": {
@@ -505,8 +407,8 @@
"max": 6.28318530718 "max": 6.28318530718
}, },
"zPosition": { "zPosition": {
"min": 0, "min": 7.94,
"max": 16.0 "max": 7.96
} }
} }
}, },
@@ -574,8 +476,8 @@
"UseInSimulation": "false" "UseInSimulation": "false"
}, },
"Simulation": { "Simulation": {
"SimulatedEvents": 1, "SimulatedEvents": 100,
"EventStride": 1 "EventStride": 100
}, },
"Output": { "Output": {
"folder": "output", "folder": "output",
@@ -588,15 +490,13 @@
"CurrentBorders": { "CurrentBorders": {
"Species": [ "Species": [
"e-", "e-",
"T2+" "T+"
], ],
"Intervall": "EachSync", "Intervall": "EachSync",
"OverwriteLast": "true" "OverwriteLast": "true"
}, },
"DeletionLogger": { "DeletionLogger": {
"Species": [ "Species": "all",
"all"
],
"Intervall": "EachSync", "Intervall": "EachSync",
"OverwriteLast": "true" "OverwriteLast": "true"
} }
+32 -38
View File
@@ -1,45 +1,39 @@
{ {
"VectorFields": { "VectorfieldExample1": {
"field1": { "VectorFieldConstant": {
"VectorFieldConstant": { "Constant": {
"Constant": { "vector": [ 1, 2, 3]
"vector": [
1,
2,
3
]
}
}
},
"field2": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
},
"field3": {
"VectorFieldFromArray": {
"ReadArrayFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocity/distributions",
"Filename": "drift_velocity.h5"
},
"Keys": [
"/vr",
"/vphi",
"/vz"
]
},
"Radius": 0.045,
"Length": 16
} }
} }
}, },
"field4": { "VectorfieldExample2": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2
}
}
}
},
"VectorfieldExample3": {
"VectorFieldFromArray": {
"ReadArrayFromFile": {
"PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/velocity/distributions",
"Filename": "drift_velocity.h5"
},
"Keys": [
"/vr",
"/vphi",
"/vz"
]
},
"Radius": 0.045,
"Length": 16
}
},
"VectorfieldExample4": {
"VectorFieldFromArray": { "VectorFieldFromArray": {
"ReadArrayFromFile": { "ReadArrayFromFile": {
"PathToH5": { "PathToH5": {
@@ -0,0 +1,35 @@
{
"VelocityDistributionFunctionExample1": {
"IsotropicDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Mass": {
"FromParticleType": "T2"
}
}
},
"VelocityDistributionFunctionExample2": {
"DirectedDistribution": {
"EnergyDistributionFunction": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"Direction": {
"vector": [0,0,1]
},
"Mass": {
"FromParticleType": "T2"
}
}
}
}
+29 -44
View File
@@ -135,23 +135,6 @@ void BorisMover::movementStep(
u_plus_z + (q * electric_field(2) * maximal_time_step_s_) / (2. * m); u_plus_z + (q * electric_field(2) * maximal_time_step_s_) / (2. * m);
const blitz::TinyVector<double, 3> u_new(u_new_x, u_new_y, u_new_z); const blitz::TinyVector<double, 3> u_new(u_new_x, u_new_y, u_new_z);
/*
Might be slower, but essentially the same code
const blitz::TinyVector<double, 3> u_minus =
v + (q * electric_field * maximal_time_step_s_) / (2. * m);
const double gamma = kinematic::relativisticGamma(u_minus);;
const blitz::TinyVector<double, 3> temp_1 =
(q * magnetic_field * maximal_time_step_s_) / (2. * m * gamma);
const blitz::TinyVector<double, 3> u_prime =
u_minus + (blitz::cross(u_minus, temp_1));
const blitz::TinyVector<double, 3> temp_2 =
(2. * temp_1) / (1. + (blitz::dot(temp_1, temp_1)));
const blitz::TinyVector<double, 3> u_plus =
u_minus + (blitz::cross(u_prime, temp_2));
const blitz::TinyVector<double, 3> u_new =
u_plus + (q * electric_field * maximal_time_step_s_) / (2. * m);
*/
particle->velocity(CartesianVector(u_new)); particle->velocity(CartesianVector(u_new));
const CartesianCoordinate distance(u_new * maximal_time_step_s_); const CartesianCoordinate distance(u_new * maximal_time_step_s_);
@@ -196,8 +179,6 @@ void DriftMover::move(particle::Particle* particle,
const blitz::TinyVector<double, 3> B = const blitz::TinyVector<double, 3> B =
magnetic_field->value(old_position).cartesianEntries(old_position); magnetic_field->value(old_position).cartesianEntries(old_position);
const double B_norm = kinematic::norm(B); const double B_norm = kinematic::norm(B);
// Todo: add calculation of divB here
// use Kassiopeia paper for reference
const blitz::TinyVector<double, 3> v_parallel = const blitz::TinyVector<double, 3> v_parallel =
kinematic::parallelVector(old_velocity.cartesianEntries(), B); kinematic::parallelVector(old_velocity.cartesianEntries(), B);
@@ -207,15 +188,6 @@ void DriftMover::move(particle::Particle* particle,
kinematic::perpendicularVector(old_velocity.cartesianEntries(), B); kinematic::perpendicularVector(old_velocity.cartesianEntries(), B);
const double v_perp_norm = kinematic::norm(v_perp); const double v_perp_norm = kinematic::norm(v_perp);
const double gyro_radius = particle->mass_kg() * v_perp_norm /
(B_norm * std::abs(particle->charge_C()));
const blitz::TinyVector<double, 3> velocity_normal =
(-1) * blitz::cross(v_parallel, v_perp);
const blitz::TinyVector<double, 3> offset_to_gyro_center =
gyro_radius * velocity_normal / kinematic::norm(velocity_normal);
const blitz::TinyVector<double, 3> v_drift = driftVelocity(B, E); const blitz::TinyVector<double, 3> v_drift = driftVelocity(B, E);
const double v_drift_norm = kinematic::norm(v_drift); const double v_drift_norm = kinematic::norm(v_drift);
@@ -225,30 +197,43 @@ void DriftMover::move(particle::Particle* particle,
const blitz::TinyVector<double, 3> movement_parallel = const blitz::TinyVector<double, 3> movement_parallel =
v_parallel * timestep; v_parallel * timestep;
const blitz::TinyVector<double, 3> movement_drift = v_drift * timestep; const blitz::TinyVector<double, 3> movement_drift = v_drift * timestep;
const double gyro_frequency =
particle->charge_C() * B_norm / particle->mass_kg();
const double total_rotation_angle = gyro_frequency * timestep;
const blitz::TinyVector<double, 3> movement_around_gyro_center =
kinematic::rotateVector(offset_to_gyro_center, v_parallel,
total_rotation_angle) -
offset_to_gyro_center;
particle->move(CartesianCoordinate(movement_parallel + movement_drift +
movement_around_gyro_center));
const blitz::TinyVector<double, 3> E_parallel = const blitz::TinyVector<double, 3> E_parallel =
kinematic::parallelVector(E, B); kinematic::parallelVector(E, B);
const blitz::TinyVector<double, 3> dv_electric = const blitz::TinyVector<double, 3> dv_electric =
timestep * particle->charge_C() * E_parallel / particle->mass_kg(); timestep * particle->charge_C() * E_parallel / particle->mass_kg();
const blitz::TinyVector<double, 3> v_perp_rotated = if (v_perp_norm > 0.) {
kinematic::rotateVector(v_perp, v_parallel, total_rotation_angle); const double gyro_radius = particle->mass_kg() * v_perp_norm /
(B_norm * std::abs(particle->charge_C()));
particle->velocity( const blitz::TinyVector<double, 3> velocity_normal =
CartesianVector(v_parallel + v_perp_rotated + dv_electric)); (-1) * blitz::cross(B, v_perp);
const blitz::TinyVector<double, 3> offset_to_gyro_center =
gyro_radius * velocity_normal / kinematic::norm(velocity_normal);
const double gyro_frequency =
particle->charge_C() * B_norm / particle->mass_kg();
const double total_rotation_angle = gyro_frequency * timestep;
const blitz::TinyVector<double, 3> movement_around_gyro_center =
kinematic::rotateVector(offset_to_gyro_center, B,
total_rotation_angle) -
offset_to_gyro_center;
const blitz::TinyVector<double, 3> v_perp_rotated =
kinematic::rotateVector(v_perp, B, total_rotation_angle);
particle->move(CartesianCoordinate(movement_parallel + movement_drift +
movement_around_gyro_center));
particle->velocity(
CartesianVector(v_parallel + v_perp_rotated + dv_electric));
} else {
particle->move(CartesianCoordinate(movement_parallel + movement_drift));
particle->velocity(CartesianVector(v_parallel + dv_electric));
}
particle->increaseTimeAlive(timestep); particle->increaseTimeAlive(timestep);
particle->increaseTimeInBin(timestep); particle->increaseTimeInBin(timestep);