source: trunk/FACT++/erfa/src/gmst82.c@ 19713

Last change on this file since 19713 was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
File size: 6.2 KB
Line 
1#include "erfa.h"
2
3double eraGmst82(double dj1, double dj2)
4/*
5** - - - - - - - - - -
6** e r a G m s t 8 2
7** - - - - - - - - - -
8**
9** Universal Time to Greenwich mean sidereal time (IAU 1982 model).
10**
11** Given:
12** dj1,dj2 double UT1 Julian Date (see note)
13**
14** Returned (function value):
15** double Greenwich mean sidereal time (radians)
16**
17** Notes:
18**
19** 1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any
20** convenient way between the arguments dj1 and dj2. For example,
21** JD(UT1)=2450123.7 could be expressed in any of these ways,
22** among others:
23**
24** dj1 dj2
25**
26** 2450123.7 0 (JD method)
27** 2451545 -1421.3 (J2000 method)
28** 2400000.5 50123.2 (MJD method)
29** 2450123.5 0.2 (date & time method)
30**
31** The JD method is the most natural and convenient to use in
32** cases where the loss of several decimal digits of resolution
33** is acceptable. The J2000 and MJD methods are good compromises
34** between resolution and convenience. The date & time method is
35** best matched to the algorithm used: maximum accuracy (or, at
36** least, minimum noise) is delivered when the dj1 argument is for
37** 0hrs UT1 on the day in question and the dj2 argument lies in the
38** range 0 to 1, or vice versa.
39**
40** 2) The algorithm is based on the IAU 1982 expression. This is
41** always described as giving the GMST at 0 hours UT1. In fact, it
42** gives the difference between the GMST and the UT, the steady
43** 4-minutes-per-day drawing-ahead of ST with respect to UT. When
44** whole days are ignored, the expression happens to equal the GMST
45** at 0 hours UT1 each day.
46**
47** 3) In this function, the entire UT1 (the sum of the two arguments
48** dj1 and dj2) is used directly as the argument for the standard
49** formula, the constant term of which is adjusted by 12 hours to
50** take account of the noon phasing of Julian Date. The UT1 is then
51** added, but omitting whole days to conserve accuracy.
52**
53** Called:
54** eraAnp normalize angle into range 0 to 2pi
55**
56** References:
57**
58** Transactions of the International Astronomical Union,
59** XVIII B, 67 (1983).
60**
61** Aoki et al., Astron. Astrophys. 105, 359-361 (1982).
62**
63** Copyright (C) 2013-2017, NumFOCUS Foundation.
64** Derived, with permission, from the SOFA library. See notes at end of file.
65*/
66{
67/* Coefficients of IAU 1982 GMST-UT1 model */
68 double A = 24110.54841 - ERFA_DAYSEC / 2.0;
69 double B = 8640184.812866;
70 double C = 0.093104;
71 double D = -6.2e-6;
72
73/* Note: the first constant, A, has to be adjusted by 12 hours */
74/* because the UT1 is supplied as a Julian date, which begins */
75/* at noon. */
76
77 double d1, d2, t, f, gmst;
78
79
80/* Julian centuries since fundamental epoch. */
81 if (dj1 < dj2) {
82 d1 = dj1;
83 d2 = dj2;
84 } else {
85 d1 = dj2;
86 d2 = dj1;
87 }
88 t = (d1 + (d2 - ERFA_DJ00)) / ERFA_DJC;
89
90/* Fractional part of JD(UT1), in seconds. */
91 f = ERFA_DAYSEC * (fmod(d1, 1.0) + fmod(d2, 1.0));
92
93/* GMST at this UT1. */
94 gmst = eraAnp(ERFA_DS2R * ((A + (B + (C + D * t) * t) * t) + f));
95
96 return gmst;
97
98}
99/*----------------------------------------------------------------------
100**
101**
102** Copyright (C) 2013-2017, NumFOCUS Foundation.
103** All rights reserved.
104**
105** This library is derived, with permission, from the International
106** Astronomical Union's "Standards of Fundamental Astronomy" library,
107** available from http://www.iausofa.org.
108**
109** The ERFA version is intended to retain identical functionality to
110** the SOFA library, but made distinct through different function and
111** file names, as set out in the SOFA license conditions. The SOFA
112** original has a role as a reference standard for the IAU and IERS,
113** and consequently redistribution is permitted only in its unaltered
114** state. The ERFA version is not subject to this restriction and
115** therefore can be included in distributions which do not support the
116** concept of "read only" software.
117**
118** Although the intent is to replicate the SOFA API (other than
119** replacement of prefix names) and results (with the exception of
120** bugs; any that are discovered will be fixed), SOFA is not
121** responsible for any errors found in this version of the library.
122**
123** If you wish to acknowledge the SOFA heritage, please acknowledge
124** that you are using a library derived from SOFA, rather than SOFA
125** itself.
126**
127**
128** TERMS AND CONDITIONS
129**
130** Redistribution and use in source and binary forms, with or without
131** modification, are permitted provided that the following conditions
132** are met:
133**
134** 1 Redistributions of source code must retain the above copyright
135** notice, this list of conditions and the following disclaimer.
136**
137** 2 Redistributions in binary form must reproduce the above copyright
138** notice, this list of conditions and the following disclaimer in
139** the documentation and/or other materials provided with the
140** distribution.
141**
142** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
143** the International Astronomical Union nor the names of its
144** contributors may be used to endorse or promote products derived
145** from this software without specific prior written permission.
146**
147** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
148** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
149** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
150** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
151** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
152** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
153** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
154** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
155** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
156** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
157** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
158** POSSIBILITY OF SUCH DAMAGE.
159**
160*/
Note: See TracBrowser for help on using the repository browser.