Introduction

When you enjoy sunrise and sunset, do you pay attention to the variation of the Sun’s visual shape? Comparatively speaking, the Sun’s image at sunrise or sunset is flatter than that at noon; however, although the Sun’s image at noon is the roundest on a day, it still appears to be an ellipse and not a perfect circle. Very few research papers systemically explain the theoretical reasons for the variation of the Sun’s visual shape, and only a few very short articles on Wikipedia and in popular science magazines simply outline the natural phenomenon based on atmospheric refraction.

The effects of atmospheric refraction have been studied widely in the fields of optical communications and weather forecast. For the free-space optical communication systems, by applying astronomical refraction formulas and considering meteorological conditions on ground, Karin and Florian (2004) have simulated the refraction angles of solar rays in the atmosphere, and calculated the vertical deviation of solar beams at various wavelengths. For the earth-to-satellite laser communications, Xiang (2008) analyzed the effect of atmospheric chromatic dispersion on the pointing error of the uplink laser beam. For the sake of improving accuracy of satellite laser ranging, Yuan et al. (2011) used ray tracing to compute the various optical paths caused by atmosphere refraction, and gave a regional distribution of the optical path difference in China. Jiang et al. (2013) investigated the relationship between the optical paths and the satellite zenith angles, and proposed an atmospheric refraction compensation scheme for the different satellite zenith angles. In order to find out about the effect of atmospheric refraction on the propagation of weather radar beams, Wang et al. (2018) explored the vertical variation of the refraction index in the first kilometer of the atmosphere with regional climate and topography. Balal and Pinhasi (2019) evaluated the effect of atmospheric refraction and absorption on the propagation of millimeter and sub-millimeter wavelengths from land to satellite. Chaim and Hall (2000) made use of ray tracing to determine atmospheric refraction, and combined the digital terrain model to calculate the visual sunrise and sunset times at some cities in Israel. Kambezidis and Papanikolaou (1990) researched the relationship between solar position and atmospheric refraction. Kambezidis and Tsangrassoulis (1993) proposed a new correction of right ascension according to solar position. Kambezidis (1997) established a set of appropriate spherical trigonometric formulas to estimate sunrise and sunset hours by considering flat and complex terrains and atmospheric refraction. Instead of spherical trigonometry, Sproul (2007) used vector analysis to research the position relationship between the Sun and the Earth.

This paper investigates the variation of the Sun’s visual shape on a day, and figures out the reasons for the shape variation by massive experimental measurements and systemic theoretical analyses. First, hundreds of photos of the Sun were taken from sunrise to sunset; an image processing was performed to extract features of the Sun’s visual shape from the photos. The method of moments and the least-square method were combined to fit the periphery of the Sun in the processed images; and a set of formulas was derived to calculate the feature parameters of the elliptic Sun. Error analyses showed that the relative measurements accuracy was about 0.023%, the standard deviation of the fitting curve of the ellipse was only 4 pixels. The experimental results proved that the Sun’s visual shape can be accurately approximated by an ellipse. Second, in order to investigate the reasons for the variation of the Sun’s visual shape, the atmospheric refraction effects were first researched to simulate the influence on the Sun’s visual shape at different observation times and positions. Based on Kepler’s laws, the relative position and velocity between the Sun and the Earth were analyzed, and a set of formulas was derived to calculate the zenith and azimuth angles of the Sun for different observation positions and times; according to the differential equation of light propagation in an inhomogeneous medium, an iterative algorithm was developed to trace the rays of light in the atmosphere. Meanwhile, because the refraction index of the atmosphere mainly depends on air density, it is expressed as a function of altitude and wavelength of light. Under this expression, it is proved theoretically that the trajectory of sunlight is a planar curve. Nevertheless, as a result of atmospheric refraction, the Sun’s visual shape contracts only in the zenith direction, resulting in an elliptic Sun in the observer’s eyes. In addition, the length contraction phenomenon in the Einstein’s special relativity theory due to the relative movement between the Sun and the observer was also investigated to simulate its effects on the Sun’s visual shape at different observation times and positions. Because the relative velocity between the Sun and the observer varies with time, especially the direction of the motion, the effect of the length contraction phenomenon on the Sun’s visual shape also varies with time; therefore, the analysis included the contraction ratio and the contraction direction of the Sun’s visual shape, which describe a ratio of the minor to the major axis and the direction of semi-minor axis of the Sun’s visual shape. A relationship between the length contraction effect, observation positions and times was established. Although the effect of the Einstein’s special relativity theory also makes the Sun’s visual shape contract in one direction and results in an elliptic Sun, this differs from the atmospheric refraction effect, because the contraction direction caused by the Einstein’s special relativity theory varies with time. Comprehensively considering the effects of atmospheric refraction and the Einstein’s special relativity theory on the Sun’s visual shape, although different, we can prove that the Sun’s visual shape is still an ellipse. Therefore, a formula calculating the shape parameter of the ellipse was derived. Finally, the observation position was chosen to be Dalian, and the observation time mid-December 2018. Then, the variation of the Sun’s visual shape was simulated, including two cases: one with atmospheric refraction effects only, and another with both atmospheric refraction and the Einstein’s special relativity theory. By comparison, it can be found that the relative errors of the simulation results and the experimental data are less than 0.3%. These results show that the reason for the variation of the Sun’s visual shape is mainly atmospheric refraction; and at times except of sunrise and sunset, the length contraction effect of the Einstein’s special relativity theory also contributes, but little.

Experimental measurements and calculations

In order to investigate the variation of the Sun’s visual shape, a high-resolution digital camera was used to take more than 300 photos of the Sun from sunrise to sunset. The time chosen was before the winter solstice in the year 2018; the position was Dalian, a city in northeast China. In Fig. 1, three photos are given, the projection plane is perpendicular to the direction from the camera to the Sun, and the horizontal direction of the photo is about parallel to the sea level. Here, the Sun’s visual shape is assumed an ellipse. In the later Sections, the assumption will be verified by experimental results and theoretical analyses. A shape parameter describing the ellipse is defined as k = b/a, where a stands for the dimension of its semi-major axis, b the dimension of its semi-minor axis. When the sun rises or sets, the vertical direction of the photo or the direction of b is about perpendicular to the sea level. A bigger k means that the Sun’s visual shape is rounder. Seeing from Fig. 1, at sunrise, noon and sunset, the major and minor axes of the Sun are basically along the horizontal and vertical directions of the images.

Fig. 1
figure 1

Images of the Sun

For extracting the shape parameter k from the Sun’s photos, image processing, and the methods of moments and least-squares were employed. First, the Sun’s image expressed by RGB was converted to a binary image expressed by two luminance values of 0 and 1; then the periphery of the Sun was extracted from the binary image by removing the interior pixels; next, considering the Sun’s binary image as an ellipse, the method of moments was used to evaluate its feature parameters, such as the semi-major axis, the semi-minor axis, the coordinates of the center, and the angle between the major axis of the ellipse and the horizontal direction of the image, which were defined as the initial values of the iterative algorithm for fitting an ellipse to the periphery of the Sun. Finally, the least-squares method or the iterative algorithm was applied to fit an ellipse to the periphery of the Sun and compute the feature parameters of the Sun’s elliptical image.

Processing the Sun’s image taken by a camera

A photo of the Sun taken by a camera is a true color image expressed in RGB. In order to extract the shape parameter k from the Sun’s photo, the Sun’s image should be processed.

First, the true color image was converted to a grayscale image by removing the hue and saturation information, while retaining luminance. The mapping relationship between luminance and RGB can be described as

$$ \mathrm{Y}=0.299\mathrm{R}+0.587\mathrm{G}+0.114\mathrm{B} $$
(1)

where Y denotes the luminance value at every pixel, ranging from 0 to 1, Y = 1 denotes white, Y = 0 stands for black. Then, in order to reduce noise in the grayscale image, a 3-by-3 neighborhood median filtering was performed. Fig. 2a is a true color image taken by a camera, and Fig. 2b is a processed image after median filtering. Next, according to the contrast of Fig. 2b, a luminance threshold \( \overset{\sim }{\mathrm{Y}} \) was estimated, and the luminance values of all pixels with \( \mathrm{Y}\ge \overset{\sim }{\mathrm{Y}} \) were replaced with the value 1, while the luminance values of the other pixels were set to 0. In this way, Fig. 2b is converted to a binary image expressed by two luminance values of 0 and 1. Besides, in order to eliminate isolated points and burrs on the periphery, the morphological operations were applied to the binary image, including image erosion and dilation. During the image erosions and dilations, a 3-by-3 matrix SE was used as a structuring element object

$$ \mathbf{SE}=\left[\begin{array}{ccc}1& 1& 1\\ {}1& 1& 1\\ {}1& 1& 1\end{array}\right] $$
(2)
Fig. 2
figure 2

Image processing procedure

After performing 3 times erosions, 3 times dilations were implemented. Fig. 2c is the binary image after performing erosions and dilations. The last step was to remove the interior pixels and retain the periphery of the Sun. For a pixel in Fig. 2c, if the luminance values of all its 4-connected neighbors were 1, its luminance value would be set to 0, otherwise, the pixel would be retained as a point on the periphery of the Sun, and its luminance value is 1. Fig. 2d illustrates the periphery of the Sun.

Extracting features from the Sun’s binary image by the method of moments

Fig. 2c is a binary image, where the Sun can be regarded as an ellipse. The feature parameters of the ellipse include the dimension a of the semi-major axis, the dimension b of the semi-minor axis, the center coordinate C (xc, yc), and the angle γ between the major axis of the ellipse and the horizontal direction of the image, as shown in Fig. 3.

Fig. 3
figure 3

Relationship between two coordinate systems

The binary image is expressed by an M × N matrix consisting of 0 and 1; 1 and 0 denote white and black, respectively. It is assumed that the matrix element is IMi, j, i = 1, 2, ⋯, M; j = 1, 2, ⋯, N, using the method of moments, the Sun’s area A and the center coordinate C (xc, yc) can be calculated by

$$ {\displaystyle \begin{array}{c}\mathrm{A}={\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}{\mathrm{IM}}_{\mathrm{i},\mathrm{j}}\kern3.25em \\ {}{\mathrm{x}}_{\mathrm{c}}=\frac{1}{\mathrm{A}}{\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}\left(\mathrm{i}\times {\mathrm{IM}}_{\mathrm{i},\mathrm{j}}\right)\\ {}{\mathrm{y}}_{\mathrm{c}}=\frac{1}{\mathrm{A}}{\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}\left(\mathrm{j}\times {\mathrm{IM}}_{\mathrm{i},\mathrm{j}}\right)\end{array}} $$
(3)

The angle γ between the major axis of the ellipse and the horizontal direction of the image can also be obtained by

$$ \tan \left(2\upgamma \right)=\frac{2{\mathrm{I}}_{\mathrm{xy}}}{{\mathrm{I}}_{\mathrm{xx}}-{\mathrm{I}}_{\mathrm{yy}}} $$
(4)

where, Ixx, Ixy and Iyy are the secondary moments relative to C (xc, yc), which can be computed by the following equations

$$ {\displaystyle \begin{array}{c}{\mathrm{I}}_{\mathrm{x}\mathrm{x}}={\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}{\left(\mathrm{i}-{\mathrm{x}}_{\mathrm{c}}\right)}^2\times {\mathrm{I}\mathrm{M}}_{\mathrm{i},\mathrm{j}}\kern4.5em \\ {}{\mathrm{I}}_{\mathrm{x}\mathrm{y}}={\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}\left(\mathrm{i}-{\mathrm{x}}_{\mathrm{c}}\right)\times \left(\mathrm{j}-{\mathrm{y}}_{\mathrm{c}}\right)\times {\mathrm{I}\mathrm{M}}_{\mathrm{i},\mathrm{j}}\\ {}{\mathrm{I}}_{\mathrm{y}\mathrm{y}}={\sum}_{\mathrm{i}=1}^{\mathrm{M}}{\sum}_{\mathrm{j}=1}^{\mathrm{N}}{\left(\mathrm{j}-{\mathrm{y}}_{\mathrm{c}}\right)}^2\times {\mathrm{I}\mathrm{M}}_{\mathrm{i},\mathrm{j}}\kern4.25em \end{array}} $$
(5)

