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