/[MITgcm]/MITgcm/pkg/ecco/cost_trans_zonal.F
ViewVC logotype

Contents of /MITgcm/pkg/ecco/cost_trans_zonal.F

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


Revision 1.8 - (show annotations) (download)
Fri Aug 10 19:45:27 2012 UTC (11 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63r, checkpoint63s, checkpoint64, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65d, checkpoint65e
Changes since 1.7: +2 -2 lines
include ECCO_OPTIONS.h instead of COST_CPPOPTIONS.h

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

  ViewVC Help
Powered by ViewVC 1.1.22