/[MITgcm]/MITgcm/pkg/ptracers/ptracers_readparms.F
ViewVC logotype

Contents of /MITgcm/pkg/ptracers/ptracers_readparms.F

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


Revision 1.30 - (show annotations) (download)
Sat Apr 5 18:22:16 2008 UTC (16 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint60, checkpoint61, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint61b, checkpoint61a
Changes since 1.29: +12 -1 lines
move out of PARAMS.h the last piece of old-ptracer code (tauTr1ClimRelax,
 lambdaTr1ClimRelax) and put them (for now) in pkg/ptracers.
(note: but not clear to me what lambdaTr1ClimRelax is used for ...)

1 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_readparms.F,v 1.29 2007/12/17 22:03:15 jmc Exp $
2 C $Name: $
3
4 #include "PTRACERS_OPTIONS.h"
5
6 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7 CBOP
8 C !ROUTINE: PTRACERS_READPARMS
9
10 C !INTERFACE:
11 SUBROUTINE PTRACERS_READPARMS( myThid )
12
13 C !DESCRIPTION:
14 C Initialize PTRACERS parameters, read in data.ptracers
15
16 C !USES:
17 IMPLICIT NONE
18 #include "SIZE.h"
19 #include "EEPARAMS.h"
20 #include "PTRACERS_SIZE.h"
21 #include "PTRACERS_PARAMS.h"
22 #include "PARAMS.h"
23 #ifdef ALLOW_MNC
24 #include "MNC_PARAMS.h"
25 #endif
26
27 C !INPUT PARAMETERS:
28 INTEGER myThid
29 CEOP
30
31 #ifdef ALLOW_PTRACERS
32
33 C !LOCAL VARIABLES:
34 C k,iTracer :: loop indices
35 C iUnit :: unit number for I/O
36 C msgBuf :: message buffer
37 INTEGER k, iTracer
38 INTEGER iUnit
39 INTEGER ic
40 CHARACTER*(MAX_LEN_MBUF) msgBuf
41 _RL PTRACERS_diffKr(PTRACERS_num)
42 _RL tauTr1ClimRelax
43
44 C PTRACERS_taveFreq :: Frequency with which time-averaged PTRACERS
45 C are written to post-processing files.
46 C tauTr1ClimRelax :: old parameter (will be removed 1 day)
47 NAMELIST /PTRACERS_PARM01/
48 & tauTr1ClimRelax,
49 & PTRACERS_dumpFreq,
50 & PTRACERS_taveFreq,
51 & PTRACERS_monitorFreq,
52 & PTRACERS_advScheme,
53 & PTRACERS_ImplVertAdv,
54 & PTRACERS_diffKh,
55 & PTRACERS_diffK4,
56 & PTRACERS_diffKr,
57 & PTRACERS_diffKrNr,
58 & PTRACERS_ref,
59 & PTRACERS_EvPrRn,
60 & PTRACERS_useGMRedi,
61 & PTRACERS_useKPP,
62 & PTRACERS_Iter0,
63 & PTRACERS_numInUse,
64 & PTRACERS_initialFile,
65 & PTRACERS_useRecords,
66 & PTRACERS_names,
67 & PTRACERS_long_names,
68 & PTRACERS_units,
69 & PTRACERS_timeave_mnc,
70 & PTRACERS_snapshot_mnc,
71 & PTRACERS_monitor_mnc,
72 & PTRACERS_pickup_write_mnc,
73 & PTRACERS_pickup_read_mnc
74
75 _BEGIN_MASTER(myThid)
76
77 C This routine has been called by the main model so we set our
78 C internal flag to indicate we are in business
79 c PTRACERSisON=.TRUE.
80 C Note(jmc): remove this flag which is not really usefull (not set properly
81 C when usePTRACERS=F and always TRUE otherwise);
82 C much better to use "usePTRACERS" flag instead.
83
84 C Set ptracer IO & diagnostics labels (2 characters long)
85 CALL PTRACERS_SET_IOLABEL(
86 O PTRACERS_ioLabel,
87 I PTRACERS_num, myThid )
88
89 C Set defaults values for parameters in PTRACERS.h
90 PTRACERS_dumpFreq = dumpFreq
91 PTRACERS_taveFreq = taveFreq
92 PTRACERS_monitorFreq = monitorFreq
93 PTRACERS_Iter0 = 0
94 PTRACERS_numInUse=-1
95 DO iTracer=1,PTRACERS_num
96 PTRACERS_advScheme(iTracer)=saltAdvScheme
97 PTRACERS_ImplVertAdv(iTracer) = .FALSE.
98 PTRACERS_diffKh(iTracer)=diffKhS
99 PTRACERS_diffK4(iTracer)=diffK4S
100 PTRACERS_diffKr(iTracer)=UNSET_RL
101 DO k=1,Nr
102 PTRACERS_diffKrNr(k,iTracer)=diffKrNrS(k)
103 PTRACERS_ref (k,iTracer)=0. _d 0
104 ENDDO
105 PTRACERS_EvPrRn(iTracer)=UNSET_RL
106 PTRACERS_useGMRedi(iTracer)=useGMRedi
107 PTRACERS_useKPP(iTracer)=useKPP
108 PTRACERS_initialFile(iTracer)=' '
109 DO ic = 1,MAX_LEN_FNAM
110 PTRACERS_names(iTracer)(ic:ic) = ' '
111 PTRACERS_long_names(iTracer)(ic:ic) = ' '
112 PTRACERS_units(iTracer)(ic:ic) = ' '
113 ENDDO
114 ENDDO
115 PTRACERS_useRecords = .FALSE.
116 #ifdef ALLOW_MNC
117 PTRACERS_timeave_mnc = useMNC .AND. timeave_mnc
118 PTRACERS_snapshot_mnc = useMNC .AND. snapshot_mnc
119 PTRACERS_monitor_mnc = useMNC .AND. monitor_mnc
120 PTRACERS_pickup_write_mnc = useMNC .AND. pickup_write_mnc
121 PTRACERS_pickup_read_mnc = useMNC .AND. pickup_read_mnc
122 #else
123 PTRACERS_timeave_mnc = .FALSE.
124 PTRACERS_snapshot_mnc = .FALSE.
125 PTRACERS_monitor_mnc = .FALSE.
126 PTRACERS_pickup_write_mnc = .FALSE.
127 PTRACERS_pickup_read_mnc = .FALSE.
128 #endif
129 tauTr1ClimRelax = 0.
130
131 C Open and read the data.ptracers file
132 WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers'
133 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
134 & SQUEEZE_RIGHT , myThid )
135 CALL OPEN_COPY_DATA_FILE(
136 I 'data.ptracers', 'PTRACERS_READPARMS',
137 O iUnit,
138 I myThid )
139 READ(UNIT=iUnit,NML=PTRACERS_PARM01)
140 WRITE(msgBuf,'(A)')
141 & ' PTRACERS_READPARMS: finished reading data.ptracers'
142 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
143 & SQUEEZE_RIGHT , myThid )
144
145 C Close the open data file
146 CLOSE(iUnit)
147
148 C Now set-up any remaining parameters that result from the input
149 C parameters
150
151 C Tracer 1 climatology relaxation time scale (<- but the code is gone !)
152 IF ( tauTr1ClimRelax .EQ. 0. ) THEN
153 lambdaTr1ClimRelax = 0.
154 ELSE
155 lambdaTr1ClimRelax = 1./tauTr1ClimRelax
156 ENDIF
157
158 C If PTRACERS_numInUse was not set in data.ptracers then we can
159 C assume that all PTRACERS fields will be in use
160 IF (PTRACERS_numInUse.LT.0) THEN
161 PTRACERS_numInUse=PTRACERS_num
162 ENDIF
163 C Check we are not trying to use more tracers than allowed
164 IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN
165 WRITE(msgBuf,'(A,I4,A,I4,A)')
166 & ' PTRACERS_READPARMS: You requested',PTRACERS_numInUse,
167 & ' tracers at run time when only',PTRACERS_num,
168 & ' were specified at compile time. Naughty! '
169 CALL PRINT_ERROR( msgBuf, myThid )
170 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
171 ENDIF
172 C Check that enough parameters were specified
173 DO iTracer=1,PTRACERS_numInUse
174 IF (PTRACERS_advScheme(iTracer).EQ.0) THEN
175 WRITE(msgBuf,'(A,A,I3)')
176 & ' PTRACERS_READPARMS: ',
177 & 'No advect. scheme specified for tracer #',
178 & iTracer
179 CALL PRINT_ERROR( msgBuf, myThid )
180 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
181 ENDIF
182 ENDDO
183 #ifndef INCLUDE_IMPLVERTADV_CODE
184 DO iTracer=1,PTRACERS_numInUse
185 IF ( PTRACERS_ImplVertAdv(iTracer) ) THEN
186 WRITE(msgBuf,'(A)')
187 & 'PTRACERS_READPARMS: #undef INCLUDE_IMPLVERTADV_CODE'
188 CALL PRINT_ERROR( msgBuf, myThid )
189 WRITE(msgBuf,'(2A,I3,A)') 'PTRACERS_READPARMS:',
190 & ' but pTracers_ImplVertAdv(',iTracer,' ) is TRUE'
191 CALL PRINT_ERROR( msgBuf, myThid )
192 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
193 ENDIF
194 ENDDO
195 #endif
196 DO iTracer=1,PTRACERS_numInUse
197 IF ( PTRACERS_useGMRedi(iTracer) .AND. .NOT.useGMRedi ) THEN
198 WRITE(msgBuf,'(2A,I3,A)') 'PTRACERS_READPARMS:',
199 & ' pTracers_useGMRedi(',iTracer,' ) is TRUE'
200 CALL PRINT_ERROR( msgBuf, myThid )
201 WRITE(msgBuf,'(A,L5,A)')
202 & 'PTRACERS_READPARMS: But not useGMRedi (=',useGMRedi,')'
203 CALL PRINT_ERROR( msgBuf, myThid )
204 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
205 ENDIF
206 IF ( PTRACERS_useKPP(iTracer) .AND. .NOT.useKPP ) THEN
207 WRITE(msgBuf,'(2A,I3,A)') 'PTRACERS_READPARMS:',
208 & ' pTracers_useKPP(',iTracer,' ) is TRUE'
209 CALL PRINT_ERROR( msgBuf, myThid )
210 WRITE(msgBuf,'(A,L5,A)')
211 & 'PTRACERS_READPARMS: But not useKPP (=',useKPP,')'
212 CALL PRINT_ERROR( msgBuf, myThid )
213 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
214 ENDIF
215 IF ( PTRACERS_diffKr(iTracer).NE.UNSET_RL ) THEN
216 DO k=1,Nr
217 PTRACERS_diffKrNr(k,iTracer)=PTRACERS_diffKr(iTracer)
218 ENDDO
219 ENDIF
220 ENDDO
221
222 #ifdef ALLOW_MNC
223 PTRACERS_timeave_mnc = useMNC .AND. PTRACERS_timeave_mnc
224 PTRACERS_snapshot_mnc = useMNC .AND. PTRACERS_snapshot_mnc
225 PTRACERS_monitor_mnc = useMNC .AND. PTRACERS_monitor_mnc
226 PTRACERS_pickup_write_mnc = useMNC .AND. PTRACERS_pickup_write_mnc
227 PTRACERS_pickup_read_mnc = useMNC .AND. PTRACERS_pickup_read_mnc
228
229 PTRACERS_timeave_mdsio = (.NOT. PTRACERS_timeave_mnc)
230 & .OR. outputTypesInclusive
231 PTRACERS_snapshot_mdsio = (.NOT. PTRACERS_snapshot_mnc)
232 & .OR. outputTypesInclusive
233 PTRACERS_monitor_stdio = (.NOT. PTRACERS_monitor_mnc)
234 & .OR. outputTypesInclusive
235 PTRACERS_pickup_write_mdsio = (.NOT. PTRACERS_pickup_write_mnc)
236 & .OR. outputTypesInclusive
237 PTRACERS_pickup_read_mdsio = (.NOT. PTRACERS_pickup_read_mnc)
238 & .OR. outputTypesInclusive
239 #else
240 PTRACERS_timeave_mnc = .FALSE.
241 PTRACERS_snapshot_mnc = .FALSE.
242 PTRACERS_monitor_mnc = .FALSE.
243 PTRACERS_pickup_write_mnc = .FALSE.
244 PTRACERS_pickup_read_mnc = .FALSE.
245 PTRACERS_timeave_mdsio = .TRUE.
246 PTRACERS_snapshot_mdsio = .TRUE.
247 PTRACERS_monitor_stdio = .TRUE.
248 PTRACERS_pickup_write_mdsio = .TRUE.
249 PTRACERS_pickup_read_mdsio = .TRUE.
250 #endif
251
252 C-- Print a summary of pTracer parameter values:
253 iUnit = standardMessageUnit
254 WRITE(msgBuf,'(A)') '// ==================================='
255 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
256 WRITE(msgBuf,'(A)') '// PTRACERS parameters '
257 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
258 WRITE(msgBuf,'(A)') '// ==================================='
259 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
260 CALL WRITE_0D_I( PTRACERS_numInUse, INDEX_NONE,
261 & 'PTRACERS_numInUse =',
262 & ' /* number of tracers */')
263 CALL WRITE_0D_I( PTRACERS_Iter0, INDEX_NONE,
264 & 'PTRACERS_Iter0 =',
265 & ' /* timestep number when tracers are initialized */')
266 CALL WRITE_0D_R8(PTRACERS_dumpFreq, INDEX_NONE,
267 & 'PTRACERS_dumpFreq =',
268 & ' /* Frequency^-1 for snapshot output (s) */')
269 CALL WRITE_0D_R8(PTRACERS_taveFreq, INDEX_NONE,
270 & 'PTRACERS_taveFreq =',
271 & ' /* Frequency^-1 for time-Aver. output (s) */')
272 CALL WRITE_0D_L( PTRACERS_useRecords, INDEX_NONE,
273 & 'PTRACERS_useRecords =', ' /* all tracers in 1 file */')
274
275 CALL WRITE_0D_L( PTRACERS_timeave_mnc, INDEX_NONE,
276 & 'PTRACERS_timeave_mnc =',
277 & ' /* use MNC for Tave output */')
278 CALL WRITE_0D_L( PTRACERS_snapshot_mnc, INDEX_NONE,
279 & 'PTRACERS_snapshot_mnc =',
280 & ' /* use MNC for snapshot output */')
281 CALL WRITE_0D_L( PTRACERS_pickup_write_mnc, INDEX_NONE,
282 & 'PTRACERS_pickup_write_mnc =',
283 & ' /* use MNC for writing pickups */')
284 CALL WRITE_0D_L( PTRACERS_pickup_read_mnc, INDEX_NONE,
285 & 'PTRACERS_pickup_read_mnc =',
286 & ' /* use MNC for reading pickups */')
287
288 DO iTracer=1,PTRACERS_numInUse
289 WRITE(msgBuf,'(A)') ' -----------------------------------'
290 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
291 WRITE(msgBuf,'(A,I4)') ' tracer number : ',iTracer
292 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
293 CALL WRITE_0D_C( PTRACERS_ioLabel(iTracer), 0, INDEX_NONE,
294 & 'PTRACERS_ioLabel =', ' /* tracer IO Label */')
295 CALL WRITE_0D_I( PTRACERS_advScheme(iTracer), INDEX_NONE,
296 & 'PTRACERS_advScheme =', ' /* Advection Scheme */')
297 CALL WRITE_0D_L( PTRACERS_ImplVertAdv(iTracer), INDEX_NONE,
298 & 'PTRACERS_ImplVertAdv =',
299 & ' /* implicit vert. advection flag */')
300 CALL WRITE_0D_R8( PTRACERS_diffKh(iTracer), INDEX_NONE,
301 & 'PTRACERS_diffKh =', ' /* Laplacian Diffusivity */')
302 CALL WRITE_0D_R8( PTRACERS_diffK4(iTracer), INDEX_NONE,
303 & 'PTRACERS_diffK4 =', ' /* Biharmonic Diffusivity */')
304 CALL WRITE_1D_R8( PTRACERS_diffKrNr(1,iTracer), Nr, INDEX_K,
305 & 'PTRACERS_diffKrNr =', ' /* Vertical Diffusivity */')
306 CALL WRITE_0D_L( PTRACERS_useGMRedi(iTracer), INDEX_NONE,
307 & 'PTRACERS_useGMRedi =', ' /* apply GM-Redi */')
308 CALL WRITE_0D_L( PTRACERS_useKPP(iTracer), INDEX_NONE,
309 & 'PTRACERS_useKPP =', ' /* apply KPP scheme */')
310 CALL WRITE_1D_R8( PTRACERS_ref(1,iTracer), Nr, INDEX_K,
311 & 'PTRACERS_ref =', ' /* Reference vertical profile */')
312 CALL WRITE_0D_R8( PTRACERS_EvPrRn(iTracer), INDEX_NONE,
313 & 'PTRACERS_EvPrRn =', '/* tracer conc. in Evap. & Rain */')
314
315 ENDDO
316 WRITE(msgBuf,'(A)') ' -----------------------------------'
317 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
318
319 _END_MASTER(myThid)
320 C Everyone else must wait for the parameters to be loaded
321 _BARRIER
322
323 #endif /* ALLOW_PTRACERS */
324
325 RETURN
326 END
327

  ViewVC Help
Powered by ViewVC 1.1.22