1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_readparms.F,v 1.4 2003/11/13 06:35:15 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PTRACERS_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: PTRACERS_READPARMS |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE PTRACERS_READPARMS( myThid ) |
11 |
|
12 |
C !DESCRIPTION: |
13 |
C Initialize PTRACERS parameters, read in data.ptracers |
14 |
|
15 |
C !USES: =============================================================== |
16 |
IMPLICIT NONE |
17 |
#include "SIZE.h" |
18 |
#include "EEPARAMS.h" |
19 |
#include "PTRACERS_SIZE.h" |
20 |
#include "PTRACERS.h" |
21 |
#include "PARAMS.h" |
22 |
|
23 |
C !INPUT PARAMETERS: =================================================== |
24 |
C myThid :: thread number |
25 |
INTEGER myThid |
26 |
|
27 |
C !OUTPUT PARAMETERS: ================================================== |
28 |
C none |
29 |
|
30 |
#ifdef ALLOW_PTRACERS |
31 |
|
32 |
C !LOCAL VARIABLES: ==================================================== |
33 |
C iTracer :: loop indices |
34 |
C iUnit :: unit number for I/O |
35 |
C msgBuf :: message buffer |
36 |
INTEGER iTracer |
37 |
INTEGER iUnit |
38 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
39 |
CEOP |
40 |
|
41 |
C PTRACERS_taveFreq :: Frequency with which time-averaged PTRACERS |
42 |
C are written to post-processing files. |
43 |
NAMELIST /PTRACERS_PARM01/ |
44 |
& PTRACERS_taveFreq, |
45 |
& PTRACERS_advScheme, |
46 |
& PTRACERS_diffKh, |
47 |
& PTRACERS_diffK4, |
48 |
& PTRACERS_diffKr, |
49 |
& PTRACERS_useGMRedi, |
50 |
& PTRACERS_useKPP, |
51 |
& PTRACERS_numInUse, |
52 |
& PTRACERS_initialFile, |
53 |
& PTRACERS_useRecords |
54 |
|
55 |
C This routine has been called by the main model so we set our |
56 |
C internal flag to indicate we are in business |
57 |
PTRACERSisON=.TRUE. |
58 |
|
59 |
C Set defaults values for parameters in PTRACERS.h |
60 |
PTRACERS_taveFreq=taveFreq |
61 |
PTRACERS_numInUse=-1 |
62 |
DO iTracer=1,PTRACERS_num |
63 |
PTRACERS_advScheme(iTracer)=saltAdvScheme |
64 |
PTRACERS_diffKh(iTracer)=diffKhS |
65 |
PTRACERS_diffK4(iTracer)=diffK4S |
66 |
PTRACERS_diffKr(iTracer)=diffKrS |
67 |
PTRACERS_useGMRedi(iTracer)=useGMRedi |
68 |
PTRACERS_useKPP(iTracer)=useKPP |
69 |
PTRACERS_initialFile(iTracer)=' ' |
70 |
ENDDO |
71 |
PTRACERS_useRecords=.FALSE. |
72 |
|
73 |
C Open and read the data.ptracers file |
74 |
_BEGIN_MASTER(myThid) |
75 |
WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers' |
76 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
77 |
& SQUEEZE_RIGHT , 1) |
78 |
CALL OPEN_COPY_DATA_FILE( |
79 |
I 'data.ptracers', 'PTRACERS_READPARMS', |
80 |
O iUnit, |
81 |
I myThid ) |
82 |
READ(UNIT=iUnit,NML=PTRACERS_PARM01) |
83 |
WRITE(msgBuf,'(A)') |
84 |
& ' PTRACERS_READPARMS: finished reading data.ptracers' |
85 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
86 |
& SQUEEZE_RIGHT , 1) |
87 |
|
88 |
C Close the open data file |
89 |
CLOSE(iUnit) |
90 |
_END_MASTER(myThid) |
91 |
|
92 |
C Everyone else must wait for the parameters to be loaded |
93 |
_BARRIER |
94 |
|
95 |
C Now set-up any remaining parameters that result from the input parameters |
96 |
|
97 |
C If PTRACERS_numInUse was not set in data.ptracers then we can assume |
98 |
C that all PTRACERS fields will be in use |
99 |
IF (PTRACERS_numInUse.LT.0) THEN |
100 |
PTRACERS_numInUse=PTRACERS_num |
101 |
ENDIF |
102 |
C Check we are not trying to use more tracers than allowed |
103 |
IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN |
104 |
WRITE(msgBuf,'(A,I2,A,I2,A)') |
105 |
& ' PTRACERS_READPARMS: You requested ',PTRACERS_numInUse, |
106 |
& ' tracers at run time when only ',PTRACERS_num, |
107 |
& ' were specified at compile time. Naughty! ' |
108 |
CALL PRINT_ERROR(msgBuf, 1) |
109 |
STOP 'ABNORMAL END: S/R PTRACERS_READPARMS' |
110 |
ENDIF |
111 |
C Check that enough parameters were specified |
112 |
DO iTracer=1,PTRACERS_numInUse |
113 |
IF (PTRACERS_advScheme(iTracer).EQ.0) THEN |
114 |
WRITE(msgBuf,'(A,I2)') |
115 |
& ' PTRACERS_READPARMS: No advect. scheme specified for tracer #', |
116 |
& iTracer |
117 |
CALL PRINT_ERROR(msgBuf, 1) |
118 |
STOP 'ABNORMAL END: S/R PTRACERS_READPARMS' |
119 |
ENDIF |
120 |
ENDDO |
121 |
|
122 |
|
123 |
#endif /* ALLOW_PTRACERS */ |
124 |
|
125 |
RETURN |
126 |
END |