1 |
edhill |
1.7 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_readparms.F,v 1.6 2004/09/03 20:10:47 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 |
#ifdef ALLOW_MNC |
24 |
|
|
#include "MNC_PARAMS.h" |
25 |
|
|
#endif |
26 |
|
|
|
27 |
edhill |
1.6 |
C !INPUT PARAMETERS: |
28 |
adcroft |
1.1 |
INTEGER myThid |
29 |
edhill |
1.6 |
CEOP |
30 |
adcroft |
1.1 |
|
31 |
|
|
#ifdef ALLOW_PTRACERS |
32 |
|
|
|
33 |
edhill |
1.6 |
C !LOCAL VARIABLES: |
34 |
|
|
C iTracer :: loop indices |
35 |
|
|
C iUnit :: unit number for I/O |
36 |
|
|
C msgBuf :: message buffer |
37 |
adcroft |
1.1 |
INTEGER iTracer |
38 |
|
|
INTEGER iUnit |
39 |
edhill |
1.6 |
INTEGER ic |
40 |
adcroft |
1.1 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
41 |
|
|
|
42 |
jmc |
1.5 |
C PTRACERS_taveFreq :: Frequency with which time-averaged PTRACERS |
43 |
|
|
C are written to post-processing files. |
44 |
|
|
NAMELIST /PTRACERS_PARM01/ |
45 |
edhill |
1.6 |
& PTRACERS_taveFreq, |
46 |
|
|
& PTRACERS_advScheme, |
47 |
|
|
& PTRACERS_diffKh, |
48 |
|
|
& PTRACERS_diffK4, |
49 |
|
|
& PTRACERS_diffKr, |
50 |
|
|
& PTRACERS_useGMRedi, |
51 |
|
|
& PTRACERS_useKPP, |
52 |
|
|
& PTRACERS_numInUse, |
53 |
|
|
& PTRACERS_initialFile, |
54 |
|
|
& PTRACERS_useRecords, |
55 |
|
|
& PTRACERS_names, |
56 |
|
|
& PTRACERS_long_names, |
57 |
|
|
& PTRACERS_units, |
58 |
edhill |
1.7 |
& PTRACERS_write_ioinc, |
59 |
|
|
& PTRACERS_read_mnc, |
60 |
|
|
& PTRACERS_write_mnc |
61 |
jmc |
1.5 |
|
62 |
edhill |
1.6 |
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 |
adcroft |
1.1 |
PTRACERSisON=.TRUE. |
65 |
|
|
|
66 |
edhill |
1.6 |
C Set defaults values for parameters in PTRACERS.h |
67 |
dimitri |
1.4 |
PTRACERS_taveFreq=taveFreq |
68 |
adcroft |
1.1 |
PTRACERS_numInUse=-1 |
69 |
|
|
DO iTracer=1,PTRACERS_num |
70 |
edhill |
1.6 |
PTRACERS_advScheme(iTracer)=saltAdvScheme |
71 |
|
|
PTRACERS_diffKh(iTracer)=diffKhS |
72 |
|
|
PTRACERS_diffK4(iTracer)=diffK4S |
73 |
|
|
PTRACERS_diffKr(iTracer)=diffKrS |
74 |
|
|
PTRACERS_useGMRedi(iTracer)=useGMRedi |
75 |
|
|
PTRACERS_useKPP(iTracer)=useKPP |
76 |
|
|
PTRACERS_initialFile(iTracer)=' ' |
77 |
|
|
DO ic = 1,MAX_LEN_FNAM |
78 |
|
|
PTRACERS_names(iTracer)(ic:ic) = ' ' |
79 |
|
|
PTRACERS_long_names(iTracer)(ic:ic) = ' ' |
80 |
|
|
PTRACERS_units(iTracer)(ic:ic) = ' ' |
81 |
|
|
ENDDO |
82 |
adcroft |
1.1 |
ENDDO |
83 |
edhill |
1.7 |
PTRACERS_useRecords = .FALSE. |
84 |
|
|
PTRACERS_read_mdsio = .TRUE. |
85 |
|
|
PTRACERS_read_mnc = .FALSE. |
86 |
|
|
PTRACERS_write_mdsio = .TRUE. |
87 |
|
|
PTRACERS_write_mnc = .FALSE. |
88 |
|
|
PTRACERS_write_ioinc = .FALSE. |
89 |
adcroft |
1.1 |
|
90 |
edhill |
1.6 |
C Open and read the data.ptracers file |
91 |
adcroft |
1.1 |
_BEGIN_MASTER(myThid) |
92 |
|
|
WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers' |
93 |
|
|
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
94 |
|
|
& SQUEEZE_RIGHT , 1) |
95 |
|
|
CALL OPEN_COPY_DATA_FILE( |
96 |
|
|
I 'data.ptracers', 'PTRACERS_READPARMS', |
97 |
|
|
O iUnit, |
98 |
|
|
I myThid ) |
99 |
|
|
READ(UNIT=iUnit,NML=PTRACERS_PARM01) |
100 |
|
|
WRITE(msgBuf,'(A)') |
101 |
|
|
& ' PTRACERS_READPARMS: finished reading data.ptracers' |
102 |
|
|
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
103 |
|
|
& SQUEEZE_RIGHT , 1) |
104 |
|
|
|
105 |
edhill |
1.6 |
C Close the open data file |
106 |
adcroft |
1.1 |
CLOSE(iUnit) |
107 |
|
|
_END_MASTER(myThid) |
108 |
|
|
|
109 |
edhill |
1.6 |
C Everyone else must wait for the parameters to be loaded |
110 |
adcroft |
1.1 |
_BARRIER |
111 |
|
|
|
112 |
edhill |
1.6 |
C Now set-up any remaining parameters that result from the input |
113 |
|
|
C parameters |
114 |
adcroft |
1.1 |
|
115 |
edhill |
1.6 |
C If PTRACERS_numInUse was not set in data.ptracers then we can |
116 |
|
|
C assume that all PTRACERS fields will be in use |
117 |
adcroft |
1.1 |
IF (PTRACERS_numInUse.LT.0) THEN |
118 |
edhill |
1.6 |
PTRACERS_numInUse=PTRACERS_num |
119 |
adcroft |
1.1 |
ENDIF |
120 |
edhill |
1.6 |
C Check we are not trying to use more tracers than allowed |
121 |
adcroft |
1.1 |
IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN |
122 |
edhill |
1.6 |
WRITE(msgBuf,'(A,I2,A,I2,A)') |
123 |
|
|
& ' PTRACERS_READPARMS: You requested ',PTRACERS_numInUse, |
124 |
|
|
& ' tracers at run time when only ',PTRACERS_num, |
125 |
|
|
& ' were specified at compile time. Naughty! ' |
126 |
|
|
CALL PRINT_ERROR(msgBuf, 1) |
127 |
|
|
STOP 'ABNORMAL END: S/R PTRACERS_READPARMS' |
128 |
adcroft |
1.1 |
ENDIF |
129 |
edhill |
1.6 |
C Check that enough parameters were specified |
130 |
adcroft |
1.1 |
DO iTracer=1,PTRACERS_numInUse |
131 |
edhill |
1.6 |
IF (PTRACERS_advScheme(iTracer).EQ.0) THEN |
132 |
|
|
WRITE(msgBuf,'(A,A,I2)') |
133 |
|
|
& ' PTRACERS_READPARMS: ', |
134 |
|
|
& 'No advect. scheme specified for tracer #', |
135 |
|
|
& iTracer |
136 |
|
|
CALL PRINT_ERROR(msgBuf, 1) |
137 |
|
|
STOP 'ABNORMAL END: S/R PTRACERS_READPARMS' |
138 |
|
|
ENDIF |
139 |
adcroft |
1.1 |
ENDDO |
140 |
|
|
|
141 |
edhill |
1.6 |
#ifdef ALLOW_MNC |
142 |
|
|
IF (useMNC) THEN |
143 |
edhill |
1.7 |
C Set the default I/O Types |
144 |
|
|
IF (PTRACERS_read_mnc) PTRACERS_read_mdsio = .FALSE. |
145 |
|
|
IF ( (.NOT. PTRACERS_write_ioinc) |
146 |
|
|
& .AND. PTRACERS_write_mnc ) pickup_write_mdsio = .FALSE. |
147 |
|
|
|
148 |
|
|
C Initialize the MNC variable types for PTRACERS |
149 |
edhill |
1.6 |
CALL PTRACERS_MNC_INIT( myThid ) |
150 |
|
|
ENDIF |
151 |
|
|
#endif /* ALLOW_MNC */ |
152 |
|
|
|
153 |
adcroft |
1.1 |
#endif /* ALLOW_PTRACERS */ |
154 |
|
|
|
155 |
|
|
RETURN |
156 |
|
|
END |
157 |
edhill |
1.6 |
|