/[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.14 - (show annotations) (download)
Wed Dec 1 22:54:02 2004 UTC (19 years, 6 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint56b_post, checkpoint56c_post
Changes since 1.13: +6 -1 lines
o collect all ptracers output in an new routine (PTRACERS_OUTPUT) that
  is called from DO_THE_MODEL_IO
  - rename PTRACERS_STATV_WRITE to PTRACERS_WRITE_TIMEAVE
  - introduce new parameter PTRACERS_dumpFreq (defaults to dumpFreq)
  - clean up PTRACERS_WRITE_TIMEAVE a little

1 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_readparms.F,v 1.13 2004/11/28 23:50:59 mlosch 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.h"
22 #include "PARAMS.h"
23
24 C !INPUT PARAMETERS:
25 INTEGER myThid
26 CEOP
27
28 #ifdef ALLOW_PTRACERS
29
30 C !LOCAL VARIABLES:
31 C k,iTracer :: loop indices
32 C iUnit :: unit number for I/O
33 C msgBuf :: message buffer
34 INTEGER k, iTracer
35 INTEGER iUnit
36 INTEGER ic
37 CHARACTER*(MAX_LEN_MBUF) msgBuf
38 _RL PTRACERS_diffKr(PTRACERS_num)
39
40 C PTRACERS_taveFreq :: Frequency with which time-averaged PTRACERS
41 C are written to post-processing files.
42 NAMELIST /PTRACERS_PARM01/
43 & PTRACERS_dumpFreq,
44 & PTRACERS_taveFreq,
45 & PTRACERS_monitorFreq,
46 & PTRACERS_advScheme,
47 & PTRACERS_diffKh,
48 & PTRACERS_diffK4,
49 & PTRACERS_diffKr,
50 & PTRACERS_diffKrNr,
51 & PTRACERS_useGMRedi,
52 & PTRACERS_useKPP,
53 & PTRACERS_numInUse,
54 & PTRACERS_initialFile,
55 & PTRACERS_useRecords,
56 & PTRACERS_names,
57 & PTRACERS_long_names,
58 & PTRACERS_units,
59 & PTRACERS_read_mnc,
60 & PTRACERS_write_mnc
61
62 C This routine has been called by the main model so we set our
63 C internal flag to indicate we are in business
64 PTRACERSisON=.TRUE.
65
66 C Set defaults values for parameters in PTRACERS.h
67 PTRACERS_taveFreq = dumpFreq
68 PTRACERS_taveFreq = taveFreq
69 PTRACERS_monitorFreq = monitorFreq
70 PTRACERS_numInUse=-1
71 DO iTracer=1,PTRACERS_num
72 PTRACERS_advScheme(iTracer)=saltAdvScheme
73 PTRACERS_diffKh(iTracer)=diffKhS
74 PTRACERS_diffK4(iTracer)=diffK4S
75 PTRACERS_diffKr(iTracer)=UNSET_RL
76 DO k=1,Nr
77 PTRACERS_diffKrNr(k,iTracer)=diffKrNrS(k)
78 ENDDO
79 PTRACERS_useGMRedi(iTracer)=useGMRedi
80 PTRACERS_useKPP(iTracer)=useKPP
81 PTRACERS_initialFile(iTracer)=' '
82 DO ic = 1,MAX_LEN_FNAM
83 PTRACERS_names(iTracer)(ic:ic) = ' '
84 PTRACERS_long_names(iTracer)(ic:ic) = ' '
85 PTRACERS_units(iTracer)(ic:ic) = ' '
86 ENDDO
87 ENDDO
88 PTRACERS_useRecords = .FALSE.
89 PTRACERS_read_mdsio = .TRUE.
90 PTRACERS_read_mnc = .FALSE.
91 PTRACERS_write_mdsio = .TRUE.
92 PTRACERS_write_mnc = .FALSE.
93
94 C Open and read the data.ptracers file
95 _BEGIN_MASTER(myThid)
96 WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers'
97 CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
98 & SQUEEZE_RIGHT , 1)
99 CALL OPEN_COPY_DATA_FILE(
100 I 'data.ptracers', 'PTRACERS_READPARMS',
101 O iUnit,
102 I myThid )
103 READ(UNIT=iUnit,NML=PTRACERS_PARM01)
104 WRITE(msgBuf,'(A)')
105 & ' PTRACERS_READPARMS: finished reading data.ptracers'
106 CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
107 & SQUEEZE_RIGHT , 1)
108
109 C Close the open data file
110 CLOSE(iUnit)
111 _END_MASTER(myThid)
112
113 C Everyone else must wait for the parameters to be loaded
114 _BARRIER
115
116 C Now set-up any remaining parameters that result from the input
117 C parameters
118
119 C If PTRACERS_numInUse was not set in data.ptracers then we can
120 C assume that all PTRACERS fields will be in use
121 IF (PTRACERS_numInUse.LT.0) THEN
122 PTRACERS_numInUse=PTRACERS_num
123 ENDIF
124 C Check we are not trying to use more tracers than allowed
125 IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN
126 WRITE(msgBuf,'(A,I2,A,I2,A)')
127 & ' PTRACERS_READPARMS: You requested ',PTRACERS_numInUse,
128 & ' tracers at run time when only ',PTRACERS_num,
129 & ' were specified at compile time. Naughty! '
130 CALL PRINT_ERROR(msgBuf, 1)
131 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
132 ENDIF
133 C Check that enough parameters were specified
134 DO iTracer=1,PTRACERS_numInUse
135 IF (PTRACERS_advScheme(iTracer).EQ.0) THEN
136 WRITE(msgBuf,'(A,A,I2)')
137 & ' PTRACERS_READPARMS: ',
138 & 'No advect. scheme specified for tracer #',
139 & iTracer
140 CALL PRINT_ERROR(msgBuf, 1)
141 STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
142 ENDIF
143 ENDDO
144 DO iTracer=1,PTRACERS_numInUse
145 PTRACERS_useGMRedi(iTracer) = PTRACERS_useGMRedi(iTracer)
146 & .AND.useGMRedi
147 PTRACERS_useKPP(iTracer) = PTRACERS_useKPP(iTracer)
148 & .AND.useKPP
149 IF ( PTRACERS_diffKr(iTracer).NE.UNSET_RL ) THEN
150 DO k=1,Nr
151 PTRACERS_diffKrNr(k,iTracer)=PTRACERS_diffKr(iTracer)
152 ENDDO
153 ENDIF
154 ENDDO
155
156 #ifdef ALLOW_MNC
157 IF (useMNC) THEN
158 C Set the default I/O Types
159 IF (PTRACERS_read_mnc) PTRACERS_read_mdsio = .FALSE.
160 IF ( (.NOT. outputTypesInclusive)
161 & .AND. PTRACERS_write_mnc ) pickup_write_mdsio = .FALSE.
162 IF ( (.NOT. outputTypesInclusive)
163 & .AND. PTRACERS_write_mnc ) PTRACERS_write_mdsio = .FALSE.
164
165 C Initialize the MNC variable types for PTRACERS
166 CALL PTRACERS_MNC_INIT( myThid )
167 ENDIF
168 #endif /* ALLOW_MNC */
169
170 C-- Print a summary of pTracer parameter values:
171 iUnit = standardMessageUnit
172 WRITE(msgBuf,'(A)') '// ==================================='
173 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
174 WRITE(msgBuf,'(A)') '// PTRACERS parameters '
175 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
176 WRITE(msgBuf,'(A)') '// ==================================='
177 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
178 CALL WRITE_0D_I( PTRACERS_numInUse, INDEX_NONE,
179 & 'PTRACERS_numInUse =',
180 & ' /* number of tracers */')
181 CALL WRITE_0D_R8(PTRACERS_dumpFreq, INDEX_NONE,
182 & 'PTRACERS_dumpFreq =',
183 & ' /* Frequency^-1 for snapshot output (s) */')
184 CALL WRITE_0D_R8(PTRACERS_taveFreq, INDEX_NONE,
185 & 'PTRACERS_taveFreq =',
186 & ' /* Frequency^-1 for time-Aver. output (s) */')
187 CALL WRITE_0D_L( PTRACERS_useRecords, INDEX_NONE,
188 & 'PTRACERS_useRecords =', ' /* all tracers in 1 file */')
189 CALL WRITE_0D_L( PTRACERS_write_mdsio, INDEX_NONE,
190 & 'PTRACERS_write_mdsio =', ' /* write mdsio files */')
191 CALL WRITE_0D_L( PTRACERS_write_mnc, INDEX_NONE,
192 & 'PTRACERS_write_mnc =', ' /* write mnc files */')
193
194 DO iTracer=1,PTRACERS_numInUse
195 WRITE(msgBuf,'(A)') ' -----------------------------------'
196 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
197 WRITE(msgBuf,'(A,I4)') ' tracer number : ',iTracer
198 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
199 CALL WRITE_0D_I( PTRACERS_advScheme(iTracer), INDEX_NONE,
200 & 'PTRACERS_advScheme =', ' /* Advection Scheme */')
201 CALL WRITE_0D_R8( PTRACERS_diffKh(iTracer), INDEX_NONE,
202 & 'PTRACERS_diffKh =', ' /* Laplacian Diffusivity */')
203 CALL WRITE_0D_R8( PTRACERS_diffK4(iTracer), INDEX_NONE,
204 & 'PTRACERS_diffK4 =', ' /* Biharmonic Diffusivity */')
205 CALL WRITE_1D_R8( PTRACERS_diffKrNr(1,iTracer), Nr, INDEX_K,
206 & 'PTRACERS_diffKrNr =', ' /* Vertical Diffusivity */')
207 CALL WRITE_0D_L( PTRACERS_useGMRedi(iTracer), INDEX_NONE,
208 & 'PTRACERS_useGMRedi =', ' /* apply GM-Redi */')
209 CALL WRITE_0D_L( PTRACERS_useKPP(iTracer), INDEX_NONE,
210 & 'PTRACERS_useKPP =', ' /* apply KPP scheme */')
211
212 ENDDO
213 WRITE(msgBuf,'(A)') ' -----------------------------------'
214 CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , 1)
215 #endif /* ALLOW_PTRACERS */
216
217 RETURN
218 END
219

  ViewVC Help
Powered by ViewVC 1.1.22