IAP GITLAB

Helix.hpp 2.12 KB
Newer Older
Ralf Ulrich's avatar
Ralf Ulrich committed
1 2
n/*
 * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3 4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This software is distributed under the terms of the GNU General Public
 * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
 * the license.
 */

#pragma once

#include <cmath>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/Vector.hpp>

namespace corsika {
Ralf Ulrich's avatar
Ralf Ulrich committed
17

18
  /*!
Ralf Ulrich's avatar
Ralf Ulrich committed
19
   * Defines a helical path
Ralf Ulrich's avatar
Ralf Ulrich committed
20
   *
21 22 23 24 25 26 27 28 29 30 31 32 33
   * A Helix is defined by the cyclotron frequency \f$ \omega_c \f$, the initial
   * Point r0 and
   * the velocity vectors \f$ \vec{v}_{\parallel} \f$ and \f$ \vec{v}_{\perp} \f$
   * denoting the projections of the initial velocity \f$ \vec{v}_0 \f$ parallel
   * and perpendicular to the axis \f$ \vec{B} \f$, respectively, i.e.
   * \f{align*}{
        \vec{v}_{\parallel} &= \frac{\vec{v}_0 \cdot \vec{B}}{\vec{B}^2} \vec{B} \\
        \vec{v}_{\perp} &= \vec{v}_0 - \vec{v}_{\parallel}
     \f}
   */

  class Helix {

Ralf Ulrich's avatar
Ralf Ulrich committed
34 35
    ///! \todo move VelocityVec into PhysicalUnits
    using VelocityVec = Vector<SpeedType::dimension_type>;
36 37

  public:
Ralf Ulrich's avatar
Ralf Ulrich committed
38
    Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVec const& pvPar,
Ralf Ulrich's avatar
Ralf Ulrich committed
39
          VelocityVec const& pvPerp)
Ralf Ulrich's avatar
Ralf Ulrich committed
40 41 42 43 44 45
        : r0_(pR0)
        , omegaC_(pOmegaC)
        , vPar_(pvPar)
        , vPerp_(pvPerp)
        , uPerp_(vPerp_.cross(vPar_.normalized()))
        , radius_(pvPar.norm() / abs(pOmegaC)) {}
46

Ralf Ulrich's avatar
Ralf Ulrich committed
47
    inline LengthType getRadius() const;
48

Ralf Ulrich's avatar
Ralf Ulrich committed
49 50 51
    inline Point getPosition(TimeType t) const;
    
    inline Point getPositionFromArclength(LengthType l) const;
52

Ralf Ulrich's avatar
Ralf Ulrich committed
53
    inline LengthType getArcLength(TimeType t1, TimeType t2) const;
54

Ralf Ulrich's avatar
Ralf Ulrich committed
55
    inline TimeType getTimeFromArclength(LengthType l) const;
56

Ralf Ulrich's avatar
Ralf Ulrich committed
57 58 59 60 61 62 63
  private:
    Point r0_;             ///! origin of helix, but this is in the center of the
                           ///! "cylinder" on which the helix rotates
    FrequencyType omegaC_; ///! speed of angular rotation
    VelocityVec vPar_;     ///! speed along direction of "cylinder"
    VelocityVec vPerp_, uPerp_; 
    LengthType radius_;
64 65 66 67 68
  };

} // namespace corsika

#include <corsika/detail/framework/geometry/Helix.inl>