Applying Eqs. (4) and (5), the principal moments of inertia, I1 and I2, are obtained

$$ {\displaystyle \begin{array}{c}\kern0.5em \\ {}{\mathrm{I}}_1={\cos}^2\left(\upgamma \right){\mathrm{I}}_{\mathrm{xx}}+{\sin}^2\left(\upgamma \right){\mathrm{I}}_{\mathrm{yy}}+\sin \left(2\upgamma \right){\mathrm{I}}_{\mathrm{xy}}\\ {}{\mathrm{I}}_2={\cos}^2\left(\upgamma \right){\mathrm{I}}_{\mathrm{yy}}+{\sin}^2\left(\upgamma \right){\mathrm{I}}_{\mathrm{xx}}-\sin \left(2\upgamma \right){\mathrm{I}}_{\mathrm{xy}}\end{array}} $$
(6)

If the Sun in the binary image is considered as an ellipse with two semi-axes a and b, its area A and the principal moments of inertia I1 and I2 can be expressed as

$$ \mathrm{A}=\uppi a\mathrm{b}\kern1.75em {\mathrm{I}}_1=\frac{\uppi}{4}a{\mathrm{b}}^3\kern1.75em {\mathrm{I}}_2=\frac{\uppi}{4}{a}^3\mathrm{b} $$
(7)

Therefore, a and k can be solved by

$$ \kern0.5em a=2\sqrt{{\mathrm{I}}_2/\mathrm{A}}\kern3em \mathrm{k}=\sqrt{{\mathrm{I}}_1/{\mathrm{I}}_2} $$
(8)

Applying the method of moments, the feature parameters of the Sun’s binary image are finally extracted, including a, b, C (xc, yc), γ and k.

Taking the Sun’s image in Fig. 2c for example, the feature parameters are extracted. The result data are given in Table 1, where the length unit is pixel. Comparing the binary image of the Sun with the ellipse obtained by Eq. (7), the area of non-overlapped domain is calculated, equal to 37,418; and its error relative to the total area is about 0.38%.

Table 1 Results calculated by the method of moments (Fig. 2c)

Fitting an ellipse to the Sun’s periphery by the least-square method

Fig. 2d illustrates the periphery of the Sun’s visual shape. It is assumed that Pi (xi, yi), i = 1, 2, ⋯, q is a point on the periphery. In order to fit an ellipse to the periphery points, two coordinate systems are established, one is the global coordinate system O − XY, the other is the local coordinate system C − XeYe, as shown in Fig. 3. In O − XY, X and Y are along the horizontal and vertical directions of the image, respectively. In C − XeYe, the original point is set as the center of the ellipse; Xe and Ye are along the semi-major axis and semi-minor axis of the ellipse, respectively.

In the local coordinate system C-XeYe, Pi (xi, yi) on the Sun’s periphery can be expressed in the form of a vector \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \), satisfying

$$ \kern1.5em {\displaystyle \begin{array}{c}{\overrightarrow{\mathrm{P}}}_{\mathrm{i}}=\kern1em {\overset{\sim }{\mathrm{x}}}_{\mathrm{i}}{\overrightarrow{\mathrm{i}}}_{\mathrm{e}}+{\overset{\sim }{\mathrm{y}}}_{\mathrm{i}}{\overrightarrow{\mathrm{j}}}_{\mathrm{e}}\kern6.5em \mathrm{i}=1,2,\cdots, \mathrm{q}\ \\ {}{\overset{\sim }{\mathrm{x}}}_{\mathrm{i}}=\kern1em \left({\mathrm{x}}_{\mathrm{i}}-{\mathrm{x}}_{\mathrm{c}}\right)\cdotp \cos \left(\upgamma \right)+\left({\mathrm{y}}_{\mathrm{i}}-{\mathrm{y}}_{\mathrm{c}}\right)\cdotp \sin \left(\upgamma \right)\\ {}{\overset{\sim }{\mathrm{y}}}_{\mathrm{i}}=-\left({\mathrm{x}}_{\mathrm{i}}-{\mathrm{x}}_{\mathrm{c}}\right)\cdotp \sin \left(\upgamma \right)+\left({\mathrm{y}}_{\mathrm{i}}-{\mathrm{y}}_{\mathrm{c}}\right)\cdotp \cos \left(\upgamma \right)\ \end{array}} $$
(9)

The equation of fitting a reference ellipse can be written as

$$ {\displaystyle \begin{array}{c}\overrightarrow{\mathrm{r}}\left(\uptheta \right)={\mathrm{x}}_{\mathrm{e}}{\overrightarrow{\mathrm{i}}}_{\mathrm{e}}+{\mathrm{y}}_{\mathrm{e}}{\overrightarrow{\mathrm{j}}}_{\mathrm{e}}\kern2em \uptheta \in \left[0,2\uppi \right]\\ {}\ {\mathrm{x}}_{\mathrm{e}}=a\cdotp \cos \left(\uptheta \right)\kern7em \\ {}\kern0.5em {\mathrm{y}}_{\mathrm{e}}=\mathrm{b}\cdotp \sin \left(\uptheta \right)\kern7em \end{array}} $$
(10)

where, \( \overrightarrow{\mathrm{r}}\left(\uptheta \right) \) is the polar radius of an edge point on the fitting reference ellipse; θ is the corresponding curve parameter; \( {\overrightarrow{\mathrm{i}}}_{\mathrm{e}} \) and \( {\overrightarrow{\mathrm{j}}}_{\mathrm{e}} \) stand for the unit vectors along Xe and Ye; (xe, ye) is the coordinate of the point in C-XeYe. Its unit tangent vector \( \overrightarrow{\mathrm{T}}\left(\uptheta \right) \) and unit normal vector \( \overrightarrow{\mathrm{N}}\left(\uptheta \right) \) can be expressed as

$$ {\displaystyle \begin{array}{c}\overrightarrow{\mathrm{T}}\left(\uptheta \right)={\mathrm{T}}_{\mathrm{x}}{\overrightarrow{\mathrm{i}}}_{\mathrm{e}}+{\mathrm{T}}_{\mathrm{y}}{\overrightarrow{\mathrm{j}}}_{\mathrm{e}}\kern0.5em \\ {}\overrightarrow{\mathrm{N}}\left(\uptheta \right)={\mathrm{N}}_{\mathrm{x}}{\overrightarrow{\mathrm{i}}}_{\mathrm{e}}+{\mathrm{N}}_{\mathrm{y}}{\overrightarrow{\mathrm{j}}}_{\mathrm{e}}\end{array}} $$
(11)

Setting \( \mathrm{D}=\sqrt{a^2\cdotp {\sin}^2\left(\uptheta \right)+{\mathrm{b}}^2\cdotp {\cos}^2\left(\uptheta \right)}\kern0.5em \), Tx, Ty, Nx and Ny satisfy

$$ \left\{\begin{array}{c}{\mathrm{T}}_{\mathrm{x}}=-a\cdotp \sin \left(\uptheta \right)/\mathrm{D}\\ {}{\mathrm{T}}_{\mathrm{y}}=+\mathrm{b}\cdotp \cos \left(\uptheta \right)/\mathrm{D}\end{array}\right.\kern4.25em \left\{\begin{array}{c}{\mathrm{N}}_{\mathrm{x}}=-{\mathrm{T}}_{\mathrm{y}}\\ {}{\mathrm{N}}_{\mathrm{y}}=+{\mathrm{T}}_{\mathrm{x}}\end{array}\right.\kern0.5em $$
(12)

A fitting error \( {\upvarepsilon}_{\mathrm{i}}^{\ast } \) is defined as the shortest distance from the Sun’s periphery point \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \) to the fitting reference ellipse

$$ {\upvarepsilon}_{\mathrm{i}}^{\ast }=\left({\overrightarrow{\mathrm{P}}}_{\mathrm{i}}-\overrightarrow{\mathrm{r}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\right)\cdotp \overrightarrow{\mathrm{N}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right) $$
(13)

where, the sign “ · ” means the scalar product of vectors; \( \overrightarrow{\mathrm{r}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right) \) is the projection of point \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \) on the fitting reference ellipse along the normal direction. \( {\uptheta}_{\mathrm{i}}^{\ast } \) satisfies

$$ \left({\overrightarrow{\mathrm{P}}}_{\mathrm{i}}-\overrightarrow{\mathrm{r}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\right)\cdotp \overrightarrow{\mathrm{T}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)=0 $$
(14)

In order to calculate \( {\uptheta}_{\mathrm{i}}^{\ast } \), first connect \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \) to the center C of the fitting reference ellipse by a straight line; and determine the intersection \( \overrightarrow{\mathrm{r}}\left({\uptheta}_{\mathrm{i}}\right) \) of the line and the ellipse; then take θi as an initial value of \( {\uptheta}_{\mathrm{i}}^{\ast } \), where θi satisfies

$$ \tan \left({\uptheta}_{\mathrm{i}}\right)=\left(a\cdotp {\overset{\sim }{\mathrm{y}}}_{\mathrm{i}}\right)/\left(\mathrm{b}\cdotp {\overset{\sim }{\mathrm{x}}}_{\mathrm{i}}\right) $$
(15)

Based on Eq. (14), an iterative algorithm is constructed to calculate \( {\uptheta}_{\mathrm{i}}^{\ast } \)

$$ {\uptheta}_{\mathrm{i}}^{\mathrm{n}+1}={\uptheta}_{\mathrm{i}}^{\mathrm{n}}+\left({\overrightarrow{\mathrm{P}}}_{\mathrm{i}}-\overrightarrow{\mathrm{r}}\left({\uptheta}_{\mathrm{i}}^{\mathrm{n}}\right)\right)\cdotp \overrightarrow{\mathrm{T}}\left({\uptheta}_{\mathrm{i}}^{\mathrm{n}}\right)/\sqrt{a^2\cdotp {\sin}^2\left({\uptheta}_{\mathrm{i}}^{\mathrm{n}}\right)+{\mathrm{b}}^2\cdotp {\cos}^2\left({\uptheta}_{\mathrm{i}}^{\mathrm{n}}\right)}\kern0.75em $$
(16)

where, n stands for the number of iterations. During fitting the ellipse, the number of iterations is not more than 2, that is n ≤ 2, because \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \) is near the ellipse when taking θi as an initial value of \( {\uptheta}_{\mathrm{i}}^{\ast } \).

During the iterative calculation, the fitting error \( {\upvarepsilon}_{\mathrm{i}}^{\ast },\mathrm{i}=1,2,\cdots, \mathrm{q} \) can be obtained by Eq. (13). For the sake of reducing the error and finding the optimal fitting to the ellipse, the feature parameters of the ellipse should be modified iteratively, including a, b, C (xc, yc), and γ. Assuming that the increments of the five parameters are ∆xc, yc, ∆γ, ∆a and ∆b, applying Eq. (13), the relationship between the increments and the fitting errors can be established

$$ {\displaystyle \begin{array}{c}{\upvarepsilon}_{\mathrm{i}}={\upvarepsilon}_{\mathrm{i}}^{\ast }-\Delta \upgamma \left[\ {\mathrm{x}}_{\mathrm{e}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)-{\mathrm{y}}_{\mathrm{e}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\right]-{\Delta \mathrm{x}}_{\mathrm{c}}{\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\\ {}\kern2.25em -\Delta {\mathrm{y}}_{\mathrm{c}}{\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)-\Delta a\cdotp \cos \left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)-\Delta \mathrm{b}\cdotp \sin \left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\end{array}} $$
(17)

where εi is the shortest distance from \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}} \) to the fitting reference ellipse with modified feature parameters. For convenience, Eq. (17) is rewritten as

$$ {\left[\upvarepsilon \right]}_{\mathrm{q}\times 1}={\left[{\upvarepsilon}^{\ast}\right]}_{\mathrm{q}\times 1}-{\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}{\left[\Delta \right]}_{5\times 1} $$
(18)

