103 |
_RL c3d(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL c3d(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
104 |
INTEGER errCode |
INTEGER errCode |
105 |
#ifdef ALLOW_GGL90_HORIZDIFF |
#ifdef ALLOW_GGL90_HORIZDIFF |
106 |
|
C hFac :: fractional thickness of W-cell |
107 |
C xA, yA :: area of lateral faces |
C xA, yA :: area of lateral faces |
108 |
C dfx, dfy :: diffusive flux across lateral faces |
C dfx, dfy :: diffusive flux across lateral faces |
109 |
C gTKE :: right hand side of diffusion equation |
C gTKE :: right hand side of diffusion equation |
110 |
|
_RL hFac |
111 |
_RL xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
112 |
_RL yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
113 |
_RL dfx(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dfx(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
335 |
km1 = k-1 |
km1 = k-1 |
336 |
|
|
337 |
#ifdef ALLOW_GGL90_HORIZDIFF |
#ifdef ALLOW_GGL90_HORIZDIFF |
338 |
IF ( GGL90diffTKEh .GT. 0. _d 0 ) THEN |
IF ( GGL90diffTKEh .GT. 0. _d 0 ) THEN |
339 |
C horizontal diffusion of TKE (requires an exchange in |
C horizontal diffusion of TKE (requires an exchange in |
340 |
C do_fields_blocking_exchanges) |
C do_fields_blocking_exchanges) |
341 |
C common factors |
C common factors |
342 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
343 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
344 |
xA(i,j) = _dyG(i,j,bi,bj) |
xA(i,j) = _dyG(i,j,bi,bj)*drC(k)* |
345 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
& (min(.5 _d 0,_hFacW(i,j,k-1,bi,bj) ) + |
346 |
yA(i,j) = _dxG(i,j,bi,bj) |
& min(.5 _d 0,_hFacW(i,j,k ,bi,bj) ) ) |
347 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
yA(i,j) = _dxG(i,j,bi,bj)*drC(k)* |
348 |
|
& (min(.5 _d 0,_hFacS(i,j,k-1,bi,bj) ) + |
349 |
|
& min(.5 _d 0,_hFacS(i,j,k ,bi,bj) ) ) |
350 |
ENDDO |
ENDDO |
351 |
ENDDO |
ENDDO |
352 |
C Compute diffusive fluxes |
C Compute diffusive fluxes |
357 |
dfx(i,j) = -GGL90diffTKEh*xA(i,j) |
dfx(i,j) = -GGL90diffTKEh*xA(i,j) |
358 |
& *_recip_dxC(i,j,bi,bj) |
& *_recip_dxC(i,j,bi,bj) |
359 |
& *(GGL90TKE(i,j,k,bi,bj)-GGL90TKE(i-1,j,k,bi,bj)) |
& *(GGL90TKE(i,j,k,bi,bj)-GGL90TKE(i-1,j,k,bi,bj)) |
360 |
|
#ifdef ISOTROPIC_COS_SCALING |
361 |
& *CosFacU(j,bi,bj) |
& *CosFacU(j,bi,bj) |
362 |
|
#endif /* ISOTROPIC_COS_SCALING */ |
363 |
|
& *maskW(i,j,k,bi,bj) ! paranoia setting |
364 |
ENDDO |
ENDDO |
365 |
ENDDO |
ENDDO |
366 |
C ... across y-faces |
C ... across y-faces |
375 |
#ifdef ISOTROPIC_COS_SCALING |
#ifdef ISOTROPIC_COS_SCALING |
376 |
& *CosFacV(j,bi,bj) |
& *CosFacV(j,bi,bj) |
377 |
#endif /* ISOTROPIC_COS_SCALING */ |
#endif /* ISOTROPIC_COS_SCALING */ |
378 |
|
& *maskS(i,j,k,bi,bj) ! paranoia setting |
379 |
ENDDO |
ENDDO |
380 |
ENDDO |
ENDDO |
381 |
C Compute divergence of fluxes |
C Compute divergence of fluxes |
382 |
DO j=1-OLy,sNy+OLy-1 |
DO j=1-OLy,sNy+OLy-1 |
383 |
DO i=1-OLx,sNx+OLx-1 |
DO i=1-OLx,sNx+OLx-1 |
384 |
gTKE(i,j) = |
hFac = min(.5 _d 0,_hFacC(i,j,k-1,bi,bj) ) + |
385 |
& -_recip_hFacC(i,j,k,bi,bj)*recip_drF(k)*recip_rA(i,j,bi,bj) |
& min(.5 _d 0,_hFacC(i,j,k ,bi,bj) ) |
386 |
& *( (dfx(i+1,j)-dfx(i,j)) |
gTKE(i,j) = 0.0 |
387 |
& +(dfy(i,j+1)-dfy(i,j)) |
if ( hFac .ne. 0.0 ) |
388 |
& ) |
& gTKE(i,j) = -recip_drC(k)*recip_rA(i,j,bi,bj)/hFac |
389 |
|
& *((dfx(i+1,j)-dfx(i,j)) |
390 |
|
& +(dfy(i,j+1)-dfy(i,j)) ) |
391 |
|
& *maskC(i,j,k,bi,bj) ! paranoia setting |
392 |
ENDDO |
ENDDO |
393 |
ENDDO |
ENDDO |
394 |
C end if GGL90diffTKEh .eq. 0. |
C end if GGL90diffTKEh .eq. 0. |