1 |
C $Header: /u/gcmpack/MITgcm/pkg/ocn_compon_interf/cpl_readparms.F,v 1.3 2004/07/26 20:13:47 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: CPL_READPARMS |
9 |
C !INTERFACE: |
10 |
SUBROUTINE CPL_READPARMS( myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | S/R CPL_READPARMS |
15 |
C | o Read Coupling parameters that control import/export |
16 |
C | from/to the coupler layer |
17 |
C *==========================================================* |
18 |
C | this version is specific to 1 component (ocean) |
19 |
C *==========================================================* |
20 |
C \ev |
21 |
|
22 |
C !USES: |
23 |
IMPLICIT NONE |
24 |
|
25 |
C == Global variables === |
26 |
|
27 |
#include "SIZE.h" |
28 |
|
29 |
#include "EEPARAMS.h" |
30 |
#include "PARAMS.h" |
31 |
#ifdef ALLOW_MNC |
32 |
#include "MNC_PARAMS.h" |
33 |
#endif |
34 |
#include "CPL_PARAMS.h" |
35 |
|
36 |
C !INPUT/OUTPUT PARAMETERS: |
37 |
C == Routine Arguments == |
38 |
C myThid - Number of this instance |
39 |
INTEGER myThid |
40 |
CEOP |
41 |
|
42 |
#ifdef COMPONENT_MODULE |
43 |
|
44 |
C Functions |
45 |
INTEGER ILNBLNK |
46 |
|
47 |
C == Local Variables == |
48 |
C msgBuf :: Informational/error meesage buffer |
49 |
C iUnit :: Work variable for IO unit number |
50 |
C k :: loop counter |
51 |
C iL :: Work variable for length of file-name |
52 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
53 |
INTEGER iUnit, k, iL |
54 |
|
55 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
56 |
|
57 |
C-- Coupling parameters: |
58 |
C cpl_earlyExpImpCall :: call coupler early in the time stepping call sequence |
59 |
C useImportHFlx :: True => use the Imported HeatFlux from couler |
60 |
C useImportFW :: True => use the Imported Fresh Water flux fr cpl |
61 |
C useImportTau :: True => use the Imported Wind-Stress from couler |
62 |
C useImportSLP :: True => use the Imported Sea-level Atmos. Pressure |
63 |
C useImportSIce :: True => use the Imported Sea-Ice loading |
64 |
C cpl_taveFreq :: Frequency^-1 for time-Aver. output (s) |
65 |
NAMELIST /CPL_OCN_PARAM/ |
66 |
& cpl_earlyExpImpCall, |
67 |
& useImportHFlx, useImportFW, useImportTau, |
68 |
& useImportSLP, useImportSIce, |
69 |
& cpl_taveFreq, cpl_snapshot_mnc, cpl_timeave_mnc |
70 |
|
71 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
72 |
|
73 |
C- Set default value: |
74 |
cpl_earlyExpImpCall = .TRUE. |
75 |
useImportHFlx = .TRUE. |
76 |
useImportFW = .TRUE. |
77 |
useImportTau = .TRUE. |
78 |
useImportSLP = .TRUE. |
79 |
useImportSIce = .TRUE. |
80 |
cpl_taveFreq = taveFreq |
81 |
cpl_snapshot_mnc = snapshot_mnc |
82 |
cpl_timeave_mnc = timeave_mnc |
83 |
|
84 |
_BEGIN_MASTER(myThid) |
85 |
|
86 |
WRITE(msgBuf,'(A)') ' CPL_READPARMS: opening data.cpl' |
87 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
88 |
|
89 |
CALL OPEN_COPY_DATA_FILE( 'data.cpl', 'CPL_READPARMS', |
90 |
O iUnit, myThid ) |
91 |
|
92 |
C-- Read parameters from open data file: |
93 |
|
94 |
C- Parameters for coupling interface: |
95 |
READ(UNIT=iUnit,NML=CPL_OCN_PARAM) |
96 |
|
97 |
WRITE(msgBuf,'(A)') |
98 |
& ' CPL_READPARMS: finished reading data.cpl' |
99 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
100 |
|
101 |
C-- Close the open data file |
102 |
CLOSE(iUnit) |
103 |
|
104 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
105 |
C-- Check parameters and model configuration |
106 |
|
107 |
C- If land_taveFreq is positive, then must compile the land-diagnostics code |
108 |
#ifndef ALLOW_TIMEAVE |
109 |
IF (cpl_taveFreq.GT.0.) THEN |
110 |
WRITE(msgBuf,'(A)') |
111 |
& 'CPL_READPARMS: cpl_taveFreq > 0 but not compiled pkg/timeave' |
112 |
CALL PRINT_ERROR( msgBuf, myThid) |
113 |
WRITE(msgBuf,'(A)') |
114 |
& 'Re-compile with pkg "timeave" in packages.conf' |
115 |
CALL PRINT_ERROR( msgBuf, myThid) |
116 |
STOP 'ABNORMAL END: S/R CPL_READPARMS' |
117 |
ENDIF |
118 |
#endif /* ALLOW_TIMEAVE */ |
119 |
|
120 |
#ifndef ATMOSPHERIC_LOADING |
121 |
IF ( useImportSLP ) THEN |
122 |
WRITE(msgBuf,'(A)') |
123 |
& 'CPL_READPARMS: useImportSLP is set but' |
124 |
CALL PRINT_ERROR( msgBuf , myThid) |
125 |
ELSEIF ( useImportSIce ) THEN |
126 |
WRITE(msgBuf,'(A)') |
127 |
& 'CPL_READPARMS: useImportSIce is set but' |
128 |
CALL PRINT_ERROR( msgBuf , myThid) |
129 |
ENDIF |
130 |
IF ( useImportSLP .OR. useImportSIce ) THEN |
131 |
WRITE(msgBuf,'(A)') |
132 |
& 'CPL_READPARMS: pressure loading code is not compiled.' |
133 |
CALL PRINT_ERROR( msgBuf , myThid) |
134 |
WRITE(msgBuf,'(A)') |
135 |
& 'Re-compile with: #define ATMOSPHERIC_LOADING', |
136 |
CALL PRINT_ERROR( msgBuf , myThid) |
137 |
STOP 'ABNORMAL END: S/R CPL_READPARMS' |
138 |
ENDIF |
139 |
#endif |
140 |
|
141 |
IF ( .NOT.cpl_earlyExpImpCall .AND. staggerTimeStep ) THEN |
142 |
WRITE(msgBuf,'(A,L5,A,L5)') |
143 |
& 'CPL_READPARMS: staggerTimeStep=',staggerTimeStep, |
144 |
& ' ; cpl_earlyExpImpCall=', cpl_earlyExpImpCall |
145 |
CALL PRINT_ERROR( msgBuf, myThid) |
146 |
WRITE(msgBuf,'(A)') |
147 |
& 'CPL_READPARMS: taggerTimeStep requires cpl_earlyExpImpCall' |
148 |
CALL PRINT_ERROR( msgBuf, myThid) |
149 |
STOP 'ABNORMAL END: S/R CPL_READPARMS' |
150 |
ENDIF |
151 |
|
152 |
C Set IO flags |
153 |
IF ( (.NOT. outputTypesInclusive) |
154 |
& .AND. cpl_snapshot_mnc ) cpl_snapshot_mdsio = .FALSE. |
155 |
IF ( (.NOT. outputTypesInclusive) |
156 |
& .AND. cpl_timeave_mnc ) cpl_timeave_mdsio = .FALSE. |
157 |
|
158 |
C- derive other parameters: |
159 |
|
160 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
161 |
C-- Print out parameter values : |
162 |
|
163 |
iUnit = standardMessageUnit |
164 |
WRITE(msgBuf,'(A)') ' ' |
165 |
CALL PRINT_MESSAGE(msgBuf,iUnit,SQUEEZE_RIGHT,1) |
166 |
WRITE(msgBuf,'(A)') '// ===================================' |
167 |
CALL PRINT_MESSAGE(msgBuf,iUnit,SQUEEZE_RIGHT,1) |
168 |
WRITE(msgBuf,'(A)') '// Coupling package parameters :' |
169 |
CALL PRINT_MESSAGE(msgBuf,iUnit,SQUEEZE_RIGHT,1) |
170 |
WRITE(msgBuf,'(A)') '// ===================================' |
171 |
CALL PRINT_MESSAGE(msgBuf,iUnit,SQUEEZE_RIGHT,1) |
172 |
|
173 |
C- namelist CPL_OCN_PARAM: |
174 |
CALL WRITE_0D_L( cpl_earlyExpImpCall, INDEX_NONE, |
175 |
& 'cpl_earlyExpImpCall=', |
176 |
& ' /* call coupler early in the time-stepping */') |
177 |
CALL WRITE_0D_L( useImportHFlx, INDEX_NONE, |
178 |
& 'useImportHFlx=', |
179 |
& ' /* use Imported Heat-Flx fr Coupler on/off flag */') |
180 |
CALL WRITE_0D_L( useImportFW , INDEX_NONE, |
181 |
& 'useImportFW =', |
182 |
& ' /* use Imported Fresh-Water fr Cpl. on/off flag */') |
183 |
CALL WRITE_0D_L( useImportTau , INDEX_NONE, |
184 |
& 'useImportTau =', |
185 |
& ' /* use Imported Wind-Stress fr Cpl. on/off flag */') |
186 |
CALL WRITE_0D_L( useImportSLP , INDEX_NONE, |
187 |
& 'useImportSLP =', |
188 |
& ' /* use Imported Sea-level Atm Press on/off flag */') |
189 |
CALL WRITE_0D_L( useImportSIce , INDEX_NONE, |
190 |
& 'useImportSIce=', |
191 |
& ' /* use Imported Sea-Ice loading on/off flag */') |
192 |
CALL WRITE_0D_R8( cpl_taveFreq, INDEX_NONE, 'cpl_taveFreq =', |
193 |
& ' /* Frequency^-1 for time-Aver. output (s) */') |
194 |
|
195 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
196 |
|
197 |
_END_MASTER(myThid) |
198 |
|
199 |
C-- Everyone else must wait for the parameters to be loaded |
200 |
_BARRIER |
201 |
|
202 |
#endif /* COMPONENT_MODULE */ |
203 |
|
204 |
RETURN |
205 |
END |