The parameter adjustment results in the change of the location and normal vector of the fitting reference ellipse. In Eq. (18), [ε]q × 1 is a column vector consisting of the normal errors calculated after adjusting the parameters, and its ith element is εi; [ε]q × 1 is a column vector consisting of the normal errors calculated before adjusting the parameters, and its ith element is \( {\upvarepsilon}_{\mathrm{i}}^{\ast } \); [X]q × 5 is a matrix, and its ith row [X]i × 5 is \( \left[{\mathrm{x}}_{\mathrm{e}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)-{\mathrm{y}}_{\mathrm{e}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right),{\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right),{\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right),\cos \left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{x}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right),\sin \left({\uptheta}_{\mathrm{i}}^{\ast}\right){\mathrm{N}}_{\mathrm{y}}\left({\uptheta}_{\mathrm{i}}^{\ast}\right)\right] \); [Δ]5 × 1 is a column vector consisting of the adjusted parameters, [Δ]5 × 1 = [Δγ, Δxc, Δyc, Δa, Δb]T, and the sign “T” means the transpose of a vector or matrix.

The least-square method is applied to adjust the five feature parameters. The objective is to make \( {\sum}_{\mathrm{i}=1}^{\mathrm{q}}{\upvarepsilon}_{\mathrm{i}}^2 \) minimum. Based on Eq. (18), the normal equation of the least-square method can be described as

$$ \left({\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}^{\mathrm{T}}{\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}\right){\left[\Delta \right]}_{5\times 1}={\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}^{\mathrm{T}}{\left[{\upvarepsilon}^{\ast}\right]}_{\mathrm{q}\times 1} $$
(19)

By Solving Eq. (19), the parameter increments ∆xc, yc, ∆γ, ∆a and ∆b can be figured out.

According to the principle of statistics, by applying Eq. (18), the variance SE2 of the residuals of the fitting ellipse can be calculated

$$ {\mathrm{SE}}^2=\frac{1}{\mathrm{q}-5}{\sum}_{\mathrm{i}=1}^{\mathrm{q}}{\upvarepsilon}_{\mathrm{i}}^2 $$
(20)

Subsequently, the variances \( {\mathrm{S}}_a^2 \) and \( {\mathrm{S}}_{\mathrm{b}}^2 \) are obtained

$$ {\mathrm{S}}_a^2={\mathrm{S}\mathrm{E}}^2\cdotp {\mathrm{V}}_{4,4}\kern3.25em {\mathrm{S}}_{\mathrm{b}}^2={\mathrm{S}\mathrm{E}}^2\cdotp {\mathrm{V}}_{5,5} $$

where, \( {\mathrm{S}}_a^2 \) is the variance of a; \( {\mathrm{S}}_{\mathrm{b}}^2 \) is the variance of b; V4, 4 and V5, 5 stand for the 4th and 5th diagonal elements of \( {\left({\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}^{\mathrm{T}}{\left[\mathrm{X}\right]}_{\mathrm{q}\times 5}\right)}^{-1} \).

By employing the least-square method (LSM) to fit an ellipse to the periphery of the Sun’s image, the optimal result parameters are obtained, including the semi-major axis anew, the semi- minor axis bnew, the angle γnew

$$ {a}^{\mathrm{new}}=a+\Delta a\kern1.5em {\mathrm{b}}^{\mathrm{new}}=\mathrm{b}+\Delta \mathrm{b}\kern1.5em {\upgamma}^{\mathrm{new}}=\upgamma +\Delta \upgamma $$
(21)

and the center coordinate \( \left({\mathrm{x}}_{\mathrm{c}}^{\mathrm{new}},{\mathrm{y}}_{\mathrm{c}}^{\mathrm{new}}\right) \) of the fitting ellipse in O − XY

$$ {\displaystyle \begin{array}{c}{\mathrm{x}}_{\mathrm{c}}^{\mathrm{new}}={\Delta \mathrm{x}}_{\mathrm{c}}\cdotp \cos \left({\upgamma}^{\mathrm{new}}\right)-\Delta {\mathrm{y}}_{\mathrm{c}}\cdotp \sin \left({\upgamma}^{\mathrm{new}}\right)+{\mathrm{x}}_{\mathrm{c}}\\ {}{\mathrm{y}}_{\mathrm{c}}^{\mathrm{new}}={\Delta \mathrm{x}}_{\mathrm{c}}\cdotp \sin \left({\upgamma}^{\mathrm{new}}\right)+\Delta {\mathrm{y}}_{\mathrm{c}}\cdotp \cos \left({\upgamma}^{\mathrm{new}}\right)+{\mathrm{y}}_{\mathrm{c}}\end{array}} $$
(22)

Taking the Sun’s periphery in Fig. 2d for example, the least-square method is used to fit an ellipse to the periphery. The initial values are the data listed in Table 1, which are the feature parameters calculated by the method of moments. The final results are shown in Fig. 4 and Table 2.

Fig. 4
figure 4

The Sun’s periphery and the fitting ellipse

Table 2 Results calculated by the least-square method (Fig. 2d)

Seeing from Table 2, the variances \( {\mathrm{S}}_a^2 \) and \( {\mathrm{S}}_{\mathrm{b}}^2 \) are very little. If the confidence level is 99.73%, for the semi-major axis a, its measurement accuracy is ±3Sa =  ± 0.1971, and the relative accuracy is 0.011%; for the semi-minor axis b, its measurement accuracy is ±3Sb =  ± 0.2016, and the relative accuracy is 0.012%. For the shape parameter k in Table 2, its relative measurement accuracy can be estimated as 0.023%, the sum of the relative accuracies of a and b. The standard deviation of the fitted ellipse to the periphery of the Sun is only about 4 pixels, while the average diameter of the Sun is about 1765 pixels. The results show that the Sun’s image can be described as an ellipse.

Experimental results

The method of moments and the least-square method are combined to calculate the shape parameters k of the Sun’s images. The images have been taken from sunrise to sunset in mid-December at Dalian. In the Sun’s binary image, the Sun is considered as an ellipse. The method of moments is used to evaluate the feature parameters of the ellipse at first, and the feature parameters are set as the initial values of the iterative algorithm for fitting an ellipse to the periphery of the Sun; then, the least-square method or the iterative algorithm is performed to fit an ellipse to the periphery of the Sun and compute the feature parameters of the ellipse.

The resulting data are listed in Table 3, including the shape parameter k, the semi-major axis a, the semi-minor axis b, and the corresponding errors, where the maximum and minimum values of k, and their corresponding timings, as well as the maximum error of k are marked in bold. Obviously, the Sun’s visual shape always appears to be an ellipse instead of a perfect circle. The Sun’s image is the roundest at noon, while at 7:11 Beijing time, the Sun’s image is a flat ellipse with the minimum shape parameter of 88.13%. It should be noted that the sunset photos were taken at Jinshitan Beach. Because the mountains obstruct some sunset view, the last time in Table 3 is 16:20 Beijing time.

Table 3 Results calculated based on the Sun’s images

To easily observe the variation of the shape parameter, a variation curve is plotted based on the data of Table 3, as shown in Fig. 5, where the horizontal axis is Beijing time, and the vertical axis is k. Seeing from Fig. 5, it is observed that k varies fast and abruptly around sunrise and sunset, whereas it is almost flat from 8:00 to 15:00 Beijing time.

Fig. 5
figure 5

Shape parameter extracted from the Sun’s images

Theoretical analyses and simulation

When the Sun is just rising in the morning, the Sun’s image is flattened in the vertical direction, and its shape parameter is minimal; as time goes on, the Sun’s visual shape becomes rounder and rounder, until noon, when the shape parameter reaches its maximum; however, the roundest image of the Sun is still an ellipse, but not a circle. In this Section, based on atmospheric refraction effects and the length contraction phenomenon in the Einstein’s special relativity theory, the theoretical analysis and simulation are conducted to investigate the reasons for the variation of the Sun’s visual shape.

Atmospheric refraction effects

By considering the atmospheric refraction effects only, the Sun’s visual shape is affected by the refractive index of the atmosphere, the Sun’s position in the sky and observation time; therefore, a model to estimate the refraction index at an altitude was established, and a set of formulas was derived to determine the zenith and azimuth angles of the Sun for different observation times and positions. Finally, an iterative algorithm was constructed to trace rays of light in the atmosphere.

Model of the atmospheric altitude and the refraction index

The Sun’s diameter is 1.392 × 106 km, and the average Sun-Earth distance is about 1.496 × 108 km. It is assumed that the rays from the Sun travel in straight lines. When an observer on the Earth sees the Sun, his angle of view can be calculated by the Sun’s diameter over the average Sun-Earth distance, equal to 32.004 or 0.5334o. However, the Earth is surrounded by a thick atmosphere, and the rays of light must pass through the atmosphere before reaching the Earth. By increasing the altitude, the air density decreases, resulting in a decrease in the refractive index of the atmosphere. As a result, the rays of light are bent in the atmosphere, which means the angle of view varies. The variation in the angle of view mainly occurs in the vertical direction, while in the horizontal direction, the angle of view almost remains unaffected. Therefore, the Sun in our eyes is like an ellipse, but not a circle. The shape of the ellipse varies with the observation time and position. The altitude influences the refractive index by the varying temperature and pressure. When the altitude is above 50 km, the refractive index approaches 1, so the paper mainly focuses on the propagation of light rays in the atmosphere below this altitude.

The relationship between air temperature T (in °K) and altitude H (in km) can be formulated as (Karin and Florian 2004; Jiang et al. 2013; Wang et al. 2018)

