1 |
mlosch |
1.21 |
C $Header: /u/gcmpack/MITgcm/model/src/do_oceanic_phys.F,v 1.20 2005/11/06 22:20:30 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PACKAGES_CONFIG.h" |
5 |
|
|
#include "CPP_OPTIONS.h" |
6 |
|
|
|
7 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
8 |
|
|
# ifdef ALLOW_GMREDI |
9 |
|
|
# include "GMREDI_OPTIONS.h" |
10 |
|
|
# endif |
11 |
|
|
# ifdef ALLOW_KPP |
12 |
|
|
# include "KPP_OPTIONS.h" |
13 |
|
|
# endif |
14 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
15 |
|
|
|
16 |
|
|
CBOP |
17 |
|
|
C !ROUTINE: DO_OCEANIC_PHYS |
18 |
|
|
C !INTERFACE: |
19 |
|
|
SUBROUTINE DO_OCEANIC_PHYS(myTime, myIter, myThid) |
20 |
|
|
C !DESCRIPTION: \bv |
21 |
|
|
C *==========================================================* |
22 |
|
|
C | SUBROUTINE DO_OCEANIC_PHYS |
23 |
|
|
C | o Controlling routine for oceanic physics and |
24 |
|
|
C | parameterization |
25 |
|
|
C *==========================================================* |
26 |
|
|
C | o originally, part of S/R thermodynamics |
27 |
|
|
C *==========================================================* |
28 |
|
|
C \ev |
29 |
|
|
|
30 |
|
|
C !USES: |
31 |
|
|
IMPLICIT NONE |
32 |
|
|
C == Global variables === |
33 |
|
|
#include "SIZE.h" |
34 |
|
|
#include "EEPARAMS.h" |
35 |
|
|
#include "PARAMS.h" |
36 |
|
|
#include "DYNVARS.h" |
37 |
|
|
#include "GRID.h" |
38 |
jmc |
1.20 |
#ifdef ALLOW_TIMEAVE |
39 |
|
|
#include "TIMEAVE_STATV.h" |
40 |
|
|
#endif |
41 |
jmc |
1.1 |
|
42 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
43 |
|
|
# include "tamc.h" |
44 |
|
|
# include "tamc_keys.h" |
45 |
|
|
# include "FFIELDS.h" |
46 |
|
|
# include "EOS.h" |
47 |
|
|
# ifdef ALLOW_KPP |
48 |
|
|
# include "KPP.h" |
49 |
|
|
# endif |
50 |
|
|
# ifdef ALLOW_GMREDI |
51 |
|
|
# include "GMREDI.h" |
52 |
|
|
# endif |
53 |
|
|
# ifdef ALLOW_EBM |
54 |
|
|
# include "EBM.h" |
55 |
|
|
# endif |
56 |
heimbach |
1.10 |
# ifdef EXACT_CONSERV |
57 |
|
|
# include "SURFACE.h" |
58 |
|
|
# endif |
59 |
jmc |
1.1 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
60 |
|
|
|
61 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
62 |
|
|
C == Routine arguments == |
63 |
jmc |
1.18 |
C myTime :: Current time in simulation |
64 |
|
|
C myIter :: Current iteration number in simulation |
65 |
|
|
C myThid :: Thread number for this instance of the routine. |
66 |
jmc |
1.1 |
_RL myTime |
67 |
|
|
INTEGER myIter |
68 |
|
|
INTEGER myThid |
69 |
|
|
|
70 |
|
|
C !LOCAL VARIABLES: |
71 |
|
|
C == Local variables |
72 |
jmc |
1.18 |
C rhoK, rhoKM1 :: Density at current level, and level above |
73 |
|
|
C iMin, iMax :: Ranges and sub-block indices on which calculations |
74 |
jmc |
1.1 |
C jMin, jMax are applied. |
75 |
jmc |
1.18 |
C bi, bj :: tile indices |
76 |
|
|
C i,j,k :: loop indices |
77 |
jmc |
1.1 |
_RL rhokm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
78 |
|
|
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
79 |
|
|
_RL sigmaX (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
80 |
|
|
_RL sigmaY (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
81 |
|
|
_RL sigmaR (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
82 |
|
|
INTEGER iMin, iMax |
83 |
|
|
INTEGER jMin, jMax |
84 |
|
|
INTEGER bi, bj |
85 |
jmc |
1.18 |
INTEGER i, j, k |
86 |
jmc |
1.17 |
INTEGER doDiagsRho |
87 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
88 |
|
|
LOGICAL DIAGNOSTICS_IS_ON |
89 |
|
|
EXTERNAL DIAGNOSTICS_IS_ON |
90 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
91 |
jmc |
1.1 |
|
92 |
|
|
CEOP |
93 |
|
|
|
94 |
heimbach |
1.12 |
#ifdef ALLOW_AUTODIFF_TAMC |
95 |
|
|
C-- dummy statement to end declaration part |
96 |
|
|
itdkey = 1 |
97 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
98 |
|
|
|
99 |
jmc |
1.1 |
#ifdef ALLOW_DEBUG |
100 |
jmc |
1.5 |
IF ( debugLevel .GE. debLevB ) |
101 |
jmc |
1.1 |
& CALL DEBUG_ENTER('DO_OCEANIC_PHYS',myThid) |
102 |
|
|
#endif |
103 |
|
|
|
104 |
jmc |
1.17 |
doDiagsRho = 0 |
105 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
106 |
|
|
IF ( useDiagnostics .AND. fluidIsWater ) THEN |
107 |
|
|
IF ( DIAGNOSTICS_IS_ON('DRHODR ',myThid) ) doDiagsRho = 1 |
108 |
|
|
IF ( DIAGNOSTICS_IS_ON('RHOANOSQ',myThid) .OR. |
109 |
|
|
& DIAGNOSTICS_IS_ON('URHOMASS',myThid) .OR. |
110 |
|
|
& DIAGNOSTICS_IS_ON('VRHOMASS',myThid) .OR. |
111 |
|
|
& DIAGNOSTICS_IS_ON('WRHOMASS',myThid) .OR. |
112 |
|
|
& DIAGNOSTICS_IS_ON('WRHOMASS',myThid) ) doDiagsRho = 2 |
113 |
|
|
ENDIF |
114 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
115 |
|
|
|
116 |
jmc |
1.5 |
#ifdef ALLOW_THSICE |
117 |
jmc |
1.14 |
IF ( useThSIce .AND. fluidIsWater ) THEN |
118 |
jmc |
1.5 |
#ifdef ALLOW_DEBUG |
119 |
|
|
IF ( debugLevel .GE. debLevB ) |
120 |
|
|
& CALL DEBUG_CALL('THSICE_MAIN',myThid) |
121 |
|
|
#endif |
122 |
|
|
C-- Step forward Therm.Sea-Ice variables |
123 |
|
|
C and modify forcing terms including effects from ice |
124 |
|
|
CALL TIMER_START('THSICE_MAIN [DO_OCEANIC_PHYS]', myThid) |
125 |
|
|
CALL THSICE_MAIN( myTime, myIter, myThid ) |
126 |
|
|
CALL TIMER_STOP( 'THSICE_MAIN [DO_OCEANIC_PHYS]', myThid) |
127 |
|
|
ENDIF |
128 |
|
|
#endif /* ALLOW_THSICE */ |
129 |
|
|
|
130 |
mlosch |
1.21 |
#ifdef ALLOW_SHELFICE |
131 |
|
|
IF ( useShelfIce .AND. fluidIsWater ) THEN |
132 |
|
|
#ifdef ALLOW_DEBUG |
133 |
|
|
IF ( debugLevel .GE. debLevB ) |
134 |
|
|
& CALL DEBUG_CALL('SHELFICE_THERMODYNAMICS',myThid) |
135 |
|
|
#endif |
136 |
|
|
C compute temperature and (virtual) salt flux at the |
137 |
|
|
C shelf-ice ocean interface |
138 |
|
|
CALL TIMER_START('SHELFICE_THERMODYNAMICS [DO_OCEANIC_PHYS]', |
139 |
|
|
& myThid) |
140 |
|
|
CALL SHELFICE_THERMODYNAMICS( myTime, myIter, myThid ) |
141 |
|
|
CALL TIMER_STOP( 'SHELFICE_THERMODYNAMICS [DO_OCEANIC_PHYS]', |
142 |
|
|
& myThid) |
143 |
|
|
ENDIF |
144 |
|
|
#endif /* ALLOW_SHELFICE */ |
145 |
|
|
|
146 |
jmc |
1.5 |
C-- Freeze water at the surface |
147 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
148 |
|
|
CADJ STORE theta = comlev1, key = ikey_dynamics |
149 |
|
|
#endif |
150 |
heimbach |
1.12 |
IF ( allowFreezing |
151 |
|
|
& .AND. .NOT. useSEAICE |
152 |
jmc |
1.5 |
& .AND. .NOT. useThSIce ) THEN |
153 |
|
|
CALL FREEZE_SURFACE( myTime, myIter, myThid ) |
154 |
|
|
ENDIF |
155 |
|
|
|
156 |
|
|
#ifdef COMPONENT_MODULE |
157 |
|
|
# ifndef ALLOW_AIM |
158 |
|
|
C-- Apply imported data (from coupled interface) to forcing fields |
159 |
edhill |
1.7 |
C jmc: do not know precisely where to put this call (bf or af thSIce ?) |
160 |
jmc |
1.5 |
IF ( useCoupler ) THEN |
161 |
|
|
CALL OCN_APPLY_IMPORT( .TRUE., myTime, myIter, myThid ) |
162 |
|
|
ENDIF |
163 |
|
|
# endif |
164 |
|
|
#endif /* COMPONENT_MODULE */ |
165 |
|
|
|
166 |
jmc |
1.1 |
#ifdef ALLOW_AUTODIFF_TAMC |
167 |
|
|
C-- HPF directive to help TAMC |
168 |
|
|
CHPF$ INDEPENDENT |
169 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
170 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
171 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
172 |
heimbach |
1.15 |
C-- HPF directive to help TAMC |
173 |
|
|
CHPF$ INDEPENDENT |
174 |
jmc |
1.1 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
175 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
176 |
|
|
|
177 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
178 |
|
|
act1 = bi - myBxLo(myThid) |
179 |
|
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
180 |
|
|
act2 = bj - myByLo(myThid) |
181 |
|
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
182 |
|
|
act3 = myThid - 1 |
183 |
|
|
max3 = nTx*nTy |
184 |
|
|
act4 = ikey_dynamics - 1 |
185 |
|
|
itdkey = (act1 + 1) + act2*max1 |
186 |
|
|
& + act3*max1*max2 |
187 |
|
|
& + act4*max1*max2*max3 |
188 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
189 |
|
|
|
190 |
|
|
C-- Set up work arrays with valid (i.e. not NaN) values |
191 |
|
|
C These inital values do not alter the numerical results. They |
192 |
|
|
C just ensure that all memory references are to valid floating |
193 |
|
|
C point numbers. This prevents spurious hardware signals due to |
194 |
|
|
C uninitialised but inert locations. |
195 |
|
|
|
196 |
|
|
DO j=1-OLy,sNy+OLy |
197 |
|
|
DO i=1-OLx,sNx+OLx |
198 |
|
|
rhok (i,j) = 0. _d 0 |
199 |
|
|
rhoKM1 (i,j) = 0. _d 0 |
200 |
|
|
ENDDO |
201 |
|
|
ENDDO |
202 |
|
|
|
203 |
|
|
DO k=1,Nr |
204 |
|
|
DO j=1-OLy,sNy+OLy |
205 |
|
|
DO i=1-OLx,sNx+OLx |
206 |
|
|
C This is currently also used by IVDC and Diagnostics |
207 |
|
|
sigmaX(i,j,k) = 0. _d 0 |
208 |
|
|
sigmaY(i,j,k) = 0. _d 0 |
209 |
|
|
sigmaR(i,j,k) = 0. _d 0 |
210 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
211 |
|
|
cph all the following init. are necessary for TAF |
212 |
|
|
cph although some of these are re-initialised later. |
213 |
|
|
IVDConvCount(i,j,k,bi,bj) = 0. |
214 |
|
|
# ifdef ALLOW_GMREDI |
215 |
|
|
Kwx(i,j,k,bi,bj) = 0. _d 0 |
216 |
|
|
Kwy(i,j,k,bi,bj) = 0. _d 0 |
217 |
|
|
Kwz(i,j,k,bi,bj) = 0. _d 0 |
218 |
|
|
# ifdef GM_NON_UNITY_DIAGONAL |
219 |
|
|
Kux(i,j,k,bi,bj) = 0. _d 0 |
220 |
|
|
Kvy(i,j,k,bi,bj) = 0. _d 0 |
221 |
|
|
# endif |
222 |
|
|
# ifdef GM_EXTRA_DIAGONAL |
223 |
|
|
Kuz(i,j,k,bi,bj) = 0. _d 0 |
224 |
|
|
Kvz(i,j,k,bi,bj) = 0. _d 0 |
225 |
|
|
# endif |
226 |
|
|
# ifdef GM_BOLUS_ADVEC |
227 |
|
|
GM_PsiX(i,j,k,bi,bj) = 0. _d 0 |
228 |
|
|
GM_PsiY(i,j,k,bi,bj) = 0. _d 0 |
229 |
|
|
# endif |
230 |
|
|
# ifdef GM_VISBECK_VARIABLE_K |
231 |
|
|
VisbeckK(i,j,bi,bj) = 0. _d 0 |
232 |
|
|
# endif |
233 |
|
|
# endif /* ALLOW_GMREDI */ |
234 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
235 |
|
|
ENDDO |
236 |
|
|
ENDDO |
237 |
|
|
ENDDO |
238 |
|
|
|
239 |
|
|
iMin = 1-OLx |
240 |
|
|
iMax = sNx+OLx |
241 |
|
|
jMin = 1-OLy |
242 |
|
|
jMax = sNy+OLy |
243 |
|
|
|
244 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
245 |
|
|
CADJ STORE theta(:,:,:,bi,bj) = comlev1_bibj, key=itdkey, byte=isbyte |
246 |
|
|
CADJ STORE salt (:,:,:,bi,bj) = comlev1_bibj, key=itdkey, byte=isbyte |
247 |
heimbach |
1.12 |
CADJ STORE totphihyd(:,:,:,bi,bj) |
248 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
249 |
heimbach |
1.10 |
# ifdef ALLOW_KPP |
250 |
jmc |
1.1 |
CADJ STORE uvel (:,:,:,bi,bj) = comlev1_bibj, key=itdkey, byte=isbyte |
251 |
|
|
CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key=itdkey, byte=isbyte |
252 |
heimbach |
1.10 |
# endif |
253 |
|
|
# ifdef EXACT_CONSERV |
254 |
|
|
CADJ STORE pmepr(:,:,bi,bj) = comlev1_bibj, key=itdkey, byte=isbyte |
255 |
|
|
# endif |
256 |
jmc |
1.1 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
257 |
|
|
|
258 |
|
|
#ifdef ALLOW_DEBUG |
259 |
|
|
IF ( debugLevel .GE. debLevB ) |
260 |
|
|
& CALL DEBUG_MSG('ENTERING UPWARD K LOOP',myThid) |
261 |
|
|
#endif |
262 |
|
|
|
263 |
|
|
C-- Start of diagnostic loop |
264 |
|
|
DO k=Nr,1,-1 |
265 |
|
|
|
266 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
267 |
|
|
C? Patrick, is this formula correct now that we change the loop range? |
268 |
|
|
C? Do we still need this? |
269 |
|
|
cph kkey formula corrected. |
270 |
|
|
cph Needed for rhok, rhokm1, in the case useGMREDI. |
271 |
|
|
kkey = (itdkey-1)*Nr + k |
272 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
273 |
|
|
|
274 |
|
|
C-- Calculate gradients of potential density for isoneutral |
275 |
|
|
C slope terms (e.g. GM/Redi tensor or IVDC diffusivity) |
276 |
|
|
c IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN |
277 |
jmc |
1.17 |
IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.) |
278 |
|
|
& .OR. doDiagsRho.GE.1 ) THEN |
279 |
jmc |
1.1 |
#ifdef ALLOW_DEBUG |
280 |
|
|
IF ( debugLevel .GE. debLevB ) |
281 |
|
|
& CALL DEBUG_CALL('FIND_RHO',myThid) |
282 |
|
|
#endif |
283 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
284 |
|
|
CADJ STORE theta(:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte |
285 |
|
|
CADJ STORE salt (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte |
286 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
287 |
|
|
CALL FIND_RHO( |
288 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, k, k, |
289 |
|
|
I theta, salt, |
290 |
|
|
O rhoK, |
291 |
|
|
I myThid ) |
292 |
|
|
|
293 |
|
|
IF (k.GT.1) THEN |
294 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
295 |
|
|
CADJ STORE theta(:,:,k-1,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte |
296 |
|
|
CADJ STORE salt (:,:,k-1,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte |
297 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
298 |
|
|
CALL FIND_RHO( |
299 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, k-1, k, |
300 |
|
|
I theta, salt, |
301 |
|
|
O rhoKm1, |
302 |
|
|
I myThid ) |
303 |
|
|
ENDIF |
304 |
|
|
#ifdef ALLOW_DEBUG |
305 |
|
|
IF ( debugLevel .GE. debLevB ) |
306 |
|
|
& CALL DEBUG_CALL('GRAD_SIGMA',myThid) |
307 |
|
|
#endif |
308 |
|
|
CALL GRAD_SIGMA( |
309 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, k, |
310 |
|
|
I rhoK, rhoKm1, rhoK, |
311 |
|
|
O sigmaX, sigmaY, sigmaR, |
312 |
|
|
I myThid ) |
313 |
|
|
ENDIF |
314 |
|
|
|
315 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
316 |
heimbach |
1.12 |
ctest# ifndef GM_EXCLUDE_CLIPPING |
317 |
jmc |
1.1 |
CADJ STORE rhok (:,:) = comlev1_bibj_k , key=kkey, byte=isbyte |
318 |
heimbach |
1.12 |
ctest# endif |
319 |
jmc |
1.1 |
CADJ STORE rhokm1 (:,:) = comlev1_bibj_k , key=kkey, byte=isbyte |
320 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
321 |
|
|
C-- Implicit Vertical Diffusion for Convection |
322 |
|
|
c ==> should use sigmaR !!! |
323 |
|
|
IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN |
324 |
|
|
#ifdef ALLOW_DEBUG |
325 |
|
|
IF ( debugLevel .GE. debLevB ) |
326 |
|
|
& CALL DEBUG_CALL('CALC_IVDC',myThid) |
327 |
|
|
#endif |
328 |
|
|
CALL CALC_IVDC( |
329 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, k, |
330 |
|
|
I rhoKm1, rhoK, |
331 |
|
|
I myTime, myIter, myThid) |
332 |
|
|
ENDIF |
333 |
|
|
|
334 |
jmc |
1.17 |
#ifdef ALLOW_DIAGNOSTICS |
335 |
|
|
IF ( doDiagsRho.GE.2 ) THEN |
336 |
|
|
CALL DIAGS_RHO( k, bi, bj, |
337 |
|
|
I rhoK, rhoKm1, |
338 |
|
|
I myTime, myIter, myThid) |
339 |
|
|
ENDIF |
340 |
|
|
#endif |
341 |
|
|
|
342 |
jmc |
1.1 |
C-- end of diagnostic k loop (Nr:1) |
343 |
|
|
ENDDO |
344 |
|
|
|
345 |
jmc |
1.8 |
#ifdef ALLOW_DIAGNOSTICS |
346 |
jmc |
1.17 |
c IF ( useDiagnostics .AND. |
347 |
|
|
c & (useGMRedi .OR. ivdc_kappa.NE.0.) ) THEN |
348 |
|
|
IF ( doDiagsRho.GE.1 ) THEN |
349 |
jmc |
1.16 |
CALL DIAGNOSTICS_FILL (sigmaR, 'DRHODR ', 0, Nr, |
350 |
|
|
& 2, bi, bj, myThid) |
351 |
jmc |
1.8 |
ENDIF |
352 |
|
|
#endif |
353 |
|
|
|
354 |
jmc |
1.1 |
#ifdef ALLOW_OBCS |
355 |
|
|
C-- Calculate future values on open boundaries |
356 |
|
|
IF (useOBCS) THEN |
357 |
|
|
#ifdef ALLOW_DEBUG |
358 |
|
|
IF ( debugLevel .GE. debLevB ) |
359 |
|
|
& CALL DEBUG_CALL('OBCS_CALC',myThid) |
360 |
|
|
#endif |
361 |
heimbach |
1.11 |
CALL OBCS_CALC( bi, bj, myTime+deltaTclock, myIter+1, |
362 |
jmc |
1.1 |
I uVel, vVel, wVel, theta, salt, |
363 |
|
|
I myThid ) |
364 |
|
|
ENDIF |
365 |
|
|
#endif /* ALLOW_OBCS */ |
366 |
|
|
|
367 |
|
|
#ifndef ALLOW_AUTODIFF_TAMC |
368 |
jmc |
1.14 |
IF ( fluidIsWater ) THEN |
369 |
jmc |
1.1 |
#endif |
370 |
|
|
C-- Determines forcing terms based on external fields |
371 |
|
|
C relaxation terms, etc. |
372 |
|
|
#ifdef ALLOW_DEBUG |
373 |
|
|
IF ( debugLevel .GE. debLevB ) |
374 |
|
|
& CALL DEBUG_CALL('EXTERNAL_FORCING_SURF',myThid) |
375 |
|
|
#endif |
376 |
|
|
CALL EXTERNAL_FORCING_SURF( |
377 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
378 |
|
|
I myTime, myIter, myThid ) |
379 |
|
|
#ifndef ALLOW_AUTODIFF_TAMC |
380 |
|
|
ENDIF |
381 |
|
|
#endif |
382 |
|
|
|
383 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
384 |
|
|
cph needed for KPP |
385 |
jmc |
1.4 |
CADJ STORE surfaceForcingU(:,:,bi,bj) |
386 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
387 |
jmc |
1.4 |
CADJ STORE surfaceForcingV(:,:,bi,bj) |
388 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
389 |
jmc |
1.4 |
CADJ STORE surfaceForcingS(:,:,bi,bj) |
390 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
391 |
jmc |
1.4 |
CADJ STORE surfaceForcingT(:,:,bi,bj) |
392 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
393 |
jmc |
1.4 |
CADJ STORE surfaceForcingTice(:,:,bi,bj) |
394 |
jmc |
1.1 |
CADJ & = comlev1_bibj, key=itdkey, byte=isbyte |
395 |
heimbach |
1.13 |
|
396 |
jmc |
1.1 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
397 |
|
|
|
398 |
|
|
#ifdef ALLOW_GMREDI |
399 |
|
|
|
400 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
401 |
heimbach |
1.10 |
# ifndef GM_EXCLUDE_CLIPPING |
402 |
jmc |
1.1 |
cph storing here is needed only for one GMREDI_OPTIONS: |
403 |
|
|
cph define GM_BOLUS_ADVEC |
404 |
heimbach |
1.10 |
cph keep it although TAF says you dont need to. |
405 |
jmc |
1.1 |
cph but I've avoided the #ifdef for now, in case more things change |
406 |
|
|
CADJ STORE sigmaX(:,:,:) = comlev1_bibj, key=itdkey, byte=isbyte |
407 |
|
|
CADJ STORE sigmaY(:,:,:) = comlev1_bibj, key=itdkey, byte=isbyte |
408 |
heimbach |
1.12 |
CADJ STORE sigmaR(:,:,:) = comlev1_bibj, key=itdkey, byte=isbyte |
409 |
heimbach |
1.10 |
# endif |
410 |
jmc |
1.1 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
411 |
|
|
|
412 |
|
|
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
413 |
|
|
IF (useGMRedi) THEN |
414 |
|
|
#ifdef ALLOW_DEBUG |
415 |
|
|
IF ( debugLevel .GE. debLevB ) |
416 |
|
|
& CALL DEBUG_CALL('GMREDI_CALC_TENSOR',myThid) |
417 |
|
|
#endif |
418 |
|
|
CALL GMREDI_CALC_TENSOR( |
419 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
420 |
|
|
I sigmaX, sigmaY, sigmaR, |
421 |
|
|
I myThid ) |
422 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
423 |
|
|
ELSE |
424 |
|
|
CALL GMREDI_CALC_TENSOR_DUMMY( |
425 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
426 |
|
|
I sigmaX, sigmaY, sigmaR, |
427 |
|
|
I myThid ) |
428 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
429 |
|
|
ENDIF |
430 |
|
|
|
431 |
|
|
#endif /* ALLOW_GMREDI */ |
432 |
|
|
|
433 |
|
|
#ifdef ALLOW_KPP |
434 |
|
|
C-- Compute KPP mixing coefficients |
435 |
|
|
IF (useKPP) THEN |
436 |
|
|
#ifdef ALLOW_DEBUG |
437 |
|
|
IF ( debugLevel .GE. debLevB ) |
438 |
|
|
& CALL DEBUG_CALL('KPP_CALC',myThid) |
439 |
|
|
#endif |
440 |
|
|
CALL KPP_CALC( |
441 |
|
|
I bi, bj, myTime, myThid ) |
442 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
443 |
|
|
ELSE |
444 |
|
|
CALL KPP_CALC_DUMMY( |
445 |
|
|
I bi, bj, myTime, myThid ) |
446 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
447 |
|
|
ENDIF |
448 |
|
|
|
449 |
|
|
#endif /* ALLOW_KPP */ |
450 |
|
|
|
451 |
mlosch |
1.6 |
#ifdef ALLOW_PP81 |
452 |
|
|
C-- Compute PP81 mixing coefficients |
453 |
|
|
IF (usePP81) THEN |
454 |
|
|
#ifdef ALLOW_DEBUG |
455 |
|
|
IF ( debugLevel .GE. debLevB ) |
456 |
|
|
& CALL DEBUG_CALL('PP81_CALC',myThid) |
457 |
|
|
#endif |
458 |
|
|
CALL PP81_CALC( |
459 |
|
|
I bi, bj, myTime, myThid ) |
460 |
|
|
ENDIF |
461 |
|
|
#endif /* ALLOW_PP81 */ |
462 |
|
|
|
463 |
|
|
#ifdef ALLOW_MY82 |
464 |
|
|
C-- Compute MY82 mixing coefficients |
465 |
|
|
IF (useMY82) THEN |
466 |
|
|
#ifdef ALLOW_DEBUG |
467 |
|
|
IF ( debugLevel .GE. debLevB ) |
468 |
|
|
& CALL DEBUG_CALL('MY82_CALC',myThid) |
469 |
|
|
#endif |
470 |
|
|
CALL MY82_CALC( |
471 |
|
|
I bi, bj, myTime, myThid ) |
472 |
|
|
ENDIF |
473 |
|
|
#endif /* ALLOW_MY82 */ |
474 |
|
|
|
475 |
mlosch |
1.9 |
#ifdef ALLOW_GGL90 |
476 |
|
|
C-- Compute GGL90 mixing coefficients |
477 |
|
|
IF (useGGL90) THEN |
478 |
|
|
#ifdef ALLOW_DEBUG |
479 |
|
|
IF ( debugLevel .GE. debLevB ) |
480 |
|
|
& CALL DEBUG_CALL('GGL90_CALC',myThid) |
481 |
|
|
#endif |
482 |
|
|
CALL GGL90_CALC( |
483 |
|
|
I bi, bj, myTime, myThid ) |
484 |
|
|
ENDIF |
485 |
|
|
#endif /* ALLOW_GGL90 */ |
486 |
|
|
|
487 |
jmc |
1.20 |
#ifdef ALLOW_TIMEAVE |
488 |
|
|
IF ( taveFreq.GT. 0. _d 0 .AND. fluidIsWater ) THEN |
489 |
|
|
CALL TIMEAVE_SURF_FLUX( bi, bj, myTime, myIter, myThid) |
490 |
|
|
ENDIF |
491 |
|
|
IF (taveFreq.GT.0. .AND. ivdc_kappa.NE.0.) THEN |
492 |
|
|
CALL TIMEAVE_CUMULATE(ConvectCountTave, IVDConvCount, |
493 |
|
|
I Nr, deltaTclock, bi, bj, myThid) |
494 |
|
|
ENDIF |
495 |
|
|
#endif /* ALLOW_TIMEAVE */ |
496 |
|
|
|
497 |
jmc |
1.1 |
C-- end bi,bj loops. |
498 |
|
|
ENDDO |
499 |
|
|
ENDDO |
500 |
|
|
|
501 |
jmc |
1.18 |
#ifdef ALLOW_DIAGNOSTICS |
502 |
|
|
IF ( fluidIsWater .AND. useDiagnostics ) THEN |
503 |
|
|
CALL DIAGS_OCEANIC_SURF_FLUX( myTime, myIter, myThid ) |
504 |
|
|
ENDIF |
505 |
jmc |
1.19 |
IF ( ivdc_kappa.NE.0 .AND. useDiagnostics ) THEN |
506 |
|
|
CALL DIAGNOSTICS_FILL( IVDConvCount,'CONVADJ ', |
507 |
|
|
& 0, Nr, 0, 1, 1, myThid ) |
508 |
|
|
ENDIF |
509 |
jmc |
1.18 |
#endif |
510 |
|
|
|
511 |
jmc |
1.1 |
#ifdef ALLOW_DEBUG |
512 |
|
|
IF ( debugLevel .GE. debLevB ) |
513 |
|
|
& CALL DEBUG_LEAVE('DO_OCEANIC_PHYS',myThid) |
514 |
|
|
#endif |
515 |
|
|
|
516 |
|
|
RETURN |
517 |
|
|
END |