Length of Day and Twilight http://herbert.gandraxa.com/length_of_day.xml img/lod_menu.jpg Friedrichshafen /img/lod_menu_big.jpg home.xml Home articles.xml Articles Length of Day and Twilight herbert gandraxa.com Herbert Glarner 20060115 http://herbert.wikispaces.com/ Relocated to here 20090702 Bigger formulas 20110119 Recoded in XLM 20110530 Using formulas_with_xml.xml math in XML http://en.wikipedia.org/wiki/Daylight Daylight on Wikipedia http://en.wikipedia.org/wiki/Twilight Twilight on Wikipedia Based on this work, Don Whiteside offers a neat MS-Excel file in his blog titled http://dc.metblogs.com/2006/12/22/the-longest-night-is-over/ The longest night is over , including day length charts and tables with latitudes for world cities and US towns. There's a Matlab implementation of the presented formulae on the developer's page http://www.mathworks.com/matlabcentral/fileexchange/20390-day-length MathWorks , including a worked example. Length of Day Formulae Simplifications Final Formula Function Graphs Twilight Formulae Practical Calculation Sample Values

Abstract Shows how to calculate the length of day and the duration of twilight for any latitude and for any day of year, using some basic trigonometry.

50 Length of Day Formulae

The actual day of year and the latitude (0deg at the equator to 90deg at the North pole) both influence the length of the day.

