1 |
C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_check.F,v 1.24 2011/02/10 21:24:19 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GMREDI_OPTIONS.h" |
5 |
#ifdef ALLOW_PTRACERS |
6 |
# include "PTRACERS_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
CBOP |
10 |
C !ROUTINE: GMREDI_CHECK |
11 |
C !INTERFACE: |
12 |
SUBROUTINE GMREDI_CHECK( myThid ) |
13 |
|
14 |
C !DESCRIPTION: \bv |
15 |
C *==========================================================* |
16 |
C | SUBROUTINE GMREDI_CHECK |
17 |
C | o Check consistency with model configuration |
18 |
C *==========================================================* |
19 |
C *==========================================================* |
20 |
C \ev |
21 |
|
22 |
C !USES: |
23 |
IMPLICIT NONE |
24 |
|
25 |
C === Global variables === |
26 |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
29 |
#include "GMREDI.h" |
30 |
#ifdef ALLOW_GENERIC_ADVDIFF |
31 |
# include "GAD.h" |
32 |
#endif |
33 |
#ifdef ALLOW_PTRACERS |
34 |
# include "PTRACERS_SIZE.h" |
35 |
# include "PTRACERS_PARAMS.h" |
36 |
#endif |
37 |
|
38 |
C !INPUT/OUTPUT PARAMETERS: |
39 |
C === Routine arguments === |
40 |
C myThid :: my Thread Id number |
41 |
INTEGER myThid |
42 |
|
43 |
#ifdef ALLOW_GMREDI |
44 |
C !LOCAL VARIABLES: |
45 |
C === Local variables === |
46 |
C msgBuf :: Informational/error message buffer |
47 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
48 |
CEOP |
49 |
#ifdef ALLOW_PTRACERS |
50 |
INTEGER iTr |
51 |
LOGICAL redFlag |
52 |
#endif |
53 |
|
54 |
_BEGIN_MASTER(myThid) |
55 |
|
56 |
WRITE(msgBuf,'(A)') 'GMREDI_CHECK: #define GMREDI' |
57 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
58 |
& SQUEEZE_RIGHT , myThid ) |
59 |
|
60 |
C- print out some kee parameters : |
61 |
CALL WRITE_0D_L( GM_AdvForm, INDEX_NONE, |
62 |
& 'GM_AdvForm =', ' /* if FALSE => use SkewFlux Form */') |
63 |
CALL WRITE_0D_L( GM_InMomAsStress, INDEX_NONE, |
64 |
& 'GM_InMomAsStress =', ' /* if TRUE => apply as Eddy Stress */') |
65 |
CALL WRITE_0D_L( GM_AdvSeparate, INDEX_NONE, |
66 |
& 'GM_AdvSeparate =',' /* Calc Bolus & Euler Adv. separately */') |
67 |
CALL WRITE_0D_L( GM_ExtraDiag, INDEX_NONE, |
68 |
& 'GM_ExtraDiag =',' /* Tensor Extra Diag (line 1&2) non 0 */') |
69 |
CALL WRITE_0D_RL( GM_isopycK, INDEX_NONE, 'GM_isopycK =', |
70 |
& ' /* Background Isopyc. Diffusivity [m^2/s] */') |
71 |
CALL WRITE_0D_RL( GM_background_K*GM_skewflx, INDEX_NONE, |
72 |
& 'GM_skewflx*K =', |
73 |
& ' /* Background GM_SkewFlx Diffusivity [m^2/s] */') |
74 |
CALL WRITE_0D_RL( GM_background_K*GM_advect, INDEX_NONE, |
75 |
& 'GM_advec*K =', |
76 |
& ' /* Backg. GM-Advec(=Bolus) Diffusivity [m^2/s]*/') |
77 |
CALL WRITE_0D_RL( GM_Kmin_horiz, INDEX_NONE, 'GM_Kmin_horiz =', |
78 |
& ' /* Minimum Horizontal Diffusivity [m^2/s] */') |
79 |
CALL WRITE_0D_RL( GM_Visbeck_alpha, INDEX_NONE, |
80 |
& 'GM_Visbeck_alpha =', ' /* Visbeck alpha coeff. [-] */') |
81 |
CALL WRITE_0D_RL( GM_Small_Number, INDEX_NONE, |
82 |
& 'GM_Small_Number =', ' /* epsilon used in slope calc */') |
83 |
CALL WRITE_0D_RL( GM_slopeSqCutoff, INDEX_NONE, |
84 |
& 'GM_slopeSqCutoff =', ' /* Slope^2 cut-off value */') |
85 |
CALL WRITE_0D_C( GM_taper_scheme, 0, INDEX_NONE, |
86 |
& 'GM_taper_scheme =', |
87 |
& ' /* Type of Tapering/Clipping scheme */') |
88 |
CALL WRITE_0D_RL( GM_maxSlope, INDEX_NONE, |
89 |
& 'GM_maxSlope =', ' /* Maximum Slope (Tapering/Clipping) */') |
90 |
CALL WRITE_0D_RL( GM_facTrL2dz, INDEX_NONE, |
91 |
& 'GM_facTrL2dz =', |
92 |
& ' /* Minimum Trans.Layer Thick. (factor of dz) */') |
93 |
CALL WRITE_0D_RL( GM_facTrL2ML, INDEX_NONE, |
94 |
& 'GM_facTrL2ML =', |
95 |
& ' /* Max.Trans.Layer Thick. (factor of MxL Depth)*/') |
96 |
CALL WRITE_0D_RL( GM_maxTransLay, INDEX_NONE, |
97 |
& 'GM_maxTransLay =', |
98 |
& ' /* Maximum Transition Layer Thickness [m] */') |
99 |
CALL WRITE_0D_L( GM_UseBVP, INDEX_NONE, |
100 |
& 'GM_UseBVP =', |
101 |
& ' /* if TRUE => use bvp a la Ferrari et al. (2010) */') |
102 |
CALL WRITE_0D_I( GM_BVP_ModeNumber, INDEX_NONE, |
103 |
& 'GM_BVP_ModeNumber =', |
104 |
& ' /* Vertical mode number for BVP wave speed */') |
105 |
CALL WRITE_0D_RL( GM_BVP_cMin, INDEX_NONE, |
106 |
& 'GM_BVP_cMin =', |
107 |
& ' /* Minimum wave speed for BVP [m/s] */') |
108 |
CALL WRITE_0D_L( GM_useSubMeso, INDEX_NONE, |
109 |
& 'GM_useSubMeso =', |
110 |
& ' /* if TRUE => use Sub-Meso param. (B.Fox-Kemper) */') |
111 |
CALL WRITE_0D_RL( subMeso_Ceff, INDEX_NONE, |
112 |
& 'subMeso_Ceff =', |
113 |
& ' /* efficiency coeff. of Mixed-Layer Eddies [-] */') |
114 |
CALL WRITE_0D_RL( subMeso_invTau, INDEX_NONE, |
115 |
& 'subMeso_invTau =', |
116 |
& ' /* inverse of Sub-Meso mixing time-scale [/s] */') |
117 |
CALL WRITE_0D_RL( subMeso_LfMin, INDEX_NONE, |
118 |
& 'subMeso_LfMin =',' /* minimum length-scale "Lf" [m] */') |
119 |
CALL WRITE_0D_RS( subMeso_Lmax, INDEX_NONE, |
120 |
& 'subMeso_Lmax =',' /* maximum grid-scale length [m] */') |
121 |
|
122 |
C-- Check parameters: |
123 |
|
124 |
C- GM/Redi needs implicit diffusion (will be packaged later) |
125 |
IF ( .NOT.implicitDiffusion ) THEN |
126 |
WRITE(msgBuf,'(A)') 'GM/Redi needs implicitDiffusion=.true.' |
127 |
CALL PRINT_ERROR( msgBuf , myThid ) |
128 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
129 |
ENDIF |
130 |
|
131 |
#ifndef GM_VISBECK_VARIABLE_K |
132 |
C Make sure we are not trying to use something that is unavailable |
133 |
IF ( GM_Visbeck_alpha.NE.0. ) THEN |
134 |
WRITE(msgBuf,'(A)') |
135 |
& ' GMREDI_CHECK: Visbeck variables used in data.gmredi' |
136 |
CALL PRINT_ERROR( msgBuf, myThid ) |
137 |
WRITE(msgBuf,'(A)') |
138 |
& ' GMREDI_CHECK: without #define GM_VISBECK_VARIABLE_K' |
139 |
CALL PRINT_ERROR( msgBuf, myThid ) |
140 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
141 |
ENDIF |
142 |
#endif |
143 |
|
144 |
#ifndef GM_BOLUS_ADVEC |
145 |
C Make sure we are not trying to use some arrays that are unavailable |
146 |
IF ( GM_AdvForm ) THEN |
147 |
WRITE(msgBuf,'(A)') |
148 |
& ' GMREDI_CHECK: GM Advection form used in data.gmredi' |
149 |
CALL PRINT_ERROR( msgBuf, myThid ) |
150 |
WRITE(msgBuf,'(A)') |
151 |
& ' GMREDI_CHECK: without #define GM_BOLUS_ADVEC' |
152 |
CALL PRINT_ERROR( msgBuf, myThid ) |
153 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
154 |
ENDIF |
155 |
#endif |
156 |
|
157 |
#ifndef GM_EXTRA_DIAGONAL |
158 |
C Make sure we are not trying to use some arrays that are unavailable |
159 |
IF ( GM_ExtraDiag ) THEN |
160 |
WRITE(msgBuf,'(A)') |
161 |
& ' GMREDI_CHECK: GM_skew_Flux_K & GM_isopycK not equal' |
162 |
CALL PRINT_ERROR( msgBuf, myThid ) |
163 |
WRITE(msgBuf,'(A)') |
164 |
& ' GMREDI_CHECK: without #define GM_EXTRA_DIAGONAL' |
165 |
CALL PRINT_ERROR( msgBuf, myThid ) |
166 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
167 |
ENDIF |
168 |
#endif |
169 |
|
170 |
#ifndef GM_NON_UNITY_DIAGONAL |
171 |
IF ( GM_iso2dFile .NE. ' ' .OR. |
172 |
& GM_iso1dFile .NE. ' ' ) THEN |
173 |
WRITE(msgBuf,'(A)') |
174 |
& ' GMREDI_CHECK: needs #define GM_NON_UNITY_DIAGONAL' |
175 |
CALL PRINT_ERROR( msgBuf, myThid ) |
176 |
WRITE(msgBuf,'(A)') |
177 |
& ' GMREDI_CHECK: to use GM_iso2dFile or GM_iso1dFile' |
178 |
CALL PRINT_ERROR( msgBuf, myThid ) |
179 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
180 |
ENDIF |
181 |
#endif |
182 |
|
183 |
#ifdef GM_EXCLUDE_SUBMESO |
184 |
IF ( GM_useSubMeso ) THEN |
185 |
WRITE(msgBuf,'(2A)') ' GMREDI_CHECK: ', |
186 |
& 'cannot use Sub-Meso (GM_useSubMeso=T)' |
187 |
CALL PRINT_ERROR( msgBuf, myThid ) |
188 |
WRITE(msgBuf,'(2A)') ' GMREDI_CHECK: ', |
189 |
& 'when compiled with #define GM_EXCLUDE_SUBMESO' |
190 |
CALL PRINT_ERROR( msgBuf, myThid ) |
191 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
192 |
ENDIF |
193 |
#endif /* GM_EXCLUDE_SUBMESO */ |
194 |
|
195 |
IF ( GM_useSubMeso .AND. .NOT.GM_AdvForm ) THEN |
196 |
WRITE(msgBuf,'(2A)') ' GMREDI_CHECK: ', |
197 |
& 'Sub-Meso only implemented within GM_AdvForm' |
198 |
CALL PRINT_ERROR( msgBuf, myThid ) |
199 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
200 |
ENDIF |
201 |
|
202 |
IF ( GM_InMomAsStress ) THEN |
203 |
#ifdef ALLOW_EDDYPSI |
204 |
WRITE(msgBuf,'(A)') |
205 |
& ' GMREDI_CHECK: Bug in ALLOW_EDDYPSI with GM_InMomAsStress' |
206 |
CALL PRINT_ERROR( msgBuf, myThid ) |
207 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
208 |
#else /* ALLOW_EDDYPSI */ |
209 |
WRITE(msgBuf,'(2A)') |
210 |
& ' GMREDI_CHECK: need to define ALLOW_EDDYPSI in CPP_OPTIONS.h', |
211 |
& ' to use GM_InMomAsStress' |
212 |
CALL PRINT_ERROR( msgBuf, myThid ) |
213 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
214 |
#endif /* ALLOW_EDDYPSI */ |
215 |
ENDIF |
216 |
IF ( GM_InMomAsStress .AND. .NOT.GM_AdvForm ) THEN |
217 |
WRITE(msgBuf,'(A)') |
218 |
& ' GMREDI_CHECK: need GM_AdvForm=T to use GM_InMomAsStress' |
219 |
CALL PRINT_ERROR( msgBuf, myThid ) |
220 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
221 |
ENDIF |
222 |
|
223 |
#ifdef ALLOW_PTRACERS |
224 |
IF ( GM_AdvForm .AND. .NOT.GM_AdvSeparate |
225 |
& .AND. usePTRACERS ) THEN |
226 |
redFlag = .FALSE. |
227 |
DO iTr=1,PTRACERS_numInUse |
228 |
IF ( .NOT.PTRACERS_useGMRedi(iTr) ) THEN |
229 |
redFlag = .TRUE. |
230 |
WRITE(msgBuf,'(2A,I3,A,L5)') ' GMREDI_CHECK:', |
231 |
& ' pTracers_useGMRedi(',iTr,' )=', PTRACERS_useGMRedi(iTr) |
232 |
CALL PRINT_ERROR( msgBuf, myThid ) |
233 |
ENDIF |
234 |
ENDDO |
235 |
IF ( redFlag ) THEN |
236 |
WRITE(msgBuf,'(2A)') ' GMREDI_CHECK:', |
237 |
& ' but GM Advective Form applies to all tracers !' |
238 |
CALL PRINT_ERROR( msgBuf, myThid ) |
239 |
STOP 'ABNORMAL END: S/R GMREDI_CHECK' |
240 |
ENDIF |
241 |
ENDIF |
242 |
#endif /* ALLOW_PTRACERS */ |
243 |
|
244 |
#ifdef ALLOW_GENERIC_ADVDIFF |
245 |
C Check size of overlap region |
246 |
IF ( GM_AdvForm .AND. .NOT.GM_AdvSeparate |
247 |
& .AND. GM_Visbeck_alpha.NE.0. |
248 |
& .AND. useMultiDimAdvec ) THEN |
249 |
C Visbeck variable K requires 1 more row/column in the overlap: |
250 |
C might need to increase Olx,Oly from 2 to 3 if GM advective |
251 |
C form & multi-dim advection are used. This happens when: |
252 |
C a) using a 5 points stencil advection scheme ; or |
253 |
C b) using a 3 points stencil advection scheme on CS-grid |
254 |
GAD_OlMinSize(2) = MAX( GAD_OlMinSize(2), 1) |
255 |
WRITE(msgBuf,'(A,9I3)') |
256 |
& 'GMREDI_CHECK: GAD_OlMinSize=', GAD_OlMinSize |
257 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
258 |
& SQUEEZE_RIGHT , myThid ) |
259 |
ENDIF |
260 |
#endif /* ALLOW_GENERIC_ADVDIFF */ |
261 |
|
262 |
_END_MASTER(myThid) |
263 |
|
264 |
#endif /* ALLOW_GMREDI */ |
265 |
RETURN |
266 |
END |