1 |
C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_readparms.F,v 1.14 2012/04/07 15:44:49 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CAL_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE CAL_READPARMS( myThid ) |
7 |
|
8 |
C ================================================================== |
9 |
C SUBROUTINE cal_readparms |
10 |
C ================================================================== |
11 |
C o This routine initialises the calendar according to the user |
12 |
C specifications in "data.calendar". |
13 |
C |
14 |
C started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
15 |
C changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
16 |
C - restructured the original version in order to have a |
17 |
C better interface to the MITgcmUV. |
18 |
C |
19 |
C Christian Eckert eckert@mit.edu 10-Jan-2000 |
20 |
C - Modified namelist input. The data file is first copied |
21 |
C to scrunit1 with the comment lines being left out. |
22 |
C After this, scrunit1 is used to read the namelist data. |
23 |
C |
24 |
C Christian Eckert eckert@mit.edu 19-Jan-2000 |
25 |
C - Changed the role of the routine arguments. Chris Hill |
26 |
C proposed to make the calendar less "invasive". The tool |
27 |
C now assumes that the MITgcmUV already provides an ade- |
28 |
C quate set of time stepping parameters. The calendar |
29 |
C only associates a date with the given starttime of the |
30 |
C numerical model. startdate corresponds to zero start- |
31 |
C time. So, given niter0 or startdate .ne. zero the actual |
32 |
C startdate of the current integration is shifted by the |
33 |
C time interval correponding to niter0, startdate respec- |
34 |
C tively. |
35 |
C |
36 |
C Christian Eckert eckert@mit.edu 03-Feb-2000 |
37 |
C - Introduced new routine and function names, cal_<NAME>, |
38 |
C for verion 0.1.3. |
39 |
C ================================================================== |
40 |
C SUBROUTINE cal_readparms |
41 |
C ================================================================== |
42 |
|
43 |
IMPLICIT NONE |
44 |
|
45 |
C == global variables == |
46 |
#include "SIZE.h" |
47 |
#include "EEPARAMS.h" |
48 |
#include "PARAMS.h" |
49 |
#include "cal.h" |
50 |
|
51 |
C == routine arguments == |
52 |
C myThid :: my Thread Id number |
53 |
INTEGER myThid |
54 |
|
55 |
C == local variables == |
56 |
INTEGER iUnit |
57 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
58 |
|
59 |
C == end of interface == |
60 |
|
61 |
C Calendar parameters |
62 |
NAMELIST /CAL_NML/ |
63 |
& TheCalendar, |
64 |
& startDate_1, startDate_2, |
65 |
& calendarDumps |
66 |
|
67 |
#ifdef ALLOW_DEBUG |
68 |
IF (debugMode) CALL DEBUG_ENTER('CAL_READPARMS',myThid) |
69 |
#endif |
70 |
|
71 |
IF ( .NOT.useCAL ) THEN |
72 |
C- pkg CAL is not used |
73 |
_BEGIN_MASTER(myThid) |
74 |
C- Track pkg activation status: |
75 |
cal_setStatus = -1 |
76 |
C print a (weak) warning if data.cal is found |
77 |
CALL PACKAGES_UNUSED_MSG( 'useCAL', ' ', ' ' ) |
78 |
_END_MASTER(myThid) |
79 |
RETURN |
80 |
ENDIF |
81 |
|
82 |
_BEGIN_MASTER(myThid) |
83 |
|
84 |
C Initialise the calendar parameters |
85 |
cal_setStatus = 0 |
86 |
TheCalendar = ' ' |
87 |
startdate_1 = 0 |
88 |
startdate_2 = 0 |
89 |
calendarDumps = .FALSE. |
90 |
|
91 |
C Next, read the calendar data file. |
92 |
WRITE(msgBuf,'(A)') 'CAL_READPARMS: opening data.cal' |
93 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
94 |
& SQUEEZE_RIGHT , 1) |
95 |
|
96 |
CALL OPEN_COPY_DATA_FILE( |
97 |
I 'data.cal', 'CAL_READPARMS', |
98 |
O iUnit, |
99 |
I myThid ) |
100 |
READ(unit = iUnit, nml = cal_nml) |
101 |
WRITE(msgBuf,'(A)') |
102 |
& 'CAL_READPARMS: finished reading data.cal' |
103 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
104 |
& SQUEEZE_RIGHT , 1) |
105 |
CLOSE( iUnit ) |
106 |
|
107 |
_END_MASTER(myThid) |
108 |
|
109 |
C Everyone else must wait for the parameters to be loaded |
110 |
_BARRIER |
111 |
|
112 |
#ifdef ALLOW_DEBUG |
113 |
IF (debugMode) CALL DEBUG_LEAVE('CAL_READPARMS',myThid) |
114 |
#endif |
115 |
|
116 |
RETURN |
117 |
END |