venus.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "astro.h"
  10. void
  11. venus(void)
  12. {
  13. double pturbl, pturbb, pturbr;
  14. double lograd;
  15. double dele, enom, vnom, nd, sl;
  16. double v0, t0, m0, j0, s0;
  17. double lsun, elong, ci, dlong;
  18. /*
  19. * here are the mean orbital elements
  20. */
  21. ecc = .00682069 - .00004774*capt + 0.091e-6*capt2;
  22. incl = 3.393631 + .0010058*capt - 0.97e-6*capt2;
  23. node = 75.779647 + .89985*capt + .00041*capt2;
  24. argp = 130.163833 + 1.408036*capt - .0009763*capt2;
  25. mrad = .7233316;
  26. anom = 212.603219 + 1.6021301540*eday + .00128605*capt2;
  27. motion = 1.6021687039;
  28. /*
  29. * mean anomalies of perturbing planets
  30. */
  31. v0 = 212.60 + 1.602130154*eday;
  32. t0 = 358.63 + .985608747*eday;
  33. m0 = 319.74 + 0.524032490*eday;
  34. j0 = 225.43 + .083090842*eday;
  35. s0 = 175.8 + .033459258*eday;
  36. v0 *= radian;
  37. t0 *= radian;
  38. m0 *= radian;
  39. j0 *= radian;
  40. s0 *= radian;
  41. incl *= radian;
  42. node *= radian;
  43. argp *= radian;
  44. anom = fmod(anom, 360.)*radian;
  45. /*
  46. * computation of long period terms affecting the mean anomaly
  47. */
  48. anom +=
  49. (2.761-0.022*capt)*radsec*sin(
  50. 13.*t0 - 8.*v0 + 43.83*radian + 4.52*radian*capt)
  51. + 0.268*radsec*cos(4.*m0 - 7.*t0 + 3.*v0)
  52. + 0.019*radsec*sin(4.*m0 - 7.*t0 + 3.*v0)
  53. - 0.208*radsec*sin(s0 + 1.4*radian*capt);
  54. /*
  55. * computation of elliptic orbit
  56. */
  57. enom = anom + ecc*sin(anom);
  58. do {
  59. dele = (anom - enom + ecc * sin(enom)) /
  60. (1 - ecc*cos(enom));
  61. enom += dele;
  62. } while(fabs(dele) > converge);
  63. vnom = 2*atan2(sqrt((1+ecc)/(1-ecc))*sin(enom/2),
  64. cos(enom/2));
  65. rad = mrad*(1 - ecc*cos(enom));
  66. lambda = vnom + argp;
  67. /*
  68. * perturbations in longitude
  69. */
  70. icosadd(venfp, vencp);
  71. pturbl = cosadd(4, v0, t0, m0, j0);
  72. pturbl *= radsec;
  73. /*
  74. * perturbations in latidude
  75. */
  76. pturbb = cosadd(3, v0, t0, j0);
  77. pturbb *= radsec;
  78. /*
  79. * perturbations in log radius vector
  80. */
  81. pturbr = cosadd(4, v0, t0, m0, j0);
  82. /*
  83. * reduction to the ecliptic
  84. */
  85. lambda += pturbl;
  86. nd = lambda - node;
  87. lambda = node + atan2(sin(nd)*cos(incl),cos(nd));
  88. sl = sin(incl)*sin(nd);
  89. beta = atan2(sl, pyth(sl)) + pturbb;
  90. lograd = pturbr*2.30258509;
  91. rad *= 1 + lograd;
  92. motion *= radian*mrad*mrad/(rad*rad);
  93. /*
  94. * computation of magnitude
  95. */
  96. lsun = 99.696678 + 0.9856473354*eday;
  97. lsun *= radian;
  98. elong = lambda - lsun;
  99. ci = (rad - cos(elong))/sqrt(1 + rad*rad - 2*rad*cos(elong));
  100. dlong = atan2(pyth(ci), ci)/radian;
  101. mag = -4 + .01322*dlong + .0000004247*dlong*dlong*dlong;
  102. semi = 8.41;
  103. helio();
  104. geo();
  105. }