source: codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iniorbit.F @ 298

Last change on this file since 298 was 298, checked in by milmd, 10 years ago

Less output messages are written. On 20000 cores it is better. In LMDZ, only master of MPI and OpenMP can write.

File size: 3.6 KB
Line 
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 mod_phys_lmdz_para, only : is_master
7      IMPLICIT NONE
8
9c=======================================================================
10c
11c   Auteur:
12c   -------
13c     Frederic Hourdin      22 Fevrier 1991
14c
15c   Objet:
16c   ------
17c    Initialisation du sous programme orbite qui calcule
18c    a une date donnee de l'annee de duree year_day commencant
19c    a l'equinoxe de printemps et dont le periastre se situe
20c    a la date peri_day, la distance au soleil et la declinaison.
21c
22c   Interface:
23c   ----------
24c   - Doit etre appele avant d'utiliser orbite.
25c   - initialise une partie du common planete_mod
26c
27c   Arguments:
28c   ----------
29c
30c   Input:
31c   ------
32c   apoastr       \   apoastron and periastron of the orbit in AU
33c   periastr      /   
34c
35c=======================================================================
36
37c-----------------------------------------------------------------------
38c   Declarations:
39c   -------------
40
41!#include "planete.h"
42#include "comcstfi.h"
43
44c   Arguments:
45c   ----------
46
47      REAL papoastr,pperiastr,pyear_day,pperi_day,pobliq
48
49c   Local:
50c   ------
51
52      REAL zxref,zanom,zz,zx0,zdx
53      INTEGER iter
54
55c-----------------------------------------------------------------------
56
57      pi=2.*asin(1.)
58
59      apoastr =papoastr
60      periastr=pperiastr
61      year_day=pyear_day
62      obliquit=pobliq
63      peri_day=pperi_day
64
65
66      !!!! SPARADRAP TEMPORAIRE !!!!
67      !!!! SPARADRAP TEMPORAIRE !!!!
68      !!!! We hope that all cases are above 25 Mkm [OK with Gliese 581d]
69      IF ( apoastr .gt. 25.) THEN
70        IF (is_master) THEN
71        PRINT*,'!!!!! WARNING !!!!!'
72        PRINT*,'!!!!! YOU ARE ABOUT TO WITNESS A DIRT HACK !!!!!'
73        PRINT*,'This must be an old start file.'
74        PRINT*,'The code changed 19/03/2012: we now use AU.'
75        PRINT*,'So I am assuming units are in Mkm here'
76        PRINT*,'and I am performing a conversion towards AU.'
77        END IF
78        periastr = periastr / 149.598 ! Mkm to AU
79        apoastr = apoastr / 149.598 ! Mkm to AU
80      ENDIF
81      !!!! SPARADRAP TEMPORAIRE !!!!
82      !!!! SPARADRAP TEMPORAIRE !!!!
83
84 
85      IF (is_master) PRINT*,'Periastron in AU  ',periastr
86      IF (is_master) PRINT*,'Apoastron in AU  ',apoastr 
87      IF (is_master) PRINT*,'Obliquity in degrees  :',obliquit
88
89
90      e_elips=(apoastr-periastr)/(periastr+apoastr)
91      p_elips=0.5*(periastr+apoastr)*(1-e_elips*e_elips)
92
93      IF (is_master) print*,'e_elips',e_elips
94      IF (is_master) print*,'p_elips',p_elips
95
96c-----------------------------------------------------------------------
97c calcul de l'angle polaire et de la distance au soleil :
98c -------------------------------------------------------
99
100c  calcul de l'zanomalie moyenne
101
102      zz=(year_day-pperi_day)/year_day
103      zanom=2.*pi*(zz-nint(zz))
104      zxref=abs(zanom)
105      IF (is_master) PRINT*,'zanom  ',zanom
106
107c  resolution de l'equation horaire  zx0 - e * sin (zx0) = zxref
108c  methode de Newton
109
110      zx0=zxref+e_elips*sin(zxref)
111      DO 110 iter=1,100
112         zdx=-(zx0-e_elips*sin(zx0)-zxref)/(1.-e_elips*cos(zx0))
113         if(abs(zdx).le.(1.e-12)) goto 120
114         zx0=zx0+zdx
115110   continue
116120   continue
117      zx0=zx0+zdx
118      if(zanom.lt.0.) zx0=-zx0
119      IF (is_master) PRINT*,'zx0   ',zx0
120
121c zteta est la longitude solaire
122
123      timeperi=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.))
124      IF (is_master) PRINT*,'Solar longitude of periastron',
125     &          ' timeperi = ',timeperi
126
127      RETURN
128      END
Note: See TracBrowser for help on using the repository browser.