source: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_cal_mod.F90 @ 3895

Last change on this file since 3895 was 3895, checked in by ymipsl, 9 years ago

Make LMDZ5 be compliant to generate initiale state and compute in openMP mode suing unstructured grid.

YM

File size: 2.9 KB
Line 
1! $Id:$
2MODULE phys_cal_mod
3! This module contains information on the calendar at the actual time step
4
5  INTEGER,SAVE :: year_cur      ! current year
6!$OMP THREADPRIVATE(year_cur)
7  INTEGER,SAVE :: mth_cur       ! current month
8!$OMP THREADPRIVATE(mth_cur)
9  INTEGER,SAVE :: day_cur       ! current day
10!$OMP THREADPRIVATE(day_cur)
11  INTEGER,SAVE :: days_elapsed  ! number of whole days since start of the simulation
12!$OMP THREADPRIVATE(days_elapsed)
13  INTEGER,SAVE :: mth_len       ! number of days in the current month
14!$OMP THREADPRIVATE(mth_len)
15  INTEGER,SAVE :: year_len      ! number of days in the current year
16!$OMP THREADPRIVATE(year_len)
17  REAL,SAVE    :: hour
18!$OMP THREADPRIVATE(hour)
19  REAL,SAVE    :: jD_1jan
20!$OMP THREADPRIVATE(jD_1jan)
21  REAL,SAVE    :: jH_1jan
22!$OMP THREADPRIVATE(jH_1jan)
23  REAL,SAVE    :: xjour
24!$OMP THREADPRIVATE(xjour)
25  REAL,SAVE    :: jD_cur  ! jour courant a l'appel de la physique (jour julien)
26!$OMP THREADPRIVATE(jD_cur)
27  REAL,SAVE    :: jH_cur  ! heure courante a l'appel de la physique (jour julien)
28!$OMP THREADPRIVATE(jH_cur)
29  REAL,SAVE    :: jD_ref  ! jour du demarage de la simulation (jour julien)
30!$OMP THREADPRIVATE(jD_ref)
31 CHARACTER (len=10) :: calend ! type de calendrier
32!$OMP THREADPRIVATE(calend)
33
34
35CONTAINS
36 
37  SUBROUTINE phys_cal_init(annee_ref,day_ref)
38  USE IOIPSL, ONLY:  ymds2ju, getin, ioconf_calendar
39  USE mod_phys_lmdz_para, ONLY:  is_master,is_omp_master,bcast
40  IMPLICIT NONE
41    INTEGER,INTENT(IN) :: annee_ref
42    INTEGER,INTENT(IN) :: day_ref
43
44    !Config  Key  = calend
45    !Config  Desc = type de calendrier utilise
46    !Config  Def  = earth_360d
47    !Config  Help = valeur possible: earth_360d, earth_365d, earth_366d
48    !Config         
49    calend = 'earth_360d'
50
51    IF (is_master) CALL getin('calend', calend)
52    CALL bcast(calend)
53
54    IF (is_omp_master) THEN
55      IF (calend == 'earth_360d') THEN
56        CALL ioconf_calendar('360d')
57      ELSE IF (calend == 'earth_365d') THEN
58        CALL ioconf_calendar('noleap')
59      ELSE IF (calend == 'earth_366d') THEN
60        CALL ioconf_calendar('gregorian')
61      ELSE
62        CALL abort_physic('phys_cal_init','Mauvais choix de calendrier',1)
63      ENDIF
64    ENDIF
65
66    CALL ymds2ju(annee_ref, 1, day_ref, 0., jD_ref)
67    jD_ref=INT(jD_ref)
68 
69  END SUBROUTINE  phys_cal_init
70 
71 
72  SUBROUTINE phys_cal_update(julian_day)
73    ! This subroutine updates the module saved variables.
74    USE IOIPSL, only: ju2ymds, ymds2ju, ioget_mon_len, ioget_year_len
75    REAL, INTENT(IN) :: julian_day
76
77
78    jD_cur=INT(julian_day)
79    jH_cur=julian_day-jD_cur
80   
81    CALL ju2ymds(jD_cur+jH_cur, year_cur, mth_cur, day_cur, hour)
82    CALL ymds2ju(year_cur, 1, 1, 0., jD_1jan)
83   
84    jH_1jan = jD_1jan - int (jD_1jan)
85    jD_1jan = int (jD_1jan)
86    xjour = jD_cur - jD_1jan
87    days_elapsed = jD_cur - jD_1jan
88
89    ! Get lenght of acutual month
90    mth_len = ioget_mon_len(year_cur,mth_cur)
91
92    year_len = ioget_year_len(year_cur)
93
94  END SUBROUTINE phys_cal_update
95
96END MODULE phys_cal_mod
Note: See TracBrowser for help on using the repository browser.