1 |
jmc |
1.3 |
C $Header: /u/gcmpack/MITgcm/pkg/pp81/pp81_calc_diff.F,v 1.2 2004/10/17 23:12:59 jmc Exp $ |
2 |
mlosch |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PP81_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE PP81_CALC_DIFF( |
7 |
jmc |
1.3 |
I bi,bj,iMin,iMax,jMin,jMax,kArg,kSize, |
8 |
|
|
U KappaRx, |
9 |
mlosch |
1.1 |
I myThid) |
10 |
|
|
|
11 |
|
|
C /==========================================================\ |
12 |
|
|
C | SUBROUTINE PP81_CALC_DIFF | |
13 |
|
|
C | o Add contrubution to net diffusivity from PP81 mixing | |
14 |
|
|
C \==========================================================/ |
15 |
|
|
IMPLICIT NONE |
16 |
|
|
|
17 |
|
|
C == GLobal variables == |
18 |
|
|
#include "SIZE.h" |
19 |
|
|
#include "EEPARAMS.h" |
20 |
|
|
#include "PARAMS.h" |
21 |
|
|
#include "DYNVARS.h" |
22 |
|
|
#include "GRID.h" |
23 |
jmc |
1.3 |
#ifdef ALLOW_PP81 |
24 |
|
|
#include "PP81.h" |
25 |
|
|
#endif |
26 |
mlosch |
1.1 |
|
27 |
|
|
C == Routine arguments == |
28 |
jmc |
1.3 |
C bi, bj, :: tile indices |
29 |
|
|
C iMin,iMax :: Range of points for which calculation is done |
30 |
|
|
C jMin,jMax :: Range of points for which calculation is done |
31 |
|
|
C kArg :: = 0 -> do the k-loop here and treat all levels |
32 |
|
|
C > 0 -> k-loop is done outside and treat only level k=kArg |
33 |
|
|
C kSize :: 3rd Dimension of the vertical diffusivity array KappaRx |
34 |
|
|
C KappaRx :: vertical diffusivity array |
35 |
|
|
C myThid :: Instance number for this innvocation of PP81_CALC_DIFF |
36 |
|
|
|
37 |
|
|
INTEGER bi,bj,iMin,iMax,jMin,jMax,kArg,kSize |
38 |
|
|
_RL KappaRx(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
39 |
mlosch |
1.1 |
INTEGER myThid |
40 |
|
|
|
41 |
|
|
#ifdef ALLOW_PP81 |
42 |
|
|
|
43 |
|
|
C == Local variables == |
44 |
jmc |
1.3 |
C i,j,k :: Loop counters |
45 |
|
|
INTEGER i,j,k |
46 |
mlosch |
1.1 |
|
47 |
jmc |
1.3 |
C-- Add Vertical diffusivity contribution from PP81 |
48 |
|
|
IF ( kArg .EQ. 0 ) THEN |
49 |
|
|
C- do all levels : |
50 |
|
|
DO k=1,MIN(Nr,kSize) |
51 |
|
|
DO j=jMin,jMax |
52 |
|
|
DO i=iMin,iMax |
53 |
|
|
KappaRx(i,j,k) = KappaRx(i,j,k) |
54 |
|
|
& +( PPdiffKr(i,j,k,bi,bj) |
55 |
mlosch |
1.1 |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_DIFFKR_CONTROL)) |
56 |
|
|
& - diffKr(i,j,k,bi,bj) ) |
57 |
|
|
#else |
58 |
jmc |
1.2 |
& - diffKrNrT(k) ) |
59 |
mlosch |
1.1 |
#endif |
60 |
jmc |
1.3 |
ENDDO |
61 |
|
|
ENDDO |
62 |
|
|
ENDDO |
63 |
|
|
ELSE |
64 |
|
|
C- do level k=kArg only : |
65 |
|
|
k = MIN(kArg,kSize) |
66 |
|
|
DO j=jMin,jMax |
67 |
|
|
DO i=iMin,iMax |
68 |
|
|
KappaRx(i,j,k) = KappaRx(i,j,k) |
69 |
|
|
& +( PPdiffKr(i,j,kArg,bi,bj) |
70 |
mlosch |
1.1 |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_DIFFKR_CONTROL)) |
71 |
jmc |
1.3 |
& - diffKr(i,j,kArg,bi,bj) ) |
72 |
mlosch |
1.1 |
#else |
73 |
jmc |
1.3 |
& - diffKrNrT(kArg) ) |
74 |
mlosch |
1.1 |
#endif |
75 |
jmc |
1.3 |
ENDDO |
76 |
|
|
ENDDO |
77 |
|
|
ENDIF |
78 |
mlosch |
1.1 |
|
79 |
|
|
#endif /* ALLOW_PP81 */ |
80 |
|
|
|
81 |
|
|
RETURN |
82 |
|
|
END |