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