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

Annotation of /MITgcm/model/src/grad_sigma.F

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


Revision 1.8 - (hide annotations) (download)
Thu Aug 16 02:13:40 2007 UTC (16 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint60, checkpoint61, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59g, checkpoint59f, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a
Changes since 1.7: +7 -5 lines
add argument "withSigns" to S/R FILL_CS_CORNER_TR_RL calls

1 jmc 1.8 C $Header: /u/gcmpack/MITgcm/model/src/grad_sigma.F,v 1.7 2007/07/27 22:18:57 heimbach Exp $
2 cnh 1.3 C $Name: $
3 adcroft 1.1
4     #include "CPP_OPTIONS.h"
5    
6 cnh 1.3 CBOP
7     C !ROUTINE: GRAD_SIGMA
8     C !INTERFACE:
9 adcroft 1.1 SUBROUTINE GRAD_SIGMA(
10     I bi, bj, iMin, iMax, jMin, jMax, K,
11     I rhoK, sigKm1, sigKp1,
12     O sigmaX, sigmaY, sigmaR,
13     I myThid )
14 cnh 1.3 C !DESCRIPTION: \bv
15     C *==========================================================*
16 jmc 1.8 C | SUBROUTINE GRAD_SIGMA
17     C | o Calculate isoneutral gradients
18 cnh 1.3 C *==========================================================*
19     C \ev
20    
21     C !USES:
22 adcroft 1.1 IMPLICIT NONE
23     C == Global variables ==
24     #include "SIZE.h"
25     #include "GRID.h"
26     #include "EEPARAMS.h"
27     #include "PARAMS.h"
28    
29 cnh 1.3 C !INPUT/OUTPUT PARAMETERS:
30 adcroft 1.1 C == Routine arguments ==
31 jmc 1.4 C rhoK :: density at level k
32     C sigKm1 :: upper level density computed at current pressure
33     C sigKp1 :: lower level density computed at current pressure
34     C sigmaX,Y,R :: iso-neutral gradient of density in 3 directions X,Y,R
35 adcroft 1.1 INTEGER bi,bj,iMin,iMax,jMin,jMax,K
36     _RL rhoK(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
37     _RL sigKm1(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
38     _RL sigKp1(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
39     _RL sigmaX(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
40     _RL sigmaY(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
41     _RL sigmaR(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
42     INTEGER myThid
43    
44 cnh 1.3 C !LOCAL VARIABLES:
45 adcroft 1.1 C == Local variables ==
46 jmc 1.4 C rhoLoc :: local copy of rhoK
47 adcroft 1.1 INTEGER i,j
48 jmc 1.4 _RL rhoLoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
49 cnh 1.3 CEOP
50 adcroft 1.1
51 jmc 1.4 C- safer to work on a local copy of rhoK (before a partial update)
52     DO j=1-Oly,sNy+Oly
53     DO i=1-Olx,sNx+Olx
54     rhoLoc(i,j) = rhoK(i,j)
55     ENDDO
56     ENDDO
57    
58     C- Internal exchange for calculations in X
59 heimbach 1.7 cph-exch2#ifndef ALLOW_AUTODIFF_TAMC
60 jmc 1.4 IF ( useCubedSphereExchange ) THEN
61 jmc 1.8 CALL FILL_CS_CORNER_TR_RL( .TRUE., .FALSE.,
62     & rhoLoc, bi,bj, myThid )
63 jmc 1.4 ENDIF
64 heimbach 1.7 cph-exch2#endif
65 adcroft 1.1 DO j=1-Oly,sNy+Oly
66     DO i=1-Olx+1,sNx+Olx
67     sigmaX(i,j,k)=_maskW(i,j,k,bi,bj)
68     & *_recip_dxC(i,j,bi,bj)
69 jmc 1.4 & *(rhoLoc(i,j)-rhoLoc(i-1,j))
70 adcroft 1.1 ENDDO
71     ENDDO
72    
73 jmc 1.4 C- Internal exchange for calculations in Y
74 heimbach 1.7 cph-exch2#ifndef ALLOW_AUTODIFF_TAMC
75 jmc 1.4 IF ( useCubedSphereExchange ) THEN
76 jmc 1.8 CALL FILL_CS_CORNER_TR_RL(.FALSE., .FALSE.,
77     & rhoLoc, bi,bj, myThid )
78 jmc 1.4 ENDIF
79 heimbach 1.7 cph-exch2#endif
80 adcroft 1.1 DO j=1-Oly+1,sNy+Oly
81     DO i=1-Olx,sNx+Olx
82     sigmaY(i,j,k)=_maskS(i,j,k,bi,bj)
83     & *_recip_dyC(i,j,bi,bj)
84 jmc 1.4 & *(rhoLoc(i,j)-rhoLoc(i,j-1))
85 adcroft 1.1 ENDDO
86     ENDDO
87    
88 jmc 1.4 IF (K.EQ.1) THEN
89     DO j=1-Oly,sNy+Oly
90     DO i=1-Olx,sNx+Olx
91 adcroft 1.1 sigmaR(i,j,k)=0.
92 jmc 1.4 ENDDO
93 adcroft 1.1 ENDDO
94 jmc 1.4 ELSE
95     DO j=1-Oly,sNy+Oly
96     DO i=1-Olx,sNx+Olx
97     sigmaR(i,j,k)= maskC(i,j,k,bi,bj)
98 jmc 1.6 & *recip_drC(k)*rkSign
99     & *(sigKp1(i,j)-sigKm1(i,j))
100 jmc 1.4 ENDDO
101     ENDDO
102     ENDIF
103 adcroft 1.1
104     RETURN
105     END

  ViewVC Help
Powered by ViewVC 1.1.22