Back to home page

darwin3

 
 

    


Warning, /doc/phys_pkgs/cal.rst is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 8679f909 on 2018-02-08 22:03:01 UTC
8679f9097b Jeff*0001 .. _sub_phys_pkg_cal:
                0002 
                0003 CAL: The calendar package
                0004 -------------------------
                0005 
                0006 
                0007 Authors: Christian Eckert and Patrick Heimbach
                0008 
                0009 This calendar tool was originally intended to enable the use of absolute
                0010 dates (Gregorian Calendar dates) in MITgcm. There is, however, a fair
                0011 number of routines that can be used independently of the main MITgcm
                0012 executable. After some minor modifications the whole package can be used
                0013 either as a stand-alone calendar or in connection with any dynamical
                0014 model that needs calendar dates. Some straightforward extensions are
                0015 still pending e.g. the availability of the Julian Calendar, to be able
                0016 to resolve fractions of a second, and to have a time- step that is
                0017 longer than one day.
                0018 
                0019 Basic assumptions for the calendar tool
                0020 #######################################
                0021 
                0022 It is assumed that the SMALLEST TIME INTERVAL to be resolved is ONE
                0023 SECOND.
                0024 
                0025 Further assumptions are that there is an INTEGER NUMBER OF MODEL STEPS
                0026 EACH DAY, and that AT LEAST ONE STEP EACH DAY is made.
                0027 
                0028 Not each individual routine depends on these assumptions; there are only
                0029 a few places where they enter.
                0030 
                0031 Format of calendar dates
                0032 ########################
                0033 
                0034 In this calendar tool a complete date specification is defined as the
                0035 following integer array:
                0036 
                0037 ::
                0038 
                0039     c           integer date(4)
                0040     c
                0041     c           ( yyyymmdd, hhmmss, leap_year, dayofweek )
                0042     c
                0043     c             date(1) = yyyymmdd    <-- Year-Month-Day
                0044     c             date(2) =   hhmmss    <-- Hours-Minutes-Seconds
                0045     c             date(3) = leap_year   <-- Leap Year/No Leap Year
                0046     c             date(4) = dayofweek   <-- Day of the Week
                0047     c
                0048     c             leap_year is either equal to 1 (normal year)
                0049     c                              or equal to 2 (leap year)
                0050     c
                0051     c             dayofweek has a range of 1 to 7.
                0052 
                0053 In case the Gregorian Calendar is used, the first day of the week is
                0054 Friday, since day of the Gregorian Calendar was Friday, 15 Oct. 1582. As
                0055 a date array this date would be specified as
                0056 
                0057 ::
                0058 
                0059     c               refdate(1) = 15821015
                0060     c               refdate(2) =        0
                0061     c               refdate(3) =        1
                0062     c               refdate(4) =        1
                0063 
                0064 Calendar dates and time intervals
                0065 #################################
                0066 
                0067 Subtracting calendar dates yields time intervals. Time intervals have
                0068 the following format:
                0069 
                0070 ::
                0071 
                0072     c         integer datediff(4)
                0073     c
                0074     c           datediff(1) = # Days
                0075     c           datediff(2) = hhmmss
                0076     c           datediff(3) =      0
                0077     c           datediff(4) =     -1
                0078 
                0079 Such time intervals can be added to or can be subtracted from calendar
                0080 dates. Time intervals can be added to and be subtracted from each other.
                0081 
                0082 Using the calendar together with MITgcm
                0083 #######################################
                0084 
                0085 Each routine has as an argument the thread number that it is belonging
                0086 to, even if this number is not used in the routine itself.
                0087 
                0088 In order to include the calendar tool into the MITgcm setup the MITgcm
                

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 90.

0089 subroutine “initialise.F” or the routine “initilise\_fixed.F”, depending 0090 on the MITgcm release, has to be modified in the following way: 0091 0092 :: 0093 0094 c #ifdef ALLOW_CALENDAR 0095 c C-- Initialise the calendar package. 0096 c #ifdef USE_CAL_NENDITER 0097 c CALL cal_Init( 0098 c I startTime, 0099 c I endTime, 0100 c I deltaTclock, 0101 c I nIter0, 0102 c I nEndIter, 0103 c I nTimeSteps, 0104 c I myThid 0105 c & ) 0106 c #else 0107 c CALL cal_Init( 0108 c I startTime, 0109 c I endTime, 0110 c I deltaTclock, 0111 c I nIter0, 0112 c I nTimeSteps, 0113 c I myThid 0114 c & ) 0115 c #endif 0116 c _BARRIER 0117 c #endif 0118 0119 It is useful to have the CPP flag ALLOW\_CALENDAR in order to switch 0120 from the usual MITgcm setup to the one that includes the calendar tool. 0121 The CPP flag USE\_CAL\_NENDITER has been introduced in order to enable 0122 the use of the calendar for MITgcm releases earlier than checkpoint 25 0123 which do not have the global variable \*nEndIter\*. 0124 0125 The individual calendars 0126 ######################## 0127 0128 Simple model calendar: 0129 0130 This calendar can be used by defining 0131 0132 :: 0133 0134 c TheCalendar='model' 0135

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 137.

