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

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

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


Revision 1.8 - (show annotations) (download)
Mon Jun 19 14:40:43 2006 UTC (17 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58m_post, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58r_post, checkpoint58n_post, checkpoint58k_post, checkpoint58l_post
Changes since 1.7: +3 -3 lines
DST advection S/R : use local copy of velocity to compute CFL

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_r.F,v 1.7 2006/06/18 23:31:35 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: GAD_DST3FL_ADV_R
8
9 C !INTERFACE: ==========================================================
10 SUBROUTINE GAD_DST3FL_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 DST Scheme with flux limiting
20
21 C !USES: ===============================================================
22 IMPLICIT NONE
23
24 C == GLobal variables ==
25 #include "SIZE.h"
26 #include "GRID.h"
27 #include "GAD.h"
28
29 C == Routine arguments ==
30 C !INPUT PARAMETERS: ===================================================
31 C bi,bj :: tile indices
32 C k :: vertical level
33 C deltaTloc :: local time-step (s)
34 C rTrans :: vertical volume transport
35 C wFld :: vertical flow
36 C tracer :: tracer field
37 C myThid :: thread number
38 INTEGER bi,bj,k
39 _RL dTarg
40 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
41 _RL wFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
42 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
43 INTEGER myThid
44
45 C !OUTPUT PARAMETERS: ==================================================
46 C wT :: vertical advective flux
47 _RL wT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
48
49 C == Local variables ==
50 C !LOCAL VARIABLES: ====================================================
51 C i,j :: loop indices
52 C km1 :: =max( k-1 , 1 )
53 C wLoc :: velocity, vertical component
54 C wCFL :: Courant-Friedrich-Levy number
55 INTEGER i,j,kp1,km1,km2
56 _RL Rjm,Rj,Rjp,cfl,d0,d1
57 _RL psiP,psiM,thetaP,thetaM
58 _RL wLoc
59 _RL thetaMax
60 PARAMETER( thetaMax = 1.D+20 )
61
62 km2=MAX(1,k-2)
63 km1=MAX(1,k-1)
64 kp1=MIN(Nr,k+1)
65
66 DO j=1-Oly,sNy+Oly
67 DO i=1-Olx,sNx+Olx
68 Rjp=(tracer(i,j,k)-tracer(i,j,kp1))
69 & *maskC(i,j,kp1,bi,bj)
70 Rj =(tracer(i,j,km1)-tracer(i,j,k))
71 & *maskC(i,j,k,bi,bj)*maskC(i,j,km1,bi,bj)
72 Rjm=(tracer(i,j,km2)-tracer(i,j,km1))
73 & *maskC(i,j,km1,bi,bj)
74
75 wLoc = wFld(i,j)
76 c wLoc = rTrans(i,j)*recip_rA(i,j,bi,bj)
77 cfl=abs(wLoc*dTarg*recip_drC(k))
78 d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth
79 d1=(1. _d 0 -cfl*cfl)*oneSixth
80
81 C- the old version: can produce overflow, division by zero,
82 C and is wrong for tracer with low concentration:
83 c thetaP=Rjm/(1.D-20+Rj)
84 c thetaM=Rjp/(1.D-20+Rj)
85 C- the right expression, but not bounded:
86 c thetaP=0.D0
87 c thetaM=0.D0
88 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
89 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
90 C- prevent |thetaP,M| to reach too big value:
91 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
92 thetaP=SIGN(thetaMax,Rjm*Rj)
93 ELSE
94 thetaP=Rjm/Rj
95 ENDIF
96 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
97 thetaM=SIGN(thetaMax,Rjp*Rj)
98 ELSE
99 thetaM=Rjp/Rj
100 ENDIF
101
102 psiP=d0+d1*thetaP
103 psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
104 & thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
105 psiM=d0+d1*thetaM
106 psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
107 & thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
108
109 wT(i,j)=
110 & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
111 & *( tracer(i,j, k ) + psiM*Rj )
112 & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
113 & *( tracer(i,j,km1) - psiP*Rj )
114
115 ENDDO
116 ENDDO
117
118 RETURN
119 END

  ViewVC Help
Powered by ViewVC 1.1.22