[net.astro] Sunrise and Sunset

birnbaum@aecom.UUCP (Ira Birnbaum) (12/19/84)

Does anyone out there know an equation for sunrise and sunset
given the day of the year?
I saw one two weeks ago, but can't remember where...
                   Thanx Muchly,
                   michab

colonel@gloria.UUCP (12/23/84)

> Does anyone out there know an equation for sunrise and sunset
> given the day of the year?

This isn't quite what you want, but you're welcome to it.  It gives the
DIRECTION of sunset at the solstice at various latitudes.  (One look
will tell you why I wrote it in FORTRAN.)  23.5 is the earth's tilt,
more or less.

	t=sind(23.5)
	print 1, (i, asind(t/cosd(float(i))),i=0,66)
1	format (1x,i2,3x,f8.1)
	stop
	end
	function sind(x)
	sind=sin(x*3.14159/180)
	return
	end
	function cosd(x)
	cosd=cos(x*3.14159/180)
	return
	end
	function asind(x)
	asind=180/3.14159*asin(x)
	return
	end
-- 
Col. G. L. Sicherman
...seismo!rochester!rocksanne!rocksvax!sunybcs!gloria!colonel

eugene@ames.UUCP (Eugene Miya) (12/28/84)

> > Does anyone out there know an equation for sunrise and sunset
> > given the day of the year?
> 
> This isn't quite what you want, but you're welcome to it.  It gives the
> DIRECTION of sunset at the solstice at various latitudes.  (One look
> will tell you why I wrote it in FORTRAN.)  23.5 is the earth's tilt,

! FORTRAN?!
!  "No reason for it really."
!	Clint Eastwood as Dirty Harry

> more or less.
> -- 
> Col. G. L. Sicherman

To determine sunrise and set, you need to know several things: local
longititude, latitude, declination and so on.  You need an emphermis
for this.
I also include the most general formula for sun angle (zenith)
what some one asked for earlier.  I am surprised no one has posted
in this in the past few months.  Sorry, I left my notes on this at home
so long.

Send some of the following thru eqn(1) to see the geometry.
.EQ
delim $$
.EN
.nf
$ theta $ == solar zenith angle, Zenith == 0
$ phi $ == solar azimuth angle 0 == South, AM is negative, PM is positive
$ zeta $ == longitude negative in the Western hemisphere, standard meridians
are every 15 degrees from 0
$ psi $ == latitude
The equation of time
$ omega $ == the equation of time based on a 24 clock
$ omega sub eqt $ == a correction for omega
$ delta $ == solar declination
$ t sub hr $ == local time on a 24 hour [decimal] clock

I intentionally do not simplify the following equations so that the
1) the science may be understood, and 2) certain intermediate
results are useful later (see the cos of the solar zenith angle).
I learned this in a series of some of the most beautiful lectures I
ever had as a student.  (They are somewhat simplified, but should do
the trick.  There are other equations I have not included.)

Start: The equation of time:
.EQ
omega ~=~ 15 ( t sub hr - 12) + omega sub eqt + ( zeta sub loc - zeta sub
std )
.EN
This converts 24 hour local time corrected solar noon time.

Local sunrise time:
.EQ
t sub sunrise ~=~ 12 - { omega + [ omega sub eqt + ( zeta sub loc - zeta sub
std )]   } over 15
.EN

Local sunset time:
.EQ
t sub sunset ~=~ 12 + { omega - [ omega sub eqt + ( zeta sub loc - zeta sub
std )] } over 15
.EN
The latter two equations are 24 hour local time.

Here's the beef:

General Sun zenith angle:
.EQ
cos theta sub sun ~=~ sin psi sin delta + cos psi cos delta cos omega
.EN

General Sun azimuth angle:
.EQ
cos phi sub sun ~=~ { sin psi cos theta sub sun - sin theta } over { cos
psi sin theta sub sun}
.EN

The equations for determining the time for sunrise and set are simplifications
of the two above equations.

Some C: /* not checked, you must write dtor() or get azel(6) */
	/* dtor() == degree to radians */

double t, zeta_loc, zeta_std, omega, omega_eqt;
double sin(), cos();
double dtor();
double delta, psi, c_theta_sun, c_phi_sun, theta_sun;

omega = 15 * ( t - 12) + omega_eqt + (zeta_loc - zeta_std);

c_theta_sun = sin(dtor(psi)) * sin(dtor(delta)) + cos(dtor(psi)) *
cos(dtor(delta)) * cos(dtor(omega));

c_phi_sun = ( sin(dtor(psi)) * c_theta_sun - sin(dtor(delta))) /
(cos(dtor(psi)) * sin(dtor(theta_sun)));

/* if you simplify this code, PLEASE comment the old code with	*/
/* the more detailed version AND the eqn source above		*/
/* Note in the last line you must determine sin theta_sun.	*/

Credit: Dr. Jeff Dozier, Snowmelt Project, University of California,
Santa Barbara, CA 93016 [ucbvax!ucsbcsl!dozier].
I got this from my days working on snow hydrology and energy balance models.
That felt good!

--eugene miya
  NASA Ames Research Center
  {hplabs,ihnp4,dual,hao,vortex}!ames!aurora!eugene
  emiya@ames-vmsb.ARPA

	"Reality!....what a concept!"
			Robin Williams

eugene@ames.UUCP (01/02/85)

I just saw another request for the formulas.  If you did not get them
or if you don't understand how to use them, write me.  I have sample problems
and excercises to work and worked out.

--eugene miya
  NASA Ames Research Center
  {hplabs,ihnp4,dual,hao,vortex}!ames!aurora!eugene
  emiya@ames-vmsb.ARPA

berger@aecom.UUCP (Micha Berger) (12/11/85)

	Does anyone out there have an equation for
approximate sunrise and sunset within one minute error?
                                    tnx,
                                    mb