1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_trans_zonal.F,v 1.1 2005/05/27 22:10:27 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine cost_trans_zonal( mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE cost_trans_zonal |
10 |
c ================================================================== |
11 |
c |
12 |
c o Compute zonal transports. |
13 |
c |
14 |
c ================================================================== |
15 |
c SUBROUTINE cost_trans_zonal |
16 |
c ================================================================== |
17 |
|
18 |
implicit none |
19 |
|
20 |
c == global variables == |
21 |
|
22 |
#include "EEPARAMS.h" |
23 |
#include "SIZE.h" |
24 |
#include "PARAMS.h" |
25 |
#include "GRID.h" |
26 |
#include "DYNVARS.h" |
27 |
|
28 |
#include "optim.h" |
29 |
#include "cost.h" |
30 |
#include "ecco_cost.h" |
31 |
#include "ctrl_dummy.h" |
32 |
|
33 |
c == routine arguments == |
34 |
|
35 |
integer mythid |
36 |
|
37 |
#ifdef ALLOW_COST_TRANSPORT |
38 |
|
39 |
c == local variables == |
40 |
|
41 |
integer nsect |
42 |
parameter ( nsect = 5 ) |
43 |
|
44 |
integer isect |
45 |
integer kmin(nsect),kmax(nsect) |
46 |
c |
47 |
integer bi,bj |
48 |
integer i,j,k |
49 |
integer itlo,ithi |
50 |
integer jtlo,jthi |
51 |
integer jmin,jmax |
52 |
integer imin,imax |
53 |
integer irec |
54 |
integer il |
55 |
integer funit |
56 |
|
57 |
character*(80) fnameout |
58 |
character*(80) fnametheta |
59 |
character*(80) fnamesalt |
60 |
character*(80) fnameuvel |
61 |
character*(80) fnamevvel |
62 |
character*(MAX_LEN_MBUF) msgbuf |
63 |
|
64 |
_RL p5 |
65 |
parameter( p5 = 0.5 ) |
66 |
|
67 |
_RL dummy |
68 |
_RL del_x |
69 |
c-- tv: heat transport --- [Watt] (order of 1.E15 = PW) |
70 |
c-- sv: freshwater transport --- [kg/sec] (order 1.E9 equiv. 1 Sv in vol.) |
71 |
c-- convert from [ppt*m^3/sec] via rhoConst/1000. |
72 |
c-- ( 1ppt = 1000*[mass(salt)]/[mass(seawater)] ) |
73 |
c-- mv: volume flux --- [m^3/sec] (order of 10^6 = 1 Sv) |
74 |
_RL tu(nsect), su(nsect), mu(nsect) |
75 |
_RL musum(nsect), mumin(nsect), mumax(nsect), mulev(nsect,Nr) |
76 |
_RL xlon(nsect),beglat(nsect),endlat(nsect) |
77 |
c-- 1: A21 - Drake Passage 67W |
78 |
c-- 2: J89 - Indonesian Throughflow 125E |
79 |
c-- 3: I6 - South Africa 30E |
80 |
c-- 4: I9S - Western Australia 115E |
81 |
c-- 5: P12 - Tasmania 145E |
82 |
DATA xlon / 293.0, 125.0, 30.0, 115.0, 145.0 / |
83 |
DATA beglat / -67.0, -14.5, -70.0, -67.0, -67.0 / |
84 |
DATA endlat / -55.0, -8.5, -31.0, -32.0, -42.0 / |
85 |
c |
86 |
c _RL ylat2,beglon2,endlon2 |
87 |
c _RL ylat3,beglon3,endlon3 |
88 |
c parameter(ylat= 29., beglon=-42., endlon =-2.) |
89 |
c parameter(ylat= 29., beglon=282., endlon =352.) |
90 |
c parameter(ylat= 29., beglon=-82., endlon =-2.) |
91 |
cc parameter(ylat= 66.75,beglon=-34.5,endlon =-22.5) |
92 |
cc parameter(ylat2= 63.8,beglon2=-20,endlon2 =-5.) |
93 |
cc parameter(ylat3= 63.8,beglon3=-98.5,endlon3 =-80.0) |
94 |
|
95 |
logical doglobalread |
96 |
logical ladinit |
97 |
|
98 |
c == external functions == |
99 |
|
100 |
integer ilnblnk |
101 |
external ilnblnk |
102 |
|
103 |
c == end of interface == |
104 |
|
105 |
doglobalread = .false. |
106 |
ladinit = .false. |
107 |
|
108 |
jtlo = mybylo(mythid) |
109 |
jthi = mybyhi(mythid) |
110 |
itlo = mybxlo(mythid) |
111 |
ithi = mybxhi(mythid) |
112 |
jmin = 1 |
113 |
jmax = sny |
114 |
imin = 1 |
115 |
imax = snx |
116 |
|
117 |
il=ilnblnk( tbarfile ) |
118 |
write(fnametheta(1:80),'(2a,i10.10)') |
119 |
& tbarfile(1:il),'.',optimcycle |
120 |
c |
121 |
il=ilnblnk( sbarfile ) |
122 |
write(fnamesalt(1:80),'(2a,i10.10)') |
123 |
& sbarfile(1:il),'.',optimcycle |
124 |
c |
125 |
il=ilnblnk( ubarfile ) |
126 |
write(fnameuvel(1:80),'(2a,i10.10)') |
127 |
& ubarfile(1:il),'.',optimcycle |
128 |
c |
129 |
il=ilnblnk( vbarfile ) |
130 |
write(fnamevvel(1:80),'(2a,i10.10)') |
131 |
& vbarfile(1:il),'.',optimcycle |
132 |
|
133 |
do isect = 1, nsect |
134 |
|
135 |
call mdsfindunit( funit, mythid ) |
136 |
write(fnameout(1:80),'(a,i2.2,a,i4.4)') |
137 |
& 'cost_trans_zon',isect,'.',optimcycle |
138 |
open(unit=funit,file=fnameout) |
139 |
|
140 |
write(msgbuf,'(a,1(X,D22.15))') |
141 |
& 'ECCO_TRANS_ZON_XLON: section at lon: ', xlon(isect) |
142 |
call print_message( msgbuf, standardmessageunit, |
143 |
& SQUEEZE_RIGHT, mythid ) |
144 |
|
145 |
musum(isect) = 0.0 |
146 |
|
147 |
do irec = 1, nmonsrec |
148 |
|
149 |
call active_read_xyz( fnametheta, tbar, irec, |
150 |
& doglobalread, ladinit, |
151 |
& optimcycle, mythid, |
152 |
& dummy ) |
153 |
c |
154 |
call active_read_xyz( fnamesalt, sbar, irec, |
155 |
& doglobalread, ladinit, |
156 |
& optimcycle, mythid, |
157 |
& dummy ) |
158 |
c |
159 |
call active_read_xyz( fnameuvel, ubar, irec, |
160 |
& doglobalread, ladinit, |
161 |
& optimcycle, mythid, |
162 |
& dummy ) |
163 |
c |
164 |
call active_read_xyz( fnamevvel, vbar, irec, |
165 |
& doglobalread, ladinit, |
166 |
& optimcycle, mythid, |
167 |
& dummy ) |
168 |
|
169 |
tu(isect) = 0.0 |
170 |
su(isect) = 0.0 |
171 |
mu(isect) = 0.0 |
172 |
mumin(isect) = 0.0 |
173 |
mumax(isect) = 0.0 |
174 |
kmin(isect) = 0 |
175 |
kmax(isect) = 0 |
176 |
|
177 |
c-- Next, do the monthly average for temperature. |
178 |
c-- Assign the first value to the array holding the average. |
179 |
do bj = jtlo,jthi |
180 |
do bi = itlo,ithi |
181 |
do k = 1,nr |
182 |
do j = jmin,jmax |
183 |
do i = imin,imax |
184 |
del_x = xc(i,j,bi,bj)-xc(i-1,j,bi,bj) |
185 |
if ( xc(i,j,bi,bj) .ge. xlon(isect) .and. |
186 |
$ xc(i,j,bi,bj) .lt. xlon(isect)+del_x .and. |
187 |
$ yc(i,j,bi,bj) .ge. beglat(isect) .and. |
188 |
$ yc(i,j,bi,bj) .le. endlat(isect) ) then |
189 |
tu(isect) = tu(isect) + p5*(tbar(i,j,k,bi,bj) |
190 |
$ + tbar(i-1,j,k,bi,bj))*ubar(i,j,k,bi,bj) |
191 |
$ * _dyG(i,j,bi,bj) |
192 |
& * drF(k)*_hFacW(i,j,k,bi,bj) |
193 |
$ *HeatCapacity_Cp*rhoNil |
194 |
su(isect) = su(isect) + p5*(sbar(i,j,k,bi,bj) |
195 |
$ + sbar(i-1,j,k,bi,bj))*ubar(i,j,k,bi,bj) |
196 |
$ * _dyG(i,j,bi,bj) |
197 |
& * drF(k)*_hFacW(i,j,k,bi,bj) |
198 |
& * rhoNil/1000. |
199 |
mu(isect) = mu(isect) + p5*(hFacC(i,j,k,bi,bj) |
200 |
$ + hFacC(i-1,j,k,bi,bj))*ubar(i,j,k,bi,bj) |
201 |
$ * _dyG(i,j,bi,bj) |
202 |
& * drF(k)*_hFacW(i,j,k,bi,bj) |
203 |
endif |
204 |
enddo |
205 |
enddo |
206 |
mulev(isect,k) = mu(isect) |
207 |
enddo |
208 |
enddo |
209 |
enddo |
210 |
|
211 |
_GLOBAL_SUM_R8( tu(isect), mythid ) |
212 |
_GLOBAL_SUM_R8( su(isect), mythid ) |
213 |
_GLOBAL_SUM_R8( mu(isect), mythid ) |
214 |
c |
215 |
do k =1,nr |
216 |
_GLOBAL_SUM_R8( mulev(isect,k), mythid ) |
217 |
enddo |
218 |
mumin(isect) = mulev(isect,1) |
219 |
mumax(isect) = mulev(isect,1) |
220 |
do k = 2,nr |
221 |
if ( mulev(isect,k) .GT. mulev(isect,k-1) ) then |
222 |
mumax(isect) = mulev(isect,k) |
223 |
kmax(isect) = k |
224 |
endif |
225 |
if ( mulev(isect,k) .LT. mulev(isect,k-1) ) then |
226 |
mumin(isect) = mulev(isect,k) |
227 |
kmin(isect) = k |
228 |
endif |
229 |
enddo |
230 |
|
231 |
musum(isect) = musum(isect) + mu(isect) |
232 |
|
233 |
write(msgbuf,'(a,i3,i5,2i3,5(X,D15.8))') |
234 |
& 'ECCO_TRANS_ZON ', isect, irec, kmin(isect), kmax(isect), |
235 |
& tu(isect), su(isect), mu(isect), mumin(isect), mumax(isect) |
236 |
call print_message( msgbuf, standardmessageunit, |
237 |
& SQUEEZE_RIGHT, mythid ) |
238 |
c |
239 |
write(msgbuf,'(a,i3,1(X,D22.15))') |
240 |
& 'ECCO_TRANS_ZON_SUM musum ', isect, musum(isect) |
241 |
call print_message( msgbuf, standardmessageunit, |
242 |
& SQUEEZE_RIGHT, mythid ) |
243 |
|
244 |
write(funit,'(i3,i5,2i3,5(X,D22.15))') |
245 |
& isect, irec, kmin(isect), kmax(isect), |
246 |
& tu(isect), su(isect), mu(isect), mumin(isect), mumax(isect) |
247 |
|
248 |
c-- end loop over irec |
249 |
enddo |
250 |
|
251 |
close(funit) |
252 |
|
253 |
c-- end loop over isect |
254 |
enddo |
255 |
|
256 |
#endif |
257 |
|
258 |
end |