1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_argo_theta.F,v 1.1 2003/11/06 22:10:06 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 |
c == external functions == |
73 |
|
74 |
integer ilnblnk |
75 |
external ilnblnk |
76 |
_RL SW_PTMP |
77 |
external SW_PTMP |
78 |
|
79 |
c == end of interface == |
80 |
|
81 |
jtlo = mybylo(mythid) |
82 |
jthi = mybyhi(mythid) |
83 |
itlo = mybxlo(mythid) |
84 |
ithi = mybxhi(mythid) |
85 |
jmin = 1 |
86 |
jmax = sny |
87 |
imin = 1 |
88 |
imax = snx |
89 |
|
90 |
spval = -2. |
91 |
ztop = -.981*1.027 |
92 |
rl_35= 35.0 |
93 |
rl_0 = 0.0 |
94 |
c-- Read state record from global file. |
95 |
doglobalread = .false. |
96 |
ladinit = .false. |
97 |
|
98 |
#ifdef ALLOW_ARGO_THETA_COST_CONTRIBUTION |
99 |
|
100 |
#ifdef ECCO_VERBOSE |
101 |
write(msgbuf,'(a)') ' ' |
102 |
call print_message( msgbuf, standardmessageunit, |
103 |
& SQUEEZE_RIGHT , mythid) |
104 |
write(msgbuf,'(a,i8.8)') |
105 |
& ' cost_ARGO_THETA: number of records to process =', nmonsrec |
106 |
call print_message( msgbuf, standardmessageunit, |
107 |
& SQUEEZE_RIGHT , mythid) |
108 |
write(msgbuf,'(a)') ' ' |
109 |
call print_message( msgbuf, standardmessageunit, |
110 |
& SQUEEZE_RIGHT , mythid) |
111 |
#endif |
112 |
|
113 |
if (optimcycle .ge. 0) then |
114 |
ilu=ilnblnk( tbarfile ) |
115 |
write(fnametheta(1:80),'(2a,i10.10)') |
116 |
& tbarfile(1:ilu), '.', optimcycle |
117 |
endif |
118 |
|
119 |
fcthread_argot = 0. _d 0 |
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 |
cph call cost_readargot( irec, mythid ) |
131 |
call mdsreadfield( argotfile, cost_iprec, 'RL', nr, argotobs, |
132 |
& irec, mythid) |
133 |
|
134 |
c-- Loop over this thread's tiles. |
135 |
do bj = jtlo,jthi |
136 |
do bi = itlo,ithi |
137 |
c-- Loop over the model layers |
138 |
|
139 |
fctile_argot = 0. _d 0 |
140 |
|
141 |
do k = 1,nr |
142 |
|
143 |
c-- Determine the weights to be used. |
144 |
do j = jmin,jmax |
145 |
do i = imin,imax |
146 |
cph( |
147 |
cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO' |
148 |
cph below statement could be replaced by following |
149 |
cph to make it independnet of Nr: |
150 |
cph |
151 |
cph if ( rC(K) .GT. -1000. ) then |
152 |
cph) |
153 |
c-- set cmask=0 in areas shallower than 1000m |
154 |
if( (argotobs(i,j,k,bi,bj) .ne. 0.).and. |
155 |
& (argotobs(i,j,k,bi,bj) .ge. spval).and. |
156 |
& (_hFacC(i,j,13,bi,bj) .ne. 0.).and. |
157 |
& (_hFacC(i,j,k,bi,bj) .ne. 0.) )then |
158 |
www(i,j) = cosphi(i,j,bi,bj) |
159 |
tmpobs(i,j) = SW_PTMP(rl_35, |
160 |
$ argotobs(i,j,k,bi,bj),ztop*rc(k),rl_0) |
161 |
|
162 |
fctile_argot = fctile_argot + |
163 |
& wtheta2(i,j,k,bi,bj)*www(i,j)* |
164 |
& (tbar(i,j,k,bi,bj)-tmpobs(i,j))* |
165 |
& (tbar(i,j,k,bi,bj)-tmpobs(i,j)) |
166 |
endif |
167 |
enddo |
168 |
enddo |
169 |
c-- End of loop over layers. |
170 |
enddo |
171 |
|
172 |
fcthread_argot = fcthread_argot + fctile_argot |
173 |
objf_argot(bi,bj) = objf_argot(bi,bj) + fctile_argot |
174 |
|
175 |
#ifdef ECCO_VERBOSE |
176 |
write(msgbuf,'(a)') ' ' |
177 |
call print_message( msgbuf, standardmessageunit, |
178 |
& SQUEEZE_RIGHT , mythid) |
179 |
write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)') |
180 |
& ' COST_ARGO_THETA: irec,bi,bj = ',irec,bi,bj |
181 |
call print_message( msgbuf, standardmessageunit, |
182 |
& SQUEEZE_RIGHT , mythid) |
183 |
write(msgbuf,'(a,d22.15)') |
184 |
& ' COST_ARGO_THETA: cost function = ', fctile_argot |
185 |
call print_message( msgbuf, standardmessageunit, |
186 |
& SQUEEZE_RIGHT , mythid) |
187 |
write(msgbuf,'(a)') ' ' |
188 |
call print_message( msgbuf, standardmessageunit, |
189 |
& SQUEEZE_RIGHT , mythid) |
190 |
#endif |
191 |
|
192 |
enddo |
193 |
enddo |
194 |
|
195 |
#ifdef ECCO_VERBOSE |
196 |
c-- Print cost function for all tiles. |
197 |
c _GLOBAL_SUM_R8( fcthread_argot , myThid ) |
198 |
write(msgbuf,'(a)') ' ' |
199 |
call print_message( msgbuf, standardmessageunit, |
200 |
& SQUEEZE_RIGHT , mythid) |
201 |
write(msgbuf,'(a,i8.8)') |
202 |
& ' cost_ARGOT: irec = ',irec |
203 |
call print_message( msgbuf, standardmessageunit, |
204 |
& SQUEEZE_RIGHT , mythid) |
205 |
write(msgbuf,'(a,a,d22.15)') |
206 |
& ' global cost function value', |
207 |
& ' ( ARGO temp. ) = ',fcthread_argot |
208 |
call print_message( msgbuf, standardmessageunit, |
209 |
& SQUEEZE_RIGHT , mythid) |
210 |
write(msgbuf,'(a)') ' ' |
211 |
call print_message( msgbuf, standardmessageunit, |
212 |
& SQUEEZE_RIGHT , mythid) |
213 |
#endif |
214 |
|
215 |
enddo |
216 |
c-- End of second loop over records. |
217 |
|
218 |
#else |
219 |
c-- Do not enter the calculation of the CTD temperature contribution |
220 |
c-- to the final cost function. |
221 |
|
222 |
fctile_argot = 0. _d 0 |
223 |
fcthread_argot = 0. _d 0 |
224 |
|
225 |
crg |
226 |
nrec = 1 |
227 |
crg |
228 |
|
229 |
_BEGIN_MASTER( mythid ) |
230 |
write(msgbuf,'(a)') ' ' |
231 |
call print_message( msgbuf, standardmessageunit, |
232 |
& SQUEEZE_RIGHT , mythid) |
233 |
write(msgbuf,'(a,a)') |
234 |
& ' cost_ARGOT: no contribution of ARGO temperature ', |
235 |
& ' to cost function.' |
236 |
call print_message( msgbuf, standardmessageunit, |
237 |
& SQUEEZE_RIGHT , mythid) |
238 |
write(msgbuf,'(a,a,i9.8)') |
239 |
& ' cost_ARGOT: number of records that would have', |
240 |
& ' been processed: ',nrec |
241 |
call print_message( msgbuf, standardmessageunit, |
242 |
& SQUEEZE_RIGHT , mythid) |
243 |
write(msgbuf,'(a)') ' ' |
244 |
call print_message( msgbuf, standardmessageunit, |
245 |
& SQUEEZE_RIGHT , mythid) |
246 |
_END_MASTER( mythid ) |
247 |
#endif |
248 |
|
249 |
return |
250 |
end |