source: trunk/LMDZ.COMMON/libf/evolution/NS_generalorbit.F90 @ 3493

Last change on this file since 3493 was 3493, checked in by jbclement, 3 weeks ago

PEM:

  • Renaming of Norbert Schorghofer's subroutines with the prefix 'NS_';
  • Making the extension of all NS's subroutines as '.F90';
  • Deletion of the wrapper subroutine;
  • Making the initialization, variables management and arguments of the main subroutine for the dynamic computation of ice table to be more suitable.

JBC

File size: 1.6 KB
Line 
1!=============================================================
2! Subroutine to return distance, longitude, and declination of
3! the sun in planetocentric coordinates from orbital elements
4!
5! INPUTS:
6! edays = time since perihelion (earth days)
7! a = semimajor axis (AU)
8! ecc = eccentricity
9! omega = Ls of perihelion, relative to equinox (radians)
10! eps = obliquity (radians)
11!
12! OUTPUTS:
13! Ls = areocentric longitude (radians)
14! dec = planetocentric solar declination (radians)
15! r = heliocentric distance (AU)
16!=============================================================
17
18      SUBROUTINE generalorbit(edays,a,ecc,omega,eps,Ls,dec,r)
19      implicit none
20      real*8 edays,a,ecc,omega,eps  ! input
21      real*8 Ls,dec,r  ! output
22      real*8 pi,d2r
23      parameter (pi=3.1415926535897932,d2r=pi/180.d0)
24      integer j
25      real*8 M,E,nu,T,Eold
26
27!     T = orbital period (days)
28      T = sqrt(4*pi**2/(6.674e-11*1.989e30)*(a*149.598e9)**3)/86400.
29
30!     M = mean anomaly (radians)
31      M = 2.*pi*edays/T  ! M=0 at perihelion
32
33!     E = eccentric anomaly
34!     solve M = E - ecc*sin(E) by newton method
35      E = M
36      do j=1,10
37         Eold = E
38         E = E - (E - ecc*sin(E) - M)/(1.-ecc*cos(E))
39         if (abs(E-Eold)<1.e-8) exit
40      enddo
41
42!     nu = true anomaly
43      !nu = acos(cos(E)-ecc/(1.-ecc*cos(E)))
44      !nu = sqrt(1-ecc^2)*sin(E)/(1.-ecc*cos(E))
45      !nu = atan(sqrt(1-ecc^2)*sin(E)/(1-cos(E)))
46      nu = 2.*atan(sqrt((1.+ecc)/(1.-ecc))*tan(E/2.))
47
48      !r = a*(1.-ecc**2)/(1.+ecc*cos(nu))
49      r = a*(1-ecc*cos(E))
50      Ls = mod(nu + omega,2.*pi)   
51      dec = asin(sin(eps)*sin(Ls))
52
53      END
54
Note: See TracBrowser for help on using the repository browser.