Many, many more comments

This commit is contained in:
2024-12-04 17:15:04 +01:00
parent 8696517336
commit 03854339ca
100 changed files with 1702 additions and 49 deletions
+63
View File
@@ -7,55 +7,117 @@
#include "simulation/position_binning.h"
#include "simulation/timer.h"
// class to store and calculate particle currents
class CurrentCollector {
public:
// Constructor: takes a CylinderBinning object to create the crossing and area arrays
// a shared_ptr of a timer object (object be shared between all
// CurrentCollectors and DensityFields regardless of specie)
CurrentCollector(const CylinderBinning& position_binning,
std::shared_ptr<Timer> timer);
// from the pointer to the particle and the Coordinate of an old position (e.g. before movement)
// crossings over bin boundaries are determined and stored
void collect(particle::Particle* particle, const Coordinate& old_position);
// returns the blitz::Array containing the crossings out of the bins in radial direction
blitz::Array<double, 3> negativeCrossingsInR() const;
// returns the blitz::Array containing the crossins into the bins in radial direction
blitz::Array<double, 3> positiveCrossingsInR() const;
// return a blitz::Array with the areas of the bin borders in radial direction
blitz::Array<double, 3> areaInR() const;
// return a blitz::Array with the particle current in radial direction (in m^-2s^-1)
blitz::Array<double, 3> currentInR() const;
// returns the blitz::Array containing the crossings out of the bins in azimuthal direction
blitz::Array<double, 3> negativeCrossingsInPhi() const;
// returns the blitz::Array containing the crossins into the bins in azimuthal direction
blitz::Array<double, 3> positiveCrossingsInPhi() const;
// return a blitz::Array with the areas of the bin borders in azimuthal direction
blitz::Array<double, 3> areaInPhi() const;
// return a blitz::Array with the particle current in azimuthal direction (in m^-2s^-1)
blitz::Array<double, 3> currentInPhi() const;
// returns the blitz::Array containing the crossings out of the bins in longitudinal direction
blitz::Array<double, 3> negativeCrossingsInZ() const;
// returns the blitz::Array containing the crossins into the bins in longitudinal direction
blitz::Array<double, 3> positiveCrossingsInZ() const;
// return a blitz::Array with the areas of the bin borders in longitudinal direction
blitz::Array<double, 3> areaInZ() const;
// return a blitz::Array with the particle current in longitudinal direction (in m^-2s^-1)
blitz::Array<double, 3> currentInZ() const;
// return the time from the Timer object
double physicalTime() const;
// give the CpuSynchronizer class access to the private member variables to
// make synchronization between processes simpler
friend class CpuSynchronizer;
private:
// determine whether the particle moves out of or into a bin in radial direction from two TinyVectors containing
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
// is then updated at the closest boundary position of the new bin; if multiple bins would
// be crossed only the boundary described above will receive an update
void collectRadialMovement(const blitz::TinyVector<int, 3>& bin_old,
const blitz::TinyVector<int, 3>& bin_new);
// determine whether the particle moves out of or into a bin in longitudinal direction from two TinyVectors containing
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
// is then updated at the closest boundary position of the new bin; if multiple bins would
// be crossed only the boundary described above will receive an update
void collectLongitudinalMovement(const blitz::TinyVector<int, 3>& bin_old,
const blitz::TinyVector<int, 3>& bin_new);
// determine whether the particle moves out of or into a bin in azimuthal direction from two TinyVectors containing
// the indices of two bins of the CylinderBinning, the corresponding crossings member array
// is then updated at the closest boundary position of the new bin (periodic nature is accouted for); if multiple bins would
// be crossed only the boundary described above will receive an update
void collectAzimuthalMovement(const blitz::TinyVector<int, 3>& bin_old,
const blitz::TinyVector<int, 3>& bin_new);
/*
schematics for the numbering of the bins and the corresponding borders
longitudinal:
underflow bin 0 bin 1 bin 2 ... bin N-1 overflow
---------|------------|------------|------------| ... |------------|--------
border_0 border_1 border_2 border_3 ... border_N-1 border_N
radial:
bin 0 bin 1 bin 2 ... bin N-1 overflow
----------|------------|------------| ... |------------|--------
border_0 border_1 border_2 ... border_N-2 border_N-1
azimuthal:
bin N-1 bin 0 bin 1 bin 2 ... bin N-1 bin 0
---------|------------|------------|------------| ... |------------|--------
border_0 border_1 border_2 border_3 ... border_N-1 border_0
*/
// create the array containing the areas of the different boundary sections between bins in longitudinal direction
// uses the provided CylinderBinning for the spacings of the bins
blitz::Array<double, 3> createAreaLongitudinal(
const CylinderBinning& position_binning);
// return an array for the counting of crossings across the bin borders in longitudinal direction
blitz::Array<double, 3> createCrossingsLongitudinal(
const CylinderBinning& position_binning);
// return an array containing the areas of the different boundary sections between bins in radial direction
// uses the provided CylinderBinning for the spacings of the bins
blitz::Array<double, 3> createAreaRadial(
const CylinderBinning& position_binning);
// return an array for the counting of crossings across the bin borders in radial direction
blitz::Array<double, 3> createCrossingsRadial(
const CylinderBinning& position_binning);
// create the array containing the areas of the different boundary sections between bins in azimuthal direction
// uses the provided CylinderBinning for the spacings of the bins
blitz::Array<double, 3> createAreaAzimuthal(
const CylinderBinning& position_binning);
// return an array for the counting of crossings across the bin borders in azimuthal direction
blitz::Array<double, 3> createCrossingsAzimuthal(
const CylinderBinning& position_binning);
// Arrays for the storage of boundary crossings
blitz::Array<double, 3> z_negative_crossings;
blitz::Array<double, 3> z_positive_crossings;
@@ -65,6 +127,7 @@ class CurrentCollector {
blitz::Array<double, 3> r_negative_crossings;
blitz::Array<double, 3> r_positive_crossings;
// Arrays with the size area of the boundary segments
blitz::Array<double, 3> collector_areas_r;
blitz::Array<double, 3> collector_areas_phi;
blitz::Array<double, 3> collector_areas_z;