Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18dc3d56bb | ||
|
|
cc7d57ba9c | ||
|
|
d8163516e7 | ||
|
|
f130274ea5 | ||
|
|
1e1c84a211 | ||
|
|
d98a14f9ea | ||
|
|
6c02cac31f | ||
|
|
12aeead76d | ||
|
|
4cf84d7f9d | ||
|
|
ba84963f96 | ||
|
|
dc226a8d53 | ||
|
|
1f4314c527 | ||
|
|
1efcb58d35 |
@@ -202,14 +202,18 @@ def plotSpectrumAtZ(filename, path_to_species, z_position, plot_axis, output_per
|
||||
spectrum_at_z = spectrumAtZ(
|
||||
filename, path_to_species, z_position, output_period)
|
||||
E_bins = energyBinsDensityfield(filename, path_to_species)
|
||||
# included to get dn/dE
|
||||
E_bin_volumes = E_bins[1:] - E_bins[:-1]
|
||||
plot_bins, plot_datas = makeBarPlotData(
|
||||
spectrum_at_z[1:-1], E_bins[0:-1], E_bins[1:])
|
||||
spectrum_at_z[1:-1]/E_bin_volumes, E_bins[0:-1], E_bins[1:])
|
||||
plot_axis.plot(plot_bins, plot_datas, label=str(path_to_species))
|
||||
plot_axis.set_xscale("log")
|
||||
plot_axis.set_yscale("log")
|
||||
plot_axis.set_xlabel(r"Energy $E$ (eV)")
|
||||
plot_axis.set_ylabel(
|
||||
r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}\log_{10}E}$ $\left(\frac{1}{\mathrm{m}^{3} \log_{10}(\mathrm{eV})}\right)$")
|
||||
r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}E}$ $\left(\frac{1}{\mathrm{m}^{3} \mathrm{eV}}\right)$")
|
||||
# plot_axis.set_ylabel(
|
||||
# r"Diff. Density $\frac{\mathrm{d}n_e}{\mathrm{d}\log_{10}E}$ $\left(\frac{1}{\mathrm{m}^{3} \log_{10}(\mathrm{eV})}\right)$")
|
||||
|
||||
|
||||
def plotAllSpectrumAtZ(filename, z_position, output_period, specie_keys, output_folder):
|
||||
@@ -256,7 +260,7 @@ def plotLongitudinalParticleCurrentVsZ(filename, path_to_species, plot_axis, out
|
||||
z_bins = zBinsDensityField(filename, path_to_species)
|
||||
plot_axis.plot(z_bins, current_in_z, label=str(path_to_species))
|
||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
||||
plot_axis.set_ylabel(r"Particle current $j$ ($m^{-3}s^{-1}$)")
|
||||
plot_axis.set_ylabel(r"Particle current $j$ ($m^{-2}s^{-1}$)")
|
||||
|
||||
|
||||
def plotAllLongitudinalParticleCurrentVsZ(filename, output_period, specie_keys, output_folder):
|
||||
@@ -278,7 +282,7 @@ def plotLongitudinalElectricCurrentVsZ(filename, path_to_species, plot_axis, out
|
||||
z_bins = zBinsDensityField(filename, path_to_species)
|
||||
plot_axis.plot(z_bins, current_in_z)
|
||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
||||
plot_axis.set_ylabel(r"Electric current $I$ ($A$)")
|
||||
plot_axis.set_ylabel(r"Electric current $I$ ($A$)") # unit should be wrong, think it should be A/m^2
|
||||
|
||||
|
||||
def printDeletionLoggerStats(filename, path_to_species, output_period="LastSyncPeriod"):
|
||||
@@ -300,3 +304,50 @@ def printDeletionLoggerStats(filename, path_to_species, output_period="LastSyncP
|
||||
def printAllDeletionLoggerStats(filename, specie_keys, output_period):
|
||||
for key in specie_keys:
|
||||
printDeletionLoggerStats(filename, key, output_period)
|
||||
|
||||
def zBinsPoissonSolver(filename, path_to_poisson_solver):
|
||||
file = h5py.File(filename, 'r')
|
||||
path_to_border = path_to_poisson_solver + "/BinBorders/longitudinal"
|
||||
return np.array(file[path_to_border])
|
||||
|
||||
def rBinsPoissonSolver(filename, path_to_poisson_solver):
|
||||
file = h5py.File(filename, 'r')
|
||||
path_to_border = path_to_poisson_solver + "/BinBorders/radial"
|
||||
return np.array(file[path_to_border])
|
||||
|
||||
def potential(filename, path_to_poisson_solver, output_period):
|
||||
file = h5py.File(filename, 'r')
|
||||
path_to_density = path_to_poisson_solver + "/SimulationData" + \
|
||||
outputPeriodKey(output_period) + "/Potential"
|
||||
return np.array(file[path_to_density])
|
||||
|
||||
# returns potential averaged over r-direction; assumes only one azimuthal bin
|
||||
def potentialVsZ(filename, path_to_poisson_solver, output_period="LastSyncPeriod"):
|
||||
rbinBorders = rBinsPoissonSolver(filename, path_to_poisson_solver)
|
||||
deltar = rbinBorders[1] - rbinBorders[0] #assumption of linear binning
|
||||
weights = rbinBorders[1:]**2 - rbinBorders[:-1]**2 + deltar**2
|
||||
weights = np.append(deltar**2/4, weights)
|
||||
potentialValues = potential(filename, path_to_poisson_solver, output_period)
|
||||
weightedPotential = potentialValues*weights[:, np.newaxis, np.newaxis]
|
||||
return np.sum(weightedPotential, axis=(0,1)) / np.sum(weights)
|
||||
|
||||
def plotPotentialVsZ(filename, path_to_poisson_solver, plot_axis, output_period="LastSyncPeriod"):
|
||||
potential_ = potentialVsZ(filename, path_to_poisson_solver, output_period)
|
||||
z_bins = zBinsPoissonSolver(filename, path_to_poisson_solver)
|
||||
plot_bins, plot_datas = makeBarPlotData(
|
||||
potential_, z_bins, z_bins)
|
||||
plot_axis.plot(plot_bins, plot_datas)
|
||||
# plot_axis.set_yscale("log")
|
||||
plot_axis.set_xlabel(r"Distance to rear wall $z$ (m)")
|
||||
plot_axis.set_ylabel(r"Potential $\Phi$ ($V$)")
|
||||
|
||||
def plotAllPotentialVsZ(filename, output_period, output_folder):
|
||||
pst.setRcParams()
|
||||
fig, ax = plt.subplots(figsize=pst.set_size('thesis'))
|
||||
key = "PoissonSolver"
|
||||
plotPotentialVsZ(filename, key, ax, output_period)
|
||||
|
||||
ax.set_facecolor('#e7e7e7ff')
|
||||
ax.grid(color='white')
|
||||
fig.savefig(output_folder + "/potential_vs_z_at_period={}.pdf".format(output_period),
|
||||
format='pdf', bbox_inches='tight')
|
||||
@@ -49,7 +49,7 @@ class SimulationOutput {
|
||||
std::vector<OutputTask> tasks_density_fields_;
|
||||
std::vector<OutputTask> tasks_current_collector_;
|
||||
std::vector<OutputTask> tasks_deletion_logger_;
|
||||
OutputTask task_potential_; // no meta data written for now
|
||||
OutputTask task_potential_;
|
||||
|
||||
Hdf5Writer writer;
|
||||
|
||||
|
||||
@@ -55,10 +55,12 @@ class PoissonSolver {
|
||||
std::vector<std::shared_ptr<Electrode>> electrodes,
|
||||
double target_accuracy,
|
||||
int num_cycles,
|
||||
int solver_intervall,
|
||||
int solver_offset,
|
||||
bool do_solver);
|
||||
|
||||
void solvePotential(const blitz::Array<double, 3> charge_density,
|
||||
const bool solve);
|
||||
int cpu_sync);
|
||||
blitz::Array<double, 3> potential();
|
||||
std::shared_ptr<VectorField> staticElectricField();
|
||||
const CylinderBinning* densityBinning();
|
||||
@@ -72,6 +74,8 @@ class PoissonSolver {
|
||||
const CylinderBinning density_binning_;
|
||||
const double target_accuracy_;
|
||||
const int num_cycles_;
|
||||
const int solver_intervall_;
|
||||
const int solver_offset_;
|
||||
const bool do_solver_;
|
||||
|
||||
// density binning defined on the cell centers, potential defined
|
||||
|
||||
@@ -31,8 +31,6 @@ class CurrentCollector {
|
||||
|
||||
double physicalTime() const;
|
||||
|
||||
void resetCurrentCollector();
|
||||
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
|
||||
@@ -38,8 +38,6 @@ class DynamicDensityField : public DensityField {
|
||||
double density(const Coordinate& position);
|
||||
double density(const Coordinate& position, double energy_eV);
|
||||
|
||||
void resetDynamicDensityField();
|
||||
|
||||
blitz::Array<double, 3> densityArray();
|
||||
blitz::Array<double, 4> spectrumArray();
|
||||
blitz::Array<double, 4> timeInBinArray() const;
|
||||
|
||||
@@ -35,9 +35,7 @@ class Injector {
|
||||
std::shared_ptr<EventPositionDistribution> position_distribution,
|
||||
std::shared_ptr<DriftVelocity> mother_drift_velocity);
|
||||
|
||||
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine,
|
||||
const double current_time,
|
||||
const int time_resolution_events);
|
||||
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine);
|
||||
double timePassed() const;
|
||||
|
||||
private:
|
||||
@@ -50,8 +48,7 @@ class Injector {
|
||||
std::mt19937* engine,
|
||||
const Coordinate& position,
|
||||
std::shared_ptr<species::TrackedSpecie> created_specie,
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution,
|
||||
const double time_birth);
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution);
|
||||
};
|
||||
|
||||
#endif /* INJECTOR_H */
|
||||
|
||||
@@ -23,8 +23,6 @@ class DeletionLogger {
|
||||
void numDeletions(long int new_value, DeletionType type);
|
||||
long int numDeletions(DeletionType type) const;
|
||||
|
||||
void resetDeletionLogger();
|
||||
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
|
||||
@@ -14,8 +14,7 @@ class Particle {
|
||||
// Vector* velocity);
|
||||
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity,
|
||||
const double time_birth);
|
||||
const Vector& velocity);
|
||||
|
||||
void position(const Coordinate& new_position);
|
||||
CartesianCoordinate position() const;
|
||||
@@ -47,8 +46,6 @@ class Particle {
|
||||
void resetTimeInBin();
|
||||
double timeInBin() const;
|
||||
|
||||
long int ID() const;
|
||||
|
||||
private:
|
||||
CartesianVector velocity_;
|
||||
CartesianCoordinate position_;
|
||||
|
||||
@@ -34,12 +34,13 @@ class Simulation {
|
||||
void init(Parameter& parameter);
|
||||
void start();
|
||||
void finalize();
|
||||
void processEvents(int events, const int time_resolution_events);
|
||||
void processUntilTermination(particle::Particle& particle);
|
||||
void processEvents(int events);
|
||||
void processUntilTermination(particle::Particle& particle,
|
||||
std::vector<particle::Particle>& particle_queue);
|
||||
|
||||
private:
|
||||
std::vector<particle::Particle> determineInjectedParticles(
|
||||
RandomNumbers* random, const int time_resolution_events);
|
||||
RandomNumbers* random);
|
||||
|
||||
double meanFreePath(particle::Particle& particle, RandomNumbers* random);
|
||||
|
||||
@@ -68,10 +69,6 @@ class Simulation {
|
||||
|
||||
std::shared_ptr<SimulationOutput> output_;
|
||||
std::shared_ptr<CpuSynchronizer> cpu_synchronizer_;
|
||||
|
||||
std::vector<particle::Particle> queues_[2];
|
||||
int active_queue_;
|
||||
int non_active_queue_;
|
||||
};
|
||||
|
||||
#endif /* SIMULATION_H */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "simulation/particle.h"
|
||||
|
||||
class Geometry;
|
||||
class DynamicDensityField;
|
||||
|
||||
class Terminator {
|
||||
public:
|
||||
Terminator(long int max_interactions,
|
||||
|
||||
@@ -10,13 +10,9 @@ class Timer {
|
||||
double time() const;
|
||||
void increaseTimestep(double time_s);
|
||||
void setTime(double time_s);
|
||||
void resetTime();
|
||||
void setDeltaT(double deltaT);
|
||||
double getDeltaT() const;
|
||||
|
||||
private:
|
||||
double current_time_s_;
|
||||
double delta_t_time_resolution_;
|
||||
};
|
||||
|
||||
#endif /* TIMER_H */
|
||||
|
||||
@@ -81,7 +81,7 @@ TARGET_TEST=$(BIN_DIR)/karl_test
|
||||
|
||||
# Compile logic
|
||||
|
||||
all: blitz jansson karl
|
||||
all: blitz hdf5 jansson karl
|
||||
|
||||
check_homebase:
|
||||
ifeq ($(HOMEBASE),)
|
||||
@@ -99,6 +99,12 @@ 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
|
||||
|
||||
@@ -54,6 +54,13 @@
|
||||
"yValuesKey": "/vz(ms)",
|
||||
"prefactor": 1
|
||||
}
|
||||
},
|
||||
"f5": {
|
||||
"Exponential": {
|
||||
"scale": -1,
|
||||
"prefactor": 1,
|
||||
"comment": "f5 = prefactor*exp(scale*x)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"3dto1D examples": {
|
||||
|
||||
@@ -568,6 +568,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GradientField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 2.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GravityField": {
|
||||
@@ -616,7 +625,8 @@
|
||||
"TargetAccuracy": 1e-7,
|
||||
"NumCycles": 2e4,
|
||||
"Intervall": 1,
|
||||
"Offset": 9
|
||||
"Offset": 9,
|
||||
"DoSolver": "true"
|
||||
},
|
||||
"Simulation": {
|
||||
"SimulatedEvents": 1,
|
||||
@@ -639,9 +649,7 @@
|
||||
"OverwriteLast": "true"
|
||||
},
|
||||
"DeletionLogger": {
|
||||
"Species": [
|
||||
"all"
|
||||
],
|
||||
"Species": "all",
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "true"
|
||||
},
|
||||
|
||||
@@ -565,6 +565,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GradientField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PoissonSolver": {
|
||||
@@ -585,13 +594,30 @@
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
},
|
||||
"Boundary": {
|
||||
"Top": {
|
||||
"type": "neumann",
|
||||
"value": 0
|
||||
},
|
||||
"Bottom": {
|
||||
"type": "dirichlet",
|
||||
"value": 0
|
||||
},
|
||||
"Hull": {
|
||||
"type": "dirichlet",
|
||||
"value": 0
|
||||
}
|
||||
},
|
||||
"TargetAccuracy": 1e-7,
|
||||
"NumCycles": 2e4
|
||||
"NumCycles": 2e4,
|
||||
"Intervall": 1,
|
||||
"Offset": 0
|
||||
},
|
||||
"Simulation": {
|
||||
"SimulatedEvents": 1,
|
||||
"EventStride": 1,
|
||||
"PoissonOffset": 0
|
||||
"PoissonOffset": 0,
|
||||
"DoSolver": "false"
|
||||
},
|
||||
"Output": {
|
||||
"folder": "output",
|
||||
|
||||
@@ -1,536 +0,0 @@
|
||||
{
|
||||
"GlobalPositionBinning": {
|
||||
"CylinderBinning": {
|
||||
"Radial": {
|
||||
"NumberOfBins": 10,
|
||||
"MaxRadius": {
|
||||
"value": 5,
|
||||
"unit": "cm"
|
||||
}
|
||||
},
|
||||
"Longitudinal": {
|
||||
"NumberOfBins": 75,
|
||||
"MaxLength": {
|
||||
"value": 300,
|
||||
"unit": "cm"
|
||||
}
|
||||
},
|
||||
"Azimuthal": {
|
||||
"NumberOfBins": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 300,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Species": {
|
||||
"Background": {
|
||||
"TritiumGas": {
|
||||
"ParticleType": "T",
|
||||
"ConstantDensityField": {
|
||||
"ScalarField": {
|
||||
"ScalarFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Product": {
|
||||
"fi": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fj": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"Exponential": {
|
||||
"scale": -7.1307e-4,
|
||||
"prefactor": 1E17
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"VelocityDistribution": {
|
||||
"VelocityDistributionFromFunction": {
|
||||
"VelocityDistributionFunction": {
|
||||
"IsotropicDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"MaxwellBoltzmann": {
|
||||
"Temperature": {
|
||||
"value": 5,
|
||||
"unit": "K"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"DriftVelocity": {
|
||||
"VectorField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Product": {
|
||||
"fi": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fj": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [
|
||||
0,
|
||||
16
|
||||
],
|
||||
"yValues": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"prefactor": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tracked": {
|
||||
"e-": {
|
||||
"ParticleType": "electron",
|
||||
"Mover": {
|
||||
"Drift": {
|
||||
"MaximalMovedDistance": {
|
||||
"value": 1e-3,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 300,
|
||||
"unit": "cm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reflector": {
|
||||
"NoReflector": {}
|
||||
},
|
||||
"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": {
|
||||
"freeMovement": {
|
||||
"Type": "FreeMovement"
|
||||
},
|
||||
"elastic": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "TritiumGas",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "eT2_elastic_scattering_constant"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"T+": {
|
||||
"ParticleType": "T+",
|
||||
"Mover": {
|
||||
"Drift":{
|
||||
"MaximalMovedDistance": {
|
||||
"value": 1e-3,
|
||||
"unit": "m"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Terminator": {
|
||||
"MaximumInteractions": 1E6,
|
||||
"MaxTimeAlive": {
|
||||
"value": 1,
|
||||
"unit": "s"
|
||||
},
|
||||
"BoundaryGeometry": {
|
||||
"Cylinder": {
|
||||
"Radius": {
|
||||
"value": 5,
|
||||
"unit": "cm"
|
||||
},
|
||||
"Height": {
|
||||
"value": 300,
|
||||
"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"
|
||||
},
|
||||
"elastic": {
|
||||
"Type": "ElasticScattering",
|
||||
"Target": "TritiumGas",
|
||||
"CrossSection": {
|
||||
"PredefinedFunction": "eT2_elastic_scattering_constant"
|
||||
},
|
||||
"ScatteringAngleDistribution": {
|
||||
"Isotropic": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Injector": {
|
||||
"CreatedSpecies": {
|
||||
"specie1": {
|
||||
"TrackedSpecieName": "e-",
|
||||
"CreationVelocityDistribution": {
|
||||
"VelocityDistributionFromFunction": {
|
||||
"VelocityDistributionFunction": {
|
||||
"DirectedDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"Constant": {
|
||||
"constant": {
|
||||
"value": 4.30867e-4,
|
||||
"unit": "eV"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "electron"
|
||||
},
|
||||
"Direction":{
|
||||
"vector": [1, 0, 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"specie2": {
|
||||
"TrackedSpecieName": "T+",
|
||||
"CreationVelocityDistribution": {
|
||||
"VelocityDistributionFromFunction": {
|
||||
"VelocityDistributionFunction": {
|
||||
"DirectedDistribution": {
|
||||
"EnergyDistributionFunction": {
|
||||
"Constant": {
|
||||
"constant": {
|
||||
"unit": "eV",
|
||||
"value": 4.30867e-4
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mass": {
|
||||
"FromParticleType": "T"
|
||||
},
|
||||
"Direction": {
|
||||
"vector": [1, 0, 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"EventPositionDistribution": {
|
||||
"ScalarField": {
|
||||
"ScalarFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Product": {
|
||||
"fi": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fj": {
|
||||
"Constant": {
|
||||
"constant": 1
|
||||
}
|
||||
},
|
||||
"fk": {
|
||||
"PiecewiseLinear": {
|
||||
"xValues": [0.0, 3.0],
|
||||
"yValues": [1.0, 1.0],
|
||||
"prefactor": 1E15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"DensityLimit": {
|
||||
"min": 0,
|
||||
"max": 1E15
|
||||
},
|
||||
"PositionLimits": {
|
||||
"rPosition": {
|
||||
"min": 0,
|
||||
"max": 0.05
|
||||
},
|
||||
"phiPosition": {
|
||||
"min": 0,
|
||||
"max": 6.28318530718
|
||||
},
|
||||
"zPosition": {
|
||||
"min": 0,
|
||||
"max": 0.3
|
||||
}
|
||||
}
|
||||
},
|
||||
"MotherDriftVelocity": {
|
||||
"VectorField": {
|
||||
"VectorFieldConstant": {
|
||||
"constant": {
|
||||
"vector": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"unit": "m/s"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Activity": {
|
||||
"value": 1e7,
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GradientField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GravityField": {
|
||||
"VectorField": {
|
||||
"VectorFieldFunctionInZ": {
|
||||
"zFunction": {
|
||||
"Constant3D": {
|
||||
"constant": -9.81
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PoissonSolver": {
|
||||
"BoundaryGeometry": {
|
||||
"CreateSameAs": ["SourceGeometry"]
|
||||
},
|
||||
"PositionBinning": {
|
||||
"CreateSameAs": [
|
||||
"GlobalPositionBinning"
|
||||
]
|
||||
},
|
||||
"Boundary": {
|
||||
"Top": {
|
||||
"type": "neumann",
|
||||
"value": 0
|
||||
},
|
||||
"Bottom": {
|
||||
"type": "dirichlet",
|
||||
"value": 0
|
||||
},
|
||||
"Hull": {
|
||||
"type": "dirichlet",
|
||||
"value": 0
|
||||
}
|
||||
},
|
||||
"TargetAccuracy": 1e-6,
|
||||
"NumCycles": 2e4,
|
||||
"DoSolver": "true"
|
||||
},
|
||||
"Simulation": {
|
||||
"SimulatedEvents": 200000,
|
||||
"EventStride": 5000,
|
||||
"TimeResolutionEvents": 20000,
|
||||
"commentTimeRes": "number of events over all cpus defining the timeresolution"
|
||||
},
|
||||
"Output": {
|
||||
"folder": "output",
|
||||
"filename": "timerestest3",
|
||||
"DensityFields": {
|
||||
"Species": "all",
|
||||
"Intervall": 1,
|
||||
"OverwriteLast": "false"
|
||||
},
|
||||
"CurrentBorders": {
|
||||
"Species": [
|
||||
"e-",
|
||||
"T+"
|
||||
],
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "false"
|
||||
},
|
||||
"DeletionLogger": {
|
||||
"Species": "all",
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "false"
|
||||
},
|
||||
"PoissonSolver": {
|
||||
"Intervall": "EachSync",
|
||||
"OverwriteLast": "false"
|
||||
}
|
||||
},
|
||||
"RandomNumbers": {
|
||||
"Seed": 1337
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ double buildMass(json_t* object) {
|
||||
} else if (json_object_by_path(object, {"value"})) {
|
||||
return json_double(json_object_by_path(object, {"value"}));
|
||||
} else {
|
||||
ERROR("The mass is not given correcty.");
|
||||
ERROR("The mass is not given correctly.");
|
||||
return 0.;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,20 @@ namespace generator {
|
||||
|
||||
auto boundaries = buildBoundaries(parameter, {"PoissonSolver", "Boundary"});
|
||||
|
||||
int solver_intervall = json_int(json_object_by_path(object, {"Intervall"}));
|
||||
if (solver_intervall == 0 &&
|
||||
json_string(json_object_by_path(
|
||||
object, {"Intervall"})) == "EachSync") {
|
||||
solver_intervall = 1;
|
||||
}
|
||||
ASSERT_POSITIVE(&solver_intervall,
|
||||
"The intervall for poisson solver stride must be positive"
|
||||
" or 'EachSync'");
|
||||
|
||||
int solver_offset = json_int(json_object_by_path(object, {"Offset"}));
|
||||
ASSERT_NOTNEGATIVE(&solver_offset,
|
||||
"The offset for poisson solver has to be non-negative");
|
||||
|
||||
std::vector<std::shared_ptr<Electrode>> electrodes{};
|
||||
|
||||
double target_accuracy = parameter.doubleValue(
|
||||
@@ -38,12 +52,13 @@ namespace generator {
|
||||
int num_cycles = parameter.intValue(json_path_append({"PoissonSolver"},
|
||||
{"NumCycles"}));
|
||||
|
||||
bool do_solver = parameter.boolValue(
|
||||
json_path_append({"PoissonSolver"}, {"DoSolver"}), false);
|
||||
bool do_solver = parameter.boolValue(json_path_append({"PoissonSolver"},
|
||||
{"DoSolver"}), true);
|
||||
|
||||
return std::shared_ptr<PoissonSolver>(new PoissonSolver(boundaries.at("Bottom"),
|
||||
boundaries.at("Top"), boundaries.at("Hull"), geometry, position_binning,
|
||||
electrodes, target_accuracy, num_cycles, do_solver));
|
||||
electrodes, target_accuracy, num_cycles, solver_intervall, solver_offset,
|
||||
do_solver));
|
||||
}
|
||||
|
||||
std::map<std::string, GlobalBoundary> buildBoundaries(Parameter& parameter,
|
||||
|
||||
@@ -143,7 +143,7 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
||||
intervall = 1;
|
||||
}
|
||||
ASSERT_POSITIVE(&intervall,
|
||||
"The intervall for the poisson solver output must be positive");
|
||||
"The output intervall for the poisson solver output must be positive.");
|
||||
|
||||
bool overwrite_last = json_bool(
|
||||
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
|
||||
|
||||
@@ -44,8 +44,10 @@ blitz::Array<double, 3> readFromFile(json_t* object) {
|
||||
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component) {
|
||||
std::string absolute_filename =
|
||||
readAbsoluteFilename(json_object_by_path(object, {"PathToH5"}));
|
||||
DEBUG_LEVEL_3("path to h5: " + absolute_filename);
|
||||
std::string key = json_string(
|
||||
json_array_get(json_object_by_path(object, {"Keys"}), component));
|
||||
DEBUG_LEVEL_3("key: " + key);
|
||||
|
||||
Hdf5Reader reader(absolute_filename);
|
||||
return reader.readD3Double(key);
|
||||
|
||||
@@ -30,8 +30,7 @@ InteractionOutput ClusterFormation::performInteraction(
|
||||
const blitz::TinyVector<double, 3> v_cluster =
|
||||
kinematic::velocity(energy_eV, product_->mass_kg()) *
|
||||
v_target / kinematic::norm(v_target);
|
||||
particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster),
|
||||
particle.timeAlive());
|
||||
particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster));
|
||||
|
||||
InteractionOutput output;
|
||||
output.add(cluster);
|
||||
|
||||
@@ -93,14 +93,10 @@ InteractionOutput ElectronIonization::performInteraction(
|
||||
|
||||
particle.velocity(v_impact_new);
|
||||
|
||||
|
||||
const double time_birth = particle.timeAlive();
|
||||
InteractionOutput output;
|
||||
output.add(
|
||||
particle::Particle(electron_, x_impact, CartesianVector(v_ejected),
|
||||
time_birth));
|
||||
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target),
|
||||
time_birth));
|
||||
particle::Particle(electron_, x_impact, CartesianVector(v_ejected)));
|
||||
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target)));
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
std::vector<std::shared_ptr<Electrode>> electrodes,
|
||||
double target_accuracy,
|
||||
int num_cycles,
|
||||
int solver_intervall,
|
||||
int solver_offset,
|
||||
bool do_solver)
|
||||
: bottom_boundary_(bottom_boundary),
|
||||
top_boundary_(top_boundary),
|
||||
@@ -32,6 +34,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
electrodes_(electrodes),
|
||||
target_accuracy_(target_accuracy),
|
||||
num_cycles_(num_cycles),
|
||||
solver_intervall_(solver_intervall),
|
||||
solver_offset_(solver_offset),
|
||||
do_solver_(do_solver) {
|
||||
|
||||
blitz::TinyVector<double, 3> stepsize = density_binning_.stepsize();
|
||||
@@ -77,12 +81,13 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
blitz::Range(density_binning.binIndexMin()(2),
|
||||
density_binning.binIndexMax()(2)));
|
||||
zero_chargedensity = 0.;
|
||||
solvePotential(zero_chargedensity, true);
|
||||
solvePotential(zero_chargedensity, 0);
|
||||
}
|
||||
|
||||
void PoissonSolver::solvePotential(
|
||||
const blitz::Array<double, 3> charge_density, const bool solve) {
|
||||
if (!(do_solver_) || !(solve)) {
|
||||
const blitz::Array<double, 3> charge_density, int cpu_sync) {
|
||||
if ((!do_solver_) || ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_)
|
||||
&& (cpu_sync > 0)))) {
|
||||
return;
|
||||
}
|
||||
DEBUG_LEVEL_3("Interpolating chargedensity.");
|
||||
@@ -240,7 +245,7 @@ bool PoissonSolver::converged(
|
||||
double normalized_maximum =
|
||||
maximum_difference*SI::eps0/(fabs(blitz::max(interpolated_density)) + 1e-12);
|
||||
std::ostringstream message;
|
||||
message << "Maximum Difference normalized by order of magnitude: "
|
||||
message << "Maximum Differenece normalized by order of magnitude: "
|
||||
<< normalized_difference;
|
||||
DEBUG_LEVEL_0(message.str());
|
||||
return normalized_difference < target_accuracy_;
|
||||
|
||||
@@ -133,10 +133,9 @@ void CpuSynchronizer::synchronize(
|
||||
tracked_species) {
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
auto it = tracked_species.begin();
|
||||
// drops due to time being a global variable now
|
||||
//DEBUG_LEVEL_3("Timer Synchronization.");
|
||||
//synchronize(it->second->dynamicDensityField()->timer_.get(),
|
||||
// it->second->lastSyncDensityField()->timer_.get());
|
||||
DEBUG_LEVEL_3("Timer Synchronization.");
|
||||
synchronize(it->second->dynamicDensityField()->timer_.get(),
|
||||
it->second->lastSyncDensityField()->timer_.get());
|
||||
|
||||
for (auto& pair : tracked_species) {
|
||||
// DEBUG_LEVEL_3("dynden Synchronization.");
|
||||
|
||||
@@ -238,16 +238,5 @@ blitz::Array<double, 3> CurrentCollector::currentInR() const {
|
||||
return current_in_r;
|
||||
}
|
||||
double CurrentCollector::physicalTime() const {
|
||||
return timer_->getDeltaT();
|
||||
}
|
||||
|
||||
void CurrentCollector::resetCurrentCollector() {
|
||||
z_negative_crossings = 0.;
|
||||
z_positive_crossings = 0.;
|
||||
|
||||
phi_negative_crossings = 0.;
|
||||
phi_positive_crossings = 0.;
|
||||
|
||||
r_negative_crossings = 0.;
|
||||
r_positive_crossings = 0.;
|
||||
return timer_->time();
|
||||
}
|
||||
@@ -130,7 +130,7 @@ double DynamicDensityField::density(const Coordinate& position) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
const double t = timer_->time();
|
||||
const double time_in_bin = blitz::sum(time_in_bin_s_(
|
||||
position_bin(0), position_bin(1), position_bin(2), blitz::Range::all()));
|
||||
const long int deleted_particles = blitz::sum(deleted_particles_(
|
||||
@@ -146,7 +146,7 @@ double DynamicDensityField::density(const Coordinate& position,
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const int energy_bin = energy_binning_.bin(energy_eV);
|
||||
const double t = timer_->getDeltaT();
|
||||
const double t = timer_->time();
|
||||
const double time_in_bin = time_in_bin_s_(position_bin(0), position_bin(1),
|
||||
position_bin(2), energy_bin);
|
||||
const long deleted_particles = deleted_particles_(
|
||||
@@ -177,7 +177,7 @@ void DynamicDensityField::recalculateDensityArray() {
|
||||
blitz::thirdIndex iz;
|
||||
blitz::fourthIndex iE;
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
const double t = timer_->time();
|
||||
density_per_m3_ = (time_in_bin_s_(ir, iphi, iz, iE) / t -
|
||||
deleted_particles_(ir, iphi, iz, iE)) /
|
||||
bin_volume_m3_(ir, iphi, iz);
|
||||
@@ -205,13 +205,6 @@ double DynamicDensityField::physicalTime() const {
|
||||
return timer_->time();
|
||||
}
|
||||
|
||||
void DynamicDensityField::resetDynamicDensityField() {
|
||||
//timer_->resetTime(); // time stays global
|
||||
time_in_bin_s_ = 0.;
|
||||
deleted_particles_ = 0.;
|
||||
density_per_m3_ = 0.;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "simulation/particle.h"
|
||||
#include "simulation/species.h"
|
||||
#include "simulation/velocity_distribution.h"
|
||||
#include <sstream>
|
||||
|
||||
Injector::Injector(
|
||||
std::vector<InjectorInfo>& injector_info,
|
||||
@@ -27,8 +26,7 @@ particle::Particle Injector::rollNewParticle(
|
||||
std::mt19937* engine,
|
||||
const Coordinate& position,
|
||||
std::shared_ptr<species::TrackedSpecie> created_specie,
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution,
|
||||
const double time_birth) {
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution) {
|
||||
blitz::TinyVector<double, 3> velocity =
|
||||
creation_velocity_distribution->rollVelocity(position, engine)
|
||||
.cartesianEntries();
|
||||
@@ -37,29 +35,20 @@ particle::Particle Injector::rollNewParticle(
|
||||
velocity,
|
||||
mother_drift_velocity_->driftVelocity(position).cartesianEntries());
|
||||
}
|
||||
std::stringstream out;
|
||||
out << created_specie->name() << " created at time: " << time_birth << "s.";
|
||||
DEBUG_LEVEL_3(out.str());
|
||||
return particle::Particle(created_specie, position,
|
||||
CartesianVector(velocity), time_birth);
|
||||
CartesianVector(velocity));
|
||||
}
|
||||
|
||||
std::vector<particle::Particle> Injector::rollNewParticles(
|
||||
std::mt19937* engine, const double current_time,
|
||||
const int time_resolution_events) {
|
||||
std::mt19937* engine) {
|
||||
CylinderCoordinate position = position_distribution_->rollPosition(engine);
|
||||
DEBUG_LEVEL_3("Injected z position: " +
|
||||
std::to_string(position.cylinderEntries()(2)));
|
||||
std::vector<particle::Particle> new_particles;
|
||||
const double delta_t = time_resolution_events*timePassed();
|
||||
std::uniform_real_distribution<> injection_time(current_time - delta_t,
|
||||
current_time);
|
||||
const double time_birth = injection_time(*engine);
|
||||
for (auto& injector_info : injector_infos_) {
|
||||
new_particles.push_back(
|
||||
rollNewParticle(engine, position, injector_info.created_specie,
|
||||
injector_info.creation_velocity_distribution,
|
||||
time_birth));
|
||||
injector_info.creation_velocity_distribution));
|
||||
}
|
||||
return new_particles;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,3 @@ long int DeletionLogger::numDeletions(DeletionType type) const {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DeletionLogger::resetDeletionLogger() {
|
||||
for(auto& pair : num_deletions) {
|
||||
pair.second = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+88
-53
@@ -29,19 +29,22 @@ void BorisMover::move(particle::Particle* particle,
|
||||
auto old_position = particle->position();
|
||||
double old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
|
||||
if (old_kinetic_energy < 1E-9) {
|
||||
// Guard against small enegies taking up much time without contributing to
|
||||
// density
|
||||
return;
|
||||
}
|
||||
// if (old_kinetic_energy < 1E-9) {
|
||||
// DEBUG_LEVEL_2("Particle has too low an energy.");
|
||||
// // Guard against small enegies taking up much time without contributing to
|
||||
// // density
|
||||
// //return;
|
||||
// }
|
||||
|
||||
bool changed_position_bin = false;
|
||||
bool changed_energy_bin = false;
|
||||
bool left_simulation_domain = false;
|
||||
bool died_in_bin = false;
|
||||
|
||||
while (
|
||||
!(changed_position_bin || changed_energy_bin || left_simulation_domain) &&
|
||||
(leftover_distance > 0.)) {
|
||||
!(changed_position_bin || changed_energy_bin
|
||||
|| left_simulation_domain || died_in_bin) &&
|
||||
(leftover_distance > 0.)) {
|
||||
old_position = particle->position();
|
||||
old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
|
||||
@@ -51,8 +54,13 @@ void BorisMover::move(particle::Particle* particle,
|
||||
electric_field->value(old_position).cartesianEntries(old_position);
|
||||
const blitz::TinyVector<double, 3> B =
|
||||
magnetic_field->value(old_position).cartesianEntries(old_position);
|
||||
const blitz::TinyVector<double, 3> g =
|
||||
gravity_field->value(old_position).cartesianEntries(old_position);
|
||||
|
||||
movementStep(particle, E, B, moved_distance);
|
||||
const blitz::TinyVector<double, 3> force_over_q =
|
||||
E + particle->mass_kg()/particle->charge_C()*g;
|
||||
|
||||
movementStep(particle, force_over_q, B, moved_distance);
|
||||
particle->increaseTimeAlive(maximal_time_step_s_);
|
||||
particle->increaseTimeInBin(maximal_time_step_s_);
|
||||
|
||||
@@ -69,6 +77,9 @@ void BorisMover::move(particle::Particle* particle,
|
||||
left_simulation_domain =
|
||||
particle->specie()->terminator()->leftSimulationDomain(particle);
|
||||
|
||||
died_in_bin =
|
||||
particle->specie()->terminator()->reachedMaxTimeAlive(particle);
|
||||
|
||||
leftover_distance -= moved_distance;
|
||||
}
|
||||
|
||||
@@ -187,60 +198,75 @@ void DriftMover::move(particle::Particle* particle,
|
||||
// if particle too slow -> timestep > maximum time the particle lives
|
||||
// -> add maximal timestep to time in bin and stop moving the particle
|
||||
bool died_in_bin = false;
|
||||
const double max_time_alive =
|
||||
particle->specie()->dynamicDensityField()->physicalTime() -
|
||||
particle->timeAlive();
|
||||
const double max_time_alive = particle->specie()->terminator()->maxTimeAlive();
|
||||
|
||||
while (
|
||||
!(changed_position_bin || changed_energy_bin || left_simulation_domain) &&
|
||||
(leftover_distance > 0.) && !(died_in_bin)) {
|
||||
std::stringstream out;
|
||||
old_position = particle->position();
|
||||
old_velocity = particle->velocity();
|
||||
|
||||
out << "cylinder vector pos: " << old_position.cartesianEntries() <<"\n";
|
||||
|
||||
old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
// out << " old kinetic Energy: " << old_kinetic_energy << "\n";
|
||||
|
||||
blitz::TinyVector<double, 3> force_over_charge =
|
||||
electric_field->value(old_position).cartesianEntries(old_position) +
|
||||
gravity_field->value(old_position).cartesianEntries(old_position) *
|
||||
particle->mass_kg() / particle->charge_C();
|
||||
electric_field->value(old_position).cartesianEntries(old_position);
|
||||
|
||||
// gravity force / q
|
||||
force_over_charge += gravity_field->value(old_position).cartesianEntries(old_position)
|
||||
* particle->mass_kg() / particle->charge_C();
|
||||
|
||||
const blitz::TinyVector<double, 3> B =
|
||||
magnetic_field->value(old_position).cartesianEntries(old_position);
|
||||
const double B_norm = kinematic::norm(B);
|
||||
|
||||
const blitz::TinyVector<double, 3> gradB =
|
||||
magnetic_field->gradientValue(old_position).cartesianEntries(old_position);
|
||||
// Todo: add calculation of divB here
|
||||
// use Kassiopeia paper for reference
|
||||
out << " B(cyli): " << magnetic_field->value(old_position).cylinderEntries()<<"\n";
|
||||
|
||||
const blitz::TinyVector<double, 3> v_parallel =
|
||||
kinematic::parallelVector(old_velocity.cartesianEntries(), B);
|
||||
const double v_parallel_norm = kinematic::norm(v_parallel);
|
||||
// out << " v_parallel: " << v_parallel << "\n";
|
||||
|
||||
const blitz::TinyVector<double, 3> v_perp =
|
||||
kinematic::perpendicularVector(old_velocity.cartesianEntries(), B);
|
||||
const double v_perp_norm = kinematic::norm(v_perp);
|
||||
out << " v_perp: " << v_perp << "\n";
|
||||
|
||||
// magnetic moment
|
||||
const double magnetic_moment = (particle->mass_kg()*(v_perp_norm*v_perp_norm)/2)/B_norm;
|
||||
// magnetic moment force / q
|
||||
const double magnetic_moment = (particle->mass_kg()*(v_perp_norm*v_perp_norm/2))/B_norm;
|
||||
out << " magnetic moment: " << magnetic_moment << "\n";
|
||||
|
||||
force_over_charge += -(magnetic_moment / particle->charge_C() * gradB);
|
||||
|
||||
// curvature force
|
||||
force_over_charge += -(magnetic_moment / particle->charge_C() *
|
||||
magnetic_field->gradientValue(old_position).cartesianEntries(old_position));
|
||||
// out << " gradB (cyli): "
|
||||
// << magnetic_field->gradientValue(old_position).cylinderEntries(old_position)
|
||||
// << "\n";
|
||||
// centrifugal force / q
|
||||
force_over_charge += -(particle->mass_kg()/particle->charge_C() *
|
||||
(v_parallel_norm*v_parallel_norm) *
|
||||
kinematic::perpendicularVector(gradB, B) /
|
||||
B_norm);
|
||||
(v_parallel_norm*v_parallel_norm) *
|
||||
kinematic::perpendicularVector(magnetic_field->
|
||||
gradientValue(old_position).cartesianEntries(old_position), B) /
|
||||
B_norm);
|
||||
// debugging
|
||||
// const blitz::TinyVector<double, 3> tmpfrc = -(particle->mass_kg()/particle->charge_C() *
|
||||
// (v_perp_norm*v_perp_norm/2) *
|
||||
// magnetic_field->gradientValue(old_position).cartesianEntries(old_position) /
|
||||
// B_norm);
|
||||
// out << " gradB force/q: " << tmpfrc << "\n";
|
||||
|
||||
const blitz::TinyVector<double, 3> v_drift = driftVelocity(force_over_charge, B);
|
||||
const double v_drift_norm = kinematic::norm(v_drift);
|
||||
|
||||
const double stepsize = std::min(leftover_distance, maximal_distance_m_);
|
||||
// guard against very large timesteps i.e. v ~ 0 -> timestep = Inf
|
||||
// should be a very rare case (but has happend)
|
||||
// should be a very rare case
|
||||
const double timestep = std::min(
|
||||
stepsize / (v_parallel_norm + v_perp_norm + v_drift_norm),
|
||||
max_time_alive);
|
||||
// out << " timestep: " << timestep << "\n";
|
||||
|
||||
const blitz::TinyVector<double, 3> movement_parallel =
|
||||
v_parallel * timestep;
|
||||
@@ -255,6 +281,7 @@ void DriftMover::move(particle::Particle* particle,
|
||||
if (v_perp_norm > SimConstants::compare_epsilon) {
|
||||
const double gyro_radius = particle->mass_kg() * v_perp_norm /
|
||||
(B_norm * particle->charge_C());
|
||||
// out << " gyroradius: " << gyro_radius << "\n";
|
||||
|
||||
const blitz::TinyVector<double, 3> velocity_normal =
|
||||
(-1) * blitz::cross(B, v_perp);
|
||||
@@ -262,46 +289,56 @@ void DriftMover::move(particle::Particle* particle,
|
||||
const blitz::TinyVector<double, 3> offset_to_gyro_center =
|
||||
gyro_radius * velocity_normal / kinematic::norm(velocity_normal);
|
||||
|
||||
const blitz::TinyVector<double, 3> guiding_center =
|
||||
(offset_to_gyro_center + old_position.cartesianEntries());
|
||||
out << " guiding center: " << guiding_center << "\n";
|
||||
out << " offset gyro: " << offset_to_gyro_center << "\n";
|
||||
out << " movement parallel:" << movement_parallel << "\n";
|
||||
|
||||
const double gyro_frequency =
|
||||
particle->charge_C() * B_norm / particle->mass_kg();
|
||||
|
||||
const double total_rotation_angle = -gyro_frequency * timestep;
|
||||
out << " tot rot angle: " << total_rotation_angle << "\n";
|
||||
const blitz::TinyVector<double, 3> movement_around_gyro_center =
|
||||
offset_to_gyro_center -
|
||||
kinematic::rotateVector(offset_to_gyro_center, B,
|
||||
total_rotation_angle);
|
||||
offset_to_gyro_center - kinematic::rotateVector(offset_to_gyro_center,
|
||||
B, total_rotation_angle);
|
||||
// out << " movement around gyro: " << movement_around_gyro_center << "\n";
|
||||
|
||||
const double v_parallel_new_norm = kinematic::norm(v_parallel + dv_electric);
|
||||
// v_perp by conservation of magn. moment
|
||||
const blitz::TinyVector<double, 3> new_position = old_position.cartesianEntries()
|
||||
+ movement_parallel + movement_drift
|
||||
+ movement_around_gyro_center;
|
||||
const blitz::TinyVector<double, 3> B_new =
|
||||
magnetic_field->value(CartesianCoordinate(new_position))
|
||||
.cartesianEntries(CartesianCoordinate(new_position));
|
||||
|
||||
const double v_perp_new_norm =
|
||||
sqrt(2*magnetic_moment*kinematic::norm(B_new)/particle->mass_kg());
|
||||
|
||||
const blitz::TinyVector<double, 3> v_perp_rotated =
|
||||
kinematic::rotateVector(v_perp, B, total_rotation_angle);
|
||||
// out << " v_perp,rotated: " << v_perp_rotated << "\n";
|
||||
|
||||
const double v_parallel_norm_new = kinematic::norm(v_parallel + dv_electric);
|
||||
// might be better to do after the actual movement and then just extract
|
||||
// the position again from the particle
|
||||
const blitz::TinyVector<double, 3> new_position = old_position.cartesianEntries()
|
||||
+ movement_parallel
|
||||
+ movement_drift
|
||||
+ movement_around_gyro_center;
|
||||
|
||||
const blitz::TinyVector<double, 3> B_new =
|
||||
magnetic_field->value(CartesianCoordinate(new_position)).
|
||||
cartesianEntries(CartesianCoordinate(new_position));
|
||||
|
||||
const double v_perp_norm_new =
|
||||
sqrt(2*magnetic_moment*kinematic::norm(B_new)/particle->mass_kg());
|
||||
DEBUG_LEVEL_3(out.str());
|
||||
|
||||
particle->move(CartesianCoordinate(movement_parallel + movement_drift +
|
||||
movement_around_gyro_center));
|
||||
|
||||
// project v_parallel and v_perp onto the new direction of B
|
||||
const blitz::TinyVector<double, 3> v_parallel_new =
|
||||
kinematic::parallelVector(v_parallel + dv_electric, B_new);
|
||||
const blitz::TinyVector<double, 3> v_perp_new =
|
||||
kinematic::perpendicularVector(v_perp_rotated, B_new);
|
||||
kinematic::parallelVector(v_parallel + dv_electric, B_new);
|
||||
const blitz::TinyVector<double, 3> v_perpendicular_new =
|
||||
kinematic::perpendicularVector(v_perp_rotated, B_new);
|
||||
|
||||
// use the new direction for the actual velocity (nec. for mu to be const)
|
||||
const blitz::TinyVector<double, 3> v_new =
|
||||
v_parallel_new/kinematic::norm(v_parallel_new)*v_parallel_norm_new +
|
||||
v_perp_new/kinematic::norm(v_perp_new)*v_perp_norm_new;
|
||||
v_parallel_new/kinematic::norm(v_parallel_new) * v_parallel_new_norm +
|
||||
v_perpendicular_new/kinematic::norm(v_perpendicular_new) * v_perp_new_norm;
|
||||
|
||||
particle->velocity(CartesianVector(v_new));
|
||||
} else {
|
||||
// neccessary to adjust as well? i.e. adjust the direction of v_parallel
|
||||
particle->move(CartesianCoordinate(movement_parallel + movement_drift));
|
||||
particle->velocity(CartesianVector(v_parallel + dv_electric));
|
||||
}
|
||||
@@ -313,9 +350,6 @@ void DriftMover::move(particle::Particle* particle,
|
||||
|
||||
died_in_bin =
|
||||
particle->specie()->terminator()->reachedMaxTimeAlive(particle);
|
||||
if(died_in_bin) {
|
||||
DEBUG_LEVEL_3("Mover: particle died in bin.");
|
||||
}
|
||||
|
||||
changed_position_bin =
|
||||
particle->specie()->dynamicDensityField()->changedPositionBin(
|
||||
@@ -329,6 +363,7 @@ void DriftMover::move(particle::Particle* particle,
|
||||
particle->specie()->terminator()->leftSimulationDomain(particle);
|
||||
|
||||
leftover_distance -= stepsize;
|
||||
DEBUG_LEVEL_3(out.str());
|
||||
}
|
||||
|
||||
particle->specie()->dynamicDensityField()->logMovement(
|
||||
|
||||
@@ -20,13 +20,12 @@ Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
|
||||
Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity,
|
||||
const double time_birth)
|
||||
const Vector& velocity)
|
||||
: specie_(specie),
|
||||
position_(position),
|
||||
velocity_(velocity, position),
|
||||
id_(this->last_id_),
|
||||
time_alive_s_(time_birth),
|
||||
time_alive_s_(0.),
|
||||
time_in_bin_s_(0.),
|
||||
interaction_counter_(0) {
|
||||
last_id_++;
|
||||
@@ -111,8 +110,4 @@ double Particle::timeInBin() const {
|
||||
return time_in_bin_s_;
|
||||
}
|
||||
|
||||
long int Particle::ID() const {
|
||||
return id_;
|
||||
}
|
||||
|
||||
} // namespace particle
|
||||
|
||||
@@ -69,9 +69,6 @@ void Simulation::init(Parameter& parameter) {
|
||||
DEBUG_LEVEL_0("Init cpu synchronizer.");
|
||||
cpu_synchronizer_ = std::make_shared<CpuSynchronizer>();
|
||||
DEBUG_LEVEL_3("Init done.");
|
||||
|
||||
active_queue_ = 0;
|
||||
non_active_queue_ = 1;
|
||||
}
|
||||
|
||||
int eventsThisCpu(int events_all_cpus) {
|
||||
@@ -91,11 +88,6 @@ int eventsOfCycle(int stride, int leftover_events) {
|
||||
}
|
||||
}
|
||||
|
||||
void switch_active(int& active, int& non_active) {
|
||||
non_active = active;
|
||||
active = (active + 1)%2;
|
||||
}
|
||||
|
||||
void Simulation::finalize() {
|
||||
SIM_INFO("Simulation ended.");
|
||||
}
|
||||
@@ -107,47 +99,21 @@ void Simulation::start() {
|
||||
parameter_.intValue(json_path({"Simulation", "EventStride"}), 1);
|
||||
const int total_simulated_events =
|
||||
parameter_.intValue(json_path({"Simulation", "SimulatedEvents"}), 1);
|
||||
const int time_resolution_events =
|
||||
parameter_.intValue(json_path({"Simulation", "TimeResolutionEvents"}),
|
||||
total_simulated_events);
|
||||
|
||||
SIM_INFO("Total simulated events: " + std::to_string(total_simulated_events));
|
||||
SIM_INFO("Simulated events before cpu sync: " + std::to_string(event_stride));
|
||||
const int events_this_cpu = eventsThisCpu(total_simulated_events);
|
||||
const int time_resolution_this_cpu = eventsThisCpu(time_resolution_events);
|
||||
SIM_INFO("Events per cpu (approx.): " + std::to_string(events_this_cpu));
|
||||
int leftover_events = events_this_cpu;
|
||||
int leftover_events_time_resolution = time_resolution_this_cpu;
|
||||
|
||||
const double delta_t = time_resolution_events*injector_->timePassed();
|
||||
timer_->setDeltaT(delta_t);
|
||||
|
||||
int num_cpu_syncs = 0;
|
||||
bool reset = true;
|
||||
|
||||
queues_[0].reserve(events_this_cpu);
|
||||
queues_[1].reserve(events_this_cpu);
|
||||
// bring some order into the reset checks
|
||||
|
||||
timer_->increaseTimestep(delta_t);
|
||||
while (leftover_events > 0) {
|
||||
std::stringstream out;
|
||||
out << "Timeinterval: " << timer_->time() << "s.";
|
||||
out << "\n size of particle: " << sizeof(particle::Particle);
|
||||
DEBUG_LEVEL_3(out.str());
|
||||
|
||||
int events_of_cylcle = eventsOfCycle(event_stride, leftover_events_time_resolution);
|
||||
int events_of_cylcle = eventsOfCycle(event_stride, leftover_events);
|
||||
SIM_INFO("Leftover events on first cpu: " +
|
||||
std::to_string(leftover_events));
|
||||
processEvents(events_of_cylcle, time_resolution_events);
|
||||
DEBUG_LEVEL_3("Size of backup queue: " +
|
||||
std::to_string(queues_[non_active_queue_].size()));
|
||||
processEvents(events_of_cylcle);
|
||||
|
||||
DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events));
|
||||
leftover_events -= events_of_cylcle;
|
||||
leftover_events_time_resolution -= events_of_cylcle;
|
||||
|
||||
reset = !(leftover_events_time_resolution > 0);
|
||||
|
||||
SIM_INFO("Cpu sync.");
|
||||
SimulationTimer::eventStartPoint(std::string("CpuSync"));
|
||||
@@ -157,7 +123,7 @@ void Simulation::start() {
|
||||
|
||||
SIM_INFO("Poisson step.");
|
||||
SimulationTimer::eventStartPoint(std::string("PoissonStep"));
|
||||
poisson_solver_->solvePotential(chargedensity(), reset);
|
||||
poisson_solver_->solvePotential(chargedensity(), num_cpu_syncs);
|
||||
electric_field_->updateDynamicField(poisson_solver_->staticElectricField());
|
||||
|
||||
SimulationTimer::eventStopPoint(std::string("PoissonStep"));
|
||||
@@ -166,28 +132,6 @@ void Simulation::start() {
|
||||
SimulationTimer::eventStartPoint(std::string("Output"));
|
||||
output_->writeSimulationData(num_cpu_syncs, tracked_species_, poisson_solver_.get());
|
||||
SimulationTimer::eventStopPoint(std::string("Output"));
|
||||
|
||||
if(reset) {
|
||||
SIM_INFO("Do resets and increase the timestep for timeresolution.");
|
||||
timer_->increaseTimestep(delta_t);
|
||||
for(auto& pair : tracked_species_) {
|
||||
pair.second->dynamicDensityField()->resetDynamicDensityField();
|
||||
pair.second->lastSyncDensityField()->resetDynamicDensityField();
|
||||
|
||||
// questionable if they need to be reset:
|
||||
// + time res in current
|
||||
// - ions very slow -> very unlikely that an ion crosses a boundary
|
||||
pair.second->currentCollector()->resetCurrentCollector();
|
||||
pair.second->lastSyncCurrentCollector()->resetCurrentCollector();
|
||||
|
||||
// do not need to be reset, since the time resolution considers the same
|
||||
// set of particles
|
||||
// pair.second->deletionLogger()->resetDeletionLogger();
|
||||
// pair.second->lastSyncDeletionLogger()->resetDeletionLogger();
|
||||
}
|
||||
leftover_events_time_resolution = time_resolution_this_cpu;
|
||||
switch_active(active_queue_, non_active_queue_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,18 +139,20 @@ int particleNumberFromQueue(int queue_length, RandomNumbers* random) {
|
||||
return random->rollUniform(0, queue_length);
|
||||
}
|
||||
|
||||
void Simulation::processEvents(int events, const int time_resolution_events) {
|
||||
void Simulation::processEvents(int events) {
|
||||
DEBUG_LEVEL_0("Processing events.");
|
||||
std::vector<particle::Particle> particle_queue;
|
||||
particle_queue.reserve(100);
|
||||
int current_event = 0;
|
||||
while ((current_event < events) || (!queues_[active_queue_].empty())) {
|
||||
while ((current_event < events) || (!particle_queue.empty())) {
|
||||
DEBUG_LEVEL_2("Current event: " + std::to_string(current_event));
|
||||
|
||||
if (queues_[active_queue_].empty()) {
|
||||
if (particle_queue.empty()) {
|
||||
current_event += 1;
|
||||
DEBUG_LEVEL_2("Inject particles to queue.");
|
||||
SimulationTimer::eventStartPoint(std::string("ParticleInjection"));
|
||||
std::vector<particle::Particle> new_particles =
|
||||
determineInjectedParticles(random_.get(), time_resolution_events);
|
||||
determineInjectedParticles(random_.get());
|
||||
#if defined debug_level3
|
||||
for(auto& particle : new_particles) {
|
||||
std::stringstream output_ss;
|
||||
@@ -220,27 +166,25 @@ void Simulation::processEvents(int events, const int time_resolution_events) {
|
||||
SimulationTimer::eventStopPoint(std::string("ParticleInjection"));
|
||||
DEBUG_LEVEL_2("Injected particles to queue.");
|
||||
|
||||
queues_[active_queue_].insert(queues_[active_queue_].end(), new_particles.begin(),
|
||||
particle_queue.insert(particle_queue.end(), new_particles.begin(),
|
||||
new_particles.end());
|
||||
}
|
||||
DEBUG_LEVEL_2("Particles in queue: " +
|
||||
std::to_string(queues_[active_queue_].size()));
|
||||
DEBUG_LEVEL_2("Particles in backup queue: " +
|
||||
std::to_string(queues_[non_active_queue_].size()));
|
||||
DEBUG_LEVEL_2("Particles in queue: " + std::to_string(particle_queue.size()));
|
||||
const int particle_number =
|
||||
particleNumberFromQueue(queues_[active_queue_].size(), random_.get());
|
||||
particleNumberFromQueue(particle_queue.size(), random_.get());
|
||||
|
||||
// extract particle here from queue, so that an extension of the queue does
|
||||
// not mess up the reference
|
||||
particle::Particle particle = queues_[active_queue_].at(particle_number);
|
||||
queues_[active_queue_].erase(queues_[active_queue_].begin() + particle_number);
|
||||
particle::Particle particle = particle_queue.at(particle_number);
|
||||
particle_queue.erase(particle_queue.begin() + particle_number);
|
||||
|
||||
processUntilTermination(particle);
|
||||
processUntilTermination(particle, particle_queue);
|
||||
}
|
||||
}
|
||||
|
||||
void Simulation::processUntilTermination(
|
||||
particle::Particle& particle) {
|
||||
particle::Particle& particle,
|
||||
std::vector<particle::Particle>& particle_queue) {
|
||||
DEBUG_LEVEL_3("Process particle until termination");
|
||||
while (particle.specie()->terminator()->isAlive(&particle)) {
|
||||
auto old_position = particle.position();
|
||||
@@ -267,9 +211,12 @@ void Simulation::processUntilTermination(
|
||||
|
||||
if (particle.specie()->terminator()->reachedMaxTimeAlive(
|
||||
&particle)) {
|
||||
DEBUG_LEVEL_3("Move particle " + particle.specie()->name()
|
||||
+" to backup queue.");
|
||||
queues_[non_active_queue_].push_back(particle);
|
||||
DEBUG_LEVEL_3("Terminate particle " + particle.specie()->name()
|
||||
+". Reached max time alive.");
|
||||
if (particle.specie()->deletionLogger()) {
|
||||
particle.specie()->deletionLogger()->logDeletion(
|
||||
particle.position(), DeletionType::max_time_alive);
|
||||
}
|
||||
break;
|
||||
} else if (particle.specie()->terminator()->leftSimulationDomain(
|
||||
&particle)) {
|
||||
@@ -308,7 +255,7 @@ void Simulation::processUntilTermination(
|
||||
particle.increaseInteractionCounter();
|
||||
|
||||
for (auto& new_particle : output.newParticles()) {
|
||||
queues_[active_queue_].push_back(new_particle);
|
||||
particle_queue.push_back(new_particle);
|
||||
}
|
||||
|
||||
if (output.deleteCurrentParticle()) {
|
||||
@@ -377,10 +324,9 @@ interaction::InteractionOutput Simulation::interact(
|
||||
}
|
||||
|
||||
std::vector<particle::Particle> Simulation::determineInjectedParticles(
|
||||
RandomNumbers* random, const int time_resolution_events) {
|
||||
// timer_->increaseTimestep(injector_->timePassed());
|
||||
return injector_->rollNewParticles(random->engine(),
|
||||
timer_->time(), time_resolution_events);
|
||||
RandomNumbers* random) {
|
||||
timer_->increaseTimestep(injector_->timePassed());
|
||||
return injector_->rollNewParticles(random->engine());
|
||||
}
|
||||
|
||||
//maybe put that into the poisson solver
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "simulation/errors.h"
|
||||
#include "simulation/geometry.h"
|
||||
#include "simulation/density_field.h"
|
||||
|
||||
Terminator::Terminator(long int max_interactions,
|
||||
double max_time_alive,
|
||||
@@ -32,8 +31,7 @@ bool Terminator::reachedMaxInteractions(
|
||||
return particle->interactionCounter() > max_interactions_;
|
||||
}
|
||||
bool Terminator::reachedMaxTimeAlive(const particle::Particle* particle) const {
|
||||
return particle->timeAlive() >= particle->specie()->dynamicDensityField()
|
||||
->physicalTime();
|
||||
return particle->timeAlive() > max_time_alive_;
|
||||
}
|
||||
|
||||
bool Terminator::leftSimulationDomain(
|
||||
|
||||
@@ -13,15 +13,3 @@ void Timer::increaseTimestep(double time_s) {
|
||||
void Timer::setTime(double time_s) {
|
||||
current_time_s_ = time_s;
|
||||
}
|
||||
|
||||
void Timer::resetTime() {
|
||||
setTime(0.);
|
||||
}
|
||||
|
||||
void Timer::setDeltaT(double deltaT) {
|
||||
delta_t_time_resolution_ = deltaT;
|
||||
}
|
||||
|
||||
double Timer::getDeltaT() const {
|
||||
return delta_t_time_resolution_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user