$$ \mathbf{T}\left(\mathrm{H}\right)=\left\{\begin{array}{c}{\mathrm{T}}_0-6.5\mathrm{H}\kern5em \mathrm{H}\le 11\ \mathrm{km}\kern4.25em \\ {}{\mathrm{T}}_0-71.5\kern5em 11\ \mathrm{km}<\mathrm{H}\le 22\ \mathrm{km}\\ {}{\mathrm{T}}_0+\mathrm{H}-93.5\kern2.75em 22\ \mathrm{km}<\mathrm{H}\le 32\ \mathrm{km}\\ {}{\mathrm{T}}_0+3\mathrm{H}-157.5\kern1.75em 32\ \mathrm{km}<\mathrm{H}\le 50\ \mathrm{km}\end{array}\right. $$
(23)

where, T0 is the air temperature at ground level.

Setting T0 = 269.15oK, i.e. −4oC, based on Eq. (23), a temperature variation curve T(H) is given in Fig. 6, where the horizontal axis is the altitude H, the vertical axis is the temperature T.

Fig. 6
figure 6

Temperature variation as a function of altitude

According to hydrostatics, the air pressure P and the altitude H satisfy the condition

$$ \frac{\mathrm{dP}}{\mathrm{dH}}=-\uprho \mathrm{g} $$
(24)

where, ρ is the air density in g/m3; g is the gravitational acceleration, equal to 9.8 m/s2. In the atmosphere, the air satisfies the equation of state

$$ \mathrm{P}=\frac{\uprho}{\upmu}\mathrm{RT} $$
(25)

where, R = 8.3144 J · Mol−1 · K−1 is the gas constant; μ = 28.966 g · Mol−1 is the molar mass of air. Substituting Eq. (25) into Eq. (24), the relationship between the air pressure P and altitude H is obtained

$$ \frac{\mathrm{dP}}{\mathrm{dH}}=-\frac{\upmu \mathrm{g}}{\mathrm{R}}\frac{\mathrm{P}}{\mathrm{T}} $$
(26)

The relationship between air density ρ and altitude H can be expressed as

$$ \frac{\mathrm{d}\uprho}{\mathrm{d}\mathrm{H}}=-\frac{\uprho}{\mathrm{T}}\left(\frac{\upmu \mathrm{g}}{\mathrm{R}}+\frac{\mathrm{d}\mathrm{T}}{\mathrm{d}\mathrm{H}}\right) $$
(27)

Substituting Eq. (23) into Eqs. (26) and (27), the following formulas are obtained by calculating the integral

$$ \mathrm{P}\left(\mathrm{H}\right)=\left\{\begin{array}{c}{\mathrm{P}}_0\cdotp {\left(1-\frac{6.5}{{\mathrm{T}}_0}\mathrm{H}\right)}^{5.2526}\kern9.75em \mathrm{H}\le 11\ \mathrm{km}\kern4.25em \\ {}\mathrm{P}(11)\cdotp {\mathrm{e}}^{\frac{34.1416}{\mathrm{T}(11)}\left(\mathrm{H}-11\right)}\kern9.5em 11\ \mathrm{km}<\mathrm{H}\le 22\ \mathrm{km}\\ {}\mathrm{P}(22)\cdotp {\left[1+\frac{1}{\mathrm{T}(22)}\cdotp \left(\mathrm{H}-22\right)\right]}^{-34.1416}\kern2em 22\ \mathrm{km}<\mathrm{H}\le 32\ \mathrm{km}\\ {}\mathrm{P}(32)\cdotp {\left[1+\frac{3}{\mathrm{T}(32)}\cdotp \left(\mathrm{H}-32\right)\right]}^{-11.3805}\kern1.75em 32\ \mathrm{km}<\mathrm{H}\le 50\ \mathrm{km}\end{array}\right. $$
(28)

and

$$ \uprho \left(\mathrm{H}\right)=\left\{\begin{array}{c}{\uprho}_0\cdotp {\left(1-\frac{6.5}{{\mathrm{T}}_0}\mathrm{H}\right)}^{4.2526}\kern8.75em \mathrm{H}\le 11\ \mathrm{km}\kern4.25em \\ {}\uprho (11)\cdotp {\mathrm{e}}^{\frac{34.1416}{\mathrm{T}(11)}\left(\mathrm{H}-11\right)}\kern8.75em 11\ \mathrm{km}<\mathrm{H}\le 22\ \mathrm{km}\\ {}\uprho (22)\cdotp {\left[1+\frac{1}{\mathrm{T}(22)}\cdotp \left(\mathrm{H}-22\right)\right]}^{-35.1416}\kern1.25em 22\ \mathrm{km}<\mathrm{H}\le 32\ \mathrm{km}\\ {}\uprho (32)\cdotp {\left[1+\frac{3}{\mathrm{T}(32)}\cdotp \left(\mathrm{H}-32\right)\right]}^{-12.3805}\kern1em 32\ \mathrm{km}<\mathrm{H}\le 50\ \mathrm{km}\end{array}\right. $$
(29)

where, P0 and ρ0 stand for the air pressure and air density at ground level. P0, ρ0 and T0 satisfy Eq.(25); P, T and ρ are functions of H.

Setting T0 = 269.15oK, P0 = 1.01325 × 105 Pa, ρ0 can be calculated from Eq. (25), that is \( {\uprho}_0=\frac{{\mathrm{P}}_0\upmu}{\mathrm{R}{\mathrm{T}}_0}=1.3115\ \mathrm{kg}/{\mathrm{m}}^3 \). Based on Eqs. (23), (28) and (29), the variations of atmospheric pressure and air density as a function of altitude are obtained, as shown in Fig. 7.

Fig. 7
figure 7

Atmospheric pressure and air density variations as a function of altitude

Neglecting influences of vapor in the air on the refractive index of the atmosphere, based on Eq. (25), the refractive index n can be calculated by (Karin and Florian 2004; Jiang et al. 2013; Xiang 2008)

$$ {\displaystyle \begin{array}{c}\mathrm{n}\left(\mathrm{H}\right)=1+7.76\times {10}^{-8}\times \left(1+7.52\times {10}^{-3}{\lambda}^{-2}\right)\cdotp \frac{\mathrm{P}\left(\mathrm{H}\right)}{\mathrm{T}\left(\mathrm{H}\right)}\ \\ {}\kern3em =1+2.23\times {10}^{-8}\times \left(1+7.52\times {10}^{-3}{\lambda}^{-2}\right)\cdotp \rho \left(\mathrm{H}\right)\end{array}} $$
(30)

Where, λ (in μm) is the wavelength of light.

Based on Eq. (30), the refractive index n(H) is plotted in Fig. 8, where the red line stands for the red light from the Sun at sunrise, at the wavelength of λ = 0.685 μm; the black line stands for the white light from the Sun at noon, at the wavelength of λ = 0.550 μm. Seeing Fig. 8, it can be found that with an increase in the altitude, the refractive index n decreases. When H > 30 km, n approaches 1, i.e. the refractive index in a vacuum.

Fig. 8
figure 8

Refractive index variation as a function of altitude

In order to investigate the influence of wavelength of light on the refractive index n, the difference of n between the red and white light is calculated; the results are shown in Fig. 9. Obviously, the influence of wavelength on n mainly occurs in the atmosphere below 30 km, but the influence is very little and can be neglected.

Fig. 9
figure 9

Difference of n between red and white light

Model of the theoretical zenith angle of the sun, the observation time and position

The Sun’s photos were taken in mid-December 2018 at Dalian. Besides the refractive index of the atmosphere, the observation time and position also affect the Sun’s visual shape. Therefore, a model of the Sun’s zenith angle, the observation time and position should be established. Here, neglecting atmospheric refraction effects, a set of formulas was derived to calculate the theoretical zenith angle of the Sun according to the observation position and time.

Figure 10 is a sectional view of the Earth surrounded by a thick atmosphere. Dalian is located at 121.62oE longitude and 38.92oN latitude. It is assumed that a line connects Dalian (point A) and the Earth’s center (point O), another one connects the Sun and the Earth’s center (point O). The angle φDL between the two lines is the theoretical zenith angle of the Sun. The Earth rotates around its axis, and simultaneously moves around the Sun on the ecliptic plane. The Earth’s axis is not perpendicular to the ecliptic plane since there is the declination angle between the equatorial plane and the ecliptic plane. Therefore, the theoretical zenith angle φDL of the Sun varies with the Earth’s rotation and its position on the ecliptic plane.

Fig. 10
figure 10

Sectional view of the Earth surrounded by a thick atmosphere

For convenience, it is assumed that the Sun moves around the Earth in an elliptical orbit, and the Earth is located at a focal point of the elliptical orbit. The parameters of the elliptical orbit are: the semi-major axis \( {\hat{a}}_{\mathrm{S}}=1.4960\times {10}^8\ \mathrm{km} \), the semi-minor axis \( {\hat{\mathrm{b}}}_{\mathrm{S}}=1.4958\times {10}^8\ \mathrm{km} \), the focal length \( {\hat{\mathrm{c}}}_{\mathrm{S}}=25\times {10}^5\ \mathrm{km} \), the eccentricity \( {\hat{\mathrm{e}}}_{\mathrm{S}}=0.0167 \).

The Sun coordinate system O − XsYs is shown in Fig. 11, where the original point is set as the focus where the Earth is located; Xs points to the perihelion; Ys is perpendicular to Xs. In terms of Xs the elliptical orbit can be described as

$$ \mathrm{r}\left(\uptheta \right)=\frac{{\hat{\mathrm{e}}}_{\mathrm{S}}{\hat{\mathrm{P}}}_{\mathrm{S}}}{1+{\hat{\mathrm{e}}}_{\mathrm{S}}\cos \left(\uptheta \right)} $$
(31)

where, r(θ) is the polar radius; θ is the corresponding polar angle; \( {\hat{\mathrm{P}}}_{\mathrm{S}}={\left({\hat{\mathrm{b}}}_{\mathrm{S}}\right)}^2/{\hat{\mathrm{c}}}_{\mathrm{S}} \).

Fig. 11
figure 11

Two coordinate systems O − XsYs and O − XEYEZE

According to Kepler’s second law, r(θ) satisfies

$$ {\mathrm{r}}^2\left(\uptheta \right)\cdotp \frac{\mathrm{d}\uptheta}{\mathrm{d}\mathrm{t}}={\mathrm{C}}_0 $$
(32)

where, C0 is an undetermined constant; t stands for the time counting from the perihelion.

Calculating the integral of Eq. (32), t(θ) can be expressed as

$$ \mathrm{t}\left(\uptheta \right)=\frac{1}{{\mathrm{C}}_0}{\int}_0^{\uptheta}{\mathrm{r}}^2\left(\uptheta \right)\mathrm{d}\uptheta $$
(33)

The area of the elliptical orbit is \( \uppi \cdotp {\hat{\mathrm{a}}}_{\mathrm{S}}\cdotp {\hat{\mathrm{b}}}_{\mathrm{S}} \), which is defined as

$$ \frac{1}{2}{\int}_0^{2\uppi}{\mathrm{r}}^2\left(\uptheta \right)\mathrm{d}\uptheta =\uppi \cdotp {\hat{a}}_{\mathrm{S}}\cdotp {\hat{\mathrm{b}}}_{\mathrm{S}} $$
(34)

Because the period of revolution of the Earth is T0 = 365.2422 days, and T0 = t(2π), substituting Eq. (34) into Eq. (33), C0 can be obtained

$$ {\mathrm{C}}_0=\frac{2\uppi \cdotp {\hat{a}}_{\mathrm{S}}\cdotp {\hat{\mathrm{b}}}_{\mathrm{S}}}{{\mathrm{T}}_0} $$
(35)

Substituting Eqs. (31) and (35) into Eq. (33), t(θ) can be rewritten as

$$ \mathrm{t}\left(\uptheta \right)=\frac{{\mathrm{T}}_0}{2\uppi \cdotp {\hat{a}}_{\mathrm{S}}\cdotp {\hat{\mathrm{b}}}_{\mathrm{S}}}{\int}_0^{\cdotp }{\left(\frac{{\hat{\mathrm{e}}}_{\mathrm{S}}{\hat{\mathrm{P}}}_{\mathrm{S}}}{1+{\hat{\mathrm{e}}}_{\mathrm{S}}\cos \left(\uptheta \right)}\right)}^2d\uptheta $$
(36)

Letting

$$ \tan \left(\frac{\hat{\upvarphi}}{2}\right)=\sqrt{\frac{1-{\hat{\mathrm{e}}}_{\mathrm{S}}}{1+{\hat{\mathrm{e}}}_{\mathrm{S}}}}\tan \left(\frac{\uptheta}{2}\right) $$
(37)

replacing the variable θ in Eq. (36) yields

$$ \mathrm{t}\left(\hat{\upvarphi}\right)=\frac{{\mathrm{T}}_0}{2\uppi}\left(\hat{\upvarphi}-{\hat{\mathrm{e}}}_{\mathrm{S}}\sin \left(\hat{\upvarphi}\right)\right) $$
(38)

For a given time t0, in order to determine the Sun’s polar angle θ,\( \hat{\upvarphi} \) should be first solved by using Eq. (38); then θ is obtained by substituting \( \hat{\upvarphi} \) into Eq. (37).

Eq. (38) is a transcendental equation. In order to solve for \( \hat{\upvarphi} \), an iterative algorithm is constructed

$$ {\hat{\upvarphi}}^{\mathrm{n}+1}=\frac{2\uppi \cdotp {\mathrm{t}}_0}{{\mathrm{T}}_0}+{\hat{\mathrm{e}}}_{\mathrm{S}}\sin \left({\hat{\upvarphi}}^{\mathrm{n}}\right) $$
(39)

where, \( {\hat{\upvarphi}}^{\mathrm{n}} \) is the iteration variable in the nth iteration, with an initial iteration value of \( {\hat{\upvarphi}}^0=\frac{2\uppi \cdotp {\mathrm{t}}_0}{{\mathrm{T}}_0} \). The error formula of the iterative algorithm can be expressed as

$$ \mid {\hat{\upvarphi}}^{\mathrm{n}}-{\hat{\upvarphi}}^{\ast}\mid \le \frac{{\mathrm{L}}^{\mathrm{n}}}{1-\mathrm{L}}\mid {\hat{\upvarphi}}^0-{\hat{\upvarphi}}^1\mid $$
(40)

where, \( {\hat{\upvarphi}}^{\ast } \) is the solution to Eq. (38); L is Lipschitz constant, the maximum value of the derivative of \( {\hat{\upvarphi}}^{\mathrm{n}} \), satisfying

$$ \mathrm{L}=\frac{\mathrm{d}\left(\frac{2\uppi \cdotp {\mathrm{t}}_0}{{\mathrm{T}}_0}+{\hat{\mathrm{e}}}_{\mathrm{S}}\sin \left(\hat{\upvarphi}\right)\right)}{\mathrm{d}\hat{\upvarphi}}\le {\hat{\mathrm{e}}}_{\mathrm{S}}=0.0167 $$
(41)

From Eqs. (40) and (41), it is seen that the iterative algorithm converges very fast. During the iteration, when setting the accuracy as 10−6(o), the number of iterations is not more than 3, that is n ≤ 3.

In Fig. 11, the Earth coordinate system O − XEYEZE is also established, where the original point is the Earth’s center, which coincides with the original point of the Sun coordinate system O − XsYs; ZE is the Earth’s axis; YE is along the line of the intersection of the equatorial plane and the ecliptic plane, and coincides with Ys; XE is in the equatorial plane, the angle δ is the declination angle equal to 23.433o.

According to the Gregorian calendar, when the Sun is located at an intersection of the equatorial plane and the ecliptic plane, or when the Sun is on the YE, the time in 2018 is 00:15:24 on March 21 (Beijing time); in this paper, this time is taken as reference time. Beijing time is defined as the time at 120oE longitude. At 00:15:24 on March 21, \( {\upxi}_{\mathrm{BJ}}^0 \) is used to denote the angle between the projection of the 120oE longitude on the plane O − XEYE and the XE axis. At the reference time, the Sun’s polar angle θ = 90o, and there are 11.7433 h from 00:15:24 to 12:00:00 Beijing time; then, \( {\upxi}_{\mathrm{BJ}}^0 \) can be calculated by

$$ {\upxi}_{\mathrm{BJ}}^0={90}^{\mathrm{o}}-11.7433\left({\overline{\upomega}}_{\mathrm{E}}-{\overline{\upomega}}_{\mathrm{S}}\right)=-{86.1495}^{\mathrm{o}} $$
(42)

where, \( {\overline{\upomega}}_{\mathrm{E}}={15.0411}^{\mathrm{o}}/\mathrm{hour} \), is the average angular velocity of the Earth around its axis; \( {\overline{\upomega}}_{\mathrm{S}}={0.0411}^{\mathrm{o}}/\mathrm{hour} \), is the average angular velocity of the Earth around the Sun.

Dalian is located at 121.62oE longitude, with a longitude difference between Dalian and Beijing of 1.62o. ξDL is used to denote the angle between the XE axis and the projection of the 121.62oE longitude on the O − XEYE, as shown in Fig. 11. At the reference time, using \( {\upxi}_{\mathrm{DL}}^0 \) to describe ξDL, and \( {\upxi}_{\mathrm{DL}}^0 \) can be calculated by

$$ {\upxi}_{\mathrm{DL}}^0={\upxi}_{\mathrm{BJ}}^0+{1.62}^{\mathrm{o}}=-{84.5295}^{\mathrm{o}} $$
(43)

Taking 00:15:24 on March 21, 2018 (Beijing time) as reference time, after ∆t hours, ξDL can be obtained

$$ {\upxi}_{\mathrm{DL}}={\upxi}_{\mathrm{DL}}^0+\Delta \mathrm{t}\left({\overline{\upomega}}_{\mathrm{E}}-{\overline{\upomega}}_{\mathrm{S}}\right) $$
(44)

In the Earth coordinate system O − XEYEZE, ηDL is used to stand for the angle between the radius direction from the original point (point O) to Dalian (point A) and the coordinate plane O − XEYE, as shown in Fig. 11. Because Dalian is located at 38.92oN latitude, ηDL = 38.92o. \( \overrightarrow{\mathrm{OA}} \) is the unit vector along the radius direction OA, and can be expressed by

$$ \overrightarrow{\mathrm{OA}}=\cos \left({\upeta}_{\mathrm{DL}}\right)\cos \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{i}}_{\mathrm{E}}}+\cos \left({\upeta}_{\mathrm{DL}}\right)\sin \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{j}}_{\mathrm{E}}}+\sin \left({\upeta}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{k}}_{\mathrm{E}}}\kern0.75em $$
(45)

