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