1 |
C $Header: /u/gcmpack/MITgcm/pkg/runclock/runclock_readparms.F,v 1.3 2014/05/28 00:13:16 jmc Exp $ |
2 |
C $Name: BASE $ |
3 |
|
4 |
#include "RUNCLOCK_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE RUNCLOCK_READPARMS( myThid ) |
7 |
C *==========================================================* |
8 |
C | SUBROUTINE RUNCLOCK_READPARMS | |
9 |
C *==========================================================* |
10 |
IMPLICIT NONE |
11 |
|
12 |
C === Global variables === |
13 |
#include "EEPARAMS.h" |
14 |
#include "SIZE.h" |
15 |
#include "PARAMS.h" |
16 |
#include "RUNCLOCK.h" |
17 |
|
18 |
C === Routine arguments === |
19 |
INTEGER myThid |
20 |
|
21 |
#ifdef ALLOW_RUNCLOCK |
22 |
C === Local variables === |
23 |
C msgBuf - Informational/error message buffer |
24 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
25 |
INTEGER iUnit |
26 |
INTEGER tSecs |
27 |
|
28 |
C-- RUNCLOCK parameters |
29 |
NAMELIST /RUNCLOCK/ |
30 |
& RC_maxtime_hr, |
31 |
& RC_maxtime_mi, |
32 |
& RC_maxtime_sc |
33 |
|
34 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
35 |
|
36 |
IF ( .NOT.useRunClock ) THEN |
37 |
C- pkg RUNCLOCK is not used |
38 |
_BEGIN_MASTER(myThid) |
39 |
C- Track pkg activation status: |
40 |
RUNCLOCKIsOn = .FALSE. |
41 |
C print a (weak) warning if data.runclock is found |
42 |
CALL PACKAGES_UNUSED_MSG( 'useRunClock', ' ', ' ' ) |
43 |
_END_MASTER(myThid) |
44 |
RETURN |
45 |
ENDIF |
46 |
|
47 |
RUNCLOCKIsOn = .TRUE. |
48 |
|
49 |
_BEGIN_MASTER(myThid) |
50 |
|
51 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: opening data.runclock' |
52 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
53 |
& SQUEEZE_RIGHT , 1) |
54 |
|
55 |
CALL OPEN_COPY_DATA_FILE( |
56 |
I 'data.runclock', 'RUNCLOCK_READPARMS', |
57 |
O iUnit, |
58 |
I myThid ) |
59 |
|
60 |
C-- Default values for RUNCLOCK |
61 |
RC_maxtime_hr=0 |
62 |
RC_maxtime_mi=0 |
63 |
RC_maxtime_sc=0 |
64 |
|
65 |
C-- Read parameters from open data file |
66 |
READ(UNIT=iUnit,NML=RUNCLOCK) |
67 |
|
68 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: read data.runclock done' |
69 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
70 |
& SQUEEZE_RIGHT , 1) |
71 |
|
72 |
C-- Close the open data file |
73 |
#ifdef SINGLE_DISK_IO |
74 |
CLOSE(iUnit) |
75 |
#else |
76 |
CLOSE(iUnit,STATUS='DELETE') |
77 |
#endif /* SINGLE_DISK_IO */ |
78 |
|
79 |
IF (RC_maxtime_hr.LT.0) THEN |
80 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: ERR! RC_maxtime_hr<0' |
81 |
CALL PRINT_ERROR( msgBuf, myThid ) |
82 |
ENDIF |
83 |
IF (RC_maxtime_mi.LT.0) THEN |
84 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: ERR! RC_maxtime_mi<0' |
85 |
CALL PRINT_ERROR( msgBuf, myThid ) |
86 |
ENDIF |
87 |
IF (RC_maxtime_sc.LT.0) THEN |
88 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: ERR! RC_maxtime_sc<0' |
89 |
CALL PRINT_ERROR( msgBuf, myThid ) |
90 |
ENDIF |
91 |
IF (RC_maxtime_sc.GT.59 .AND. RC_maxtime_mi.NE.0) THEN |
92 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: ERR! RC_maxtime_sc>59' |
93 |
CALL PRINT_ERROR( msgBuf, myThid ) |
94 |
ENDIF |
95 |
IF (RC_maxtime_mi.GT.59 .AND. RC_maxtime_hr.NE.0) THEN |
96 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: ERR! RC_maxtime_mi>59' |
97 |
CALL PRINT_ERROR( msgBuf, myThid ) |
98 |
ENDIF |
99 |
|
100 |
tSecs=(RC_maxtime_hr*60+RC_maxtime_mi)*60+RC_maxtime_sc |
101 |
IF (tSecs.EQ.0) THEN |
102 |
WRITE(msgBuf,'(A)') ' RUNCLOCK_READPARMS: no Wall Clock limit set' |
103 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
104 |
& SQUEEZE_RIGHT , 1) |
105 |
c write(0,*) ' RUNCLOCK_READPARMS: no Wall Clock limit set' |
106 |
ELSE |
107 |
WRITE(msgBuf,'(A,I7)') |
108 |
& ' RUNCLOCK_READPARMS: Wall Clock limit set to ',tSecs |
109 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
110 |
& SQUEEZE_RIGHT , 1) |
111 |
c write(0,*) ' RUNCLOCK_READPARMS: Wall Clock limit set to ',tSecs |
112 |
ENDIF |
113 |
|
114 |
_END_MASTER(myThid) |
115 |
|
116 |
C-- Everyone else must wait for the parameters to be loaded |
117 |
_BARRIER |
118 |
|
119 |
#endif /* ALLOW_RUNCLOCK */ |
120 |
|
121 |
RETURN |
122 |
END |