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

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

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


Revision 1.10 - (show annotations) (download)
Sun Jun 18 23:31:35 2006 UTC (17 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.9: +9 -9 lines
change velocity argument from a 5-indices global array to a local 2-D array
 (but still not used)

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_y.F,v 1.9 2006/06/07 01:55:14 heimbach Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 SUBROUTINE GAD_DST3FL_ADV_Y(
7 I bi,bj,k,deltaTloc,
8 I vTrans, vFld,
9 I maskLocS, tracer,
10 O vT,
11 I myThid )
12 C /==========================================================\
13 C | SUBROUTINE GAD_DST3FL_ADV_Y |
14 C | o Compute Meridional advective Flux of Tracer using |
15 C | 3rd Order DST Sceheme with flux limiting |
16 C |==========================================================|
17 IMPLICIT NONE
18
19 C == GLobal variables ==
20 #include "SIZE.h"
21 #include "GRID.h"
22 #include "GAD.h"
23
24 C == Routine arguments ==
25 INTEGER bi,bj,k
26 _RL deltaTloc
27 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
28 _RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
29 _RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
31 _RL vT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
32 INTEGER myThid
33
34 C == Local variables ==
35 C vLoc :: velocity [m/s], meridional component
36 INTEGER i,j
37 _RL Rjm,Rj,Rjp,cfl,d0,d1,psiP,psiM,thetaP,thetaM
38 _RL vLoc
39 _RL thetaMax
40 PARAMETER( thetaMax = 1.D+20 )
41
42 DO i=1-Olx,sNx+Olx
43 vT(i,1-Oly)=0. _d 0
44 vT(i,2-Oly)=0. _d 0
45 vT(i,sNy+Oly)=0. _d 0
46 ENDDO
47 DO j=1-Oly+2,sNy+Oly-1
48 DO i=1-Olx,sNx+Olx
49 Rjp=(tracer(i,j+1)-tracer(i, j ))*maskLocS(i,j+1)
50 Rj =(tracer(i, j )-tracer(i,j-1))*maskLocS(i, j )
51 Rjm=(tracer(i,j-1)-tracer(i,j-2))*maskLocS(i,j-1)
52
53 c vLoc = vFld(i,j)
54 vLoc = vTrans(i,j)*recip_dxG(i,j,bi,bj)
55 & *recip_drF(k)*_recip_hFacS(i,j,k,bi,bj)
56 cfl=abs(vLoc*deltaTloc*recip_dyC(i,j,bi,bj))
57 d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth
58 d1=(1. _d 0 -cfl*cfl)*oneSixth
59
60 C- the old version: can produce overflow, division by zero,
61 c and is wrong for tracer with low concentration:
62 c thetaP=Rjm/(1.D-20+Rj)
63 c thetaM=Rjp/(1.D-20+Rj)
64 C- the right expression, but not bounded:
65 c thetaP=0.D0
66 c thetaM=0.D0
67 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
68 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
69 C- prevent |thetaP,M| to reach too big value:
70 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
71 thetaP=SIGN(thetaMax,Rjm*Rj)
72 ELSE
73 thetaP=Rjm/Rj
74 ENDIF
75 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
76 thetaM=SIGN(thetaMax,Rjp*Rj)
77 ELSE
78 thetaM=Rjp/Rj
79 ENDIF
80
81 psiP=d0+d1*thetaP
82 psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP),
83 & thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
84 psiM=d0+d1*thetaM
85 psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM),
86 & thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
87
88 vT(i,j)=
89 & 0.5*(vTrans(i,j)+abs(vTrans(i,j)))
90 & *( Tracer(i,j-1) + psiP*Rj )
91 & +0.5*(vTrans(i,j)-abs(vTrans(i,j)))
92 & *( Tracer(i, j ) - psiM*Rj )
93
94 ENDDO
95 ENDDO
96
97 RETURN
98 END

  ViewVC Help
Powered by ViewVC 1.1.22