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

Last change on this file since 18679 was 18348, checked in by tbretz, 9 years ago
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-2015, 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/* Julian centuries since fundamental epoch. */
80 if (dj1 < dj2) {
81 d1 = dj1;
82 d2 = dj2;
83 } else {
84 d1 = dj2;
85 d2 = dj1;
86 }
87 t = (d1 + (d2 - ERFA_DJ00)) / ERFA_DJC;
88
89/* Fractional part of JD(UT1), in seconds. */
90 f = ERFA_DAYSEC * (fmod(d1, 1.0) + fmod(d2, 1.0));
91
92/* GMST at this UT1. */
93 gmst = eraAnp(ERFA_DS2R * ((A + (B + (C + D * t) * t) * t) + f));
94
95 return gmst;
96
97}
98/*----------------------------------------------------------------------
99**
100**
101** Copyright (C) 2013-2015, NumFOCUS Foundation.
102** All rights reserved.
103**
104** This library is derived, with permission, from the International
105** Astronomical Union's "Standards of Fundamental Astronomy" library,
106** available from http://www.iausofa.org.
107**
108** The ERFA version is intended to retain identical functionality to
109** the SOFA library, but made distinct through different function and
110** file names, as set out in the SOFA license conditions. The SOFA
111** original has a role as a reference standard for the IAU and IERS,
112** and consequently redistribution is permitted only in its unaltered
113** state. The ERFA version is not subject to this restriction and
114** therefore can be included in distributions which do not support the
115** concept of "read only" software.
116**
117** Although the intent is to replicate the SOFA API (other than
118** replacement of prefix names) and results (with the exception of
119** bugs; any that are discovered will be fixed), SOFA is not
120** responsible for any errors found in this version of the library.
121**
122** If you wish to acknowledge the SOFA heritage, please acknowledge
123** that you are using a library derived from SOFA, rather than SOFA
124** itself.
125**
126**
127** TERMS AND CONDITIONS
128**
129** Redistribution and use in source and binary forms, with or without
130** modification, are permitted provided that the following conditions
131** are met:
132**
133** 1 Redistributions of source code must retain the above copyright
134** notice, this list of conditions and the following disclaimer.
135**
136** 2 Redistributions in binary form must reproduce the above copyright
137** notice, this list of conditions and the following disclaimer in
138** the documentation and/or other materials provided with the
139** distribution.
140**
141** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
142** the International Astronomical Union nor the names of its
143** contributors may be used to endorse or promote products derived
144** from this software without specific prior written permission.
145**
146** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
147** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
148** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
149** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
150** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
151** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
152** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
153** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
154** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
155** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
156** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
157** POSSIBILITY OF SUCH DAMAGE.
158**
159*/
Note: See TracBrowser for help on using the repository browser.