#ifndef VELOCITY_DISTRIBUTION_H #define VELOCITY_DISTRIBUTION_H #include #include #include "simulation/coordinates.h" class VelocityDistributionFunction; class VelocityDistribution { public: virtual CartesianVector rollVelocity(const Coordinate& position, std::mt19937* engine) = 0; }; class VelocityDistributionFromFunction : public VelocityDistribution { public: VelocityDistributionFromFunction( std::shared_ptr fv); CartesianVector rollVelocity(const Coordinate& position, std::mt19937* engine); private: std::shared_ptr fv_; }; // only applicable to TrackedSpecies (i.e. only for DynamicDensityFields) // other density don't have any information about the velocity direction class DynamicDensityField; class MagneticField; // Class to draw a velocity from the pitch angle resolved density class VelocityDistributionFromDensityField : public VelocityDistribution { public: // Constructor: takes shared ptr to the DynamicDensityField object from which // should be drawn and the mass of the species to which the density // field belongs VelocityDistributionFromDensityField( std::shared_ptr density_field, double mass_kg); // stub: can be implemented to return the drift velocity of the particles // at the CylinderVector position of the density field CartesianVector driftVelocity_ms(const CylinderVector& position); // returns a velocity vector drawn from the energy and pitch angle distributions // since no magnetic field is given use e_z as the direction wrt the definition // of the pitch angle CartesianVector rollVelocity(const Coordinate& position, std::mt19937* engine); // returns a velocity vector drawn from the energy and pitch angle distributions // use the given magnetic field at the provided position to determine the // direction of velocity from the pitch angle // the direction of the perpendicular part of the velocity vector is drawn isotropically CartesianVector rollVelocity( const Coordinate& position, std::mt19937* engine, std::shared_ptr magnetic_field); // return a velocity vector drawn uniformly in the bin specifed by index CartesianVector drawVelocity(const blitz::TinyVector index, std::mt19937* engine); CartesianVector drawVelocity(const blitz::TinyVector index, std::mt19937* engine, const Coordinate& position, std::shared_ptr magnetic_field); private: // mass of the species of which the density field is a part of const double mass_kg_; std::shared_ptr density_field_; blitz::Array energy_values; blitz::Array mu_values; std::vector energyBinBorders_; std::vector pitchAngleBinBorders_; std::uniform_real_distribution theta_distribution_; }; #endif /* VELOCITY_DISTRIBUTION_H */