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

Contents 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.12 - (show annotations) (download)
Tue Dec 5 22:21:50 2006 UTC (17 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58t_post, checkpoint58w_post, mitgcm_mapl_00, checkpoint58v_post, checkpoint58x_post, checkpoint58u_post, checkpoint58s_post
Changes since 1.11: +12 -13 lines
change horizontal CFL for deep-model.

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_x.F,v 1.11 2006/06/19 14:40:43 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 SUBROUTINE GAD_DST3FL_ADV_X(
7 I bi,bj,k,deltaTloc,
8 I uTrans, uFld,
9 I maskLocW, tracer,
10 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 _RL deltaTloc
27 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
28 _RL uFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
29 _RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 _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 C uLoc :: velocity [m/s], zonal component
36 INTEGER i,j
37 _RL Rjm,Rj,Rjp,uCFL,d0,d1,psiP,psiM,thetaP,thetaM
38 _RL uLoc
39 _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
46 DO j=1-Oly,sNy+Oly
47 uT(1-Olx,j)=0. _d 0
48 uT(2-Olx,j)=0. _d 0
49 uT(sNx+Olx,j)=0. _d 0
50 DO i=1-Olx+2,sNx+Olx-1
51 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
55 uLoc = uFld(i,j)
56 uCFL = ABS( uLoc*deltaTloc
57 & *recip_dxC(i,j,bi,bj)*recip_deepFacC(k) )
58 d0=(2. _d 0 -uCFL)*(1. _d 0 -uCFL)*oneSixth
59 d1=(1. _d 0 -uCFL*uCFL)*oneSixth
60
61 C- the old version: can produce overflow, division by zero,
62 c and is wrong for tracer with low concentration:
63 c thetaP=Rjm/(1.D-20+Rj)
64 c thetaM=Rjp/(1.D-20+Rj)
65 C- the right expression, but not bounded:
66 c thetaP=0.D0
67 c thetaM=0.D0
68 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
69 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
70 C- prevent |thetaP,M| to reach too big value:
71 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
72 thetaP=SIGN(thetaMax,Rjm*Rj)
73 ELSE
74 thetaP=Rjm/Rj
75 ENDIF
76 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
77 thetaM=SIGN(thetaMax,Rjp*Rj)
78 ELSE
79 thetaM=Rjp/Rj
80 ENDIF
81
82 psiP=d0+d1*thetaP
83 psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
84 & thetaP*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
85 psiM=d0+d1*thetaM
86 psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
87 & thetaM*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
88
89 uT(i,j)=
90 & 0.5*(uTrans(i,j)+ABS(uTrans(i,j)))
91 & *( Tracer(i-1,j) + psiP*Rj )
92 & +0.5*(uTrans(i,j)-ABS(uTrans(i,j)))
93 & *( Tracer( i ,j) - psiM*Rj )
94
95 ENDDO
96 ENDDO
97
98 RETURN
99 END

  ViewVC Help
Powered by ViewVC 1.1.22