V0.11.4 - refraction seems underpredicted

Bug #1088413 reported by Owen Thornton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stellarium
Fix Released
Medium
gzotti

Bug Description

Hi,

V0.11.4 - refraction seems underpredicted
---------------------------------------------------------------

I've been doing some checks on the refraction calcs in Stellarium. When an object passes through the observer's meridian, the difference between geometric and apparent positions should ALL be in the Dec or Alt directions. So far so good.

However, when manually cross-checking the refraction values from the Sæmundsson (1986) formula -- http://en.wikipedia.org/wiki/Atmospheric_refraction -- with the specified pressure and temperature, I get significantly different refraction values from Stellarium.

For example, two different planets at meridian (at different times of year) ...

Alt ~41 deg
Stellarium Refraction = 0.68 arcmin
Sæmundsson Refraction = 1.2 arcmin

Alt ~73 deg
Stellarium Refraction = 0.03 arcmin
Sæmundsson Refraction = 0.3 arcmin

(The accuracy seems much better close to the horizon, believe it or not.)

...

Am I missing something?

Cheers,
Owen Thornton.
Brisbane.

P.S. I am extremely new to practical astronomy but have a reasonable handle on the theory side of things and a goodish background in numerical programming during the daytime. I gotta say, I just love this software! I am using it to test the limits of the DC servo motors in the mount of my brand new telescope. (And people say I need a hobby!)

Related branches

description: updated
description: updated
Changed in stellarium:
assignee: nobody → gzotti (georg-zotti)
Revision history for this message
gzotti (georg-zotti) wrote :

Wow, thanks for your critical investigation!

Now, the basic implementation of Saemundson's formula is correct (I just went over the code and even indeed found cosmetic omissions, but those were not relevant. It gives about 0.3 arcmin at 73 degrees, but the infostring differs by only 1 arcsec!)
I was mostly concerned with refraction close to the horizon where we have many arcminutes, and here it was too close to find an error before.

But now *I* am missing something... indeed something further down in the computation pipeline apparently goes wrong, acknowledged. Please stay tuned.

G.

Changed in stellarium:
status: New → Confirmed
importance: Undecided → Medium
Changed in stellarium:
milestone: none → 0.12.1
Changed in stellarium:
milestone: 0.12.1 → none
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Georg, maybe you can restore unit tests for atmospheric refraction and extinction? It can help us for finding errors in those features.

Revision history for this message
Frank Reed (frank-9) wrote :

Refraction values are still wrong (or again wrong?) in ver. 0.13.1. For altitudes above 30 degrees, the refraction is too low by around 0.3 to 0.4 minutes of arc. Even the functional dependence is wrong. For altitudes above 15 degrees, the (actual) refraction is nearly proportional to tan(z) where z is zenith distance and for zenith distances less than 45 degrees this is nearly equivalent to refraction directly proportional to zenith distance, but refraction in Stellarium falls off much more rapidly with altitude.

Revision history for this message
gzotti (georg-zotti) wrote :

There were lots of other changes and necessities, I wanted to come back to this issue a bit later.

