1 |
adcroft |
1.4 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/generic_advdiff/gad_c4_adv_x.F,v 1.3 2001/08/20 20:45:15 jmc Exp $ |
2 |
jmc |
1.2 |
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
|
|
#include "GAD_OPTIONS.h" |
5 |
|
|
|
6 |
adcroft |
1.4 |
CBOP |
7 |
|
|
C !ROUTINE: GAD_C4_ADV_X |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
adcroft |
1.1 |
SUBROUTINE GAD_C4_ADV_X( |
11 |
|
|
I bi,bj,k, |
12 |
|
|
I uTrans, |
13 |
|
|
I tracer, |
14 |
|
|
O uT, |
15 |
|
|
I myThid ) |
16 |
adcroft |
1.4 |
|
17 |
|
|
C !DESCRIPTION: |
18 |
|
|
C Calculates the area integrated zonal flux due to advection of a tracer |
19 |
|
|
C using centered fourth-order interpolation: |
20 |
|
|
C \begin{equation*} |
21 |
|
|
C F^x_{adv} = U \overline{ \theta - \frac{1}{6} \delta_{ii} \theta }^i |
22 |
|
|
C \end{equation*} |
23 |
|
|
C Near boundaries, the scheme reduces to a second if the flow is away |
24 |
|
|
C from the boundary and to third order if the flow is towards |
25 |
|
|
C the boundary. |
26 |
|
|
|
27 |
|
|
C !USES: =============================================================== |
28 |
adcroft |
1.1 |
IMPLICIT NONE |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "GRID.h" |
31 |
|
|
#include "GAD.h" |
32 |
|
|
|
33 |
adcroft |
1.4 |
C !INPUT PARAMETERS: =================================================== |
34 |
|
|
C bi,bj :: tile indices |
35 |
|
|
C k :: vertical level |
36 |
|
|
C uTrans :: zonal volume transport |
37 |
|
|
C tracer :: tracer field |
38 |
|
|
C myThid :: thread number |
39 |
adcroft |
1.1 |
INTEGER bi,bj,k |
40 |
|
|
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
41 |
|
|
_RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
42 |
adcroft |
1.4 |
INTEGER myThid |
43 |
|
|
|
44 |
|
|
C !OUTPUT PARAMETERS: ================================================== |
45 |
|
|
C uT :: zonal advective flux |
46 |
adcroft |
1.1 |
_RL uT (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
47 |
|
|
|
48 |
adcroft |
1.4 |
C !LOCAL VARIABLES: ==================================================== |
49 |
|
|
C i,j :: loop indices |
50 |
|
|
C Rjm,Rj,Rjp :: differences at i-1,i,i+1 |
51 |
|
|
C Rjjm,Rjjp :: second differences at i-1,i |
52 |
adcroft |
1.1 |
INTEGER i,j |
53 |
|
|
_RL Rjm,Rj,Rjp,Rjjm,Rjjp |
54 |
adcroft |
1.4 |
CEOP |
55 |
adcroft |
1.1 |
|
56 |
|
|
DO j=1-Oly,sNy+Oly |
57 |
|
|
uT(1-Olx,j)=0. |
58 |
jmc |
1.2 |
uT(2-Olx,j)=0. |
59 |
|
|
uT(sNx+Olx,j)=0. |
60 |
|
|
DO i=1-Olx+2,sNx+Olx-1 |
61 |
jmc |
1.3 |
Rjp=(tracer(i+1,j)-tracer(i,j)) |
62 |
|
|
c & *maskW(i+1,j,k,bi,bj) |
63 |
|
|
Rj =(tracer(i,j)-tracer(i-1,j)) |
64 |
|
|
c & *maskW(i,j,k,bi,bj) |
65 |
|
|
Rjm=(tracer(i-1,j)-tracer(i-2,j)) |
66 |
|
|
c & *maskW(i-1,j,k,bi,bj) |
67 |
|
|
C- jmc: mask not needed here above if Rjjp & Rjjm & uTrans are masked |
68 |
|
|
Rjjp=(Rjp-Rj)*maskW(i+1,j,k,bi,bj) |
69 |
|
|
Rjjm=(Rj-Rjm)*maskW(i-1,j,k,bi,bj) |
70 |
|
|
uT(i,j) = |
71 |
adcroft |
1.1 |
& uTrans(i,j)*( |
72 |
|
|
& Tracer(i,j)+Tracer(i-1,j)-oneSixth*( Rjjp+Rjjm ) |
73 |
|
|
& )*0.5 _d 0 |
74 |
jmc |
1.3 |
& +ABS( uTrans(i,j) )*0.5 _d 0*oneSixth*( Rjjp-Rjjm ) |
75 |
|
|
& *( 1. _d 0 - maskW(i-1,j,k,bi,bj)*maskW(i+1,j,k,bi,bj) ) |
76 |
adcroft |
1.1 |
ENDDO |
77 |
|
|
ENDDO |
78 |
|
|
|
79 |
|
|
RETURN |
80 |
|
|
END |