forked from altMITgcm/MITgcm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kpp_transport_t.F
110 lines (96 loc) · 3.3 KB
/
kpp_transport_t.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
C $Header: /u/gcmpack/MITgcm/pkg/kpp/kpp_transport_t.F,v 1.20 2014/05/06 15:50:14 jmc Exp $
C $Name: $
#include "KPP_OPTIONS.h"
#ifdef ALLOW_GMREDI
#include "GMREDI_OPTIONS.h"
#endif
SUBROUTINE KPP_TRANSPORT_T (
I iMin,iMax,jMin,jMax,bi,bj,k,km1,
O df,
I myTime, myIter, myThid )
C *==========================================================*
C | o SUBROUTINE KPP_TRANSPORT_T
C | Add non local KPP transport term (ghat) to diffusive
C | temperature flux.
C *==========================================================*
C | The nonlocal transport term is nonzero only for scalars
C | in unstable (convective) forcing conditions.
C | Note: [surfaceForcingT + Qsw * (1-KPPfrac)]
C | is the total heat flux penetrating the mixed layer
C | from the surface in deg C / s referenced to the
C | top layer.
C | Note: KPPdiffKzT(-,k) is defined at the top of grid cell
C | k while KPPghat(i,j,k,bi,bj) is defined at the
C | bottom of grid cell k.
C | For K=1, KPPdiffKzT(-,k) = 0 which insures no flux
C | through the surface.
C *==========================================================*
IMPLICIT NONE
C == GLobal variables ==
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
#include "FFIELDS.h"
#include "KPP.h"
#include "KPP_PARAMS.h"
#ifdef ALLOW_GMREDI
#include "GMREDI.h"
#endif
C == Routine arguments ==
C iMin,iMax,jMin, :: Range of points for which calculation
C jMax,bi,bj,k,km1 results will be set.
C df :: Diffusive flux component work array.
C myTime :: Current time in simulation
C myIter :: Current iteration number in simulation
C myThid :: My Thread Id. number
INTEGER iMin,iMax,jMin,jMax,bi,bj,k,km1
_RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL myTime
INTEGER myIter
INTEGER myThid
#if defined(ALLOW_KPP) && defined(KPP_GHAT)
C == Local variables ==
C i, j :: Loop counters
INTEGER i, j
_RL recip_Cp
#ifdef ALLOW_GMREDI
_RL tmpFac
#endif
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
recip_Cp = 1. _d 0 / HeatCapacity_Cp
#ifdef ALLOW_GMREDI
IF ( useGMRedi .AND. KPP_ghatUseTotalDiffus ) THEN
tmpFac = 1. _d 0
ELSE
tmpFac = 0. _d 0
ENDIF
DO j=jMin,jMax
DO i=iMin,iMax
df(i,j) = - _rA(i,j,bi,bj)
& *( KPPdiffKzT(i,j,k,bi,bj) + tmpFac*Kwz(i,j,k,bi,bj) )
& *KPPghat(i,j,km1,bi,bj)
& *( surfaceForcingT(i,j,bi,bj)
& +surfaceForcingTice(i,j,bi,bj)
& -Qsw(i,j,bi,bj)*recip_Cp*recip_rhoConst
& *(1.-KPPfrac(i,j,bi,bj))
& )
ENDDO
ENDDO
#else /* ALLOW_GMREDI */
DO j=jMin,jMax
DO i=iMin,iMax
df(i,j) = - _rA(i,j,bi,bj)
& *KPPdiffKzT(i,j,k,bi,bj)
& *KPPghat(i,j,km1,bi,bj)
& *( surfaceForcingT(i,j,bi,bj)
& +surfaceForcingTice(i,j,bi,bj)
& -Qsw(i,j,bi,bj)*recip_Cp*recip_rhoConst
& *(1.-KPPfrac(i,j,bi,bj))
& )
ENDDO
ENDDO
#endif /* ALLOW_GMREDI */
#endif /* ALLOW_KPP and KPP_GHAT */
RETURN
END