source: LMDZ6/trunk/libf/phylmd/phys_cal_mod.F90 @ 3847

Last change on this file since 3847 was 3452, checked in by Laurent Fairhead, 6 years ago

gregorian calendar option disappeared in latest commits
OB/LF

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:keywords set to Id
File size: 3.0 KB
RevLine 
[3435]1! $Id: phys_cal_mod.F90 3452 2019-01-28 09:45:20Z fairhead $
[1227]2MODULE phys_cal_mod
[2344]3! This module contains information on the calendar at the current time step
[1227]4
[2344]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)
[2802]11  INTEGER,SAVE :: days_elapsed  ! number of whole days since start of the current year
[2344]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)
[2491]17  REAL,SAVE    :: hour         ! seconds elapsed (in the current day) since midnight
[2344]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)
[2358]31 CHARACTER (len=10) :: calend ! type of calendar to use
32                              ! (can be earth_360d, earth_365d or earth_366d)
33!$OMP THREADPRIVATE(calend)
[1227]34
35CONTAINS
36 
[2344]37  SUBROUTINE phys_cal_init(annee_ref,day_ref)
[2802]38
[3435]39    USE IOIPSL, ONLY:  ymds2ju, ioconf_calendar
40    USE mod_phys_lmdz_para, ONLY:  is_master,is_omp_master
[2802]41    USE ioipsl_getin_p_mod, ONLY: getin_p
42
43    IMPLICIT NONE
[2344]44    INTEGER,INTENT(IN) :: annee_ref
45    INTEGER,INTENT(IN) :: day_ref
46
[2358]47    ! Find out which type of calendar we are using
48    calend = 'earth_360d' ! default
49    CALL getin_p("calend",calend)
[3435]50
51    IF (is_omp_master) THEN
52      IF (calend == 'earth_360d') THEN
53        CALL ioconf_calendar('360d')
54      ELSE IF (calend == 'earth_365d') THEN
55        CALL ioconf_calendar('noleap')
[3452]56      ELSE IF (calend == 'earth_366d' .OR. calend == 'gregorian') THEN
[3435]57        CALL ioconf_calendar('gregorian')
58      ELSE
59        CALL abort_physic('phys_cal_init','Mauvais choix de calendrier',1)
60      ENDIF
61    ENDIF
62!$OMP BARRIER
[2358]63     
[2344]64    CALL ymds2ju(annee_ref, 1, day_ref, 0., jD_ref)
65    jD_ref=INT(jD_ref)
66 
67  END SUBROUTINE  phys_cal_init
68
[2422]69  SUBROUTINE phys_cal_update(julian_date)
[1227]70    ! This subroutine updates the module saved variables.
71
[2098]72    USE IOIPSL, only: ju2ymds, ymds2ju, ioget_mon_len, ioget_year_len
[2422]73    IMPLICIT NONE
74    REAL, INTENT(IN) :: julian_date
75
76    jD_cur=INT(julian_date)
77    jH_cur=julian_date-jD_cur
[1227]78   
79    CALL ju2ymds(jD_cur+jH_cur, year_cur, mth_cur, day_cur, hour)
80    CALL ymds2ju(year_cur, 1, 1, 0., jD_1jan)
81   
82    jH_1jan = jD_1jan - int (jD_1jan)
83    jD_1jan = int (jD_1jan)
84    xjour = jD_cur - jD_1jan
85    days_elapsed = jD_cur - jD_1jan
86
[2422]87    ! Get lenght of current month
[1227]88    mth_len = ioget_mon_len(year_cur,mth_cur)
89
[2422]90    ! Get length of current year
[2098]91    year_len = ioget_year_len(year_cur)
92
[1227]93  END SUBROUTINE phys_cal_update
94
95END MODULE phys_cal_mod
Note: See TracBrowser for help on using the repository browser.