#ifndef MOVER_H #define MOVER_H #include "simulation/electromagnetic_field.h" #include "simulation/particle.h" // class defining the minimum requirements of a mover class class Mover { public: virtual void move(particle::Particle* particle, double mfp_m, ElectricField* electric_field, MagneticField* magnetic_field) = 0; }; // Mover class using the Boris push algorithm for propagation class BorisMover : public Mover { public: // Constructor: sets the maximal timestep acceptable for the Boris puhs algorithm // (should at the very least resolve the gyro timescale of the particle) BorisMover(double maximal_time_step_s); // propagate the Particle particle using the electric and magnetic fields // until the particle has moved a distance of mfp_m or until it changes // either its energy or position bin or it reaches the maximal time the // particle is allowed to live // also updates the density, deletion logger and current collector of the particle species void move(particle::Particle* particle, double mfp_m, ElectricField* electric_field, MagneticField* magnetic_field); private: const double maximal_time_step_s_; // single update step of the Boris push algorithm // updates moved_distance by the distance the particle moved during the update step void movementStep(particle::Particle* particle, const blitz::TinyVector& electric_field, const blitz::TinyVector& magnetic_field, double& moved_distance) const; }; // Mover class using the drift approximation for propagation class DriftMover : public Mover { public: // Constructor: takes the maximal distance the particle is allowed to move during one step // (should be smaller than the length scale defined by the gradient of the modulus of the magnetic field) DriftMover(double maximal_distance); // propagate the Particle particle using the electric and magnetic fields // until the particle has moved a distance of mfp_m or until it changes // either its energy or position bin or it reaches the maximal time the // particle is allowed to live // also updates the density, deletion logger and current collector of the particle species void move(particle::Particle* particle, double mfp_m, ElectricField* electric_field, MagneticField* magnetic_field); private: const double maximal_distance_m_; // single update step using the drift approximation // updates moved_distance by the distance the particle moved during the update step blitz::TinyVector driftVelocity( const blitz::TinyVector& magnetic_field, const blitz::TinyVector& electric_field) const; }; // Mover for the case of no magnetic field. Simply ignores electric and magnetic field // for the movement step, i.e. velocity doesn't change. class EulerMover : public Mover { public: // Constructor: takes the maxium distance the particle is allowed to move during // one update step (used to limit the distance a particle can move // into a neighboring bin before the check can be performed if the bin has been changed) EulerMover(double maximal_distance); void move(particle::Particle* particle, double mfp_m, ElectricField* electric_field, MagneticField* magnetic_field); private: const double maximal_distance_m_; }; #endif /* MOVER_H */