anal_energy_write.f 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. c*************************************************************************
  2. c ANAL_ENERGY_WRITE.F
  3. c*************************************************************************
  4. c Writes the energy of the total system (massive bodies) wrt time.
  5. c
  6. c Input:
  7. c t ==> current time
  8. c nbod ==> number of massive bodies (int scalar)
  9. c mass ==> mass of bodies (real array)
  10. c j2rp2 ==> scaled value of j2 moment (real*8 scalar)
  11. c j4rp4 ==> scaled value of j4 moment (real*8 scalar)
  12. c xh,yh,zh ==> current position in helio coord
  13. c (real arrays)
  14. c vxh,vyh,vzh ==> current velocity in helio coord
  15. c (real arrays)
  16. c iu ==> unit to write to (int scalar)
  17. c fopenstat ==> The status flag for the open
  18. c statements of the output files.
  19. c (character*80)
  20. c eoff ==> An energy offset that is added to the energy
  21. c (real*8 scalar)
  22. c
  23. c Remarks:
  24. c Authors: Hal Levison
  25. c Date: 3/4/93
  26. c Last revision: 12/27/96
  27. subroutine anal_energy_write(t,nbod,mass,j2rp2,j4rp4,xh,yh,zh,
  28. & vxh,vyh,vzh,iu,fopenstat,eoff)
  29. include '../swift.inc'
  30. c... Inputs:
  31. integer nbod,iu
  32. real*8 mass(nbod),t,j2rp2,j4rp4,eoff
  33. real*8 xh(nbod),yh(nbod),zh(nbod)
  34. real*8 vxh(nbod),vyh(nbod),vzh(nbod)
  35. character*80 fopenstat
  36. c... Internals
  37. integer i1st
  38. real*8 energy,eltot(3),ke,pot
  39. data i1st/0/
  40. save i1st
  41. c----
  42. c... Executable code
  43. c Compute and print initial ke,pot,energy and ang. mom.
  44. call anal_energy(nbod,mass,j2rp2,j4rp4,xh,yh,zh,
  45. & vxh,vyh,vzh,ke,pot,energy,eltot)
  46. energy = energy + eoff
  47. call io_energy_write(i1st,t,energy,eltot,iu,fopenstat)
  48. if(i1st.eq.0) then
  49. i1st=1
  50. endif
  51. return
  52. end !anal_energy_write
  53. c--------------------------------------------------------------------------