/[MITgcm]/MITgcm/pkg/atm_compon_interf/cpl_readparms.F
ViewVC logotype

Annotation of /MITgcm/pkg/atm_compon_interf/cpl_readparms.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.13 - (hide annotations) (download)
Wed Aug 9 15:23:39 2017 UTC (6 years, 9 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, HEAD
Changes since 1.12: +6 -2 lines
replace CLOSE(nmlfileUnit) with CLOSE(nmlfileUnit,STATUS='DELETE') to remove
scratchfiles after closing, except for SINGLE_DISK_IO, when everything
stays the same

1 mlosch 1.13 C $Header: /u/gcmpack/MITgcm/pkg/atm_compon_interf/cpl_readparms.F,v 1.12 2016/01/06 00:45:23 jmc Exp $
2     C $Name: BASE $
3 jmc 1.1
4 jmc 1.11 #include "ATM_CPL_OPTIONS.h"
5 jmc 1.1
6     CBOP
7     C !ROUTINE: CPL_READPARMS
8     C !INTERFACE:
9     SUBROUTINE CPL_READPARMS( myThid )
10    
11     C !DESCRIPTION: \bv
12     C *==========================================================*
13     C | S/R CPL_READPARMS
14     C | o Read Coupling parameters that control import/export
15     C | from/to the coupler layer
16     C *==========================================================*
17     C | this version is specific to 1 component (atmos)
18     C *==========================================================*
19     C \ev
20 jmc 1.4
21 jmc 1.1 C !USES:
22     IMPLICIT NONE
23    
24     C == Global variables ===
25     #include "SIZE.h"
26     #include "EEPARAMS.h"
27     #include "PARAMS.h"
28     #include "CPL_PARAMS.h"
29    
30     C !INPUT/OUTPUT PARAMETERS:
31 jmc 1.4 C == Routine Arguments ==
32 jmc 1.7 C myThid :: my Thread Id. number
33 jmc 1.1 INTEGER myThid
34     CEOP
35    
36     #ifdef COMPONENT_MODULE
37    
38 jmc 1.7 C !FUNCTIONS:
39     c INTEGER ILNBLNK
40 jmc 1.1
41 jmc 1.7 C !LOCAL VARIABLES:
42 jmc 1.4 C == Local Variables ==
43 jmc 1.7 C msgBuf :: Informational/error message buffer
44 jmc 1.1 C iUnit :: Work variable for IO unit number
45     C k :: loop counter
46     C iL :: Work variable for length of file-name
47 jmc 1.8 C cpl_earlyExpImpCall :: retired; always call coupler early in call sequence
48    
49 jmc 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuf
50 jmc 1.7 INTEGER iUnit
51     c INTEGER k, iL
52 jmc 1.10 _RL cpl_atmSendFrq, tmpLoc
53 jmc 1.8 LOGICAL cpl_earlyExpImpCall
54 jmc 1.1
55     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
56    
57 jmc 1.4 C-- Coupling parameters:
58 jmc 1.5 C cpl_oldPickup :: restart from an old pickup (= until checkpoint 59h)
59 jmc 1.2 C useImportMxlD :: True => use Imported Mix.Layer Detph from coupler
60     C useImportSST :: True => use the Imported SST from coupler
61     C useImportSSS :: True => use the Imported SSS from coupler
62     C useImportVsq :: True => use the Imported Surf. velocity^2
63 jmc 1.12 C useImportThSIce :: True => use the Imported thSIce state vars from coupler
64     C useImportFlxCO2 :: True => use the Imported air-sea CO2 flux from coupler
65 jmc 1.4 C cpl_atmSendFrq :: Frequency^-1 for sending data to coupler (s)
66 jmc 1.1 NAMELIST /CPL_ATM_PARAM/
67 jmc 1.2 & cpl_earlyExpImpCall,
68     & cpl_oldPickup,
69 jmc 1.4 & useImportMxlD, useImportSST, useImportSSS,
70 jmc 1.12 & useImportVsq, useImportThSIce, useImportFlxCO2,
71 jmc 1.9 & cpl_atmSendFrq,
72     & maxNumberPrint
73 jmc 1.1
74     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
75    
76 jmc 1.7 _BEGIN_MASTER(myThid)
77    
78     C-- Open the data file
79     WRITE(msgBuf,'(A)') ' CPL_READPARMS: opening data.cpl'
80 jmc 1.11 CALL PRINT_MESSAGE( msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1 )
81 jmc 1.7
82     CALL OPEN_COPY_DATA_FILE( 'data.cpl', 'CPL_READPARMS',
83     O iUnit, myThid )
84    
85 jmc 1.1 C- Set default value:
86 jmc 1.4 cpl_earlyExpImpCall = .TRUE.
87     cpl_oldPickup = .FALSE.
88     useImportMxlD = .TRUE.
89     useImportSST = .TRUE.
90     useImportSSS = .TRUE.
91     useImportVsq = .TRUE.
92 jmc 1.12 useImportThSIce = cpl_exchange2W_sIce.EQ.3
93     useImportFlxCO2 = cpl_exchange_DIC .EQ. 3
94 jmc 1.2 cpl_atmSendFrq= deltaTClock
95 jmc 1.9 maxNumberPrint= 100
96     countPrtExp = 0
97     countPrtImp = 0
98 jmc 1.4
99 jmc 1.1 C-- Read parameters from open data file:
100    
101     C- Parameters for coupling interface:
102     READ(UNIT=iUnit,NML=CPL_ATM_PARAM)
103    
104 jmc 1.4 WRITE(msgBuf,'(A)')
105 jmc 1.1 & ' CPL_READPARMS: finished reading data.cpl'
106 jmc 1.11 CALL PRINT_MESSAGE( msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1 )
107 jmc 1.4
108 jmc 1.1 C-- Close the open data file
109 mlosch 1.13 #ifdef SINGLE_DISK_IO
110 jmc 1.1 CLOSE(iUnit)
111 mlosch 1.13 #else
112     CLOSE(iUnit,STATUS='DELETE')
113     #endif /* SINGLE_DISK_IO */
114 jmc 1.1
115     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
116 jmc 1.8 C-- Check for retired parameters:
117     IF ( .NOT.cpl_earlyExpImpCall ) THEN
118     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
119     & 'Parameter "cpl_earlyExpImpCall" has been retired;'
120     CALL PRINT_ERROR( msgBuf, myThid )
121     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
122     & '=> always call coupler early in sequence of calls'
123     CALL PRINT_ERROR( msgBuf, myThid )
124 jmc 1.11 cplErrorCount = cplErrorCount + 1
125 jmc 1.8 ENDIF
126    
127 jmc 1.1 C-- Check parameters and model configuration
128 jmc 1.12
129     #ifndef ALLOW_LAND
130     IF ( atm_cplExch_RunOff ) THEN
131     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: needs',
132     & ' to compile pkg/land to use: atm_cplExch_RunOff=T'
133     CALL PRINT_ERROR( msgBuf, myThid )
134     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
135     & ' (set from Coupler "data.cpl": cpl_exchange_RunOff > 1)'
136     CALL PRINT_ERROR( msgBuf, myThid )
137     cplErrorCount = cplErrorCount + 1
138     ENDIF
139     #endif /* ndef ALLOW_LAND */
140     #ifndef ALLOW_THSICE
141     IF ( atm_cplExch1W_sIce ) THEN
142     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: needs',
143     & ' to compile pkg/thsice to use: atm_cplExch1W_sIce=T'
144     CALL PRINT_ERROR( msgBuf, myThid )
145     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
146     & ' (set from Coupler "data.cpl": cpl_exchange1W_sIce > 1)'
147     CALL PRINT_ERROR( msgBuf, myThid )
148     cplErrorCount = cplErrorCount + 1
149     ENDIF
150     IF ( atm_cplExch2W_sIce ) THEN
151     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: needs',
152     & ' to compile pkg/thsice to use: atm_cplExch2W_sIce=T'
153     CALL PRINT_ERROR( msgBuf, myThid )
154     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
155     & ' (set from Coupler "data.cpl": cpl_exchange2W_sIce > 1)'
156     CALL PRINT_ERROR( msgBuf, myThid )
157     cplErrorCount = cplErrorCount + 1
158     ENDIF
159     IF ( atm_cplExch_SaltPl ) THEN
160     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: needs',
161     & ' to compile pkg/thsice to use: atm_cplExch_SaltPl=T'
162     CALL PRINT_ERROR( msgBuf, myThid )
163     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
164     & ' (set from Coupler "data.cpl": cpl_exchange_SaltPl > 1)'
165     CALL PRINT_ERROR( msgBuf, myThid )
166     cplErrorCount = cplErrorCount + 1
167     ENDIF
168     #endif /* ndef ALLOW_THSICE */
169     #ifndef ALLOW_AIM
170     IF ( atm_cplExch_DIC ) THEN
171     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: needs',
172     & ' to compile pkg/aim_v23 to use: atm_cplExch_DIC = T'
173     CALL PRINT_ERROR( msgBuf, myThid )
174     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
175     & ' (set from Coupler "data.cpl": cpl_exchange_DIC > 1)'
176     CALL PRINT_ERROR( msgBuf, myThid )
177     cplErrorCount = cplErrorCount + 1
178     ENDIF
179     #endif /* ndef ALLOW_AIM */
180    
181     IF ( useImportThSIce .AND. .NOT.atm_cplExch2W_sIce ) THEN
182     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: useImportThSIce',
183     & ' requires setting'
184     CALL PRINT_ERROR( msgBuf, myThid )
185     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
186     & ' cpl_exchange2W_sIce > 1 (in Coupler "data.cpl")'
187     CALL PRINT_ERROR( msgBuf, myThid )
188     cplErrorCount = cplErrorCount + 1
189     ELSEIF ( useImportThSIce .AND. cpl_exchange2W_sIce.NE.3 ) THEN
190     WRITE(msgBuf,'(2A)') '** WARNING ** CPL_READPARMS: ',
191     & 'useImportThSIce useless without'
192     CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
193     & SQUEEZE_RIGHT, myThid )
194     WRITE(msgBuf,'(2A)') '** WARNING ** CPL_READPARMS: ',
195     & ' cpl_exchange2W_sIce = 3 (in Coupler "data.cpl")'
196     CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
197     & SQUEEZE_RIGHT, myThid )
198     ENDIF
199     IF ( useImportFlxCO2 .AND. cpl_exchange_DIC.NE.3 ) THEN
200 jmc 1.4 WRITE(msgBuf,'(2A)') 'CPL_READPARMS: useImportFlxCO2',
201 jmc 1.12 & ' requires setting'
202     CALL PRINT_ERROR( msgBuf, myThid )
203     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: ',
204     & ' cpl_exchange_DIC = 3 (in Coupler "data.cpl")'
205 jmc 1.8 CALL PRINT_ERROR( msgBuf, myThid )
206 jmc 1.11 cplErrorCount = cplErrorCount + 1
207 jmc 1.4 ENDIF
208 jmc 1.10 tmpLoc = NINT( cpl_atmSendFrq / deltaTClock )
209     tmpLoc = ABS( tmpLoc - ( cpl_atmSendFrq / deltaTClock ) )
210     IF ( tmpLoc.GT.1. _d -12 .OR. cpl_atmSendFrq.EQ.zeroRL ) THEN
211     WRITE(msgBuf,'(2A)') 'CPL_READPARMS: cpl_atmSendFrq',
212     & ' is not a multiple of deltaT'
213     CALL PRINT_ERROR( msgBuf, myThid )
214 jmc 1.11 cplErrorCount = cplErrorCount + 1
215 jmc 1.10 ENDIF
216 jmc 1.1
217 jmc 1.10 C- Derive other parameters:
218 jmc 1.1 cplSendFrq_iter = NINT( cpl_atmSendFrq / deltaTClock )
219 jmc 1.11 IF ( cplSendFrq_iter.LT.1 ) cplSendFrq_iter = 1
220 jmc 1.1
221     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
222 jmc 1.11 C-- Print out set-up summary
223 jmc 1.1
224     iUnit = standardMessageUnit
225     WRITE(msgBuf,'(A)') ' '
226 jmc 1.11 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
227 jmc 1.1 WRITE(msgBuf,'(A)') '// ==================================='
228 jmc 1.11 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
229     WRITE(msgBuf,'(A)') '// Coupling set-up summary :'
230     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
231 jmc 1.1 WRITE(msgBuf,'(A)') '// ==================================='
232 jmc 1.11 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
233    
234     C- o Print Coupler-Exchange config (set from params in coupler 'data.cpl')
235     WRITE(msgBuf,'(A)') '// -------'
236     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
237     WRITE(msgBuf,'(A)')
238     & '// Coupler-exchange switch (received from coupler):'
239     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
240    
241     CALL WRITE_0D_L( atm_cplSequential, INDEX_NONE,
242     & 'atm_cplSequential =',
243     & ' /* use Sequential Coupling Exchange on/off flag */')
244     CALL WRITE_0D_L( atm_cplExch_RunOff, INDEX_NONE,
245     & 'atm_cplExch_RunOff =',
246     & ' /* exchange RunOff fields with coupler on/off */')
247     CALL WRITE_0D_L( atm_cplExch1W_sIce, INDEX_NONE,
248     & 'atm_cplExch1W_sIce =',
249     & ' /* 1-way exchange of seaice vars with coupler */')
250     CALL WRITE_0D_L( atm_cplExch2W_sIce, INDEX_NONE,
251     & 'atm_cplExch2W_sIce =',
252     & ' /* 2-way exchange of ThSIce vars with coupler */')
253     CALL WRITE_0D_L( atm_cplExch_SaltPl, INDEX_NONE,
254     & 'atm_cplExch_SaltPl =',
255     & ' /* exchange Salt-Plume fields with coupler */')
256     CALL WRITE_0D_L( atm_cplExch_DIC, INDEX_NONE,
257     & 'atm_cplExch_DIC =',
258     & ' /* exchange DIC fields with coupler on/off */')
259    
260     C- print namelist parameter value:
261     WRITE(msgBuf,'(A)') '// -------'
262     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
263     WRITE(msgBuf,'(A)')
264     & '// Coupler parameters (from local param file):'
265     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
266 jmc 1.1
267 jmc 1.2 CALL WRITE_0D_L( cpl_oldPickup , INDEX_NONE,
268     & 'cpl_oldPickup =',
269 jmc 1.4 & ' /* restart from old pickup on/off flag */')
270 jmc 1.2 CALL WRITE_0D_L( useImportMxlD , INDEX_NONE,
271     & 'useImportMxlD =',
272 jmc 1.4 & ' /* use Imported MxL. Depth from Coupler flag */')
273 jmc 1.12 CALL WRITE_0D_L( useImportSST , INDEX_NONE,
274     & 'useImportSST =',
275 jmc 1.4 & ' /* use Imported SST from Coupler on/off flag */')
276 jmc 1.12 CALL WRITE_0D_L( useImportSSS , INDEX_NONE,
277     & 'useImportSSS =',
278 jmc 1.4 & ' /* use Imported SSS from Coupler on/off flag */')
279 jmc 1.12 CALL WRITE_0D_L( useImportVsq , INDEX_NONE,
280     & 'useImportVsq =',
281 jmc 1.4 & ' /* use Imported surf.Vel^2 from Coupler flag */')
282 jmc 1.12 CALL WRITE_0D_L( useImportThSIce, INDEX_NONE,
283     & 'useImportThSIce=',
284     & ' /* use Imported thSIce state-var fr Cpl. flag */')
285     CALL WRITE_0D_L( useImportFlxCO2, INDEX_NONE,
286     & 'useImportFlxCO2=',
287     & ' /* use Imported air-sea CO2 flux fr Cpl. flag */')
288 jmc 1.6 CALL WRITE_0D_RL( cpl_atmSendFrq, INDEX_NONE, 'cpl_atmSendFrq =',
289 jmc 1.1 & ' /* Frequency^o-1 for sending data to Coupler (s) */')
290 jmc 1.4 C cpl_atmSendFrq :: Frequency^-1 for sending data to coupler (s)
291 jmc 1.1 CALL WRITE_0D_I( cplSendFrq_iter, INDEX_NONE,'cplSendFrq_iter =',
292 jmc 1.9 & ' /* send data to coupler every "cplSendFrq" iter */')
293     CALL WRITE_0D_I( maxNumberPrint, INDEX_NONE, 'maxNumberPrint =',
294     & ' /* max number of printed Exp/Imp messages */')
295 jmc 1.1
296 jmc 1.11 WRITE(msgBuf,'(A)') '// ==================================='
297     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
298     WRITE(msgBuf,'(A)') '// End of Coupling set-up summary'
299     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
300     WRITE(msgBuf,'(A)') '// ==================================='
301     CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
302    
303 jmc 1.1 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
304    
305     _END_MASTER(myThid)
306 jmc 1.4
307 jmc 1.1 C-- Everyone else must wait for the parameters to be loaded
308     _BARRIER
309    
310     #endif /* COMPONENT_MODULE */
311    
312     RETURN
313     END

  ViewVC Help
Powered by ViewVC 1.1.22