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

Last change on this file since 2636 was 2544, checked in by maronga, 7 years ago

introduced new module date_and_time_mod

  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1!> @file date_and_time_mod.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
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 2544 2017-10-13 18:09:32Z raasch $
27! Initial revision
28!
29!
30
31!
32! Description:
33! ------------
34!> This routine calculates all needed information on date and time used by
35!> other modules
36!------------------------------------------------------------------------------!
37 MODULE date_and_time_mod
38 
39    USE control_parameters,                                                    &
40        ONLY: time_since_reference_point 
41 
42    USE kinds
43
44    IMPLICIT NONE
45
46    PRIVATE
47   
48    PUBLIC   calc_date_and_time, d_hours_day, d_seconds_hour, d_seconds_year,  &
49             day_of_year, day_of_year_init, time_utc, time_utc_init
50
51
52    INTEGER(iwp) ::  day_of_year              !< day of the year (DOY)
53    INTEGER(iwp) ::  day_of_year_init = 172   !< DOY at model start (default: 21 June)
54
55    REAL(wp) ::  time_utc                     !< current model time in UTC
56    REAL(wp) ::  time_utc_init = 43200.0_wp   !< UTC time at model start
57
58    REAL(wp), PARAMETER ::  d_hours_day    = 0.0416666666667_wp    !< inverse of hours per day (1/24)
59    REAL(wp), PARAMETER ::  d_seconds_hour = 0.000277777777778_wp   !< inverse of seconds per hour (1/3600)
60    REAL(wp), PARAMETER ::  d_seconds_year = 31536000.0_wp          !< inverse of the seconds per year (1/(365*86400))
61   
62    SAVE
63
64 CONTAINS
65
66!------------------------------------------------------------------------------!
67! Description:
68! ------------
69!> Calculate current day of the year and time in UTC
70!------------------------------------------------------------------------------!
71 
72    SUBROUTINE calc_date_and_time
73
74       IMPLICIT NONE
75
76!
77!--    Calculate current day of the year
78       day_of_year = day_of_year_init + INT(FLOOR( (time_utc_init + time_since_reference_point)&
79                               / 86400.0_wp ), KIND=iwp)
80                       
81       time_utc = MOD((time_utc_init + time_since_reference_point), 86400.0_wp)
82       
83       
84
85    END SUBROUTINE calc_date_and_time
86
87
88
89 END MODULE date_and_time_mod
Note: See TracBrowser for help on using the repository browser.