1 |
C $Header: $ |
2 |
|
3 |
#include "KPP_OPTIONS.h" |
4 |
|
5 |
subroutine KPP_CALC( |
6 |
I bi, bj, myTime, myThid ) |
7 |
C /==========================================================\ |
8 |
C | SUBROUTINE KPP_CALC | |
9 |
C | o Compute all KPP fields defined in KPP.h | |
10 |
C |==========================================================| |
11 |
C | This subroutine serves as an interface between MITGCMUV | |
12 |
C | code and NCOM 1-D routines in kpp_routines.F | |
13 |
C \==========================================================/ |
14 |
IMPLICIT NONE |
15 |
|
16 |
c======================================================================= |
17 |
c |
18 |
c written by : jan morzel, august 11, 1994 |
19 |
c modified by : jan morzel, january 25, 1995 : "dVsq" and 1d code |
20 |
c detlef stammer, august, 1997 : for MIT GCM Classic |
21 |
c d. menemenlis, july, 1998 : for MIT GCM UV |
22 |
c |
23 |
c compute vertical mixing coefficients based on the k-profile |
24 |
c and oceanic planetary boundary layer scheme by large & mcwilliams. |
25 |
c |
26 |
c summary: |
27 |
c - compute interior mixing everywhere: |
28 |
c interior mixing gets computed at all interfaces due to constant |
29 |
c internal wave background activity ("fkpm" and "fkph"), which |
30 |
c is enhanced in places of static instability (local richardson |
31 |
c number < 0). |
32 |
c Additionally, mixing can be enhanced by adding contribution due |
33 |
c to shear instability which is a function of the local richardson |
34 |
c number |
35 |
c - double diffusivity: |
36 |
c interior mixing can be enhanced by double diffusion due to salt |
37 |
c fingering and diffusive convection (ifdef "kmixdd"). |
38 |
c - kpp scheme in the boundary layer: |
39 |
c |
40 |
c a.boundary layer depth: |
41 |
c at every gridpoint the depth of the oceanic boundary layer |
42 |
c ("hbl") gets computed by evaluating bulk richardson numbers. |
43 |
c b.boundary layer mixing: |
44 |
c within the boundary layer, above hbl, vertical mixing is |
45 |
c determined by turbulent surface fluxes, and interior mixing at |
46 |
c the lower boundary, i.e. at hbl. |
47 |
c |
48 |
c this subroutine provides the interface between the MIT GCM UV and the |
49 |
c subroutine "kppmix", where boundary layer depth, vertical |
50 |
c viscosity, vertical diffusivity, and counter gradient term (ghat) |
51 |
c are computed slabwise. |
52 |
c note: subroutine "kppmix" uses m-k-s units. |
53 |
c |
54 |
c time level: |
55 |
c input tracer and velocity profiles are evaluated at time level |
56 |
c tau, surface fluxes come from tau or tau-1. |
57 |
c |
58 |
c grid option: |
59 |
c in this "1-grid" implementation, diffusivity and viscosity |
60 |
c profiles are computed on the "t-grid" (by using velocity shear |
61 |
c profiles averaged from the "u,v-grid" onto the "t-grid"; note, that |
62 |
c the averaging includes zero values on coastal and seafloor grid |
63 |
c points). viscosity on the "u,v-grid" is computed by averaging the |
64 |
c "t-grid" viscosity values onto the "u,v-grid". |
65 |
c |
66 |
c vertical grid: |
67 |
c mixing coefficients get evaluated at the bottom of the lowest |
68 |
c layer, i.e., at depth zw(Nr). these values are only useful when |
69 |
c the model ocean domain does not include the entire ocean down to |
70 |
c the seafloor ("upperocean" setup) and allows flux through the |
71 |
c bottom of the domain. for full-depth runs, these mixing |
72 |
c coefficients are being zeroed out before leaving this subroutine. |
73 |
c |
74 |
c------------------------------------------------------------------------- |
75 |
|
76 |
c global parameters updated by kpp_calc |
77 |
c KPPviscAz - KPP eddy viscosity coefficient (m^2/s) |
78 |
c KPPdiffKzT - KPP diffusion coefficient for temperature (m^2/s) |
79 |
c KPPdiffKzS - KPP diffusion coefficient for salt and tracers (m^2/s) |
80 |
c KPPghat - Nonlocal transport coefficient (s/m^2) |
81 |
c KPPhbl - Boundary layer depth on "t-grid" (m) |
82 |
c KPPfrac - Fraction of short-wave flux penetrating mixing layer |
83 |
|
84 |
c-- KPP_CALC computes vertical viscosity and diffusivity for region |
85 |
c (-2:sNx+3,-2:sNy+3) as required by CALC_DIFFUSIVITY and requires |
86 |
c values of uVel, vVel, fu, fv in the region (-2:sNx+4,-2:sNy+4). |
87 |
c Hence overlap region needs to be set OLx=4, OLy=4. |
88 |
c When option FRUGAL_KPP is used, computation in overlap regions |
89 |
c is replaced with exchange calls hence reducing overlap requirements |
90 |
c to OLx=1, OLy=1. |
91 |
|
92 |
#include "SIZE.h" |
93 |
#include "EEPARAMS.h" |
94 |
#include "PARAMS.h" |
95 |
#include "DYNVARS.h" |
96 |
#include "KPP.h" |
97 |
#include "KPP_PARAMS.h" |
98 |
#include "FFIELDS.h" |
99 |
#include "GRID.h" |
100 |
|
101 |
#ifdef ALLOW_AUTODIFF_TAMC |
102 |
#include "tamc.h" |
103 |
#include "tamc_keys.h" |
104 |
#else /* ALLOW_AUTODIFF_TAMC */ |
105 |
integer ikey |
106 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
107 |
|
108 |
EXTERNAL DIFFERENT_MULTIPLE |
109 |
LOGICAL DIFFERENT_MULTIPLE |
110 |
|
111 |
c Routine arguments |
112 |
c bi, bj - array indices on which to apply calculations |
113 |
c myTime - Current time in simulation |
114 |
|
115 |
INTEGER bi, bj |
116 |
INTEGER myThid |
117 |
_RL myTime |
118 |
|
119 |
#ifdef ALLOW_KPP |
120 |
|
121 |
c Local arrays and variables |
122 |
c work? (nx,ny) - horizontal working arrays |
123 |
c ustar (nx,ny) - surface friction velocity (m/s) |
124 |
c bo (nx,ny) - surface turbulent buoyancy forcing (m^2/s^3) |
125 |
c bosol (nx,ny) - surface radiative buoyancy forcing (m^2/s^3) |
126 |
c shsq (nx,ny,Nr) - local velocity shear squared |
127 |
c at interfaces for ri_iwmix (m^2/s^2) |
128 |
c dVsq (nx,ny,Nr) - velocity shear re surface squared |
129 |
c at grid levels for bldepth (m^2/s^2) |
130 |
c dbloc (nx,ny,Nr) - local delta buoyancy at interfaces |
131 |
c for ri_iwmix and bldepth (m/s^2) |
132 |
c Ritop (nx,ny,Nr) - numerator of bulk richardson number |
133 |
c at grid levels for bldepth |
134 |
c vddiff (nx,ny,Nrp2,1)- vertical viscosity on "t-grid" (m^2/s) |
135 |
c vddiff (nx,ny,Nrp2,2)- vert. diff. on next row for temperature (m^2/s) |
136 |
c vddiff (nx,ny,Nrp2,3)- vert. diff. on next row for salt&tracers (m^2/s) |
137 |
c ghat (nx,ny,Nr) - nonlocal transport coefficient (s/m^2) |
138 |
c hbl (nx,ny) - mixing layer depth (m) |
139 |
c kmtj (nx,ny) - maximum number of wet levels in each column |
140 |
c z0 (nx,ny) - Roughness length (m) |
141 |
c zRef (nx,ny) - Reference depth: Hmix * epsilon (m) |
142 |
c uRef (nx,ny) - Reference zonal velocity (m/s) |
143 |
c vRef (nx,ny) - Reference meridional velocity (m/s) |
144 |
|
145 |
_RS worka (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
146 |
_RS workb (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
147 |
#ifdef FRUGAL_KPP |
148 |
integer work1(sNx,sNy) |
149 |
_RS work2 (sNx,sNy) |
150 |
_RS ustar (sNx,sNy) |
151 |
_RS bo (sNx,sNy) |
152 |
_RS bosol (sNx,sNy) |
153 |
_RS shsq (sNx,sNy,Nr) |
154 |
_RS dVsq (sNx,sNy,Nr) |
155 |
_RS dbloc (sNx,sNy,Nr) |
156 |
_RS Ritop (sNx,sNy,Nr) |
157 |
_RS vddiff (sNx,sNy,0:Nrp1,mdiff) |
158 |
_RS ghat (sNx,sNy,Nr) |
159 |
_RS hbl (sNx,sNy) |
160 |
#ifdef KPP_ESTIMATE_UREF |
161 |
_RS z0 (sNx,sNy) |
162 |
_RS zRef (sNx,sNy) |
163 |
_RS uRef (sNx,sNy) |
164 |
_RS vRef (sNx,sNy) |
165 |
#endif /* KPP_ESTIMATE_UREF */ |
166 |
#else /* FRUGAL_KPP */ |
167 |
integer work1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
168 |
_RS work2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
169 |
_RS ustar (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
170 |
_RS bo (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
171 |
_RS bosol (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
172 |
_RS shsq (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
173 |
_RS dVsq (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
174 |
_RS dbloc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
175 |
_RS Ritop (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
176 |
_RS vddiff (1-OLx:sNx+OLx,1-OLy:sNy+OLy,0:Nrp1,mdiff) |
177 |
_RS ghat (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
178 |
_RS hbl (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
179 |
#ifdef KPP_ESTIMATE_UREF |
180 |
_RS z0 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
181 |
_RS zRef (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
182 |
_RS uRef (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
183 |
_RS vRef (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
184 |
#endif /* KPP_ESTIMATE_UREF */ |
185 |
#endif /* FRUGAL_KPP */ |
186 |
|
187 |
c imin,imax,jmin,jmax - array indices |
188 |
integer imin , imax , jmin , jmax |
189 |
parameter( imin=-2, imax=sNx+3, jmin=-2, jmax=sNy+3 ) |
190 |
|
191 |
c mixing process switches |
192 |
logical lri |
193 |
parameter( lri = .true. ) |
194 |
|
195 |
_RS p0 , p5 , p25 , p125 , p0625 |
196 |
parameter( p0=0.0, p5=0.5, p25=0.25, p125=0.125, p0625=0.0625 ) |
197 |
|
198 |
_RS tempVar |
199 |
integer i, j, k, kp1, im1, ip1, jm1, jp1 |
200 |
|
201 |
#ifdef KPP_ESTIMATE_UREF |
202 |
_RS dBdz1, dBdz2, ustarX, ustarY |
203 |
#endif |
204 |
|
205 |
IF (use_KPPmixing) THEN |
206 |
|
207 |
CADJ STORE fu (:,: ,bi,bj) = uvtape, key = ikey, byte = isbyte |
208 |
CADJ STORE fv (:,: ,bi,bj) = uvtape, key = ikey, byte = isbyte |
209 |
|
210 |
c Check to see if new vertical mixing coefficient should be computed now? |
211 |
IF ( DIFFERENT_MULTIPLE(kpp_freq,myTime,myTime-deltaTClock) .OR. |
212 |
1 myTime .EQ. startTime ) THEN |
213 |
|
214 |
c----------------------------------------------------------------------- |
215 |
c prepare input arrays for subroutine "kppmix" to compute |
216 |
c viscosity and diffusivity and ghat. |
217 |
c All input arrays need to be in m-k-s units. |
218 |
c |
219 |
c note: for the computation of the bulk richardson number in the |
220 |
c "bldepth" subroutine, gradients of velocity and buoyancy are |
221 |
c required at every depth. in the case of very fine vertical grids |
222 |
c (thickness of top layer < 2m), the surface reference depth must |
223 |
c be set to zref=epsilon/2*zgrid(k), and the reference value |
224 |
c of velocity and buoyancy must be computed as vertical average |
225 |
c between the surface and 2*zref. in the case of coarse vertical |
226 |
c grids zref is zgrid(1)/2., and the surface reference value is |
227 |
c simply the surface value at zgrid(1). |
228 |
c----------------------------------------------------------------------- |
229 |
|
230 |
c------------------------------------------------------------------------ |
231 |
c density related quantities |
232 |
c -------------------------- |
233 |
c |
234 |
c work2 - density of surface layer (kg/m^3) |
235 |
c dbloc - local buoyancy gradient at Nr interfaces |
236 |
c g/rho{k+1,k+1} * [ drho{k,k+1}-drho{k+1,k+1} ] (m/s^2) |
237 |
c dbsfc (stored in Ritop to conserve stack memory) |
238 |
c - buoyancy difference with respect to the surface |
239 |
c g * [ drho{1,k}/rho{1,k} - drho{k,k}/rho{k,k} ] (m/s^2) |
240 |
c ttalpha (stored in vddiff(:,:,:,1) to conserve stack memory) |
241 |
c - thermal expansion coefficient without 1/rho factor |
242 |
c d(rho{k,k})/d(T(k)) (kg/m^3/C) |
243 |
c ssbeta (stored in vddiff(:,:,:,2) to conserve stack memory) |
244 |
c - salt expansion coefficient without 1/rho factor |
245 |
c d(rho{k,k})/d(S(k)) (kg/m^3/PSU) |
246 |
c------------------------------------------------------------------------ |
247 |
|
248 |
CALL TIMER_START('STATEKPP [KPP_CALC]', myThid) |
249 |
CALL STATEKPP( |
250 |
I bi, bj, myThid |
251 |
O , work2, dbloc, Ritop |
252 |
#ifdef FRUGAL_KPP |
253 |
O , vddiff(1 ,1 ,1,1), vddiff(1 ,1 ,1,2) |
254 |
#else |
255 |
O , vddiff(1-OLx,1-OLy,1,1), vddiff(1-OLx,1-OLy,1,2) |
256 |
#endif |
257 |
& ) |
258 |
CALL TIMER_STOP ('STATEKPP [KPP_CALC]', myThid) |
259 |
|
260 |
#ifdef KPP_SMOOTH_DBLOC |
261 |
c horizontally smooth dbloc with a 121 filter |
262 |
c (stored in ghat to save space) |
263 |
|
264 |
DO k = 1, Nr |
265 |
CALL SMOOTH_HORIZ_RS ( |
266 |
I k, bi, bj, |
267 |
I dbloc(1-OLx,1-OLy,k), |
268 |
O ghat (1-OLx,1-OLy,k) ) |
269 |
ENDDO |
270 |
|
271 |
#else /* KPP_SMOOTH_DBLOC */ |
272 |
|
273 |
DO k = 1, Nr |
274 |
#ifdef FRUGAL_KPP |
275 |
DO j = 1, sNy |
276 |
DO i = 1, sNx |
277 |
#else |
278 |
DO j = 1-OLy, sNy+OLy |
279 |
DO i = imin, imax |
280 |
#endif |
281 |
ghat(i,j,k) = dbloc(i,j,k) |
282 |
ENDDO |
283 |
ENDDO |
284 |
ENDDO |
285 |
|
286 |
#endif /* KPP_SMOOTH_DBLOC */ |
287 |
|
288 |
#ifdef KPP_SMOOTH_DENS |
289 |
c horizontally smooth density related quantities with 121 filters |
290 |
CALL SMOOTH_HORIZ_RS ( |
291 |
I k, bi, bj, |
292 |
I work2, |
293 |
O work2 ) |
294 |
DO k = 1, Nr |
295 |
CALL SMOOTH_HORIZ_RS ( |
296 |
I k, bi, bj, |
297 |
I dbloc (1-OLx,1-OLy,k) , |
298 |
O dbloc (1-OLx,1-OLy,k) ) |
299 |
CALL SMOOTH_HORIZ_RS ( |
300 |
I k, bi, bj, |
301 |
I Ritop (1-OLx,1-OLy,k) , |
302 |
O Ritop (1-OLx,1-OLy,k) ) |
303 |
CALL SMOOTH_HORIZ_RS ( |
304 |
I k, bi, bj, |
305 |
I vddiff(1-OLx,1-OLy,k,1), |
306 |
O vddiff(1-OLx,1-OLy,k,1) ) |
307 |
CALL SMOOTH_HORIZ_RS ( |
308 |
I k, bi, bj, |
309 |
I vddiff(1-OLx,1-OLy,k,2), |
310 |
O vddiff(1-OLx,1-OLy,k,2) ) |
311 |
ENDDO |
312 |
#endif /* KPP_SMOOTH_DENS */ |
313 |
|
314 |
DO k = 1, Nr |
315 |
#ifdef FRUGAL_KPP |
316 |
DO j = 1, sNy |
317 |
DO i = 1, sNx |
318 |
#else |
319 |
DO j = 1-OLy, sNy+OLy |
320 |
DO i = 1-OLx, sNx+OLx |
321 |
#endif |
322 |
|
323 |
c zero out dbloc over land points (so that the convective |
324 |
c part of the interior mixing can be diagnosed) |
325 |
dbloc(i,j,k) = dbloc(i,j,k) * pMask(i,j,k,bi,bj) |
326 |
ghat(i,j,k) = ghat(i,j,k) * pMask(i,j,k,bi,bj) |
327 |
Ritop(i,j,k) = Ritop(i,j,k) * pMask(i,j,k,bi,bj) |
328 |
if(k.eq.nzmax(i,j,bi,bj)) then |
329 |
dbloc(i,j,k) = p0 |
330 |
ghat(i,j,k) = p0 |
331 |
Ritop(i,j,k) = p0 |
332 |
endif |
333 |
|
334 |
c numerator of bulk richardson number on grid levels |
335 |
c note: land and ocean bottom values need to be set to zero |
336 |
c so that the subroutine "bldepth" works correctly |
337 |
Ritop(i,j,k) = (zgrid(1)-zgrid(k)) * Ritop(i,j,k) |
338 |
|
339 |
END DO |
340 |
END DO |
341 |
END DO |
342 |
|
343 |
c------------------------------------------------------------------------ |
344 |
c friction velocity, turbulent and radiative surface buoyancy forcing |
345 |
c ------------------------------------------------------------------- |
346 |
c taux / rho = fu * delZ(1) (N/m^2) |
347 |
c tauy / rho = fv * delZ(1) (N/m^2) |
348 |
c ustar = sqrt( sqrt( taux^2 + tauy^2 ) / rho ) (m/s) |
349 |
c bo = - g * (alpha*Qnet + beta*EmPmR) * delZ(1) / rho (m^2/s^3) |
350 |
c bosol = - g * alpha * Qsw * delZ(1) / rho (m^2/s^3) |
351 |
c------------------------------------------------------------------------ |
352 |
|
353 |
#ifdef FRUGAL_KPP |
354 |
DO j = 1, sNy |
355 |
jp1 = j + 1 |
356 |
DO i = 1, sNx |
357 |
#else |
358 |
DO j = jmin, jmax |
359 |
jp1 = j + 1 |
360 |
DO i = imin, imax |
361 |
#endif |
362 |
ip1 = i+1 |
363 |
ustar(i,j) = SQRT( SQRT( |
364 |
& (fu(i,j,bi,bj) + fu(ip1,j,bi,bj)) * p5 * delZ(1) * |
365 |
& (fu(i,j,bi,bj) + fu(ip1,j,bi,bj)) * p5 * delZ(1) + |
366 |
& (fv(i,j,bi,bj) + fv(i,jp1,bi,bj)) * p5 * delZ(1) * |
367 |
& (fv(i,j,bi,bj) + fv(i,jp1,bi,bj)) * p5 * delZ(1) )) |
368 |
bo(I,J) = - gravity * |
369 |
& ( vddiff(I,J,1,1) * Qnet(i,j,bi,bj) + |
370 |
& vddiff(I,J,1,2) * EmPmR(i,j,bi,bj) |
371 |
& ) * |
372 |
& delZ(1) / work2(I,J) |
373 |
bosol(I,J) = - gravity * vddiff(I,J,1,1) * Qsw(i,j,bi,bj) * |
374 |
& delZ(1) / work2(I,J) |
375 |
END DO |
376 |
END DO |
377 |
|
378 |
#ifndef FRUGAL_KPP |
379 |
c set array edges to zero |
380 |
DO j = jmin, jmax |
381 |
DO i = 1-OLx, imin-1 |
382 |
ustar(i,j) = p0 |
383 |
bo (I,J) = p0 |
384 |
bosol(I,J) = p0 |
385 |
END DO |
386 |
DO i = imax+1, sNx+OLx |
387 |
ustar(i,j) = p0 |
388 |
bo (I,J) = p0 |
389 |
bosol(I,J) = p0 |
390 |
END DO |
391 |
END DO |
392 |
DO i = 1-OLx, sNx+OLx |
393 |
DO j = 1-OLy, jmin-1 |
394 |
ustar(i,j) = p0 |
395 |
bo (I,J) = p0 |
396 |
bosol(I,J) = p0 |
397 |
END DO |
398 |
DO j = jmax+1, sNy+OLy |
399 |
ustar(i,j) = p0 |
400 |
bo (I,J) = p0 |
401 |
bosol(I,J) = p0 |
402 |
END DO |
403 |
END DO |
404 |
#endif |
405 |
|
406 |
c------------------------------------------------------------------------ |
407 |
c velocity shear |
408 |
c -------------- |
409 |
c Get velocity shear squared, averaged from "u,v-grid" |
410 |
c onto "t-grid" (in (m/s)**2): |
411 |
c dVsq(k)=(Uref-U(k))**2+(Vref-V(k))**2 at grid levels |
412 |
c shsq(k)=(U(k)-U(k+1))**2+(V(k)-V(k+1))**2 at interfaces |
413 |
c------------------------------------------------------------------------ |
414 |
|
415 |
c dVsq computation |
416 |
|
417 |
#ifdef KPP_ESTIMATE_UREF |
418 |
|
419 |
c Get rid of vertical resolution dependence of dVsq term by |
420 |
c estimating a surface velocity that is independent of first level |
421 |
c thickness in the model. First determine mixed layer depth hMix. |
422 |
c Second zRef = espilon * hMix. Third determine roughness length |
423 |
c scale z0. Third estimate reference velocity. |
424 |
|
425 |
#ifdef FRUGAL_KPP |
426 |
DO j = 1, sNy |
427 |
jp1 = j + 1 |
428 |
DO i = 1, sNx |
429 |
#else |
430 |
DO j = jmin, jmax |
431 |
jp1 = j + 1 |
432 |
DO i = imin, imax |
433 |
#endif /* FRUGAL_KPP */ |
434 |
ip1 = i + 1 |
435 |
|
436 |
c Determine mixed layer depth hMix as the shallowest depth at which |
437 |
c dB/dz exceeds 5.2e-5 s^-2. |
438 |
work1(i,j) = nzmax(i,j,bi,bj) |
439 |
DO k = 1, Nr |
440 |
IF ( k .LT. nzmax(i,j,bi,bj) .AND. |
441 |
& dbloc(i,j,k) / drC(k+1) .GT. dB_dz ) |
442 |
& work1(i,j) = k |
443 |
END DO |
444 |
|
445 |
c Linearly interpolate to find hMix. |
446 |
k = work1(i,j) |
447 |
IF ( k .EQ. 0 .OR. nzmax(i,j,bi,bj) .EQ. 1 ) THEN |
448 |
zRef(i,j) = p0 |
449 |
ELSEIF ( k .EQ. 1) THEN |
450 |
dBdz2 = dbloc(i,j,1) / drC(2) |
451 |
zRef(i,j) = drF(1) * dB_dz / dBdz2 |
452 |
ELSEIF ( k .LT. nzmax(i,j,bi,bj) ) THEN |
453 |
dBdz1 = dbloc(i,j,k-1) / drC(k ) |
454 |
dBdz2 = dbloc(i,j,k ) / drC(k+1) |
455 |
zRef(i,j) = rF(k) + drF(k) * (dB_dz - dBdz1) / |
456 |
& MAX ( phepsi, dBdz2 - dBdz1 ) |
457 |
ELSE |
458 |
zRef(i,j) = rF(k+1) |
459 |
ENDIF |
460 |
|
461 |
c Compute roughness length scale z0 subject to 0 < z0 |
462 |
tempVar = SQRT ( p5 * ( |
463 |
& (uVel(i, j, 1,bi,bj)-uVel(i, j, 2,bi,bj)) * |
464 |
& (uVel(i, j, 1,bi,bj)-uVel(i, j, 2,bi,bj)) + |
465 |
& (uVel(ip1,j, 1,bi,bj)-uVel(ip1,j, 2,bi,bj)) * |
466 |
& (uVel(ip1,j, 1,bi,bj)-uVel(ip1,j, 2,bi,bj)) + |
467 |
& (vVel(i, j, 1,bi,bj)-vVel(i, j, 2,bi,bj)) * |
468 |
& (vVel(i, j, 1,bi,bj)-vVel(i, j, 2,bi,bj)) + |
469 |
& (vVel(i, jp1,1,bi,bj)-vVel(i, jp1,2,bi,bj)) * |
470 |
& (vVel(i, jp1,1,bi,bj)-vVel(i, jp1,2,bi,bj)) ) ) |
471 |
z0(i,j) = rF(2) * |
472 |
& ( rF(3) * LOG ( rF(3) / rF(2) ) / |
473 |
& ( rF(3) - rF(2) ) - |
474 |
& tempVar * vonK / |
475 |
& MAX ( ustar(i,j), phepsi ) ) |
476 |
z0(i,j) = MAX ( z0(i,j), phepsi ) |
477 |
|
478 |
c zRef is set to 0.1 * hMix subject to z0 <= zRef <= drF(1) |
479 |
zRef(i,j) = MAX ( epsilon * zRef(i,j), z0(i,j) ) |
480 |
zRef(i,j) = MIN ( zRef(i,j), drF(1) ) |
481 |
|
482 |
c Estimate reference velocity uRef and vRef. |
483 |
uRef(i,j) = p5 * |
484 |
& ( uVel(i,j,1,bi,bj) + uVel(ip1,j,1,bi,bj) ) |
485 |
vRef(i,j) = p5 * |
486 |
& ( vVel(i,j,1,bi,bj) + vVel(i,jp1,1,bi,bj) ) |
487 |
IF ( zRef(i,j) .LT. drF(1) ) THEN |
488 |
ustarX = ( fu(i,j,bi,bj) + fu(ip1,j,bi,bj) ) * p5 |
489 |
ustarY = ( fv(i,j,bi,bj) + fu(i,jp1,bi,bj) ) * p5 |
490 |
tempVar = MAX ( phepsi, |
491 |
& SQRT ( ustarX * ustarX + ustarY * ustarY ) ) |
492 |
tempVar = ustar(i,j) * |
493 |
& ( LOG ( zRef(i,j) / rF(2) ) + |
494 |
& z0(i,j) / zRef(i,j) - z0(i,j) / rF(2) ) / |
495 |
& vonK / tempVar |
496 |
uRef(i,j) = uRef(i,j) + ustarX * tempVar |
497 |
vRef(i,j) = vRef(i,j) + ustarY * tempVar |
498 |
ENDIF |
499 |
|
500 |
END DO |
501 |
END DO |
502 |
|
503 |
IF (KPPmixingMaps) THEN |
504 |
#ifdef FRUGAL_KPP |
505 |
CALL PRINT_MAPRS( |
506 |
I zRef, 'zRef', PRINT_MAP_XY, |
507 |
I 1, sNx, 1, sNy, 1, 1, 1, 1, |
508 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
509 |
CALL PRINT_MAPRS( |
510 |
I z0, 'z0', PRINT_MAP_XY, |
511 |
I 1, sNx, 1, sNy, 1, 1, 1, 1, |
512 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
513 |
CALL PRINT_MAPRS( |
514 |
I uRef, 'uRef', PRINT_MAP_XY, |
515 |
I 1, sNx, 1, sNy, 1, 1, 1, 1, |
516 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
517 |
CALL PRINT_MAPRS( |
518 |
I vRef, 'vRef', PRINT_MAP_XY, |
519 |
I 1, sNx, 1, sNy, 1, 1, 1, 1, |
520 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
521 |
#else |
522 |
CALL PRINT_MAPRS( |
523 |
I zRef, 'zRef', PRINT_MAP_XY, |
524 |
I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, 1, 1, |
525 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
526 |
CALL PRINT_MAPRS( |
527 |
I z0, 'z0', PRINT_MAP_XY, |
528 |
I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, 1, 1, |
529 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
530 |
CALL PRINT_MAPRS( |
531 |
I uRef, 'uRef', PRINT_MAP_XY, |
532 |
I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, 1, 1, |
533 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
534 |
CALL PRINT_MAPRS( |
535 |
I vRef, 'vRef', PRINT_MAP_XY, |
536 |
I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, 1, 1, |
537 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
538 |
#endif |
539 |
ENDIF |
540 |
|
541 |
DO k = 1, Nr |
542 |
#ifdef FRUGAL_KPP |
543 |
DO j = 1, sNy |
544 |
jm1 = j - 1 |
545 |
jp1 = j + 1 |
546 |
DO i = 1, sNx |
547 |
#else |
548 |
DO j = jmin, jmax |
549 |
jm1 = j - 1 |
550 |
jp1 = j + 1 |
551 |
DO i = imin, imax |
552 |
#endif /* FRUGAL_KPP */ |
553 |
im1 = i - 1 |
554 |
ip1 = i + 1 |
555 |
dVsq(i,j,k) = p5 * ( |
556 |
$ (uRef(i,j) - uVel(i, j, k,bi,bj)) * |
557 |
$ (uRef(i,j) - uVel(i, j, k,bi,bj)) + |
558 |
$ (uRef(i,j) - uVel(ip1,j, k,bi,bj)) * |
559 |
$ (uRef(i,j) - uVel(ip1,j, k,bi,bj)) + |
560 |
$ (vRef(i,j) - vVel(i, j, k,bi,bj)) * |
561 |
$ (vRef(i,j) - vVel(i, j, k,bi,bj)) + |
562 |
$ (vRef(i,j) - vVel(i, jp1,k,bi,bj)) * |
563 |
$ (vRef(i,j) - vVel(i, jp1,k,bi,bj)) ) |
564 |
#ifdef KPP_SMOOTH_DVSQ |
565 |
dVsq(i,j,k) = p5 * dVsq(i,j,k) + p125 * ( |
566 |
$ (uRef(i,j) - uVel(i, jm1,k,bi,bj)) * |
567 |
$ (uRef(i,j) - uVel(i, jm1,k,bi,bj)) + |
568 |
$ (uRef(i,j) - uVel(ip1,jm1,k,bi,bj)) * |
569 |
$ (uRef(i,j) - uVel(ip1,jm1,k,bi,bj)) + |
570 |
$ (uRef(i,j) - uVel(i, jp1,k,bi,bj)) * |
571 |
$ (uRef(i,j) - uVel(i, jp1,k,bi,bj)) + |
572 |
$ (uRef(i,j) - uVel(ip1,jp1,k,bi,bj)) * |
573 |
$ (uRef(i,j) - uVel(ip1,jp1,k,bi,bj)) + |
574 |
$ (vRef(i,j) - vVel(im1,j, k,bi,bj)) * |
575 |
$ (vRef(i,j) - vVel(im1,j, k,bi,bj)) + |
576 |
$ (vRef(i,j) - vVel(im1,jp1,k,bi,bj)) * |
577 |
$ (vRef(i,j) - vVel(im1,jp1,k,bi,bj)) + |
578 |
$ (vRef(i,j) - vVel(ip1,j, k,bi,bj)) * |
579 |
$ (vRef(i,j) - vVel(ip1,j, k,bi,bj)) + |
580 |
$ (vRef(i,j) - vVel(ip1,jp1,k,bi,bj)) * |
581 |
$ (vRef(i,j) - vVel(ip1,jp1,k,bi,bj)) ) |
582 |
#endif /* KPP_SMOOTH_DVSQ */ |
583 |
END DO |
584 |
END DO |
585 |
END DO |
586 |
|
587 |
#else /* KPP_ESTIMATE_UREF */ |
588 |
|
589 |
DO k = 1, Nr |
590 |
#ifdef FRUGAL_KPP |
591 |
DO j = 1, sNy |
592 |
jm1 = j - 1 |
593 |
jp1 = j + 1 |
594 |
DO i = 1, sNx |
595 |
#else |
596 |
DO j = jmin, jmax |
597 |
jm1 = j - 1 |
598 |
jp1 = j + 1 |
599 |
DO i = imin, imax |
600 |
#endif /* FRUGAL_KPP */ |
601 |
im1 = i - 1 |
602 |
ip1 = i + 1 |
603 |
dVsq(i,j,k) = p5 * ( |
604 |
$ (uVel(i, j, 1,bi,bj)-uVel(i, j, k,bi,bj)) * |
605 |
$ (uVel(i, j, 1,bi,bj)-uVel(i, j, k,bi,bj)) + |
606 |
$ (uVel(ip1,j, 1,bi,bj)-uVel(ip1,j, k,bi,bj)) * |
607 |
$ (uVel(ip1,j, 1,bi,bj)-uVel(ip1,j, k,bi,bj)) + |
608 |
$ (vVel(i, j, 1,bi,bj)-vVel(i, j, k,bi,bj)) * |
609 |
$ (vVel(i, j, 1,bi,bj)-vVel(i, j, k,bi,bj)) + |
610 |
$ (vVel(i, jp1,1,bi,bj)-vVel(i, jp1,k,bi,bj)) * |
611 |
$ (vVel(i, jp1,1,bi,bj)-vVel(i, jp1,k,bi,bj)) ) |
612 |
#ifdef KPP_SMOOTH_DVSQ |
613 |
dVsq(i,j,k) = p5 * dVsq(i,j,k) + p125 * ( |
614 |
$ (uVel(i, jm1,1,bi,bj)-uVel(i, jm1,k,bi,bj)) * |
615 |
$ (uVel(i, jm1,1,bi,bj)-uVel(i, jm1,k,bi,bj)) + |
616 |
$ (uVel(ip1,jm1,1,bi,bj)-uVel(ip1,jm1,k,bi,bj)) * |
617 |
$ (uVel(ip1,jm1,1,bi,bj)-uVel(ip1,jm1,k,bi,bj)) + |
618 |
$ (uVel(i, jp1,1,bi,bj)-uVel(i, jp1,k,bi,bj)) * |
619 |
$ (uVel(i, jp1,1,bi,bj)-uVel(i, jp1,k,bi,bj)) + |
620 |
$ (uVel(ip1,jp1,1,bi,bj)-uVel(ip1,jp1,k,bi,bj)) * |
621 |
$ (uVel(ip1,jp1,1,bi,bj)-uVel(ip1,jp1,k,bi,bj)) + |
622 |
$ (vVel(im1,j, 1,bi,bj)-vVel(im1,j, k,bi,bj)) * |
623 |
$ (vVel(im1,j, 1,bi,bj)-vVel(im1,j, k,bi,bj)) + |
624 |
$ (vVel(im1,jp1,1,bi,bj)-vVel(im1,jp1,k,bi,bj)) * |
625 |
$ (vVel(im1,jp1,1,bi,bj)-vVel(im1,jp1,k,bi,bj)) + |
626 |
$ (vVel(ip1,j, 1,bi,bj)-vVel(ip1,j, k,bi,bj)) * |
627 |
$ (vVel(ip1,j, 1,bi,bj)-vVel(ip1,j, k,bi,bj)) + |
628 |
$ (vVel(ip1,jp1,1,bi,bj)-vVel(ip1,jp1,k,bi,bj)) * |
629 |
$ (vVel(ip1,jp1,1,bi,bj)-vVel(ip1,jp1,k,bi,bj)) ) |
630 |
#endif /* KPP_SMOOTH_DVSQ */ |
631 |
END DO |
632 |
END DO |
633 |
END DO |
634 |
|
635 |
#endif /* KPP_ESTIMATE_UREF */ |
636 |
|
637 |
c shsq computation |
638 |
DO k = 1, Nrm1 |
639 |
kp1 = k + 1 |
640 |
#ifdef FRUGAL_KPP |
641 |
DO j = 1, sNy |
642 |
jm1 = j - 1 |
643 |
jp1 = j + 1 |
644 |
DO i = 1, sNx |
645 |
#else |
646 |
DO j = jmin, jmax |
647 |
jm1 = j - 1 |
648 |
jp1 = j + 1 |
649 |
DO i = imin, imax |
650 |
#endif /* FRUGAL_KPP */ |
651 |
im1 = i - 1 |
652 |
ip1 = i + 1 |
653 |
shsq(i,j,k) = p5 * ( |
654 |
$ (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) * |
655 |
$ (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) + |
656 |
$ (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) * |
657 |
$ (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) + |
658 |
$ (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) * |
659 |
$ (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) + |
660 |
$ (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) * |
661 |
$ (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) ) |
662 |
#ifdef KPP_SMOOTH_SHSQ |
663 |
shsq(i,j,k) = p5 * shsq(i,j,k) + p125 * ( |
664 |
$ (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) * |
665 |
$ (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) + |
666 |
$ (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) * |
667 |
$ (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) + |
668 |
$ (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) * |
669 |
$ (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) + |
670 |
$ (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) * |
671 |
$ (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) + |
672 |
$ (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) * |
673 |
$ (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) + |
674 |
$ (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) * |
675 |
$ (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) + |
676 |
$ (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) * |
677 |
$ (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) + |
678 |
$ (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) * |
679 |
$ (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) ) |
680 |
#endif |
681 |
END DO |
682 |
END DO |
683 |
END DO |
684 |
|
685 |
c shsq @ Nr computation |
686 |
#ifdef FRUGAL_KPP |
687 |
DO j = 1, sNy |
688 |
DO i = 1, sNx |
689 |
#else |
690 |
DO j = jmin, jmax |
691 |
DO i = imin, imax |
692 |
#endif |
693 |
shsq(i,j,Nr) = p0 |
694 |
END DO |
695 |
END DO |
696 |
|
697 |
#ifndef FRUGAL_KPP |
698 |
c set array edges to zero |
699 |
DO k = 1, Nr |
700 |
DO j = jmin, jmax |
701 |
DO i = 1-OLx, imin-1 |
702 |
shsq(i,j,k) = p0 |
703 |
dVsq(i,j,k) = p0 |
704 |
END DO |
705 |
DO i = imax+1, sNx+OLx |
706 |
shsq(i,j,k) = p0 |
707 |
dVsq(i,j,k) = p0 |
708 |
END DO |
709 |
END DO |
710 |
DO i = 1-OLx, sNx+OLx |
711 |
DO j = 1-OLy, jmin-1 |
712 |
shsq(i,j,k) = p0 |
713 |
dVsq(i,j,k) = p0 |
714 |
END DO |
715 |
DO j = jmax+1, sNy+OLy |
716 |
shsq(i,j,k) = p0 |
717 |
dVsq(i,j,k) = p0 |
718 |
END DO |
719 |
END DO |
720 |
END DO |
721 |
#endif |
722 |
|
723 |
c----------------------------------------------------------------------- |
724 |
c solve for viscosity, diffusivity, ghat, and hbl on "t-grid" |
725 |
c----------------------------------------------------------------------- |
726 |
|
727 |
#ifdef FRUGAL_KPP |
728 |
DO j = 1, sNy |
729 |
DO i = 1, sNx |
730 |
#else |
731 |
DO j = 1-OLy, sNy+OLy |
732 |
DO i = 1-OLx, sNx+OLx |
733 |
#endif |
734 |
work1(i,j) = nzmax(i,j,bi,bj) |
735 |
work2(i,j) = Fcori(i,j,bi,bj) |
736 |
END DO |
737 |
END DO |
738 |
CALL TIMER_START('KPPMIX [KPP_CALC]', myThid) |
739 |
CALL KPPMIX ( |
740 |
I lri, work1, shsq, dVsq, ustar |
741 |
I , bo, bosol, dbloc, Ritop, work2 |
742 |
I , ikey |
743 |
O , vddiff |
744 |
U , ghat |
745 |
O , hbl |
746 |
& ) |
747 |
|
748 |
CALL TIMER_STOP ('KPPMIX [KPP_CALC]', myThid) |
749 |
|
750 |
IF (KPPmixingMaps) THEN |
751 |
#ifdef FRUGAL_KPP |
752 |
CALL PRINT_MAPRS( |
753 |
I hbl, 'hbl', PRINT_MAP_XY, |
754 |
I 1, sNx, 1, sNy, 1, 1, 1, 1, |
755 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
756 |
#else |
757 |
CALL PRINT_MAPRS( |
758 |
I hbl, 'hbl', PRINT_MAP_XY, |
759 |
I 1-OLx, sNx+OLx, 1-OLy, sNy+OLy, 1, 1, 1, 1, |
760 |
I 1, sNx, 1, sNy, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ) |
761 |
#endif |
762 |
ENDIF |
763 |
|
764 |
CADJ STORE vddiff, ghat = uvtape, key = ikey |
765 |
|
766 |
c----------------------------------------------------------------------- |
767 |
c zero out land values, |
768 |
c make sure coefficients are within reasonable bounds, |
769 |
c and transfer to global variables |
770 |
c----------------------------------------------------------------------- |
771 |
|
772 |
#ifdef FRUGAL_KPP |
773 |
DO j = 1, sNy |
774 |
DO i = 1, sNx |
775 |
#else |
776 |
DO j = jmin, jmax |
777 |
DO i = imin, imax |
778 |
#endif |
779 |
DO k = 1, Nr |
780 |
c KPPviscAz |
781 |
tempVar = min( maxKPPviscAz(k), vddiff(i,j,k-1,1) ) |
782 |
tempVar = max( minKPPviscAz, tempVar ) |
783 |
KPPviscAz(i,j,k,bi,bj) = tempVar*pMask(i,j,k,bi,bj) |
784 |
c KPPdiffKzS |
785 |
tempVar = min( maxKPPdiffKzS, vddiff(i,j,k-1,2) ) |
786 |
tempVar = max( minKPPdiffKzS, tempVar ) |
787 |
KPPdiffKzS(i,j,k,bi,bj) = tempVar*pMask(i,j,k,bi,bj) |
788 |
c KPPdiffKzT |
789 |
tempVar = min( maxKPPdiffKzT, vddiff(i,j,k-1,3) ) |
790 |
tempVar = max( minKPPdiffKzT, tempVar ) |
791 |
KPPdiffKzT(i,j,k,bi,bj) = tempVar*pMask(i,j,k,bi,bj) |
792 |
c KPPghat |
793 |
tempVar = min( maxKPPghat, ghat(i,j,k) ) |
794 |
tempVar = max( minKPPghat, tempVar ) |
795 |
KPPghat(i,j,k,bi,bj) = tempVar*pMask(i,j,k,bi,bj) |
796 |
END DO |
797 |
c KPPhbl: set to -zgrid(1) over land |
798 |
KPPhbl(i,j,bi,bj) = (hbl(i,j) + zgrid(1)) |
799 |
& * pMask(i,j,1,bi,bj) - |
800 |
& zgrid(1) |
801 |
END DO |
802 |
END DO |
803 |
#ifdef FRUGAL_KPP |
804 |
_EXCH_XYZ_R8(KPPviscAz , myThid ) |
805 |
_EXCH_XYZ_R8(KPPdiffKzS , myThid ) |
806 |
_EXCH_XYZ_R8(KPPdiffKzT , myThid ) |
807 |
_EXCH_XYZ_R8(KPPghat , myThid ) |
808 |
_EXCH_XY_R8 (KPPhbl , myThid ) |
809 |
#endif |
810 |
|
811 |
#ifdef KPP_SMOOTH_VISC |
812 |
c horizontal smoothing of vertical viscosity |
813 |
c as coded requires FRUGAL_KPP and OLx=4, OLy=4 |
814 |
c alternatively could recode with OLx=5, OLy=5 |
815 |
|
816 |
DO k = 1, Nr |
817 |
CALL SMOOTH_HORIZ_RL ( |
818 |
I k, bi, bj, |
819 |
I KPPviscAz(1-OLx,1-OLy,k,bi,bj), |
820 |
O KPPviscAz(1-OLx,1-OLy,k,bi,bj) ) |
821 |
END DO |
822 |
#endif /* KPP_SMOOTH_VISC */ |
823 |
|
824 |
#ifdef KPP_SMOOTH_DIFF |
825 |
c horizontal smoothing of vertical diffusivity |
826 |
c as coded requires FRUGAL_KPP and OLx=4, OLy=4 |
827 |
c alternatively could recode with OLx=5, OLy=5 |
828 |
|
829 |
DO k = 1, Nr |
830 |
CALL SMOOTH_HORIZ_RL ( |
831 |
I k, bi, bj, |
832 |
I KPPdiffKzS(1-OLx,1-OLy,k,bi,bj), |
833 |
O KPPdiffKzS(1-OLx,1-OLy,k,bi,bj) ) |
834 |
CALL SMOOTH_HORIZ_RL ( |
835 |
I k, bi, bj, |
836 |
I KPPdiffKzT(1-OLx,1-OLy,k,bi,bj), |
837 |
O KPPdiffKzT(1-OLx,1-OLy,k,bi,bj) ) |
838 |
END DO |
839 |
#endif /* KPP_SMOOTH_DIFF */ |
840 |
|
841 |
|
842 |
C Compute fraction of solar short-wave flux penetrating to |
843 |
C the bottom of the mixing layer. |
844 |
DO j=1-OLy,sNy+OLy |
845 |
DO i=1-OLx,sNx+OLx |
846 |
worka(i,j) = KPPhbl(i,j,bi,bj) |
847 |
ENDDO |
848 |
ENDDO |
849 |
CALL SWFRAC( |
850 |
I (sNx+2*OLx)*(sNy+2*OLy), -1., worka, |
851 |
O workb ) |
852 |
DO j=1-OLy,sNy+OLy |
853 |
DO i=1-OLx,sNx+OLx |
854 |
KPPfrac(i,j,bi,bj) = workb(i,j) |
855 |
ENDDO |
856 |
ENDDO |
857 |
|
858 |
CADJ STORE KPPhbl (:,: ,bi,bj) = uvtape, key = ikey, byte = isbyte |
859 |
CADJ STORE KPPghat (:,:,:,bi,bj) = uvtape, key = ikey, byte = isbyte |
860 |
CADJ STORE KPPviscAz (:,:,:,bi,bj) = uvtape, key = ikey, byte = isbyte |
861 |
CADJ STORE KPPdiffKzT(:,:,:,bi,bj) = uvtape, key = ikey, byte = isbyte |
862 |
CADJ STORE KPPdiffKzS(:,:,:,bi,bj) = uvtape, key = ikey, byte = isbyte |
863 |
|
864 |
ENDIF |
865 |
ENDIF |
866 |
|
867 |
#endif ALLOW_KPP |
868 |
|
869 |
RETURN |
870 |
END |