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

Annotation of /MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_x.F

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


Revision 1.8 - (hide annotations) (download)
Tue Oct 18 16:03:55 2005 UTC (18 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58b_post, checkpoint57y_post, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint57y_pre, checkpoint58e_post, checkpoint58g_post, checkpoint57w_post, checkpoint57x_post, checkpoint58c_post
Changes since 1.7: +37 -14 lines
change it to work with low tracer concentrations; add upper bound to slope
ratio theta.

1 jmc 1.8 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_x.F,v 1.7 2005/08/19 22:19:35 heimbach Exp $
2 jmc 1.5 C $Name: $
3 adcroft 1.1
4     #include "GAD_OPTIONS.h"
5    
6     SUBROUTINE GAD_DST3FL_ADV_X(
7 heimbach 1.7 I bi,bj,k,deltaTloc,
8 adcroft 1.1 I uTrans, uVel,
9 jmc 1.6 I maskLocW, tracer,
10 adcroft 1.1 O uT,
11     I myThid )
12     C /==========================================================\
13     C | SUBROUTINE GAD_DST3FL_ADV_X |
14     C | o Compute Zonal 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 heimbach 1.7 _RL deltaTloc
27 adcroft 1.1 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
28     _RL uVel(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
29 jmc 1.6 _RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 adcroft 1.1 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
31     _RL uT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
32     INTEGER myThid
33    
34     C == Local variables ==
35 jmc 1.5 C uFld :: velocity [m/s], zonal component
36 adcroft 1.1 INTEGER i,j
37 adcroft 1.3 _RL Rjm,Rj,Rjp,cfl,d0,d1,psiP,psiM,thetaP,thetaM
38 jmc 1.5 _RL uFld
39 jmc 1.8 _RL thetaMax
40     PARAMETER( thetaMax = 1.D+20 )
41    
42     C- jmc: an alternative would be to compute directly psiM*Rj & psiP*Rj
43     C (if Rj*Rjm < 0 => psiP*Rj = 0 , elsef Rj > 0 ... , else ... )
44     C with no need to compute thetaM (might be easier to differentiate)
45 adcroft 1.1
46     DO j=1-Oly,sNy+Oly
47 jmc 1.8 uT(1-Olx,j)=0. _d 0
48     uT(2-Olx,j)=0. _d 0
49     uT(sNx+Olx,j)=0. _d 0
50 adcroft 1.1 DO i=1-Olx+2,sNx+Olx-1
51 jmc 1.6 Rjp=(tracer(i+1,j)-tracer( i ,j))*maskLocW(i+1,j)
52     Rj =(tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j)
53     Rjm=(tracer(i-1,j)-tracer(i-2,j))*maskLocW(i-1,j)
54 adcroft 1.1
55 jmc 1.5 c uFld = uVel(i,j,k,bi,bj)
56     uFld = uTrans(i,j)*recip_dyG(i,j,bi,bj)
57     & *recip_drF(k)*recip_hFacW(i,j,k,bi,bj)
58 heimbach 1.7 cfl=abs(uFld*deltaTloc*recip_dxC(i,j,bi,bj))
59 jmc 1.8 d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth
60     d1=(1. _d 0 -cfl*cfl)*oneSixth
61    
62     C- the old version: can produce overflow, division by zero,
63     c and is wrong for tracer with low concentration:
64     c thetaP=Rjm/(1.D-20+Rj)
65     c thetaM=Rjp/(1.D-20+Rj)
66     C- the right expression, but not bounded:
67 heimbach 1.4 c thetaP=0.D0
68 jmc 1.8 c thetaM=0.D0
69 heimbach 1.4 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
70 jmc 1.8 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
71     C- prevent |thetaP,M| to reach too big value:
72     IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
73     thetaP=SIGN(thetaMax,Rjm*Rj)
74     ELSE
75     thetaP=Rjm/Rj
76     ENDIF
77     IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
78     thetaM=SIGN(thetaMax,Rjp*Rj)
79     ELSE
80     thetaM=Rjp/Rj
81     ENDIF
82    
83 adcroft 1.1 psiP=d0+d1*thetaP
84 jmc 1.8 psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP),
85     & thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
86 adcroft 1.1 psiM=d0+d1*thetaM
87 jmc 1.8 psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM),
88     & thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
89    
90 adcroft 1.1 uT(i,j)=
91 heimbach 1.2 & 0.5*(uTrans(i,j)+abs(uTrans(i,j)))
92     & *( Tracer(i-1,j) + psiP*Rj )
93     & +0.5*(uTrans(i,j)-abs(uTrans(i,j)))
94     & *( Tracer( i ,j) - psiM*Rj )
95 adcroft 1.1
96     ENDDO
97     ENDDO
98    
99     RETURN
100     END

  ViewVC Help
Powered by ViewVC 1.1.22