/[MITgcm]/MITgcm_contrib/submesoscale/code/gmredi_check.F
ViewVC logotype

Contents of /MITgcm_contrib/submesoscale/code/gmredi_check.F

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


Revision 1.3 - (show annotations) (download)
Fri May 30 22:24:25 2008 UTC (17 years, 1 month ago) by dimitri
Branch: MAIN
Changes since 1.2: +3 -1 lines
Modifications to make it compatible with Gael's 30 May 2008 changes.

1 C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_check.F,v 1.16 2008/05/30 02:50:16 gforget 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 meesage 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_R8( GM_isopycK, INDEX_NONE, 'GM_isopycK =',
70 & ' /* Background Isopyc. Diffusivity ( m^2/s ) */')
71 CALL WRITE_0D_R8( GM_background_K*GM_skewflx, INDEX_NONE,
72 & ' GM_skewflx*K =',
73 & ' /* Background GM_SkewFlx Diffusivity ( m^2/s ) */')
74 CALL WRITE_0D_R8( GM_background_K*GM_advect, INDEX_NONE,
75 & ' GM_advec*K =',
76 & ' /* Backg. GM-Advec(=Bolus) Diffusivity ( m^2/s ) */')
77 CALL WRITE_0D_R8( GM_Visbeck_alpha, INDEX_NONE,
78 & ' GM_Visbeck_alpha =',' /* Visbeck alpha coeff. ( ) */')
79 WRITE(msgBuf,'(A,A40)')' Tapering/Cliping : ',GM_taper_scheme
80 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
81 & SQUEEZE_RIGHT, myThid )
82 CALL WRITE_0D_R8( GM_Small_Number, INDEX_NONE,
83 & ' GM_Small_Number =',' /* epsilon used in slope calc */')
84 CALL WRITE_0D_R8( GM_slopeSqCutoff, INDEX_NONE,
85 & ' GM_slopeSqCutoff =', ' /* Slope^2 cut-off value */')
86
87
88 C-- Check parameters:
89
90 C- GM/Redi needs implicit diffusion (will be packaged later)
91 IF ( .NOT.implicitDiffusion ) THEN
92 WRITE(msgBuf,'(A)') 'GM/Redi needs implicitDiffusion=.true.'
93 CALL PRINT_ERROR( msgBuf , myThid )
94 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
95 ENDIF
96
97 #ifndef GM_VISBECK_VARIABLE_K
98 C Make sure we are not trying to use something that is unavailable
99 IF ( GM_Visbeck_alpha.NE.0. ) THEN
100 WRITE(msgBuf,'(A)')
101 & ' GMREDI_CHECK: Visbeck variables used in data.gmredi'
102 CALL PRINT_ERROR( msgBuf, myThid )
103 WRITE(msgBuf,'(A)')
104 & ' GMREDI_CHECK: without #define GM_VISBECK_VARIABLE_K'
105 CALL PRINT_ERROR( msgBuf, myThid )
106 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
107 ENDIF
108 #endif
109
110 #ifndef GM_BOLUS_ADVEC
111 C Make sure we are not trying to use some arrays that are unavailable
112 IF ( GM_AdvForm ) THEN
113 WRITE(msgBuf,'(A)')
114 & ' GMREDI_CHECK: GM Advection form used in data.gmredi'
115 CALL PRINT_ERROR( msgBuf, myThid )
116 WRITE(msgBuf,'(A)')
117 & ' GMREDI_CHECK: without #define GM_BOLUS_ADVEC'
118 CALL PRINT_ERROR( msgBuf, myThid )
119 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
120 ENDIF
121 #endif
122
123 #ifndef GM_EXTRA_DIAGONAL
124 C Make sure we are not trying to use some arrays that are unavailable
125 IF ( GM_ExtraDiag ) THEN
126 WRITE(msgBuf,'(A)')
127 & ' GMREDI_CHECK: GM_skew_Flux_K & GM_isopycK not equal'
128 CALL PRINT_ERROR( msgBuf, myThid )
129 WRITE(msgBuf,'(A)')
130 & ' GMREDI_CHECK: without #define GM_EXTRA_DIAGONAL'
131 CALL PRINT_ERROR( msgBuf, myThid )
132 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
133 ENDIF
134 #endif
135
136 #ifdef GM_SUBMESO
137 IF (GM_SM_Ce .gt. 0 _d 0) THEN
138 C Make sure we are not trying to use some arrays that are unavailable
139 IF ((.not.GM_ExtraDiag ).and.(.not.GM_AdvForm)) THEN
140 WRITE(msgBuf,'(A)')
141 & ' GMREDI: GM_SUBMESO needs GM_EXTRA_DIAGONAL or GM_BOLUS_ADVEC'
142 CALL PRINT_ERROR( msgBuf, myThid )
143 WRITE(msgBuf,'(A)')
144 & ' GMREDI_CHECK: add #define GM_EXTRA_DIAGONAL'
145 CALL PRINT_ERROR( msgBuf, myThid )
146 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
147 ENDIF
148 ENDIF
149 #endif
150
151
152 #ifdef ALLOW_PTRACERS
153 IF ( GM_AdvForm .AND. .NOT.GM_AdvSeparate
154 & .AND. usePTRACERS ) THEN
155 redFlag = .FALSE.
156 DO iTr=1,PTRACERS_numInUse
157 IF ( .NOT.PTRACERS_useGMRedi(iTr) ) THEN
158 redFlag = .TRUE.
159 WRITE(msgBuf,'(2A,I3,A,L5)') ' GMREDI_CHECK:',
160 & ' pTracers_useGMRedi(',iTr,' )=', PTRACERS_useGMRedi(iTr)
161 CALL PRINT_ERROR( msgBuf, myThid )
162 ENDIF
163 ENDDO
164 IF ( redFlag ) THEN
165 WRITE(msgBuf,'(2A)') ' GMREDI_CHECK:',
166 & ' but GM Advective Form applies to all tracers !'
167 CALL PRINT_ERROR( msgBuf, myThid )
168 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
169 ENDIF
170 ENDIF
171 #endif /* ALLOW_PTRACERS */
172
173 #ifdef ALLOW_GENERIC_ADVDIFF
174 C Check size of overlap region
175 IF ( GM_AdvForm .AND. .NOT.GM_AdvSeparate
176 & .AND. GM_Visbeck_alpha.NE.0.
177 & .AND. useMultiDimAdvec
178 & .AND. (Olx.LT.3 .OR. Oly.LT.3) ) THEN
179 C Visbeck variable K requires 1 more row/column in the overlap:
180 C might need to increase Olx,Oly from 2 to 3 if GM advective
181 C form & multi-dim advection are used. This happens when:
182 C a) using a 5 points stencil advection scheme ; or
183 C b) using a 3 points stencil advection scheme on CS-grid
184 C note: not clear how to check (b) since none of the advection scheme
185 C currently implemented falls in this category, except if
186 C GAD_FLUX_LIMITER.h is changed to use a "constant" flux-limiter
187 C (from Lax-Wendroff to 1rst Order upwind).
188 C-------
189 c IF ( (useCubedSphereExchange
190 c & .AND.( tempAdvScheme.EQ.ENUM_LAXWENDROFF
191 c & .OR. saltAdvScheme.EQ.ENUM_LAXWENDROFF )
192 c & ).OR.( tempAdvScheme.EQ.ENUM_FLUX_LIMIT
193 c & .OR. saltAdvScheme.EQ.ENUM_FLUX_LIMIT
194 c & .OR. tempAdvScheme.EQ.ENUM_DST3_FLUX_LIMIT
195 c & .OR. saltAdvScheme.EQ.ENUM_DST3_FLUX_LIMIT
196 c & .OR. tempAdvScheme.EQ.ENUM_DST3
197 c & .OR. saltAdvScheme.EQ.ENUM_DST3 )
198 c & ) THEN
199 WRITE(msgBuf,'(A,A)')
200 & 'GMREDI_CHECK: Visbeck + GM_AdvForm in MultiDimAdvec'
201 CALL PRINT_ERROR( msgBuf , myThid )
202 WRITE(msgBuf,'(A)') 'GMREDI_CHECK: need at least Olx,Oly = 3'
203 CALL PRINT_ERROR( msgBuf , myThid )
204 STOP 'ABNORMAL END: S/R GMREDI_CHECK'
205 c ENDIF
206 ENDIF
207 #endif /* ALLOW_GENERIC_ADVDIFF */
208
209 _END_MASTER(myThid)
210
211 #endif /* ALLOW_GMREDI */
212 RETURN
213 END

  ViewVC Help
Powered by ViewVC 1.1.22