/[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.13 - (show annotations) (download)
Wed Apr 4 01:39:06 2007 UTC (17 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint59, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint62b, checkpoint61f, checkpoint61n, checkpoint59j, checkpoint61q, checkpoint61e, 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.12: +5 -6 lines
add a logical argument "calcCFL" to DST horizontal Advection S/R
(if false, assume that uFld,vFld are already CFL number in x,y dir)

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_y.F,v 1.12 2006/12/05 22:21:50 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 SUBROUTINE GAD_DST3FL_ADV_Y(
7 I bi,bj,k, calcCFL, 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 LOGICAL calcCFL
27 _RL deltaTloc
28 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
29 _RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 _RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
31 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
32 _RL vT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
33 INTEGER myThid
34
35 C == Local variables ==
36 INTEGER i,j
37 _RL Rjm,Rj,Rjp,vCFL,d0,d1,psiP,psiM,thetaP,thetaM
38 _RL thetaMax
39 PARAMETER( thetaMax = 1.D+20 )
40
41 DO i=1-Olx,sNx+Olx
42 vT(i,1-Oly)=0. _d 0
43 vT(i,2-Oly)=0. _d 0
44 vT(i,sNy+Oly)=0. _d 0
45 ENDDO
46 DO j=1-Oly+2,sNy+Oly-1
47 DO i=1-Olx,sNx+Olx
48 Rjp=(tracer(i,j+1)-tracer(i, j ))*maskLocS(i,j+1)
49 Rj =(tracer(i, j )-tracer(i,j-1))*maskLocS(i, j )
50 Rjm=(tracer(i,j-1)-tracer(i,j-2))*maskLocS(i,j-1)
51
52 vCFL = vFld(i,j)
53 IF ( calcCFL ) vCFL = ABS( vFld(i,j)*deltaTloc
54 & *recip_dyC(i,j,bi,bj)*recip_deepFacC(k) )
55 d0=(2. _d 0 -vCFL)*(1. _d 0 -vCFL)*oneSixth
56 d1=(1. _d 0 -vCFL*vCFL)*oneSixth
57
58 C- the old version: can produce overflow, division by zero,
59 c and is wrong for tracer with low concentration:
60 c thetaP=Rjm/(1.D-20+Rj)
61 c thetaM=Rjp/(1.D-20+Rj)
62 C- the right expression, but not bounded:
63 c thetaP=0.D0
64 c thetaM=0.D0
65 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
66 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
67 C- prevent |thetaP,M| to reach too big value:
68 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
69 thetaP=SIGN(thetaMax,Rjm*Rj)
70 ELSE
71 thetaP=Rjm/Rj
72 ENDIF
73 IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
74 thetaM=SIGN(thetaMax,Rjp*Rj)
75 ELSE
76 thetaM=Rjp/Rj
77 ENDIF
78
79 psiP=d0+d1*thetaP
80 psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
81 & thetaP*(1. _d 0 -vCFL)/(vCFL+1. _d -20) ))
82 psiM=d0+d1*thetaM
83 psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
84 & thetaM*(1. _d 0 -vCFL)/(vCFL+1. _d -20) ))
85
86 vT(i,j)=
87 & 0.5*(vTrans(i,j)+ABS(vTrans(i,j)))
88 & *( Tracer(i,j-1) + psiP*Rj )
89 & +0.5*(vTrans(i,j)-ABS(vTrans(i,j)))
90 & *( Tracer(i, j ) - psiM*Rj )
91
92 ENDDO
93 ENDDO
94
95 RETURN
96 END

  ViewVC Help
Powered by ViewVC 1.1.22