1 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/gmredi/gmredi_rtransport.F,v 1.1 2000/06/21 19:42:54 adcroft Exp $ |
2 |
|
3 |
#include "GMREDI_OPTIONS.h" |
4 |
|
5 |
subroutine GMREDI_RTRANSPORT( |
6 |
I iMin,iMax,jMin,jMax,bi,bj,K, |
7 |
I maskUp,Tracer, |
8 |
U df, |
9 |
I myThid) |
10 |
C /==========================================================\ |
11 |
C | o SUBROUTINE GMREDI_RTRANSPORT | |
12 |
C | Add vertical transport terms from GM/Redi | |
13 |
C | parameterization. | |
14 |
C |==========================================================| |
15 |
C \==========================================================/ |
16 |
IMPLICIT NONE |
17 |
|
18 |
C == GLobal variables == |
19 |
#include "SIZE.h" |
20 |
#include "EEPARAMS.h" |
21 |
#include "PARAMS.h" |
22 |
#include "GRID.h" |
23 |
#include "GMREDI.h" |
24 |
|
25 |
C == Routine arguments == |
26 |
C iMin,iMax,jMin, - Range of points for which calculation |
27 |
C jMax,bi,bj,k results will be set. |
28 |
C xA - Area of X face |
29 |
C Tracer - 3D Tracer field |
30 |
C df - Diffusive flux component work array. |
31 |
INTEGER iMin,iMax,jMin,jMax,bi,bj,k |
32 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
33 |
_RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
34 |
_RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
35 |
INTEGER myThid |
36 |
|
37 |
#ifdef ALLOW_GMREDI |
38 |
|
39 |
C == Local variables == |
40 |
C I, J - Loop counters |
41 |
INTEGER I, J |
42 |
_RL dTdx,dTdy |
43 |
|
44 |
C Surface flux is zero |
45 |
IF (useGMRedi .AND. K.GT.1) THEN |
46 |
|
47 |
DO j=jMin,jMax |
48 |
DO i=iMin,iMax |
49 |
|
50 |
C- Horizontal gradients interpolated to W points |
51 |
dTdx = 0.5*( |
52 |
& +0.5*(_maskW(i+1,j,k,bi,bj) |
53 |
& *_recip_dxC(i+1,j,bi,bj)* |
54 |
& (Tracer(i+1,j,k,bi,bj)-Tracer(i,j,k,bi,bj)) |
55 |
& +_maskW(i,j,k,bi,bj) |
56 |
& *_recip_dxC(i,j,bi,bj)* |
57 |
& (Tracer(i,j,k,bi,bj)-Tracer(i-1,j,k,bi,bj))) |
58 |
& +0.5*(_maskW(i+1,j,k-1,bi,bj) |
59 |
& *_recip_dxC(i+1,j,bi,bj)* |
60 |
& (Tracer(i+1,j,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj)) |
61 |
& +_maskW(i,j,k-1,bi,bj) |
62 |
& *_recip_dxC(i,j,bi,bj)* |
63 |
& (Tracer(i,j,k-1,bi,bj)-Tracer(i-1,j,k-1,bi,bj))) |
64 |
& ) |
65 |
|
66 |
dTdy = 0.5*( |
67 |
& +0.5*(_maskS(i,j,k,bi,bj) |
68 |
& *_recip_dyC(i,j,bi,bj)* |
69 |
& (Tracer(i,j,k,bi,bj)-Tracer(i,j-1,k,bi,bj)) |
70 |
& +_maskS(i,j+1,k,bi,bj) |
71 |
& *_recip_dyC(i,j+1,bi,bj)* |
72 |
& (Tracer(i,j+1,k,bi,bj)-Tracer(i,j,k,bi,bj))) |
73 |
& +0.5*(_maskS(i,j,k-1,bi,bj) |
74 |
& *_recip_dyC(i,j,bi,bj)* |
75 |
& (Tracer(i,j,k-1,bi,bj)-Tracer(i,j-1,k-1,bi,bj)) |
76 |
& +_maskS(i,j+1,k-1,bi,bj) |
77 |
& *_recip_dyC(i,j+1,bi,bj)* |
78 |
& (Tracer(i,j+1,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj))) |
79 |
& ) |
80 |
|
81 |
C- Off-diagonal components of vertical flux |
82 |
df(i,j) = df(i,j) |
83 |
& - _rA(i,j,bi,bj) |
84 |
& *(GM_background_K |
85 |
#ifdef GM_VISBECK_VARIABLE_K |
86 |
& +VisbeckK(i,j,myThid) |
87 |
#endif |
88 |
& )*( Kwx(i,j,k,myThid)*dTdx +Kwy(i,j,k,myThid)*dTdy ) |
89 |
|
90 |
ENDDO |
91 |
ENDDO |
92 |
|
93 |
c IF (.NOT.implicitDiffusion) THEN |
94 |
c |
95 |
c This vertical diffusion term is currently implemented |
96 |
c by adding the VisbeckK*Kwz diffusivity to KappaRT/S |
97 |
c See calc_diffusivity.F and calc_gt.F (calc_gs.F) |
98 |
c |
99 |
c DO j=jMin,jMax |
100 |
c DO i=iMin,iMax |
101 |
c df(i,j) = df(i,j) - _rA(i,j,bi,bj) |
102 |
c & *maskUp(i,j)*VisbeckK(i,j,myThid)*Kwz(i,j,k,myThid) |
103 |
c & *recip_drC(k)*rkfac |
104 |
c & *(Tracer(i,j,k-1,bi,bj)-Tracer(i,j,k,bi,bj)) |
105 |
c ENDDO |
106 |
c ENDDO |
107 |
c ENDIF |
108 |
|
109 |
ENDIF |
110 |
#endif /* ALLOW_GMREDI */ |
111 |
|
112 |
RETURN |
113 |
END |