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

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

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

revision 1.4 by dimitri, Thu Nov 13 06:35:15 2003 UTC revision 1.9 by jmc, Sun Oct 17 23:06:52 2004 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "PTRACERS_OPTIONS.h"  #include "PTRACERS_OPTIONS.h"
5    
6    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7  CBOP  CBOP
8  C !ROUTINE: PTRACERS_READPARMS  C     !ROUTINE: PTRACERS_READPARMS
9          
10  C !INTERFACE: ==========================================================  C     !INTERFACE:
11        SUBROUTINE PTRACERS_READPARMS( myThid )        SUBROUTINE PTRACERS_READPARMS( myThid )
12          
13  C !DESCRIPTION:  C     !DESCRIPTION:
14  C     Initialize PTRACERS parameters, read in data.ptracers  C     Initialize PTRACERS parameters, read in data.ptracers
15    
16  C !USES: ===============================================================  C     !USES:
17        IMPLICIT NONE        IMPLICIT NONE
18  #include "SIZE.h"  #include "SIZE.h"
19  #include "EEPARAMS.h"  #include "EEPARAMS.h"
20    #include "PTRACERS_SIZE.h"
21  #include "PTRACERS.h"  #include "PTRACERS.h"
22  #include "PARAMS.h"  #include "PARAMS.h"
23    
24  C !INPUT PARAMETERS: ===================================================  C     !INPUT PARAMETERS:
 C  myThid               :: thread number  
25        INTEGER myThid        INTEGER myThid
26    CEOP
 C !OUTPUT PARAMETERS: ==================================================  
 C  none  
27    
28  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
29    
30  C !LOCAL VARIABLES: ====================================================  C     !LOCAL VARIABLES:
31  C  iTracer              :: loop indices  C     iTracer    :: loop indices
32  C  iUnit                :: unit number for I/O  C     iUnit      :: unit number for I/O
33  C  msgBuf               :: message buffer  C     msgBuf     :: message buffer
34        INTEGER iTracer        INTEGER iTracer
35        INTEGER iUnit        INTEGER iUnit
36          INTEGER ic
37        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
 CEOP  
