46 use sufr_kinds,
only: double
47 use sufr_constants,
only: nlpname,enpname, jd2000
48 use sufr_numerics,
only: deq
55 real(double),
intent(in) :: t1
56 integer,
intent(in) :: comID
57 real(double),
intent(out) :: x,y,z
59 integer,
parameter :: max_try_i = nint(1e5)
61 real(double) :: k,jj,del, tp,q,a,e,o1,o2,in,nu,r,t,jde,te, m,n,ee,ee1,de, qq,gamma,tannu2,tannu2_0,tannu2_1,w,q2,q3,dq3
62 real(double) :: eps,dpsi,eps0,deps, ff,gg,hh,pp,qqq,rr,a1,a2,b1,b2,c1,c2
64 jde = t1*365250.d0 + jd2000
109 if(abs(de).lt.del)
exit
118 de = (m + e*sin(ee) - ee) / (1.d0 - e*cos(ee))
120 if(abs(de).lt.del)
exit
123 if(i.ge.max_try_i)
write(0,
'(A,I0,A,F8.5,A, I0,A, 2(ES10.3,A))')
' cometxyz(): WARNING: Kepler solution did not converge for comet '// &
124 trim(
cometnames(comid))//
' (',comid,
'), with e =', e,
' (',i,
' iterations; ', abs(de),
' >', del,
').'
126 nu = 2.d0 * atan( sqrt( (1.d0+e)/(1.d0-e) ) * tan(ee/2.d0) )
132 w = 3*k/(q*sqrt(2*q))*t
135 tannu2_1 = (2*tannu2**3 + w)/(3*(tannu2**2+1.d0))
136 if(abs(tannu2-tannu2_1).lt.del)
exit
145 nu = 2.d0*atan(tannu2)
150 qq = k/(2.d0*q)*sqrt((1.d0+e)/q)
151 gamma = (1.d0-e)/(1.d0+e)
154 iloop:
do i=1,max_try_i
157 q3 = q2 + 2.d0*gamma*tannu2**3/3.d0
161 dq3 = (-1)**(j-1) * gamma**(j-2) * ((jj-1.d0) - j*gamma) * tannu2**(2*j-1) / (2*jj-1.d0)
162 if(isnan(dq3))
return
165 if(abs(dq3).lt.del)
exit j1loop
167 if(j.eq.1000) j1 = j1+1
170 if(
thesky_verbosity.gt.0)
write(0,
'(A,I0,A,F8.5,A, I0,A, 2(ES10.3,A))')
' cometxyz(): WARNING: j1-iteration did not converge for comet '// &
171 trim(
cometnames(comid))//
' (',comid,
'), with e =', e,
' (',i,
' iterations; ', abs(dq3),
' >', del,
').'
178 tannu2 = (2.d0/3.d0*tannu2**3+q3) / (tannu2**2+1.d0)
179 if(abs(tannu2-tannu2_1).lt.del)
exit j2loop
181 if(j.eq.1000) j2 = j2+1
183 if(
thesky_verbosity.gt.0)
write(0,
'(A,I0,A,F8.5,A, I0,A, 2(ES10.3,A))')
' cometxyz(): WARNING: j2-iteration did not converge for comet '// &
184 trim(
cometnames(comid))//
' (',comid,
'), with e =', e,
' (',i,
' iterations; ', abs(tannu2-tannu2_1),
' >', del,
').'
189 if(abs(tannu2-tannu2_0).lt.del)
then
190 nu = 2.d0*atan(tannu2)
194 if(i.ge.max_try_i)
then
195 if(
thesky_verbosity.gt.0)
write(0,
'(A,I0,A,F8.5,A, I0,A, 2(ES10.3,A))')
' cometxyz(): WARNING: i-iteration did not converge for comet '// &
196 trim(
cometnames(comid))//
' (',comid,
'), with e =', e,
' (',i,
' iterations; ', abs(tannu2-tannu2_0),
' >', del,
').'
206 r = q * (1.d0+e) / (1.d0 + e*cos(nu))
213 gg = sin(o2)*cos(eps)
214 hh = sin(o2)*sin(eps)
216 pp = -sin(o2)*cos(in)
217 qqq = cos(o2)*cos(in)*cos(eps) - sin(in)*sin(eps)
218 rr = cos(o2)*cos(in)*sin(eps) + sin(in)*cos(eps)
222 a2 = sqrt(ff*ff + pp*pp)
224 b2 = sqrt(gg*gg + qqq*qqq)
226 c2 = sqrt(hh*hh + rr*rr)
229 x = r * a2 * sin(a1 + o1 + nu)
230 y = r * b2 * sin(b1 + o1 + nu)
231 z = r * c2 * sin(c1 + o1 + nu)
265 use sufr_kinds,
only: double
266 use sufr_constants,
only: pi, jd2000
267 use sufr_numerics,
only: deq0
268 use sufr_angles,
only: rev
276 real(double),
intent(in) :: t,t0
277 integer,
intent(in) :: comID
278 real(double),
intent(out) :: l,b,r,d
280 real(double) :: l0,b0,r0,x0,y0,z0,x,y,z
281 real(double) :: ra,dec,dpsi,eps0,deps,eps,jd1,jd2
295 jd1 = t*365250.d0 + jd2000
299 r = sqrt(x*x + y*y + z*z)
306 d = sqrt(x*x + y*y + z*z)
real(double), dimension(ncometsmax, 9) cometelems
Orbital elements of the comets: 1: JD of epoch (often J2000), 2: Perihelion distance (AU?...
subroutine cometgc(t, t0, comid, r, l, b, d)
Calc geocentric lbr coordinates for comet com at t1 (in Julian millennia Dynamical Time)
subroutine cometxyz(t1, comid, x, y, z)
Calculate heliocentric xyz coordinates for comet com at t1 (in J.mill DT). Usually called by cometgc(...
subroutine precess_xyz(jd1, jd2, x, y, z)
Compute the precession of the equinoxes in rectangular coordinates, from jd1 to jd2.
subroutine eq_2_ecl(ra, dec, eps, l, b)
Convert (geocentric) spherical equatorial coordinates RA, Dec (and eps) to spherical ecliptical coord...
subroutine ecl_spher_2_eq_rect(l, b, r, eps, x, y, z)
Convert spherical, ecliptical coordinates to rectangular, equatorial coordinates of an object - both ...
subroutine nutation(t, dpsi, eps0, deps)
Calculate nutation - cheap routine from Meeus - as well as the mean obliquity of the ecliptic.
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...