forked from darwinproject/darwin3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gad_u3_adv_y.F
75 lines (66 loc) · 2.37 KB
/
gad_u3_adv_y.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
#include "GAD_OPTIONS.h"
CBOP
C !ROUTINE: GAD_U3_ADV_Y
C !INTERFACE: ==========================================================
SUBROUTINE GAD_U3_ADV_Y(
I bi,bj,k,
I vTrans, maskLocS,
I tracer,
O vT,
I myThid )
C !DESCRIPTION:
C Calculates the area integrated meridional flux due to advection of a tracer
C using upwind biased third-order interpolation (or the $\kappa=1/3$ scheme):
C \begin{equation*}
C F^y_{adv} = V \overline{ \theta - \frac{1}{6} \delta_{jj} \theta }^j
C + \frac{1}{12} |V| \delta_{jjj} \theta
C \end{equation*}
C Near boundaries, mask all the gradients ==> still 3rd O.
C !USES: ===============================================================
IMPLICIT NONE
#include "SIZE.h"
c#include "GRID.h"
#include "GAD.h"
C !INPUT PARAMETERS: ===================================================
C bi,bj :: tile indices
C k :: vertical level
C vTrans :: meridional volume transport
C maskLocS :: mask (either 0 or 1) at grid-cell southern edge
C tracer :: tracer field
C myThid :: my thread Id number
INTEGER bi,bj,k
_RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
INTEGER myThid
C !OUTPUT PARAMETERS: ==================================================
C vT :: meridional advective flux
_RL vT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
C !LOCAL VARIABLES: ====================================================
C i,j :: loop indices
C Rjm,Rj,Rjp :: differences at j-1,j,j+1
C Rjjm,Rjjp :: second differences at j-1,j
INTEGER i,j
_RL Rjm,Rj,Rjp,Rjjm,Rjjp
CEOP
DO i=1-Olx,sNx+Olx
vT(i,1-Oly)=0.
vT(i,2-Oly)=0.
vT(i,sNy+Oly)=0.
ENDDO
DO j=1-Oly+2,sNy+Oly-1
DO i=1-Olx,sNx+Olx
Rjp = (tracer(i,j+1)-tracer(i, j ))*maskLocS(i,j+1)
Rj = (tracer(i, j )-tracer(i,j-1))*maskLocS(i, j )
Rjm = (tracer(i,j-1)-tracer(i,j-2))*maskLocS(i,j-1)
Rjjp=Rjp-Rj
Rjjm=Rj-Rjm
vT(i,j) =
& vTrans(i,j)*(
& Tracer(i,j)+Tracer(i,j-1)-oneSixth*( Rjjp+Rjjm )
& )*0.5 _d 0
& +ABS( vTrans(i,j) )*0.5 _d 0*oneSixth*( Rjjp-Rjjm )
ENDDO
ENDDO
RETURN
END