The perceived way of the sun around the planet can be viewed at as the boundary circle of the planet's disc. However, this constellation (in which the sun apparently circles along the disc's boundary) applies only at equinoxes and only at the North pole. The further away one is from the North pole (towards the equator), the more the surrounding circle is tilted along the West-East axis, until it is completely upright (perpendicular to the planet's disc) at the equator.

Furthermore, there is also a shift of the circle away from the disc, along the obliquity of the ecliptic (connecting the centers of the two circles at an angle of 23.439deg). This shift can be "upwards" (max. distance at the summer solstice) or "downwards" (max. distance at the winter solstice) depending on the actual latitude.

The following image shows the tilted and shifted solar circle for the Winter Solstice at 45deg North. It is only the part b out of the whole circle in which the sun in visible: when continueing its path on the blue line it is night (but see the part titled #B Twilight below).

/img/lod_fig01.jpg Solar Circle for the Summer Solstice at 45deg North Fig. 1: Solar Circle for the Summer Solstice at 45deg North

The following table calculates the exposed part b in relation to the whole circle. The formulas mention 3 parameters, which signify:

• Axis: Obliquity of the ecliptic (as the rotation axis of the Earth is not perpendicular to its orbital plane, the equatorial plane is not parallel to the ecliptic plane, but makes an angle of 23.439deg); for our purposes this is a constant value, it changes slowly only within thousands of years.
• Lat: Latitude of the observer (0deg at the equator, 90deg at the Northpole).
• Day: Day of year (1st year 0...364, from 365 add 0.25 for every completed year within the Great Year consisting of 4 years, i.e. 365.25 etc.). Note, that the day of year does not start with the astronomically quite arbitrary January 1st, but with the day of the winter solstice in the first year a four years cycle.

Thanks to David X. Callaway to point this out early in the text to avoid confusion.

• Note: The expression "observer" in the remarks refers to a hypothetical observer located on the center of the planet's "disc".

Angle between observer and sun's zenith:

Thanks to Andrew Green for spotting an error which was introduced while translating from HTML to XLM in formulas #m_eq_1 (1) and #m_eq_9 (9) .

$z = 90 - Lat - cos pi timesnbsp Day 182.625 nbsptimesnbspAxis$

Latitude of observer:

$c = -Lat$

Angle between solar disc and sun's zenith:

$a = z - c$

Distance from observer to sun's zenith:

$d =nbsp 1 sin(a)$

Distance from observer to the center of the sun's circle:

$t = cos(a)d$

Exposed radius part between sun's zenith and sun's circle:

$m = 1 + tan(c)t$

• if m is negative, then the sun never appears the whole day long (polar winter): m must be adjusted to 0 (the sun can not shine less than 0 hours).
• if m is larger than 2, the "sun circle" does not intersect with the planet's surface and the sun is shining the whole day (polar summer): m must be adjusted to 2 (the sun can not shine for more than 24 hours).
• Angle between center of sun's disc and sunrise or sunset point on the solar circle (not the planet's disc), resp.:

$f = arccos(1 - m)$

Exposed fraction of the sun's circle (0=never...1 = whole day):

$b =nbsp f 180$

To get the number of hours the sun shines at the given Day at the given Latitude Lat, b needs to be multiplied by 24.

Simplifications

The calculation of a and m can be simplified to:

$90 - cos pi timesnbsp Day 182.625 nbsptimesnbspAxis$

and

$m = 1 +nbsp tan(-Lat)cos(a) sin(a)$

Because cos / sin = cot = 1 / tan, a and m can be merged into:

$m = 1 +nbspnbsp tan(-Lat) tan 90 - cos pi timesnbsp Day 182.625 nbsptimes Axis$

Since tan(x) = cot(90 - x) = 1 / tan(90 - x), the division can thankfully be converted into a multiplication. Also, tan(-Lat) is equivalent with -tan(Lat):

$m = 1 - tan(Lat)tan Axis times cos pi times Day 182.625$

The expression pi/182.625 can be precalculated and saved as a constant j:

$j =nbsp pi 182.625 nbspapprox 0.0172...$
Final Formula

This reduces the calculation of m prior the correction of out-of-range values to 3 multiplications and 1 addition:

$m = 1 - tan(Lat)tan(Axis times cos(j times Day))$

(Note, that the argument of the cos function is in radians, whereas the arguments of the tan functions are in degrees.

Thanks to Kim Mackay for pointing this out.

)

Adjust the limits of m to be between 0...2; then

$b =nbsp arccos(1 - m) 180$

completes the calculation.

Function Graphs

Notice, that depending on what your plotting software accepts (deg/rad), you might need to modify the b formula slightly. For example would you use ARCCOS(1-m)/(2*PI())*360/180 in Microsoft Excel, which simplifies to ARCCOS(1-m)/PI().

Thanks to reader justanote for this observation.

Above formulas for the Length of Day b produce the following graphs over a whole year, shown for the latitudes at 0deg, 10deg ... 90deg North:

/img/lod_fig02.jpg Length of Day graphs for the Northern hemisphere. Fig. 2: Length of Day graphs for the Northern hemisphere. Note, that the x Axis starts out with the Winter Solstice and is not identical with the calendary start.

Thanks to Martin Bonda for reminding me to make this clear.

Twilight

The sun does not appear or disappear just so, a shorter or longer twilight period begins before the start of the day and ends after the end of the day, i.e. the twilight affects the duration of the "dark" night, never the duration of the "bright" day.

For most purposes, it is sufficient to take into consideration the Civil Twilight plus the Nautical Twilight, but not the Astronomical Twilight (which latter would be interpreted as fully dark anyway for casual observers).

Civil Twilight is defined as the sun being 6deg below the horizon, Nautical Twilight as 12deg. Therefore, the duration of the twilight depends on how long the sun needs to cross these 12deg, and this (mainly) depends from the angle the sun circle is tilted towards the planet's "disc". This angle is steep (orthogonal to the planet's disc) at the equator. The further away from the equator the observer is, the flatter the angle becomes, and there are Northern regions in which not the whole twilight cycle is completed. This is the case for all latitudes North of 90deg-Axis-12deg=54.561deg.

To some extent the angle also depends from the day of year: It is at the equinoxes that the angle is steepest for any latitude, and on the Northern hemisphere the summer solstice is flattest (also the winter solstice is flatter than at the equinoxes, but not so flat as at the summer solstice). However, the differences along a year are short and extend over some minutes only.

Formulae

When the planet's so far flat disc is given some height h, then twilight is defined as the part e of the solar arc.

/img/lod_fig03.jpg Planet disc with added thickness"> Fig. 3: Planet disc with added thickness.

