1
$\begingroup$

I am creating program in C which is derived from Javascript Solar Radiation calculator based on a book Guide to HTML, JavaScript and PHP: For Scientists and Engineers By David R. Brooks. The original program calculates Sidereal time like this:

  // Sidereal time (Theta0)
  double GMST = 280.46061837+360.98564736629*( i->JulianDate-2451545.);
  // Sidereal_time = GMST + 0.000387933*T2 - T3/38710000
  double Sidereal_time = GMST+0.000387933*T*T
       -T*T*T/38710000.;
  // Performance optimalizatuion of code for Sidereal=fmod(Sidereal,360.) or Sidereal%360
  double S_save=Sidereal_time/360.;
  if (S_save < 0.) Sidereal_time = Sidereal_time-ceil(S_save)*360.;
  else Sidereal_time = Sidereal_time-floor(S_save)*360.;
  if (Sidereal_time < 0.) Sidereal_time+=360.;

Where i->JulianDate is date/time specified by user which is converted to Julian date. As you can see this approach is based on 2451545.0 which is the equivalent of January 1, 2000, at 12:00:00 UT and 36525.0 is Julian Year. I am not sure why there is 36525 instead 365.25 (days of Julian Year). Can you explain this?

Once more the same code without comments:

  double GMST = 280.46061837+360.98564736629*( i->JulianDate-2451545.);
  double Sidereal_time = GMST+0.000387933*T*T-T*T*T/38710000.;
  double S_save=Sidereal_time/360.;
  if (S_save < 0.) 
     Sidereal_time = Sidereal_time-ceil(S_save)*360.;
  else 
     Sidereal_time = Sidereal_time-floor(S_save)*360.;
  if (Sidereal_time < 0.) 
     Sidereal_time+=360.;

Another question:

If I enter date older than January 1, 2000, at 12:00:00 UT, e.g. 1945, will the sidereal time be correct? Or do I need to change the number 36525.0 to extend the range?

Yet, before the Sidereal time is calculated in the program there is this: double T=( i->JulianDate-2451545.0)/36525.0; Which is similar thing.

Sidereal_time is used to calculate hour_angle which is used to calculate Sun's elevation and Solar Zenit Angle Z. Will this variables be affected when I type 1945 or older date in the program?

EDIT: I have added log to my program which printed values into file. I have tested the program for range 1990-2010. You can see that the SideReal time same as L0 (Geometric mean longitude) is negative number when the date is older than 2000/01/01 as defined in the program to calculate T. The difference of 10 years is cca 0.09999 of Julian century.

Date:1990 1 1 12:0:0
Julian Century: -0.099986
L0 - geometric mean longitude of the sun:: -3319.117706
GMST: -1318039.123563
Sidereal time: -1318039.123559
Julian Date: 2447893.000000

Date:1991 1 1 12:0:0
Julian Century: -0.089993
L0 - geometric mean longitude of the sun:: -2959.356420
GMST: -1186279.362275
Sidereal time: -1186279.362271
Julian Date: 2448258.000000

Date:1992 1 1 12:0:0
Julian Century: -0.080000
L0 - geometric mean longitude of the sun:: -2599.595134
GMST: -1054519.600986
Sidereal time: -1054519.600983
Julian Date: 2448623.000000

Date:1993 1 1 12:0:0
Julian Century: -0.069979
L0 - geometric mean longitude of the sun:: -2238.848201
GMST: -922398.854050
Sidereal time: -922398.854048
Julian Date: 2448989.000000

Date:1994 1 1 12:0:0
Julian Century: -0.059986
L0 - geometric mean longitude of the sun:: -1879.086915
GMST: -790639.092761
Sidereal time: -790639.092760
Julian Date: 2449354.000000

Date:1995 1 1 12:0:0
Julian Century: -0.049993
L0 - geometric mean longitude of the sun:: -1519.325629
GMST: -658879.331472
Sidereal time: -658879.331472
Julian Date: 2449719.000000

Date:1996 1 1 12:0:0
Julian Century: -0.040000
L0 - geometric mean longitude of the sun:: -1159.564343
GMST: -527119.570184
Sidereal time: -527119.570183
Julian Date: 2450084.000000

Date:1997 1 1 12:0:0
Julian Century: -0.029979
L0 - geometric mean longitude of the sun:: -798.817409
GMST: -394998.823248
Sidereal time: -394998.823247
Julian Date: 2450450.000000

Date:1998 1 1 12:0:0
Julian Century: -0.019986
L0 - geometric mean longitude of the sun:: -439.056123
GMST: -263239.061959
Sidereal time: -263239.061959
Julian Date: 2450815.000000

Date:1999 1 1 12:0:0
Julian Century: -0.009993
L0 - geometric mean longitude of the sun:: -79.294836
GMST: -131479.300670
Sidereal time: -131479.300670
Julian Date: 2451180.000000

