symba5_step_pl.f 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. c*************************************************************************
  2. c SYMBA5_STEP_PL.F
  3. c*************************************************************************
  4. c
  5. c Input:
  6. c i1st ==> = 0 if first step; = 1 not (int scalar)
  7. c time ==> current time (real scalar)
  8. c nbod ==> number of massive bodies (int scalar)
  9. c nbodm ==> location of the last massie body
  10. c (int scalar)
  11. c mass ==> mass of bodies (real array)
  12. c j2rp2,j4rp4 ==> J2*radii_pl^2 and J4*radii_pl^4
  13. c (real scalars)
  14. c xh,yh,zh ==> initial position in helio coord
  15. c (real arrays)
  16. c vxh,vyh,vzh ==> initial velocity in helio coord
  17. c (real arrays)
  18. c dt ==> time step
  19. c lclose ==> .true. --> marge particles if they
  20. c get too close. Read in that
  21. c distance in io_init_pl
  22. c (logical*2 scalar)
  23. c rpl ==> physical size of a planet.
  24. c (real array)
  25. c eoff ==> Energy offset (real scalar)
  26. c rhill ==> size of planet's hills sphere
  27. c (real array)
  28. c mtiny ==> Small mass (real array)
  29. c Output:
  30. c xh,yh,zh ==> final position in helio coord
  31. c (real arrays)
  32. c vxh,vyh,vzh ==> final velocity in helio coord
  33. c (real arrays)
  34. c rpl ==> Recalculated physical size of a planet.
  35. c if merger happened (real array)
  36. c nbod ==> Recalculated number of massive bodies
  37. c if merger happened (int scalar)
  38. c mass ==> Recalculated mass of bodies
  39. c if merger happened (real array)
  40. c isenc ==> 0 --> No encounter during last dt
  41. c 1 --> There was encounters
  42. c (integer scalar)
  43. c mergelst ==> list of mergers (int array)
  44. c mergecnt ==> count of mergers (int array)
  45. c iecnt ==> Number of encounters (int*2 array)
  46. c eoff ==> Energy offset (real scalar)
  47. c rhill ==> size of planet's hills sphere
  48. c (real array)
  49. c
  50. c Remarks: Based on symba2_step_pl.f
  51. c Authors: Hal Levison
  52. c Date: 11/27/97
  53. c Last revision:
  54. subroutine symba5_step_pl(i1st,time,nbod,nbodm,mass,j2rp2,
  55. & j4rp4,xh,yh,zh,vxh,vyh,vzh,dt,lclose,rpl,isenc,
  56. & mergelst,mergecnt,iecnt,eoff,rhill,mtiny)
  57. include '../swift.inc'
  58. include 'symba5.inc'
  59. c... Inputs Only:
  60. integer nbod,i1st,nbodm
  61. real*8 mass(nbod),dt,time,j2rp2,j4rp4,mtiny
  62. logical*2 lclose
  63. c... Inputs and Outputs:
  64. real*8 xh(nbod),yh(nbod),zh(nbod)
  65. real*8 vxh(nbod),vyh(nbod),vzh(nbod)
  66. real*8 rpl(nbod),eoff,rhill(NTPMAX)
  67. c... Outputs only
  68. integer isenc
  69. integer*2 iecnt(NTPMAX),ielev(NTPMAX)
  70. integer mergelst(2,NTPMAX),mergecnt
  71. c... Internals
  72. integer i,j,ieflg,irec
  73. logical*1 svdotr ! Not used in the routine
  74. integer*2 ielst(2,NENMAX),ielc
  75. c----
  76. c... Executable code
  77. do i=2,nbod
  78. iecnt(i) = 0
  79. ielev(i) = -1
  80. enddo
  81. isenc = 0
  82. c... check for encounters
  83. irec = 0
  84. ielc = 0
  85. do j=2,nbodm
  86. do i=j+1,nbod
  87. ieflg = 0
  88. call symba5_chk(rhill,nbod,i,j,mass,xh,yh,zh,vxh,
  89. & vyh,vzh,dt,irec,ieflg,svdotr)
  90. if(ieflg.ne.0) then
  91. isenc = 1
  92. iecnt(i) = iecnt(i) + 1
  93. iecnt(j) = iecnt(j) + 1
  94. ielev(i) = 0
  95. ielev(j) = 0
  96. ielc = ielc + 1
  97. if(ielc.gt.NENMAX) then
  98. write(*,*) 'ERROR: encounter matrix is filled.'
  99. write(*,*) 'STOPPING'
  100. call util_exit(1)
  101. endif
  102. ielst(1,ielc) = i
  103. ielst(2,ielc) = j
  104. endif
  105. enddo
  106. enddo
  107. c... do a step
  108. if(isenc.eq.0) then
  109. call symba5_step_helio(i1st,nbod,nbodm,mass,j2rp2,
  110. & j4rp4,xh,yh,zh,vxh,vyh,vzh,dt)
  111. mergecnt=0
  112. else
  113. call symba5_step_interp(time,iecnt,ielev,nbod,
  114. & nbodm,mass,rhill,j2rp2,j4rp4,lclose,rpl,xh,yh,zh,
  115. & vxh,vyh,vzh,dt,mergelst,mergecnt,eoff,ielc,ielst,
  116. & mtiny)
  117. i1st = 0
  118. endif
  119. return
  120. end ! symba5_step_pl.f
  121. c-----------------------------------------------------------