libTheSky
Routines to compute sky positions of Sun, Moon, planets and more
All Namespaces Files Functions Variables Pages
planets.f90
Go to the documentation of this file.
1!> \file planets.f90 Procedures to compute planet positions and more for libTheSky
2
3
4! Copyright (c) 2002-2025 Marc van der Sluys - Nikhef/Utrecht University - marc.vandersluys.nl
5!
6! This file is part of the libTheSky package,
7! see: https://libthesky.sf.net/
8!
9! This is free software: you can redistribute it and/or modify it under the terms of the
10! European Union Public Licence 1.2 (EUPL 1.2).
11!
12! This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13! without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14! See the EU Public Licence for more details.
15!
16! You should have received a copy of the European Union Public Licence along with this code.
17! If not, see <https://www.eupl.eu/1.2/en/>.
18
19
20!***********************************************************************************************************************************
21!> \brief Procedures for planets
22
24 implicit none
25 save
26
27
28contains
29
30
31 !*********************************************************************************************************************************
32 !> \brief Compute the position, distance, etc of a planet
33 !!
34 !! \param jd Julian date of computation
35 !! \param pl Planet number: Moon=0, Merc=1,Nep=8,Plu=9 3=Sun, 0=Moon, >10 for other objects
36 !!
37 !! \param lat Latitude of the observer (rad, optional)
38 !! \param lon Longitude of the observer (rad, optional)
39 !! \param hgt Altitude/elevation of the observer above sea level (metres, optional)
40 !!
41 !! \param LBaccur Desired accuracy of the heliocentric L,B in VSOP87 (rad, optional; defaults to full accuracy)
42 !! \param Raccur Desired accuracy of the heliocentric R in VSOP87 (AU, optional; defaults to full accuracy)
43 !!
44 !! \param ltime Correct for light time (optional; defaults to true). .false. saves ~50% in CPU time at the cost of some accuracy.
45 !! \param aber Correct for aberration (optional; defaults to true).
46 !! \param to_fk5 Convert coordinates to the FK5 system (optional; defaults to true).
47 !! \param assume_jde Assume JD provided is actually JDE (optional; defaults to false).
48 !!
49 !! \param lunar_theory Choose Lunar theory: 1: ELP82b, 2: ELP-MPP02/LLR, 3: ELP-MPP02/DE405 ('historical' - default)
50 !! \param nutat IAU nutation model to use: 0 (no nutation!), 1980 or 2000 (default).
51 !! \param magmdl Planet-magnitude model: 1: Müller (1893), 2: Meeus p.286, 3: AA 1992, 4: AA 2012 (optional, defaults to 4).
52 !! \param verbosity Verbosity for debug output (0-3). Defaults to 0: silent.
53 !!
54 !!
55 !! \note
56 !! - lat0 and lon0 can be provided through the module TheSky_local (rad, rad and m), or through the optional arguments.
57 !! Note that using the latter will update the former!
58 !! - results are returned in the array planpos() in the module TheSky_planetdata
59 !!
60
61 subroutine planet_position(jd,pl, lat,lon,hgt, LBaccur,Raccur, ltime,aber,to_fk5,assume_jde, &
62 lunar_theory,nutat,magmdl, verbosity)
63
64 use sufr_kinds, only: double
65 use sufr_constants, only: pi,pi2, r2d,r2h, au,earthr,pland, enpname, jd2000
66 use sufr_system, only: warn, quit_program_error
67 use sufr_angles, only: rev, rev2
68 use sufr_dummy, only: dumdbl1,dumdbl2
69 use sufr_text, only: d2s
70 use sufr_numerics, only: deq0
71
72 use thesky_vsop, only: vsop87d_lbr
77 use thesky_sun, only: sunmagn
79 use thesky_comets, only: cometgc
80 use thesky_planetdata, only: planpos, pl0
84
85 implicit none
86 real(double), intent(in) :: jd
87 integer, intent(in) :: pl
88 real(double), intent(in), optional :: lat,lon,hgt, LBaccur,Raccur
89 logical, intent(in), optional :: ltime,aber,to_fk5, assume_jde
90 integer, intent(in), optional :: lunar_theory, nutat,magmdl, verbosity
91
92 integer :: j, llunar_theory, lnutat,lmagmdl, lverb
93 real(double) :: jdl,jde,jde_lt, tjm,tjm0, llat,llon,lhgt, lLBaccur,lRaccur, dpsi,eps0,deps,eps,tau,tau1
94 real(double) :: hcl0,hcb0,hcr0, hcl,hcb,hcr, hcl00,hcb00,hcr00, sun_gcl,sun_gcb, gcx,gcy,gcz, gcx0,gcy0,gcz0, dhcr
95 real(double) :: gcl,gcb,delta,gcl0,gcb0,delta0
96 real(double) :: ra,dec,gmst,agst,lst,hh,az,alt,elon, topra,topdec,topl,topb,topdiam,topdelta,tophh,topaz,topalt
97 real(double) :: diam,illfr,pa,magn, parang,parang_ecl,hp, rES1,rES2
98 logical :: lltime,laber,lto_fk5
99
100 ! Make sure these are always defined:
101 gcl0 = 0.d0; gcb0 = 0.d0; hcr00 = 0.d0
102 gcx = 0.d0; gcy = 0.d0; gcz = 0.d0
103 gcx0 = 0.d0; gcy0 = 0.d0; gcz0 = 0.d0
104 topdelta = 0.d0; delta0 = 0.d0
105 diam = 0.d0
106 magn = 0.d0 ! Make sure magn is always defined
107
108 pl0 = pl ! Remember which planet was computed last
109
110
111 ! Handle optional variables:
112 ! Geographic location:
113 llat = lat0
114 llon = lon0
115 lhgt = height
116 if(present(lat)) llat = lat
117 if(present(lon)) llon = lon
118 if(present(hgt)) lhgt = hgt
119
120 ! Coordinate accuracy:
121 llbaccur = 0.d0 ! Seting L,B,R accuracy equal to VSOP87 truncation still skips some terms!
122 lraccur = 0.d0
123 if(present(lbaccur)) llbaccur = lbaccur
124 if(present(raccur)) lraccur = raccur
125
126 ! Light time, aberration and FK5 switches:
127 lltime = .true. ! Correct for light time by default
128 if(present(ltime)) lltime = ltime
129
130 laber = .true. ! Correct for aberration by default
131 if(present(aber)) laber = aber
132
133 lto_fk5 = .true. ! Convert to FK5 by default
134 if(present(to_fk5)) lto_fk5 = to_fk5
135
136 ! Select lunar theory:
137 ! llunar_theory = 1 ! Use (corrected) ELP82b as default
138 llunar_theory = 3 ! Use ELP-MPP02/DE405 ('historical') as default. This should be the "default default" :-)
139 if(present(lunar_theory)) llunar_theory = lunar_theory
140 if(llunar_theory.lt.1 .or. llunar_theory.gt.3) &
141 call quit_program_error('planet_position(): lunar_theory must be 1, 2 or 3', 1)
142
143 ! Nutation model:
144 lnutat = 2000 ! 2000 IAU nutation model
145 if(present(nutat)) then
146 lnutat = nutat
147 if(lnutat.ne.1980 .and. lnutat.ne.2000 .and. lnutat.ne.0) &
148 call quit_program_error('planet_position(): nutat must be 2000, 1980 or 0', 1)
149 end if
150
151 ! Planet-magnitude model:
152 lmagmdl = 4 ! AA 2012
153 if(present(magmdl)) then
154 lmagmdl = magmdl
155 if(lmagmdl.lt.1 .or. lmagmdl.gt.4) &
156 call quit_program_error('planet_position(): magmdl must be 1-4', 1)
157 end if
158
159 ! Verbosity:
160 lverb = 0 ! Silent
161 if(present(verbosity)) lverb = verbosity
162
163
164 ! Calc JDE and tjm:
165 jdl = jd ! Local version of JD
166 deltat = calc_deltat(jdl)
167 ! deltat = 0.d0
168 ! write(*,'(/,A,/)') '*** WARNING: libTheSky/planets.f90: setting DeltaT to 0 ***'
169
170 if(present(assume_jde) .and. assume_jde) then
171 jde = jdl ! JD provided is actually JDE
172 jdl = jde - deltat/86400.d0
173 else
174 jde = jdl + deltat/86400.d0
175 end if
176
177 tjm = (jde-jd2000)/365250.d0 ! Julian Millennia after 2000.0 in dyn. time, tau in Meeus
178 tjm0 = tjm
179 if(lverb.gt.0) then
180 print*,'JD: ', d2s(jdl,8) ! ms accuracy
181 print*,'DeltaT: ', d2s(deltat,3) ! ms accuracy
182 print*,'JDE: ', d2s(jde,8) ! ms accuracy
183 print*,'t_jm: ', d2s(tjm,10) ! ~s accuracy
184 end if
185
186 call vsop87d_lbr(tjm,3, hcl0,hcb0,hcr0, llbaccur,lraccur) ! Calculate the Earth's true heliocentric l,b,r
187
188 if(lverb.gt.3) then
189 print*
190 ! print*, 'Heliocentric longitude Earth, FK4: ', d2s(modulo(hcl0,pi2)*r2d, 9), ' deg'
191 ! print*, 'Heliocentric latitude Earth, FK4: ', d2s(hcb0*r2d, 9), ' deg'
192 ! print*, 'Heliocentric distance Earth: ', d2s(hcr0, 9), ' au'
193 print*
194 print*, 'Earth:'
195 print*, 't_jm: ', d2s(tjm, 10)
196 print*, 'Heliocentric longitude Earth: ', d2s(modulo(hcl0,pi2)*r2d, 9), ' deg'
197 print*, 'Heliocentric latitude Earth: ', d2s(hcb0*r2d, 9), ' deg'
198 print*, 'Heliocentric distance Earth: ', d2s(hcr0, 9), ' au'
199 end if
200
201
202 ! Iterate to get the light time tau, hence apparent positions:
203 tau = 0.d0; tau1 = 0.d0 ! Initial values for light time in days
204 j = 0 ! Count iterations; allows escape in case of infinite loop
205 do while(deq0(tau1) .or. abs((tau1-tau)/tau1).gt.1.d-10) ! Moon's tau ~10^-5; 1.d-10~10^-5 sec (1.d-7~10^-2 sec)
206
207 tau = tau1 ! On first iteration, tau=0 to get true positions
208 tjm = tjm0 - tau/365250.d0 ! Iterate to calculate light time
209 jde_lt = jd2000 + tjm*365250 ! JDE, corrected for light time
210 hcl = 0.d0; hcb = 0.d0; hcr = 0.d0 ! Heliocentric coordinates
211
212
213 ! Compute l,b,r for planet, Pluto, asteroid, Earth's shadow:
214 if(pl.gt.0.and.pl.lt.9) call vsop87d_lbr(tjm,pl, hcl,hcb,hcr, llbaccur,lraccur) ! Heliocentric l,b,r
215 if(pl.eq.9) call plutolbr(tjm*10.d0, hcl,hcb,hcr) ! This is for 2000.0, precess 10 lines below
216 if(pl.gt.10000) call asteroid_lbr(tjm,pl-10000, hcl,hcb,hcr) ! Heliocentric lbr for asteroids
217 if(pl.eq.-1) then ! Centre of Earth's shadow
218 call vsop87d_lbr(tjm,3, hcl,hcb,hcr, llbaccur,lraccur) ! = heliocentric coordinates of the Earth...
219
220 select case(llunar_theory)
221 case(1)
222 call elp82b_lbr(tjm, dumdbl1,dumdbl2,dhcr) ! only want dhcr
223 case(2)
224 call elp_mpp02_lbr(jde_lt, 0, dumdbl1,dumdbl2,dhcr) ! only want dhcr - 0: LLR mode
225 case(3)
226 call elp_mpp02_lbr(jde_lt, 1, dumdbl1,dumdbl2,dhcr) ! only want dhcr - 1: DE405 ('historical') mode
227 end select
228
229 hcr = hcr + dhcr ! + distance Earth-Moon
230 end if
231
232
233 ! Compute geocentric ecliptical position for the Moon:
234 if(pl.eq.0) then ! Moon
235 select case(llunar_theory)
236 case(1)
237 call elp82b_lbr(tjm, gcl,gcb,delta) ! Get apparent geocentric coordinates of the Moona
238 case(2)
239 call elp_mpp02_lbr(jde_lt, 0, gcl,gcb,delta) ! Get apparent geocentric coordinates of the Moon. Mode=0: LLR mode
240 case(3)
241 call elp_mpp02_lbr(jde_lt, 1, gcl,gcb,delta) ! Get apparent geocentric coordinates of the Moon. Mode=1: DE405 ('historical') mode
242 end select
243 end if
244
245 if(pl.ne.0.and.pl.lt.10 .or. pl.gt.10000) then ! Planet, asteroid, Earth's shadow
246 ! For Neptune's birthday:
247 ! print*,'TESTING!!!'
248 ! call precess_ecl(jde,jd2000,hcl,hcb) ! from JoD to J2000.0
249
250 call hc_spher_2_gc_rect(hcl,hcb,hcr, hcl0,hcb0,hcr0, gcx,gcy,gcz) ! Convert heliocentric l,b,r to geocentric x,y,z
251 call rect_2_spher(gcx,gcy,gcz, gcl,gcb,delta) ! Convert geocentric x,y,z to geocentric l,b,r
252 if(pl.eq.3) delta = hcr
253 if(pl.eq.9) call precess_ecl(jd2000,jde, gcl,gcb) ! Pluto: from J2000.0 to JoD
254 end if
255
256 if(pl.gt.10.and.pl.lt.10000) &
257 call cometgc(tjm,tjm0, pl, hcr,gcl,gcb,delta) ! Calc geocentric l,b,r coordinates for a comet
258
259
260 ! Store 'true' position, for tau=0:
261 if(j.eq.0) then
262 if(abs(tau).gt.1.d-10) call warn('planet_position(): tau != 0 on first light-time iteration', 0)
263
264 hcl00 = hcl ! Heliocentric l,b,r
265 hcb00 = hcb
266 hcr00 = hcr
267
268 gcx0 = gcx ! Geocentric x,y,z
269 gcy0 = gcy
270 gcz0 = gcz
271
272 delta0 = delta ! Geocentric l,b,r
273 gcl0 = gcl
274 gcb0 = gcb
275 end if
276
277 tau1 = 5.77551830441d-3 * delta ! Light time in days
278
279 if(lverb.gt.3) then
280 print*
281 print*
282 print*, 'Iteration: ', j
283 ! print*,'t_jm: ', d2s(tjm, 10)
284 ! print*
285 ! print*, 'Heliocentric longitude planet, FK4: ', d2s(modulo(hcl00,pi2)*r2d, 9), ' deg'
286 ! print*, 'Heliocentric latitude planet, FK4: ', d2s(hcb00*r2d, 9), ' deg'
287 ! print*, 'Heliocentric distance planet: ', d2s(hcr00, 9), ' au'
288 print*
289 print*, 'Planet:'
290 print*, 't_jm: ', d2s(tjm, 10)
291 print*, 'Heliocentric longitude: ', d2s(modulo(hcl,pi2)*r2d, 9), ' deg'
292 print*, 'Heliocentric latitude: ', d2s(hcb*r2d, 9), ' deg'
293 print*, 'Heliocentric distance: ', d2s(hcr, 9), ' au'
294 print*
295 print*, 'Geocentric x: ', d2s(gcx, 9), ' au'
296 print*, 'Geocentric y: ', d2s(gcy, 9), ' au'
297 print*, 'Geocentric z: ', d2s(gcz, 9), ' au'
298 print*
299 print*, 'Geocentric longitude: ', d2s(modulo(gcl,pi2)*r2d, 9), ' deg'
300 print*, 'Geocentric latitude: ', d2s(gcb*r2d, 9), ' deg'
301 print*, 'True geocentric distance: ', d2s(delta0, 9), ' au'
302 print*, 'Apparent geocentric distance: ', d2s(delta, 9), ' au'
303 print*
304 print*, 'JDE_i: ', d2s(jde_lt, 9)
305 print*, 't_jm: ', d2s(tjm, 10)
306 print*, 'Light time: ', d2s(tau,9), ' day'
307 print*, 'Light time1: ', d2s(tau1,9), ' day'
308 print*
309 end if
310
311 if(.not.lltime) exit ! Do not take into account light time
312 if(pl.eq.3) exit ! Want true position for Sun(!)
313
314 j = j+1
315 if(j.ge.30) then
316 call warn('planet_position(): Light time failed to converge for '//trim(enpname(pl)), 0)
317 exit
318 end if
319 end do
320
321 tau = tau1
322 tjm = tjm0 ! Still Julian Millennia since 2000.0 in dynamical time
323 delta = delta0 ! Want the TRUE distance, not APPARENT!
324
325 if(lverb.gt.3) then
326 print*
327 print*, 'Number of iterations: ', j
328 print*, 'Final light time: ', d2s(tau, 9)
329 print*, 'Final t_Jm: ', d2s(tjm, 10)
330 print*
331 end if
332
333 if(pl.eq.-1) then ! Earth's shadow
334 select case(llunar_theory)
335 case(1)
336 call elp82b_lbr(tjm, dumdbl1,dumdbl2,delta) ! Geocentric distance of the Moon for Earth shadow; only need delta
337 case(2)
338 call elp_mpp02_lbr(jde_lt, 0, dumdbl1,dumdbl2,delta) ! Geocentric distance of the Moon for Earth shadow; only need delta - LLR mode
339 case(3)
340 call elp_mpp02_lbr(jde_lt, 1, dumdbl1,dumdbl2,delta) ! Geocentric distance of the Moon for Earth shadow; only need delta - DE405 ('historical') mode
341 end select
342 end if
343
344 ! Earth -> Sun. Note that we want the TRUE position!
345
346 ! (As for other planets, we'd use the true position for the Earth (when the light arrives) and the
347 ! APPARENT position of the Sun (when the light left). However, since the positions are heliocentric, the
348 ! latter is always (0,0,0).
349 if(pl.eq.3) then
350 gcl = rev(hcl0+pi)
351 gcb = -hcb0
352 delta = hcr0
353 end if
354
355
356 if(lverb.gt.2) then
357 print*
358 print*
359 ! print*,'t_jm: ', d2s(tjm, 10)
360 ! print*
361 ! print*, 'Heliocentric longitude planet, FK4: ', d2s(modulo(hcl00,pi2)*r2d, 9), ' deg'
362 ! print*, 'Heliocentric latitude planet, FK4: ', d2s(hcb00*r2d, 9), ' deg'
363 ! print*, 'Heliocentric distance planet: ', d2s(hcr00, 9), ' au'
364 print*
365 print*, 'Planet after light-time iterations, before correction for nutation, aberration, FK5:'
366 print*, 'Final t_jm: ', d2s(tjm, 10)
367 print*, 'Final heliocentric longitude: ', d2s(modulo(hcl,pi2)*r2d, 9), ' deg'
368 print*, 'Final heliocentric latitude: ', d2s(hcb*r2d, 9), ' deg'
369 print*, 'Final heliocentric distance: ', d2s(hcr, 9), ' au'
370 print*
371 print*, 'Final geocentric x: ', d2s(gcx, 9), ' au'
372 print*, 'Final geocentric y: ', d2s(gcy, 9), ' au'
373 print*, 'Final geocentric z: ', d2s(gcz, 9), ' au'
374 print*
375 print*, 'Final geocentric longitude: ', d2s(modulo(gcl,pi2)*r2d, 9), ' deg'
376 print*, 'Final geocentric latitude: ', d2s(gcb*r2d, 9), ' deg'
377 print*, 'Final (true) geocentric distance: ', d2s(delta, 9), ' au'
378 print*
379 print*, 'Final jde_i: ', d2s(jde_lt, 9)
380 print*, 'Final t_jm: ', d2s(tjm, 10)
381 print*, 'Final light time: ', d2s(tau,9), ' day'
382 print*, 'Final light time1: ', d2s(tau1,9), ' day'
383 print*
384 end if
385
386 ! Compute and correct for nutation:
387 if(lnutat.eq.1980) then
388 call nutation(tjm, dpsi,eps0,deps) ! IAU 1980 nutation model: dpsi: nutation in longitude, deps: in obliquity
389 else ! if(lnutat.eq.2000) then
390 call nutation2000(jdl, dpsi,deps, eps0) ! IAU 2000 nutation model (originally doesn't provide eps0)
391
392 if(lnutat.eq.0) then ! No nutation(!)
393 dpsi = 0.d0
394 deps = 0.d0
395 end if
396 end if
397 eps = eps0 + deps ! Correct for nutation in obliquity: mean -> true obliquity of the ecliptic
398
399
400 ! Correct for aberration and nutation, and convert to FK5:
401 if(pl.lt.10) then ! I suppose this should also happen for comets, but this compares better...
402 if(laber .and. (pl.ne.0)) call aberration_ecl(tjm,hcl0, gcl,gcb) ! Aberration - not for the Moon
403 if(lto_fk5) call fk5(tjm, gcl,gcb)
404 gcl = gcl + dpsi ! Nutation in longitude
405 end if
406
407 ! sun_gcl,sun_gcb give gcl,gcb as if pl.eq.3
408 sun_gcl = rev(hcl0+pi)
409 sun_gcb = -hcb0
410
411 ! Aberration, FK5 and nutation for sun_gcl,sun_gcb:
412 if(laber) call aberration_ecl(tjm,hcl0, sun_gcl,sun_gcb)
413 if(lto_fk5) call fk5(tjm, sun_gcl,sun_gcb)
414 sun_gcl = sun_gcl + dpsi ! Nutation in longitude
415
416 ! FK5 conversion for l,b, hcl0,hcb0, hcl00,hcb00:
417 if(lto_fk5) then
418 call fk5(tjm, hcl,hcb)
419 call fk5(tjm, hcl0,hcb0)
420 call fk5(tjm, hcl00,hcb00)
421 end if
422
423 if(lverb.gt.3) then
424 print*
425 print*, 'Convert to the FK5 system: ', lto_fk5
426 print*, 'True heliocentric longitude, FK5: ', d2s(modulo(hcl00,pi2)*r2d, 9), ' deg'
427 print*, 'True heliocentric latitude, FK5: ', d2s(hcb00*r2d, 9), ' deg'
428 print*, 'True heliocentric distance: ', d2s(hcr00, 9), ' au'
429 print*
430 end if
431
432
433 ! Convert geocentric ecliptical to equatorial coordinates:
434 call ecl_2_eq(gcl,gcb,eps, ra,dec) ! RA, Dec
435
436
437 ! Sidereal time:
438 gmst = calc_gmst(jdl) ! Greenwich mean sidereal time
439 agst = rev(gmst + dpsi*cos(eps)) ! Correction for equation of the equinoxes -> Greenwich apparent sidereal time
440 lst = rev(agst + llon) ! Local apparent sidereal time, llon > 0 for E
441
442
443 ! Apparent diameter:
444 if(pl.ge.0.and.pl.lt.10) diam = atan(pland(pl)/(delta*au))
445 !if(pl.lt.10.and.pl.ge.0) diam = atan(planr(pl)/(2*delta*au))*2
446 if(pl.eq.-1) then
447 call earthshadow(delta,hcr0, res1,res2) ! Calc Earth shadow radii at Moon distance: (pen)umbra radius - geocentric
448 diam = 2*res1 ! Umbra diameter to planpos(12)
449 end if
450
451 ! Convert heliocentric to topocentric coordinates:
452 call geoc2topoc_ecl(gcl,gcb, delta,diam/2.d0, eps,lst, topl,topb,topdiam, lat=llat,hgt=lhgt) ! Geocentric to topoc: l, b, diam
453 if(pl.eq.-1) topdiam = res2 ! Earth penumbra radius at Moon distance
454 topdiam = 2*topdiam ! Was radius, now diameter
455 if(pl.ge.0.and.pl.lt.10) topdelta = pland(pl)/tan(topdiam)/au
456
457
458 ! Convert equatorial to horizontal coordinates:
459 call eq2horiz(ra,dec,agst, hh,az,alt, lat=llat,lon=llon)
460
461
462 ! Elongation:
463 elon = acos(cos(gcb)*cos(hcb0)*cos(gcl-rev(hcl0+pi)))
464 if(pl.gt.10) elon = acos((hcr0**2 + delta**2 - hcr**2)/(2*hcr0*delta)) ! For comets (only?) - CHECK: looks like phase angle...
465
466 ! Convert topocentric coordinates: ecliptical -> equatorial -> horizontal:
467 ! call geoc2topoc_eq(ra,dec,delta,hh,topra,topdec) ! Geocentric to topocentric
468 call ecl_2_eq(topl,topb,eps, topra,topdec) ! Topocentric l,b -> RA,dec - identical result (AA 1999-01-02/22); probably cheaper
469 call eq2horiz(topra,topdec,agst, tophh,topaz,topalt, lat=llat,lon=llon)
470
471 ! Phase angle:
472 pa = 0.d0 ! Make sure pa is always defined
473 if(pl.eq.0) then
474 pa = atan2( hcr0*sin(elon) , delta - hcr0*cos(elon) ) ! Moon
475 else if(pl.gt.0) then
476 pa = acos( (hcr**2 + delta**2 - hcr0**2) / (2*hcr*delta) ) ! Planets
477 end if
478 illfr = 0.5d0*(1.d0 + cos(pa)) ! Illuminated fraction of the disc
479
480
481 ! Compute magnitude:
482 if(pl.gt.0.and.pl.lt.10) then
483 magn = planet_magnitude(pl,hcr,delta,pa, lmagmdl)
484 if(pl.eq.6) magn = magn + dsatmagn(tjm*10., gcl,gcb) ! Correct Saturn's magnitude for rings
485 end if
486
487 if(pl.eq.0) magn = moonmagn(pa,delta) ! Moon
488 if(pl.gt.10000) magn = asteroid_magn(pl-10000,delta,hcr,pa) ! Asteroid magnitude (valid for |pa|<120°)
489
490 ! Comet magnitude:
491 if(pl.gt.10 .and. pl.lt.10000) then
492 diam = 0.d0
493 if(cometdiedatp(pl) .and. jdl.gt.cometelems(pl,7)) then ! Comet died at perihelion and is now dead
494 magn = 99.9d0
495 else
496 magn = cometelems(pl,8) + 5*log10(delta) + 2.5d0*cometelems(pl,9)*log10(hcr) ! m = H + 5log(d) + 2.5*G*log(r)
497 magn = magn + comet_scatter_magnitude_correction(pa)
498 end if
499 topdelta = delta
500 end if
501
502
503 ! Parallactic angle:
504 !parang = atan2(sin(hh),tan(llat)*cos(dec) - sin(dec)*cos(hh)) ! Parallactic angle (between zenith and celestial north pole): geocentric - Meeus Eq.14.1
505 parang = atan2(sin(tophh),tan(llat)*cos(topdec) - sin(topdec)*cos(tophh)) ! Parallactic angle (between zenith and celestial north pole): topocentric
506 parang_ecl = atan( (cos(topl)*tan(eps)) / (sin(topl)*sin(topb)*tan(eps) - cos(topb)) ) ! "Parallactic angle" (between ECLIPTICAL and celestial north pole): topocentric - Meeus p.100
507
508 ! Horizontal parallax:
509 hp = asin(earthr/(delta*au)) ! Horizontal parallax
510
511
512 ! Overrule some values:
513 if(pl.eq.0) hcr = 0.d0 ! No heliocentric distance for the Moon
514 if(pl.eq.3) then ! Sun:
515 elon = 0.d0 ! Elongation
516 pa = 0.d0 ! Phase angle
517 magn = sunmagn(delta) ! Magnitude; changes ~0.05 over half a year...
518 illfr = 1.d0 ! Illuminated fraction
519 end if
520
521
522
523
524 ! Save variables:
525 ! Geocentric:
526 planpos = 0.d0 ! 1-12 are geocentric, repeated as topocentric in 21-32
527
528 planpos(1) = rev(gcl) ! Ecliptical longitude
529 planpos(2) = rev2(gcb) ! Ecliptical latitude
530 planpos(3) = hcr ! Distance to the Sun (heliocentric!)
531
532 planpos(4) = delta ! True(!) geocentric distance
533 planpos(5) = rev(ra) ! R.A.
534 planpos(6) = dec ! Declination
535
536 planpos(7) = tau ! Light time in days
537
538 planpos(8) = rev(hh) ! Hour angle
539 planpos(9) = rev(az) ! Azimuth
540 planpos(10) = alt ! Altitude
541
542 planpos(11) = rev(elon) ! Elongation
543 planpos(12) = diam ! Apparent diameter
544
545 if(lverb.gt.1) then
546 print*
547 print*, 'Final apparent geocentric longitude: ', d2s(rev(gcl)*r2d, 9), ' deg'
548 print*, 'Final apparent geocentric latitude: ', d2s(rev2(gcb)*r2d, 9), ' deg'
549 print*, 'Final apparent geocentric distance: ', d2s(delta, 9), ' au'
550 print*, 'Final apparent heliocentric distance: ', d2s(hcr, 9), ' au'
551 print*
552 print*, 'Final apparent geocentric right ascension: ', d2s(rev(ra)*r2h, 9), ' hr'
553 print*, 'Final apparent geocentric declination: ', d2s(dec*r2d, 9), ' deg'
554 print*
555 end if
556
557
558 planpos(13) = magn ! Apparent visual magnitude
559 planpos(14) = illfr ! Illuminated fraction
560 planpos(15) = rev(pa) ! Phase angle
561
562 planpos(16) = parang ! Topocentric parallactic angle (between celestial pole and zenith)
563 planpos(17) = hp ! Horizontal parallax
564 planpos(18) = parang_ecl ! Topocentric ecliptical "parallactic angle" (between celestial and ecliptical pole)
565
566 ! Topocentric:
567 planpos(21) = rev(topl)
568 planpos(22) = rev2(topb)
569 planpos(23) = delta0 ! True geocentric distance (== delta?)
570
571 planpos(24) = topdelta
572 planpos(25) = rev(topra)
573 planpos(26) = topdec
574
575 planpos(28) = rev(tophh) ! Hour angle
576 planpos(29) = rev(topaz)
577 planpos(30) = topalt
578 planpos(31) = topalt + refract(topalt) ! Topocentric altitude, corrected for (cheap) atmospheric refraction
579
580 planpos(32) = topdiam
581
582 ! Heliocentric:
583 planpos(33) = rev(hcl) ! Heliocentric apparent l,b,r
584 planpos(34) = rev2(hcb)
585 planpos(35) = hcr
586
587 planpos(36) = rev(hcl00) ! Heliocentric true l,b,r, converted to FK5
588 planpos(37) = rev2(hcb00)
589 planpos(38) = hcr00
590
591 ! Other variables:
592 planpos(39) = dble(pl) ! Remember for which planet data were computed
593 planpos(40) = jde ! JDE for these data
594
595 planpos(41) = rev(hcl0+pi+dpsi) ! Geocentric, true L,B,R for the Sun, in FK5, corrected for nutation
596 planpos(42) = rev2(-hcb0)
597 planpos(43) = hcr0
598
599 planpos(44) = lst ! Local APPARENT sidereal time
600 planpos(45) = rev(agst) ! Greenwich APPARENT sidereal time (in radians)
601 planpos(46) = tjm0 * 10 ! Apparent dynamical time in Julian Centuries since 2000.0
602
603 planpos(47) = dpsi ! Nutation in longitude
604 planpos(48) = eps ! True obliquity of the ecliptic; corrected for nutation
605 planpos(49) = rev(gmst) ! Greenwich MEAN sidereal time (in radians)
606 planpos(50) = eps0 ! Mean obliquity of the ecliptic; without nutation
607
608 ! Geocentric:
609 planpos(51) = rev(sun_gcl) ! Apparent geocentric longitude of the Sun (variable was treated as if pl.eq.3)
610 planpos(52) = rev2(sun_gcb) ! Apparent geocentric latitude of the Sun (variable was treated as if pl.eq.3)
611
612 planpos(58) = jdl ! JD used for calculation
613 planpos(59) = deltat ! DeltaT used for calculation
614
615 planpos(61) = gcx ! Apparent geocentric x,y,z
616 planpos(62) = gcy
617 planpos(63) = gcz
618
619 planpos(64) = gcx0 ! True geocentric x,y,z
620 planpos(65) = gcy0
621 planpos(66) = gcz0
622
623 planpos(67) = gcl0 ! True geocentric l,b,r
624 planpos(68) = gcb0
625 planpos(69) = delta0 ! (==delta?)
626
627 end subroutine planet_position
628 !*********************************************************************************************************************************
629
630
631
632
633
634
635 !*********************************************************************************************************************************
636 !> \brief Calculate Pluto's position l,b,r at time t
637 !!
638 !! \param t Dynamical time in Julian Centuries after 2000.0
639 !! \param l Heliocentric longitude (rad) (output)
640 !! \param b Heliocentric latitude (rad) (output)
641 !! \param r Heliocentric distance (AU?) (output)
642
643 subroutine plutolbr(t,l,b,r)
644 use sufr_kinds, only: double
645 use sufr_constants, only: d2r
647
648 implicit none
649 real(double), intent(in) :: t
650 real(double), intent(out) :: l,b,r
651 integer :: i
652 real(double) :: j,s,p,a, cosa,sina
653
654 j = 34.35d0 + 3034.9057d0 * t
655 s = 50.08d0 + 1222.1138 * t
656 p = 238.96d0 + 144.96d0 * t
657
658 l = 0.d0
659 b = 0.d0
660 r = 0.d0
661
662 do i=1,43
663 a = (pluc(i,1)*j + pluc(i,2)*s + pluc(i,3)*p) * d2r
664 cosa = cos(a)
665 sina = sin(a)
666 l = l + plul(i,1)*sina + plul(i,2)*cosa
667 b = b + plub(i,1)*sina + plub(i,2)*cosa
668 r = r + plur(i,1)*sina + plur(i,2)*cosa
669 end do
670
671 l = ( l*1.d-6 + 238.958116d0 + 144.96d0*t ) * d2r
672 b = ( b*1.d-6 - 3.908239d0 ) * d2r
673 r = r*1.d-7 + 40.7241346d0
674
675 end subroutine plutolbr
676 !*********************************************************************************************************************************
677
678
679
680
681 !*********************************************************************************************************************************
682 !> \brief Calculate orbital elements for the planets
683 !!
684 !! \param jd Julian day of calculation
685 !!
686 !! \note
687 !! Results are returned through the module planetdata, for planet pl and element el:
688 !! - plelems(pl,el): EoD
689 !! - plelems2000(pl,el): J2000.0
690 !!
691 !! \note
692 !! Elements (el):
693 !! - 1: L - mean longitude
694 !! - 2: a - semi-major axis
695 !! - 3: e - eccentricity
696 !! - 4: i - inclination
697 !! - 5: Omega - longitude of ascending node
698 !! - 6: pi - longitude of perihelion
699
700 subroutine planetelements(jd)
701 use sufr_kinds, only: double
702 use sufr_constants, only: d2r, jd2000
703 use sufr_system, only: quit_program_error
704 use sufr_angles, only: rev
705 use sufr_numerics, only: deq0
706
707 use thesky_local, only: deltat
710
711 implicit none
712 real(double), intent(in) :: jd
713 integer :: el,pl,te
714 real(double) :: jde,tm,tms(0:3)
715
716 if(deq0(plelemdata(1,1,1,1))) call quit_program_error('planetelements(): did you forget to call readplanetelements()?', 0)
717
718 deltat = calc_deltat(jd)
719 jde = jd + deltat/86400.d0
720 tm = (jde-jd2000)/36525.d0 ! Julian Centuries after 2000.0 in dynamical time
721
722
723 ! Powers of tm:
724 do te=0,3
725 tms(te) = tm**te
726 end do
727
728
729 do pl=1,8
730 do el=1,6
731
732 plelems(pl,el) = 0.d0
733 plelems2000(pl,el) = 0.d0
734
735 do te=0,3
736 plelems(pl,el) = plelems(pl,el) + plelemdata(1,pl,el,te) * tms(te)
737 plelems2000(pl,el) = plelems2000(pl,el) + plelemdata(2,pl,el,te) * tms(te)
738 end do
739
740 if(el.ne.2.and.el.ne.3) then
741 plelems(pl,el) = rev(plelems(pl,el) * d2r)
742 plelems2000(pl,el) = rev(plelems2000(pl,el) * d2r)
743 end if
744
745 end do
746 end do
747
748 end subroutine planetelements
749 !*********************************************************************************************************************************
750
751
752
753
754 !*********************************************************************************************************************************
755 !> \brief Calculate planet magnitude
756 !!
757 !! \param pl Planet ID
758 !! \param hc_dist Distance from the Sun (AU)
759 !! \param gc_dist Distance from the Earth (AU)
760 !! \param phang Phase angle (rad)
761 !! \param model Model to use: 1: Müller (1893), 2: Meeus p.286, 3: AA 1992, 4: AA 2012 (optional, defaults to 4).
762 !!
763 !! \retval planet_magnitude Apparent visual planet magnitiude
764 !!
765 !! \see
766 !! - Müller, POPot 8, 193 (1893) - https://ui.adsabs.harvard.edu/abs/1893POPot...8..193M/ - p.341/149 - Model 1.
767 !! - Meeus, Astronomical Algorithms, 1998, Ch.41 - Model 2 (origin unsure).
768 !! - Expl.Supl.tt.Astr.Almanac, 2nd Ed. (1992) - Model 3.
769 !! - Expl.Supl.tt.Astr.Almanac, 3rd Ed. (2012) - Model 4 (default).
770
771 function planet_magnitude(pl, hc_dist,gc_dist, phang, model)
772 use sufr_kinds, only: double
773 use sufr_constants, only: r2d
774 use sufr_system, only: quit_program_error
775
776 implicit none
777 integer, intent(in) :: pl
778 integer, intent(in), optional :: model
779 integer :: lpl, lmodel
780 real(double), intent(in) :: hc_dist,gc_dist,phang
781 real(double) :: planet_magnitude,pa,pa2,pa3,a0(9),a1(9),a2(9),a3(9)
782
783 ! Optional argument:
784 lmodel = 4 ! Model 4: Expl.Supl.tt.Astr.Almanac, 3rd Ed. (2012)
785 if(present(model)) lmodel = model
786
787 ! PA must be in degrees:
788 pa = phang*r2d
789 if(lmodel.eq.1 .and. pl.eq.1) pa = pa - 50.d0 ! For Mercury (deg) -- ONLY FOR MODEL 1 !!!
790 pa2 = pa*pa
791 pa3 = pa*pa2
792
793 lpl = pl ! Local pl
794
795 if(lmodel.eq.1) then ! Model 1: Müller (1893)
796 ! Mer Ven Ear Mars Jup Sat Ur Nep Pl
797 a0 = [-1.16d0, 4.d0, 0.d0, 1.3d0, 8.93d0, 8.68d0, 6.85d0, 7.05d0, 1.d0] * (-1)
798 a1 = [ 2.838d0, 1.322d0, 0.d0, 1.486d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-2
799 a2 = [ 1.023d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-4
800 a3 = [ 0.d0, 0.4247d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-6
801
802 else if(lmodel.eq.2) then ! Model 2: Meeus p.286
803 ! Mer Ven Ear Mars Jup Sat Ur Nep Pl
804 a0 = [ 0.42d0, 4.40d0, 0.d0, 1.52d0, 9.40d0, 8.88d0, 7.19d0, 6.87d0, 1.00d0] * (-1)
805 a1 = [ 3.80d0, 0.09d0, 0.d0, 1.6d0, 0.5d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-2
806 a2 = [-2.73d0, 2.39d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-4
807 a3 = [ 2.d0, -0.65d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-6
808
809 else if(lmodel.eq.3) then ! Model 3: Expl.Supl.tt.Astr.Almanac, 2nd Ed. (1992)
810 ! Mer Ven Ear Mars Jup Sat Ur Nep Pl
811 a0 = [ 0.36d0, 4.29d0, 0.d0, 1.52d0, 9.25d0, 8.88d0, 7.19d0, 6.87d0, 1.00d0] * (-1)
812 a1 = [ 3.80d0, 0.09d0, 0.d0, 1.6d0, 0.5d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-2
813 a2 = [-2.73d0, 2.39d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-4
814 a3 = [ 2.d0, -0.65d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-6
815
816 else if(lmodel.eq.4) then ! Model 4: Expl.Supl.tt.Astr.Almanac, 3rd Ed. (2012)
817 ! Mer Ven Ven2 Mars Jup Sat Ur Nep Pl
818 a0 = [ 0.60d0, 4.47d0, -0.98d0, 1.52d0, 9.40d0, 8.88d0, 7.19d0, 6.87d0, 1.01d0] * (-1)
819 a1 = [ 4.98d0, 1.03d0, -1.02d0, 1.6d0, 0.5d0, 4.4d0, 0.2d0, 0.d0, 0.d0] * 1.d-2
820 a2 = [-4.88d0, 0.57d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-4
821 a3 = [ 3.02d0, 0.13d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0] * 1.d-6
822
823 if(pl.eq.2 .and. pa.gt.163.6d0) lpl = 3 ! Venus 2
824 else
825 call quit_program_error('planet_magnitude(): model must be 1-4', 0)
826 end if
827
828 planet_magnitude = 5*log10(hc_dist*gc_dist) + a0(lpl) + a1(lpl)*pa + a2(lpl)*pa2 + a3(lpl)*pa3
829
830 end function planet_magnitude
831 !*********************************************************************************************************************************
832
833
834
835
836 !*********************************************************************************************************************************
837 !> \brief Calculate Saturn's magnitude
838 !!
839 !! \param t Dynamical time in Julian centuries after J2000.0
840 !!
841 !! \param gl Geocentric longitude (rad)
842 !! \param gb Geocentric latitude (rad)
843 !! \param d Geocentric distance (AU)
844 !!
845 !! \param l Heliocentric longitude (rad)
846 !! \param b Heliocentric latitude (rad)
847 !! \param r Heliocentric distance (AU)
848 !!
849 !! \param magmdl Model to use: 1: Müller (1893), 2: Meeus p.286; optional, default: 2.
850 !!
851 !! \retval satmagn The magnitude of Saturn
852 !!
853 !! \see
854 !! - Müller, POPot 8, 193 (1893) - https://ui.adsabs.harvard.edu/abs/1893POPot...8..193M/ - p.341/149
855 !! - Meeus, Astronomical Algorithms, 1998, Ch.41
856
857 function satmagn(t, gl,gb,d, l,b,r, magmdl)
858 use sufr_kinds, only: double
859 use sufr_constants, only: d2r,r2d
860 use sufr_angles, only: rev2
861
862 implicit none
863 real(double), intent(in) :: t, gl,gb,d, l,b,r
864 integer, intent(in), optional :: magmdl
865 real(double) :: satmagn, in,om,bbb,n,ll,bb,u1,u2,du
866 integer :: lmagmdl
867
868 lmagmdl = 2
869 if(present(magmdl)) lmagmdl = magmdl
870
871 in = 0.490005d0 - 2.2686d-4*t + 7.d-8*t**2 ! Radians
872 om = 2.9584809d0 + 0.0243418d0*t + 7.19d-6*t**2 ! Radians
873
874 bbb = asin( sin(in)*cos(gb)*sin(gl-om) - cos(in)*sin(gb) )
875 n = (113.6655d0 + 0.8771d0*t)*d2r
876 ll = l - 0.01759d0*d2r/r
877 bb = b - 7.64d-4*d2r * cos(l-n)/r
878
879 u1 = atan2( sin(in)*sin(bb) + cos(in)*cos(bb)*sin(ll-om) , cos(bb)*cos(ll-om) )
880 u2 = atan2( sin(in)*sin(gb) + cos(in)*cos(gb)*sin(gl-om) , cos(gb)*cos(gl-om) )
881 du = abs(rev2(u1-u2)) ! rev2() is needed because u1 and u2 jump from pi to -pi at different moments
882
883 if(lmagmdl.eq.1) then
884 ! Model 1 - Müller (1983):
885 satmagn = -8.68d0 + 5.d0*log10(d*r) + 0.044d0*abs(du)*r2d - 2.60d0*sin(abs(bbb)) + 1.25d0*(sin(bbb))**2
886 else
887 ! Method 2 - Meeus p.286: - constant difference of 0.2m...(?)
888 satmagn = -8.88d0 + 5.d0*log10(d*r) + 0.044d0*abs(du)*r2d - 2.60d0*sin(abs(bbb)) + 1.25d0*(sin(bbb))**2
889 end if
890
891 end function satmagn
892 !*********************************************************************************************************************************
893
894
895 !*********************************************************************************************************************************
896 !> \brief Calculate a correction to Saturn's magnitude due to its rings.
897 !!
898 !! \param tjc Dynamical time in Julian centuries after J2000.0.
899 !!
900 !! \param glon Geocentric longitude (rad).
901 !! \param glat Geocentric latitude (rad).
902 !!
903 !! \retval dsatmagn Correction to Saturn's magnitude due to its rings.
904 !!
905 !! \see Müller, POPot 8, 193 (1893) - https://ui.adsabs.harvard.edu/abs/1893POPot...8..193M/ - p.341/149
906
907 function dsatmagn(tjc, glon,glat)
908 use sufr_kinds, only: double
909 use sufr_angles, only: rev2
910
911 implicit none
912 real(double), intent(in) :: tjc, glon,glat
913 real(double) :: dsatmagn, inc,omg, bbb ! , n,ll,bb, u1,u2,du, bbb
914
915 inc = 0.490005d0 - 2.2686d-4*tjc + 7.d-8*tjc**2 ! Radians
916 omg = 2.9584809d0 + 0.0243418d0*tjc + 7.19d-6*tjc**2 ! Radians
917
918 bbb = asin( sin(inc)*cos(glat)*sin(glon-omg) - cos(inc)*sin(glat) )
919
920 dsatmagn = -2.60d0*sin(abs(bbb)) + 1.25d0*(sin(bbb))**2
921
922 end function dsatmagn
923 !*********************************************************************************************************************************
924
925
926 !*********************************************************************************************************************************
927 !> \brief Calculate the umbra and penumbra geocentric radii of the Earth's shadow
928 !!
929 !! \param dm0 Distance of the Moon (AU)
930 !! \param ds0 Distance of the Sun (AU)
931 !!
932 !! \param r1 Umbra radius at distance of the Moon (rad) (output)
933 !! \param r2 Penumbra radius at distance of the Moon (rad) (output)
934 !!
935 !! \see Expl.sup. to the Astronomical Almanac, p.428
936
937 subroutine earthshadow(dm0,ds0, r1,r2)
938 use sufr_kinds, only: double
939 use sufr_constants, only: au, earthr,planr
940
941 implicit none
942 real(double), intent(in) :: dm0,ds0
943 real(double), intent(out) :: r1,r2
944 real(double) :: rs,re,ds,dm,p1,ps,ss
945
946 dm = dm0*au ! AU -> cm
947 ds = ds0*au ! AU -> cm
948
949 re = earthr
950 rs = planr(3)
951
952 p1 = asin(re/dm) * 0.998340d0 ! Moon parallax, compensated for Earth's atmosphere
953 ps = asin(re/ds) ! Solar parallax
954 ss = asin(rs/ds) ! Solar semi-diameter
955
956 r1 = 1.02d0 * (p1 + ps - ss)
957 r2 = 1.02d0 * (p1 + ps + ss)
958
959 end subroutine earthshadow
960 !*********************************************************************************************************************************
961
962
963 !*********************************************************************************************************************************
964 !> \brief Compute physical data for Jupiter
965 !!
966 !! \param jd Julian day for computation
967 !!
968 !! \param de Jovocentric latitude of the Earth = inclination of planet axis to plane of the sky as seen from Earth (output)
969 !! \param ds Jovocentric latitude of the Sun = inclination of planet axis to plane of the sky as seen from Earth (output)
970 !! \param omg1 Longitude of central meridian of System I (equator+-10deg) (output)
971 !! \param omg2 Longitude of central meridian of System II (output)
972 !!
973 !! \param dphase Phase correction (output)
974 !! \param pa Position angle of Jupiter's north pole (from N to E) (output)
975 !! \param in Inclination of Jupiter's rotation axis to the orbital plane (output)
976 !! \param om Longitude of node of Jupiter's equator on ecliptic (output)
977 !!
978 !! \see Meeus, Astronomical Algorithms, 1998, Ch.43, p.293-295
979
980 subroutine jupiterphys(jd, de,ds, omg1,omg2, dphase, pa, in,om)
981 use sufr_kinds, only: double
982 use sufr_constants, only: d2r, pi, jd1900
983 use sufr_angles, only: rev
984
985 use thesky_local, only: deltat
986 use thesky_planetdata, only: planpos
989
990 implicit none
991 real(double), intent(in) :: jd
992 real(double), intent(out) :: de,ds, omg1,omg2, dphase, pa, in,om
993 real(double) :: jde,d,t1,t2,t3
994 real(double) :: alp0,del0,w1,w2,x,y,z,eps0,eps,dpsi,l,b,alps,dels, r,r0,l0
995 real(double) :: u,v,alp,del,dze,delta,l1,b1
996
997 ! To get data for the exact (rounded off) moment of Meeus' example:
998 !d = 15690.00068d0
999 !jde = d + 2433282.5d0
1000 !jd = jde - deltat/86400.d0
1001
1002 call planet_position(jd,5)
1003 call planetelements(jd)
1004
1005 deltat = calc_deltat(jd)
1006 jde = jd + deltat/86400.d0
1007
1008 ! Meeus, step 1, p.293:
1009 d = jde - 2433282.5d0 ! Since 1950 (!)
1010 t1 = d/36525.d0 ! Time since 1950 (!) in Julian centuries
1011
1012 t2 = (jde - jd1900)/36525.d0 ! Time since J1900.0 (!), in Julian centuries
1013 in = (3.120262d0 + 0.0006d0 * t2) * d2r ! Inclination of Jupiter's rotation axis to the orbital plane (Meeus, p.311)
1014
1015 t3 = jde - 2443000.5d0 - planpos(7) ! Days since 1976-08-10 (Meeus, p.305), minus light-travel time
1016 om = (316.518203d0 - 2.08362d-6*t3) * d2r ! Long. of node of Jupiter's equator on ecliptic, psi in Meeus, p.306
1017 om = om + (1.3966626d0*t1 + 3.088d-4*t1**2)*d2r ! Correct for precession (since B1950, but J1950 will do), Meeus p.311
1018
1019 alp0 = rev((268.d0 + 0.1061d0*t1)*d2r) ! Right ascension of Jupiter's north pole
1020 del0 = rev((64.5d0 - 0.0164d0*t1)*d2r) ! Declination of Jupiter's north pole
1021
1022 ! Meeus, step 2, p.294:
1023 w1 = rev((17.710d0 + 877.90003539d0*d)*d2r) ! Longitude system I
1024 w2 = rev((16.838d0 + 870.27003539d0*d)*d2r) ! Longitude system II
1025
1026 x = planpos(61) ! Apparent geocentric x
1027 y = planpos(62) ! Apparent geocentric y
1028 z = planpos(63) ! Apparent geocentric z
1029
1030 l = planpos(33) ! Heliocentric apparent l
1031 b = planpos(34) ! Heliocentric apparent b
1032 r = planpos(35) ! Heliocentric apparent r
1033 delta = planpos(4) ! Apparent geocentric distance
1034
1035 l0 = rev(planpos(41)+pi) ! Heliocentric, true coordinates of the Earth
1036 r0 = planpos(43)
1037
1038 ! Meeus, step 8, p.294:
1039 eps0 = planpos(50) ! Mean obliquity of the ecliptic; without nutation
1040 eps = planpos(48) ! True obliquity of the ecliptic; corrected for nutation
1041 dpsi = planpos(47) ! Nutation in longitude
1042
1043 ! Meeus, step 9, p.294:
1044 call ecl_2_eq(l,b,eps, alps,dels)
1045
1046 ! Meeus, step 10, p.294:
1047 ds = -sin(del0)*sin(dels) - cos(del0)*cos(dels)*cos(alp0-alps) ! Planetocentric declination of the Sun
1048
1049 ! Meeus, step 11, p.294:
1050 u = y*cos(eps0) - z*sin(eps0)
1051 v = y*sin(eps0) + z*cos(eps0)
1052
1053 alp = rev(atan2(u,x))
1054 del = atan2(v,sqrt(x**2+u**2))
1055 dze = rev( atan2( sin(del0)*cos(del)*cos(alp0-alp) - sin(del)*cos(del0) , cos(del)*sin(alp0-alp) ) )
1056
1057 ! Meeus, step 12, p.294:
1058 de = -sin(del0)*sin(del) - cos(del0)*cos(del)*cos(alp0-alp) ! Planetocentric declination of the Earth
1059
1060 ! Meeus, step 14, p.295 - phase correction - same sign as sin(l-l0):
1061 dphase = abs( (2*r*delta + r0**2 - r**2 - delta**2)/(4*r*delta) ) * sin(l-l0)/abs(sin(l-l0))
1062
1063 ! Meeus, step 13, p.295:
1064 omg1 = rev(w1 - dze - 5.07033d0*d2r * delta + dphase) ! Longitude of central meridian of System I (equator +- 10deg)
1065 omg2 = rev(w2 - dze - 5.02626d0*d2r * delta + dphase) ! Longitude of central meridian of System II (higher lat)
1066
1067 ! Meeus, steps 16, 17, p.295:
1068 call eq_2_ecl(alp0,del0,eps0, l1,b1) ! Has to be eps0
1069 call ecl_2_eq(l1+dpsi,b1,eps, alp0,del0) ! Has to be eps
1070
1071 ! Meeus, step 18, p.295:
1072 pa = atan2( cos(del0)*sin(alp0-alp) , sin(del0)*cos(del) - cos(del0)*sin(del)*cos(alp0-alp) ) ! PA of Jupiter's north pole
1073
1074 end subroutine jupiterphys
1075 !*********************************************************************************************************************************
1076
1077
1078 !*********************************************************************************************************************************
1079 !> \brief Compute physical data for Saturn
1080 !!
1081 !! \param jd Julian day of computation
1082 !!
1083 !! \param be Saturnicentric latitude of the Earth = inclination of planet axis to plane of the sky as seen from Earth (output)
1084 !! \param bs Saturnicentric latitude of the Sun = inclination of planet axis to plane of the sky as seen from the Sun (output)
1085 !!
1086 !! \param pa Position angle of Saturn's north pole (from N to E) (output)
1087 !! \param in Inclination of Saturn's rotation axis to the orbital plane (output)
1088 !! \param om Longitude of node of Saturn's equator on ecliptic (output)
1089 !!
1090 !! \param ar Projected major axis of ring (NOT semi-!!!) (output)
1091 !! \param br Projected minor axes of ring (NOT semi-!!!), = ar * sin(be) (output)
1092 !! \param du Difference between saturnicentric longitudes of Sun and Earth (Sun - Earth, NOT abs!!!) (output)
1093 !!
1094 !! \param pa_s Position angle of Saturn's north pole (from N to E), as seen from the SUN (output)
1095 !! \param ar_s Projected major axis of ring (NOT semi-!!!), as seen from the SUN (output)
1096 !! \param br_s Projected minor axes of ring (NOT semi-!!!), as seen from the SUN, = ar_s * sin(bs) (output)
1097 !!
1098 !!
1099 !! \see Meeus, Astronomical Algorithms, 1998, Ch.45 (The ring of Saturn)
1100 !!
1101 !! \todo
1102 !! - check true/apparent coordinates (see CHECK)
1103
1104 subroutine saturnphys(jd, be,bs, pa, in,om, ar,br, du, pa_s, ar_s,br_s)
1105 use sufr_kinds, only: double
1106 use sufr_constants, only: pi, as2r,d2r
1107 use sufr_angles, only: rev
1108
1111
1112 implicit none
1113 real(double), intent(in) :: jd
1114 real(double), intent(out) :: be,bs, pa, in,om, ar,br, du, pa_s, ar_s,br_s
1115 integer :: loop
1116 real(double) :: t, lam,bet, d,l,b,r, l0,b0,r0, x,y,z, dpsi,eps, ascn
1117 real(double) :: l2,b2, u1,u2, lam0,bet0, dl,db, ra,dec, ra0,dec0, sinbe
1118
1119 call planet_position(jd,6) ! Position of Saturn
1120
1121 ! Meeus, step 3:
1122 l = planpos(33) ! Heliocentric longitude of Saturn
1123 b = planpos(34) ! Heliocentric latitude of Saturn
1124 r = planpos(35) ! Heliocentric distance of Saturn
1125
1126 t = planpos(46) ! App. dyn. time in Julian Centuries since 2000.0
1127
1128 ! Meeus, step 10:
1129 dpsi = planpos(47) ! Nutation in longitude
1130 eps = planpos(48) ! True obliquity of the ecliptic; corrected for nutation
1131
1132 do loop=1,2 ! From Sun, Earth:
1133
1134 ! Meeus, step 2:
1135 if(loop.eq.1) then ! Seen from the Sun:
1136 lam = l
1137 bet = b
1138 d = r
1139 else ! Seen from the Earth:
1140 l0 = rev(planpos(41)+pi) ! Geocentric, true L,B,R for the Earth, in FK5 - CHECK - need apparent?
1141 b0 = -planpos(42)
1142 r0 = planpos(43)
1143
1144 ! Meeus, Ch. 45, step 5:
1145 call hc_spher_2_gc_rect(l,b,r, l0,b0,r0, x,y,z)
1146 call rect_2_spher(x,y,z, lam,bet,d)
1147 end if
1148
1149 ! Meeus, step 1:
1150 in = (28.075216d0 - 0.012998d0*t + 4.d-6 * t**2) * d2r ! Inclination of rotation axis, Eq. 45.1a
1151 om = (169.508470d0 + 1.394681d0*t + 4.12d-4 * t**2) * d2r ! Longitude of asc. node of equator - Omega, Eq. 45.1b
1152
1153 ! Meeus, step 6:
1154 sinbe = sin(in)*cos(bet)*sin(lam-om) - cos(in)*sin(bet)
1155 ar = 375.35d0*as2r/d ! Major axis of outer edge of outer ring
1156 br = ar*sinbe ! Minor axis of outer edge of outer ring
1157 be = asin(sinbe) ! B
1158
1159 if(loop.eq.2) then ! Seen from Earth:
1160 ! Meeus, step 7:
1161 call planetelements(jd)
1162 ascn = plelems(6,5) ! Longitude of Saturn's ascending node
1163 l2 = l - 0.01759d0*d2r / r ! Correct for the Sun's aberration on Saturn - lon
1164 b2 = b - 7.64d-4*d2r * cos(l-ascn) / r ! Correct for the Sun's aberration on Saturn - lat
1165
1166 ! Meeus, step 8:
1167 bs = asin(sin(in)*cos(b2)*sin(l2-om) - cos(in)*sin(b2)) ! B'
1168
1169 ! Meeus, step 9:
1170 u1 = atan2(sin(in)*sin(b2) + cos(in)*cos(b2)*sin(l2-om), cos(b2)*cos(l2-om)) ! Saturnicentric longitude of the Sun
1171 u2 = atan2(sin(in)*sin(bet) + cos(in)*cos(bet)*sin(lam-om), cos(bet)*cos(lam-om)) ! Saturnicentric longitude of the Earth
1172 du = u1-u2
1173 end if
1174
1175 ! Meeus, step 11:
1176 lam0 = om - pi/2.d0 ! Ecliptical longitude of Saturn's north pole
1177 bet0 = pi/2.d0 - in ! Ecliptical latitude of Saturn's north pole
1178
1179 if(loop.eq.2) then ! Seen from the Earth:
1180 ! Meeus, step 12 - correct for the aberration of Saturn:
1181 dl = 0.005693d0*d2r * cos(l0-lam)/cos(bet)
1182 db = 0.005693d0*d2r * sin(l0-lam)*sin(bet)
1183 lam = lam + dl
1184 bet = bet + db
1185
1186 ! Meeus, step 13 - correct for nutation in longitude:
1187 lam0 = lam0 + dpsi
1188 lam = lam + dpsi
1189 end if
1190
1191 ! Meeus, step 14:
1192 call ecl_2_eq(lam,bet,eps, ra,dec)
1193 call ecl_2_eq(lam0,bet0,eps, ra0,dec0)
1194
1195 ! Meeus, step 15:
1196 pa = atan2(cos(dec0)*sin(ra0-ra),sin(dec0)*cos(dec) - cos(dec0)*sin(dec)*cos(ra0-ra)) ! Position angle
1197
1198 if(loop.eq.1) then ! Save data for the Sun's pov:
1199 pa_s = pa
1200 ar_s = ar
1201 br_s = br
1202 end if
1203 end do ! loop=1,2 - from Sun, Earth
1204
1205 end subroutine saturnphys
1206 !*********************************************************************************************************************************
1207
1208
1209
1210
1211
1212 !*********************************************************************************************************************************
1213 !> \brief Compute low-accuracy planet positions. Sun and Moon have dedicated routines, for planets abridged VSOP87 is used.
1214 !!
1215 !! \param jd Julian Day of computation
1216 !! \param pl Planet number: 0: Moon, 1-2: Mer-Ven, 3: Sun, 4-9: Mar-Plu
1217 !!
1218 !! \param calc Calculate 1: l,b,r,diam, 2: + ra,dec, 3: + gmst,agst, 4: + az,alt, 5: + elon, mag, k, pa, parang, hp, GC LBR,
1219 !! 6: + topocentric positions (Sun and Moon only, optional - default = 5)
1220 !! \param nt Number of terms to use for the calculation (has an effect for Moon only; nt<=60);
1221 !! a smaller nt gives faster, but less accurate results (optional, default=60)
1222 !!
1223 !! \param lat Latitude of the observer (rad, optional)
1224 !! \param lon Longitude of the observer (rad, optional)
1225
1226 subroutine planet_position_la(jd, pl, calc,nt, lat,lon)
1227 use sufr_kinds, only: double
1228 use sufr_angles, only: rev,rev2
1229
1230 use thesky_planetdata, only: planpos
1231 use thesky_moon, only: moonpos_la
1232 use thesky_sun, only: sunpos_la
1234 use thesky_local, only: lat0,lon0
1235
1236 implicit none
1237 real(double), intent(in) :: jd
1238 integer, intent(in) :: pl
1239 integer, intent(in), optional :: calc,nt
1240 real(double), intent(in), optional :: lat,lon
1241
1242 integer :: lcalc,lnt
1243 real(double) :: dh_ref, parAng, dRA_ref
1244
1245 lcalc = 5
1246 if(present(calc)) lcalc = calc
1247
1248 if(present(lat)) lat0 = lat
1249 if(present(lon)) lon0 = lon
1250
1251
1252 planpos = 0.d0
1253 planpos(39) = dble(pl)
1254
1255 select case(pl)
1256 case(0) ! Moon
1257
1258 lnt = 60
1259 if(present(nt)) lnt = nt
1260 call moonpos_la(jd, lcalc,lnt)
1261
1262 case(3) ! Sun
1263
1264 call sunpos_la(jd, lcalc)
1265
1266 case default ! Planets
1267
1268 call planet_position(jd,pl, lbaccur=1.d-6,raccur=1.d-4, ltime=.false.) ! Truncated VSOP87, no light-time correction
1269
1270 end select
1271
1272
1273 ! Fill topocentric planpos elements (21-32) with geocentric values (1-12) for Moon and Sun:
1274 if(pl.eq.0 .or. pl.eq.3) then
1275 planpos(21:32) = planpos(1:12)
1276 planpos(31) = planpos(30) ! Altitude, "corrected" for refraction - except that it is not corrected in the cheap version
1277
1278
1279 ! Simple correction for horizontal parallax, Meeus p.281, assuming rho=1:
1280 if(lcalc.eq.5) planpos(30) = planpos(10) - asin(sin(planpos(17))*cos(planpos(10))) ! alt' = alt - Hp*cos(alt)
1281
1282 ! More precise conversion to topocentric coordinates:
1283 if(lcalc.ge.6) then ! This takes 15% more CPU time for the Moon (full accuracy; nt=60) and 110% more for the Sun!
1284 call geoc2topoc_ecl(planpos(1),planpos(2), planpos(4),planpos(12)/2.d0, planpos(48),planpos(44), & ! l,b, del,r, eps,lst
1285 planpos(21),planpos(22),planpos(32)) ! L,B, r
1286 planpos(32) = planpos(32)*2.d0 ! Apparent diameter
1287 planpos(24) = planpos(4)*planpos(12)/planpos(32) ! Distance
1288
1289 call geoc2topoc_eq(planpos(5),planpos(6), planpos(4),planpos(8), planpos(25),planpos(26)) ! ra,dec, del,hh, topo ra,dec
1290
1291 call eq2horiz(planpos(25),planpos(26),planpos(45), planpos(28),planpos(29),planpos(30)) ! topo ra,dec,agst, -> hh,az,alt
1292 end if
1293
1294 if(lcalc.ge.5) then
1295 dh_ref = refract(planpos(30)) ! Corrected for atmospheric refraction in altitude
1296 planpos(31) = planpos(30) + dh_ref ! Topocentric altitude, corrected for atmospheric refraction
1297
1298 parang = atan2(sin(planpos(28)),tan(lat0)*cos(planpos(26)) - sin(planpos(26))*cos(planpos(28))) ! Topoc. paral. angle
1299 dra_ref = dh_ref / cos(planpos(26)) * sin(parang)
1300 planpos(25) = rev(planpos(25) + dra_ref) ! Correct topocentric RA for refraction
1301 planpos(28) = rev(planpos(28) - dra_ref) ! Correct topocentric HA for refraction
1302 planpos(26) = planpos(26) + dh_ref*cos(parang)
1303 end if
1304 end if
1305
1306 end subroutine planet_position_la
1307 !*********************************************************************************************************************************
1308
1309 !*********************************************************************************************************************************
1310 !> \brief Correction for comet magnitude due to forward and backscattering
1311 !!
1312 !! \param phaseAng Phase angle of the comet (rad)
1313 !!
1314 !! \retval Magnitude correction, to be added to the magnitude (usually negative)
1315 !!
1316 !! \see https://ui.adsabs.harvard.edu/abs/2007ICQ....29..119M
1317 !!
1318
1320 use sufr_kinds, only: double
1321 use sufr_constants, only: pi ! , r2d
1322 use sufr_angles, only: rev2
1323
1324 implicit none
1325 real(double), intent(in) :: phaseang
1326 real(double) :: comet_scatter_magnitude_correction, theta,d90,gf,gb,k,phi
1327
1328 theta = rev2(pi - phaseang) ! Scattering angle = 180° - phase angle
1329
1330 d90 = 0.3d0 ! Dust-to-gas light ratio in the coma at theta=90°. 1 for a "normal" comet, ~10 for a "dusty" one. 3.3 ~ half way. 0.3 taken from http://astro.vanbuitenen.nl/comet/2020F8
1331 gf = 0.9d0 ! Forward-scattering asymmetry factor
1332 gb = -0.6d0 ! Backscattering asymmetry factor
1333 k = 0.95d0 ! Partition coefficient between forward and backscattering
1334
1335 phi = d90/(1+d90) * (k*((1+gf**2)/(1+gf**2 - 2*gf*cos(theta)))**1.5d0 + &
1336 k*((1+gb**2)/(1+gb**2 - 2*gb*cos(theta)))**1.5d0 + 1.d0/d90) ! Eq.1
1337
1338 comet_scatter_magnitude_correction = -2.5d0*log10(phi)
1339
1340 ! write(*,'(99F9.3)') phaseAng*r2d,theta*r2d,d90,gf,gb,k,phi,comet_scatter_magnitude_correction
1342 !*********************************************************************************************************************************
1343
1344
1345end module thesky_planets
1346!***********************************************************************************************************************************
Procedures for asteroids.
Definition asteroids.f90:23
subroutine asteroid_lbr(t, as, l, b, r)
Calculate heliocentric ecliptical coordinates l,b,r for asteroid as at time t (Julian Millennia after...
real(double) function asteroid_magn(as, delta, r, pa)
Calculate asteroid magnitude for asteroid AS.
Data to compute comet positions.
Definition modules.f90:322
logical, dimension(ncometsmax) cometdiedatp
This comet died at perihelion (true/false)
Definition modules.f90:331
real(double), dimension(ncometsmax, 9) cometelems
Orbital elements of the comets: 1: JD of epoch (often J2000), 2: Perihelion distance (AU?...
Definition modules.f90:332
Procedures for comets.
Definition comets.f90:23
subroutine cometgc(t, t0, comid, r, l, b, d)
Calc geocentric lbr coordinates for comet com at t1 (in Julian millennia Dynamical Time)
Definition comets.f90:265
Procedures for coordinates.
real(double) function refract(alt, press, temp)
Compute the atmospheric refraction for a given true altitude. You should add the result to the uncorr...
subroutine eq2horiz(ra, dec, agst, hh, az, alt, lat, lon)
Convert spherical equatorial coordinates (RA, dec, agst) to spherical horizontal coordinates (hh,...
subroutine eq_2_ecl(ra, dec, eps, l, b)
Convert (geocentric) spherical equatorial coordinates RA, Dec (and eps) to spherical ecliptical coord...
subroutine rect_2_spher(x, y, z, l, b, r)
Convert rectangular coordinates x,y,z to spherical coordinates l,b,r.
subroutine ecl_2_eq(l, b, eps, ra, dec)
Convert (geocentric) spherical ecliptical coordinates l,b (and eps) to spherical equatorial coordinat...
subroutine fk5(t, l, b)
Convert coordinates to the FK5 system.
subroutine hc_spher_2_gc_rect(l, b, r, l0, b0, r0, x, y, z)
Compute the geocentric rectangular coordinates of a planet, from its and the Earth's heliocentric sph...
subroutine aberration_ecl(t, l0, l, b)
Correct ecliptic longitude and latitiude for annual aberration.
subroutine precess_ecl(jd1, jd2, l, b)
Compute the precession of the equinoxes in geocentric ecliptical coordinates.
subroutine geoc2topoc_eq(gcra, gcd, gcr, gch, tcra, tcd, lat, hgt)
Convert geocentric equatorial coordinates to topocentric.
subroutine geoc2topoc_ecl(gcl, gcb, gcr, gcs, eps, lst, tcl, tcb, tcs, lat, hgt)
Convert spherical ecliptical coordinates from the geocentric to the topocentric system.
Date and time procedures.
Definition date_time.f90:49
real(double) function calc_gmst(jd, deltat)
Calculate Greenwich Mean Sidereal Time for any instant, in radians.
real(double) function calc_deltat(jd, force_recompute)
Compute DeltaT for a given JD.
Local parameters for libTheSky: location, date, time.
Definition modules.f90:56
real(double) height
Altitude of the observer above sea level (m)
Definition modules.f90:65
real(double) lon0
Longitude of the observer (rad)
Definition modules.f90:64
real(double) deltat
Current value of DeltaT (s)
Definition modules.f90:66
real(double) lat0
Latitude of the observer (rad)
Definition modules.f90:63
Procedures for the Moon.
subroutine elp82b_lbr(tjj, ll, bb, rr)
Calculate the apparent geocentric ecliptical position of the Moon, using the Lunar Solution ELP 2000-...
real(double) function moonmagn(pa, delta)
Calculate the magnitude of the Moon.
subroutine elp_mpp02_lbr(jd, mode, lon, lat, rad, precess)
Compute the spherical lunar coordinates using the ELP2000/MPP02 lunar theory in the dynamical mean ec...
subroutine moonpos_la(jd, calc, nt)
Quick, lower-accuracy lunar coordinates; ~600x faster than ELP.
Procedures for nutation.
Definition nutation.f90:25
subroutine nutation(t, dpsi, eps0, deps)
Calculate nutation - cheap routine from Meeus - as well as the mean obliquity of the ecliptic.
Definition nutation.f90:46
subroutine nutation2000(jd, dpsi_tot, deps_tot, eps0)
Compute nutation using the IAU 2000 model. Add the mean obliquity of the ecliptic by Laskar (1986).
Definition nutation.f90:102
Planet data, needed to compute planet positions.
Definition modules.f90:85
integer, dimension(43, 2) plub
Constants for the latitude of Pluto.
Definition modules.f90:98
real(double), dimension(8, 6) plelems
Planet orbital elements for Equation of Data.
Definition modules.f90:109
integer pl0
Remember a special planet.
Definition modules.f90:101
real(double), dimension(nplanpos) planpos
Planpos[] is an array with many different types of coordinates and related variables:
Definition modules.f90:192
real(double), dimension(8, 6) plelems2000
Planet orbital elements for J2000.
Definition modules.f90:110
integer, dimension(43, 2) plur
Constants for the distance of Pluto.
Definition modules.f90:99
real(double), dimension(2, 8, 6, 0:3) plelemdata
Data to compute planet orbital elements.
Definition modules.f90:111
integer, dimension(43, 3) pluc
Constants for the periodic terms for the position of Pluto.
Definition modules.f90:96
integer, dimension(43, 2) plul
Constants for the longitude of Pluto.
Definition modules.f90:97
Procedures for planets.
Definition planets.f90:23
subroutine earthshadow(dm0, ds0, r1, r2)
Calculate the umbra and penumbra geocentric radii of the Earth's shadow.
Definition planets.f90:938
subroutine planet_position(jd, pl, lat, lon, hgt, lbaccur, raccur, ltime, aber, to_fk5, assume_jde, lunar_theory, nutat, magmdl, verbosity)
Compute the position, distance, etc of a planet.
Definition planets.f90:63
real(double) function satmagn(t, gl, gb, d, l, b, r, magmdl)
Calculate Saturn's magnitude.
Definition planets.f90:858
subroutine planet_position_la(jd, pl, calc, nt, lat, lon)
Compute low-accuracy planet positions. Sun and Moon have dedicated routines, for planets abridged VSO...
Definition planets.f90:1227
subroutine planetelements(jd)
Calculate orbital elements for the planets.
Definition planets.f90:701
subroutine jupiterphys(jd, de, ds, omg1, omg2, dphase, pa, in, om)
Compute physical data for Jupiter.
Definition planets.f90:981
real(double) function dsatmagn(tjc, glon, glat)
Calculate a correction to Saturn's magnitude due to its rings.
Definition planets.f90:908
subroutine saturnphys(jd, be, bs, pa, in, om, ar, br, du, pa_s, ar_s, br_s)
Compute physical data for Saturn.
Definition planets.f90:1105
real(double) function comet_scatter_magnitude_correction(phaseang)
Correction for comet magnitude due to forward and backscattering.
Definition planets.f90:1320
real(double) function planet_magnitude(pl, hc_dist, gc_dist, phang, model)
Calculate planet magnitude.
Definition planets.f90:772
subroutine plutolbr(t, l, b, r)
Calculate Pluto's position l,b,r at time t.
Definition planets.f90:644
Low-accuracy procedures for the Sun.
Definition sun.f90:23
real(double) function sunmagn(dist)
Calculate Sun magnitude.
Definition sun.f90:283
subroutine sunpos_la(jd, calc, lat, lon)
Low-accuracy solar coordinates.
Definition sun.f90:58
Procedures for VSOP.
Definition vsop.f90:34
subroutine vsop87d_lbr(tm, pl, lon, lat, rad, lbaccur, raccur)
Calculate true heliocentric ecliptic coordinates l,b,r for planet pl and the mean ecliptic and equino...
Definition vsop.f90:59