[4190] | 1 | MODULE astronomy |
---|
[4229] | 2 | |
---|
[4194] | 3 | #include "use_logging.h" |
---|
| 4 | |
---|
[4190] | 5 | IMPLICIT NONE |
---|
| 6 | SAVE |
---|
[4176] | 7 | |
---|
[4190] | 8 | REAL :: aphelie, periheli, year_day, peri_day, obliquit, & |
---|
| 9 | timeperi, e_elips,p_elips |
---|
| 10 | REAL, PARAMETER :: unitastr=149.597927, & ! millions of km |
---|
| 11 | pi=2.*ASIN(1.) |
---|
[4192] | 12 | |
---|
[4190] | 13 | CONTAINS |
---|
[4229] | 14 | |
---|
[4190] | 15 | SUBROUTINE solarlong(pday,psollong) |
---|
[4233] | 16 | REAL, INTENT(IN) :: pday ! jour de l annee (le jour 0 correspondant a l equinoxe) |
---|
[4210] | 17 | REAL, INTENT(OUT) :: psollong ! solar longitude |
---|
[4190] | 18 | LOGICAL, PARAMETER :: lwrite=.TRUE. |
---|
[4176] | 19 | |
---|
[4229] | 20 | ! Local: |
---|
| 21 | ! ------ |
---|
[4190] | 22 | REAL zanom,xref,zx0,zdx,zteta,zz |
---|
| 23 | INTEGER iter |
---|
[4176] | 24 | |
---|
[4229] | 25 | !-------------------------------------------------------- |
---|
[4233] | 26 | ! calcul de l angle polaire et de la distance au soleil : |
---|
[4229] | 27 | ! ------------------------------------------------------- |
---|
[4176] | 28 | |
---|
[4233] | 29 | ! calcul de l zanomalie moyenne |
---|
[4176] | 30 | |
---|
[4190] | 31 | zz=(pday-peri_day)/year_day |
---|
| 32 | zanom=2.*pi*(zz-nint(zz)) |
---|
| 33 | xref=abs(zanom) |
---|
[4176] | 34 | |
---|
[4233] | 35 | ! resolution de l equation horaire zx0 - e * sin (zx0) = xref |
---|
[4229] | 36 | ! methode de Newton |
---|
| 37 | |
---|
[4190] | 38 | zx0=xref+e_elips*sin(xref) |
---|
| 39 | DO iter=1,10 |
---|
| 40 | zdx=-(zx0-e_elips*sin(zx0)-xref)/(1.-e_elips*cos(zx0)) |
---|
| 41 | zx0=zx0+zdx |
---|
| 42 | END DO |
---|
| 43 | zx0=zx0+zdx |
---|
| 44 | if(zanom.lt.0.) zx0=-zx0 |
---|
[4229] | 45 | |
---|
[4190] | 46 | ! zteta est la longitude solaire |
---|
[4229] | 47 | |
---|
[4190] | 48 | zteta=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.)) |
---|
[4229] | 49 | |
---|
[4190] | 50 | psollong=zteta-timeperi |
---|
[4229] | 51 | |
---|
[4190] | 52 | IF(psollong.LT.0.) psollong=psollong+2.*pi |
---|
| 53 | IF(psollong.GT.2.*pi) psollong=psollong-2.*pi |
---|
| 54 | !----------------------------------------------------------------------- |
---|
| 55 | ! sorties eventuelles: |
---|
| 56 | ! --------------------- |
---|
[4229] | 57 | |
---|
[4190] | 58 | IF (lwrite) THEN |
---|
[4210] | 59 | WRITELOG(*,*) 'day of the year :',pday |
---|
| 60 | WRITELOG(*,*) 'solar longitude : ',psollong |
---|
| 61 | LOG_DBG('solarlong') |
---|
[4190] | 62 | ENDIF |
---|
[4229] | 63 | |
---|
[4190] | 64 | END SUBROUTINE solarlong |
---|
[4229] | 65 | |
---|
[4191] | 66 | SUBROUTINE iniorbit |
---|
| 67 | !======================================================================= |
---|
| 68 | ! |
---|
| 69 | ! Auteur: |
---|
| 70 | ! ------- |
---|
| 71 | ! Frederic Hourdin 22 Fevrier 1991 |
---|
| 72 | ! |
---|
| 73 | ! Objet: |
---|
| 74 | ! ------ |
---|
| 75 | ! Initialisation du sous programme orbite qui calcule |
---|
[4233] | 76 | ! a une date donnee de l annee de duree year_day commencant |
---|
| 77 | ! a l equinoxe de printemps et dont le perihelie se situe |
---|
[4191] | 78 | ! a la date peri_day, la distance au soleil et la declinaison. |
---|
| 79 | ! |
---|
| 80 | ! Interface: |
---|
| 81 | ! ---------- |
---|
| 82 | ! - initialise certaines variables de ce module |
---|
[4233] | 83 | ! - Doit etre appele avant d utiliser orbite. |
---|
[4191] | 84 | ! |
---|
| 85 | ! Arguments: |
---|
| 86 | ! ---------- |
---|
| 87 | ! |
---|
| 88 | ! Input: |
---|
| 89 | ! ------ |
---|
[4233] | 90 | ! aphelie \ aphelie et perihelie de l orbite |
---|
[4191] | 91 | ! periheli / en millions de kilometres. |
---|
| 92 | ! |
---|
| 93 | !======================================================================= |
---|
[4229] | 94 | |
---|
[4191] | 95 | !----------------------------------------------------------------------- |
---|
[4229] | 96 | |
---|
[4191] | 97 | ! Local: |
---|
| 98 | ! ------ |
---|
| 99 | REAL zxref,zanom,zz,zx0,zdx |
---|
| 100 | INTEGER iter |
---|
[4229] | 101 | |
---|
[4191] | 102 | !----------------------------------------------------------------------- |
---|
[4229] | 103 | |
---|
[4194] | 104 | WRITELOG(*,*) 'Perihelie en Mkm ',periheli |
---|
[4229] | 105 | WRITELOG(*,*) 'Aphelise en Mkm ',aphelie |
---|
[4194] | 106 | WRITELOG(*,*) 'obliquite en degres :',obliquit |
---|
[4229] | 107 | |
---|
[4191] | 108 | e_elips=(aphelie-periheli)/(periheli+aphelie) |
---|
| 109 | p_elips=0.5*(periheli+aphelie)*(1-e_elips*e_elips)/unitastr |
---|
[4229] | 110 | |
---|
[4194] | 111 | WRITELOG(*,*) 'e_elips',e_elips |
---|
| 112 | WRITELOG(*,*) 'p_elips',p_elips |
---|
| 113 | |
---|
[4191] | 114 | !----------------------------------------------------------------------- |
---|
[4233] | 115 | ! calcul de l angle polaire et de la distance au soleil : |
---|
[4191] | 116 | ! ------------------------------------------------------- |
---|
[4229] | 117 | |
---|
[4233] | 118 | ! calcul de l zanomalie moyenne |
---|
[4229] | 119 | |
---|
[4191] | 120 | zz=(year_day-peri_day)/year_day |
---|
| 121 | zanom=2.*pi*(zz-nint(zz)) |
---|
| 122 | zxref=abs(zanom) |
---|
[4194] | 123 | WRITELOG(*,*) 'zanom ',zanom |
---|
[4229] | 124 | |
---|
[4233] | 125 | ! resolution de l equation horaire zx0 - e * sin (zx0) = zxref |
---|
[4191] | 126 | ! methode de Newton |
---|
[4229] | 127 | |
---|
[4191] | 128 | zx0=zxref+e_elips*sin(zxref) |
---|
| 129 | DO iter=1,100 |
---|
| 130 | zdx=-(zx0-e_elips*sin(zx0)-zxref)/(1.-e_elips*cos(zx0)) |
---|
| 131 | zx0=zx0+zdx |
---|
| 132 | END DO |
---|
[4229] | 133 | |
---|
[4191] | 134 | zx0=zx0+zdx |
---|
| 135 | if(zanom.lt.0.) zx0=-zx0 |
---|
[4194] | 136 | WRITELOG(*,*) 'zx0 ',zx0 |
---|
[4229] | 137 | |
---|
[4191] | 138 | ! zteta est la longitude solaire |
---|
[4229] | 139 | |
---|
[4191] | 140 | timeperi=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.)) |
---|
[4194] | 141 | WRITELOG(*,*) 'longitude solaire du perihelie timeperi = ',timeperi |
---|
[4229] | 142 | |
---|
[4199] | 143 | LOG_INFO('iniorbit') |
---|
[4229] | 144 | |
---|
[4191] | 145 | END SUBROUTINE iniorbit |
---|
| 146 | |
---|
[4192] | 147 | PURE SUBROUTINE orbite(pls,pdist_sol,pdecli) |
---|
| 148 | !======================================================================= |
---|
| 149 | ! |
---|
| 150 | ! Objet: |
---|
| 151 | ! ------ |
---|
| 152 | ! |
---|
| 153 | ! Distance from sun and declimation as a function of the solar |
---|
| 154 | ! longitude Ls |
---|
| 155 | ! |
---|
| 156 | ! Arguments: |
---|
| 157 | ! ---------- |
---|
| 158 | ! |
---|
| 159 | ! Input: |
---|
| 160 | ! ------ |
---|
| 161 | ! pls Ls |
---|
| 162 | ! |
---|
| 163 | ! Output: |
---|
| 164 | ! ------- |
---|
| 165 | ! pdist_sol Distance Sun-Planet in UA |
---|
| 166 | ! pdecli declinaison ( en radians ) |
---|
| 167 | ! |
---|
| 168 | !======================================================================= |
---|
| 169 | !----------------------------------------------------------------------- |
---|
| 170 | ! Declarations: |
---|
| 171 | ! ------------- |
---|
[4229] | 172 | |
---|
[4192] | 173 | ! arguments: |
---|
| 174 | ! ---------- |
---|
| 175 | |
---|
| 176 | REAL, INTENT(IN) :: pls |
---|
| 177 | REAL, INTENT(OUT) :: pdist_sol,pdecli |
---|
[4229] | 178 | |
---|
[4192] | 179 | !----------------------------------------------------------------------- |
---|
[4229] | 180 | |
---|
[4192] | 181 | ! Distance Sun-Planet |
---|
[4229] | 182 | |
---|
[4192] | 183 | pdist_sol=p_elips/(1.+e_elips*cos(pls+timeperi)) |
---|
[4229] | 184 | |
---|
[4192] | 185 | ! Solar declination |
---|
[4229] | 186 | |
---|
[4192] | 187 | pdecli= asin (sin(pls)*sin(obliquit*pi/180.)) |
---|
[4229] | 188 | |
---|
[4192] | 189 | END SUBROUTINE orbite |
---|
| 190 | |
---|
[4190] | 191 | END MODULE astronomy |
---|