source: palm/trunk/SOURCE/date_and_time_mod.f90 @ 2701

Last change on this file since 2701 was 2701, checked in by suehring, 4 years ago

changes from last commit documented

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1!> @file date_and_time_mod.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2017 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: date_and_time_mod.f90 2701 2017-12-15 15:40:50Z suehring $
27! Bugfix in definition of d_seconds_year.
28!
29! 2698 2017-12-14 18:46:24Z suehring
30! Initial revision
31!
32!
33
34!
35! Description:
36! ------------
37!> This routine calculates all needed information on date and time used by
38!> other modules
39!------------------------------------------------------------------------------!
40 MODULE date_and_time_mod
41 
42    USE control_parameters,                                                    &
43        ONLY: time_since_reference_point
44 
45    USE kinds
46
47    IMPLICIT NONE
48
49    PRIVATE
50   
51    PUBLIC   calc_date_and_time, d_hours_day, d_seconds_hour, d_seconds_year,  &
52             day_of_year, day_of_year_init, time_utc, time_utc_init
53
54
55    INTEGER(iwp) ::  day_of_year              !< day of the year (DOY)
56    INTEGER(iwp) ::  day_of_year_init = 172   !< DOY at model start (default: 21 June)
57
58    REAL(wp) ::  time_utc                     !< current model time in UTC
59    REAL(wp) ::  time_utc_init = 43200.0_wp   !< UTC time at model start
60
61    REAL(wp), PARAMETER ::  d_hours_day    = 1.0_wp / 24.0_wp       !< inverse of hours per day (1/24)
62    REAL(wp), PARAMETER ::  d_seconds_hour = 1.0_wp / 3600.0_wp     !< inverse of seconds per hour (1/3600)
63    REAL(wp), PARAMETER ::  d_seconds_year = 1.0_wp / 31536000.0_wp !< inverse of the seconds per year (1/(365*86400))
64   
65    SAVE
66
67 CONTAINS
68
69!------------------------------------------------------------------------------!
70! Description:
71! ------------
72!> Calculate current day of the year and time in UTC
73!------------------------------------------------------------------------------!
74 
75    SUBROUTINE calc_date_and_time
76
77       IMPLICIT NONE
78
79!
80!--    Calculate current day of the year
81       day_of_year = day_of_year_init + INT(FLOOR( (time_utc_init + time_since_reference_point)&
82                               / 86400.0_wp ), KIND=iwp)
83                       
84       time_utc = MOD((time_utc_init + time_since_reference_point), 86400.0_wp)
85       
86       
87
88    END SUBROUTINE calc_date_and_time
89
90
91
92 END MODULE date_and_time_mod
Note: See TracBrowser for help on using the repository browser.