1 Commits
Author SHA1 Message Date
Jonas Kellerer 71dc3f4ada Merge branch 'develop' 2022-11-11 13:42:46 +01:00
15 changed files with 427 additions and 420 deletions
+2 -7
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)))[-1, :] return (np.sum(particles, axis=(1)) / np.sum(areas_in_r, axis=(1)))[-2, :]
def densityVsZ(filename, path_to_species, output_period="LastSyncPeriod"): def densityVsZ(filename, path_to_species, output_period="LastSyncPeriod"):
@@ -212,19 +212,14 @@ 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, plot_instructions={}): def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder):
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))
@@ -1,34 +0,0 @@
{
"DriftVelocityExample1": {
"DriftVelocity": {
"VectorField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Product": {
"fi": {
"Constant": {
"constant": 1
}
},
"fj": {
"Constant": {
"constant": 1
}
},
"fk": {
"Constant": {
"constant": 1
}
}
}
}
}
}
}
},
"DriftVelocityExample2": {
"null": {}
}
}
@@ -1,20 +0,0 @@
{
"EnergyDistributionFunctionExample1": {
"MaxwellBoltzmann": {
"Temperature": {
"value": 80,
"unit": "K"
}
}
},
"EnergyDistributionFunctionExample2": {
"TritiumBetaDecay": {}
},
"EnergyDistributionFunctionExample3": {
"Constant": {
"constant": {
"value": 1
}
}
}
}
+55 -25
View File
@@ -1,10 +1,26 @@
{ {
"Functions": { "Functions": {
"1Dto1D examples": { "1Dto1D examples": {
"f1": { "f1": {
"PiecewiseLinear": { "PiecewiseLinear": {
"xValues": [0, 1.43, 3], "xValues": [
"yValues": [5E-4, 0.002, 0.02], 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 "prefactor": 1
} }
}, },
@@ -31,23 +47,11 @@
"PiecewiseLinearFromFile": { "PiecewiseLinearFromFile": {
"PathToH5": { "PathToH5": {
"Type": "RelativeToHomebase", "Type": "RelativeToHomebase",
"RelativePath": "path/relative", "RelativePath": "data/velocityDistributions/T2_vz/KuckertPaper",
"Filename": "data.h5" "Filename": "T2_vz_vs_z_kuckert_approximated.h5"
}, },
"xValuesKey": "/xvalues", "xValuesKey": "/z_position(m)",
"yValuesKey": "/yvalues", "yValuesKey": "/vz(ms)",
"prefactor": 1
}
},
"f5": {
"PiecewiseLinearFromFile": {
"PathToH5": {
"Type": "AbsolutPath",
"RelativePath": "/some/absolut/path",
"Filename": "data.h5"
},
"xValuesKey": "/xvalues",
"yValuesKey": "/yvalues",
"prefactor": 1 "prefactor": 1
} }
} }
@@ -60,15 +64,41 @@
}, },
"f2": { "f2": {
"Product": { "Product": {
"fi": { "Constant": {"constant": 2 }}, "fi": {
"fj": { "Constant": {"constant": 2 }}, "Constant": {
"fk": { "PiecewiseLinear": { "constant": 2
"xValues": [0, 1.43, 3], }
"yValues": [5E-4, 0.002, 0.02], },
"prefactor": 1 } "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
} }
} }
} }
} }
} }
} }
}
@@ -141,16 +141,6 @@
"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"
} }
@@ -182,11 +172,6 @@
"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"
} }
@@ -222,11 +207,6 @@
"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
@@ -1,18 +0,0 @@
{
"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": 5, "NumberOfBins": 15,
"MaxRadius": { "MaxRadius": {
"value": 4.5, "value": 4.5,
"unit": "cm" "unit": "cm"
} }
}, },
"Longitudinal": { "Longitudinal": {
"NumberOfBins": 166, "NumberOfBins": 1657,
"MaxLength": { "MaxLength": {
"value": 1657, "value": 1657,
"unit": "cm" "unit": "cm"
} }
}, },
"Azimuthal": { "Azimuthal": {
"NumberOfBins": 1 "NumberOfBins": 4
} }
} }
}, },
@@ -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_relative.h5" "Filename": "T2_n_vs_z_kuckert_approximated.h5"
}, },
"xValuesKey": "/z_position(m)", "xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)", "yValuesKey": "/n(m3)",
"prefactor": 6.337599E19 "prefactor": 1E20
} }
} }
} }
@@ -125,10 +125,11 @@
"e-": { "e-": {
"ParticleType": "electron", "ParticleType": "electron",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-12,
"unit": "s"
} }
} }
}, },
@@ -347,17 +348,18 @@
"T2+": { "T2+": {
"ParticleType": "T2+", "ParticleType": "T2+",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-8,
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 10, "value": 1,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -439,17 +441,18 @@
"T+": { "T+": {
"ParticleType": "T+", "ParticleType": "T+",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-8,
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 10, "value": 1,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -542,17 +545,18 @@
"T3+": { "T3+": {
"ParticleType": "T3+", "ParticleType": "T3+",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-8,
"unit": "s"
} }
} }
}, },
"Terminator": { "Terminator": {
"MaximumInteractions": 1E6, "MaximumInteractions": 1E6,
"MaxTimeAlive": { "MaxTimeAlive": {
"value": 10, "value": 1,
"unit": "s" "unit": "s"
}, },
"BoundaryGeometry": { "BoundaryGeometry": {
@@ -690,7 +694,7 @@
"PathToH5": { "PathToH5": {
"Type": "RelativeToHomebase", "Type": "RelativeToHomebase",
"RelativePath": "data/densityDistributions/T2", "RelativePath": "data/densityDistributions/T2",
"Filename": "T2_n_vs_z_kuckert_approximated_relative.h5" "Filename": "T2_n_vs_z_kuckert_approximated.h5"
}, },
"xValuesKey": "/z_position(m)", "xValuesKey": "/z_position(m)",
"yValuesKey": "/n(m3)", "yValuesKey": "/n(m3)",
@@ -753,7 +757,7 @@
} }
}, },
"Activity": { "Activity": {
"value": 1E14, "value": 1E15,
"unit": "Bq" "unit": "Bq"
} }
}, },
@@ -791,8 +795,15 @@
"VectorField": { "VectorField": {
"VectorFieldFunctionInZ": { "VectorFieldFunctionInZ": {
"zFunction": { "zFunction": {
"Constant3D": { "PiecewiseLinearFromFile": {
"constant": 2.5 "PathToH5": {
"Type": "RelativeToHomebase",
"RelativePath": "data/magneticField/Kassiopeia",
"Filename": "B_vs_z_kassiopeia_approximated.h5"
},
"xValuesKey": "/z_position(m)",
"yValuesKey": "/B(T)",
"prefactor": 1
} }
} }
} }
@@ -802,12 +813,12 @@
"UseInSimulation": "false" "UseInSimulation": "false"
}, },
"Simulation": { "Simulation": {
"SimulatedEvents": 10000000, "SimulatedEvents": 1000000,
"EventStride": 1000 "EventStride": 10
}, },
"Output": { "Output": {
"folder": "output", "folder": "output",
"filename": "katrin", "filename": "karl_output",
"DensityFields": { "DensityFields": {
"Species": "all", "Species": "all",
"Intervall": 1, "Intervall": 1,
-17
View File
@@ -1,17 +0,0 @@
{
"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"
}
}
}
}
@@ -1,5 +1,6 @@
{ {
"ScalarFieldsExample1": { "ScalarFields": {
"field1": {
"ScalarFieldFunctionInZ": { "ScalarFieldFunctionInZ": {
"zFunction": { "zFunction": {
"Constant3D": { "Constant3D": {
@@ -8,4 +9,5 @@
} }
} }
} }
}
} }
@@ -1,23 +0,0 @@
{
"TerminatorExample1": {
"Terminator": {
"MaximumInteractions": 1E6,
"MaxTimeAlive": {
"value": 1,
"unit": "s"
},
"BoundaryGeometry": {
"Cylinder": {
"Radius": {
"value": 4.5,
"unit": "cm"
},
"Height": {
"value": 1657,
"unit": "cm"
}
}
}
}
}
}
+182 -82
View File
@@ -2,7 +2,7 @@
"GlobalPositionBinning": { "GlobalPositionBinning": {
"CylinderBinning": { "CylinderBinning": {
"Radial": { "Radial": {
"NumberOfBins": 1, "NumberOfBins": 15,
"MaxRadius": { "MaxRadius": {
"value": 4.5, "value": 4.5,
"unit": "cm" "unit": "cm"
@@ -16,7 +16,7 @@
} }
}, },
"Azimuthal": { "Azimuthal": {
"NumberOfBins": 1 "NumberOfBins": 4
} }
} }
}, },
@@ -55,21 +55,23 @@
"PiecewiseLinear": { "PiecewiseLinear": {
"xValues": [ "xValues": [
0, 0,
7.4999, 1.43,
7.5, 3,
8.5, 8,
8.5001, 13,
14.57,
16 16
], ],
"yValues": [ "yValues": [
0, 5E-4,
0, 0.002,
0.02,
1, 1,
1, 0.02,
0, 0.002,
0 5E-4
], ],
"prefactor": 1E22 "prefactor": 1E20
} }
} }
} }
@@ -112,8 +114,20 @@
} }
}, },
"fk": { "fk": {
"Constant": { "PiecewiseLinear": {
"constant": 0 "xValues": [
0,
7.99,
8.01,
16
],
"yValues": [
-100,
-100,
100,
100
],
"prefactor": 1
} }
} }
} }
@@ -127,10 +141,11 @@
"e-": { "e-": {
"ParticleType": "electron", "ParticleType": "electron",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-12,
"unit": "s"
} }
} }
}, },
@@ -154,7 +169,12 @@
} }
}, },
"Reflector": { "Reflector": {
"NoReflector": {} "ReflectorDPS": {
"position_z": {
"value": 1600,
"unit": "cm"
}
}
}, },
"DensityField": { "DensityField": {
"DynamicDensityField": { "DynamicDensityField": {
@@ -171,7 +191,7 @@
"unit": "eV" "unit": "eV"
}, },
"MaxEnergy": { "MaxEnergy": {
"value": 1E2, "value": 20E3,
"unit": "eV" "unit": "eV"
} }
} }
@@ -196,32 +216,47 @@
} }
}, },
"Interactions": { "Interactions": {
"free": {
"Type": "FreeMovement"
},
"elastic": { "elastic": {
"Type": "ElasticScattering", "Type": "ElasticScattering",
"CrossSection": { "CrossSection": {
"1dFunction": { "PredefinedFunction": "eT2_elastic_scattering_constant"
"Constant": {
"constant": 1.412E-19
}
}
}, },
"Target": "TritiumGas", "Target": "TritiumGas",
"ScatteringAngleDistribution": { "ScatteringAngleDistribution": {
"Isotropic": {} "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+"
} }
} }
}, },
"T+": { "T2+": {
"ParticleType": "T+", "ParticleType": "T2+",
"Mover": { "Mover": {
"Drift": { "Boris": {
"MaximalMovedDistance": { "BorisStepsPerMovementCylce": 10,
"value": 0.001, "MaximalTimestepLength": {
"unit": "m" "value": 1E-8,
"unit": "s"
} }
} }
}, },
@@ -287,23 +322,87 @@
} }
}, },
"Interactions": { "Interactions": {
"free": { "name1": {
"Type": "FreeMovement" "Type": "FreeMovement"
},
"elastic": {
"Type": "ElasticScattering",
"CrossSection": {
"1dFunction": {
"Constant": {
"constant": 1.412E-19
} }
} }
}, },
"Target": "TritiumGas", "T+": {
"ScatteringAngleDistribution": { "ParticleType": "T+",
"Isotropic": {} "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"
}
} }
} }
} }
@@ -315,24 +414,12 @@
"CreationVelocityDistribution": { "CreationVelocityDistribution": {
"VelocityDistributionFromFunction": { "VelocityDistributionFromFunction": {
"VelocityDistributionFunction": { "VelocityDistributionFunction": {
"DirectedDistribution": { "IsotropicDistribution": {
"EnergyDistributionFunction": { "EnergyDistributionFunction": {
"Constant": { "TritiumBetaDecay": {}
"constant": {
"value": 8E-3,
"unit": "eV"
}
}
}, },
"Mass": { "Mass": {
"FromParticleType": "electron" "FromParticleType": "electron"
},
"Direction": {
"vector": [
0,
0,
-1
]
} }
} }
} }
@@ -340,28 +427,21 @@
} }
}, },
"specie2": { "specie2": {
"TrackedSpecieName": "T+", "TrackedSpecieName": "T2+",
"CreationVelocityDistribution": { "CreationVelocityDistribution": {
"VelocityDistributionFromFunction": { "VelocityDistributionFromFunction": {
"VelocityDistributionFunction": { "VelocityDistributionFunction": {
"DirectedDistribution": { "IsotropicDistribution": {
"EnergyDistributionFunction": { "EnergyDistributionFunction": {
"Constant": { "MaxwellBoltzmann": {
"constant": { "Temperature": {
"value": 20E-2, "value": 80,
"unit": "eV" "unit": "K"
} }
} }
}, },
"Mass": { "Mass": {
"FromParticleType": "T+" "FromParticleType": "T2"
},
"Direction": {
"vector": [
0,
0,
-1
]
} }
} }
} }
@@ -385,8 +465,26 @@
} }
}, },
"fk": { "fk": {
"Constant": { "PiecewiseLinear": {
"constant": 0.5 "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
} }
} }
} }
@@ -395,7 +493,7 @@
}, },
"DensityLimit": { "DensityLimit": {
"min": 0, "min": 0,
"max": 1 "max": 1E15
}, },
"PositionLimits": { "PositionLimits": {
"rPosition": { "rPosition": {
@@ -407,8 +505,8 @@
"max": 6.28318530718 "max": 6.28318530718
}, },
"zPosition": { "zPosition": {
"min": 7.94, "min": 0,
"max": 7.96 "max": 16.0
} }
} }
}, },
@@ -476,8 +574,8 @@
"UseInSimulation": "false" "UseInSimulation": "false"
}, },
"Simulation": { "Simulation": {
"SimulatedEvents": 100, "SimulatedEvents": 1,
"EventStride": 100 "EventStride": 1
}, },
"Output": { "Output": {
"folder": "output", "folder": "output",
@@ -490,13 +588,15 @@
"CurrentBorders": { "CurrentBorders": {
"Species": [ "Species": [
"e-", "e-",
"T+" "T2+"
], ],
"Intervall": "EachSync", "Intervall": "EachSync",
"OverwriteLast": "true" "OverwriteLast": "true"
}, },
"DeletionLogger": { "DeletionLogger": {
"Species": "all", "Species": [
"all"
],
"Intervall": "EachSync", "Intervall": "EachSync",
"OverwriteLast": "true" "OverwriteLast": "true"
} }
+11 -5
View File
@@ -1,12 +1,17 @@
{ {
"VectorfieldExample1": { "VectorFields": {
"field1": {
"VectorFieldConstant": { "VectorFieldConstant": {
"Constant": { "Constant": {
"vector": [ 1, 2, 3] "vector": [
1,
2,
3
]
} }
} }
}, },
"VectorfieldExample2": { "field2": {
"VectorFieldFunctionInZ": { "VectorFieldFunctionInZ": {
"zFunction": { "zFunction": {
"Constant3D": { "Constant3D": {
@@ -15,7 +20,7 @@
} }
} }
}, },
"VectorfieldExample3": { "field3": {
"VectorFieldFromArray": { "VectorFieldFromArray": {
"ReadArrayFromFile": { "ReadArrayFromFile": {
"PathToH5": { "PathToH5": {
@@ -32,8 +37,9 @@
"Radius": 0.045, "Radius": 0.045,
"Length": 16 "Length": 16
} }
}
}, },
"VectorfieldExample4": { "field4": {
"VectorFieldFromArray": { "VectorFieldFromArray": {
"ReadArrayFromFile": { "ReadArrayFromFile": {
"PathToH5": { "PathToH5": {
@@ -1,35 +0,0 @@
{
"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"
}
}
}
}
+41 -26
View File
@@ -135,6 +135,23 @@ 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_);
@@ -179,6 +196,8 @@ 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);
@@ -188,6 +207,15 @@ 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);
@@ -197,43 +225,30 @@ 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();
if (v_perp_norm > 0.) {
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(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 = const blitz::TinyVector<double, 3> v_perp_rotated =
kinematic::rotateVector(v_perp, B, total_rotation_angle); kinematic::rotateVector(v_perp, v_parallel, total_rotation_angle);
particle->move(CartesianCoordinate(movement_parallel + movement_drift +
movement_around_gyro_center));
particle->velocity( particle->velocity(
CartesianVector(v_parallel + v_perp_rotated + dv_electric)); 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);