File: miscAccelerationsRelativisticEffect.h

package info (click to toggle)
groops 0%2Bgit20250907%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 11,140 kB
  • sloc: cpp: 135,607; fortran: 1,603; makefile: 20
file content (107 lines) | stat: -rw-r--r-- 3,845 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/***********************************************/
/**
* @file miscAccelerationsRelativisticEffect.h
*
* @brief Relativistic effect (IERS2010).
* @see MiscAccelerations
*
* @author Torsten Mayer-Guerr
* @date 2014-03-15
*
*/
/***********************************************/

#ifndef __GROOPS_MISCACCELERATIONSRELATIVISTICEFFECT__
#define __GROOPS_MISCACCELERATIONSRELATIVISTICEFFECT__

// Latex documentation
#ifdef DOCSTRING_MiscAccelerations
static const char *docstringMiscAccelerationsRelativisticEffect = R"(
\subsection{Relativistic effect}\label{miscAccelerationsType:relativisticEffect}
The relativistic effect to the acceleration of an artificial Earth satellite
according to IERS2010 conventions.

The macro model and the attitude of the satellite is not needed.
)";
#endif

/***********************************************/

#include "base/planets.h"
#include "inputOutput/logging.h"
#include "classes/miscAccelerations/miscAccelerations.h"

/***** CLASS ***********************************/

/** @brief Relativistic effect (IERS2010).
* @ingroup miscAccelerationsGroup
* @see MiscAccelerations */
class MiscAccelerationsRelativisticEffect : public MiscAccelerationsBase
{
  Double   factor;
  Double   GM;
  Double   beta, gamma;
  Vector3d J;

public:
  MiscAccelerationsRelativisticEffect(Config &config);

  Vector3d acceleration(SatelliteModelPtr satellite, const Time &time, const Vector3d &position, const Vector3d &velocity,
                        const Rotary3d &rotSat, const Rotary3d &rotEarth, EphemeridesPtr ephemerides) override;
};

/***********************************************/

inline MiscAccelerationsRelativisticEffect::MiscAccelerationsRelativisticEffect(Config &config)
{
  try
  {
    Double momentum;

    readConfig(config, "beta",   beta,     Config::DEFAULT,  "1.0",   "PPN (parameterized post-Newtonian) parameter");
    readConfig(config, "gamma",  gamma,    Config::DEFAULT,  "1.0",   "PPN (parameterized post-Newtonian) parameter");
    readConfig(config, "J",      momentum, Config::DEFAULT,  "9.8e8", "Earth’s angular momentum per unit mass [m**2/s]");
    readConfig(config, "GM",     GM,       Config::DEFAULT,  STRING_DEFAULT_GM, "Geocentric gravitational constant");
    readConfig(config, "factor", factor,   Config::DEFAULT,  "1.0",   "the result is multiplied by this factor");
    if(isCreateSchema(config)) return;

    J = Vector3d(0, 0, momentum);
  }
  catch(std::exception &e)
  {
    GROOPS_RETHROW(e)
  }
}

/***********************************************/

inline Vector3d MiscAccelerationsRelativisticEffect::acceleration(SatelliteModelPtr /*satellite*/, const Time &time,
                                                                  const Vector3d &pos, const Vector3d &vel,
                                                                  const Rotary3d &/*rotSat*/, const Rotary3d &rotEarth, EphemeridesPtr ephemerides)
{
  try
  {
    if(!ephemerides)
      throw(Exception("No ephemerides given"));
    if(vel.r() == 0.)
      logWarning<<"MiscAccelerationsRelativisticEffect: velocity is zero"<<Log::endl;

    // Position and velocity of sun relative to Earth
    Vector3d posSun, velSun;
    ephemerides->ephemeris(time, Ephemerides::SUN, posSun, velSun);

    const Double   r = pos.r();
    const Vector3d a = GM/pow(LIGHT_VELOCITY,2)/pow(r,3) * ((2*(beta+gamma)*GM/r-gamma*vel.quadsum())*pos + 2*(1+gamma)*inner(pos,vel) * vel
                                                           +(1+gamma)*(3/r/r*inner(pos,J)*crossProduct(pos,vel) + crossProduct(vel,J)))
                     + GM_Sun/pow(LIGHT_VELOCITY,2)/pow(posSun.r(),3) * (1+2*gamma) * crossProduct(crossProduct(velSun, posSun), vel);
    return factor * rotEarth.rotate(a);
  }
  catch(std::exception &e)
  {
    GROOPS_RETHROW(e)
  }
}

/***********************************************/

#endif