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

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

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


Revision 1.19 - (hide annotations) (download)
Sat May 14 22:50:15 2005 UTC (19 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57i_post, checkpoint57n_post, checkpoint57l_post, checkpoint57h_post, checkpoint57h_done, checkpoint57j_post, checkpoint57k_post
Changes since 1.18: +6 -1 lines
move tIter0 from data.gchem to PTRACERS_Iter0 in data.ptracers

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

  ViewVC Help
Powered by ViewVC 1.1.22