1 |
C $Header: /u/gcmpack/MITgcm/pkg/kpp/kpp_transport_ptr.F,v 1.13 2010/03/16 00:14:47 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "KPP_OPTIONS.h" |
5 |
#ifdef ALLOW_GMREDI |
6 |
#include "GMREDI_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
SUBROUTINE KPP_TRANSPORT_PTR ( |
10 |
I iMin,iMax,jMin,jMax,bi,bj,k,km1, |
11 |
I tracerIdentity, |
12 |
O df, |
13 |
I myTime, myIter, myThid ) |
14 |
C *==========================================================* |
15 |
C | o SUBROUTINE KPP_TRANSPORT_PTR |
16 |
C | Add non local KPP transport term (ghat) to diffusive |
17 |
C | passive tracer flux. |
18 |
C *==========================================================* |
19 |
C | The nonlocal transport term is nonzero only for scalars |
20 |
C | in unstable (convective) forcing conditions. |
21 |
C | Note: We do not have a specific KPP diffusion for a |
22 |
C | passive tracer; use Salinity diffusion instead |
23 |
C | Note: KPPdiffKzS(-,k) is defined at the top of grid cell |
24 |
C | k while KPPghat(i,j,k,bi,bj) is defined at the |
25 |
C | bottom of grid cell k. |
26 |
C | For K=1, KPPdiffKzS(-,k) = 0 which insures no flux |
27 |
C | through the surface. |
28 |
C *==========================================================* |
29 |
IMPLICIT NONE |
30 |
|
31 |
C == GLobal variables == |
32 |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
34 |
#include "PARAMS.h" |
35 |
#include "GRID.h" |
36 |
#include "FFIELDS.h" |
37 |
#include "KPP.h" |
38 |
#include "KPP_PARAMS.h" |
39 |
#ifdef ALLOW_PTRACERS |
40 |
#include "PTRACERS_SIZE.h" |
41 |
c#include "PTRACERS_PARAMS.h" |
42 |
#include "PTRACERS_FIELDS.h" |
43 |
#endif |
44 |
#ifdef ALLOW_GMREDI |
45 |
#include "GMREDI.h" |
46 |
#endif |
47 |
#ifdef ALLOW_LONGSTEP |
48 |
#include "LONGSTEP.h" |
49 |
#endif |
50 |
|
51 |
|
52 |
C == Routine arguments == |
53 |
C iMin,iMax,jMin, - Range of points for which calculation |
54 |
C jMax,bi,bj,k,km1 results will be set. |
55 |
C tracerIdentity - Identifier for the tracer |
56 |
C df - Diffusive flux component work array. |
57 |
C myTime :: Current time in simulation |
58 |
C myIter :: Current iteration number in simulation |
59 |
C myThid :: My Thread Id. number |
60 |
INTEGER iMin,iMax,jMin,jMax,bi,bj,k,km1,tracerIdentity |
61 |
_RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
62 |
_RL myTime |
63 |
INTEGER myIter |
64 |
INTEGER myThid |
65 |
|
66 |
#if defined(ALLOW_KPP) && defined(KPP_GHAT) && defined(ALLOW_PTRACERS) |
67 |
|
68 |
C == Local variables == |
69 |
C i, j :: Loop counters |
70 |
INTEGER i, j |
71 |
_RL tmpFac |
72 |
|
73 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
74 |
|
75 |
IF (useOffLine) THEN |
76 |
|
77 |
C-- Note: in this case (offline) KPPghat array already contains |
78 |
C the product ghat*diffKzS which has been loaded from file |
79 |
DO j=jMin,jMax |
80 |
DO i=iMin,iMax |
81 |
df(i,j) = - _rA(i,j,bi,bj) |
82 |
& *KPPghat(i,j,k,bi,bj) |
83 |
& *surfaceForcingPTr(i,j,bi,bj,tracerIdentity) |
84 |
ENDDO |
85 |
ENDDO |
86 |
|
87 |
ELSE |
88 |
|
89 |
IF ( useGMRedi .AND. KPP_ghatUseTotalDiffus ) THEN |
90 |
tmpFac = 1. _d 0 |
91 |
ELSE |
92 |
tmpFac = 0. _d 0 |
93 |
ENDIF |
94 |
DO j=jMin,jMax |
95 |
DO i=iMin,iMax |
96 |
df(i,j) = - _rA(i,j,bi,bj) |
97 |
#ifdef ALLOW_LONGSTEP |
98 |
& *( LS_KPPdiffKzS(i,j,k,bi,bj) |
99 |
#ifdef ALLOW_GMREDI |
100 |
& + tmpFac*LS_Kwz(i,j,k,bi,bj) |
101 |
#endif |
102 |
& )*LS_KPPghat(i,j,km1,bi,bj) |
103 |
#else /* ALLOW_LONGSTEP */ |
104 |
& *( KPPdiffKzS(i,j,k,bi,bj) |
105 |
#ifdef ALLOW_GMREDI |
106 |
& + tmpFac*Kwz(i,j,k,bi,bj) |
107 |
#endif |
108 |
& )*KPPghat(i,j,km1,bi,bj) |
109 |
#endif /* ALLOW_LONGSTEP */ |
110 |
& *surfaceForcingPTr(i,j,bi,bj,tracerIdentity) |
111 |
ENDDO |
112 |
ENDDO |
113 |
|
114 |
ENDIF |
115 |
|
116 |
#endif /* ALLOW_KPP and KPP_GHAT and PTRACERS */ |
117 |
|
118 |
RETURN |
119 |
END |