General Purpose Geodetic Library
SgTidalUt1.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #include <math.h>
24 
25 
26 #include <QtCore/QFile>
27 #include <QtCore/QStringList>
28 #include <QtCore/QTextStream>
29 
30 #include <SgTidalUt1.h>
31 #include <SgLogger.h>
32 #include <SgMathSupport.h>
33 
34 
35 
36 
37 
38 
39 
40 void fundArgs_stub (const SgMJD&, double[5]);
41 
42 
43 /*=======================================================================================================
44 *
45 * METHODS:
46 *
47 *======================================================================================================*/
48 //
49 // static first:
50 const QString SgTidalUt1::className()
51 {
52  return "SgTidalUt1";
53 };
54 
55 
56 
57 // An empty constructor:
59  numOfUt1TableRecs4ShortPeriods_(41),
60  numZero_(0)
61 {
62  tideContent_ = tc;
64 
65  if (tideContent_ == CT_SHORT_TERMS_REMOVED) // UT1R
66  {
69  // periods < 35days:
71  }
72  else if (tideContent_ == CT_ALL_TERMS_REMOVED) // UT1S
73  {
74  if (calcVersionValue_ <= 8.200001)
75  {
79  }
80  else if (9.0 <= calcVersionValue_ && calcVersionValue_ < 9.9)
81  {
85  }
86  else if (9.99 < calcVersionValue_ && calcVersionValue_ < 99.99)
87  {
91  }
92  else
93  {
98  ": the CALC version number, " + QString("").setNum(calcVersionValue_) +
99  ", is undocumented. Removing of zonal tides from UT1 is impossible");
100  };
101  }
102  else
103  {
107  };
108 };
109 
110 
111 
112 // A destructor:
114 {
115 };
116 
117 
118 
119 //
120 double SgTidalUt1::calc(const SgMJD& t)
121 {
122  double dUt(0.0);
123  double fArgs[5];
124 
125  if (tideContent_ != CT_FULL)
126  {
127  // evaluate the fundamental arguments:
128  (*fundArgs_)(t, fArgs);
129  // calculate the zonal tidal correction:
130  calcTidalUt1(fArgs, dUt);
131  };
132  return dUt;
133 };
134 
135 
136 
137 //
138 void SgTidalUt1::calcTidalUt1(const double args[5], double& dUt1)
139 {
140  double arg, sinArg, cosArg;
141  dUt1 = 0.0;
142  //
143  for (int i=0; i<*numOfUt1TableRecs_; i++)
144  {
145  arg = 0.0;
146  for (int j=0; j<5; j++)
147  arg += args[j]*ut1Ttable_[i].n_[j];
148  arg = fmod(arg, M_PI*2.0);
149  sincos(arg, &sinArg, &cosArg);
150  dUt1 += ut1Ttable_[i].ut1_sin_*sinArg + ut1Ttable_[i].ut1_cos_*cosArg;
151  };
152  dUt1 *= 1.0E-4; // convert to seconds
153 };
154 /*=====================================================================================================*/
155 
156 
157 
158 
159 
160 
161 /*=======================================================================================================
162 *
163 * FRIENDS:
164 *
165 *======================================================================================================*/
166 //
167 
168 
169 
170 /*=====================================================================================================*/
171 //
172 // aux functions:
173 //
174 //
175 //
176 void fundArgs_stub(const SgMJD&, double args[5])
177 {
178  args[0] = args[1] = args[2] = args[3] = args[4] = 0.0;
179 };
180 
181 
182 
183 // i/o:
184 
185 
186 /*=====================================================================================================*/
187 //
188 // constants:
189 //
190 /*=====================================================================================================*/
191 
192 
193 
194 
195 
196 
197 
198 
199 /*=====================================================================================================*/
SgLogger * logger
Definition: SgLogger.cpp:231
void calcNutationFundArgs_IersConv1996(const SgMJD &tEpoch, double args[5])
void calcNutationFundArgs_IersConv2003(const SgMJD &tEpoch, double args[5])
void calcNutationFundArgs_IersStds1992(const SgMJD &tEpoch, double args[5])
void fundArgs_stub(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:176
const SgUt1TidalTableEntry ut1Ttable_IersConv1996[]
const SgUt1TidalTableEntry ut1Ttable_IersConv2010[]
const SgUt1TidalTableEntry ut1Ttable_IersConv2003[]
const int numOfUt1TableRecs_IersConv2003
const SgUt1TidalTableEntry ut1Ttable_IersStds1992[]
const int numOfUt1TableRecs_IersConv2010
const int numOfUt1TableRecs_IersConv1996
const int numOfUt1TableRecs_IersStds1992
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ TIME
Definition: SgLogger.h:80
Definition: SgMJD.h:59
void(* fundArgs_)(const SgMJD &, double[5])
Definition: SgTidalUt1.h:107
const SgUt1TidalTableEntry * ut1Ttable_
Definition: SgTidalUt1.h:102
UT1TideContentType
Definition: SgTidalUt1.h:60
@ CT_ALL_TERMS_REMOVED
Definition: SgTidalUt1.h:63
@ CT_SHORT_TERMS_REMOVED
Definition: SgTidalUt1.h:62
UT1TideContentType tideContent_
Definition: SgTidalUt1.h:100
SgTidalUt1(UT1TideContentType, double)
Definition: SgTidalUt1.cpp:58
void calcTidalUt1(const double args[5], double &dUt1)
Definition: SgTidalUt1.cpp:138
double calc(const SgMJD &)
Definition: SgTidalUt1.cpp:120
const int numOfUt1TableRecs4ShortPeriods_
Definition: SgTidalUt1.h:104
static const QString className()
Definition: SgTidalUt1.cpp:50
double calcVersionValue_
Definition: SgTidalUt1.h:101
const int * numOfUt1TableRecs_
Definition: SgTidalUt1.h:103
const int numZero_
Definition: SgTidalUt1.h:105