where, \( \overrightarrow{{\mathrm{i}}_{\mathrm{E}}} \), \( \overrightarrow{{\mathrm{j}}_{\mathrm{E}}} \) and \( \overrightarrow{{\mathrm{k}}_{\mathrm{E}}} \) are the unit vectors along XE, YE and ZE, respectively.

Based on Eqs. (37) and (38), setting θ = 90o, the moving time of the Sun from the perihelion to the reference time can be obtained, that is t0 = 89.367789 days. In the Sun coordinate system O − XsYs, applying the iterative algorithm of Eq. (39), setting to = t0 + ∆t, the polar angle θ of the Sun after moving ∆t hours can be obtained from Eqs. (37) and (38). At the moment to, it is assumed that \( \overrightarrow{\mathrm{OS}} \) is the unit vector along the radius vector r(θ) of the Sun. In the Earth coordinate system O − XEYEZE, \( \overrightarrow{\mathrm{OS}} \) can be expressed as

$$ \overrightarrow{\mathrm{OS}}=\cos \left(\uptheta \right)\cos \left(\updelta \right)\overrightarrow{{\mathrm{i}}_{\mathrm{E}}}+\sin \left(\uptheta \right)\overrightarrow{{\mathrm{j}}_{\mathrm{E}}}-\cos \left(\uptheta \right)\sin \left(\updelta \right)\overrightarrow{{\mathrm{k}}_{\mathrm{E}}} $$
(46)

The angle between \( \overrightarrow{\mathrm{OS}} \) and \( \overrightarrow{\mathrm{OA}} \) is the theoretical zenith angle φDL of the Sun relative to Dalian, as shown in Fig. 10. Based on Eqs. (45) and (46), φDL can be figured out by

$$ {\displaystyle \begin{array}{c}\cos {\upvarphi}_{\mathrm{DL}}=\overrightarrow{\mathrm{OS}}\cdotp \overrightarrow{\mathrm{OA}}\kern16em \\ {}\kern0.5em =\cos \left({\upeta}_{\mathrm{DL}}\right)\cos \left({\upxi}_{\mathrm{DL}}\right)\cos \left(\uptheta \right)\cos \left(\updelta \right)\kern2em \\ {}\kern3.5em +\cos \left({\upeta}_{\mathrm{DL}}\right)\sin \left({\upxi}_{\mathrm{DL}}\right)\sin \left(\uptheta \right)-\sin \left({\upeta}_{\mathrm{DL}}\right)\cos \left(\uptheta \right)\sin \left(\updelta \right)\end{array}} $$
(47)

Projecting \( \overrightarrow{\mathrm{OS}} \) on the equatorial plane O − XEYE, ξSun is used to denote the angle between the projection vector of \( \overrightarrow{\mathrm{OS}} \) and the XE, which describes the direction of the Sun, satisfying

$$ \tan \left({\upxi}_{\mathrm{Sun}}\right)=\frac{\sin \left(\uptheta \right)}{\cos \left(\uptheta \right)\cos \left(\updelta \right)} $$
(48)

12:00:00 Beijing time is not the moment when the Sun shines over Dalian. The time difference ∆t can be calculated by

$$ \Delta \mathrm{t}=\frac{\upxi_{\mathrm{S}\mathrm{un}}-{\upxi}_{\mathrm{DL}}}{{\overline{\upomega}}_{\mathrm{E}}-{\overline{\upomega}}_{\mathrm{S}}} $$
(49)

In Fig. 11, the Dalian coordinate system A − XDLYDLZDL is established too, where the original point is Dalian (point A); \( {\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}} \) is the unit vector of the XDL axis, and it is tangent to the longitude of Dalian, pointing to the North Pole; \( {\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}} \) is the unit vector of the YDL axis, and it is tangent to the latitude of Dalian, pointing to west; ZDL is the Zenith direction, and its unit vector is \( \overrightarrow{\mathrm{OA}} \) expressed by Eq. (45). \( {\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}} \) and \( {\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}} \) can be given by

$$ {\displaystyle \begin{array}{c}{\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}}=-\sin \left({\upeta}_{\mathrm{DL}}\right)\cos \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{i}}_{\mathrm{E}}}-\sin \left({\upeta}_{\mathrm{DL}}\right)\sin \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{j}}_{\mathrm{E}}}+\cos \left({\upeta}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{k}}_{\mathrm{E}}}\ \\ {}{\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}}=\sin \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{i}}_{\mathrm{E}}}-\cos \left({\upxi}_{\mathrm{DL}}\right)\overrightarrow{{\mathrm{j}}_{\mathrm{E}}}\kern16.75em \end{array}} $$
(50)

In the Dalian coordinate system A − XDLYDLZDL, the components of \( \overrightarrow{\mathrm{OS}} \) can be written as

$$ {\displaystyle \begin{array}{c}{\mathrm{X}}_{\mathrm{DL}}^{\mathrm{S}}={\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}}\cdotp \overrightarrow{\mathrm{OS}}\kern17em \\ {}=-\cos \left(\uptheta \right)\cos \left(\updelta \right)\sin \left({\upeta}_{\mathrm{DL}}\right)\cos \left({\upxi}_{\mathrm{DL}}\right)\kern4.25em \\ {}\kern5.25em -\sin \left(\uptheta \right)\sin \left({\upeta}_{\mathrm{DL}}\right)\sin \left({\upxi}_{\mathrm{DL}}\right)-\cos \left(\uptheta \right)\sin \left(\updelta \right)\cos \left({\upeta}_{\mathrm{DL}}\right)\end{array}} $$
(51)
$$ {\mathrm{Y}}_{\mathrm{DL}}^{\mathrm{S}}={\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}}\cdotp \overrightarrow{\mathrm{OS}}=\cos \left(\uptheta \right)\cos \left(\updelta \right)\sin \left({\upxi}_{\mathrm{DL}}\right)-\cos \left({\upxi}_{\mathrm{DL}}\right)\sin \left(\uptheta \right) $$
(52)

Thus, relative to Dalian, the Sun’s azimuth angle ψDL can be figured out by

$$ \tan \left({\uppsi}_{\mathrm{DL}}\right)=-\frac{{\mathrm{Y}}_{\mathrm{DL}}^{\mathrm{S}}}{{\mathrm{X}}_{\mathrm{DL}}^{\mathrm{S}}} $$
(53)

Defining clockwise rotation as positive, ψDL describes the angle between the Sun’s direction \( \overrightarrow{\mathrm{OS}} \) and due north.

It is assumed that atmospheric refraction effects are neglected, the observation position is Dalian, and the observation time is Beijing time one day in mid-December 2018. In Fig. 12, the variations of the theoretical zenith angle φDL and the azimuth angle ψDL are given, which are calculated from Eqs. (47) and (53).

Fig. 12
figure 12

Variations of the theoretical zenith and azimuth angles of the Sun

Besides, the time when the Sun shines over Dalian is calculated by Eq. (49). The simulation results are given in Fig. 13, where the horizontal axis is the date in the whole year of 2018, and the vertical axis is the time when the Sun shines over Dalian. From Fig. 13, it is seen that the time ranges from 11:36 to 12:08.

Fig. 13
figure 13

Variation of the time that the Sun shines over Dalian in 2018

Iterative algorithm for tracing rays of light in the atmosphere

Because the refractive index of the atmosphere varies with altitude, the rays of light are bent in the atmosphere surrounding the Earth. In the inhomogeneous medium, the propagation of light satisfies (Born and Wolf 2007)

$$ \frac{\mathrm{d}}{\mathrm{d}\mathrm{s}}\left(\mathrm{n}\frac{\mathrm{d}\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)}{\mathrm{d}\mathrm{s}}\right)=\overrightarrow{\nabla}\mathrm{n} $$
(54)

where, \( \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right) \) stands for the trace of light; s is the length of arc; n is the refractive index of the atmosphere; \( \overrightarrow{\nabla}\mathrm{n} \) is the gradient of the refractive index.

According to Eq. (30), the refractive index of the atmosphere can be expressed as n(R), where R is the distance of a point in the atmosphere to the Earth’s center. Because the contour surface of n(R) is spherical, its gradient direction is parallel to the radial direction of the Earth, that is \( \overrightarrow{\mathrm{R}}\times \overrightarrow{\nabla}\mathrm{n}=0 \). Thus, Eq. (54) can be simplified as

