/[MITgcm]/MITgcm/pkg/gmredi/gmredi_rtransport.F
ViewVC logotype

Annotation of /MITgcm/pkg/gmredi/gmredi_rtransport.F

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


Revision 1.15 - (hide annotations) (download)
Fri May 30 02:50:16 2008 UTC (16 years, 1 month ago) by gforget
Branch: MAIN
CVS Tags: checkpoint60, checkpoint61, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61r, checkpoint61p
Changes since 1.14: +3 -2 lines
o bridging the gap between eddy stress and GM.
  -> eddyTau is replaced with eddyPsi (eddyTau = f x rho0 x eddyPsi)
      along with a change in CPP option (now ALLOW_EDDYPSI).
  -> when using GM w/ GM_AdvForm:
      The total eddy streamfunction (Psi = eddyPsi + K x Slope)
      is applied either in the tracer Eq. or in momentum Eq.
      depending on data.gmredi (intro. GM_InMomAsStress).
  -> ALLOW_EDDYPSI_CONTROL for estimation purpose.
  The key modifications are in model/src/taueddy_external_forcing.F
  pkg/gmredi/gmredi_calc_*F pkg/gmredi/gmredi_*transport.F

1 gforget 1.15 C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_rtransport.F,v 1.14 2004/09/17 23:02:01 heimbach Exp $
2 heimbach 1.12 C $Name: $
3 adcroft 1.1
4     #include "GMREDI_OPTIONS.h"
5    
6     subroutine GMREDI_RTRANSPORT(
7     I iMin,iMax,jMin,jMax,bi,bj,K,
8 heimbach 1.8 I Tracer,tracerIdentity,
9 adcroft 1.1 U df,
10     I myThid)
11     C /==========================================================\
12     C | o SUBROUTINE GMREDI_RTRANSPORT |
13     C | Add vertical transport terms from GM/Redi |
14     C | parameterization. |
15     C |==========================================================|
16     C \==========================================================/
17     IMPLICIT NONE
18    
19     C == GLobal variables ==
20     #include "SIZE.h"
21     #include "EEPARAMS.h"
22     #include "PARAMS.h"
23     #include "GRID.h"
24     #include "GMREDI.h"
25    
26 heimbach 1.12 #ifdef ALLOW_AUTODIFF_TAMC
27 heimbach 1.14 # include "tamc.h"
28     # include "tamc_keys.h"
29     # ifdef ALLOW_PTRACERS
30     # include "PTRACERS_SIZE.h"
31     # endif
32 heimbach 1.12 #endif /* ALLOW_AUTODIFF_TAMC */
33    
34 adcroft 1.1 C == Routine arguments ==
35     C iMin,iMax,jMin, - Range of points for which calculation
36     C jMax,bi,bj,k results will be set.
37     C xA - Area of X face
38     C Tracer - 3D Tracer field
39     C df - Diffusive flux component work array.
40     INTEGER iMin,iMax,jMin,jMax,bi,bj,k
41     _RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
42 heimbach 1.9 INTEGER tracerIdentity
43 adcroft 1.1 _RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44     INTEGER myThid
45    
46     #ifdef ALLOW_GMREDI
47    
48     C == Local variables ==
49     C I, J - Loop counters
50     INTEGER I, J
51 heimbach 1.12 _RL dTdx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
52     _RL dTdy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53     #ifdef GM_BOLUS_ADVEC
54     _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
55     #endif
56    
57     #ifdef ALLOW_AUTODIFF_TAMC
58     act0 = tracerIdentity - 1
59     max0 = maxpass
60     act1 = bi - myBxLo(myThid)
61     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
62     act2 = bj - myByLo(myThid)
63     max2 = myByHi(myThid) - myByLo(myThid) + 1
64     act3 = myThid - 1
65     max3 = nTx*nTy
66     act4 = ikey_dynamics - 1
67     igadkey = (act0 + 1)
68     & + act1*max0
69     & + act2*max0*max1
70     & + act3*max0*max1*max2
71     & + act4*max0*max1*max2*max3
72     kkey = (igadkey-1)*Nr + k
73 heimbach 1.13 if (tracerIdentity.GT.maxpass) then
74     print *, 'ph-pass gmredi_rtrans ', maxpass, tracerIdentity
75     STOP 'maxpass seems smaller than tracerIdentity'
76     endif
77 heimbach 1.12 #endif /* ALLOW_AUTODIFF_TAMC */
78 adcroft 1.1
79     C Surface flux is zero
80 heimbach 1.2 IF (useGMRedi .AND. K.GT.1) THEN
81 adcroft 1.1
82 heimbach 1.12 C- Horizontal gradients interpolated to W points
83 adcroft 1.1 DO j=jMin,jMax
84     DO i=iMin,iMax
85 heimbach 1.12 dTdx(i,j) = op5*(
86 heimbach 1.11 & +op5*(_maskW(i+1,j,k,bi,bj)
87 adcroft 1.1 & *_recip_dxC(i+1,j,bi,bj)*
88     & (Tracer(i+1,j,k,bi,bj)-Tracer(i,j,k,bi,bj))
89     & +_maskW(i,j,k,bi,bj)
90     & *_recip_dxC(i,j,bi,bj)*
91     & (Tracer(i,j,k,bi,bj)-Tracer(i-1,j,k,bi,bj)))
92 heimbach 1.11 & +op5*(_maskW(i+1,j,k-1,bi,bj)
93 adcroft 1.1 & *_recip_dxC(i+1,j,bi,bj)*
94     & (Tracer(i+1,j,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj))
95     & +_maskW(i,j,k-1,bi,bj)
96     & *_recip_dxC(i,j,bi,bj)*
97     & (Tracer(i,j,k-1,bi,bj)-Tracer(i-1,j,k-1,bi,bj)))
98     & )
99    
100 heimbach 1.12 dTdy(i,j) = op5*(
101 heimbach 1.11 & +op5*(_maskS(i,j,k,bi,bj)
102 adcroft 1.1 & *_recip_dyC(i,j,bi,bj)*
103     & (Tracer(i,j,k,bi,bj)-Tracer(i,j-1,k,bi,bj))
104     & +_maskS(i,j+1,k,bi,bj)
105     & *_recip_dyC(i,j+1,bi,bj)*
106     & (Tracer(i,j+1,k,bi,bj)-Tracer(i,j,k,bi,bj)))
107 heimbach 1.11 & +op5*(_maskS(i,j,k-1,bi,bj)
108 adcroft 1.1 & *_recip_dyC(i,j,bi,bj)*
109     & (Tracer(i,j,k-1,bi,bj)-Tracer(i,j-1,k-1,bi,bj))
110     & +_maskS(i,j+1,k-1,bi,bj)
111     & *_recip_dyC(i,j+1,bi,bj)*
112     & (Tracer(i,j+1,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj)))
113     & )
114 heimbach 1.12 ENDDO
115     ENDDO
116    
117     #ifdef GM_AUTODIFF_EXCESSIVE_STORE
118     CADJ STORE dTdx(:,:) =
119     CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
120     CADJ STORE dTdy(:,:) =
121     CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
122     #endif
123 adcroft 1.1
124     C- Off-diagonal components of vertical flux
125 heimbach 1.12 DO j=jMin,jMax
126     DO i=iMin,iMax
127 adcroft 1.1 df(i,j) = df(i,j)
128     & - _rA(i,j,bi,bj)
129 heimbach 1.12 & *( Kwx(i,j,k,bi,bj)*dTdx(i,j)+Kwy(i,j,k,bi,bj)*dTdy(i,j) )
130 adcroft 1.1
131     ENDDO
132     ENDDO
133 jmc 1.6
134     #ifdef GM_BOLUS_ADVEC
135 gforget 1.15 IF (GM_AdvForm .AND. GM_AdvSeparate
136     & .AND. .NOT.GM_InMomAsStress) THEN
137 jmc 1.6 DO j=jMin,jMax
138     DO i=iMin,iMax
139 heimbach 1.12 rTrans(i,j) =
140 jmc 1.6 & dyG(i+1,j,bi,bj)*GM_PsiX(i+1,j,k,bi,bj)
141     & -dyG( i ,j,bi,bj)*GM_PsiX( i ,j,k,bi,bj)
142     & +dxG(i,j+1,bi,bj)*GM_PsiY(i,j+1,k,bi,bj)
143     & -dxG(i, j ,bi,bj)*GM_PsiY(i, j ,k,bi,bj)
144 heimbach 1.12 ENDDO
145     ENDDO
146     #ifdef GM_AUTODIFF_EXCESSIVE_STORE
147     CADJ STORE rtrans(:,:) =
148     CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
149     #endif
150     DO j=jMin,jMax
151     DO i=iMin,iMax
152 jmc 1.6 df(i,j) = df(i,j)
153 heimbach 1.12 & +rTrans(i,j)*op5
154     & *(Tracer(i,j,k,bi,bj)+Tracer(i,j,k-1,bi,bj))
155 jmc 1.6 ENDDO
156     ENDDO
157     ENDIF
158     #endif /* GM_BOLUS_ADVEC */
159 adcroft 1.1
160     c IF (.NOT.implicitDiffusion) THEN
161     c
162     c This vertical diffusion term is currently implemented
163     c by adding the VisbeckK*Kwz diffusivity to KappaRT/S
164     c See calc_diffusivity.F and calc_gt.F (calc_gs.F)
165     c
166     c DO j=jMin,jMax
167     c DO i=iMin,iMax
168     c df(i,j) = df(i,j) - _rA(i,j,bi,bj)
169 heimbach 1.3 c & *maskUp(i,j)*VisbeckK(i,j,bi,bj)*Kwz(i,j,k,bi,bj)
170 adcroft 1.1 c & *recip_drC(k)*rkfac
171     c & *(Tracer(i,j,k-1,bi,bj)-Tracer(i,j,k,bi,bj))
172     c ENDDO
173     c ENDDO
174     c ENDIF
175    
176     ENDIF
177     #endif /* ALLOW_GMREDI */
178    
179     RETURN
180     END

  ViewVC Help
Powered by ViewVC 1.1.22