1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/Attic/cost_argo_theta.F,v 1.1.2.1 2002/04/04 10:58:58 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine cost_argo_theta( |
7 |
I myiter, |
8 |
I mytime, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cost_argo_theta |
14 |
c ================================================================== |
15 |
c |
16 |
c o Evaluate cost function contribution of ARGO 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_argo_theta |
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_argot |
59 |
_RL fcthread_argot |
60 |
_RL www (1-olx:snx+olx,1-oly:sny+oly) |
61 |
_RL tmpobs (1-olx:snx+olx,1-oly:sny+oly) |
62 |
_RL spval |
63 |
_RL ztop,rl_35,rl_0 |
64 |
|
65 |
character*(80) fnametheta |
66 |
|
67 |
logical doglobalread |
68 |
logical ladinit |
69 |
|
70 |
character*(MAX_LEN_MBUF) msgbuf |
71 |
|
72 |
cnew( |
73 |
integer il |
74 |
integer mody, modm |
75 |
integer iyear, imonth |
76 |
character*(80) fnametmp |
77 |
logical exst |
78 |
cnew) |
79 |
|
80 |
c == external functions == |
81 |
|
82 |
integer ilnblnk |
83 |
external ilnblnk |
84 |
_RL SW_PTMP |
85 |
external SW_PTMP |
86 |
|
87 |
c == end of interface == |
88 |
|
89 |
jtlo = mybylo(mythid) |
90 |
jthi = mybyhi(mythid) |
91 |
itlo = mybxlo(mythid) |
92 |
ithi = mybxhi(mythid) |
93 |
jmin = 1 |
94 |
jmax = sny |
95 |
imin = 1 |
96 |
imax = snx |
97 |
|
98 |
spval = -1.8 |
99 |
ztop = -.981*1.027 |
100 |
rl_35= 35.0 |
101 |
rl_0 = 0.0 |
102 |
c-- Read state record from global file. |
103 |
doglobalread = .false. |
104 |
ladinit = .false. |
105 |
|
106 |
#ifdef ALLOW_ARGO_THETA_COST_CONTRIBUTION |
107 |
|
108 |
if (optimcycle .ge. 0) then |
109 |
ilu=ilnblnk( tbarfile ) |
110 |
write(fnametheta(1:80),'(2a,i10.10)') |
111 |
& tbarfile(1:ilu),'.',optimcycle |
112 |
endif |
113 |
|
114 |
fcthread_argot = 0. _d 0 |
115 |
|
116 |
cnew( |
117 |
mody = modelstartdate(1)/10000 |
118 |
modm = modelstartdate(1)/100 - mody*100 |
119 |
cnew) |
120 |
|
121 |
c-- Loop over records. |
122 |
do irec = 1,nmonsrec |
123 |
|
124 |
c-- Read time averages and the monthly mean data. |
125 |
call active_read_xyz( fnametheta, tbar, irec, |
126 |
& doglobalread, ladinit, |
127 |
& optimcycle, mythid |
128 |
& , xx_tbar_mean_dummy ) |
129 |
|
130 |
cnew( |
131 |
iyear = mody + INT((modm-1+irec-1)/12) |
132 |
imonth = 1 + MOD(modm-1+irec-1,12) |
133 |
il=ilnblnk(argotfile) |
134 |
write(fnametmp(1:80),'(2a,i4)') |
135 |
& argotfile(1:il), '_', iyear |
136 |
inquire( file=fnametmp, exist=exst ) |
137 |
if (.NOT. exst) then |
138 |
write(fnametmp(1:80),'(a)') argotfile(1:il) |
139 |
imonth = irec |
140 |
endif |
141 |
|
142 |
call mdsreadfield( fnametmp, cost_iprec, 'RL', nr, argotobs, |
143 |
& imonth, mythid) |
144 |
cnew) |
145 |
|
146 |
c-- Loop over this thread's tiles. |
147 |
do bj = jtlo,jthi |
148 |
do bi = itlo,ithi |
149 |
c-- Loop over the model layers |
150 |
|
151 |
fctile_argot = 0. _d 0 |
152 |
|
153 |
do k = 1,nr |
154 |
|
155 |
c-- Determine the weights to be used. |
156 |
do j = jmin,jmax |
157 |
do i = imin,imax |
158 |
cph( |
159 |
cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO' |
160 |
cph below statement could be replaced by following |
161 |
cph to make it independnet of Nr: |
162 |
cph |
163 |
cph if ( rC(K) .GT. -1000. ) then |
164 |
cph) |
165 |
if( (argotobs(i,j,k,bi,bj) .ne. 0.).and. |
166 |
& (argotobs(i,j,k,bi,bj) .gt. spval).and. |
167 |
& (_hFacC(i,j,13,bi,bj) .ne. 0.).and. |
168 |
& (_hFacC(i,j,k,bi,bj) .ne. 0.) )then |
169 |
www(i,j) = cosphi(i,j,bi,bj) |
170 |
tmpobs(i,j) = SW_PTMP(rl_35, |
171 |
$ argotobs(i,j,k,bi,bj),ztop*rc(k),rl_0) |
172 |
|
173 |
fctile_argot = fctile_argot + |
174 |
& wtheta2(i,j,k,bi,bj)*www(i,j)* |
175 |
& (tbar(i,j,k,bi,bj)-tmpobs(i,j))* |
176 |
& (tbar(i,j,k,bi,bj)-tmpobs(i,j)) |
177 |
endif |
178 |
enddo |
179 |
enddo |
180 |
c-- End of loop over layers. |
181 |
enddo |
182 |
|
183 |
fcthread_argot = fcthread_argot + fctile_argot |
184 |
objf_argot(bi,bj) = objf_argot(bi,bj) + fctile_argot |
185 |
|
186 |
#ifdef ECCO_VERBOSE |
187 |
write(msgbuf,'(a)') ' ' |
188 |
call print_message( msgbuf, standardmessageunit, |
189 |
& SQUEEZE_RIGHT , mythid) |
190 |
write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)') |
191 |
& ' COST_ARGO_THETA: irec,bi,bj = ',irec,bi,bj |
192 |
call print_message( msgbuf, standardmessageunit, |
193 |
& SQUEEZE_RIGHT , mythid) |
194 |
write(msgbuf,'(a,d22.15)') |
195 |
& ' COST_ARGO_THETA: cost function = ', fctile_argot |
196 |
call print_message( msgbuf, standardmessageunit, |
197 |
& SQUEEZE_RIGHT , mythid) |
198 |
write(msgbuf,'(a)') ' ' |
199 |
call print_message( msgbuf, standardmessageunit, |
200 |
& SQUEEZE_RIGHT , mythid) |
201 |
#endif |
202 |
|
203 |
enddo |
204 |
enddo |
205 |
|
206 |
#ifdef ECCO_VERBOSE |
207 |
c-- Print cost function for all tiles. |
208 |
c _GLOBAL_SUM_R8( fcthread_argot , myThid ) |
209 |
write(msgbuf,'(a)') ' ' |
210 |
call print_message( msgbuf, standardmessageunit, |
211 |
& SQUEEZE_RIGHT , mythid) |
212 |
write(msgbuf,'(a,i8.8)') |
213 |
& ' cost_ARGOT: irec = ',irec |
214 |
call print_message( msgbuf, standardmessageunit, |
215 |
& SQUEEZE_RIGHT , mythid) |
216 |
write(msgbuf,'(a,a,d22.15)') |
217 |
& ' global cost function value', |
218 |
& ' ( ARGO temp. ) = ',fcthread_argot |
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 |
c-- End of second loop over records. |
228 |
|
229 |
#else |
230 |
c-- Do not enter the calculation of the CTD temperature contribution |
231 |
c-- to the final cost function. |
232 |
|
233 |
fctile_argot = 0. _d 0 |
234 |
fcthread_argot = 0. _d 0 |
235 |
|
236 |
crg |
237 |
nrec = 1 |
238 |
crg |
239 |
|
240 |
_BEGIN_MASTER( mythid ) |
241 |
write(msgbuf,'(a)') ' ' |
242 |
call print_message( msgbuf, standardmessageunit, |
243 |
& SQUEEZE_RIGHT , mythid) |
244 |
write(msgbuf,'(a,a)') |
245 |
& ' cost_ARGOT: no contribution of ARGO temperature ', |
246 |
& ' to cost function.' |
247 |
call print_message( msgbuf, standardmessageunit, |
248 |
& SQUEEZE_RIGHT , mythid) |
249 |
write(msgbuf,'(a,a,i9.8)') |
250 |
& ' cost_ARGOT: number of records that would have', |
251 |
& ' been processed: ',nrec |
252 |
call print_message( msgbuf, standardmessageunit, |
253 |
& SQUEEZE_RIGHT , mythid) |
254 |
write(msgbuf,'(a)') ' ' |
255 |
call print_message( msgbuf, standardmessageunit, |
256 |
& SQUEEZE_RIGHT , mythid) |
257 |
_END_MASTER( mythid ) |
258 |
#endif |
259 |
|
260 |
return |
261 |
end |