| 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 | PRINT*,'iniorbit: Periastron in AU ',periastr |
|---|
| 35 | PRINT*,'iniorbit: Apoastron in AU ',apoastr |
|---|
| 36 | PRINT*,'iniorbit: Obliquity in degrees :',obliquit |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | e_elips=(apoastr-periastr)/(periastr+apoastr) |
|---|
| 40 | p_elips=0.5*(periastr+apoastr)*(1-e_elips*e_elips) |
|---|
| 41 | |
|---|
| 42 | print*,'iniorbit: e_elips',e_elips |
|---|
| 43 | print*,'iniorbit: p_elips',p_elips |
|---|
| 44 | |
|---|
| 45 | !----------------------------------------------------------------------- |
|---|
| 46 | ! compute polar angle and distance to the Sun: |
|---|
| 47 | ! ------------------------------------------------------- |
|---|
| 48 | |
|---|
| 49 | ! compute mean anomaly zanom |
|---|
| 50 | |
|---|
| 51 | zz=(year_day-pperi_day)/year_day |
|---|
| 52 | zanom=2.*pi*(zz-nint(zz)) |
|---|
| 53 | zxref=abs(zanom) |
|---|
| 54 | PRINT*,'iniorbit: zanom ',zanom |
|---|
| 55 | |
|---|
| 56 | ! solve equation zx0 - e * sin (zx0) = zxref for eccentric anomaly zx0 |
|---|
| 57 | ! using Newton method |
|---|
| 58 | |
|---|
| 59 | zx0=zxref+e_elips*sin(zxref) |
|---|
| 60 | DO iter=1,100 |
|---|
| 61 | zdx=-(zx0-e_elips*sin(zx0)-zxref)/(1.-e_elips*cos(zx0)) |
|---|
| 62 | if(abs(zdx).le.(1.e-12)) exit |
|---|
| 63 | zx0=zx0+zdx |
|---|
| 64 | ENDDO |
|---|
| 65 | |
|---|
| 66 | zx0=zx0+zdx |
|---|
| 67 | if(zanom.lt.0.) zx0=-zx0 |
|---|
| 68 | PRINT*,'iniorbit: zx0 ',zx0 |
|---|
| 69 | |
|---|
| 70 | timeperi=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.)) |
|---|
| 71 | PRINT*,'iniorbit: Perihelion solar long. Ls (deg)=', |
|---|
| 72 | & 360.-timeperi*180./pi |
|---|
| 73 | |
|---|
| 74 | END |
|---|