Skip to content

Commit

Permalink
(ephemeris) added setup for dwarf planets
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Dec 18, 2024
1 parent d2dc2bf commit f2847e5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 14 deletions.
42 changes: 35 additions & 7 deletions src/setup/set_bodies.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module setbodies
!
implicit none
public :: set_minor_planets
public :: add_body,add_sun_and_planets
public :: add_body,add_sun_and_planets,add_dwarf_planets

private

Expand Down Expand Up @@ -114,12 +114,12 @@ subroutine add_sun_and_planets(nptmass,xyzmh_ptmass,vxyz_ptmass,mtot,epoch)
'mercury', &
'venus ', &
'earth ', &
'moon ', &
'mars ', &
'jupiter', &
'saturn ', &
'uranus ', &
'neptune', &
'pluto '/) ! for nostalgia's sake
'neptune'/)
integer :: i

do i=1,nbodies
Expand All @@ -130,10 +130,38 @@ subroutine add_sun_and_planets(nptmass,xyzmh_ptmass,vxyz_ptmass,mtot,epoch)
endif
enddo

print*,' nptmass = ',nptmass

end subroutine add_sun_and_planets

!----------------------------------------------------------------
!+
! setup the solar system dwarf planets by querying their ephemeris
! from the JPL server
!+
!----------------------------------------------------------------
subroutine add_dwarf_planets(nptmass,xyzmh_ptmass,vxyz_ptmass,mtot,epoch)
integer, intent(inout) :: nptmass
real, intent(inout) :: xyzmh_ptmass(:,:),vxyz_ptmass(:,:)
real, intent(in) :: mtot
character(len=*), intent(in), optional :: epoch
integer, parameter :: nbodies = 5
character(len=*), parameter :: planet_name(nbodies) = &
(/'ceres ',&
'pluto ', &
'eris ', &
'makemake', &
'haumea '/)
integer :: i

do i=1,nbodies
if (present(epoch)) then
call add_body(planet_name(i),nptmass,xyzmh_ptmass,vxyz_ptmass,mtot,epoch=epoch)
else
call add_body(planet_name(i),nptmass,xyzmh_ptmass,vxyz_ptmass,mtot)
endif
enddo

end subroutine add_dwarf_planets

!----------------------------------------------------------------
!+
! setup a body in the solar system by querying their ephemeris
Expand Down Expand Up @@ -200,10 +228,10 @@ subroutine add_body(body_name,nptmass,xyzmh_ptmass,vxyz_ptmass,mtot,epoch)

! add a point mass for each body
nptmass = nptmass + 1
xyzmh_ptmass(1:3,nptmass) = xyz_tmp(:,2)
xyzmh_ptmass(1:3,nptmass) = xyz_tmp(1:3,2)
xyzmh_ptmass(4,nptmass) = mbody
xyzmh_ptmass(5,nptmass) = rbody
vxyz_ptmass(1:3,nptmass) = vxyz_tmp(:,2)
vxyz_ptmass(1:3,nptmass) = vxyz_tmp(1:3,2)
print "(1x,a,3(1x,1pg10.3))",' x = ',xyz_tmp(1:3,2)
print "(1x,a,3(1x,1pg10.3))",' v = ',vxyz_tmp(1:3,2)

Expand Down
22 changes: 15 additions & 7 deletions src/utils/utils_ephemeris.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,32 @@ subroutine construct_horizons_api_url(object,url,ierr,epoch)
character(len=*), intent(out) :: url ! url for query
integer, intent(out) :: ierr
character(len=*), intent(in), optional :: epoch
character(len=6) :: cmd
character(len=8) :: cmd
character(len=10) :: start_epoch,end_epoch
integer :: values(8),year,month,day

ierr = 0
select case(trim(adjustl(object)))
case('makemake')
cmd='136472' ! makemake barycentre
case('ceres')
cmd='A801 AA' ! ceres barycentre
case('eris')
cmd= '20136199' ! eris barycentre
case('haumea')
cmd = '2016108' ! haumea barycentre
case('pluto')
cmd = '999' ! pluto barycentre
cmd = '999' ! pluto body centre
case('neptune')
cmd = '899' ! neptune barycentre
cmd = '899' ! neptune body centre
case('uranus')
cmd = '799' ! uranus barycentre
cmd = '799' ! uranus body centre
case('saturn')
cmd = '699' ! saturn barycentre
cmd = '699' ! saturn body centre
case('jupiter')
cmd = '599' ! jupiter barycentre
cmd = '599' ! jupiter body centre
case('mars')
cmd = '499' ! mars barycentre
cmd = '499' ! mars body centre
case('earth')
cmd = '399' ! earth
case('venus')
Expand Down

0 comments on commit f2847e5

Please sign in to comment.