Date:2000 1 1 12:0:0
Julian Century: 0.000000
L0 - geometric mean longitude of the sun:: 280.466450
GMST: 280.460618
Sidereal time: 280.460618
Julian Date: 2451545.000000

Date:2001 1 1 12:0:0
Julian Century: 0.010021
L0 - geometric mean longitude of the sun:: 641.213384
GMST: 132401.207554
Sidereal time: 132401.207554
Julian Date: 2451911.000000

Date:2002 1 1 12:0:0
Julian Century: 0.020014
L0 - geometric mean longitude of the sun:: 1000.974670
GMST: 264160.968843
Sidereal time: 264160.968843
Julian Date: 2452276.000000

Date:2003 1 1 12:0:0
Julian Century: 0.030007
L0 - geometric mean longitude of the sun:: 1360.735957
GMST: 395920.730132
Sidereal time: 395920.730132
Julian Date: 2452641.000000

Date:2004 1 1 12:0:0
Julian Century: 0.040000
L0 - geometric mean longitude of the sun:: 1720.497244
GMST: 527680.491421
Sidereal time: 527680.491421
Julian Date: 2453006.000000

Date:2005 1 1 12:0:0
Julian Century: 0.050021
L0 - geometric mean longitude of the sun:: 2081.244178
GMST: 659801.238357
Sidereal time: 659801.238358
Julian Date: 2453372.000000

Date:2006 1 1 12:0:0
Julian Century: 0.060014
L0 - geometric mean longitude of the sun:: 2441.005465
GMST: 791560.999645
Sidereal time: 791560.999647
Julian Date: 2453737.000000

Date:2007 1 1 12:0:0
Julian Century: 0.070007
L0 - geometric mean longitude of the sun:: 2800.766751
GMST: 923320.760934
Sidereal time: 923320.760936
Julian Date: 2454102.000000

Date:2008 1 1 12:0:0
Julian Century: 0.080000
L0 - geometric mean longitude of the sun:: 3160.528038
GMST: 1055080.522223
Sidereal time: 1055080.522225
Julian Date: 2454467.000000

Date:2009 1 1 12:0:0
Julian Century: 0.090021
L0 - geometric mean longitude of the sun:: 3521.274973
GMST: 1187201.269159
Sidereal time: 1187201.269162
Julian Date: 2454833.000000

Date:2010 1 1 12:0:0
Julian Century: 0.100014
L0 - geometric mean longitude of the sun:: 3881.036260
GMST: 1318961.030447
Sidereal time: 1318961.030451
Julian Date: 2455198.000000

EDIT2: fmod(GMST,24); fmod(Sidereal_time,24);

Date:1990 1 1 12:0:0
Julian Century: -0.099986
L0 - geometric mean longitude of the sun:: -3319.117706
GMST: -7.123563
Sidereal time: -7.123559
Julian Date: 2447893.000000

Date:1991 1 1 12:0:0
Julian Century: -0.089993
L0 - geometric mean longitude of the sun:: -2959.356420
GMST: -7.362275
Sidereal time: -7.362271
Julian Date: 2448258.000000

Date:1992 1 1 12:0:0
Julian Century: -0.080000
L0 - geometric mean longitude of the sun:: -2599.595134
GMST: -7.600986
Sidereal time: -7.600983
Julian Date: 2448623.000000

Date:1993 1 1 12:0:0
Julian Century: -0.069979
L0 - geometric mean longitude of the sun:: -2238.848201
GMST: -6.854050
Sidereal time: -6.854048
Julian Date: 2448989.000000

Date:1994 1 1 12:0:0
Julian Century: -0.059986
L0 - geometric mean longitude of the sun:: -1879.086915
GMST: -7.092761
Sidereal time: -7.092760
Julian Date: 2449354.000000

Date:1995 1 1 12:0:0
Julian Century: -0.049993
L0 - geometric mean longitude of the sun:: -1519.325629
GMST: -7.331472
Sidereal time: -7.331472
Julian Date: 2449719.000000

Date:1996 1 1 12:0:0
Julian Century: -0.040000
L0 - geometric mean longitude of the sun:: -1159.564343
GMST: -7.570184
Sidereal time: -7.570183
Julian Date: 2450084.000000

Date:1997 1 1 12:0:0
Julian Century: -0.029979
L0 - geometric mean longitude of the sun:: -798.817409
GMST: -6.823248
Sidereal time: -6.823247
Julian Date: 2450450.000000

Date:1998 1 1 12:0:0
Julian Century: -0.019986
L0 - geometric mean longitude of the sun:: -439.056123
GMST: -7.061959
Sidereal time: -7.061959
Julian Date: 2450815.000000

Date:1999 1 1 12:0:0
Julian Century: -0.009993
L0 - geometric mean longitude of the sun:: -79.294836
GMST: -7.300670
Sidereal time: -7.300670
Julian Date: 2451180.000000

Date:2000 1 1 12:0:0
Julian Century: 0.000000
L0 - geometric mean longitude of the sun:: 280.466450
GMST: 16.460618
Sidereal time: 16.460618
Julian Date: 2451545.000000

