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

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

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


Revision 1.4 - (show annotations) (download)
Sun Apr 3 16:05:34 2005 UTC (19 years, 1 month ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57g_pre, checkpoint57s_post, checkpoint57g_post, checkpoint57r_post, checkpoint57i_post, checkpoint57n_post, checkpoint57l_post, checkpoint57t_post, checkpoint57v_post, checkpoint57f_post, checkpoint57h_pre, checkpoint57h_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, checkpoint57h_done, checkpoint57j_post, checkpoint57f_pre, checkpoint57o_post, checkpoint57k_post
Changes since 1.3: +30 -17 lines
Modifications to make DST3(=30) adjointable
(seems to work at 1/4 deg. for at least 1200 timesteps).

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3_adv_r.F,v 1.3 2002/03/06 01:29:36 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 SUBROUTINE GAD_DST3_ADV_R(
7 I bi_arg,bj_arg,k,dTarg,
8 I rTrans, wVel,
9 I tracer,
10 O wT,
11 I myThid )
12 C /==========================================================\
13 C | SUBROUTINE GAD_DST3_ADV_R |
14 C | o Compute Vertical advective Flux of Tracer using |
15 C | 3rd Order DST Sceheme |
16 C |==========================================================|
17 IMPLICIT NONE
18
19 C == GLobal variables ==
20 #include "SIZE.h"
21 #include "GRID.h"
22 #include "EEPARAMS.h"
23 #include "PARAMS.h"
24 #include "GAD.h"
25
26 C == Routine arguments ==
27 INTEGER bi_arg,bj_arg,k
28 _RL dTarg
29 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 _RL wVel(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
31 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
32 _RL wT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
33 INTEGER myThid
34
35 C == Local variables ==
36 C wFld :: velocity, vertical component
37 INTEGER i,j,kp1,km1,km2,bi,bj
38 _RL Rjm,Rj,Rjp,cfl,d0,d1
39 _RL psiP,psiM,thetaP,thetaM
40 _RL wFld
41 _RL smallNo
42 _RL Rjjm,Rjjp
43
44 IF (.NOT. multiDimAdvection) THEN
45 C If using the standard time-stepping/advection schemes (ie. AB-II)
46 C then the data-structures are all global arrays
47 bi=bi_arg
48 bj=bj_arg
49 ELSE
50 C otherwise if using the multi-dimensional advection schemes
51 C then the data-structures are all local arrays except
52 C for maskC(...) and wVel(...)
53 bi=1
54 bj=1
55 ENDIF
56
57 IF (inAdMode) THEN
58 smallNo = 1.0D-20
59 ELSE
60 smallNo = 1.0D-20
61 ENDIF
62
63 km2=MAX(1,k-2)
64 km1=MAX(1,k-1)
65 kp1=MIN(Nr,k+1)
66
67 DO j=1-Oly,sNy+Oly
68 DO i=1-Olx,sNx+Olx
69 Rjp=(tracer(i,j,k,bi,bj)-tracer(i,j,kp1,bi,bj))
70 & *maskC(i,j,kp1,bi_arg,bj_arg)
71 Rj =(tracer(i,j,km1,bi,bj)-tracer(i,j,k,bi,bj))
72 & *maskC(i,j,k,bi_arg,bj_arg)*maskC(i,j,km1,bi_arg,bj_arg)
73 Rjm=(tracer(i,j,km2,bi,bj)-tracer(i,j,km1,bi,bj))
74 & *maskC(i,j,km1,bi_arg,bj_arg)
75
76 c wFld = wVel(i,j,k,bi_arg,bj_arg)
77 wFld = rTrans(i,j)*recip_rA(i,j,bi_arg,bj_arg)
78 cfl=abs(wFld*dTarg*recip_drC(k))
79 d0=(2.-cfl)*(1.-cfl)*oneSixth
80 d1=(1.-cfl*cfl)*oneSixth
81 IF ( ABS(Rj).LT.smallNo .OR.
82 & ABS(Rjm).LT.smallNo ) THEN
83 thetaP=0.
84 psiP=0.
85 ELSE
86 thetaP=(Rjm+smallNo)/(smallNo+Rj)
87 psiP=d0+d1*thetaP
88 ENDIF
89 IF ( ABS(Rj).LT.smallNo .OR.
90 & ABS(Rjp).LT.smallNo ) THEN
91 thetaM=0.
92 psiM=0.
93 ELSE
94 thetaM=(Rjp+smallNo)/(smallNo+Rj)
95 psiM=d0+d1*thetaM
96 ENDIF
97 wT(i,j)=
98 & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
99 & *( Tracer(i,j, k ,bi,bj) + psiM*Rj )
100 & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
101 & *( Tracer(i,j,km1,bi,bj) - psiP*Rj )
102 ENDDO
103 ENDDO
104
105 RETURN
106 END

  ViewVC Help
Powered by ViewVC 1.1.22