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

Last change on this file since 2874 was 2718, checked in by maronga, 7 years ago

deleting of deprecated files; headers updated where needed

  • Property svn:keywords set to Id
File size: 3.2 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-2018 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: date_and_time_mod.f90 2718 2018-01-02 08:49:38Z knoop $
27! Corrected "Former revisions" section
28!
29! 2701 2017-12-15 15:40:50Z suehring
30! Changes from last commit documented
31!
32! 2698 2017-12-14 18:46:24Z suehring
33! Bugfix in definition of d_seconds_year.
34!
35! 2696 2017-12-14 17:12:51Z kanani
36! Change in file header (GPL part)
37!
38! 2544 2017-10-13 18:09:32Z maronga
39! Initial revision
40!
41!
42
43!
44! Description:
45! ------------
46!> This routine calculates all needed information on date and time used by
47!> other modules
48!------------------------------------------------------------------------------!
49 MODULE date_and_time_mod
50 
51    USE control_parameters,                                                    &
52        ONLY: time_since_reference_point 
53 
54    USE kinds
55
56    IMPLICIT NONE
57
58    PRIVATE
59   
60    PUBLIC   calc_date_and_time, d_hours_day, d_seconds_hour, d_seconds_year,  &
61             day_of_year, day_of_year_init, time_utc, time_utc_init
62
63
64    INTEGER(iwp) ::  day_of_year              !< day of the year (DOY)
65    INTEGER(iwp) ::  day_of_year_init = 172   !< DOY at model start (default: 21 June)
66
67    REAL(wp) ::  time_utc                     !< current model time in UTC
68    REAL(wp) ::  time_utc_init = 43200.0_wp   !< UTC time at model start
69
70    REAL(wp), PARAMETER ::  d_hours_day    = 1.0_wp / 24.0_wp       !< inverse of hours per day (1/24)
71    REAL(wp), PARAMETER ::  d_seconds_hour = 1.0_wp / 3600.0_wp     !< inverse of seconds per hour (1/3600)
72    REAL(wp), PARAMETER ::  d_seconds_year = 1.0_wp / 31536000.0_wp !< inverse of the seconds per year (1/(365*86400))
73   
74    SAVE
75
76 CONTAINS
77
78!------------------------------------------------------------------------------!
79! Description:
80! ------------
81!> Calculate current day of the year and time in UTC
82!------------------------------------------------------------------------------!
83 
84    SUBROUTINE calc_date_and_time
85
86       IMPLICIT NONE
87
88!
89!--    Calculate current day of the year
90       day_of_year = day_of_year_init + INT(FLOOR( (time_utc_init + time_since_reference_point)&
91                               / 86400.0_wp ), KIND=iwp)
92                       
93       time_utc = MOD((time_utc_init + time_since_reference_point), 86400.0_wp)
94       
95       
96
97    END SUBROUTINE calc_date_and_time
98
99
100
101 END MODULE date_and_time_mod
Note: See TracBrowser for help on using the repository browser.