Date:2001 1 1 12:0:0
Julian Century: 0.010021
L0 - geometric mean longitude of the sun:: 641.213384
GMST: 17.207554
Sidereal time: 17.207554
Julian Date: 2451911.000000

Date:2002 1 1 12:0:0
Julian Century: 0.020014
L0 - geometric mean longitude of the sun:: 1000.974670
GMST: 16.968843
Sidereal time: 16.968843
Julian Date: 2452276.000000

Date:2003 1 1 12:0:0
Julian Century: 0.030007
L0 - geometric mean longitude of the sun:: 1360.735957
GMST: 16.730132
Sidereal time: 16.730132
Julian Date: 2452641.000000

Date:2004 1 1 12:0:0
Julian Century: 0.040000
L0 - geometric mean longitude of the sun:: 1720.497244
GMST: 16.491421
Sidereal time: 16.491421
Julian Date: 2453006.000000

Date:2005 1 1 12:0:0
Julian Century: 0.050021
L0 - geometric mean longitude of the sun:: 2081.244178
GMST: 17.238357
Sidereal time: 17.238358
Julian Date: 2453372.000000

Date:2006 1 1 12:0:0
Julian Century: 0.060014
L0 - geometric mean longitude of the sun:: 2441.005465
GMST: 16.999645
Sidereal time: 16.999647
Julian Date: 2453737.000000

Date:2007 1 1 12:0:0
Julian Century: 0.070007
L0 - geometric mean longitude of the sun:: 2800.766751
GMST: 16.760934
Sidereal time: 16.760936
Julian Date: 2454102.000000

Date:2008 1 1 12:0:0
Julian Century: 0.080000
L0 - geometric mean longitude of the sun:: 3160.528038
GMST: 16.522223
Sidereal time: 16.522225
Julian Date: 2454467.000000

Date:2009 1 1 12:0:0
Julian Century: 0.090021
L0 - geometric mean longitude of the sun:: 3521.274973
GMST: 17.269159
Sidereal time: 17.269162
Julian Date: 2454833.000000

Date:2010 1 1 12:0:0
Julian Century: 0.100014
L0 - geometric mean longitude of the sun:: 3881.036260
GMST: 17.030447
Sidereal time: 17.030451
Julian Date: 2455198.000000
$\endgroup$
  • $\begingroup$ It's "sidereal", not "sitereal" btw. $\endgroup$ – Phiteros Jul 29 '17 at 18:21
  • $\begingroup$ Normally I'd say "aa.usno.navy.mil/faq/docs/GAST.php may or may not be helpful", but USNO appears to be down at the moment. Consider looking for archived versions of this page for the formula and its accuracy over time. $\endgroup$ – barrycarter Jul 29 '17 at 18:53
  • $\begingroup$ The number 35625. does not appear in your code. It is unclear what you are refering to. $\endgroup$ – James K Jul 29 '17 at 21:37
  • $\begingroup$ Some clever explanation of SideReal time youtube.com/watch?v=alnfOIWdp7E or this one youtube.com/watch?v=82p-DYgGFjI&feature=related $\endgroup$ – user1141649 Jul 30 '17 at 7:59
  • 1
    $\begingroup$ Could you take your GMST and sidereal time results and reduce them mod 24? We normally give both as a number between 0 and 24. After that, see if you're still getting incorrect answers? $\endgroup$ – barrycarter Jul 30 '17 at 13:42
1
$\begingroup$

I have often seen programs use a Julian century, so the 36625 is probably the number of sidereal days in a century, whereas 36525 is the number of calendar days in a century (https://en.wikipedia.org/wiki/Julian_year_(astronomy))

Sidereal time generally runs uniformly forward or backward :-). I think the calculation will work prior to 2000. I am not going to type it in to test it, but since you have (or will), you can test it. The sidereal time should be close to the same value for the same time and day regardless of the year.

| improve this answer | |
$\endgroup$
  • $\begingroup$ U R right. It is J. century not year. Here I made a test: [url]saecanet.com/calculation_page/… 18.4306 East, 1911/12/22 - result: Julian Century=-0.88028747433265. My program result T = Julian Century = -0.880329 $\endgroup$ – user1141649 Jul 29 '17 at 20:17
  • $\begingroup$ I have added the results of my test and updated the question. $\endgroup$ – user1141649 Jul 30 '17 at 10:10
  • $\begingroup$ I edited the answer to make clear the distinction between calendar days and sidereal days. $\endgroup$ – barrycarter Jul 30 '17 at 17:05
  • $\begingroup$ Actually, the code calculates the sidereal time in degrees. Unless you converted it to hours, you should "mod" it with 360. Then you need to determine how "mod" works with negative numbers, but you probably just need to add 360 if the number is negative to put it in the proper range of 0 to 360. $\endgroup$ – JohnHoltz Jul 30 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.