initialize the earth and sun ephemeris.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(jpl_ephemeris_splined), | intent(inout) | :: | me | |||
| real(kind=wp), | intent(in) | :: | et0 |
initial ephemeris time [sec] |
||
| real(kind=wp), | intent(in) | :: | dt |
ephemeris time step [sec] |
||
| real(kind=wp), | intent(in) | :: | etf |
final ephemeris time [sec] |
subroutine initialize_globals(me, et0, dt, etf) !! initialize the earth and sun ephemeris. class(jpl_ephemeris_splined),intent(inout) :: me real(wp),intent(in) :: et0 !! initial ephemeris time [sec] real(wp),intent(in) :: dt !! ephemeris time step [sec] real(wp),intent(in) :: etf !! final ephemeris time [sec] integer :: i !! counter real(wp) :: et !! ephemeris time integer :: nx !! number of points real(wp),dimension(:),allocatable :: et_vec integer :: iflag ! write(*,*) 'initialize_globals...' ! write(*,*) ' et0 = ', et0 ! write(*,*) ' dt = ', dt ! write(*,*) ' etf = ', etf call me%destroy() call earth_eph%destroy() call sun_eph%destroy() call ssb_eph%destroy() call jupiter_eph%destroy() ! first, count the number of points and allocate the arrays: nx = 0 et = et0 do if (et>etf) exit nx = nx + 1 et = et + dt end do call earth_eph%allocate(nx, kx) call sun_eph%allocate(nx, kx) call ssb_eph%allocate(nx, kx) call jupiter_eph%allocate(nx, kx) allocate(et_vec(nx)) ! function calls from et0 to etf: i = 0 ! index in the arrays et = et0 do if (et>etf) exit i = i + 1 et = et + dt et_vec(i) = et call earth_eph%populate (me%jpl_ephemeris,et,body_earth, body_moon,i) call sun_eph%populate (me%jpl_ephemeris,et,body_sun, body_moon,i) call ssb_eph%populate (me%jpl_ephemeris,et,body_ssb, body_moon,i) call jupiter_eph%populate(me%jpl_ephemeris,et,body_jupiter,body_moon,i) end do ! create the splines (one for each coordinate): do i = 1, 6 call earth_eph%spline(et_vec,i) call sun_eph%spline (et_vec,i) call ssb_eph%spline (et_vec,i) call jupiter_eph%spline(et_vec,i) end do deallocate(earth_eph%f) ! don't need these anymore deallocate(sun_eph%f) deallocate(ssb_eph%f) deallocate(jupiter_eph%f) end subroutine initialize_globals