/[MITgcm]/MITgcm_contrib/ksnow/press_release/code/pressure_release_salt.F
ViewVC logotype

Annotation of /MITgcm_contrib/ksnow/press_release/code/pressure_release_salt.F

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


Revision 1.4 - (hide annotations) (download)
Fri Apr 7 13:49:05 2017 UTC (8 years, 8 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +5 -5 lines
correct k index for cell cross-transfer

1 dgoldberg 1.4 C $Header: /u/gcmpack/MITgcm_contrib/ksnow/press_release/code/pressure_release_salt.F,v 1.3 2017/03/14 15:57:18 dgoldberg Exp $
2 ksnow 1.1 C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_OPTIONS.h"
6    
7     CBOP
8     SUBROUTINE PRESSURE_RELEASE_SALT(
9     U gS_arr,
10     I iMin,iMax,jMin,jMax, k, bi,bj,
11     I myTime, myIter, myThid )
12     C *============================================================*
13     C | SUBROUTINE PRESSURE_RELEASE_SALT
14     C | o Transport salt with darcy flux
15     C *============================================================*
16     IMPLICIT NONE
17    
18     C === Global variables ===
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21     #include "PARAMS.h"
22     #include "GRID.h"
23     #include "DYNVARS.h"
24     #include "SURFACE.h"
25     #include "FFIELDS.h"
26    
27     C === Routine arguments ===
28     C myThid - Number of this instance
29    
30     _RL gS_arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
31     INTEGER k,bi,bj
32     INTEGER iMin,iMax,jMin,jMax
33     _RL myTime
34     INTEGER myIter
35     INTEGER myThid
36    
37     CEndOfInterface
38    
39 ksnow 1.2 #ifdef ALLOW_PRESSURE_RELEASE_CODE
40 ksnow 1.1
41 ksnow 1.2 C === Local Variables ===
42     INTEGER i,j,k_e,k_ce,k_s,k_cs,k_w,k_cw,k_n,k_cn
43     _RL S_trans_west,S_trans_east,S_trans_south,S_trans_north
44 ksnow 1.1
45     DO j=jMin+1,jMax-1
46     DO i=iMin+1,iMax-1
47    
48 ksnow 1.2 S_trans_west = 0.0
49     S_trans_north = 0.0
50     S_trans_east = 0.0
51     S_trans_south = 0.0
52    
53 ksnow 1.1 C calculate the k cells the tracers are transferred between in north,
54     C south east and west cells.
55 ksnow 1.2 C Need to find if adjacent cells are deeper or shallower
56 ksnow 1.1 IF (kLowC(i,j,bi,bj) .GE. kLowC(i+1,j,bi,bj)) THEN
57     k_e = kLowC(i+1,j,bi,bj)
58     k_ce = kSurfC(i,j,bi,bj)
59     ELSE
60     k_e = kSurfC(i+1,j,bi,bj)
61     k_ce = kLowC(i,j,bi,bj)
62     ENDIF
63    
64     IF (kLowC(i,j,bi,bj) .GE. kLowC(i-1,j,bi,bj)) THEN
65     k_w = kLowC(i-1,j,bi,bj)
66     k_cw = kSurfC(i,j,bi,bj)
67     ELSE
68     k_w = kSurfC(i-1,j,bi,bj)
69     k_cw = kLowC(i,j,bi,bj)
70     ENDIF
71    
72     IF (kLowC(i,j,bi,bj) .GE. kLowC(i,j+1,bi,bj)) THEN
73     k_n = kLowC(i,j+1,bi,bj)
74     k_cn = kSurfC(i,j,bi,bj)
75     ELSE
76     k_n = kSurfC(i,j+1,bi,bj)
77     k_cn = kLowC(i,j,bi,bj)
78     ENDIF
79    
80     IF (kLowC(i,j,bi,bj) .GE. kLowC(i,j-1,bi,bj)) THEN
81     k_s = kLowC(i,j-1,bi,bj)
82     k_cs = kSurfC(i,j,bi,bj)
83     ELSE
84     k_s = kSurfC(i,j-1,bi,bj)
85     k_cs = kLowC(i,j,bi,bj)
86     ENDIF
87    
88     C calculate the net tracer flux through north, south east and west
89     C faces.
90 ksnow 1.2
91     IF (k .EQ. k_cw) THEN
92 dgoldberg 1.3 if (k_cw.gt.0 .and. k_w.gt.0) then
93     S_trans_west =0.5 _d 0 *
94     & ( pReleaseTransX(i,j,bi,bj) *
95     & (salt(i-1,j,k_w,bi,bj)+salt(i,j,k_cw,bi,bj))
96     & +abs(pReleaseTransX(i,j,bi,bj)) *
97     & (salt(i-1,j,k_w,bi,bj)-salt(i,j,k_cw,bi,bj)))
98     & *recip_rA(i,j,bi,bj)
99     & *recip_deepFac2C(k_cw)*recip_rhoFacC(k_cw)
100 ksnow 1.1 & *recip_drF(k_cw)*_recip_hFacC(i,j,k_cw,bi,bj)
101 dgoldberg 1.3 endif
102 ksnow 1.2 ENDIF
103     IF (k .EQ. k_ce) THEN
104 dgoldberg 1.3 if (k_ce.gt.0 .and. k_e.gt.0) then
105     S_trans_east =0.5 _d 0 *
106     & ( pReleaseTransX(i+1,j,bi,bj) *
107 dgoldberg 1.4 & (salt(i,j,k_ce,bi,bj)+salt(i+1,j,k_e,bi,bj))
108 dgoldberg 1.3 & +abs(pReleaseTransX(i+1,j,bi,bj)) *
109 dgoldberg 1.4 & (salt(i,j,k_ce,bi,bj)-salt(i+1,j,k_e,bi,bj)))
110 dgoldberg 1.3 & *recip_rA(i,j,bi,bj)
111     & *recip_deepFac2C(k_ce)*recip_rhoFacC(k_ce)
112 ksnow 1.2 & *recip_drF(k_ce)*_recip_hFacC(i,j,k_ce,bi,bj)
113 dgoldberg 1.3 ! S_trans_east =pReleaseTransX(i+1,j,bi,bj)*
114     ! & (salt(i,j,k_ce,bi,bj) -salt(i+1,j,k_e,bi,bj))
115     ! & *recip_dxG(i,j,bi,bj)
116     ! & *recip_drF(k_ce)*_recip_hFacC(i,j,k_ce,bi,bj)
117     endif
118 ksnow 1.2 ENDIF
119     IF (k .EQ. k_cs) THEN
120 dgoldberg 1.3 if (k_cs.gt.0 .and. k_s.gt.0) then
121     S_trans_south =0.5 _d 0 *
122     & ( pReleaseTransY(i,j,bi,bj) *
123     & (salt(i,j-1,k_s,bi,bj)+salt(i,j,k_cs,bi,bj))
124     & +abs(pReleaseTransY(i,j,bi,bj)) *
125     & (salt(i,j-1,k_s,bi,bj)-salt(i,j,k_cs,bi,bj)))
126     & *recip_rA(i,j,bi,bj)
127     & *recip_deepFac2C(k_cs)*recip_rhoFacC(k_cs)
128 ksnow 1.1 & *recip_drF(k_cs)*_recip_hFacC(i,j,k_cs,bi,bj)
129 dgoldberg 1.3 ! S_trans_south =pReleaseTransY(i,j,bi,bj)*
130     ! & (salt(i,j-1,k_s,bi,bj) -salt(i,j,k_cs,bi,bj))
131     ! & *recip_dyG(i,j,bi,bj)
132     ! & *recip_drF(k_cs)*_recip_hFacC(i,j,k_cs,bi,bj)
133     endif
134 ksnow 1.2 ENDIF
135     IF (k .EQ. k_cn) THEN
136 dgoldberg 1.3 if (k_cn.gt.0 .and. k_n.gt.0) then
137     S_trans_north =0.5 _d 0 *
138     & ( pReleaseTransY(i,j+1,bi,bj) *
139 dgoldberg 1.4 & (salt(i,j,k_cn,bi,bj)+salt(i,j+1,k_n,bi,bj))
140 dgoldberg 1.3 & +abs(pReleaseTransY(i,j+1,bi,bj)) *
141 dgoldberg 1.4 & (salt(i,j,k_cn,bi,bj)-salt(i,j+1,k_n,bi,bj)))
142 dgoldberg 1.3 & *recip_rA(i,j,bi,bj)
143     & *recip_deepFac2C(k_cn)*recip_rhoFacC(k_cn)
144 ksnow 1.2 & *recip_drF(k_cn)*_recip_hFacC(i,j,k_cn,bi,bj)
145 dgoldberg 1.3 ! S_trans_north =pReleaseTransY(i,j+1,bi,bj)*
146     ! & (salt(i,j,k_cn,bi,bj) -salt(i,j+1,k_n,bi,bj))
147     ! & *recip_dyG(i,j,bi,bj)
148     ! & *recip_drF(k_cn)*_recip_hFacC(i,j,k_cn,bi,bj)
149     endif
150 ksnow 1.2 ENDIF
151 ksnow 1.1
152 ksnow 1.2 C IF ((k .LE. 72) .AND. (k .GE. 68)) THEN
153     C IF (i .EQ. 10) THEN
154     C IF ((j .LE.100) .AND. (j .GE. 80)) THEN
155     C print *,'KS_ks',j,k,k_cn,k_cs,k_n,k_s,salt(i,j-1,k_s,bi,bj)
156     C & ,salt(i,j+1,k_n,bi,bj),S_trans_north,S_trans_south,
157     C & pReleaseTransY(i,j,bi,bj), pReleaseTransY(i,j+1,bi,bj)
158     C & ,pReleaseTransY(i,j-1,bi,bj)
159     C ENDIF
160     C ENDIF
161     C ENDIF
162 ksnow 1.1
163     C Add to get total tracer tendency.
164     gS_arr(i,j) = gS_arr(i,j) + S_trans_west - S_trans_east
165     & + S_trans_south - S_trans_north
166    
167 dgoldberg 1.3 ! if (i.eq.7.and.j.eq.161.and.k.eq.60) then
168     ! print *, "GOT HERE PRESS_RELEASE_SALT", k,
169     ! & uvel(i,j,k,bi,bj), uvel(i+1,j,k,bi,bj),
170     ! & vvel(i,j,k,bi,bj), vvel(i,j+1,k,bi,bj),
171     ! & S_trans_south,
172     ! & salt(i,j,k_cs,bi,bj), _recip_hFacC(i,j,k_cs,bi,bj),
173     ! & pReleaseTransY(i,j,bi,bj)
174     ! endif
175    
176 ksnow 1.1 ENDDO
177     ENDDO
178    
179 ksnow 1.2 #endif /* ALLOW_PRESSURE_RELEASE_CODE */
180    
181 ksnow 1.1 RETURN
182     END

  ViewVC Help
Powered by ViewVC 1.1.22