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

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

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


Revision 1.3 - (show annotations) (download)
Mon Oct 11 16:38:53 2004 UTC (19 years, 8 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57d_post, checkpoint57b_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint55h_post, checkpoint57e_post, checkpoint56c_post, checkpoint57a_post, checkpoint55g_post, checkpoint55f_post, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, eckpoint57e_pre, checkpoint57c_post, checkpoint55e_post, checkpoint56a_post, checkpoint55d_post
Changes since 1.2: +32 -19 lines
o ECCO specific cost function terms (up-to-date with 1x1 runs)
o ecco_cost_weights is modified to 1x1 runs
o modifs to allow observations to be read in as
  single file or yearly files

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/Attic/cost_xbt.F,v 1.1.2.3 2002/04/04 10:58:59 heimbach Exp $
2
3 #include "COST_CPPOPTIONS.h"
4
5
6 subroutine cost_XBT(
7 I myiter,
8 I mytime,
9 I mythid
10 & )
11
12 c ==================================================================
13 c SUBROUTINE cost_XBT
14 c ==================================================================
15 c
16 c o Evaluate cost function contribution of XBT temperature data.
17 c
18 c started: Elisabeth Remy eremy@ucsd.edu 30-Aug-2000
19 c
20 c
21 c ==================================================================
22 c SUBROUTINE cost_XBT
23 c ==================================================================
24
25 implicit none
26
27 c == global variables ==
28
29 #include "EEPARAMS.h"
30 #include "SIZE.h"
31 #include "GRID.h"
32 #include "DYNVARS.h"
33
34 #include "cal.h"
35 #include "ecco_cost.h"
36 #include "ctrl.h"
37 #include "ctrl_dummy.h"
38 #include "optim.h"
39
40 c == routine arguments ==
41
42 integer myiter
43 _RL mytime
44 integer mythid
45
46 c == local variables ==
47
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 nrec
55 integer irec
56 integer ilu
57
58 _RL fctile_xbt
59 _RL fcthread_xbt
60 _RL www (1-olx:snx+olx,1-oly:sny+oly)
61 _RL tmpobs (1-olx:snx+olx,1-oly:sny+oly)
62 _RL cmask (1-olx:snx+olx,1-oly:sny+oly)
63 _RL spval
64 _RL ztop,rl_35,rl_0
65
66 character*(80) fnametheta
67
68 logical doglobalread
69 logical ladinit
70
71 character*(MAX_LEN_MBUF) msgbuf
72
73 cnew(
74 integer il
75 integer mody, modm
76 integer iyear, imonth
77 character*(80) fnametmp
78 logical exst
79 cnew)
80
81 c == external functions ==
82
83 integer ilnblnk
84 external ilnblnk
85 _RL SW_PTMP
86 external SW_PTMP
87
88 c == end of interface ==
89
90 jtlo = mybylo(mythid)
91 jthi = mybyhi(mythid)
92 itlo = mybxlo(mythid)
93 ithi = mybxhi(mythid)
94 jmin = 1
95 jmax = sny
96 imin = 1
97 imax = snx
98
99 spval = -1.8
100 ztop = -.981*1.027
101 rl_35 = 35.0
102 rl_0 = 0.0
103
104 c-- Read state record from global file.
105 doglobalread = .false.
106 ladinit = .false.
107
108 #ifdef ALLOW_XBT_COST_CONTRIBUTION
109
110 if (optimcycle .ge. 0) then
111 ilu=ilnblnk( tbarfile )
112 write(fnametheta(1:80),'(2a,i10.10)')
113 & tbarfile(1:ilu),'.',optimcycle
114 endif
115
116 fcthread_xbt = 0. _d 0
117
118 cnew(
119 mody = modelstartdate(1)/10000
120 modm = modelstartdate(1)/100 - mody*100
121 cnew)
122
123 c-- Loop over records.
124 do irec = 1,nmonsrec
125
126 c-- Read time averages and the monthly mean data.
127 call active_read_xyz( fnametheta, tbar, irec,
128 & doglobalread, ladinit,
129 & optimcycle, mythid
130 & , xx_tbar_mean_dummy )
131
132 cnew(
133 iyear = mody + INT((modm-1+irec-1)/12)
134 imonth = 1 + MOD(modm-1+irec-1,12)
135 il=ilnblnk(xbtfile)
136 write(fnametmp(1:80),'(2a,i4)')
137 & xbtfile(1:il), '_', iyear
138 inquire( file=fnametmp, exist=exst )
139 if (.NOT. exst) then
140 write(fnametmp(1:80),'(a)') xbtfile(1:il)
141 imonth = irec
142 endif
143
144 print *, 'ph-cost-t XBT ', irec, imonth, iyear
145
146 call mdsreadfield( fnametmp, cost_iprec, 'RL', nr, xbtobs,
147 & imonth, mythid)
148 cnew)
149
150 c-- Loop over this thread's tiles.
151 do bj = jtlo,jthi
152 do bi = itlo,ithi
153 c-- Loop over the model layers
154
155 fctile_xbt = 0. _d 0
156
157 do k = 1,nr
158
159 c-- Determine the weights to be used.
160 do j = jmin,jmax
161 do i = imin,imax
162 cmask(i,j) = 1. _d 0
163 if (xbtobs(i,j,k,bi,bj) .eq. 0.) then
164 cmask(i,j) = 0. _d 0
165 endif
166
167 if (xbtobs(i,j,k,bi,bj) .lt. spval) then
168 cmask(i,j) = 0. _d 0
169 endif
170
171 cph(
172 cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO'
173 cph below statement could be replaced by following
174 cph to make it independnet of Nr:
175 cph
176 cph if ( rC(K) .GT. -1000. ) then
177 cph)
178 c-- set cmask=0 in areas shallower than 1000m
179 if (_hFacC(i,j,13,bi,bj) .eq. 0.) then
180 cmask(i,j) = 0. _d 0
181 endif
182
183 if (_hFacC(i,j,k,bi,bj) .eq. 0.) then
184 cmask(i,j) = 0. _d 0
185 endif
186
187 enddo
188 enddo
189
190 do j = jmin,jmax
191 do i = imin,imax
192 www(i,j) = cosphi(i,j,bi,bj)*cmask(i,j)
193 tmpobs(i,j) = SW_PTMP(rl_35,
194 $ xbtobs(i,j,k,bi,bj),ztop*rc(k),rl_0)
195 c-- The array ctdtobs contains CTD temperature.
196
197 fctile_xbt = fctile_xbt +
198 & (wtheta2(i,j,k,bi,bj)*www(i,j))*
199 & (tbar(i,j,k,bi,bj)-tmpobs(i,j))*
200 & (tbar(i,j,k,bi,bj)-tmpobs(i,j))
201 enddo
202 enddo
203 c-- End of loop over layers.
204 enddo
205
206 fcthread_xbt = fcthread_xbt + fctile_xbt
207 objf_xbt(bi,bj) = objf_xbt(bi,bj) + fctile_xbt
208
209 #ifdef ECCO_VERBOSE
210 write(msgbuf,'(a)') ' '
211 call print_message( msgbuf, standardmessageunit,
212 & SQUEEZE_RIGHT , mythid)
213 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
214 & ' COST_XBT: irec,bi,bj = ',irec,bi,bj
215 call print_message( msgbuf, standardmessageunit,
216 & SQUEEZE_RIGHT , mythid)
217 write(msgbuf,'(a,d22.15)')
218 & ' COST_XBT: cost function = ', fctile_xbt
219 call print_message( msgbuf, standardmessageunit,
220 & SQUEEZE_RIGHT , mythid)
221 write(msgbuf,'(a)') ' '
222 call print_message( msgbuf, standardmessageunit,
223 & SQUEEZE_RIGHT , mythid)
224 #endif
225
226 enddo
227 enddo
228
229 #ifdef ECCO_VERBOSE
230 c-- Print cost function for all tiles.
231 _GLOBAL_SUM_R8( fcthread_xbt , myThid )
232 write(msgbuf,'(a)') ' '
233 call print_message( msgbuf, standardmessageunit,
234 & SQUEEZE_RIGHT , mythid)
235 write(msgbuf,'(a,i8.8)')
236 & ' cost_XBT: irec = ',irec
237 call print_message( msgbuf, standardmessageunit,
238 & SQUEEZE_RIGHT , mythid)
239 write(msgbuf,'(a,a,d22.15)')
240 & ' global cost function value',
241 & ' ( XBT temp. ) = ',fcthread_xbt
242 call print_message( msgbuf, standardmessageunit,
243 & SQUEEZE_RIGHT , mythid)
244 write(msgbuf,'(a)') ' '
245 call print_message( msgbuf, standardmessageunit,
246 & SQUEEZE_RIGHT , mythid)
247 #endif
248
249 enddo
250 c-- End of second loop over records.
251
252 #else
253 c-- Do not enter the calculation of the XBT temperature contribution
254 c-- to the final cost function.
255
256 fctile_xbt = 0. _d 0
257 fcthread_xbt = 0. _d 0
258
259 crg
260 nrec = 1
261 crg
262
263 _BEGIN_MASTER( mythid )
264 write(msgbuf,'(a)') ' '
265 call print_message( msgbuf, standardmessageunit,
266 & SQUEEZE_RIGHT , mythid)
267 write(msgbuf,'(a,a)')
268 & ' cost_XBT: no contribution of XBT temperature ',
269 & ' to cost function.'
270 call print_message( msgbuf, standardmessageunit,
271 & SQUEEZE_RIGHT , mythid)
272 write(msgbuf,'(a,a,i9.8)')
273 & ' cost_XBT: number of records that would have',
274 & ' been processed: ',nrec
275 call print_message( msgbuf, standardmessageunit,
276 & SQUEEZE_RIGHT , mythid)
277 write(msgbuf,'(a)') ' '
278 call print_message( msgbuf, standardmessageunit,
279 & SQUEEZE_RIGHT , mythid)
280 _END_MASTER( mythid )
281 #endif
282
283 return
284 end

  ViewVC Help
Powered by ViewVC 1.1.22