Module: Integration

The Integration module bundles numerical integrators for equations of motion / particle motion.

Abstract Interface classes

class AbstractTimeIntegrator

Abstract base class for trajectory time integrators

Subclassed by Integration::FMMVerletIntegrator< FMMSolverT >, Integration::FullSumRK4Integrator, Integration::FullSumVerletIntegrator, Integration::ParallelRK4Integrator, Integration::ParallelVerletIntegrator, Integration::VelocityIntegrator, Integration::VerletIntegrator

Public Types

enum RunState

Values:

enumerator RUNNING
enumerator STOPPED
enumerator IN_TERMINATION
typedef std::pair<double, Core::Particle*> pTobPair_t
typedef std::function<void(Core::Particle *particle, double time)> particleStartMonitoringFctType

Type definition for a function to watch ion start events

Public Functions

explicit AbstractTimeIntegrator(particleStartMonitoringFctType ionStartMonitorFct = nullptr)
explicit AbstractTimeIntegrator(const std::vector<Core::Particle*> &particles, particleStartMonitoringFctType ionStartMonitorFct = nullptr)
virtual ~AbstractTimeIntegrator() = default
virtual void addParticle(Core::Particle *particle) = 0
virtual void run(unsigned int nTimesteps, double dt) = 0
virtual void runSingleStep(double dt) = 0
virtual void finalizeSimulation() = 0
void setTerminationState()

Indicates that the time integration should be terminated at the next possible time

RunState runState() const

Returns the run state of the integrator

double time() const

Gets the simulated time

unsigned int timeStep() const

Gets the current time step

Simple Integrators

class VelocityIntegrator : public Integration::AbstractTimeIntegrator

Ion trajectory integration with a very simple integrator which moves particles in every timestep according to their local velocity.

The velocity calculation and what is exported in every time step is passed to this trajectory integrator externally by functions. Thus, the integration scheme can be applied to various simulation problems.

No space charge or background collision interaction is considered with this integrator.

Public Types

typedef std::function<Core::Vector(Core::Particle *particle, std::size_t particleIndex, double time, unsigned int timestep)> velocityFctType

type definition for velocity calculation functions

typedef std::function<void(std::vector<Core::Particle*> &particles, double time, unsigned int timestep, bool lastTimestep)> timestepWriteFctType

type definition for functions exporting data in every timestep

typedef std::function<void(Core::Vector &newPartPos, Core::Particle *particle, std::size_t particleIndex, double time, unsigned int timestep)> otherActionsFctType

type definition for functions defining “other actions”, which are additional arbitrary actions performed in every time step of the integration

Public Functions

VelocityIntegrator(std::vector<Core::Particle*> particles, velocityFctType velocityFunction, timestepWriteFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr)

Creates a velocity integrator

Parameters:
  • particles – group / cloud of charged particles to be integrated

  • accelerationFunction – A function to calculate the acceleration to the individual particles

  • timestepWriteFunction – A function to export data from the simulation (can be nullptr to flag non usage)

  • otherActionsFunction – A function to perform arbitrary other actions in every time step of the simulation (can be nullptr to flag non usage)

virtual void addParticle(Core::Particle *particle) override

Adds a particle to the velocity integrator

Parameters:

particle – the particle to add

virtual void run(unsigned int nTimesteps, double dt) override

Run the integrator for a number of time steps and terminates the simulation.

Parameters:
  • nTimesteps – number of time steps to run the integration

  • dt – time step length

virtual void runSingleStep(double dt) override

Run the integrator for a single time step

Parameters:

dt – time step length

virtual void finalizeSimulation() override

Finalizes the verlet integration run (should be called after the last time step).

Velocity Verlet (Leapfrog type) Integrators

Velocity verlet integration is a leapfrog type integration algorithm. IDSimF has different velocity verlet integrators with different space charge / particle-particle interaction calculation schemes (Full sum, serial / parallel BTree, FMM with different FMM libraries)

class VerletIntegrator : public Integration::AbstractTimeIntegrator

Ion trajectory integrator with a simple velocity verlet trajectory integrator scheme including space charge. Space charge calculation with a serial Barnes Hut algorithm.

The acceleration calculation and additional actions performed is passed to this trajectory integrator externally by functions. Thus, the integration scheme can be applied to arbitrary simulation problems.

Public Functions

VerletIntegrator(std::vector<Core::Particle*> particles, accelerationFctSingleStepType accelerationFunction, postTimestepFctType postTimestepFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)

Creates a verlet integrator

Parameters:
  • particles – group / cloud of charged particles to be integrated

  • accelerationFunction – a function to calculate the acceleration to the individual particles

  • postTimestepFunction – a function performed for every time step after the particles are moved (for data export etc.)

  • otherActionsFunction – a function to perform arbitrary other actions in every time step of the simulation

  • collisionModel – a collision model, modeling the interaction between charged particles and background gas

VerletIntegrator(accelerationFctSingleStepType accelerationFunction, postTimestepFctType postTimestepFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)

Creates an empty verlet integrator (without simulated particles)

Parameters:
  • accelerationFunction – a function to calculate the acceleration to the individual particles

  • postTimestepFunction – a function to export data from the simulation

  • otherActionsFunction – a function to perform arbitrary other actions in every time step of the simulation

  • collisionModel – a collision model, modeling the interaction between charged particles and background gas

