/[MITgcm]/manual/s_phys_pkgs/text/cal.tex
ViewVC logotype

Annotation of /manual/s_phys_pkgs/text/cal.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (hide annotations) (download) (as text)
Wed Apr 5 02:27:33 2006 UTC (19 years, 3 months ago) by edhill
Branch: MAIN
Changes since 1.3: +10 -11 lines
File MIME type: application/x-tex
refer to the model uniformly as "MITgcm" and treat it as a proper noun

1 molod 1.2 \subsection{CAL: The calendar package
2 heimbach 1.1 \label{sectioncal}}
3     \begin{rawhtml}
4     <!-- CMIREDIR:sectioncal: -->
5     \end{rawhtml}
6    
7 heimbach 1.3 Authors: Christian Eckert and Patrick Heimbach
8 heimbach 1.1
9     This calendar tool was originally intended to enable the use of
10 edhill 1.4 absolute dates (Gregorian Calendar dates) in MITgcm. There is,
11     however, a fair number of routines that can be used independently of
12     the main MITgcm executable. After some minor modifications the whole
13     package can be used either as a stand-alone calendar or in connection
14     with any dynamical model that needs calendar dates. Some
15     straightforward extensions are still pending e.g. the availability of
16     the Julian Calendar, to be able to resolve fractions of a second, and
17     to have a time- step that is longer than one day.
18 heimbach 1.1
19 molod 1.2 \subsubsection{Basic assumptions for the calendar tool}
20 heimbach 1.1
21     It is assumed that the SMALLEST TIME INTERVAL to be resolved is
22     ONE SECOND.
23    
24     Further assumptions are that there is an INTEGER NUMBER OF
25     MODEL STEPS EACH DAY, and that AT LEAST ONE STEP EACH DAY is
26     made.
27    
28     Not each individual routine depends on these assumptions; there
29     are only a few places where they enter.
30    
31 molod 1.2 \subsubsection{Format of calendar dates}
32 heimbach 1.1
33     In this calendar tool a complete date specification is defined
34     as the following integer array:
35    
36     \begin{verbatim}
37     c integer date(4)
38     c
39     c ( yyyymmdd, hhmmss, leap_year, dayofweek )
40     c
41     c date(1) = yyyymmdd <-- Year-Month-Day
42     c date(2) = hhmmss <-- Hours-Minutes-Seconds
43     c date(3) = leap_year <-- Leap Year/No Leap Year
44     c date(4) = dayofweek <-- Day of the Week
45     c
46     c leap_year is either equal to 1 (normal year)
47     c or equal to 2 (leap year)
48     c
49     c dayofweek has a range of 1 to 7.
50     \end{verbatim}
51    
52     In case the Gregorian Calendar is used, the first
53     day of the week is Friday, since day of the Gregorian
54     Calendar was Friday, 15 Oct. 1582. As a date array
55     this date would be specified as
56    
57     \begin{verbatim}
58     c refdate(1) = 15821015
59     c refdate(2) = 0
60     c refdate(3) = 1
61     c refdate(4) = 1
62     \end{verbatim}
63    
64 molod 1.2 \subsubsection{Calendar dates and time intervals}
65 heimbach 1.1
66     Subtracting calendar dates yields time intervals.
67     Time intervals have the following format:
68    
69     \begin{verbatim}
70     c integer datediff(4)
71     c
72     c datediff(1) = # Days
73     c datediff(2) = hhmmss
74     c datediff(3) = 0
75     c datediff(4) = -1
76     \end{verbatim}
77    
78     Such time intervals can be added to or can be subtracted from
79     calendar dates. Time intervals can be added to and be
80     subtracted from each other.
81    
82 molod 1.2 \subsubsection{Using the calendar together with MITgcm}
83 heimbach 1.1
84     Each routine has as an argument the thread number that it is
85     belonging to, even if this number is not used in the routine
86     itself.
87    
88     In order to include the calendar tool into the MITgcm
89     setup the MITgcm subroutine "initialise.F" or the routine
90     "initilise\_fixed.F", depending on the MITgcm release, has
91     to be modified in the following way:
92    
93     {\footnotesize
94     \begin{verbatim}
95     c #ifdef ALLOW_CALENDAR
96     c C-- Initialise the calendar package.
97     c #ifdef USE_CAL_NENDITER
98     c CALL cal_Init(
99     c I startTime,
100     c I endTime,
101     c I deltaTclock,
102     c I nIter0,
103     c I nEndIter,
104     c I nTimeSteps,
105     c I myThid
106     c & )
107     c #else
108     c CALL cal_Init(
109     c I startTime,
110     c I endTime,
111     c I deltaTclock,
112     c I nIter0,
113     c I nTimeSteps,
114     c I myThid
115     c & )
116     c #endif
117     c _BARRIER
118     c #endif
119     \end{verbatim}
120     }
121    
122     It is useful to have the CPP flag ALLOW\_CALENDAR in
123     order to switch from the usual MITgcm setup to the
124     one that includes the calendar tool. The CPP flag
125     USE\_CAL\_NENDITER has been introduced in order to enable
126     the use of the calendar for MITgcm releases earlier
127     than checkpoint 25 which do not have the global variable
128     *nEndIter*.
129    
130 molod 1.2 \subsubsection{The individual calendars}
131 heimbach 1.1
132 molod 1.2 Simple model calendar:
133 heimbach 1.1
134     This calendar can be used by defining
135    
136     \begin{verbatim}
137     c TheCalendar='model'
138     \end{verbatim}
139    
140     in the calendar's data file "data.cal".
141    
142     In this case a year is assumed to have 360 days. The
143     model year is divided into 12 months with 30 days each.
144    
145 molod 1.2 Gregorian Calendar:
146 heimbach 1.1
147     This calendar can be used by defining
148    
149     \begin{verbatim}
150     c TheCalendar='gregorian'
151     \end{verbatim}
152    
153     in the calendar's data file "data.cal".
154    
155 molod 1.2 \subsubsection{Short routine description}
156 heimbach 1.1
157     {\footnotesize
158     \begin{verbatim}
159     c o cal_Init - Initialise the calendar. This is the interface
160 edhill 1.4 c to MITgcm.
161 heimbach 1.1 c
162     c o cal_Set - Sets the calendar according to the user
163     c specifications.
164     c
165     c o cal_GetDate - Given the model's current timestep or the
166     c model's current time return the corresponding
167     c calendar date.
168     c
169     c o cal_FullDate - Complete a date specification (leap year and
170     c day of the week).
171     c
172     c o cal_IsLeap - Determine whether a given year is a leap year.
173     c
174     c o cal_TimePassed - Determine the time passed between two dates.
175     c
176     c o cal_AddTime - Add a time interval either to a time interval
177     c or to a date.
178     c
179     c o cal_TimeInterval - Given a time interval return the corresponding
180     c date array.
181     c
182     c o cal_SubDates - Determine the time interval between two dates
183     c or between two time intervals.
184     c
185     c o cal_ConvDate - Decompose a date array or a time interval
186     c array into its components.
187     c
188     c o cal_CopyDate - Copy a date array or a time interval array to
189     c another array.
190     c
191     c o cal_CompDates - Compare two calendar dates or time intervals.
192     c
193     c o cal_ToSeconds - Given a time interval array return the number
194     c of seconds.
195     c
196     c o cal_WeekDay - Return the weekday as a string given the
197     c calendar date.
198     c
199     c o cal_NumInts - Return the number of time intervals between two
200     c given dates.
201     c
202     c o cal_StepsPerDay - Given an iteration number or the current
203     c integration time return the number of time
204     c steps to integrate in the current calendar day.
205     c
206     c o cal_DaysPerMonth - Given an iteration number or the current
207     c integration time return the number of days
208     c to integrate in this calendar month.
209     c
210     c o cal_MonthsPerYear - Given an iteration number or the current
211     c integration time return the number of months
212     c to integrate in the current calendar year.
213     c
214     c o cal_StepsForDay - Given the integration day return the number
215     c of steps to be integrated, the first step,
216     c and the last step in the day specified. The
217     c first and the last step refer to the total
218     c number of steps (1, ... , cal_IntSteps).
219     c
220     c o cal_DaysForMonth - Given the integration month return the number
221     c of days to be integrated, the first day,
222     c and the last day in the month specified. The
223     c first and the last day refer to the total
224     c number of steps (1, ... , cal_IntDays).
225     c
226     c o cal_MonthsForYear - Given the integration year return the number
227     c of months to be integrated, the first month,
228     c and the last month in the year specified. The
229     c first and the last step refer to the total
230     c number of steps (1, ... , cal_IntMonths).
231     c
232     c o cal_Intsteps - Return the number of calendar years that are
233     c affected by the current integration.
234     c
235     c o cal_IntDays - Return the number of calendar days that are
236     c affected by the current integration.
237     c
238     c o cal_IntMonths - Return the number of calendar months that are
239     c affected by the current integration.
240     c
241     c o cal_IntYears - Return the number of calendar years that are
242     c affected by the current integration.
243     c
244     c o cal_nStepDay - Return the number of time steps that can be
245     c performed during one calendar day.
246     c
247     c o cal_CheckDate - Do some simple checks on a date array or on a
248     c time interval array.
249     c
250     c o cal_PrintError - Print error messages according to the flags
251     c raised by the calendar routines.
252     c
253     c o cal_PrintDate - Print a date array in some format suitable for
254 edhill 1.4 c MITgcm's protocol output.
255 heimbach 1.1 c
256     c o cal_TimeStamp - Given the time and the iteration number return
257     c the date and print all the above numbers.
258     c
259     c o cal_Summary - List all the setttings of the calendar tool.
260     \end{verbatim}
261     }
262    

  ViewVC Help
Powered by ViewVC 1.1.22