comet.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #include "astro.h"
  2. #define MAXE (.999) /* cant do hyperbolas */
  3. void
  4. comet(void)
  5. {
  6. double pturbl, pturbb, pturbr;
  7. double lograd;
  8. double dele, enom, vnom, nd, sl;
  9. struct elem
  10. {
  11. double t; /* time of perihelion */
  12. double q; /* perihelion distance */
  13. double e; /* eccentricity */
  14. double i; /* inclination */
  15. double w; /* argument of perihelion */
  16. double o; /* longitude of ascending node */
  17. } elem;
  18. /* elem = (struct elem)
  19. {
  20. etdate(1990, 5, 19.293),
  21. 0.9362731,
  22. 0.6940149,
  23. 11.41096,
  24. 198.77059,
  25. 69.27130,
  26. }; /* p/schwassmann-wachmann 3, 1989d */
  27. /* elem = (struct elem)
  28. {
  29. etdate(1990, 4, 9.9761),
  30. 0.349957,
  31. 1.00038,
  32. 58.9596,
  33. 61.5546,
  34. 75.2132,
  35. }; /* austin 3, 1989c */
  36. /* elem = (struct elem)
  37. {
  38. etdate(1990, 10, 24.36),
  39. 0.9385,
  40. 1.00038,
  41. 131.62,
  42. 242.58,
  43. 138.57,
  44. }; /* levy 6 , 1990c */
  45. /* elem=(struct elem)
  46. {
  47. etdate(1996, 5, 1.3965),
  48. 0.230035,
  49. 0.999662,
  50. 124.9098,
  51. 130.2102,
  52. 188.0430,
  53. }; /* C/1996 B2 (Hyakutake) */
  54. /* elem=(struct elem)
  55. {
  56. etdate(1997, 4, 1.13413),
  57. 0.9141047,
  58. 0.9950989,
  59. 89.42932,
  60. 130.59066,
  61. 282.47069,
  62. }; /*C/1995 O1 (Hale-Bopp) */
  63. /* elem=(struct elem)
  64. {
  65. etdate(2000, 7, 26.1754),
  66. 0.765126,
  67. 0.999356,
  68. 149.3904,
  69. 151.0510,
  70. 83.1909,
  71. }; /*C/1999 S4 (Linear) */
  72. elem=(struct elem)
  73. {
  74. etdate(2002, 3, 18.9784),
  75. 0.5070601,
  76. 0.990111,
  77. 28.12106,
  78. 34.6666,
  79. 93.1206,
  80. }; /*C/2002 C1 (Ikeya-Zhang) */
  81. ecc = elem.e;
  82. if(ecc > MAXE)
  83. ecc = MAXE;
  84. incl = elem.i * radian;
  85. node = (elem.o + 0.4593) * radian;
  86. argp = (elem.w + elem.o + 0.4066) * radian;
  87. mrad = elem.q / (1-ecc);
  88. motion = .01720209895 * sqrt(1/(mrad*mrad*mrad))/radian;
  89. anom = (eday - (elem.t - 2415020)) * motion * radian;
  90. enom = anom + ecc*sin(anom);
  91. do {
  92. dele = (anom - enom + ecc * sin(enom)) /
  93. (1 - ecc*cos(enom));
  94. enom += dele;
  95. } while(fabs(dele) > converge);
  96. vnom = 2*atan2(
  97. sqrt((1+ecc)/(1-ecc))*sin(enom/2),
  98. cos(enom/2));
  99. rad = mrad*(1-ecc*cos(enom));
  100. lambda = vnom + argp;
  101. pturbl = 0;
  102. lambda += pturbl*radsec;
  103. pturbb = 0;
  104. pturbr = 0;
  105. /*
  106. * reduce to the ecliptic
  107. */
  108. nd = lambda - node;
  109. lambda = node + atan2(sin(nd)*cos(incl),cos(nd));
  110. sl = sin(incl)*sin(nd) + pturbb*radsec;
  111. beta = atan2(sl, sqrt(1-sl*sl));
  112. lograd = pturbr*2.30258509;
  113. rad *= 1 + lograd;
  114. motion *= radian*mrad*mrad/(rad*rad);
  115. semi = 0;
  116. mag = 5.47 + 6.1/2.303*log(rad);
  117. helio();
  118. geo();
  119. }