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 
33 
34 void fundArgs_stub (const SgMJD&, double[5]);
35 void fundArgs_UT1ZT (const SgMJD&, double[5]);
36 void fundArgs_NUTFA (const SgMJD&, double[5]);
37 void fundArgs_NUTF96 (const SgMJD&, double[5]);
38 void fundArgs_NUTFA10(const SgMJD&, double[5]);
39 
40 
41 void calcUT1stub(const double[5], double&);
42 void calcUT1ZT (const double[5], double&);
43 void calcUT1S_82(const double[5], double&);
44 void calcUT1S_83(const double[5], double&);
45 void calcUT1S2K (const double[5], double&);
46 
47 
48 
49 
50 
51 /*=======================================================================================================
52 *
53 * METHODS:
54 *
55 *======================================================================================================*/
56 //
57 // static first:
58 const QString SgTidalUt1::className()
59 {
60  return "SgTidalUt1";
61 };
62 
63 
64 
65 // An empty constructor:
67 {
68  tideContent_ = tc;
70 
71  if (tideContent_ == CT_SHORT_TERMS_REMOVED) // UT1R
72  {
75  }
76  else if (tideContent_ == CT_ALL_TERMS_REMOVED) // UT1S
77  {
78  if (calcVersionValue_ <= 8.200001)
79  {
82  }
83  else if (9.0 <= calcVersionValue_ && calcVersionValue_ < 9.9)
84  {
87  }
88  else if (9.99 < calcVersionValue_ && calcVersionValue_ < 99.99)
89  {
92  }
93  else
94  {
98  ": the CALC version number, " + QString("").setNum(calcVersionValue_) +
99  ", is undocumented. Removing of zonal tides from UT1 is impossible");
100  };
101  }
102  else
103  {
106  };
107 };
108 
109 
110 
111 // A destructor:
113 {
114 };
115 
116 
117 
118 //
119 double SgTidalUt1::calc(const SgMJD& t)
120 {
121  double dUt(0.0);
122  double fArgs[5];
123 
124  // evaluate the fundamental arguments:
125  (*fundArgs)(t, fArgs);
126 
127  // calculate the zonal tidal correction:
128  (*calcUT1_UTC)(fArgs, dUt);
129  return dUt;
130 };
131 /*=====================================================================================================*/
132 
133 
134 
135 
136 
137 
138 /*=======================================================================================================
139 *
140 * FRIENDS:
141 *
142 *======================================================================================================*/
143 //
144 
145 
146 
147 /*=====================================================================================================*/
148 //
149 // aux functions:
150 //
151 //
152 //
153 void fundArgs_stub(const SgMJD&, double args[5])
154 {
155  args[0] = args[1] = args[2] = args[3] = args[4] = 0.0;
156 };
157 
158 
159 
160 //
161 void fundArgs_UT1ZT(const SgMJD& t, double args[5])
162 {
163  //
164  // ! 1. UT1ZT PROGRAM SPECIFICATION
165  //
166  // ! 1.1 Evaluate the effects of zonal earth tides on the rotation
167  // ! of the earth.
168  //
169  // ! 1.2 REFERENCES:
170  // ! 1. YODER, WILLIAMS, AND PARKE, 1981, "TIDAL
171  // ! VARIATIONS OF EARTH ROTATION", J. GEOPHYS.
172  // ! RES., VOL. 86, P. 881-891.
173  // ! 2. PROJECT MERIT STANDARDS, W. MELBOURNE, CHAIRMAN,
174  // ! U.S. NAVAL OBSERVATORY, WASHINGTON, D.C.,
175  // ! DEC. 27, 1983.
176  //
177 
178  // It is a first part of UT1ZT:
179 
180  const double seccon(206264.8062470964);
181  const double sec360(1296000.0);
182  double el, elp, f, d, om;
183  double cent((t - tEphem)/36525.0);
184  // l:
185  el = (( 0.064*cent + 31.310)*cent + 715922.633)*cent + 485866.733 +
186  fmod(1325.0*cent, 1.0)*1296000.0;
187  args[0] = fmod(el, sec360);
188  // l':
189  elp = ((-0.012*cent - 0.577)*cent + 1292581.224)*cent + 1287099.804 +
190  fmod( 99.0*cent, 1.0)*1296000.0;
191  args[1] = fmod(elp, sec360);
192  // F:
193  f = (( 0.011*cent - 13.257)*cent + 295263.137)*cent + 335778.877 +
194  fmod(1342.0*cent, 1.0)*1296000.0;
195  args[2] = fmod(f, sec360);
196  // D:
197  d = (( 0.019*cent - 6.891)*cent + 1105601.328)*cent + 1072261.307 +
198  fmod(1236.0*cent, 1.0)*1296000.0;
199  args[3] = fmod(d, sec360);
200  // Omega:
201  om = (( 0.008*cent + 7.455)*cent - 482890.539)*cent + 450160.280 -
202  fmod( 5.0*cent, 1.0)*1296000.0;
203  args[4] = fmod(om, sec360);
204  //
205  for (int i=0; i<5; i++)
206  args[i] /= seccon; // sec=>rad
207 };
208 
209 
210 
211 //
212 void fundArgs_NUTFA(const SgMJD& t, double args[5])
213 {
214  //
215  // ! NUTFA computes the number of Julian centuries since J2000 and the fundamental
216  // ! arguments and derivatives to be used in nutation series.
217  // !
218  // ! References: D.McCarthy, IERS Technical Note 13, Paris 1992
219  // ! T.C. van Flandern, Lunar Occult. Work (fundam.argum.)
220  //
221  const double elc [5] = { 0.064, 31.310, 715922.633, 485866.733, 1325.0};
222  const double elpc[5] = {-0.012, -0.577, 1292581.224, 1287099.804, 99.0};
223  const double fc [5] = { 0.011,-13.257, 295263.137, 335778.877, 1342.0};
224  const double dc [5] = { 0.019, -6.891, 1105601.328, 1072261.307, 1236.0};
225  const double omc [5] = { 0.008, 7.455, -482890.539, 450160.280, -5.0};
226  const double sec360(1296000.0);
227  const double convds(4.8481368110953599E-06);
228  double cent((t - tEphem)/36525.0);
229  double cent2, cent3;
230  double el, elp, f, d, om;
231  cent2 = cent*cent;
232  cent3 = cent2*cent;
233  // l:
234  el = elc [0]*cent3 + elc [1]*cent2 + elc [2]*cent + elc [3] + fmod(elc [4]*cent, 1.0)*sec360;
235  args[0] = fmod(el, sec360);
236  // l':
237  elp = elpc[0]*cent3 + elpc[1]*cent2 + elpc[2]*cent + elpc[3] + fmod(elpc[4]*cent, 1.0)*sec360;
238  args[1] = fmod(elp, sec360);
239  // F:
240  f = fc [0]*cent3 + fc [1]*cent2 + fc [2]*cent + fc [3] + fmod(fc [4]*cent, 1.0)*sec360;
241  args[2] = fmod(f, sec360);
242  // D:
243  d = dc [0]*cent3 + dc [1]*cent2 + dc [2]*cent + dc [3] + fmod(dc [4]*cent, 1.0)*sec360;
244  args[3] = fmod(d, sec360);
245  // Omega:
246  om = omc [0]*cent3 + omc [1]*cent2 + omc [2]*cent + omc [3] + fmod(omc [4]*cent, 1.0)*sec360;
247  args[4] = fmod(om, sec360);
248  //
249  for (int i=0; i<5; i++)
250  args[i] *= convds; // sec=>rad
251 };
252 
253 
254 
255 //
256 void fundArgs_NUTF96(const SgMJD& t, double args[5])
257 {
258  //
259  // ! NUTF96 computes the number of Julian centuries since J2000 and the
260  // ! fundamental arguments and derivatives to be used in the nutation series.
261  // !
262  // ! NUTF96 is taken from Calc 9, and comforms with the 1996 IERS Conventions.
263  // ! It should be used to duplicate the UT1 => UT1S conversion for Calc 9+
264  // ! databases, and for ALL modfile UT1 => UT1S conversions. Added to SOLVE
265  // ! 99.12.14 -DG-
266  //
267  // ! References: D.McCarthy, IERS Technical Note 13, 'IERS Conventions (1992)',
268  // ! Paris 1992
269  // ! T.C. van Flandern, Lunar Occult. Work (fundam.argum.)
270  // ! D.McCarthy, IERS Technical Note 21, 'IERS Conventions (1996)',
271  // ! Paris 1996
272  //
273  const double elc [5] = {-0.00024470, 0.051635, 31.8792, 1717915923.2178, 485868.249036};
274  const double elpc[5] = {-0.00001149, -0.000136, -0.5532, 129596581.0481, 1287104.79305};
275  const double fc [5] = { 0.00000417, -0.001037, -12.7512, 1739527262.8478, 335779.526232};
276  const double dc [5] = {-0.00003169, 0.006593, -6.3706, 1602961601.2090, 1072260.70369};
277  const double omc [5] = {-0.00005939, 0.007702, 7.4722, -6962890.2665, 450160.398036};
278  const double sec360(1296000.0);
279  const double convds(4.8481368110953599E-06);
280  double cent((t - tEphem)/36525.0);
281  double cent2, cent3, cent4;
282  double el, elp, f, d, om;
283  cent2 = cent*cent;
284  cent3 = cent2*cent;
285  cent4 = cent2*cent2;
286  // l:
287  el = elc [0]*cent4 + elc [1]*cent3 + elc [2]*cent2 + elc [3]*cent + elc[4];
288  args[0] = fmod(el, sec360);
289  // l':
290  elp = elpc[0]*cent4 + elpc[1]*cent3 + elpc[2]*cent2 + elpc[3]*cent + elpc[4];
291  args[1] = fmod(elp, sec360);
292  // F:
293  f = fc [0]*cent4 + fc [1]*cent3 + fc [2]*cent2 + fc [3]*cent + fc[3];
294  args[2] = fmod(f, sec360);
295  // D:
296  d = dc [0]*cent4 + dc [1]*cent3 + dc [2]*cent2 + dc [3]*cent + dc[4];
297  args[3] = fmod(d, sec360);
298  // Omega:
299  om = omc [0]*cent4 + omc [1]*cent3 + omc [2]*cent2 + omc [3]*cent + omc[4];
300  args[4] = fmod(om, sec360);
301 
302  for (int i=0; i<5; i++)
303  args[i] *= convds; // sec=>rad
304 };
305 
306 
307 
308 //
309 void fundArgs_NUTFA10(const SgMJD& t, double args[5])
310 {
311  // ! From Calc 10.0, 2005.12.21, DG
312  // !
313  // ! NUTFA computes the number of Julian centuries since J2000 and the fundamental
314  // ! arguments and derivatives to be used in the nutation series.
315  // !
316  // ! References: D.McCarthy, IERS Technical Note 32, IERS Conventions (2003).
317  //
318  const double elc2 [5] = {-0.00024470, 0.051635, 31.8792, 1717915923.2178, 485868.249036};
319  const double elpc2[5] = {-0.00001149, 0.000136, -0.5532, 129596581.0481, 1287104.793048};
320  const double fc2 [5] = { 0.00000417,-0.001037,-12.7512, 1739527262.8478, 335779.526232};
321  const double dc2 [5] = {-0.00003169, 0.006593, -6.3706, 1602961601.2090, 1072260.703692};
322  const double omc2 [5] = {-0.00005939, 0.007702, 7.4722, -6962890.5431, 450160.398036};
323  const double sec360(1296000.0);
324  const double convds(4.8481368110953599E-06);
325  double cent((t - tEphem)/36525.0);
326  double cent2, cent3, cent4;
327  double el, elp, f, d, om;
328  cent2 = cent*cent;
329  cent3 = cent2*cent;
330  cent4 = cent2*cent2;
331  // l:
332  el = elc2[0]*cent4 + elc2[1]*cent3 + elc2[2]*cent2 + elc2[3]*cent + elc2[4];
333  args[0] = fmod(el, sec360);
334  // l':
335  elp = elpc2[0]*cent4 + elpc2[1]*cent3 + elpc2[2]*cent2 + elpc2[3]*cent + elpc2[4];
336  args[1] = fmod(elp, sec360);
337  // F:
338  f = fc2[0]*cent4 + fc2[1]*cent3 + fc2[2]*cent2 + fc2[3]*cent + fc2[3];
339  args[2] = fmod(f, sec360);
340  // D:
341  d = dc2[0]*cent4 + dc2[1]*cent3 + dc2[2]*cent2 + dc2[3]*cent + dc2[4];
342  args[3] = fmod(d, sec360);
343  // Omega:
344  om = omc2[0]*cent4 + omc2[1]*cent3 + omc2[2]*cent2 + omc2[3]*cent + omc2[4];
345  args[4] = fmod(om, sec360);
346  //
347  for (int i=0; i<5; i++)
348  args[i] *= convds; // sec=>rad
349 };
350 
351 
352 
353 //
354 void calcUT1stub(const double[5], double& dUt1)
355 {
356  dUt1 = 0.0;
357 };
358 
359 
360 
361 //
362 void calcUT1ZT(const double args[5], double& dUt1)
363 {
364  //
365  // ! 1. UT1ZT PROGRAM SPECIFICATION
366  //
367  // ! 1.1 Evaluate the effects of zonal earth tides on the rotation
368  // ! of the earth.
369  //
370  // ! 1.2 REFERENCES:
371  // ! 1. YODER, WILLIAMS, AND PARKE, 1981, "TIDAL
372  // ! VARIATIONS OF EARTH ROTATION", J. GEOPHYS.
373  // ! RES., VOL. 86, P. 881-891.
374  // ! 2. PROJECT MERIT STANDARDS, W. MELBOURNE, CHAIRMAN,
375  // ! U.S. NAVAL OBSERVATORY, WASHINGTON, D.C.,
376  // ! DEC. 27, 1983.
377  //
378 
379  // This is a second part of UT1ZT:
380 
381  // make summation:
382  double arg;
383  dUt1 = 0.0;
384  for (int i=0; i<numOfRecs_Ut1cm; i++)
385  {
386  arg = ut1Ttable_Ut1cm[i].n_[0] * args[0] +
387  ut1Ttable_Ut1cm[i].n_[1] * args[1] +
388  ut1Ttable_Ut1cm[i].n_[2] * args[2] +
389  ut1Ttable_Ut1cm[i].n_[3] * args[3] +
390  ut1Ttable_Ut1cm[i].n_[4] * args[4] ;
391  arg = fmod(arg, M_PI*2.0);
392  dUt1 += ut1Ttable_Ut1cm[i].ut1_sin_*sin(arg);
393  };
394  dUt1 *= 1.0E-4; // convert to seconds
395 };
396 
397 
398 
399 //
400 void calcUT1S_82(const double args[5], double& dUt1)
401 {
402  //
403  // ! Purpose: This subroutine evaluates the effects of zonal Earth tides on
404  // ! the rotation of the Earth. The model used is from Yoder, Williams, and
405  // ! Park (1981) and modified by the ocean effects as given in Dickman (1991)
406  // ! as recommended by the IERS Standards, p. 117, 119-120 (1992).
407  //
408  // ! Special Note: Under the UT1S definition, and as done by this routine,
409  // ! zonal tides of _all_ periods are evaluated, including even those of
410  // ! 18.6 year period. Results will be substantially different (tenths of
411  // ! seconds) from those evaluated with the "UT1R" algorithm, which only
412  // ! includes the 41 terms for periods under 35 days. If you wish to determine
413  // ! the effects from only those periods, please use the original Luzum
414  // ! "zontids" routine, with N set to 41. (B.A.)
415  //
416  double arg, sinArg, cosArg;
417  dUt1 = 0.0;
418  for (int i=0; i<numOfRecs_Ut1s82; i++)
419  {
420  arg = 0.0;
421  for (int j=0; j<5; j++)
422  arg += args[j]*ut1Ttable_Ut1s82[i].n_[j];
423  arg = fmod(arg, M_PI*2.0);
424  sincos(arg, &sinArg, &cosArg);
425  dUt1 += ut1Ttable_Ut1s82[i].ut1_sin_*sinArg + ut1Ttable_Ut1s82[i].ut1_cos_*cosArg;
426  };
427  dUt1 *= 1.0E-4; // convert to seconds
428 };
429 
430 
431 
432 //
433 void calcUT1S_83(const double args[5], double& dUt1)
434 {
435  // ! Purpose: This subroutine evaluates the effects of zonal Earth tides on
436  // ! the rotation of the Earth. The model used is from Yoder, Williams, and
437  // ! Park (1981) and modified by the ocean effects as given in Dickman (1991)
438  // ! as recommended by the IERS Standards, p. 117, 119-120 (1992).
439  //
440  // ! Special Note: Under the UT1S definition, and as done by this routine,
441  // ! zonal tides of _all_ periods are evaluated, including even those of
442  // ! 18.6 year period. Results will be substantially different (tenths of
443  // ! seconds) from those evaluated with the "UT1R" algorithm, which only
444  // ! includes the 41 terms for periods under 35 days. If you wish to determine
445  // ! the effects from only those periods, please use the original Luzum
446  // ! "zontids" routine, with N set to 41. (B.A.)
447  //
448  // ! Note added by JMGipson
449  // ! This routine was substantially rewritten to calculate DUT_DOT,DLOD,
450  // ! and DOMEGA using the series expansion of DUT. This was done becuase
451  // ! the old definition of DUT_DOT in terms of a separate series was
452  // ! inconsistent. I modified it so that it used the same table to calculate
453  // ! the two values.
454  // ! I also removed dlod and domega from the argument list, which solve/calc
455  // ! does not use. Instead I put in DUT_DOT, which is used.
456  double arg, sinArg, cosArg;
457  dUt1 = 0.0;
458  for (int i=0; i<numOfRecs_Ut1s83; i++)
459  {
460  arg = 0.0;
461  for (int j=0; j<5; j++)
462  arg += args[j]*ut1Ttable_Ut1s83[i].n_[j];
463  arg = fmod(arg, M_PI*2.0);
464  sincos(arg, &sinArg, &cosArg);
465  dUt1 += ut1Ttable_Ut1s83[i].ut1_sin_*sinArg + ut1Ttable_Ut1s83[i].ut1_cos_*cosArg;
466  };
467  dUt1 *= 1.0E-4; // convert to seconds
468 };
469 
470 
471 
472 //
473 void calcUT1S2K(const double args[5], double& dUt1)
474 {
475  //
476  // ! From Calc 10.0, 2005.12.21, DG
477  // !
478  // ! Purpose: This subroutine evaluates the effects of zonal Earth tides on
479  // ! the rotation of the Earth. The model used is from Defraigne and Smits,
480  // ! 1999, as recommended by the IERS Conventions (2003).
481  //
482  double arg, sinArg, cosArg;
483  dUt1 = 0.0;
484  for (int i=0; i<numOfRecs_Ut1s2k; i++)
485  {
486  arg = 0.0;
487  for (int j=0; j<5; j++)
488  arg += args[j]*ut1Ttable_Ut1s2k[i].n_[j];
489  arg = fmod(arg, M_PI*2.0);
490  sincos(arg, &sinArg, &cosArg);
491  dUt1 += ut1Ttable_Ut1s2k[i].ut1_sin_*sinArg + ut1Ttable_Ut1s2k[i].ut1_cos_*cosArg;
492  };
493  dUt1 *= 1.0E-4; // convert to seconds
494 };
495 
496 
497 
498 
499 // i/o:
500 
501 
502 /*=====================================================================================================*/
503 //
504 // constants:
505 //
506 /*=====================================================================================================*/
507 
508 
509 
510 
511 
512 
513 
514 
515 /*=====================================================================================================*/
SgLogger * logger
Definition: SgLogger.cpp:231
const SgMJD tEphem(51544.5)
void fundArgs_NUTFA(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:212
void calcUT1S2K(const double[5], double &)
Definition: SgTidalUt1.cpp:473
void fundArgs_NUTF96(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:256
void calcUT1S_83(const double[5], double &)
Definition: SgTidalUt1.cpp:433
void calcUT1ZT(const double[5], double &)
Definition: SgTidalUt1.cpp:362
void calcUT1S_82(const double[5], double &)
Definition: SgTidalUt1.cpp:400
void fundArgs_NUTFA10(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:309
void calcUT1stub(const double[5], double &)
Definition: SgTidalUt1.cpp:354
void fundArgs_UT1ZT(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:161
void fundArgs_stub(const SgMJD &, double[5])
Definition: SgTidalUt1.cpp:153
const int numOfRecs_Ut1s83
const int numOfRecs_Ut1s82
const int numOfRecs_Ut1s2k
const SgUt1TidalTableEntry_Standard ut1Ttable_Ut1s82[]
const SgUt1TidalTableEntry_Clipped ut1Ttable_Ut1s83[]
const SgUt1TidalTableEntry_Simplified ut1Ttable_Ut1cm[]
const SgUt1TidalTableEntry_Standard ut1Ttable_Ut1s2k[]
const int numOfRecs_Ut1cm
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ TIME
Definition: SgLogger.h:80
Definition: SgMJD.h:59
UT1TideContentType
Definition: SgTidalUt1.h:50
@ CT_ALL_TERMS_REMOVED
Definition: SgTidalUt1.h:53
@ CT_SHORT_TERMS_REMOVED
Definition: SgTidalUt1.h:52
UT1TideContentType tideContent_
Definition: SgTidalUt1.h:90
SgTidalUt1(UT1TideContentType, double)
Definition: SgTidalUt1.cpp:66
double calc(const SgMJD &)
Definition: SgTidalUt1.cpp:119
void(* fundArgs)(const SgMJD &, double[5])
Definition: SgTidalUt1.h:93
static const QString className()
Definition: SgTidalUt1.cpp:58
void(* calcUT1_UTC)(const double[5], double &)
Definition: SgTidalUt1.h:94
double calcVersionValue_
Definition: SgTidalUt1.h:91