/[MITgcm]/MITgcm/pkg/generic_advdiff/gad_dst3_adv_r.F
ViewVC logotype

Contents of /MITgcm/pkg/generic_advdiff/gad_dst3_adv_r.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download)
Sun Oct 22 01:08:04 2006 UTC (17 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62u, checkpoint62t, checkpoint62c, checkpoint59, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint58y_post, checkpoint58t_post, checkpoint60, checkpoint61, checkpoint62, checkpoint58w_post, mitgcm_mapl_00, checkpoint58r_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint62b, checkpoint58v_post, checkpoint61f, checkpoint58x_post, checkpoint61n, checkpoint59j, checkpoint61q, checkpoint61e, checkpoint58u_post, checkpoint58s_post, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.8: +15 -18 lines
use Samar's version as the default (instead of only if useMatrix=T)

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3_adv_r.F,v 1.8 2006/06/19 14:40:43 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: GAD_DST3_ADV_R
8
9 C !INTERFACE: ==========================================================
10 SUBROUTINE GAD_DST3_ADV_R(
11 I bi,bj,k,dTarg,
12 I rTrans, wFld,
13 I tracer,
14 O wT,
15 I myThid )
16
17 C !DESCRIPTION:
18 C Calculates the area integrated vertical flux due to advection of a tracer
19 C using 3rd-order Direct Space and Time (DST-3) Advection Scheme
20
21 C !USES: ===============================================================
22 IMPLICIT NONE
23
24 C == GLobal variables ==
25 #include "SIZE.h"
26 #include "GRID.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "GAD.h"
30
31 C == Routine arguments ==
32 C !INPUT PARAMETERS: ===================================================
33 C bi,bj :: tile indices
34 C k :: vertical level
35 C deltaTloc :: local time-step (s)
36 C rTrans :: vertical volume transport
37 C wFld :: vertical flow
38 C tracer :: tracer field
39 C myThid :: thread number
40 INTEGER bi,bj,k
41 _RL dTarg
42 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
43 _RL wFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
45 INTEGER myThid
46
47 C !OUTPUT PARAMETERS: ==================================================
48 C wT :: vertical advective flux
49 _RL wT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
50
51 C == Local variables ==
52 C !LOCAL VARIABLES: ====================================================
53 C i,j :: loop indices
54 C km1 :: =max( k-1 , 1 )
55 C wLoc :: velocity, vertical component
56 C wCFL :: Courant-Friedrich-Levy number
57 INTEGER i,j,kp1,km1,km2
58 _RL wLoc
59 _RL Rjm,Rj,Rjp,cfl,d0,d1
60 #ifdef OLD_DST3_FORMULATION
61 _RL psiP,psiM,thetaP,thetaM
62 _RL smallNo
63
64 IF (inAdMode) THEN
65 smallNo = 1.0D-20
66 ELSE
67 smallNo = 1.0D-20
68 ENDIF
69 #endif
70
71 km2=MAX(1,k-2)
72 km1=MAX(1,k-1)
73 kp1=MIN(Nr,k+1)
74
75 DO j=1-Oly,sNy+Oly
76 DO i=1-Olx,sNx+Olx
77 Rjp=(tracer(i,j,k)-tracer(i,j,kp1))
78 & *maskC(i,j,kp1,bi,bj)
79 Rj =(tracer(i,j,km1)-tracer(i,j,k))
80 & *maskC(i,j,k,bi,bj)*maskC(i,j,km1,bi,bj)
81 Rjm=(tracer(i,j,km2)-tracer(i,j,km1))
82 & *maskC(i,j,km1,bi,bj)
83
84 wLoc = wFld(i,j)
85 c wLoc = rTrans(i,j)*recip_rA(i,j,bi,bj)
86 cfl=ABS(wLoc*dTarg*recip_drC(k))
87 d0=(2.-cfl)*(1.-cfl)*oneSixth
88 d1=(1.-cfl*cfl)*oneSixth
89 #ifdef OLD_DST3_FORMULATION
90 IF ( ABS(Rj).LT.smallNo .OR.
91 & ABS(Rjm).LT.smallNo ) THEN
92 thetaP=0.
93 psiP=0.
94 ELSE
95 thetaP=(Rjm+smallNo)/(smallNo+Rj)
96 psiP=d0+d1*thetaP
97 ENDIF
98 IF ( ABS(Rj).LT.smallNo .OR.
99 & ABS(Rjp).LT.smallNo ) THEN
100 thetaM=0.
101 psiM=0.
102 ELSE
103 thetaM=(Rjp+smallNo)/(smallNo+Rj)
104 psiM=d0+d1*thetaM
105 ENDIF
106 wT(i,j)=
107 & 0.5*(rTrans(i,j)+ABS(rTrans(i,j)))
108 & *( tracer(i,j, k ) + psiM*Rj )
109 & +0.5*(rTrans(i,j)-ABS(rTrans(i,j)))
110 & *( tracer(i,j,km1) - psiP*Rj )
111 #else /* OLD_DST3_FORMULATION */
112 wT(i,j)=
113 & 0.5*(rTrans(i,j)+ABS(rTrans(i,j)))
114 & *( tracer(i,j, k ) + (d0*Rj+d1*Rjp) )
115 & +0.5*(rTrans(i,j)-ABS(rTrans(i,j)))
116 & *( tracer(i,j,km1) - (d0*Rj+d1*Rjm) )
117 #endif /* OLD_DST3_FORMULATION */
118
119 ENDDO
120 ENDDO
121
122 RETURN
123 END

  ViewVC Help
Powered by ViewVC 1.1.22