0136 in the calendar’s data file “data.cal”. 0137 0138 In this case a year is assumed to have 360 days. The model year is 0139 divided into 12 months with 30 days each. 0140 0141 Gregorian Calendar: 0142 0143 This calendar can be used by defining 0144 0145 :: 0146 0147 c TheCalendar='gregorian' 0148

** Warning **

Wide character in print at /usr/local/share/lxr/source line 1030, <$git> line 150.

0149 in the calendar’s data file “data.cal”. 0150 0151 Short routine description 0152 ######################### 0153 0154 :: 0155 0156 c o cal_Init - Initialise the calendar. This is the interface 0157 c to MITgcm. 0158 c 0159 c o cal_Set - Sets the calendar according to the user 0160 c specifications. 0161 c 0162 c o cal_GetDate - Given the model's current timestep or the 0163 c model's current time return the corresponding 0164 c calendar date. 0165 c 0166 c o cal_FullDate - Complete a date specification (leap year and 0167 c day of the week). 0168 c 0169 c o cal_IsLeap - Determine whether a given year is a leap year. 0170 c 0171 c o cal_TimePassed - Determine the time passed between two dates. 0172 c 0173 c o cal_AddTime - Add a time interval either to a time interval 0174 c or to a date. 0175 c 0176 c o cal_TimeInterval - Given a time interval return the corresponding 0177 c date array. 0178 c 0179 c o cal_SubDates - Determine the time interval between two dates 0180 c or between two time intervals. 0181 c 0182 c o cal_ConvDate - Decompose a date array or a time interval 0183 c array into its components. 0184 c 0185 c o cal_CopyDate - Copy a date array or a time interval array to 0186 c another array. 0187 c 0188 c o cal_CompDates - Compare two calendar dates or time intervals. 0189 c 0190 c o cal_ToSeconds - Given a time interval array return the number 0191 c of seconds. 0192 c 0193 c o cal_WeekDay - Return the weekday as a string given the 0194 c calendar date. 0195 c 0196 c o cal_NumInts - Return the number of time intervals between two 0197 c given dates. 0198 c 0199 c o cal_StepsPerDay - Given an iteration number or the current 0200 c integration time return the number of time 0201 c steps to integrate in the current calendar day. 0202 c 0203 c o cal_DaysPerMonth - Given an iteration number or the current 0204 c integration time return the number of days 0205 c to integrate in this calendar month. 0206 c 0207 c o cal_MonthsPerYear - Given an iteration number or the current 0208 c integration time return the number of months 0209 c to integrate in the current calendar year. 0210 c 0211 c o cal_StepsForDay - Given the integration day return the number 0212 c of steps to be integrated, the first step, 0213 c and the last step in the day specified. The 0214 c first and the last step refer to the total 0215 c number of steps (1, ... , cal_IntSteps). 0216 c 0217 c o cal_DaysForMonth - Given the integration month return the number 0218 c of days to be integrated, the first day, 0219 c and the last day in the month specified. The 0220 c first and the last day refer to the total 0221 c number of steps (1, ... , cal_IntDays). 0222 c 0223 c o cal_MonthsForYear - Given the integration year return the number 0224 c of months to be integrated, the first month, 0225 c and the last month in the year specified. The 0226 c first and the last step refer to the total 0227 c number of steps (1, ... , cal_IntMonths). 0228 c 0229 c o cal_Intsteps - Return the number of calendar years that are 0230 c affected by the current integration. 0231 c 0232 c o cal_IntDays - Return the number of calendar days that are 0233 c affected by the current integration. 0234 c 0235 c o cal_IntMonths - Return the number of calendar months that are 0236 c affected by the current integration. 0237 c 0238 c o cal_IntYears - Return the number of calendar years that are 0239 c affected by the current integration. 0240 c 0241 c o cal_nStepDay - Return the number of time steps that can be 0242 c performed during one calendar day. 0243 c 0244 c o cal_CheckDate - Do some simple checks on a date array or on a 0245 c time interval array. 0246 c 0247 c o cal_PrintError - Print error messages according to the flags 0248 c raised by the calendar routines. 0249 c 0250 c o cal_PrintDate - Print a date array in some format suitable for 0251 c MITgcm's protocol output. 0252 c 0253 c o cal_TimeStamp - Given the time and the iteration number return 0254 c the date and print all the above numbers. 0255 c 0256 c o cal_Summary - List all the setttings of the calendar tool. 0257 0258 0259 Experiments and tutorials that use cal 0260 ###################################### 0261 0262 - Global ocean experiment in global\_with\_exf verification directory. 0263 0264 - Labrador Sea experiment in lab\_sea verification directory. 0265 0266