$$ \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)\times \frac{\mathrm{d}}{\mathrm{d}\mathrm{s}}\left(\mathrm{n}\frac{\mathrm{d}\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)}{\mathrm{d}\mathrm{s}}\right)=0 $$
(55)

or

$$ \frac{\mathrm{d}}{\mathrm{d}\mathrm{s}}\left(\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)\times \mathrm{n}\frac{\mathrm{d}\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)}{\mathrm{d}\mathrm{s}}\right)=0 $$
(56)

So

$$ \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)\times \mathrm{n}\frac{\mathrm{d}\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)}{\mathrm{d}\mathrm{s}}=\overrightarrow{\mathrm{Const}} $$
(57)

where, \( \overrightarrow{\mathrm{Const}} \) denotes a constant vector; \( \frac{\mathrm{d}\overrightarrow{\mathrm{R}}\left(\mathrm{s}\right)}{\mathrm{d}\mathrm{s}} \) describes the propagation direction of light. It can be seen from Eq. (57) that all position vectors \( \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right) \) of a ray are perpendicular to the constant vector \( \overrightarrow{\mathrm{Const}} \). Meanwhile, the position vectors \( \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right) \) pass through the original point, so all position vectors \( \overrightarrow{\mathrm{R}}\left(\mathrm{s}\right) \) are in the same plane, and the constant vector \( \overrightarrow{\mathrm{Const}} \) is normal to the plane. Therefore, Eq. (57) proves that the trace of light in the atmosphere is a plane curve, and the plane is determined by the Earth’s center, the incidence point and incidence direction of light, as shown in Fig. 14. Using \( \hat{\uptheta} \) to denote the angle between the propagation direction of light and the radial direction of the Earth, taking the modulus of the two sides of Eq. (57) derives

$$ \mathrm{R}\left(\mathrm{s}\right)\cdotp \mathrm{n}\cdotp \sin \left(\hat{\uptheta}\right)=\mathrm{Const} $$
(58)
Fig. 14
figure 14

Propagation direction of rays in the atmosphere

In order to trace the rays of light in the atmosphere, the atmosphere below the altitude of 50 km is equally divided into 500 layers. It is assumed that the refractive index of each layer is constant. For convenience, the subscript"i" is used to express the ith layer of the atmosphere, i = 1, 2⋯500. Ri stands for the distance of the ith layer of the atmosphere from the Earth’s center; ni is the refractive index of the ith layer; θi is the angle between the radial direction of the Earth and the propagation direction of light in the ith layer, as shown in Fig. 14.

Eq. (58) is rewritten as

$$ {\mathrm{R}}_{\mathrm{i}+1}\cdotp {\mathrm{n}}_{\mathrm{i}+1}\cdotp \sin \left({\hat{\uptheta}}_{\mathrm{i}+1}\right)={\mathrm{R}}_{\mathrm{i}}\cdotp {\mathrm{n}}_{\mathrm{i}}\cdotp \sin \left({\hat{\uptheta}}_{\mathrm{i}}\right) $$
(59)

According to Eq. (59), an iterative algorithm for tracing the rays of light can be constructed. In Fig. 14, a coordinate system O − XY was established, where the original point was the Earth’s center; the horizontal axis X pointed to the Sun; the Y axis was perpendicular to the X axis in the propagation plane of the rays. Based on the reversibility of the optical path, it is assumed that the rays of light travel from the Earth to the Sun. \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}}\left({\mathrm{x}}_{\mathrm{i}},{\mathrm{y}}_{\mathrm{i}}\right) \) is an incidence point of light in the ith layer in the atmosphere, and \( \left|{\overrightarrow{\mathrm{OP}}}_{\mathrm{i}}\right|={\mathrm{R}}_{\mathrm{i}} \); αi is the angle between \( {\overrightarrow{\mathrm{OP}}}_{\mathrm{i}} \) and the X axis; \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}+1}\left({\mathrm{x}}_{\mathrm{i}+1},{\mathrm{y}}_{\mathrm{i}+1}\right) \) is the incidence point of light in the (i + 1)th layer, and \( \left|{\overrightarrow{\mathrm{OP}}}_{\mathrm{i}+1}\right|={\mathrm{R}}_{\mathrm{i}+1} \). \( {\overrightarrow{\mathrm{P}}}_{\mathrm{i}+1}\left({\mathrm{x}}_{\mathrm{i}+1},{\mathrm{y}}_{\mathrm{i}+1}\right) \) can be traced and calculated by

$$ {\displaystyle \begin{array}{c}\sin {\hat{\uptheta}}_{\mathrm{i}+1}=\frac{{\mathrm{R}}_{\mathrm{i}}{\mathrm{n}}_{\mathrm{i}}}{{\mathrm{R}}_{\mathrm{i}+1}{\mathrm{n}}_{\mathrm{i}+1}}\sin {\hat{\uptheta}}_{\mathrm{i}}\kern2.5em \\ {}\sin {\upbeta}_{\mathrm{i}+1}=\frac{{\mathrm{R}}_{\mathrm{i}}}{{\mathrm{R}}_{\mathrm{i}+1}}\sin {\hat{\uptheta}}_{\mathrm{i}}\kern4em \\ {}\begin{array}{c}{\upalpha}_{\mathrm{i}+1}={\upalpha}_{\mathrm{i}}+{\upbeta}_{\mathrm{i}+1}-{\hat{\uptheta}}_{\mathrm{i}}\ \\ {}{\mathrm{x}}_{\mathrm{i}+1}={\mathrm{R}}_{\mathrm{i}+1}\cos \left({\upalpha}_{\mathrm{i}+1}\right)\\ {}{\mathrm{y}}_{\mathrm{i}+1}={\mathrm{R}}_{\mathrm{i}+1}\sin \left({\upalpha}_{\mathrm{i}+1}\right)\end{array}\end{array}} $$
(60)

where, βi + 1 is the incidence angle of light from the ith to the (i + 1)th layer. Eq. (60) is a one-step explicit scheme with first-order accuracy, and can be used to simulate the propagation path of light in the atmosphere. During the simulation, the observation position coordinate \( {\overrightarrow{\mathrm{P}}}_0\left({\mathrm{x}}_0,{\mathrm{y}}_0\right) \) and the angle \( {\hat{\uptheta}}_0 \) between the direction of light from the observation position and the radial direction of the Earth should be determined first. When simulating the rays of light from the center of the Sun, \( {\hat{\uptheta}}_0 \) is the observed zenith angle \( {\overset{\sim }{\upvarphi}}_{\mathrm{DL}} \).

Taking Dalian as the observation position, the rays of light propagate in the plane determined by Dalian, the Earth’s center and the Sun, as shown in Fig. 10. The coordinates of \( {\overrightarrow{\mathrm{P}}}_0 \) can be obtained by [OAcos(φDL), OAsin(φDL)], where φDL is the theoretical zenith angle calculated by Eq. (47). Because the observation position is at the seaside in Dalian, OA is set as the Earth’s radius, that is OA = 6371 km. In order to solve for \( {\hat{\uptheta}}_0 \), the method of bisection is performed. An initial guess of \( {\hat{\uptheta}}_0 \) is set to [φDL − 2o, φDL + 2o]. After the light from the Earth reaches the altitude of 50 km, its propagation direction remains unchanged, so the angle τSun between the ray and the x axis at that altitude is constrained as a given value.

The observation time is in mid-December 2018. Fig 15 shows the propagation paths of rays from the center of the Sun in the atmosphere. In Fig. 15, Dalian is set as the origin, the horizontal and vertical directions are the same as the X and Y axes in Fig. 10, and the time is Beijing time. During the simulation τSun = 0, which means when the light reaches the atmosphere at the altitude of 50 km, its propagation direction is parallel to the X axis.

Fig. 15
figure 15

Propagation paths of light rays in the atmosphere at different times in the morning at Dalian

Defining \( \updelta \upvarphi ={\overset{\sim }{\upvarphi}}_{\mathrm{DL}}-{\upvarphi}_{\mathrm{DL}} \), φDL is the theoretical zenith angle of the Sun, and \( {\overset{\sim }{\upvarphi}}_{\mathrm{DL}} \) is the observed zenith angle of the Sun. In Fig. 16, the difference between φDL and \( {\overset{\sim }{\upvarphi}}_{\mathrm{DL}} \) is given, where the horizontal axis is Beijing time of a day, the vertical axis is δφ. From Fig. 16, it could be found that δφ is bigger at sunrise and sunset than at noon, a result caused by atmospheric refraction.

Fig. 16
figure 16

Variation of the difference between φDL and \( {\overset{\sim }{\upvarphi}}_{\mathrm{DL}} \) at Dalian

In the Dalian coordinate system A − XDLYDLZDL, the direction of the Sun can be described by the observed zenith angle \( {\overset{\sim }{\upvarphi}}_{\mathrm{DL}} \) and the azimuth angle ψDL

$$ {\displaystyle \begin{array}{c}{\mathrm{X}}_{\mathrm{DL}}^{\mathrm{S}}=\sin \left({\overset{\sim }{\upvarphi}}_{\mathrm{DL}}\right)\cos \left({\uppsi}_{\mathrm{DL}}\right)\kern2.25em \\ {}{\mathrm{Y}}_{\mathrm{DL}}^{\mathrm{S}}=-\sin \left({\overset{\sim }{\upvarphi}}_{\mathrm{DL}}\right)\sin \left({\uppsi}_{\mathrm{DL}}\right)\\ {}{\mathrm{Z}}_{\mathrm{DL}}^{\mathrm{S}}=\cos \left({\overset{\sim }{\upvarphi}}_{\mathrm{DL}}\right)\kern6em \end{array}} $$
(61)

Based on Eq. (61), the direction of the Sun in A − XDLYDLZDL can be calculated. Fig. 17 is the projection of the Sun’s path on the YDLZDL plane at XDL =  − 1km.

Fig. 17
figure 17

Projection of the Sun’s path on the YDLZDL plane at XDL =  − 1 km at Dalian

The length contraction effects in the Einstein’s special relativity theory

Here, atmospheric refraction effects are neglected, and the length contraction phenomenon in the Einstein’s special relativity theory is considered to investigate its effect on the Sun’s visual shape. The length contraction phenomenon in the Sun’s image can be described by the contraction ratio and the contraction direction, which are determined by the relative velocity between the Sun and the Earth.

Because the Sun is far away from the Earth, and the Earth rotates around its axis and simultaneously around the Sun, the relative velocity between the Earth and the Sun is very big. According to the length contraction phenomenon in the Einstein’s theory of special relativity, when an observer on the Earth sees the Sun, the size of the Sun’s visual shape in its moving direction will become shorter, while the size perpendicular to the moving direction remains unchanged. Assuming that the Sun is a sphere, the Sun in the eyes of the observer will be an ellipsoid, and its ratio of the minor to the major axis can be expressed as

$$ {\mathrm{k}}_{\mathrm{SRT}}=\sqrt{1-{\mathrm{v}}^2/{\mathrm{c}}^2} $$
(62)

where, c = 3 × 108 m/s, the velocity of light in vacuum; v is the relative velocity between the Sun and the observer.

Taking into account that the average angular velocity of the Earth around its axis is \( {\overline{\upomega}}_{\mathrm{E}}={15.0411}^{\mathrm{o}}/\mathrm{hour} \), the average angular velocity of the Earth around the Sun is \( {\overline{\upomega}}_{\mathrm{S}}={0.0411}^{\mathrm{o}}/\mathrm{hour} \), the average distance from the Sun to the Earth is 1.496 × 108 km, the relative velocity between the Sun and the observer can approximate to

$$ \mathrm{v}\approx 1.496\times {10}^8\left({\overline{\upomega}}_{\mathrm{E}}-{\overline{\upomega}}_{\mathrm{S}}\right)\approx 1.088\times {10}^7\ \mathrm{m}/\mathrm{s} $$
(63)

Substituting Eq. (63) into Eq. (62) yields

$$ {\mathrm{k}}_{\mathrm{SRT}}\approx 99.93\% $$
(64)

