1 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_c4_adv_x.F,v 1.6 2008/02/29 01:30:59 mlosch Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GAD_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GAD_C4_ADV_X |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE GAD_C4_ADV_X( |
11 |
I bi,bj,k, |
12 |
I uTrans, maskLocW, |
13 |
I tracer, |
14 |
O uT, |
15 |
I myThid ) |
16 |
|
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 |
IMPLICIT NONE |
29 |
#include "SIZE.h" |
30 |
#include "GRID.h" |
31 |
#include "GAD.h" |
32 |
|
33 |
C !INPUT PARAMETERS: =================================================== |
34 |
C bi,bj :: tile indices |
35 |
C k :: vertical level |
36 |
C uTrans :: zonal volume transport |
37 |
C maskLocW :: mask (either 0 or 1) at grid-cell western edge |
38 |
C tracer :: tracer field |
39 |
C myThid :: my thread Id number |
40 |
INTEGER bi,bj,k |
41 |
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
42 |
_RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
43 |
_RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
44 |
INTEGER myThid |
45 |
|
46 |
C !OUTPUT PARAMETERS: ================================================== |
47 |
C uT :: zonal advective flux |
48 |
_RL uT (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
|
50 |
C !LOCAL VARIABLES: ==================================================== |
51 |
C i,j :: loop indices |
52 |
C Rjm,Rj,Rjp :: differences at i-1,i,i+1 |
53 |
C Rjjm,Rjjp :: second differences at i-1,i |
54 |
INTEGER i,j |
55 |
_RL Rjm,Rj,Rjp,Rjjm,Rjjp |
56 |
CEOP |
57 |
|
58 |
DO j=1-Oly,sNy+Oly |
59 |
uT(1-Olx,j)=0. |
60 |
uT(2-Olx,j)=0. |
61 |
uT(sNx+Olx,j)=0. |
62 |
ENDDO |
63 |
DO j=1-Oly,sNy+Oly |
64 |
DO i=1-Olx+2,sNx+Olx-1 |
65 |
Rjp = (tracer(i+1,j)-tracer( i ,j))*maskLocW(i+1,j) |
66 |
Rj = (tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j) |
67 |
Rjm = (tracer(i-1,j)-tracer(i-2,j))*maskLocW(i-1,j) |
68 |
Rjjp=(Rjp-Rj) |
69 |
Rjjm=(Rj-Rjm) |
70 |
uT(i,j) = |
71 |
& uTrans(i,j)*( |
72 |
& Tracer(i,j)+Tracer(i-1,j)-oneSixth*( Rjjp+Rjjm ) |
73 |
& )*0.5 _d 0 |
74 |
& +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 |
c & *( 1. _d 0 - maskLocW(i-1,j)*maskLocW(i+1,j) ) |
77 |
ENDDO |
78 |
ENDDO |
79 |
|
80 |
RETURN |
81 |
END |