1 |
C $Header: /u/gcmpack/MITgcm/pkg/gchem/gchem_check.F,v 1.7 2014/05/21 19:31:23 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GCHEM_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GCHEM_CHECK |
8 |
C !INTERFACE: |
9 |
SUBROUTINE GCHEM_CHECK( myThid ) |
10 |
C !DESCRIPTION: \bv |
11 |
C *==========================================================* |
12 |
C | SUBROUTINE GCHEM_CHECK |
13 |
C | o Validate basic package setup and inter-package |
14 |
C | dependencies. |
15 |
C *==========================================================* |
16 |
C \ev |
17 |
|
18 |
C !USES: |
19 |
IMPLICIT NONE |
20 |
C === Global variables === |
21 |
#include "SIZE.h" |
22 |
#include "EEPARAMS.h" |
23 |
#include "PARAMS.h" |
24 |
#include "GCHEM.h" |
25 |
#ifdef ALLOW_CFC |
26 |
# include "CFC_SIZE.h" |
27 |
#endif |
28 |
#ifdef ALLOW_SPOIL |
29 |
# include "SPOIL_SIZE.h" |
30 |
#endif |
31 |
#include "GCHEM_SIZE.h" |
32 |
#ifdef ALLOW_PTRACERS |
33 |
# include "PTRACERS_SIZE.h" |
34 |
# include "PTRACERS_PARAMS.h" |
35 |
#endif |
36 |
|
37 |
C !INPUT/OUTPUT PARAMETERS: |
38 |
C myThid :: My Thread Id number |
39 |
INTEGER myThid |
40 |
|
41 |
#ifdef ALLOW_GCHEM |
42 |
C !LOCAL VARIABLES: |
43 |
C msgBuf :: Informational/error message buffer |
44 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
45 |
INTEGER errCount |
46 |
INTEGER nb_tendTr |
47 |
CEOP |
48 |
|
49 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
50 |
|
51 |
_BEGIN_MASTER(myThid) |
52 |
errCount = 0 |
53 |
|
54 |
WRITE(msgBuf,'(2A)') 'GCHEM_CHECK ', |
55 |
& ' --> Starts to check GCHEM set-up' |
56 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
57 |
& SQUEEZE_RIGHT, myThid ) |
58 |
|
59 |
C-- Check GCHEM Options and Parameters: |
60 |
|
61 |
#ifndef GCHEM_ADD2TR_TENDENCY |
62 |
IF ( useCFC ) THEN |
63 |
WRITE(msgBuf,'(A)') 'GCHEM_ADD2TR_TENDENCY needed to use CFC' |
64 |
CALL PRINT_ERROR( msgBuf, myThid ) |
65 |
errCount = errCount + 1 |
66 |
ENDIF |
67 |
#endif /* ndef GCHEM_ADD2TR_TENDENCY */ |
68 |
|
69 |
#ifndef GCHEM_SEPARATE_FORCING |
70 |
IF ( useDIC ) THEN |
71 |
WRITE(msgBuf,'(A)') 'GCHEM_SEPARATE_FORCING needed to use DIC' |
72 |
CALL PRINT_ERROR( msgBuf, myThid ) |
73 |
errCount = errCount + 1 |
74 |
ENDIF |
75 |
IF ( useBLING ) THEN |
76 |
WRITE(msgBuf,'(A)') |
77 |
& 'GCHEM_SEPARATE_FORCING needed to use BLING' |
78 |
CALL PRINT_ERROR( msgBuf, myThid ) |
79 |
errCount = errCount + 1 |
80 |
ENDIF |
81 |
IF ( useDARWIN ) THEN |
82 |
WRITE(msgBuf,'(A)') |
83 |
& 'GCHEM_SEPARATE_FORCING needed to use DARWIN' |
84 |
CALL PRINT_ERROR( msgBuf, myThid ) |
85 |
errCount = errCount + 1 |
86 |
ENDIF |
87 |
#endif /* ndef GCHEM_SEPARATE_FORCING */ |
88 |
|
89 |
C GCHEM needs passive tracer package |
90 |
IF ( .NOT.usePTRACERS) THEN |
91 |
WRITE(msgBuf,'(A)') 'usePTRACERS has to be .TRUE. for GCHEM' |
92 |
CALL PRINT_ERROR( msgBuf, myThid ) |
93 |
errCount = errCount + 1 |
94 |
ENDIF |
95 |
|
96 |
C GCHEM cannot run BLING and DIC together |
97 |
IF ( useBLING .AND. useDIC ) THEN |
98 |
WRITE(msgBuf,'(A)') |
99 |
& 'useBLING and useDIC cannot both be .TRUE.' |
100 |
CALL PRINT_ERROR( msgBuf, myThid ) |
101 |
errCount = errCount + 1 |
102 |
ENDIF |
103 |
|
104 |
C GCHEM cannot run BLING and DARWIN together |
105 |
IF ( useBLING .AND. useDARWIN ) THEN |
106 |
WRITE(msgBuf,'(A)') |
107 |
& 'useBLING and useDARWIN cannot both be .TRUE.' |
108 |
CALL PRINT_ERROR( msgBuf, myThid ) |
109 |
errCount = errCount + 1 |
110 |
ENDIF |
111 |
|
112 |
C GCHEM cannot run DARWIN and DIC together |
113 |
IF ( useDARWIN .AND. useDIC ) THEN |
114 |
WRITE(msgBuf,'(A)') |
115 |
& 'useDARWIN and useDIC cannot both be .TRUE.' |
116 |
CALL PRINT_ERROR( msgBuf, myThid ) |
117 |
errCount = errCount + 1 |
118 |
ENDIF |
119 |
|
120 |
nb_tendTr = gchem_Tracer_num - gchem_sepFTr_num |
121 |
IF ( nb_tendTr.GT.GCHEM_tendTr_num ) THEN |
122 |
WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ', |
123 |
& 'Number of tendency-tracers: nb_tendTr=', nb_tendTr |
124 |
CALL PRINT_ERROR( msgBuf , myThid ) |
125 |
WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ', |
126 |
& 'Exceeds GCHEM_tendTr_num=', GCHEM_tendTr_num, |
127 |
& ' (from GCHEM_SIZE.h)' |
128 |
CALL PRINT_ERROR( msgBuf, myThid ) |
129 |
errCount = errCount + 1 |
130 |
ENDIF |
131 |
IF ( gchem_Tracer_num.GT.PTRACERS_numInUse ) THEN |
132 |
WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ', |
133 |
& 'Number of GCHEM tracers: gchem_Tracer_num =', gchem_Tracer_num |
134 |
CALL PRINT_ERROR( msgBuf, myThid ) |
135 |
WRITE(msgBuf,'(2A,I5,A)') 'GCHEM_CHECK: ', |
136 |
& ' exceeds number of pTr: PTRACERS_numInUse =',PTRACERS_numInUse |
137 |
c & ' exceeds number of PTRACERS(_numInUse)=', PTRACERS_numInUse |
138 |
CALL PRINT_ERROR( msgBuf, myThid ) |
139 |
errCount = errCount + 1 |
140 |
ENDIF |
141 |
|
142 |
IF ( errCount.GE.1 ) THEN |
143 |
WRITE(msgBuf,'(A,I3,A)') |
144 |
& 'GCEHM_CHECK: detected', errCount,' fatal error(s)' |
145 |
CALL PRINT_ERROR( msgBuf, myThid ) |
146 |
CALL ALL_PROC_DIE( 0 ) |
147 |
STOP 'ABNORMAL END: S/R GCHEM_CHECK' |
148 |
ENDIF |
149 |
_END_MASTER(myThid) |
150 |
|
151 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
152 |
|
153 |
C-- Check other GCHEM pkgs: |
154 |
|
155 |
#ifdef ALLOW_CFC |
156 |
C- run checks specific to CFC |
157 |
IF ( useCFC ) THEN |
158 |
CALL CFC_CHECK( myThid ) |
159 |
ENDIF |
160 |
#endif |
161 |
|
162 |
#ifdef ALLOW_DARWIN |
163 |
C- run checks specific to darwin |
164 |
IF ( useDARWIN ) THEN |
165 |
CALL DARWIN_CHECK( myThid ) |
166 |
ENDIF |
167 |
#endif |
168 |
|
169 |
_BEGIN_MASTER(myThid) |
170 |
WRITE(msgBuf,'(2A)') 'GCHEM_CHECK ', |
171 |
& ' <-- Ends Normally' |
172 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
173 |
& SQUEEZE_RIGHT, myThid ) |
174 |
WRITE(msgBuf,'(2A)') ' ' |
175 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
176 |
& SQUEEZE_RIGHT, myThid ) |
177 |
|
178 |
_END_MASTER(myThid) |
179 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
180 |
|
181 |
#endif /* ALLOW_GCHEM */ |
182 |
|
183 |
RETURN |
184 |
END |