1 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_fluxlimit_adv_y.F,v 1.11 2006/12/05 22:25:41 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GAD_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GAD_FLUXLIMIT_ADV_Y |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE GAD_FLUXLIMIT_ADV_Y( |
11 |
I bi,bj,k, calcCFL, deltaTloc, |
12 |
I vTrans, vFld, |
13 |
I maskLocS, tracer, |
14 |
O vT, |
15 |
I myThid ) |
16 |
|
17 |
C !DESCRIPTION: |
18 |
C Calculates the area integrated meridional flux due to advection of a tracer |
19 |
C using second-order interpolation with a flux limiter: |
20 |
C \begin{equation*} |
21 |
C F^y_{adv} = V \overline{ \theta }^j |
22 |
C - \frac{1}{2} \left( |
23 |
C [ 1 - \psi(C_r) ] |V| |
24 |
C + V \frac{v \Delta t}{\Delta y_c} \psi(C_r) |
25 |
C \right) \delta_j \theta |
26 |
C \end{equation*} |
27 |
C where the $\psi(C_r)$ is the limiter function and $C_r$ is |
28 |
C the slope ratio. |
29 |
|
30 |
C !USES: =============================================================== |
31 |
IMPLICIT NONE |
32 |
#include "SIZE.h" |
33 |
#include "GRID.h" |
34 |
|
35 |
C !INPUT PARAMETERS: =================================================== |
36 |
C bi,bj :: tile indices |
37 |
C k :: vertical level |
38 |
C calcCFL :: =T: calculate CFL number ; =F: take vFld as CFL |
39 |
C deltaTloc :: local time-step (s) |
40 |
C vTrans :: meridional volume transport |
41 |
C vFld :: meridional flow / CFL number |
42 |
C tracer :: tracer field |
43 |
C myThid :: thread number |
44 |
INTEGER bi,bj,k |
45 |
LOGICAL calcCFL |
46 |
_RL deltaTloc |
47 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
48 |
_RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
_RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
_RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
INTEGER myThid |
52 |
|
53 |
C !OUTPUT PARAMETERS: ================================================== |
54 |
C vT :: meridional advective flux |
55 |
_RL vT (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
|
57 |
C !LOCAL VARIABLES: ==================================================== |
58 |
C i,j :: loop indices |
59 |
C Cr :: slope ratio |
60 |
C Rjm,Rj,Rjp :: differences at j-1,j,j+1 |
61 |
INTEGER i,j |
62 |
_RL Cr,Rjm,Rj,Rjp |
63 |
_RL vCFL |
64 |
C Statement function provides Limiter(Cr) |
65 |
#include "GAD_FLUX_LIMITER.h" |
66 |
CEOP |
67 |
|
68 |
DO i=1-Olx,sNx+Olx |
69 |
vT(i,1-Oly)=0. |
70 |
vT(i,2-Oly)=0. |
71 |
vT(i,sNy+Oly)=0. |
72 |
ENDDO |
73 |
DO j=1-Oly+2,sNy+Oly-1 |
74 |
DO i=1-Olx,sNx+Olx |
75 |
|
76 |
vCFL = vFld(i,j) |
77 |
IF ( calcCFL ) vCFL = ABS( vFld(i,j)*deltaTloc |
78 |
& *recip_dyC(i,j,bi,bj)*recip_deepFacC(k) ) |
79 |
Rjp=(tracer(i,j+1)-tracer(i, j ))*maskLocS(i,j+1) |
80 |
Rj =(tracer(i, j )-tracer(i,j-1))*maskLocS(i, j ) |
81 |
Rjm=(tracer(i,j-1)-tracer(i,j-2))*maskLocS(i,j-1) |
82 |
|
83 |
IF (Rj.NE.0.) THEN |
84 |
IF (vTrans(i,j).GT.0) THEN |
85 |
Cr=Rjm/Rj |
86 |
ELSE |
87 |
Cr=Rjp/Rj |
88 |
ENDIF |
89 |
ELSE |
90 |
IF (vTrans(i,j).GT.0) THEN |
91 |
Cr=Rjm*1.E20 |
92 |
ELSE |
93 |
Cr=Rjp*1.E20 |
94 |
ENDIF |
95 |
ENDIF |
96 |
Cr=Limiter(Cr) |
97 |
vT(i,j) = |
98 |
& vTrans(i,j)*(Tracer(i,j)+Tracer(i,j-1))*0.5 _d 0 |
99 |
& -ABS(vTrans(i,j))*((1.-Cr)+vCFL*Cr) |
100 |
& *Rj*0.5 _d 0 |
101 |
ENDDO |
102 |
ENDDO |
103 |
|
104 |
RETURN |
105 |
END |