Class PropagationBP

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class PropagationBP : public Module

Propagation through magnetic fields using the Boris method.

This module solves the equations of motion of a relativistic charged particle when propagating through a magnetic field.

It uses the Boris push integration method.

It can be used with a fixed step size or an adaptive version which supports the step size control. The step size control tries to keep the relative error close to, but smaller than the designated tolerance. Additionally a minimum and maximum size for the steps can be set. For neutral particles a rectilinear propagation is applied and a next step of the maximum step size proposed.

Public Functions

PropagationBP(ref_ptr<MagneticField> field = NULL, double fixedStep = 1. * kpc)

maximum step size of the propagation Default constructor for the Boris push. It is constructed with a fixed step size.

Parameters:
  • field

  • fixedStep

PropagationBP(ref_ptr<MagneticField> field, double tolerance, double minStep, double maxStep)

Constructor for the adaptive Boris push.

Parameters:
  • field

  • tolerance – tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep

  • minStep – minStep/c_light is the minimum integration time step

  • maxStep – maxStep/c_light is the maximum integration time step.

virtual void process(Candidate *candidate) const

Propagates the particle. Is called once per iteration.

Parameters:

candidate – The Candidate is a passive object, that holds the information about the state of the cosmic ray and the simulation itself.

Y dY(Vector3d pos, Vector3d dir, double step, double z, double q, double m) const

Calculates the new position and direction of the particle based on the solution of the Lorentz force

Parameters:
  • pos – current position of the candidate

  • dir – current direction of the candidate

  • step – current step size of the candidate

  • z – current redshift is needed to calculate the magnetic field

  • q – current charge of the candidate

  • m – current mass of the candidate

Returns:

return the new calculated position and direction of the candidate

double errorEstimation(const Vector3d x1, const Vector3d x2, double step) const

comparison of the position after one step with the position after two steps with step/2.

Parameters:
  • x1 – position after one step of size step

  • x2 – position after two steps of size step/2

  • step – current step size

Returns:

measurement of the error of the step

Vector3d getFieldAtPosition(Vector3d pos, double z) const

Get magnetic field vector at current candidate position

Parameters:
  • pos – current position of the candidate

  • z – current redshift is needed to calculate the magnetic field

Returns:

magnetic field vector at the position pos

void tryStep(const Y &y, Y &out, Y &error, double h, ParticleState &p, double z, double q, double m) const

Adapt step size if required and calculates the new position and direction of the particle with the usage of the function dY

Parameters:
  • y – current position and direction of candidate

  • out – position and direction of candidate after the step

  • error – error for the current step

  • h – current step size

  • p – current particle state

  • z – current red shift

  • q – current charge of the candidate

  • m – current mass of the candidate

void setField(ref_ptr<MagneticField> field)

Set functions for the parameters of the class PropagationBP Set a specific magnetic field

Parameters:

field – specific magnetic field

void setTolerance(double tolerance)

Set a specific tolerance for the step size adaption

Parameters:

tolerance – tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep.

void setMinimumStep(double minStep)

Set the minimum step for the Boris push

Parameters:

minStep – minStep/c_light is the minimum integration time step

void setMaximumStep(double maxStep)

Set the maximum step for the Boris push

Parameters:

maxStep – maxStep/c_light is the maximum integration time step

ref_ptr<MagneticField> getField() const

Get functions for the parameters of the class PropagationBP, similar to the set functions

double getTolerance() const
double getMinimumStep() const
double getMaximumStep() const
virtual std::string getDescription() const
void setDescription(const std::string &description)
inline void process(ref_ptr<Candidate> candidate) const
inline size_t addReference() const
inline size_t removeReference() const
inline int removeReferenceNoDelete() const
inline size_t getReferenceCount() const

Protected Attributes

mutable size_t _referenceCount
class Y

Public Functions

inline Y()
inline Y(const Vector3d &x, const Vector3d &u)
inline Y(double f)
inline Y operator*(double f) const
inline Y &operator+=(const Y &y)

Public Members

Vector3d x
Vector3d u