File: tidesSolidMoon.cpp

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 (86 lines) | stat: -rw-r--r-- 2,624 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
/***********************************************/
/**
* @file tidesSolidMoon.cpp
*
* @brief Solid moon tides.
* @see Tides
*
* @author Beate Klinger
* @date 2013-xx-xx
*
*/
/***********************************************/

#include "base/import.h"
#include "base/sphericalHarmonics.h"
#include "config/config.h"
#include "classes/earthRotation/earthRotation.h"
#include "classes/tides/tidesSolidMoon.h"

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

TidesSolidMoon::TidesSolidMoon(Config &config)
{
  try
  {
    readConfig(config, "k20",    kReal20, Config::DEFAULT,  "0.0213", "");
    readConfig(config, "k30",    kReal30, Config::DEFAULT,  "0.0",    "");
    readConfig(config, "factor", factor,  Config::DEFAULT,  "1.0",    "the result is multiplied by this factor, set -1 to subtract the field");
    if(isCreateSchema(config)) return;
  }
  catch(std::exception &e)
  {
    GROOPS_RETHROW(e)
  }
}

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

// Geopotential (IERS-Convetions 2010) Step 1
// ------------------------------------------------
void TidesSolidMoon::moonCoefficients1(Double GM_third, const Vector3d &third, Matrix &cnm, Matrix &snm) const
{
  // Kugelflaechenfunktionen berechnen
  Matrix Cnm, Snm;
  SphericalHarmonics::CnmSnm(1./R_Moon * third, 3, Cnm, Snm);

  Double factor1 = GM_third/GM_Moon;
  Double kReal = 0.0;

  // Formel (1)
  for(UInt n=2; n<=3; n++)
    for(UInt m=0; m<=0; m++)
    {
      if (n == 2)
        kReal = kReal20;
      if (n == 3)
        kReal = kReal30;

      // nur Realteil berücksichtigt, kein Imaginärteil
      cnm(n,m) += factor1/(2.*n+1.) * (kReal * Cnm(n,m));
      snm(n,m) += factor1/(2.*n+1.) * (kReal * Snm(n,m));
    }
}

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

SphericalHarmonics TidesSolidMoon::sphericalHarmonics(const Time &time, const Rotary3d &rotMoon, EarthRotationPtr /*rotation*/, EphemeridesPtr ephemerides, UInt maxDegree, UInt minDegree, Double GM, Double R) const
{
  try
  {
    Matrix cnm(5, Matrix::TRIANGULAR, Matrix::LOWER);
    Matrix snm(5, Matrix::TRIANGULAR, Matrix::LOWER);

    const Vector3d posMoon = ephemerides->position(time, Ephemerides::MOON);
    moonCoefficients1(GM_Sun,   rotMoon.rotate(ephemerides->position(time, Ephemerides::SUN)   - posMoon), cnm, snm);
    moonCoefficients1(GM_Earth, rotMoon.rotate(ephemerides->position(time, Ephemerides::EARTH) - posMoon), cnm, snm);

    return SphericalHarmonics(GM_Moon, R_Moon, factor*cnm, factor*snm).get(maxDegree, minDegree, GM, R);
  }
  catch(std::exception &e)
  {
    GROOPS_RETHROW(e)
  }
}

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