1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_trans_merid.F,v 1.3 2007/10/09 00:02:51 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "COST_CPPOPTIONS.h" |
5 |
|
6 |
|
7 |
subroutine cost_trans_merid( mythid ) |
8 |
|
9 |
c ================================================================== |
10 |
c SUBROUTINE cost_trans_merid |
11 |
c ================================================================== |
12 |
c |
13 |
c o Compute meridional transports. |
14 |
c |
15 |
c ================================================================== |
16 |
c SUBROUTINE cost_trans_merid |
17 |
c ================================================================== |
18 |
|
19 |
implicit none |
20 |
|
21 |
c == global variables == |
22 |
|
23 |
#include "EEPARAMS.h" |
24 |
#include "SIZE.h" |
25 |
#include "PARAMS.h" |
26 |
#include "GRID.h" |
27 |
#include "DYNVARS.h" |
28 |
|
29 |
#include "optim.h" |
30 |
#include "cost.h" |
31 |
#include "ecco_cost.h" |
32 |
#include "ctrl_dummy.h" |
33 |
|
34 |
c == routine arguments == |
35 |
|
36 |
integer mythid |
37 |
|
38 |
#ifdef ALLOW_COST_TRANSPORT |
39 |
|
40 |
c == local variables == |
41 |
|
42 |
integer nsect |
43 |
parameter ( nsect = 11 ) |
44 |
|
45 |
integer isect |
46 |
integer kmin(nsect),kmax(nsect) |
47 |
c |
48 |
integer bi,bj |
49 |
integer i,j,k |
50 |
integer itlo,ithi |
51 |
integer jtlo,jthi |
52 |
integer jmin,jmax |
53 |
integer imin,imax |
54 |
integer irec |
55 |
integer il |
56 |
integer funit |
57 |
|
58 |
character*(80) fnameout |
59 |
character*(80) fnametheta |
60 |
character*(80) fnamesalt |
61 |
character*(80) fnameuvel |
62 |
character*(80) fnamevvel |
63 |
character*(MAX_LEN_MBUF) msgbuf |
64 |
|
65 |
_RL p5 |
66 |
parameter( p5 = 0.5 ) |
67 |
|
68 |
_RL dummy |
69 |
_RL del_y |
70 |
c-- tv: heat transport --- [Watt] (order of 1.E15 = PW) |
71 |
c-- sv: freshwater transport --- [kg/sec] (order 1.E9 equiv. 1 Sv in vol.) |
72 |
c-- convert from [ppt*m^3/sec] via rhoConst/1000. |
73 |
c-- ( 1ppt = 1000*[mass(salt)]/[mass(seawater)] ) |
74 |
c-- mv: volume flux --- [m^3/sec] (order of 10^6 = 1 Sv) |
75 |
_RL tv(nsect), sv(nsect), mv(nsect) |
76 |
_RL mvsum(nsect), mvmin(nsect), mvmax(nsect), mvlev(nsect,Nr) |
77 |
_RL ylat(nsect),beglon(nsect),endlon(nsect) |
78 |
c-- |
79 |
c-- 1: A5 - Atlantic 26.5N |
80 |
c-- 2: A2 - Atlantic 48N |
81 |
c-- 3: - Atlantic 65N Denmark Strait |
82 |
c-- 4: - Atlantic 26.5N Florida Strait |
83 |
c-- 5: I5 - Indian: 30S |
84 |
c-- 6: I4 - Indian: Mozambique Channel 24S |
85 |
c-- 7: I2 - Indian: 8S |
86 |
c-- 8: P1 - Pacific: 48N |
87 |
c-- 9: P3 - Pacific: 26.5N |
88 |
c-- 10: P21 - Pacific: 17S |
89 |
c-- 11: P6 - Pacific: 30S |
90 |
c-- |
91 |
DATA ylat / 26.5, 48.0, 65.0, 26.5, -30.0, -24.5, -7.5, |
92 |
& 48.0, 26.5, -17.0, -30.0 / |
93 |
DATA beglon / 279.5, 307.5, 317.0, 280.5, 30.0, 32.0, 38.0, |
94 |
& 142.0, 121.0, 147.0, 153.0 / |
95 |
DATA endlon / 347.5, 357.5, 340.0, 285.5, 116.0, 45.0, 115.0, |
96 |
& 236.0, 251.0, 290.0, 290.0 / |
97 |
c |
98 |
c _RL ylat2,beglon2,endlon2 |
99 |
c _RL ylat3,beglon3,endlon3 |
100 |
c parameter(ylat= 29., beglon=-42., endlon =-2.) |
101 |
c parameter(ylat= 29., beglon=282., endlon =352.) |
102 |
c parameter(ylat= 29., beglon=-82., endlon =-2.) |
103 |
cc parameter(ylat= 66.75,beglon=-34.5,endlon =-22.5) |
104 |
cc parameter(ylat2= 63.8,beglon2=-20,endlon2 =-5.) |
105 |
cc parameter(ylat3= 63.8,beglon3=-98.5,endlon3 =-80.0) |
106 |
|
107 |
logical doglobalread |
108 |
logical ladinit |
109 |
|
110 |
c == external functions == |
111 |
|
112 |
integer ilnblnk |
113 |
external ilnblnk |
114 |
|
115 |
c == end of interface == |
116 |
|
117 |
doglobalread = .false. |
118 |
ladinit = .false. |
119 |
|
120 |
jtlo = mybylo(mythid) |
121 |
jthi = mybyhi(mythid) |
122 |
itlo = mybxlo(mythid) |
123 |
ithi = mybxhi(mythid) |
124 |
jmin = 1 |
125 |
jmax = sny |
126 |
imin = 1 |
127 |
imax = snx |
128 |
|
129 |
il=ilnblnk( tbarfile ) |
130 |
write(fnametheta(1:80),'(2a,i10.10)') |
131 |
& tbarfile(1:il),'.',optimcycle |
132 |
c |
133 |
il=ilnblnk( sbarfile ) |
134 |
write(fnamesalt(1:80),'(2a,i10.10)') |
135 |
& sbarfile(1:il),'.',optimcycle |
136 |
c |
137 |
il=ilnblnk( ubarfile ) |
138 |
write(fnameuvel(1:80),'(2a,i10.10)') |
139 |
& ubarfile(1:il),'.',optimcycle |
140 |
c |
141 |
il=ilnblnk( vbarfile ) |
142 |
write(fnamevvel(1:80),'(2a,i10.10)') |
143 |
& vbarfile(1:il),'.',optimcycle |
144 |
|
145 |
do isect = 1, nsect |
146 |
|
147 |
call mdsfindunit( funit, mythid ) |
148 |
write(fnameout(1:80),'(a,i2.2,a,i4.4)') |
149 |
& 'cost_trans_mer',isect,'.',optimcycle |
150 |
open(unit=funit,file=fnameout) |
151 |
|
152 |
write(msgbuf,'(a,1(X,D22.15))') |
153 |
& 'ECCO_TRANS_MER_YLAT: section at lat: ', ylat(isect) |
154 |
call print_message( msgbuf, standardmessageunit, |
155 |
& SQUEEZE_RIGHT, mythid ) |
156 |
|
157 |
mvsum(isect) = 0.0 |
158 |
|
159 |
do irec = 1, nmonsrec |
160 |
|
161 |
call active_read_xyz( fnametheta, tbar, irec, |
162 |
& doglobalread, ladinit, |
163 |
& optimcycle, mythid, |
164 |
& dummy ) |
165 |
c |
166 |
call active_read_xyz( fnamesalt, sbar, irec, |
167 |
& doglobalread, ladinit, |
168 |
& optimcycle, mythid, |
169 |
& dummy ) |
170 |
c |
171 |
call active_read_xyz( fnameuvel, ubar, irec, |
172 |
& doglobalread, ladinit, |
173 |
& optimcycle, mythid, |
174 |
& dummy ) |
175 |
c |
176 |
call active_read_xyz( fnamevvel, vbar, irec, |
177 |
& doglobalread, ladinit, |
178 |
& optimcycle, mythid, |
179 |
& dummy ) |
180 |
|
181 |
tv(isect) = 0.0 |
182 |
sv(isect) = 0.0 |
183 |
mv(isect) = 0.0 |
184 |
mvmin(isect) = 0.0 |
185 |
mvmax(isect) = 0.0 |
186 |
kmin(isect) = 0 |
187 |
kmax(isect) = 0 |
188 |
|
189 |
c-- Next, do the monthly average for temperature. |
190 |
c-- Assign the first value to the array holding the average. |
191 |
do bj = jtlo,jthi |
192 |
do bi = itlo,ithi |
193 |
do k = 1,nr |
194 |
do j = jmin,jmax |
195 |
do i = imin,imax |
196 |
del_y = yc(i,j,bi,bj)-yc(i,j-1,bi,bj) |
197 |
if ( yc(i,j,bi,bj) .ge. ylat(isect) .and. |
198 |
$ yc(i,j,bi,bj) .lt. ylat(isect)+del_y .and. |
199 |
$ xc(i,j,bi,bj) .ge. beglon(isect) .and. |
200 |
$ xc(i,j,bi,bj) .le. endlon(isect) ) then |
201 |
tv(isect) = tv(isect) + p5*(tbar(i,j,k,bi,bj) |
202 |
$ + tbar(i,j-1,k,bi,bj))*vbar(i,j,k,bi,bj) |
203 |
$ * _dxG(i,j,bi,bj) |
204 |
& * drF(k)*_hFacS(i,j,k,bi,bj) |
205 |
$ *HeatCapacity_Cp*rhoNil |
206 |
sv(isect) = sv(isect) + p5*(sbar(i,j,k,bi,bj) |
207 |
$ + sbar(i,j-1,k,bi,bj))*vbar(i,j,k,bi,bj) |
208 |
$ * _dxG(i,j,bi,bj) |
209 |
& * drF(k)*_hFacS(i,j,k,bi,bj) |
210 |
& * rhoNil/1000. |
211 |
mv(isect) = mv(isect) + p5*(hFacC(i,j,k,bi,bj) |
212 |
$ + hFacC(i,j-1,k,bi,bj))*vbar(i,j,k,bi,bj) |
213 |
$ * _dxG(i,j,bi,bj) |
214 |
& * drF(k)*_hFacS(i,j,k,bi,bj) |
215 |
endif |
216 |
enddo |
217 |
enddo |
218 |
mvlev(isect,k) = mv(isect) |
219 |
enddo |
220 |
enddo |
221 |
enddo |
222 |
|
223 |
_GLOBAL_SUM_RL( tv(isect), mythid ) |
224 |
_GLOBAL_SUM_RL( sv(isect), mythid ) |
225 |
_GLOBAL_SUM_RL( mv(isect), mythid ) |
226 |
c |
227 |
do k =1,nr |
228 |
_GLOBAL_SUM_RL( mvlev(isect,k), mythid ) |
229 |
enddo |
230 |
mvmin(isect) = mvlev(isect,1) |
231 |
mvmax(isect) = mvlev(isect,1) |
232 |
do k = 2,nr |
233 |
if ( mvlev(isect,k) .GT. mvlev(isect,k-1) ) then |
234 |
mvmax(isect) = mvlev(isect,k) |
235 |
kmax(isect) = k |
236 |
endif |
237 |
if ( mvlev(isect,k) .LT. mvlev(isect,k-1) ) then |
238 |
mvmin(isect) = mvlev(isect,k) |
239 |
kmin(isect) = k |
240 |
endif |
241 |
enddo |
242 |
|
243 |
mvsum(isect) = mvsum(isect) + mv(isect) |
244 |
|
245 |
write(msgbuf,'(a,i3,i5,2i3,5(X,D15.8))') |
246 |
& 'ECCO_TRANS_MER ', isect, irec, kmin(isect), kmax(isect), |
247 |
& tv(isect), sv(isect), mv(isect), mvmin(isect), mvmax(isect) |
248 |
call print_message( msgbuf, standardmessageunit, |
249 |
& SQUEEZE_RIGHT, mythid ) |
250 |
c |
251 |
write(msgbuf,'(a,i3,1(X,D22.15))') |
252 |
& 'ECCO_TRANS_MER_SUM mvsum ', isect, mvsum(isect) |
253 |
call print_message( msgbuf, standardmessageunit, |
254 |
& SQUEEZE_RIGHT, mythid ) |
255 |
|
256 |
write(funit,'(i3,i5,2i3,5(X,D22.15))') |
257 |
& isect, irec, kmin(isect), kmax(isect), |
258 |
& tv(isect), sv(isect), mv(isect), mvmin(isect), mvmax(isect) |
259 |
|
260 |
c-- end loop over irec |
261 |
enddo |
262 |
|
263 |
close(funit) |
264 |
|
265 |
c-- end loop over isect |
266 |
enddo |
267 |
|
268 |
#endif |
269 |
|
270 |
end |