kSRT is the shape parameter of the Sun’s visual shape, describing the effect of the Einstein’s special relativity theory on the visual shape of the Sun. Eq. (64) proves that even if neglecting atmospheric refraction effects, the Sun’s shape in our eyes is an ellipse but not a perfect circle, and the ratio of the length contraction or the ratio of the dimensional deviation between the minor and major axes to the major axis is about 0.07%. However, seeing from Fig. 17, the Sun’s direction relative to the observer varies with time; as a result, the direction of the major axis in the ellipse image of the Sun also varies.

Applying Eqs. (31), (32) and (35), the transient angular velocity ωS(θ) of the Sun around the Earth can be expressed as

$$ {\upomega}_{\mathrm{S}}\left(\uptheta \right)={\overline{\upomega}}_{\mathrm{S}}\frac{{\left(1+{\hat{\mathrm{e}}}_{\mathrm{S}}\cos \left(\uptheta \right)\right)}^2}{{\left(1-{\hat{\mathrm{e}}}_{\mathrm{S}}^2\right)}^{3/2}} $$
(65)

The Sun rotates around the Earth in the elliptical plane, as shown in Fig. 11; its angular velocity vector \( {\overrightarrow{\upomega}}_{\mathrm{S}}\left(\uptheta \right) \) can be written as

$$ {\overrightarrow{\upomega}}_{\mathrm{S}}\left(\uptheta \right)={\upomega}_{\mathrm{S}}\left(\uptheta \right)\left[\sin \left(\updelta \right)\overrightarrow{{\mathrm{i}}_{\mathrm{E}}}+\cos \left(\updelta \right)\overrightarrow{{\mathrm{k}}_{\mathrm{E}}}\right] $$
(66)

The Earth rotates around its axis \( \overrightarrow{{\mathrm{k}}_{\mathrm{E}}} \); its angular velocity vector \( {\overrightarrow{\upomega}}_{\mathrm{E}} \) can be written as

$$ {\overrightarrow{\upomega}}_{\mathrm{E}}={\overline{\upomega}}_{\mathrm{E}}\overrightarrow{\cdotp {\mathrm{k}}_{\mathrm{E}}} $$
(67)

Meanwhile, applying Eqs. (31) and (46), the relative radial velocity \( {\overrightarrow{\mathrm{V}}}_{\mathrm{r}}\left(\uptheta \right) \) is obtained

$$ {\overrightarrow{\mathrm{V}}}_{\mathrm{r}}\left(\uptheta \right)=\frac{{\hat{\mathrm{e}}}_{\mathrm{S}}\sin \left(\uptheta \right)}{1+{\hat{\mathrm{e}}}_{\mathrm{S}}\cos \left(\uptheta \right)}\cdotp \mathrm{r}\left(\uptheta \right)\cdotp {\upomega}_{\mathrm{S}}\left(\uptheta \right)\cdotp \overrightarrow{\mathrm{OS}} $$
(68)

where, \( {\overrightarrow{\mathrm{V}}}_{\mathrm{r}}\left(\uptheta \right) \) is caused by the variable distance between the Sun and the Earth.

Based on Eqs. (66), (67) and (68), the transient relative velocity \( {\overrightarrow{\mathrm{V}}}_{\mathrm{SE}}\left(\uptheta \right) \) between the Sun and the Earth can be calculated by

$$ {\overrightarrow{\mathrm{V}}}_{\mathrm{S}\mathrm{E}}\left(\uptheta \right)={\overrightarrow{\mathrm{V}}}_{\mathrm{r}}\left(\uptheta \right)+\mathrm{r}\left(\uptheta \right)\left[{\overrightarrow{\upomega}}_{\mathrm{S}}\left(\uptheta \right)-{\overrightarrow{\upomega}}_{\mathrm{E}}\left(\uptheta \right)\right]\times \overrightarrow{\mathrm{OS}} $$
(69)

Substituting Eq. (69) into Eq. (62) yields

$$ {\mathrm{k}}_{\mathrm{SRT}}=\sqrt{1-{\left|{\overrightarrow{\mathrm{V}}}_{\mathrm{SE}}\left(\uptheta \right)\right|}^2/{\mathrm{c}}^2} $$
(70)

Eq. (70) describes the way that the Einstein’s special relativity theory affects the visual shape of the Sun when the relative position varies between the Sun and the Earth.

When a high-resolution digital camera is used to take photos of the Sun, the camera remains horizontal and points to the Sun, which means the Sun’s image is taken in the direction \( \overrightarrow{\mathrm{OS}} \). In the Dalian coordinate system A − XDLYDLZDL, the horizontal direction of the camera can be described by the Sun’s azimuth angle ψDL, the unit vectors \( {\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}} \) and \( {\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}} \) along two coordinate axes, that is

$$ {\overrightarrow{\mathrm{H}}}_{\mathrm{camera}}=-\sin \left({\uppsi}_{\mathrm{DL}}\right){\overrightarrow{\mathrm{AN}}}_{\mathrm{DL}}-\cos \left({\uppsi}_{\mathrm{DL}}\right){\overrightarrow{\mathrm{AW}}}_{\mathrm{DL}} $$
(71)

where, \( {\overrightarrow{\mathrm{H}}}_{\mathrm{camera}} \) is the horizontal direction of the camera or image. The vertical direction \( {\overrightarrow{\mathrm{V}}}_{\mathrm{camera}} \) of the camera or image can be determined by

$$ {\overrightarrow{\mathrm{V}}}_{\mathrm{camera}}={\overrightarrow{\mathrm{H}}}_{\mathrm{camera}}\times \overrightarrow{\mathrm{OS}} $$
(72)

In the Sun’s image, the direction of the semi-minor axis caused by the Einstein’s special relativity theory is along the projection of the Sun’s velocity \( {\overrightarrow{\mathrm{V}}}_{\mathrm{SE}}\left(\uptheta \right) \) relative to the Earth on the image. Defining ψbH as the angle between the horizontal direction of the camera and the semi-minor axis of the Sun’ image, it describes the direction of the length contraction or semi-minor axis of the Sun’s image, and can be calculated by

$$ \tan \left({\uppsi}_{\mathrm{bH}}\right)=\frac{{\overrightarrow{\mathrm{V}}}_{\mathrm{camera}}\cdotp {\overrightarrow{\mathrm{V}}}_{\mathrm{SE}}\left(\uptheta \right)}{{\overrightarrow{\mathrm{H}}}_{\mathrm{camera}}\cdotp {\overrightarrow{\mathrm{V}}}_{\mathrm{SE}}\left(\uptheta \right)} $$
(73)

Upon neglecting atmospheric refraction effects or only considering the Einstein’s special relativity theory, and regarding the Sun’s visual shape as an ellipse, its shape parameter kSRT and the angle ψbH can be evaluated by Eqs. (70) and (73), respectively.

In Fig. 18, the variation of the shape parameter kSRT is given, where the horizontal axis is the date in the whole year of 2018, and the vertical axis is kSRT. During the simulation, the observation time is set to 12:00:00 Beijing time every day, and the observation position is Dalian. Figure 18 shows that the Sun’s visual shape is the roundest at the winter solstice, and the flattest at the spring and autumnal equinoxes.

Fig. 18
figure 18

Variation of the shape parameter kSRT in 2018 at Dalian

In Fig. 19, the variation of the angle ψbH is given, where the horizontal axis is the Beijing time of a day in mid-December 2018, the vertical axis is the angle between the semi-minor axis of the Sun’s ellipse image and the horizontal direction of the camera, which describes the direction of the length contraction in the Sun’s image. Figure 19 shows that the angle ranges from 47o to −47o, and the extremes occur at sunrise and sunset. The two directions of the length contraction occurring at sunrise and sunset basically satisfy the mirror-image relation.

Fig. 19
figure 19

Variation of the angle ψbH on a day of mid-December 2018 at Dalian

Numerical simulation and experimental verification

Numerical examples of the atmospheric refraction effects

Eq. (57) shows that the light in the atmosphere propagates in a plane, and the plane is determined by the Earth’s center, the incidence point and incidence direction of light, as shown in Fig. 10 or Fig. 14. In the following numerical examples, the propagation path is simulated and analyzed by applying Eqs. (47) and (60).

When an observer on the Earth sees the Sun, the rays from the Sun pass through the thick atmosphere, and then focus on the observer’s eyes. The Sun’s visual shape is determined by the rays from the upper and lower edges of the Sun; therefore, during the analysis, only the rays from the edges of the Sun are simulated and analyzed. Meanwhile, due to the reversibility of optical path, it is assumed that the rays travel from Dalian to the Sun. In addition, when the altitude in the atmosphere is above 50 km, its refractive index approaches 1; therefore, the atmosphere below the altitude of 50 km is only considered. If the Sun’s rays propagate in straight lines, the observer on the Earth has an angle of view of 0.5334o. As a result, when simulating the ray of the upper edge of the Sun, the angle constraint τSun is set to +0.2667o, and when simulating the ray of the lower edge of the Sun, τSun is set to −0.2667o. This means that when the rays reach the atmosphere at the altitude of 50 km, the angles between the rays and the x axis are restricted to be ±0.2667o.

Dalian is taken as the observation position. The coordinates of Dalian are \( {\overrightarrow{\mathrm{P}}}_0\left[\mathrm{OAcos}\left({\upvarphi}_{\mathrm{DL}}\right),\mathrm{OAsin}\left({\upvarphi}_{\mathrm{DL}}\right)\right] \), OA = 6371 km, and the observation times are in the morning, at noon and in the afternoon on one day in mid-December 2018. In order to determine the initial angle \( {\hat{\uptheta}}_0 \) between the ray from Dalian and the radial direction of the Earth, the method of bisection is performed by setting the initial range of \( {\hat{\uptheta}}_0 \) to [φDL − 2o, φDL + 2o] and constraining the propagation direction of the ray in the atmosphere at the altitude of 50 km as τSun =  ± 0.2667o. \( {\hat{\uptheta}}_0^{\mathrm{Up}} \) denotes the incident angle of the ray from the upper edge of the Sun at Dalian, which is the angle between the ray and the radial direction of the Earth; \( {\hat{\uptheta}}_0^{\mathrm{Lo}} \) expresses the incident angle of the ray from the lower edge of the Sun at Dalian, which is the angle between the ray and the radial direction of the Earth. After performing the method of bisection, \( {\hat{\uptheta}}_0^{\mathrm{Up}} \) and \( {\hat{\uptheta}}_0^{\mathrm{Lo}} \) can be obtained by iteration; then the shape parameter of the Sun’s visual shape is evaluated by

$$ {\mathrm{k}}_{\mathrm{Ref}}=\frac{{\hat{\uptheta}}_0^{\mathrm{Up}}-{\hat{\uptheta}}_0^{\mathrm{Lo}}}{0.5334^{\mathrm{o}}} $$
(74)

where, kRef describes the effect of atmospheric refraction on the Sun’s visual shape.

Figures 20 and 21 show the propagation paths of the rays from the upper and lower edges of the Sun at 7:06 Beijing time. In Fig. 20, Dalian is set as the origin, the horizontal and vertical directions are the same as the X and Y axes in Fig. 10. From the figure, it can be found that the horizon is basically tangent to the ray from the lower edge of the Sun in the morning.

Fig. 20
figure 20

Propagation paths of the rays at 07:06 on a day in mid-December at Dalian

Fig. 21
figure 21

Propagation paths of the rays at 07:06 on a day in mid-December at Dalian

Figure 21 illustrates bending deformations of the rays in the atmosphere. In Fig. 21, the horizontal axis is the horizontal distance between the observer and the Sun, and the vertical axis is the angle between the propagation direction of the ray and the line connecting the Sun’s and the Earth’s centers. (+793.40, +0.2667) and (+787.10, − 0.2667) are the coordinates of the right end points of the two curves, i.e. the coordinates of the rays of the upper and lower edges of the Sun at the altitude of 50 km. When the rays reach an observer at Dalian, his angle of view becomes 0.4457o, that is \( {\hat{\uptheta}}_0^{\mathrm{Up}}-{\hat{\uptheta}}_0^{\mathrm{Lo}}={0.4457}^{\mathrm{o}} \). According to Eq. (74), the shape parameter kRef = 0.8357, which means that the Sun in the observer’s eyes is flattened in the vertical direction.

