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