/[MITgcm]/MITgcm/pkg/kpp/kpp_calc.F
ViewVC logotype

Contents of /MITgcm/pkg/kpp/kpp_calc.F

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


Revision 1.43 - (show annotations) (download)
Mon Jun 4 18:47:35 2007 UTC (16 years, 11 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f
Changes since 1.42: +2 -2 lines
Fix mismatch in parameter lists in KPPMIX, RI_IWMIX

1 C $Header: /u/gcmpack/MITgcm/pkg/kpp/kpp_calc.F,v 1.42 2007/05/03 21:37:34 jmc Exp $
2 C $Name: $
3
4 #include "KPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: KPP_CALC
8
9 C !INTERFACE: ==========================================================
10 SUBROUTINE KPP_CALC(
11 I bi, bj, myTime, myIter, myThid )
12
13 C !DESCRIPTION: \bv
14 C *==========================================================*
15 C | SUBROUTINE KPP_CALC |
16 C | o Compute all KPP fields defined in KPP.h |
17 C *==========================================================*
18 C | This subroutine serves as an interface between MITGCMUV |
19 C | code and NCOM 1-D routines in kpp_routines.F |
20 C *==========================================================*
21 IMPLICIT NONE
22
23 c=======================================================================
24 c
25 c written by : jan morzel, august 11, 1994
26 c modified by : jan morzel, january 25, 1995 : "dVsq" and 1d code
27 c detlef stammer, august, 1997 : for MIT GCM Classic
28 c d. menemenlis, july, 1998 : for MIT GCM UV
29 c
30 c compute vertical mixing coefficients based on the k-profile
31 c and oceanic planetary boundary layer scheme by large & mcwilliams.
32 c
33 c summary:
34 c - compute interior mixing everywhere:
35 c interior mixing gets computed at all interfaces due to constant
36 c internal wave background activity ("fkpm" and "fkph"), which
37 c is enhanced in places of static instability (local richardson
38 c number < 0).
39 c Additionally, mixing can be enhanced by adding contribution due
40 c to shear instability which is a function of the local richardson
41 c number
42 c - double diffusivity:
43 c interior mixing can be enhanced by double diffusion due to salt
44 c fingering and diffusive convection (ifdef "kmixdd").
45 c - kpp scheme in the boundary layer:
46 c
47 c a.boundary layer depth:
48 c at every gridpoint the depth of the oceanic boundary layer
49 c ("hbl") gets computed by evaluating bulk richardson numbers.
50 c b.boundary layer mixing:
51 c within the boundary layer, above hbl, vertical mixing is
52 c determined by turbulent surface fluxes, and interior mixing at
53 c the lower boundary, i.e. at hbl.
54 c
55 c this subroutine provides the interface between the MITGCM and
56 c the routine "kppmix", where boundary layer depth, vertical
57 c viscosity, vertical diffusivity, and counter gradient term (ghat)
58 c are computed slabwise.
59 c note: subroutine "kppmix" uses m-k-s units.
60 c
61 c time level:
62 c input tracer and velocity profiles are evaluated at time level
63 c tau, surface fluxes come from tau or tau-1.
64 c
65 c grid option:
66 c in this "1-grid" implementation, diffusivity and viscosity
67 c profiles are computed on the "t-grid" (by using velocity shear
68 c profiles averaged from the "u,v-grid" onto the "t-grid"; note, that
69 c the averaging includes zero values on coastal and seafloor grid
70 c points). viscosity on the "u,v-grid" is computed by averaging the
71 c "t-grid" viscosity values onto the "u,v-grid".
72 c
73 c vertical grid:
74 c mixing coefficients get evaluated at the bottom of the lowest
75 c layer, i.e., at depth zw(Nr). these values are only useful when
76 c the model ocean domain does not include the entire ocean down to
77 c the seafloor ("upperocean" setup) and allows flux through the
78 c bottom of the domain. for full-depth runs, these mixing
79 c coefficients are being zeroed out before leaving this subroutine.
80 c
81 c-------------------------------------------------------------------------
82
83 c global parameters updated by kpp_calc
84 c KPPviscAz - KPP eddy viscosity coefficient (m^2/s)
85 c KPPdiffKzT - KPP diffusion coefficient for temperature (m^2/s)
86 c KPPdiffKzS - KPP diffusion coefficient for salt and tracers (m^2/s)
87 c KPPghat - Nonlocal transport coefficient (s/m^2)
88 c KPPhbl - Boundary layer depth on "t-grid" (m)
89 c KPPfrac - Fraction of short-wave flux penetrating mixing layer
90
91 c-- KPP_CALC computes vertical viscosity and diffusivity for region
92 c (-2:sNx+3,-2:sNy+3) as required by CALC_DIFFUSIVITY and requires
93 c values of uVel, vVel, surfaceForcingU, surfaceForcingV in the
94 c region (-2:sNx+4,-2:sNy+4).
95 c Hence overlap region needs to be set OLx=4, OLy=4.
96 c \ev
97
98 C !USES: ===============================================================
99 #include "SIZE.h"
100 #include "EEPARAMS.h"
101 #include "PARAMS.h"
102 #include "DYNVARS.h"
103 #include "KPP.h"
104 #include "KPP_PARAMS.h"
105 #include "FFIELDS.h"
106 #include "GRID.h"
107 #include "GAD.h"
108 #ifdef ALLOW_SHELFICE
109 # include "SHELFICE.h"
110 #endif /* ALLOW_SHELFICE */
111 #ifdef ALLOW_AUTODIFF_TAMC
112 #include "tamc.h"
113 #include "tamc_keys.h"
114 #else /* ALLOW_AUTODIFF_TAMC */
115 integer ikppkey
116 #endif /* ALLOW_AUTODIFF_TAMC */
117
118 EXTERNAL DIFFERENT_MULTIPLE
119 LOGICAL DIFFERENT_MULTIPLE
120
121 C !INPUT PARAMETERS: ===================================================
122 c Routine arguments
123 c bi, bj :: Current tile indices
124 c myTime :: Current time in simulation
125 c myIter :: Current iteration number in simulation
126 c myThid :: My Thread Id. number
127
128 INTEGER bi, bj
129 _RL myTime
130 INTEGER myIter
131 INTEGER myThid
132
133 #ifdef ALLOW_KPP
134
135 C !LOCAL VARIABLES: ====================================================
136 c Local constants
137 c minusone, p0, p5, p25, p125, p0625
138 c imin, imax, jmin, jmax - array computation indices
139
140 _RL minusone
141 parameter( minusone=-1.0)
142 _RL p0 , p5 , p25 , p125 , p0625
143 parameter( p0=0.0, p5=0.5, p25=0.25, p125=0.125, p0625=0.0625 )
144 integer imin ,imax ,jmin ,jmax
145 parameter(imin=2-OLx,imax=sNx+OLx-1,jmin=2-OLy,jmax=sNy+OLy-1)
146
147 c Local arrays and variables
148 c work? (nx,ny) - horizontal working arrays
149 c ustar (nx,ny) - surface friction velocity (m/s)
150 c bo (nx,ny) - surface turbulent buoyancy forcing (m^2/s^3)
151 c bosol (nx,ny) - surface radiative buoyancy forcing (m^2/s^3)
152 c shsq (nx,ny,Nr) - local velocity shear squared
153 c at interfaces for ri_iwmix (m^2/s^2)
154 c dVsq (nx,ny,Nr) - velocity shear re surface squared
155 c at grid levels for bldepth (m^2/s^2)
156 c dbloc (nx,ny,Nr) - local delta buoyancy at interfaces
157 c for ri_iwmix and bldepth (m/s^2)
158 c Ritop (nx,ny,Nr) - numerator of bulk richardson number
159 c at grid levels for bldepth
160 c vddiff (nx,ny,Nrp2,1)- vertical viscosity on "t-grid" (m^2/s)
161 c vddiff (nx,ny,Nrp2,2)- vert. diff. on next row for salt&tracers (m^2/s)
162 c vddiff (nx,ny,Nrp2,3)- vert. diff. on next row for temperature (m^2/s)
163 c ghat (nx,ny,Nr) - nonlocal transport coefficient (s/m^2)
164 c hbl (nx,ny) - mixing layer depth (m)
165 c kmtj (nx,ny) - maximum number of wet levels in each column
166 c z0 (nx,ny) - Roughness length (m)
167 c zRef (nx,ny) - Reference depth: Hmix * epsilon (m)
168 c uRef (nx,ny) - Reference zonal velocity (m/s)
169 c vRef (nx,ny) - Reference meridional velocity (m/s)
170
171 integer work1 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
172 _RL worka ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
173 _RL work2 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
174 _RL work3 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
175 _RL ustar ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
176 _RL bo ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
177 _RL bosol ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
178 _RL shsq ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
179 _RL dVsq ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
180 _RL dbloc ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
181 _RL Ritop ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
182 _RL vddiff( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, 0:Nrp1, mdiff )
183 _RL ghat ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
184 _RL hbl ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
185 cph(
186 _RL TTALPHA( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nrp1 )
187 _RL SSBETA ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nrp1 )
188 cph)
189 #ifdef KPP_ESTIMATE_UREF
190 _RL z0 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
191 _RL zRef ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
192 _RL uRef ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
193 _RL vRef ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
194 #endif /* KPP_ESTIMATE_UREF */
195
196 _RL tempvar2
197 integer i, j, k, kp1, km1, im1, ip1, jm1, jp1
198
199 #ifdef KPP_ESTIMATE_UREF
200 _RL tempvar1, dBdz1, dBdz2, ustarX, ustarY
201 #endif
202
203 #ifdef ALLOW_AUTODIFF_TAMC
204 act1 = bi - myBxLo(myThid)
205 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
206 act2 = bj - myByLo(myThid)
207 max2 = myByHi(myThid) - myByLo(myThid) + 1
208 act3 = myThid - 1
209 max3 = nTx*nTy
210 act4 = ikey_dynamics - 1
211 ikppkey = (act1 + 1) + act2*max1
212 & + act3*max1*max2
213 & + act4*max1*max2*max3
214 #endif /* ALLOW_AUTODIFF_TAMC */
215 CEOP
216
217 c Check to see if new vertical mixing coefficient should be computed now?
218 IF ( DIFFERENT_MULTIPLE(kpp_freq,myTime,deltaTClock)
219 1 .OR. myTime .EQ. startTime ) THEN
220
221 c-----------------------------------------------------------------------
222 c prepare input arrays for subroutine "kppmix" to compute
223 c viscosity and diffusivity and ghat.
224 c All input arrays need to be in m-k-s units.
225 c
226 c note: for the computation of the bulk richardson number in the
227 c "bldepth" subroutine, gradients of velocity and buoyancy are
228 c required at every depth. in the case of very fine vertical grids
229 c (thickness of top layer < 2m), the surface reference depth must
230 c be set to zref=epsilon/2*zgrid(k), and the reference value
231 c of velocity and buoyancy must be computed as vertical average
232 c between the surface and 2*zref. in the case of coarse vertical
233 c grids zref is zgrid(1)/2., and the surface reference value is
234 c simply the surface value at zgrid(1).
235 c-----------------------------------------------------------------------
236
237 c------------------------------------------------------------------------
238 c density related quantities
239 c --------------------------
240 c
241 c work2 - density of surface layer (kg/m^3)
242 c dbloc - local buoyancy gradient at Nr interfaces
243 c g/rho{k+1,k+1} * [ drho{k,k+1}-drho{k+1,k+1} ] (m/s^2)
244 c dbsfc (stored in Ritop to conserve stack memory)
245 c - buoyancy difference with respect to the surface
246 c g * [ drho{1,k}/rho{1,k} - drho{k,k}/rho{k,k} ] (m/s^2)
247 c ttalpha (stored in vddiff(:,:,:,1) to conserve stack memory)
248 c - thermal expansion coefficient without 1/rho factor
249 c d(rho{k,k})/d(T(k)) (kg/m^3/C)
250 c ssbeta (stored in vddiff(:,:,:,2) to conserve stack memory)
251 c - salt expansion coefficient without 1/rho factor
252 c d(rho{k,k})/d(S(k)) (kg/m^3/PSU)
253 c------------------------------------------------------------------------
254
255 CALL TIMER_START('STATEKPP [KPP_CALC]', myThid)
256 CALL STATEKPP(
257 O work2, dbloc, Ritop,
258 O TTALPHA, SSBETA,
259 I ikppkey, bi, bj, myThid )
260 CALL TIMER_STOP ('STATEKPP [KPP_CALC]', myThid)
261
262 DO k = 1, Nr
263 DO j = 1-OLy, sNy+OLy
264 DO i = 1-OLx, sNx+OLx
265 ghat(i,j,k) = dbloc(i,j,k)
266 ENDDO
267 ENDDO
268 ENDDO
269
270 #ifdef KPP_SMOOTH_DBLOC
271 c horizontally smooth dbloc with a 121 filter
272 c smooth dbloc stored in ghat to save space
273 c dbloc(k) is buoyancy gradientnote between k and k+1
274 c levels therefore k+1 mask must be used
275
276 DO k = 1, Nr-1
277 CALL SMOOTH_HORIZ (
278 I k+1, bi, bj,
279 U ghat (1-OLx,1-OLy,k),
280 I myThid )
281 ENDDO
282
283 #endif /* KPP_SMOOTH_DBLOC */
284
285 #ifdef KPP_SMOOTH_DENS
286 c horizontally smooth density related quantities with 121 filters
287 CALL SMOOTH_HORIZ (
288 I 1, bi, bj,
289 U work2,
290 I myThid )
291 DO k = 1, Nr
292 CALL SMOOTH_HORIZ (
293 I k+1, bi, bj,
294 U dbloc (1-OLx,1-OLy,k),
295 I myThid )
296 CALL SMOOTH_HORIZ (
297 I k, bi, bj,
298 U Ritop (1-OLx,1-OLy,k),
299 I myThid )
300 CALL SMOOTH_HORIZ (
301 I k, bi, bj,
302 U TTALPHA(1-OLx,1-OLy,k),
303 I myThid )
304 CALL SMOOTH_HORIZ (
305 I k, bi, bj,
306 U SSBETA(1-OLx,1-OLy,k),
307 I myThid )
308 ENDDO
309 #endif /* KPP_SMOOTH_DENS */
310
311 DO k = 1, Nr
312 km1 = max(1,k-1)
313 DO j = 1-OLy, sNy+OLy
314 DO i = 1-OLx, sNx+OLx
315
316 c zero out dbloc over land points (so that the convective
317 c part of the interior mixing can be diagnosed)
318 dbloc(i,j,k) = dbloc(i,j,k) * maskC(i,j,k,bi,bj)
319 & * maskC(i,j,km1,bi,bj)
320 ghat(i,j,k) = ghat(i,j,k) * maskC(i,j,k,bi,bj)
321 & * maskC(i,j,km1,bi,bj)
322 Ritop(i,j,k) = Ritop(i,j,k) * maskC(i,j,k,bi,bj)
323 & * maskC(i,j,km1,bi,bj)
324 if(k.eq.nzmax(i,j,bi,bj)) then
325 dbloc(i,j,k) = p0
326 ghat(i,j,k) = p0
327 Ritop(i,j,k) = p0
328 endif
329
330 c numerator of bulk richardson number on grid levels
331 c note: land and ocean bottom values need to be set to zero
332 c so that the subroutine "bldepth" works correctly
333 Ritop(i,j,k) = (zgrid(1)-zgrid(k)) * Ritop(i,j,k)
334
335 ENDDO
336 ENDDO
337 ENDDO
338
339 cph(
340 cph this avoids a single or double recomp./call of statekpp
341 CADJ store work2 = comlev1_kpp, key = ikppkey
342 #ifdef KPP_AUTODIFF_EXCESSIVE_STORE
343 CADJ store dbloc, Ritop, ghat = comlev1_kpp, key = ikppkey
344 CADJ store vddiff = comlev1_kpp, key = ikppkey
345 CADJ store TTALPHA, SSBETA = comlev1_kpp, key = ikppkey
346 #endif
347 cph)
348
349 CML#ifdef ALLOW_SHELFICE
350 CMLC For the pbl parameterisation to work underneath the ice shelves
351 CMLC it needs to know the surface (ice-ocean) fluxes. However, masking
352 CMLC and indexing problems make this part of the code not work
353 CMLC underneath the ice shelves and the following lines are only here
354 CMLC to remind me that this still needs to be sorted out.
355 CML shelfIceFac = 0. _d 0
356 CML IF ( useShelfIce ) selfIceFac = 1. _d 0
357 CML DO j = jmin, jmax
358 CML DO i = imin, imax
359 CML surfForcT = surfaceForcingT(i,j,bi,bj)
360 CML & + shelficeForcingT(i,j,bi,bj) * shelfIceFac
361 CML surfForcS = surfaceForcingS(i,j,bi,bj)
362 CML & + shelficeForcingS(i,j,bi,bj) * shelfIceFac
363 CML ENDDO
364 CML ENDDO
365 CML#endif /* ALLOW_SHELFICE */
366
367 c------------------------------------------------------------------------
368 c friction velocity, turbulent and radiative surface buoyancy forcing
369 c -------------------------------------------------------------------
370 c taux / rho = surfaceForcingU (N/m^2)
371 c tauy / rho = surfaceForcingV (N/m^2)
372 c ustar = sqrt( sqrt( taux^2 + tauy^2 ) / rho ) (m/s)
373 c bo = - g * ( alpha*surfaceForcingT +
374 c beta *surfaceForcingS ) / rho (m^2/s^3)
375 c bosol = - g * alpha * Qsw * drF(1) / rho (m^2/s^3)
376 c------------------------------------------------------------------------
377 c velocity shear
378 c --------------
379 c Get velocity shear squared, averaged from "u,v-grid"
380 c onto "t-grid" (in (m/s)**2):
381 c dVsq(k)=(Uref-U(k))**2+(Vref-V(k))**2 at grid levels
382 c shsq(k)=(U(k)-U(k+1))**2+(V(k)-V(k+1))**2 at interfaces
383 c
384 c note: Vref can depend on the surface fluxes that is why we compute
385 c dVsq in the subroutine that does the surface related stuff
386 c (admittedly this is a bit messy)
387 c------------------------------------------------------------------------
388
389 CALL KPP_FORCING_SURF(
390 I work2, surfaceForcingU, surfaceForcingV,
391 I surfaceForcingT, surfaceForcingS, surfaceForcingTice,
392 I Qsw, ttalpha, ssbeta,
393 O ustar, bo, bosol, dVsq,
394 I ikppkey, iMin, iMax, jMin, jMax, bi, bj, myTime, myThid )
395
396 CMLcph(
397 CMLCADJ store ustar = comlev1_kpp, key = ikppkey
398 CMLcph)
399
400 c initialize arrays to zero
401 DO k = 1, Nr
402 DO j = 1-OLy, sNy+OLy
403 DO i = 1-OLx, sNx+OLx
404 shsq(i,j,k) = p0
405 ENDDO
406 ENDDO
407 ENDDO
408
409 c shsq computation
410 DO k = 1, Nrm1
411 kp1 = k + 1
412 DO j = jmin, jmax
413 jm1 = j - 1
414 jp1 = j + 1
415 DO i = imin, imax
416 im1 = i - 1
417 ip1 = i + 1
418 shsq(i,j,k) = p5 * (
419 & (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) *
420 & (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) +
421 & (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) *
422 & (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) +
423 & (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) *
424 & (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) +
425 & (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) *
426 & (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) )
427 #ifdef KPP_SMOOTH_SHSQ
428 shsq(i,j,k) = p5 * shsq(i,j,k) + p125 * (
429 & (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) *
430 & (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) +
431 & (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) *
432 & (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) +
433 & (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) *
434 & (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) +
435 & (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) *
436 & (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) +
437 & (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) *
438 & (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) +
439 & (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) *
440 & (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) +
441 & (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) *
442 & (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) +
443 & (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) *
444 & (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) )
445 #endif
446 ENDDO
447 ENDDO
448 ENDDO
449
450 cph(
451 #ifdef KPP_AUTODIFF_EXCESSIVE_STORE
452 CADJ store dvsq, shsq = comlev1_kpp, key = ikppkey
453 #endif
454 cph)
455
456 c-----------------------------------------------------------------------
457 c solve for viscosity, diffusivity, ghat, and hbl on "t-grid"
458 c-----------------------------------------------------------------------
459
460 c precompute background vertical diffusivities, which are needed for
461 c matching diffusivities at bottom of KPP PBL
462 CALL CALC_3D_DIFFUSIVITY(
463 I bi,bj,1-Olx,sNx+OLx,1-Oly,sNy+OLy,
464 I GAD_SALINITY, .FALSE., .FALSE.,
465 O KPPdiffKzS(1-Olx,1-Oly,1,bi,bj),
466 I myThid)
467 CALL CALC_3D_DIFFUSIVITY(
468 I bi,bj,1-Olx,sNx+OLx,1-Oly,sNy+OLy,
469 I GAD_TEMPERATURE, .FALSE., .FALSE.,
470 O KPPdiffKzT(1-Olx,1-Oly,1,bi,bj),
471 I myThid)
472
473 DO j = 1-OLy, sNy+OLy
474 DO i = 1-OLx, sNx+OLx
475 work1(i,j) = nzmax(i,j,bi,bj)
476 work2(i,j) = Fcori(i,j,bi,bj)
477 ENDDO
478 ENDDO
479 CALL TIMER_START('KPPMIX [KPP_CALC]', myThid)
480 CALL KPPMIX (
481 I work1, shsq, dVsq, ustar
482 I , maskC(1-Olx,1-Oly,1,bi,bj)
483 I , bo, bosol, dbloc, Ritop, work2
484 I , KPPdiffKzS(1-Olx,1-Oly,1,bi,bj)
485 I , KPPdiffKzT(1-Olx,1-Oly,1,bi,bj)
486 I , ikppkey
487 O , vddiff
488 U , ghat
489 O , hbl
490 I , mytime, myIter, mythid )
491 CALL TIMER_STOP ('KPPMIX [KPP_CALC]', myThid)
492
493 c-----------------------------------------------------------------------
494 c zero out land values and transfer to global variables
495 c-----------------------------------------------------------------------
496
497 DO j = jmin, jmax
498 DO i = imin, imax
499 DO k = 1, Nr
500 km1 = max(1,k-1)
501 KPPviscAz(i,j,k,bi,bj) = vddiff(i,j,k-1,1) * maskC(i,j,k,bi,bj)
502 & * maskC(i,j,km1,bi,bj)
503 KPPdiffKzS(i,j,k,bi,bj)= vddiff(i,j,k-1,2) * maskC(i,j,k,bi,bj)
504 & * maskC(i,j,km1,bi,bj)
505 KPPdiffKzT(i,j,k,bi,bj)= vddiff(i,j,k-1,3) * maskC(i,j,k,bi,bj)
506 & * maskC(i,j,km1,bi,bj)
507 KPPghat(i,j,k,bi,bj) = ghat(i,j,k) * maskC(i,j,k,bi,bj)
508 & * maskC(i,j,km1,bi,bj)
509 ENDDO
510 k = 1
511 #ifdef ALLOW_SHELFICE
512 if ( useShelfIce ) k = kTopC(i,j,bi,bj)
513 #endif /* ALLOW_SHELFICE */
514 KPPhbl(i,j,bi,bj) = hbl(i,j) * maskC(i,j,k,bi,bj)
515
516 ENDDO
517 ENDDO
518
519 #ifdef KPP_SMOOTH_VISC
520 c horizontal smoothing of vertical viscosity
521 DO k = 1, Nr
522 CALL SMOOTH_HORIZ (
523 I k, bi, bj,
524 U KPPviscAz(1-OLx,1-OLy,k,bi,bj),
525 I myThid )
526 ENDDO
527 C jmc: No EXCH inside bi,bj loop !!!
528 c _EXCH_XYZ_R8(KPPviscAz , myThid )
529 #endif /* KPP_SMOOTH_VISC */
530
531 #ifdef KPP_SMOOTH_DIFF
532 c horizontal smoothing of vertical diffusivity
533 DO k = 1, Nr
534 CALL SMOOTH_HORIZ (
535 I k, bi, bj,
536 U KPPdiffKzS(1-OLx,1-OLy,k,bi,bj),
537 I myThid )
538 CALL SMOOTH_HORIZ (
539 I k, bi, bj,
540 U KPPdiffKzT(1-OLx,1-OLy,k,bi,bj),
541 I myThid )
542 ENDDO
543 #endif /* KPP_SMOOTH_DIFF */
544
545 cph(
546 cph crucial: this avoids full recomp./call of kppmix
547 CADJ store KPPhbl = comlev1_kpp, key = ikppkey
548 cph)
549
550 C Compute fraction of solar short-wave flux penetrating to
551 C the bottom of the mixing layer.
552 DO j=1-OLy,sNy+OLy
553 DO i=1-OLx,sNx+OLx
554 worka(i,j) = KPPhbl(i,j,bi,bj)
555 ENDDO
556 ENDDO
557 CALL SWFRAC(
558 I (sNx+2*OLx)*(sNy+2*OLy), minusone,
559 U worka,
560 I myTime, myIter, myThid )
561 DO j=1-OLy,sNy+OLy
562 DO i=1-OLx,sNx+OLx
563 KPPfrac(i,j,bi,bj) = worka(i,j)
564 ENDDO
565 ENDDO
566
567 ENDIF
568
569 #endif /* ALLOW_KPP */
570
571 RETURN
572 END
573
574 SUBROUTINE KPP_CALC_DUMMY(
575 I bi, bj, myTime, myIter, myThid )
576 C *==========================================================*
577 C | SUBROUTINE KPP_CALC_DUMMY |
578 C | o Compute all KPP fields defined in KPP.h |
579 C | o Dummy routine for TAMC
580 C *==========================================================*
581 C | This subroutine serves as an interface between MITGCMUV |
582 C | code and NCOM 1-D routines in kpp_routines.F |
583 C *==========================================================*
584 IMPLICIT NONE
585
586 #include "SIZE.h"
587 #include "EEPARAMS.h"
588 #include "PARAMS.h"
589 #include "KPP.h"
590 #include "KPP_PARAMS.h"
591 #include "GRID.h"
592 #include "GAD.h"
593
594 c Routine arguments
595 c bi, bj :: Current tile indices
596 c myTime :: Current time in simulation
597 c myIter :: Current iteration number in simulation
598 c myThid :: My Thread Id. number
599
600 INTEGER bi, bj
601 _RL myTime
602 INTEGER myIter
603 INTEGER myThid
604
605 #ifdef ALLOW_KPP
606
607 c Local constants
608 integer i, j, k
609
610 DO j=1-OLy,sNy+OLy
611 DO i=1-OLx,sNx+OLx
612 KPPhbl (i,j,bi,bj) = 1.0
613 KPPfrac(i,j,bi,bj) = 0.0
614 DO k = 1,Nr
615 KPPghat (i,j,k,bi,bj) = 0.0
616 KPPviscAz (i,j,k,bi,bj) = viscAr
617 ENDDO
618 ENDDO
619 ENDDO
620
621 CALL CALC_3D_DIFFUSIVITY(
622 I bi,bj,1-Olx,sNx+OLx,1-Oly,sNy+OLy,
623 I GAD_SALINITY, .FALSE., .FALSE.,
624 O KPPdiffKzS(1-Olx,1-Oly,1,bi,bj),
625 I myThid)
626 CALL CALC_3D_DIFFUSIVITY(
627 I bi,bj,1-Olx,sNx+OLx,1-Oly,sNy+OLy,
628 I GAD_TEMPERATURE, .FALSE., .FALSE.,
629 O KPPdiffKzT(1-Olx,1-Oly,1,bi,bj),
630 I myThid)
631
632 #endif
633 RETURN
634 END

  ViewVC Help
Powered by ViewVC 1.1.22