What is your reference? Maybe you have other formulae? We need a pair of formulae applicable and if possible reversible from zenith to zero or even slightly below (for high mountains etc). The Saemundson/Bennett formulae seem usable, but require a small fix (about 7") so that refraction is zero in the zenith, and they are not totally reversible (i.e. apparent_h(geometrical_h(apparent))) != apparent), causing some reports on difficulties click-hitting highly magnified stars on the horizon.

Revision history for this message
Frank Reed (frank-9) wrote :

Hello Georg,

Yes, I can get you code which accurately give refraction in both directions (true-->observed and observed-->true) and also applicable for altitudes below the horizon. This is something I've been working on for many years for detailed celestial navigation calculations. The "Bennett" formula and its cousins are just "fits" to tabulated numerical integrations. They're not derived from "first principles" and they are really relics of the calculator era (when a very short formula was superior to a long conditional), so there's really no need to chase after a perfect version, like adding that 7" zenith fix. A conditional based on altitude is just as good.

Once you get into refraction values below the horizon, you really ought to include the depression of the horizon ("dip" as navigators call it) which is itself affected by refraction. And there should probably also be a factor exp(-height/scale_height) for those mountaintop observers (scale_height is variable, weather-driven but a value of 9km is close enough). All of this can certainly be included, but in what order?

It seems to me that the basic flaw in the refraction right now is fairly serious but also easily fixed. Like the original poster, I, too, noticed this issue two years ago, but assumed it would be fixed in short order. Since the refraction values seem good for low altitudes, and the problem appears at higher altitudes, why not just throw in a conditional: if (alt>15) ref=0.97/tan(alt) ? This is extremely accurate. This equation assumes alt in degrees and a result in minutes of arc, by the way. You would want to "fine tune" that constant 0.97 to get a match with the low altitude code at 15 degrees altitude, but otherwise this is quick and easy.

Frank Reed

Revision history for this message
gzotti (georg-zotti) wrote :

Thanks for that other formula. I cannot look into it right now, but I hope somewhere in December/January. Can I contact you then if I don't find that apparently serious issue? As I said, the part on Bennett/Saemundson gives correct values, but then there is some more code which I have to untangle.

If we exchange the current solution, I need a set of formulae apparent_h(geometric_h, pressure, temperature) and geometric_h(apparent_h, pressure, temperature) which should optimally be reversible and must cover altitudes from somewhat below zero to 90°.

Our horizons ("landscapes") are rendered without refraction, only celestial objects are affected. (It is assumed that photographed landscapes have recorded all refraction effects.) It is clear that refraction on the horizon is very weather dependent, we only model approximate conditions. (Or please work out a universal solution.)

Georg.

Revision history for this message
Frank Reed (frank-9) wrote :

Sounds fine. I would be happy to help in a few weeks.

By the way, here's a slightly refined version of the refraction for altitudes above 15 degrees:
  ref = 0.9716*tanz - 0.00111*tanz^3
[where tanz is tan(zenith distance) which equals 1/tan(altitude) and the result is in minutes of arc]. And again, the refraction is fine at lower altitudes. The region where the refraction is wrong is from 15 degrees up to the zenith. It's wrong by about 0.4 minutes (too low) at 45 degrees altitude, and given that the refraction there ought to be 0.97 minutes, that's a 40% error --big.

Frank Reed
ReedNavigation.com

gzotti (georg-zotti)
Changed in stellarium:
status: Confirmed → Fix Committed
Revision history for this message
gzotti (georg-zotti) wrote :

I got it, finally!

A certain optimization attempt was too optimistic, it seems.

So, I keep Bennett and Saemundson (including the corrective terms, but not the extra term from Bennett as reported by Meeus). They are of course still not perfect reciprokes, but usually are within 2" of each other, and click-identification of objects at high magnification has also improved. Refraction is about an arcminute in 45° altitude now.

@Frank Reed: Your terms give a slightly lower values than those from my sources. It is consistent with terms found in other papers, however, I wanted to avoid a jump or another interpolation area near 15° when our formulae are usable for 0..90°. I think a deviation between models of about 5" (?) is acceptable.

Changed in stellarium:
milestone: none → 0.13.2
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Commit 7261 has been revert for detailed investigation (he introduce bug #1408366).

Changed in stellarium:
milestone: 0.13.2 → 0.13.3
status: Fix Committed → In Progress
Revision history for this message
gzotti (georg-zotti) wrote :

OK, I hope r7295 did it!

Changed in stellarium:
status: In Progress → Fix Committed
Changed in stellarium:
milestone: 0.13.3 → 0.13.2
Revision history for this message
gzotti (georg-zotti) wrote :

r7300 adds another fix which internally uses doubles for avoiding some crazy numerical artifacts.

Changed in stellarium:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.