1 |
jmc |
1.8 |
C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_calc_diff.F,v 1.7 2003/01/10 00:48:39 heimbach Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
|
|
#include "GMREDI_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE GMREDI_CALC_DIFF( |
7 |
jmc |
1.8 |
I bi,bj,iMin,iMax,jMin,jMax,kArg,kSize, |
8 |
|
|
U KappaRx, |
9 |
adcroft |
1.1 |
I myThid) |
10 |
|
|
|
11 |
|
|
C /==========================================================\ |
12 |
|
|
C | SUBROUTINE GMREDI_CALC_DIFF | |
13 |
jmc |
1.8 |
C | o Add contribution to net diffusivity from GM/Redi | |
14 |
adcroft |
1.1 |
C \==========================================================/ |
15 |
|
|
IMPLICIT NONE |
16 |
|
|
|
17 |
|
|
C == GLobal variables == |
18 |
|
|
#include "SIZE.h" |
19 |
|
|
#include "EEPARAMS.h" |
20 |
|
|
#include "PARAMS.h" |
21 |
|
|
#include "GRID.h" |
22 |
jmc |
1.8 |
#ifdef ALLOW_GMREDI |
23 |
|
|
#include "GMREDI.h" |
24 |
|
|
#endif |
25 |
adcroft |
1.1 |
|
26 |
|
|
C == Routine arguments == |
27 |
jmc |
1.8 |
C bi, bj, :: tile indices |
28 |
|
|
C iMin,iMax :: Range of points for which calculation is done |
29 |
|
|
C jMin,jMax :: Range of points for which calculation is done |
30 |
|
|
C kArg :: = 0 -> do the k-loop here and treat all levels |
31 |
|
|
C > 0 -> k-loop is done outside and treat only level k=kArg |
32 |
|
|
C kSize :: 3rd Dimension of the vertical diffusivity array KappaRx |
33 |
|
|
C KappaRx :: vertical diffusivity array |
34 |
|
|
C myThid :: Instance number for this innvocation of GMREDI_CALC_DIFF |
35 |
adcroft |
1.1 |
C |
36 |
jmc |
1.8 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,kArg,kSize |
37 |
|
|
_RL KappaRx(1-Olx:sNx+Olx,1-Oly:sNy+Oly,kSize) |
38 |
adcroft |
1.1 |
INTEGER myThid |
39 |
|
|
|
40 |
|
|
#ifdef ALLOW_GMREDI |
41 |
|
|
|
42 |
|
|
C == Local variables == |
43 |
jmc |
1.8 |
C i,j,k :: Loop counters |
44 |
|
|
INTEGER i,j,k |
45 |
adcroft |
1.1 |
|
46 |
jmc |
1.8 |
C-- Add Vertical diffusivity contribution from GM/Redi |
47 |
|
|
IF ( kArg .EQ. 0 ) THEN |
48 |
|
|
C- do all levels : |
49 |
|
|
DO k=1,MIN(Nr,kSize) |
50 |
|
|
DO j=jMin,jMax |
51 |
|
|
DO i=iMin,iMax |
52 |
|
|
KappaRx(i,j,k) = KappaRx(i,j,k)+Kwz(i,j,k,bi,bj) |
53 |
|
|
ENDDO |
54 |
|
|
ENDDO |
55 |
|
|
ENDDO |
56 |
|
|
ELSE |
57 |
|
|
C- do level k=kArg only : |
58 |
|
|
k = MIN(kArg,kSize) |
59 |
|
|
DO j=jMin,jMax |
60 |
|
|
DO i=iMin,iMax |
61 |
|
|
KappaRx(i,j,k) = KappaRx(i,j,k)+Kwz(i,j,kArg,bi,bj) |
62 |
|
|
ENDDO |
63 |
|
|
ENDDO |
64 |
|
|
ENDIF |
65 |
adcroft |
1.1 |
|
66 |
|
|
#endif /* ALLOW_GMREDI */ |
67 |
|
|
|
68 |
|
|
RETURN |
69 |
|
|
END |