Figures 22 and 23 show the propagation paths of the rays from the upper and lower edges of the Sun at 11:40 Beijing time. In Fig. 23, (+105.50, +0.2667) and (+91.37, − 0.2667) are the coordinates of the right end points of the two curves, i.e. the coordinates of the rays of the upper and lower edges of the Sun at the altitude of 50 km. At noon, the Sun shines overhead in Dalian. The angle φDL between the line connecting Dalian and the Earth’s center and the x axis is 62.42o, as shown in Fig. 22.

Fig. 22
figure 22

Propagation paths of the rays at 11:40 on a day in mid-December at Dalian

Fig. 23
figure 23

Propagation paths of the rays at 11:40 on a day in mid-December at Dalian

Compared with the morning, the propagation distance of the rays from the edge of the Sun becomes short in the 50-km-thick atmosphere. Meanwhile, the angles between the rays from the Sun and the Earth’s radial direction passing through Dalian (point A) also become small. As a result, bending deformations of the rays in the atmosphere are weakened, which can easily be observed in Fig. 23. When the rays reach Dalian at noon, an observer’s angle of view becomes 0.5327o, bigger than 0.4457o (in the morning) and a little less than 0.5334o(the angular diameter of the Sun). According to Eq. (74), the shape parameter kRef = 0.9986, which means that the Sun’s image is rounder than that in the morning.

Figures 24 and 25 show the propagation paths of the rays from the upper and lower edges of the Sun at 16:28 Beijing time. In Fig. 25, (+777.50, +0.2667) and (+770.40, − 0.2667) are the coordinates of the right end points of the two curves, i.e. the coordinates of the rays of the upper and lower edges of the Sun at the altitude of 50 km. Similarly to the situation in the morning, the angle between the line connecting Dalian and the Earth’s center and the x axis is φDL = 90.18o, as shown in Fig. 24. At this moment, an observer on the Earth can see the whole image of the Sun; however, the fact is that the whole Sun have almost gone under the horizon. The observer’s angle of view is 0.4471o, approximate to 0.4457o (in the morning). According to Eq. (74), the shape parameter kRef = 0.8382, which means that the Sun’s image becomes flattened again.

Fig. 24
figure 24

Propagation paths of the rays at 16:28 on a day in mid-December at Dalian

Fig. 25
figure 25

Propagation paths of the rays at 16:28 on a day in mid-December at Dalian

In order to further investigate the effects of atmospheric refraction on the Sun’s visual shape in the whole year, a variation of the shape parameter is given in Fig. 26, where the horizontal axis is the date in the whole year of 2018, and the vertical axis is the shape parameter kRef, which is calculated by Eq. (74). During the simulation, the observation time is set as 12:00:00 Beijing time every day, the observation position is Dalian. Fig. 26 shows that the Sun’s visual shape is the roundest at the summer solstice, and the flattest at the winter solstice.

Fig. 26
figure 26

Variation of the shape parameter kRef in 2018 at Dalian

Comparison and verification

When researching the effect of the Einstein’s theory of special relativity on the Sun’s visual shape, it is proved that the contraction ratio occurring in the Sun’s image varies slowly and little with time. The shape parameter kSRT ranged from 0.99934 to 0.99948 in the whole year of 2018, as shown in Fig. 18. However, the contraction direction or the semi-minor axis direction in the Sun’s ellipse image varies rapidly and greatly with time. The angle ψbH between the horizontal direction of the image and the semi-minor axis of the Sun’s ellipse image ranged from 47o to −47o on one day of mid-December 2018, as shown in Fig. 19.

When researching the effect of atmospheric refraction on the Sun’s visual shape, it was shown that the shape parameter kRef of the Sun’s ellipse image changes greatly. kRef ranged from 0.8357 to 0.9986 on one day of mid-December 2018, as shown in Figs. 21, 23 and 25. However, the contraction direction of the Sun’s ellipse image caused by the atmospheric refraction remains unchanged. Because Eq. (57) proves that the propagation path of light in the atmosphere is a planar curve, the semi-minor axis of the Sun’s ellipse image is always perpendicular to the horizontal direction of the image.

Assuming that the Sun is a circle, by applying the elementary transformation, it can be shown that after the Einstein’s theory of special relativity and atmospheric refraction effects are applied to the circle, the circle will become an ellipse, and the shape parameter k of the ellipse can be calculated by

$$ {\mathrm{k}}^2=\left\{\begin{array}{c}\frac{\Theta_1\cos \left(2\upalpha \right)-{\Theta}_2}{\Theta_1\cos \left(2\upalpha \right)+{\Theta}_2}\kern4.5em \upalpha \ne \frac{\uppi}{2}\\ {}\frac{\Theta_1\sin \left(2\upalpha \right)-{\Theta}_3}{\Theta_1\sin \left(2\upalpha \right)+{\Theta}_3}\kern4.5em \upalpha \ne 0\end{array}\right) $$
(75)

where

$$ {\displaystyle \begin{array}{c}\mathrm{p}=\frac{1-{\mathrm{k}}_{\mathrm{SRT}}^2}{1+{\mathrm{k}}_{\mathrm{SRT}}^2}\kern7.75em \\ {}\mathrm{q}=\frac{{\mathrm{k}}_{\mathrm{Ref}}^2-1}{1+{\mathrm{k}}_{\mathrm{Ref}}^2}\kern8em \\ {}\begin{array}{c}{\Theta}_1=1+\mathrm{p}\cdotp \mathrm{qcos}\left(2{\uppsi}_{\mathrm{bH}}\right)\kern2em \\ {}{\Theta}_2=\mathrm{q}+\mathrm{p}\cdotp \cos \left(2{\uppsi}_{\mathrm{bH}}\right)\kern2.5em \\ {}\begin{array}{c}{\Theta}_3=\mathrm{p}\cdotp \sqrt{1-{\mathrm{q}}^2}\cdotp \sin \left(2{\uppsi}_{\mathrm{bH}}\right)\\ {}\tan \left(2\upalpha \right)=\frac{\Theta_3}{\ {\Theta}_2}\kern6.25em \end{array}\end{array}\end{array}} $$
(76)

Based on Eq. (70), the shape parameter kSRT can be figured out, which describes the effect of the Einstein’s theory of special relativity on the Sun’s visual shape; based on Eq. (74), the shape parameter kRef can be evaluated, which describes the effects of atmospheric refraction on the Sun’s visual shape; combining Eqs. (70), (73), (74) and (75), the shape parameter k can be calculated, which describes the effects of atmospheric refraction and the Einstein’s theory of special relativity on the Sun’s visual shape.

In order to show the reasons for the variation of the Sun’s visual shape, the theoretical simulation results and the experimental results were compared, as shown in Figs. 27 and 28. The horizontal axis is Beijing time from sunrise to sunset, the vertical axis is the shape parameter, and the pink circles are the experimental results in Table 3. In Fig. 27, the blue line stands for the simulation results by only considering atmospheric refraction effects. In Fig. 28, the blue line stands for the simulation results by considering the combination of atmospheric refraction effects and the Einstein’s theory of special relativity.

Fig. 27
figure 27

Comparison between simulation and experimental results on a day in mid-December at Dalian

Fig. 28
figure 28

Comparison between simulation and experimental results on a day in mid-December at Dalian

The relative error is defined as the difference between simulations and experimental results over the experimental results. Fig. 29 shows the relative errors of the simulated results, where the blue line is the errors calculated when only considering atmospheric refraction; the green dotted line is the errors calculated when considering the combination of atmospheric refraction and the Einstein’s theory of special relativity.

Fig. 29
figure 29

Relative errors of the simulations on a day in mid-December at Dalian

Fig. 29 shows that the Einstein’s special relativity theory affects the Sun’s visual shape much more at noon than at sunrise and sunset. For example, at 11:38 Beijing time, the shape parameter extracted from the Sun’s photo is kMeas = 0.9995; the shape parameter caused by atmospheric refraction is kRef = 0.9987 with a relative error of 0.8 × 10−3; the shape parameter calculated by considering the combination of atmospheric refraction and the Einstein’s theory of special relativity is k = 0.9993 with a relative error of 0.2 × 10−3. Although the relative error of kRef is about four times than that of k, the error is still very small and can be neglected. Figs. 27, 28 and 29 illustrate that the simulated results are coincident with the experimental ones in Table 3.

The comparison study showed that the theoretical analyses in the paper are corrected; the reason for the variation of the Sun’s visual shape is mainly due to atmospheric refraction effects, while the length contraction effect of the Einstein’s special relativity theory also contributes a little except at sunrise and sunset. Therefore, the Einstein’s special relativity theory can explain why the Sun’s visual shape always appears to be an ellipse instead of a perfect circle.

In order to further analyze the contributions of atmospheric refraction and the Einstein’s special relativity to the variation of the Sun’s visual shape, three variations of the shape parameter were simulated in Fig. 30, where the horizontal axis is the date in the whole year of 2018, and the vertical axis is the shape parameter. The blue line stands for kRef caused by atmospheric refraction effects, similar to the curve in Fig. 26; the pink dotted line stands for kSRT caused by the length contraction effect in the Einstein’s special relativity theory, which is the same with the curve in Fig. 18; the black line is the shape parameter calculated when considering the combination of atmospheric refraction and the Einstein’s special relativity theory. During the simulation, the observation time was set at 12:00:00 Beijing time every day, and the observation position was Dalian.

Fig. 30
figure 30

Variation of the shape parameter in 2018 at Dalian

Fig. 30 shows that in the whole year, the Sun’s visual shape at Dalian is the roundest at the end of February, and is the flattest at the winter solstice. The conclusion differs from that drawn from only considering atmospheric refraction or the Einstein’s special relativity, because both of them contribute to the variation of the Sun’s visual shape.

Conclusions

From sunrise to sunset, the Sun’s visual shape changes continuously from a flatter ellipse to almost a circle and then back to a flatter ellipse. In the paper, the experimental measurements and theoretical analyses were performed to investigate the reasons for the variation of the Sun’s visual shape. Some meaningful conclusions were drawn:

The method of image processing, the method of moments and the least-square method were combined to perform experimental measurements and calculations. The statistical error analyses showed that the relative measurements accuracy was about 0.023%, and the standard deviation of the fitting curve of ellipse was only 4 pixels. The experimental results showed that the Sun’s visual shape can be approximated by an ellipse accurately.

Atmospheric refraction effects make the Sun’s visual shape become an ellipse, and have a great influence on its shape during a day. Because the refraction index of the atmosphere was expressed as a function of altitude and wavelength of light, the trajectory of sunlight is a planar curve, when considering the atmospheric refraction effects only, the Sun’s visual shape contracts in the zenith direction, resulting in an elliptic Sun. In the Sun’s photo, the contraction direction remains unchanged, but the contraction ratio varies rapidly and greatly with time, especially at sunrise and sunset.

The length contraction effects in the Einstein’s special relativity theory also transform the Sun’s visual shape to an ellipse, and contribute a little to its shape variation on a day, especially at noon. Due to the relative movement of the Sun to the observer standing on the Earth, the Sun’s visual shape contracts in a direction, resulting in an elliptic Sun. However, unlike atmospheric refraction effects, the contraction ratio varies slowly and little with time, and it is about 0.06%, while its contraction direction varies rapidly and greatly with time.

Comprehensively considering effects of atmospheric refraction and the Einstein’s special relativity theory on the Sun’s visual shape, although their contraction directions are different, it is shown that the Sun’s visual shape is still an ellipse.

On a day, the Sun’s visual shape is the roundest at noon and the flattest at sunrise and sunset; in the whole year, the Sun’s visual shape for an observer at Dalian is the roundest at the end of February, and the flattest at the winter solstice. For observers at different geographic positions, if they see the Sun at the same moment, the Sun looks different. In theory, an observer at the equator could see the roundest Sun.

Comparing the theoretical simulations and experimental measurements, the relative errors were less than 0.3%. The results, thus, verified the theoretical analyses in the paper, including a set of formulas describing the relationship between the zenith angle of the Sun, the observation times and positions, the model of altitude and refraction index, the iterative algorithm for tracing rays of light in the atmosphere, and the calculation of feature parameters of the Sun’s visual shape.