Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.76k stars 821 forks source link

Wrong refraction at nonzero observer altitude #1524

Open 10110111 opened 3 years ago

10110111 commented 3 years ago

At nonzero altitude true horizon sinks below mathematical horizon. This means that e.g. the solar disk should flatten at a lower elevation than if it's observed from sea level. Moreover, in no case should it be stretched vertically.

Actual behavior of refraction in Stellarium contradicts both of these conditions. See the following animation (see it fullscreen to view the azimuthal grid):

https://user-images.githubusercontent.com/6376882/108884229-68d44800-7617-11eb-8595-00ff2bc94a93.mp4

Here I had chosen the altitude of 5 km. At this altitude true horizon is at -2.267° (ignoring refraction that would elevate it a bit). By the azimuth/elevation grid you can estimate where it should be. Notice that

  1. The solar disk is flattened the most at about mathematical horizon, and at lower elevations it's flattened less.
  2. At some point the solar disk becomes stretched, and this happens even above true horizon (e.g. at 18:27 simulation time).

This becomes very prominent with the WIP ShowMySky atmosphere when altitude is really high, e.g. with the following 30 km screenshot:

Screenshot - 230221 - 20:57:48

In fact, as you can see above, extinction is also wrong in these conditions.

gzotti commented 3 years ago

The model for refraction from the astronomical literature which we implemented in 2010 fails below about -2°. See figure 18.6 in the User Guide. This is totally irrelevant for terrestrial observers as there are no sites on the ground where you would see into the funny zone where we have to "unsquash" the sun but yes, from a balloon in the stratosphere will make a different observation. Don't say it's wrong, this is too obvious. Please provide a better model.

github-actions[bot] commented 3 years ago

Thank you @10110111 for suggesting this.

10110111 commented 3 years ago

This is totally irrelevant for terrestrial observers as there are no sites on the ground where you would see into the funny zone where we have to "unsquash" the sun

What about e.g. Rosa Khutor Peak 2320? At such altitude the true horizon is at -1.546°. Stellarium produces the following solar disk at these parameters, when it just touches the true horizon. It's already elongated at the bottom, with the total vertical diameter larger than horizontal.

Screenshot - 230221 - 22:24:12

And I've been actually able to at least see the Sun on 2017-07-17 20:02:03 MSK, where Stellarium calculates solar disk to be at -0.975°. I.e. the surrounding mountains didn't obscure it. I could have watched the Sun going even lower if I had an opportunity to remain at the peak that day. Here's how it looked:

IMG_8694

Please provide a better model

In fact, I have developed some code that calculates refraction angle from refractivity altitude profile, taking altitude and view elevation as input. But I don't know how to use the current parameters of pressure and temperature to generate the whole refractivity profile.

Also, the algorithm is a bit computationally intensive (involves numerical quadrature, and below mathematical horizon even multiple times).

axd1967 commented 3 years ago

(The altitude issue also relates with #740 )