The twilight angle (sun below horizon), as per above definition:

$t = 12$

Thickness of the planet's disc:

$h = tan(t)$

The angle v is identical with the Latitude. This is true along the whole radius of the solar circle, particularly also where the distance between the solar circle and the surface of the planet disc is h:

$v = Lat$

Knowing the angle v, the radius fraction i (an extention of the radius fraction m) can be calculated:

$i =nbsp h cos(Lat)$

The whole radius fraction m+i defines the point, at which the planet disc's lower surface is crossed by the solar circle. The value m is the same as calculated above. Note, however, that its uncorrected value must be used:

$n = m + i$

Adjust range: 0...2 is the valid range (see comments in the formula table of the preceding section). Note, that the m part (before adjustment) is the same as in the previous section, but range adjustment may not happen before the addition of the i term.

Angle between center of sun's disc and lower twilight point on the solar circle (not the planet's disc):

$k = arccos(1 - n)$

Exposed fraction of the sun's circle (0=never...1=whole day). The arc describes the daytime plus both twilight zones (b+2e):

$b + 2e =nbsp k 180$
Practical Calculation

n can not be simplified any more:

$n = 1 - tan(Lat)tan(Axis times cos(j times day)) nbsp+nbsp h cos(Lat)$

with the constants

$h = 12deg$ $j =nbsp pi 182.625$ $Axis = 23.439deg$

This is the calculation of the twilight arc (comprising both twilight durations and the daylength).

Then

$b + 2e =nbsp arccos(1 - n) 180$

completes the calculation.

Sample Values

Some individual twilight durations e (dusk or dawn) are given in the following tables. The tables' cells give the duration in hours.

Also note, that at and near the Pole there are phases with no twilight, because the sun is present all the day, or circles too far below the horizon. The values are given as 0, because half the difference between the daylength b and the arc comprising the day length and the 2 twilights ((b+2e - b)/2) are presented. These values are identical at the pole (and near it), i.e. 0 around the winter solstice, and 1 around the summer solstice (0 and 24 hrs., resp.)

t=12degWSEqSSEqWSLatitude/Day0.0045.6691.31136.97182.63228.28273.94319.59365.2590deg0.0000.00012.0000.0000.0000.00012.0000.0000.00080deg0.0004.1586.0000.0000.0000.0006.0004.1580.00070deg3.6852.9032.5622.3430.0002.3432.5622.9033.68560deg1.9771.7231.6772.6082.7552.6081.6771.7231.97750deg1.3591.2931.2871.4991.7881.4991.2871.2931.35945deg1.2041.1661.1661.2951.4361.2951.1661.1661.20440deg1.0921.0701.0741.1571.2371.1571.0741.0701.09230deg0.9480.9410.9470.9851.0150.9850.9470.9410.94820deg0.8670.8660.8720.8880.9000.8880.8720.8660.86710deg0.8260.8270.8310.8370.8410.8370.8310.8270.8260deg0.8180.8180.8180.8180.8180.8180.8180.8180.818

The following table shows the twilight duration for the civil twilight (6deg rather than 12deg).

t=6degWSintermEqintermSSintermEqintermWSLatitude/Day0.0045.6691.31136.97182.63228.28273.94319.59365.2590deg0.0000.00012.0000.0000.0000.00012.0000.0000.00080deg0.0000.0002.4830.0000.0000.0002.4830.0000.00070deg1.8591.6111.1932.3430.0002.3431.1931.6111.85960deg1.0630.8840.8091.0331.6871.0330.8090.8841.06350deg0.6950.6500.6270.6960.7830.6960.6270.6500.69545deg0.6090.5830.5700.6130.6610.6130.5700.5830.60940deg0.5490.5330.5260.5530.5820.5530.5260.5330.54930deg0.4720.4670.4650.4770.4880.4770.4650.4670.47220deg0.4300.4280.4280.4330.4380.4330.4280.4280.43010deg0.4080.4080.4080.4100.4110.4100.4080.4080.4080deg0.4020.4020.4020.4020.4020.4020.4020.4020.402