38    
39  C This routine has been called by the main model so we set our  C     PTRACERS_taveFreq :: Frequency with which time-averaged PTRACERS
40  C internal flag to indicate we are in business  C                          are written to post-processing files.
41          NAMELIST /PTRACERS_PARM01/
42         &     PTRACERS_taveFreq,
43         &     PTRACERS_advScheme,
44         &     PTRACERS_diffKh,
45         &     PTRACERS_diffK4,
46         &     PTRACERS_diffKr,
47         &     PTRACERS_useGMRedi,
48         &     PTRACERS_useKPP,
49         &     PTRACERS_numInUse,
50         &     PTRACERS_initialFile,
51         &     PTRACERS_useRecords,
52         &     PTRACERS_names,
53         &     PTRACERS_long_names,
54         &     PTRACERS_units,
55         &     PTRACERS_write_ioinc,
56         &     PTRACERS_read_mnc,
57         &     PTRACERS_write_mnc
58    
59    C     This routine has been called by the main model so we set our
60    C     internal flag to indicate we are in business
61        PTRACERSisON=.TRUE.        PTRACERSisON=.TRUE.
62    
63  C Set defaults values for parameters in PTRACERS.h  C     Set defaults values for parameters in PTRACERS.h
64        PTRACERS_taveFreq=taveFreq        PTRACERS_taveFreq=taveFreq
65        PTRACERS_numInUse=-1        PTRACERS_numInUse=-1
66        DO iTracer=1,PTRACERS_num        DO iTracer=1,PTRACERS_num
67         PTRACERS_advScheme(iTracer)=saltAdvScheme          PTRACERS_advScheme(iTracer)=saltAdvScheme
68         PTRACERS_diffKh(iTracer)=diffKhS          PTRACERS_diffKh(iTracer)=diffKhS
69         PTRACERS_diffK4(iTracer)=diffK4S          PTRACERS_diffK4(iTracer)=diffK4S
70         PTRACERS_diffKr(iTracer)=diffKrS          PTRACERS_diffKr(iTracer)=diffKrNrS(1)
71         PTRACERS_useGMRedi(iTracer)=useGMRedi          PTRACERS_useGMRedi(iTracer)=useGMRedi
72         PTRACERS_useKPP(iTracer)=useKPP          PTRACERS_useKPP(iTracer)=useKPP
73         PTRACERS_initialFile(iTracer)=' '          PTRACERS_initialFile(iTracer)=' '
74            DO ic = 1,MAX_LEN_FNAM
75              PTRACERS_names(iTracer)(ic:ic) = ' '
76              PTRACERS_long_names(iTracer)(ic:ic) = ' '
77              PTRACERS_units(iTracer)(ic:ic) = ' '
78            ENDDO
79        ENDDO        ENDDO
80        PTRACERS_useRecords=.FALSE.        PTRACERS_useRecords  = .FALSE.
81          PTRACERS_read_mdsio  = .TRUE.
82          PTRACERS_read_mnc    = .FALSE.
83          PTRACERS_write_mdsio = .TRUE.
84          PTRACERS_write_mnc   = .FALSE.
85          PTRACERS_write_ioinc = .FALSE.
86    
87  C Open and read the data.ptracers file  C     Open and read the data.ptracers file
88        _BEGIN_MASTER(myThid)        _BEGIN_MASTER(myThid)
89        WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers'        WRITE(msgBuf,'(A)') ' PTRACERS_READPARMS: opening data.ptracers'
90        CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,        CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
# Line 70  C Open and read the data.ptracers file Line 99  C Open and read the data.ptracers file
99        CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,        CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
100       &                   SQUEEZE_RIGHT , 1)       &                   SQUEEZE_RIGHT , 1)
101    
102  C Close the open data file  C     Close the open data file
103        CLOSE(iUnit)        CLOSE(iUnit)
104        _END_MASTER(myThid)        _END_MASTER(myThid)
105    
106  C Everyone else must wait for the parameters to be loaded  C     Everyone else must wait for the parameters to be loaded
107        _BARRIER        _BARRIER
108    
109  C Now set-up any remaining parameters that result from the input parameters  C     Now set-up any remaining parameters that result from the input
110    C     parameters
111    
112  C If PTRACERS_numInUse was not set in data.ptracers then we can assume  C     If PTRACERS_numInUse was not set in data.ptracers then we can
113  C that all PTRACERS fields will be in use  C     assume that all PTRACERS fields will be in use
114        IF (PTRACERS_numInUse.LT.0) THEN        IF (PTRACERS_numInUse.LT.0) THEN
115         PTRACERS_numInUse=PTRACERS_num          PTRACERS_numInUse=PTRACERS_num
116        ENDIF        ENDIF
117  C Check we are not trying to use more tracers than allowed  C     Check we are not trying to use more tracers than allowed
118        IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN        IF (PTRACERS_numInUse.GT.PTRACERS_num) THEN
119         WRITE(msgBuf,'(A,I2,A,I2,A)')          WRITE(msgBuf,'(A,I2,A,I2,A)')
120       & ' PTRACERS_READPARMS: You requested ',PTRACERS_numInUse,       &       ' PTRACERS_READPARMS: You requested ',PTRACERS_numInUse,
121       & ' tracers at run time when only ',PTRACERS_num,       &       ' tracers at run time when only ',PTRACERS_num,
122       & ' were specified at compile time. Naughty! '       &       ' were specified at compile time. Naughty! '
        CALL PRINT_ERROR(msgBuf, 1)  
        STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'  
       ENDIF  
 C Check that enough parameters were specified  
       DO iTracer=1,PTRACERS_numInUse  
        IF (PTRACERS_advScheme(iTracer).EQ.0) THEN  
         WRITE(msgBuf,'(A,I2)')  
      &  ' PTRACERS_READPARMS: No advect. scheme specified for tracer #',  
      &  iTracer  
123          CALL PRINT_ERROR(msgBuf, 1)          CALL PRINT_ERROR(msgBuf, 1)
124          STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'          STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
125         ENDIF        ENDIF
126    C     Check that enough parameters were specified
127          DO iTracer=1,PTRACERS_numInUse
128            IF (PTRACERS_advScheme(iTracer).EQ.0) THEN
129              WRITE(msgBuf,'(A,A,I2)')
130         &         ' PTRACERS_READPARMS: ',
131         &         'No advect. scheme specified for tracer #',
132         &         iTracer
133              CALL PRINT_ERROR(msgBuf, 1)
134              STOP 'ABNORMAL END: S/R PTRACERS_READPARMS'
135            ENDIF
136        ENDDO        ENDDO
137    
138    #ifdef ALLOW_MNC
139          IF (useMNC) THEN
140    C       Set the default I/O Types
141            IF (PTRACERS_read_mnc) PTRACERS_read_mdsio = .FALSE.
142            IF ( (.NOT. PTRACERS_write_ioinc)
143         &       .AND. PTRACERS_write_mnc ) pickup_write_mdsio = .FALSE.
144            
145    C       Initialize the MNC variable types for PTRACERS
146            CALL PTRACERS_MNC_INIT( myThid )
147          ENDIF
148    #endif /*  ALLOW_MNC  */
149          
150  #endif /* ALLOW_PTRACERS */  #endif /* ALLOW_PTRACERS */
151    
152        RETURN        RETURN
153        END        END
154    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22