5
$\begingroup$

I'm attempting to calculate lines of equal solar altitude, essentially a generalized case of the Earth terminator for solar altitude $ h $.

For a given sun position with declination $ \delta $ and right ascension $ \alpha $, I believe the positive north latitude $ \lambda $ and positive east longitude $ \varphi $ may be calculated using the equation

$$ \sin h = \sin \delta \cdot \sin \lambda + \cos \delta \cdot \cos \lambda \cdot \cos \omega $$

where $ \omega $ is the hour angle $ \omega = GST + \varphi - \alpha $.

WolframAlpha gives the solution as

$$ \lambda = 2 \cdot \left( { \arctan{ \left( { \sin \delta \pm \sqrt { \cos^2 \delta \cdot \cos^2 \omega + \sin^2 \delta - \sin^2 h } } \over { \cos \delta \cdot \cos \omega + \sin h } \right) } } + \pi \cdot n \right) $$

How should the correct value for $ \lambda $ be determined from the multiple solutions? Intuitively the answer is clear when viewed on a globe (excellent visualization) but how can it be expressed mathematically?

I've generated some sample plots using $ n = 0 $, where green represents $ \sin \delta + \sqrt \ldots $, red represents $ \sin \delta - \sqrt \ldots $, and the yellow dot represents the sun's location.

For $ h = -0.8333 ° $ the correct solution is the curve in green:

sunrise/sunset curves

For $ h = -18 ° $ the correct solution is the ellipse on the right with green lower half and red upper half:

astronomical twilight curves

Alternatively, is there a different/better method to use?

Worked Example

Here is an example, with additions based on the answer from d_e, to illustrate the issue (or in case I've made a math error).

$$ h = -0.8333 ° $$ $$ \delta = -14.0670 ° $$

Taking $ \varphi = 45 ° $ and $ \omega = 3.3059 rad $:

numerators:

$$ \sin \delta + \sqrt { \cos^2 \delta \cdot \cos^2 \omega + \sin^2 \delta - \sin^2 h } = 0.7442 $$

$$ \sin \delta - \sqrt { \cos^2 \delta \cdot \cos^2 \omega + \sin^2 \delta - \sin^2 h } = -1.2303 $$

denominator:

$$ \cos \delta \cdot \cos \omega + \sin h = -0.9715 $$

Using atan

Latitude values using manual division and the atan function:

$$ 2 \cdot \arctan{ \left( 0.7442 \over -0.9715 \right) } = -74.9047 ° $$ $$ 2 \cdot \arctan{ \left( -1.2303 \over -0.9715 \right) } = 103.4073 ° $$

I believe the value $103.4073 °$ should be discarded because it is outside the interval $[-90 °,90 °]$.

Using atan2

Latitude values using the atan2 function:

$$ 2 \cdot atan2{ \left( 0.7442 \over -0.9715 \right) } = 285.0953° $$ $$ 2 \cdot atan2{ \left( -1.2303 \over -0.9715 \right) } = -256.5927° $$

Mapping these values to $ [-90 °,90 °] $ gives $ -74.9047 ° $ and $ 76.5927 ° $.

Plugging those back into the original equation:

The coordinate $ (-74.9047,45.0000) $ corresponds to a solar altitude of $ -0.8333 ° $

The coordinate $ (76.5927,45.0000) $ corresponds to a solar altitude of $ -27.2789 ° $ and should be discarded.

$\endgroup$
6
  • $\begingroup$ All are correct. The ambiguity in $n$ is only one walk around the globe - thus representing the same place. Without loss of generality you can assume n=0. What other solution do you want which is "more" mathematical than the equation for $\lambda$ you quote? $\endgroup$ Commented Oct 24, 2021 at 19:43
  • 1
    $\begingroup$ I'm looking for a way to discriminate between correct mathematical solutions and the correct physical solution. In the -18° example, the ellipse on the left (with green top and red bottom) represents the line for $h = +18°$ as best I can tell, despite being a solution of the equation for $\lambda$ using -18° for $h$. $\endgroup$
    – sbooth
    Commented Oct 24, 2021 at 20:06
  • $\begingroup$ Why not simply select a random point on each ellipse and calculate what is the Sun's altitude? it will clearly give us a definite single number of the altitude angle- then we know if this ellipse is good for us. $\endgroup$
    – d_e
    Commented Oct 25, 2021 at 8:40
  • $\begingroup$ The solutions can be verified using the original equation and solving for $h$ using the calculated lat/long and checking against the desired $h$, but it seems like there should be a better way. $\endgroup$
    – sbooth
    Commented Oct 29, 2021 at 17:50
  • 1
    $\begingroup$ @d_e I added a worked example, hopefully there are no math errors. $\endgroup$
    – sbooth
    Commented Oct 30, 2021 at 21:40

1 Answer 1

3
+100
$\begingroup$

After some thought, it seems the procedure is fine, except that a diligent care is needed in the last step of Mapping to [-90, 90].

It seems a more careful way to handle this is not by plugging $n=0$ and them map the results to [-90, 90], but rather to select the $n$ value (only one can do) that would effect $\lambda$ in range [-90, 90] .

For instance, in the working example in the question, the solution (76.5927,45.0000) simply does not solve the original equation; this is because $\lambda$=−256.5927° (which indeed should solve the original equation) cannot map to any valid $\lambda$ in range of [-90, +90], because the $arctan$ is $-128.29$ hence possible mathematical solution would can also be $103.4073$ (by $n=1$) - but this is not in our required range. The second solution of $+285.0953$ can indeed be mapped into valid value if $n=-1$ hence this solution will work.

Now, there are cases of course where we have to get 2 valid solutions (one for the $+$ the other for the $-$). For example, when $\delta=0$ we must get 2 solution with opposite signs of latitude.

To conclude, if we have a valid solution between [-90, 90] after plugging some $n$, I can't see why it should not solve the original equation, and if a value solves the original equation, I cannot see why it should not work physically.

$\endgroup$
5
  • 1
    $\begingroup$ @uhoh, not sure I understand what exactly is meant by $arctan$ problem. It interesting the arctan here yielded result in about $−128.29$ or $+142$ - as most calculators simply return values between $-90$ and $90$. Had the calculator returned a regular value, I think we can safety have $n=0$ - So I don't expect any special problem with using regular $arctan$ functions $\endgroup$
    – d_e
    Commented Oct 31, 2021 at 22:51
  • $\begingroup$ Okay, then it doesn't, thanks! I'll repost only the 2nd part. $\endgroup$
    – uhoh
    Commented Oct 31, 2021 at 23:18
  • $\begingroup$ For spherical trigonometry expressions there are usually alternate forms that avoid certain computational idiosyncrasies, and these can be generated using trigonometric identities and substitutions. I wonder if something like that might be helpful here? $\endgroup$
    – uhoh
    Commented Oct 31, 2021 at 23:19
  • 1
    $\begingroup$ What you've written is helpful. I was using the atan2 function which was likely incorrect; using tan and discarding values outside the interval $[-90,90]$ seems to work. I need to perform some more calculations to be sure. $\endgroup$
    – sbooth
    Commented Nov 1, 2021 at 15:34
  • 1
    $\begingroup$ @uhoh, interesting question. I'm not an expert on that. but my hunch says what we have now is pretty neat already and working. $\endgroup$
    – d_e
    Commented Nov 1, 2021 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .