1 | ! $Id:$ |
---|
2 | MODULE phys_cal_mod |
---|
3 | ! This module contains information on the calendar at the actual time step |
---|
4 | |
---|
5 | SAVE |
---|
6 | |
---|
7 | INTEGER :: year_cur ! current year |
---|
8 | INTEGER :: mth_cur ! current month |
---|
9 | INTEGER :: day_cur ! current day |
---|
10 | INTEGER :: days_elapsed ! number of whole days since start of the simulation |
---|
11 | INTEGER :: mth_len ! number of days in the current month |
---|
12 | INTEGER :: year_len ! number of days in the current year |
---|
13 | REAL :: hour |
---|
14 | REAL :: jD_1jan |
---|
15 | REAL :: jH_1jan |
---|
16 | REAL :: xjour |
---|
17 | REAL :: jD_cur ! jour courant a l'appel de la physique (jour julien) |
---|
18 | REAL :: jH_cur ! heure courante a l'appel de la physique (jour julien) |
---|
19 | REAL :: jD_ref ! jour du demarage de la simulation (jour julien) |
---|
20 | |
---|
21 | |
---|
22 | CONTAINS |
---|
23 | |
---|
24 | SUBROUTINE phys_cal_init(annee_ref,day_ref) |
---|
25 | USE IOIPSL, ONLY: ymds2ju |
---|
26 | IMPLICIT NONE |
---|
27 | INTEGER,INTENT(IN) :: annee_ref |
---|
28 | INTEGER,INTENT(IN) :: day_ref |
---|
29 | |
---|
30 | CALL ymds2ju(annee_ref, 1, day_ref, 0., jD_ref) |
---|
31 | jD_ref=INT(jD_ref) |
---|
32 | |
---|
33 | END SUBROUTINE phys_cal_init |
---|
34 | |
---|
35 | |
---|
36 | SUBROUTINE phys_cal_update(julian_day) |
---|
37 | ! This subroutine updates the module saved variables. |
---|
38 | USE IOIPSL, only: ju2ymds, ymds2ju, ioget_mon_len, ioget_year_len |
---|
39 | REAL, INTENT(IN) :: julian_day |
---|
40 | |
---|
41 | |
---|
42 | jD_cur=INT(julian_day) |
---|
43 | jH_cur=julian_day-jD_cur |
---|
44 | |
---|
45 | CALL ju2ymds(jD_cur+jH_cur, year_cur, mth_cur, day_cur, hour) |
---|
46 | CALL ymds2ju(year_cur, 1, 1, 0., jD_1jan) |
---|
47 | |
---|
48 | jH_1jan = jD_1jan - int (jD_1jan) |
---|
49 | jD_1jan = int (jD_1jan) |
---|
50 | xjour = jD_cur - jD_1jan |
---|
51 | days_elapsed = jD_cur - jD_1jan |
---|
52 | |
---|
53 | ! Get lenght of acutual month |
---|
54 | mth_len = ioget_mon_len(year_cur,mth_cur) |
---|
55 | |
---|
56 | year_len = ioget_year_len(year_cur) |
---|
57 | |
---|
58 | END SUBROUTINE phys_cal_update |
---|
59 | |
---|
60 | END MODULE phys_cal_mod |
---|