source: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/time_phylmdz_mod.f90 @ 3835

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

Some missing threadprivate...

YM

File size: 3.0 KB
Line 
1MODULE time_phylmdz_mod
2
3    REAL,SAVE    :: pdtphys     ! physics time step (s)
4!$OMP THREADPRIVATE(pdtphys)
5    INTEGER,SAVE :: day_step    ! number of physical steps per day
6!$OMP THREADPRIVATE(day_step)
7    INTEGER,SAVE :: ndays       ! number of days to run
8!$OMP THREADPRIVATE(ndays)
9    INTEGER,SAVE :: annee_ref   ! reference year from the origin
10!$OMP THREADPRIVATE(annee_ref)
11    INTEGER,SAVE :: day_ref     ! reference year of the origin
12!$OMP THREADPRIVATE(day_ref)
13    INTEGER,SAVE :: day_ini     ! initial day of the run starting from 1st january of annee_ref
14!$OMP THREADPRIVATE(day_ini)
15    INTEGER,SAVE :: day_end     ! final day of the run starting from 1st january of annee_ref
16!$OMP THREADPRIVATE(day_end)
17    REAL,SAVE    :: start_time  ! starting time from the begining of the initial day
18!$OMP THREADPRIVATE(start_time)
19    INTEGER,SAVE :: raz_date
20!$OMP THREADPRIVATE(raz_date)
21
22    INTEGER,SAVE :: itau_phy     ! number of physiq iteration from origin
23!$OMP THREADPRIVATE(itau_phy)
24    INTEGER,SAVE :: itaufin      ! final iteration
25!$OMP THREADPRIVATE(itaufin)
26    REAL,SAVE    :: current_time ! current elapsed time (s) from the begining of the run
27!$OMP THREADPRIVATE(current_time)
28   
29
30CONTAINS
31
32  SUBROUTINE init_time(annee_ref_, day_ref_, day_ini_, start_time_, ndays_, pdtphys_)
33  USE ioipsl, ONLY : getin
34  USE phys_cal_mod, ONLY: phys_cal_init
35  USE mod_phys_lmdz_para
36  IMPLICIT NONE
37  INCLUDE 'YOMCST.h'
38    INTEGER, INTENT(IN) :: annee_ref_ 
39    INTEGER, INTENT(IN) :: day_ref_   
40    INTEGER, INTENT(IN) :: day_ini_   
41    REAL,    INTENT(IN) :: start_time_
42    INTEGER, INTENT(IN) :: ndays_     
43    REAL,    INTENT(IN) :: pdtphys_   
44   
45    annee_ref    = annee_ref_
46    day_ref      = day_ref_
47    day_ini      = day_ini_
48    start_time   = start_time_
49    ndays        = ndays_
50    pdtphys      = pdtphys_
51   
52    day_step = NINT(rday/pdtphys)
53    day_end  = day_ini + ndays
54 
55    raz_date = 0
56    IF (is_master) CALL getin('raz_date', raz_date)
57    CALL bcast(raz_date)
58    current_time=0
59   
60    CALL phys_cal_init(annee_ref,day_ref)
61   
62  END SUBROUTINE init_time
63 
64  SUBROUTINE init_iteration(itau_phy_)
65  IMPLICIT NONE
66    INTEGER, INTENT(IN) :: itau_phy_
67    itau_phy=itau_phy_
68    IF (raz_date==1) itau_phy=0
69   
70    itaufin=itau_phy+NINT(ndays/pdtphys)
71   
72  END SUBROUTINE init_iteration
73
74  SUBROUTINE set_timestep(pdtphys_)
75  USE ioipsl, ONLY : ymds2ju
76  USE phys_cal_mod, ONLY: phys_cal_update
77  USE print_control_mod, ONLY: lunout
78  IMPLICIT NONE
79    REAL,INTENT(IN) :: pdtphys_
80    REAL            :: julian_day
81   
82   
83    IF ( ABS( (pdtphys-pdtphys_) / ((pdtphys+pdtphys_)/2))> 10.*EPSILON(pdtphys_)) THEN
84       WRITE(lunout,*) "WARNING ! Pas de temps physique varie d'un appel a l'autre",pdtphys_,pdtphys
85       WRITE(lunout,*) "Cela peu occasionner des dysfonctionnements"
86    ENDIF
87    pdtphys=pdtphys_
88    current_time=current_time+pdtphys
89    CALL ymds2ju(annee_ref,1,day_ini,start_time+current_time,julian_day)
90    CALL phys_cal_update(julian_day)
91   
92  END SUBROUTINE set_timestep
93     
94END MODULE time_phylmdz_mod     
95       
96   
Note: See TracBrowser for help on using the repository browser.