virtual void addParticle(Core::Particle *particle) override

Adds a particle to the verlet integrator (required if particles are generated in the course of the simulation)

Parameters:
  • particle – the particle to add to the verlet integration

  • extIndex – an external numerical index / key for the particle to add

virtual void run(unsigned int nTimesteps, double dt) override

Run the verlet integrator for a number of time steps and terminates the simulation.

Parameters:
  • nTimesteps – number of time steps to run the verlet integration

  • dt – time step length

virtual void runSingleStep(double dt) override

Run the verlet integrator for a single time step

Parameters:

dt – time step length

virtual void finalizeSimulation() override

Finalizes the verlet integration run (should be called after the last time step).

class ParallelVerletIntegrator : public Integration::AbstractTimeIntegrator

Ion trajectory integrator with a velocity verlet trajectory integrator scheme including space charge. Space charge calculation with a partly parallelized version of a Barnes-Hut Tree.

The acceleration calculation and additional actions performed is passed to this trajectory integrator externally by functions. Thus, the integration scheme can be applied to arbitrary simulation problems.

Public Functions

ParallelVerletIntegrator(const std::vector<Core::Particle*> &particles, accelerationFctSingleStepType accelerationFunction, postTimestepFctType postTimestepFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
ParallelVerletIntegrator(accelerationFctSingleStepType accelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType postTimestepFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
virtual void addParticle(Core::Particle *particle) override

Adds a particle to the verlet integrator (required if particles are generated in the course of the simulation

Parameters:

particle – the particle to add to the verlet integration

virtual void run(unsigned int nTimesteps, double dt) override

Runs the integration

Parameters:
  • nTimesteps – number of time steps to run

  • dt – time step length

virtual void runSingleStep(double dt) override

Runs a single step of the integration

Parameters:

dt – time step length

virtual void finalizeSimulation() override

Finalizes the verlet integration run (should be called after the last time step).

template<class FMMSolverT>
class FMMVerletIntegrator : public Integration::AbstractTimeIntegrator

Public Functions

FMMVerletIntegrator(const std::vector<Core::Particle*> &particles, accelerationFctSingleStepType accelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
FMMVerletIntegrator(accelerationFctSingleStepType accelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
virtual void addParticle(Core::Particle *particle) override
virtual void run(unsigned int nTimesteps, double dt) override
virtual void runSingleStep(double dt) override
virtual void finalizeSimulation() override
FMMSolverT *getFMMSolver()
class FullSumVerletIntegrator : public Integration::AbstractTimeIntegrator

Public Functions

FullSumVerletIntegrator(const std::vector<Core::Particle*> &particles, accelerationFctSingleStepType accelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
FullSumVerletIntegrator(accelerationFctSingleStepType accelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
virtual void addParticle(Core::Particle *particle) override

Adds a particle to the verlet integrator (required if particles are generated in the course of the simulation

Parameters:

particle – the particle to add to the verlet integration

virtual void run(unsigned int nTimesteps, double dt) override
virtual void runSingleStep(double dt) override
virtual void finalizeSimulation() override

Finalizes the verlet integration run (should be called after the last time step).

Runge-Kutta 4 Integrators

Integrators with the classical Runge-Kutta 4 algorithm with different space charge / particle-particle interaction calculation schemes (Full sum, parallel BTree)

class ParallelRK4Integrator : public Integration::AbstractTimeIntegrator

Public Functions

ParallelRK4Integrator(const std::vector<Core::Particle*> &particles, accelerationFctType accelerationFunction, accelerationFctSpaceChargeType spaceChargeAccelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
ParallelRK4Integrator(accelerationFctType accelerationFunction, accelerationFctSpaceChargeType spaceChargeAccelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
virtual void addParticle(Core::Particle *particle) override

Adds a particle to the verlet integrator (required if particles are generated in the course of the simulation

Parameters:

particle – the particle to add to the verlet integration

virtual void run(unsigned int nTimesteps, double dt) override
virtual void runSingleStep(double dt) override
virtual void finalizeSimulation() override

Finalizes the RK4 integration run (should be called after the last time step).

class FullSumRK4Integrator : public Integration::AbstractTimeIntegrator

Public Functions

FullSumRK4Integrator(const std::vector<Core::Particle*> &particles, accelerationFctType accelerationFunction, accelerationFctSpaceChargeType spaceChargeAccelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
FullSumRK4Integrator(accelerationFctType accelerationFunction, accelerationFctSpaceChargeType spaceChargeAccelerationFunction, postTimestepFctType timestepWriteFunction = nullptr, otherActionsFctType otherActionsFunction = nullptr, AbstractTimeIntegrator::particleStartMonitoringFctType ionStartMonitoringFunction = nullptr, CollisionModel::AbstractCollisionModel *collisionModel = nullptr)
virtual void addParticle(Core::Particle *particle) override

Adds a particle to the Full Sum RK4 integrator (required if particles are generated in the course of the simulation

Parameters:

particle – the particle to add to the verlet integration

virtual void run(unsigned int nTimesteps, double dt) override
virtual void runSingleStep(double dt) override
virtual void finalizeSimulation() override

Finalizes the RK4 integration run (should be called after the last time step).