/[MITgcm]/MITgcm/model/src/calc_gt.F
ViewVC logotype

Diff of /MITgcm/model/src/calc_gt.F

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

revision 1.7 by cnh, Thu May 28 15:09:29 1998 UTC revision 1.14 by cnh, Tue Aug 18 16:32:41 1998 UTC
# Line 5  C $Header$ Line 5  C $Header$
5  CStartOfInterFace  CStartOfInterFace
6        SUBROUTINE CALC_GT(        SUBROUTINE CALC_GT(
7       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
8       I           xA,yA,uTrans,vTrans,wTrans,maskup,       I           xA,yA,uTrans,vTrans,rTrans,maskup,maskC,
9       I           K13,K23,K33,KapGM,       I           K13,K23,KappaRT,KapGM,
10       U           af,df,fZon,fMer,fVerT,       U           af,df,fZon,fMer,fVerT,
11       I           myThid )       I           myThid )
12  C     /==========================================================\  C     /==========================================================\
# Line 42  C     == GLobal variables == Line 42  C     == GLobal variables ==
42  #include "EEPARAMS.h"  #include "EEPARAMS.h"
43  #include "PARAMS.h"  #include "PARAMS.h"
44  #include "GRID.h"  #include "GRID.h"
45    #include "FFIELDS.h"
46    
47  C     == Routine arguments ==  C     == Routine arguments ==
48  C     fZon    - Work array for flux of temperature in the east-west  C     fZon    - Work array for flux of temperature in the east-west
# Line 51  C               direction at the south f Line 52  C               direction at the south f
52  C     fVerT   - Flux of temperature (T) in the vertical  C     fVerT   - Flux of temperature (T) in the vertical
53  C               direction at the upper(U) and lower(D) faces of a cell.  C               direction at the upper(U) and lower(D) faces of a cell.
54  C     maskUp  - Land mask used to denote base of the domain.  C     maskUp  - Land mask used to denote base of the domain.
55    C     maskC   - Land mask for theta cells (used in TOP_LAYER only)
56  C     xA      - Tracer cell face area normal to X  C     xA      - Tracer cell face area normal to X
57  C     yA      - Tracer cell face area normal to X  C     yA      - Tracer cell face area normal to X
58  C     uTrans  - Zonal volume transport through cell face  C     uTrans  - Zonal volume transport through cell face
59  C     vTrans  - Meridional volume transport through cell face  C     vTrans  - Meridional volume transport through cell face
60  C     wTrans  - Vertical volume transport through cell face  C     rTrans  - Vertical volume transport through cell face
61  C     af      - Advective flux component work array  C     af      - Advective flux component work array
62  C     df      - Diffusive flux component work array  C     df      - Diffusive flux component work array
63  C     bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation  C     bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation
# Line 68  C     myThid - Instance number for this Line 70  C     myThid - Instance number for this
70        _RS yA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73        _RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74        _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75          _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
76        _RL K13   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL K13   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
77        _RL K23   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL K23   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
78        _RL K33   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL KappaRT(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
79        _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
80        _RL af    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL af    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
81        _RL df    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL df    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 84  CEndOfInterface Line 87  CEndOfInterface
87  C     == Local variables ==  C     == Local variables ==
88  C     I, J, K - Loop counters  C     I, J, K - Loop counters
89        INTEGER i,j        INTEGER i,j
90          LOGICAL TOP_LAYER
91        _RL afFacT, dfFacT        _RL afFacT, dfFacT
92        _RL dTdx(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL dTdx(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93        _RL dTdy(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL dTdy(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94    
95        afFacT = 1. _d 0        afFacT = 1. _d 0
96        dfFacT = 1. _d 0        dfFacT = 1. _d 0
97          TOP_LAYER = K .EQ. 1
98    
99  C---  Calculate advective and diffusive fluxes between cells.  C---  Calculate advective and diffusive fluxes between cells.
100    
# Line 104  C     Advective component of zonal flux Line 109  C     Advective component of zonal flux
109  C     Zonal tracer gradient  C     Zonal tracer gradient
110        DO j=jMin,jMax        DO j=jMin,jMax
111         DO i=iMin,iMax         DO i=iMin,iMax
112          dTdx(i,j) = _rdxC(i,j,bi,bj)*          dTdx(i,j) = _recip_dxC(i,j,bi,bj)*
113       &  (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj))       &  (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj))
114         ENDDO         ENDDO
115        ENDDO        ENDDO
# Line 134  C       Advective component of meridiona Line 139  C       Advective component of meridiona
139  C     Zonal tracer gradient  C     Zonal tracer gradient
140        DO j=jMin,jMax        DO j=jMin,jMax
141         DO i=iMin,iMax         DO i=iMin,iMax
142          dTdy(i,j) = _rdyC(i,j,bi,bj)*          dTdy(i,j) = _recip_dyC(i,j,bi,bj)*
143       &  (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj))       &  (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj))
144         ENDDO         ENDDO
145        ENDDO        ENDDO
# Line 156  C--   Interpolate terms for Redi/GM sche Line 161  C--   Interpolate terms for Redi/GM sche
161        DO j=jMin,jMax        DO j=jMin,jMax
162         DO i=iMin,iMax         DO i=iMin,iMax
163          dTdx(i,j) = 0.5*(          dTdx(i,j) = 0.5*(
164       &   +0.5*(maskW(i+1,j,k,bi,bj)*_rdxC(i+1,j,bi,bj)*       &   +0.5*(_maskW(i+1,j,k,bi,bj)*_recip_dxC(i+1,j,bi,bj)*
165       &           (theta(i+1,j,k,bi,bj)-theta(i,j,k,bi,bj))       &           (theta(i+1,j,k,bi,bj)-theta(i,j,k,bi,bj))
166       &        +maskW(i,j,k,bi,bj)*_rdxC(i,j,bi,bj)*       &        +_maskW(i,j,k,bi,bj)*_recip_dxC(i,j,bi,bj)*
167       &           (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj)))       &           (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj)))
168       &   +0.5*(maskW(i+1,j,km1,bi,bj)*_rdxC(i+1,j,bi,bj)*       &   +0.5*(_maskW(i+1,j,km1,bi,bj)*_recip_dxC(i+1,j,bi,bj)*
169       &           (theta(i+1,j,km1,bi,bj)-theta(i,j,km1,bi,bj))       &           (theta(i+1,j,km1,bi,bj)-theta(i,j,km1,bi,bj))
170       &        +maskW(i,j,km1,bi,bj)*_rdxC(i,j,bi,bj)*       &        +_maskW(i,j,km1,bi,bj)*_recip_dxC(i,j,bi,bj)*
171       &           (theta(i,j,km1,bi,bj)-theta(i-1,j,km1,bi,bj)))       &           (theta(i,j,km1,bi,bj)-theta(i-1,j,km1,bi,bj)))
172       &       )       &       )
173         ENDDO         ENDDO
# Line 170  C--   Interpolate terms for Redi/GM sche Line 175  C--   Interpolate terms for Redi/GM sche
175        DO j=jMin,jMax        DO j=jMin,jMax
176         DO i=iMin,iMax         DO i=iMin,iMax
177          dTdy(i,j) = 0.5*(          dTdy(i,j) = 0.5*(
178       &   +0.5*(maskS(i,j,k,bi,bj)*_rdyC(i,j,bi,bj)*       &   +0.5*(_maskS(i,j,k,bi,bj)*_recip_dyC(i,j,bi,bj)*
179       &           (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj))       &           (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj))
180       &        +maskS(i,j+1,k,bi,bj)*_rdyC(i,j+1,bi,bj)*       &        +_maskS(i,j+1,k,bi,bj)*_recip_dyC(i,j+1,bi,bj)*
181       &           (theta(i,j+1,k,bi,bj)-theta(i,j,k,bi,bj)))       &           (theta(i,j+1,k,bi,bj)-theta(i,j,k,bi,bj)))
182       &   +0.5*(maskS(i,j,km1,bi,bj)*_rdyC(i,j,bi,bj)*       &   +0.5*(_maskS(i,j,km1,bi,bj)*_recip_dyC(i,j,bi,bj)*
183       &           (theta(i,j,km1,bi,bj)-theta(i,j-1,km1,bi,bj))       &           (theta(i,j,km1,bi,bj)-theta(i,j-1,km1,bi,bj))
184       &        +maskS(i,j+1,km1,bi,bj)*_rdyC(i,j+1,bi,bj)*       &        +_maskS(i,j+1,km1,bi,bj)*_recip_dyC(i,j+1,bi,bj)*
185       &           (theta(i,j+1,km1,bi,bj)-theta(i,j,km1,bi,bj)))       &           (theta(i,j+1,km1,bi,bj)-theta(i,j,km1,bi,bj)))
186       &       )       &       )
187         ENDDO         ENDDO
# Line 189  C     (this plays the role of the free-s Line 194  C     (this plays the role of the free-s
194        DO j=jMin,jMax        DO j=jMin,jMax
195         DO i=iMin,iMax         DO i=iMin,iMax
196          af(i,j) =          af(i,j) =
197       &   wTrans(i,j)*(theta(i,j,k,bi,bj)+theta(i,j,kM1,bi,bj))*0.5 _d 0       &   rTrans(i,j)*(theta(i,j,k,bi,bj)+theta(i,j,kM1,bi,bj))*0.5 _d 0
198         ENDDO         ENDDO
199        ENDDO        ENDDO
200  C     Diffusive component of vertical flux  C     Diffusive component of vertical flux
201  C     Note: For K=1 then KM1=1 this gives a dT/dz = 0 upper  C     Note: For K=1 then KM1=1 this gives a dT/dr = 0 upper
202  C           boundary condition.  C           boundary condition.
203        DO j=jMin,jMax        DO j=jMin,jMax
204         DO i=iMin,iMax         DO i=iMin,iMax
205          df(i,j) = zA(i,j,bi,bj)*(          df(i,j) = _rA(i,j,bi,bj)*(
      &   -(diffKzT+KapGM(i,j)*K33(i,j,k))*rdzC(k)  
      &   *(theta(i,j,kM1,bi,bj)-theta(i,j,k,bi,bj))  
206       &   -KapGM(i,j)*K13(i,j,k)*dTdx(i,j)       &   -KapGM(i,j)*K13(i,j,k)*dTdx(i,j)
207       &   -KapGM(i,j)*K23(i,j,k)*dTdy(i,j)       &   -KapGM(i,j)*K23(i,j,k)*dTdy(i,j)
208       &   )       &   )
209         ENDDO         ENDDO
210        ENDDO        ENDDO
211          IF (.NOT.implicitDiffusion) THEN
212           DO j=jMin,jMax
213            DO i=iMin,iMax
214             df(i,j) = df(i,j) + _rA(i,j,bi,bj)*(
215         &    -KappaZT(i,j,k)*recip_drC(k)
216         &    *(theta(i,j,kM1,bi,bj)-theta(i,j,k,bi,bj))
217         &    )
218            ENDDO
219           ENDDO
220          ENDIF
221  C     Net vertical flux  C     Net vertical flux
222        DO j=jMin,jMax        DO j=jMin,jMax
223         DO i=iMin,iMax         DO i=iMin,iMax
224          fVerT(i,j,kUp) = (afFacT*af(i,j) + dfFacT*df(i,j))*maskUp(i,j)          fVerT(i,j,kUp) = ( afFacT*af(i,j)+  dfFacT*df(i,j) )*maskUp(i,j)
225         ENDDO         ENDDO
226        ENDDO        ENDDO
227          IF ( TOP_LAYER ) THEN
228           DO j=jMin,jMax
229            DO i=iMin,iMax
230             fVerT(i,j,kUp) = afFacT*af(i,j)*freeSurfFac
231            ENDDO
232           ENDDO
233          ENDIF
234    
235  C--   Tendency is minus divergence of the fluxes.  C--   Tendency is minus divergence of the fluxes.
236  C     Note. Tendency terms will only be correct for range  C     Note. Tendency terms will only be correct for range
# Line 220  C           they are not algorithmically Line 240  C           they are not algorithmically
240  C           are not used.  C           are not used.
241        DO j=jMin,jMax        DO j=jMin,jMax
242         DO i=iMin,iMax         DO i=iMin,iMax
243    #define _recip_VolT(i,j,k,bi,bj) _recip_hFacC(i,j,k,bi,bj)*recip_drF(k)/_rA(i,j,bi,bj)
244          gT(i,j,k,bi,bj)=          gT(i,j,k,bi,bj)=
245       &   -_rhFacC(i,j,k,bi,bj)*rdzF(k)*_rdxF(i,j,bi,bj)*_rdyF(i,j,bi,bj)       &   -_recip_VolT(i,j,k,bi,bj)
246       &   *(       &   *(
247       &    +( fZon(i+1,j)-fZon(i,j) )       &    +( fZon(i+1,j)-fZon(i,j) )
248       &    +( fMer(i,j+1)-fMer(i,j) )       &    +( fMer(i,j+1)-fMer(i,j) )
249       &    +( fVerT(i,j,kUp)-fVerT(i,j,kDown) )       &    +( fVerT(i,j,kUp)-fVerT(i,j,kDown) )*rkFac
250       &    )       &    )
251         ENDDO         ENDDO
252        ENDDO        ENDDO
253    
254  C--   External thermal forcing term(s)  C--   External thermal forcing term(s)
255    C     o Surface relaxation term
256          IF ( TOP_LAYER ) THEN
257           DO j=jMin,jMax
258            DO i=iMin,iMax
259             gT(i,j,k,bi,bj)=gT(i,j,k,bi,bj)
260         &  +maskC(i,j)*(
261         &   -lambdaThetaClimRelax*(theta(i,j,k,bi,bj)-SST(i,j,bi,bj))
262         &   -Qnet(i,j,bi,bj) )
263            ENDDO
264           ENDDO
265          ENDIF
266    
267        RETURN        RETURN
268        END        END

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22