1 | SUBROUTINE iniorbit |
---|
2 | $ (papoastr,pperiastr,pyear_day,pperi_day,pobliq) |
---|
3 | |
---|
4 | USE planete_mod, only: apoastr, periastr, year_day, obliquit, |
---|
5 | & peri_day, e_elips, p_elips, timeperi |
---|
6 | use comcstfi_mod, only: pi |
---|
7 | IMPLICIT NONE |
---|
8 | |
---|
9 | !======================================================================= |
---|
10 | ! Initialisation of orbital parameters (stored in planete_h module) |
---|
11 | !======================================================================= |
---|
12 | |
---|
13 | c Arguments: |
---|
14 | c ---------- |
---|
15 | |
---|
16 | REAL,INTENT(IN) :: papoastr,pperiastr,pyear_day,pperi_day,pobliq |
---|
17 | |
---|
18 | c Local: |
---|
19 | c ------ |
---|
20 | |
---|
21 | REAL zxref,zanom,zz,zx0,zdx |
---|
22 | INTEGER iter |
---|
23 | |
---|
24 | c----------------------------------------------------------------------- |
---|
25 | |
---|
26 | pi=2.*asin(1.) |
---|
27 | |
---|
28 | apoastr =papoastr |
---|
29 | periastr=pperiastr |
---|
30 | year_day=pyear_day |
---|
31 | obliquit=pobliq |
---|
32 | peri_day=pperi_day |
---|
33 | |
---|
34 | |
---|
35 | !!!! SPARADRAP TEMPORAIRE !!!! |
---|
36 | !!!! SPARADRAP TEMPORAIRE !!!! |
---|
37 | !!!! We hope that all cases are above 25 Mkm [OK with Gliese 581d] |
---|
38 | IF ( apoastr .gt. 25.) THEN |
---|
39 | PRINT*,'!!!!! WARNING !!!!!' |
---|
40 | PRINT*,'!!!!! YOU ARE ABOUT TO WITNESS A DIRT HACK !!!!!' |
---|
41 | PRINT*,'This must be an old start file.' |
---|
42 | PRINT*,'The code changed 19/03/2012: we now use AU.' |
---|
43 | PRINT*,'So I am assuming units are in Mkm here' |
---|
44 | PRINT*,'and I am performing a conversion towards AU.' |
---|
45 | periastr = periastr / 149.598 ! Mkm to AU |
---|
46 | apoastr = apoastr / 149.598 ! Mkm to AU |
---|
47 | ENDIF |
---|
48 | !!!! SPARADRAP TEMPORAIRE !!!! |
---|
49 | !!!! SPARADRAP TEMPORAIRE !!!! |
---|
50 | |
---|
51 | |
---|
52 | PRINT*,'iniorbit: Periastron in AU ',periastr |
---|
53 | PRINT*,'iniorbit: Apoastron in AU ',apoastr |
---|
54 | PRINT*,'iniorbit: Obliquity in degrees :',obliquit |
---|
55 | |
---|
56 | |
---|
57 | e_elips=(apoastr-periastr)/(periastr+apoastr) |
---|
58 | p_elips=0.5*(periastr+apoastr)*(1-e_elips*e_elips) |
---|
59 | |
---|
60 | print*,'iniorbit: e_elips',e_elips |
---|
61 | print*,'iniorbit: p_elips',p_elips |
---|
62 | |
---|
63 | !----------------------------------------------------------------------- |
---|
64 | ! compute polar angle and distance to the Sun: |
---|
65 | ! ------------------------------------------------------- |
---|
66 | |
---|
67 | ! compute mean anomaly zanom |
---|
68 | |
---|
69 | zz=(year_day-pperi_day)/year_day |
---|
70 | zanom=2.*pi*(zz-nint(zz)) |
---|
71 | zxref=abs(zanom) |
---|
72 | PRINT*,'iniorbit: zanom ',zanom |
---|
73 | |
---|
74 | ! solve equation zx0 - e * sin (zx0) = zxref for eccentric anomaly zx0 |
---|
75 | ! using Newton method |
---|
76 | |
---|
77 | zx0=zxref+e_elips*sin(zxref) |
---|
78 | DO iter=1,100 |
---|
79 | zdx=-(zx0-e_elips*sin(zx0)-zxref)/(1.-e_elips*cos(zx0)) |
---|
80 | if(abs(zdx).le.(1.e-12)) exit |
---|
81 | zx0=zx0+zdx |
---|
82 | ENDDO |
---|
83 | |
---|
84 | zx0=zx0+zdx |
---|
85 | if(zanom.lt.0.) zx0=-zx0 |
---|
86 | PRINT*,'iniorbit: zx0 ',zx0 |
---|
87 | |
---|
88 | timeperi=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.)) |
---|
89 | PRINT*,'iniorbit: Perihelion solar long. Ls (deg)=', |
---|
90 | & 360.-timeperi*180./pi |
---|
91 | |
---|
92 | END |
---|