1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_argo_salt.F,v 1.1 2003/11/06 22:10:06 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine cost_argo_salt( |
7 |
I myiter, |
8 |
I mytime, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cost_argo_salt |
14 |
c ================================================================== |
15 |
c |
16 |
c o Evaluate cost function contribution of ARGO salt 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_salt |
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_argos |
59 |
_RL fcthread_argos |
60 |
_RL www (1-olx:snx+olx,1-oly:sny+oly) |
61 |
_RL wtmp (1-olx:snx+olx,1-oly:sny+oly) |
62 |
_RL tmpobs (1-olx:snx+olx,1-oly:sny+oly) |
63 |
_RL tmpbar (1-olx:snx+olx,1-oly:sny+oly) |
64 |
_RL spval |
65 |
|
66 |
character*(80) fnamesalt |
67 |
|
68 |
logical doglobalread |
69 |
logical ladinit |
70 |
|
71 |
character*(MAX_LEN_MBUF) msgbuf |
72 |
|
73 |
c == external functions == |
74 |
|
75 |
integer ilnblnk |
76 |
external ilnblnk |
77 |
|
78 |
c == end of interface == |
79 |
|
80 |
jtlo = mybylo(mythid) |
81 |
jthi = mybyhi(mythid) |
82 |
itlo = mybxlo(mythid) |
83 |
ithi = mybxhi(mythid) |
84 |
jmin = 1 |
85 |
jmax = sny |
86 |
imin = 1 |
87 |
imax = snx |
88 |
|
89 |
spval = -1. |
90 |
|
91 |
c-- Read state record from global file. |
92 |
doglobalread = .false. |
93 |
ladinit = .false. |
94 |
|
95 |
#ifdef ALLOW_ARGO_SALT_COST_CONTRIBUTION |
96 |
|
97 |
#ifdef ECCO_VERBOSE |
98 |
write(msgbuf,'(a)') ' ' |
99 |
call print_message( msgbuf, standardmessageunit, |
100 |
& SQUEEZE_RIGHT , mythid) |
101 |
write(msgbuf,'(a,i8.8)') |
102 |
& ' cost_ARGO_SALT: number of records to process =', nmonsrec |
103 |
call print_message( msgbuf, standardmessageunit, |
104 |
& SQUEEZE_RIGHT , mythid) |
105 |
write(msgbuf,'(a)') ' ' |
106 |
call print_message( msgbuf, standardmessageunit, |
107 |
& SQUEEZE_RIGHT , mythid) |
108 |
#endif |
109 |
|
110 |
if (optimcycle .ge. 0) then |
111 |
ilu=ilnblnk( sbarfile ) |
112 |
write(fnamesalt(1:80),'(2a,i10.10)') |
113 |
& sbarfile(1:ilu), '.', optimcycle |
114 |
endif |
115 |
|
116 |
fcthread_argos = 0. _d 0 |
117 |
|
118 |
c-- Loop over records. |
119 |
do irec = 1,nmonsrec |
120 |
|
121 |
c-- Read time averages and the monthly mean data. |
122 |
call active_read_xyz( fnamesalt, sbar, irec, |
123 |
& doglobalread, ladinit, |
124 |
& optimcycle, mythid |
125 |
& , xx_sbar_mean_dummy ) |
126 |
|
127 |
cph call cost_readargos( irec, mythid ) |
128 |
call mdsreadfield( argosfile, cost_iprec, 'RL', nr, argosobs, |
129 |
& irec, mythid) |
130 |
|
131 |
c-- Loop over this thread's tiles. |
132 |
do bj = jtlo,jthi |
133 |
do bi = itlo,ithi |
134 |
c-- Loop over the model layers |
135 |
|
136 |
fctile_argos = 0. _d 0 |
137 |
do k = 1,nr |
138 |
|
139 |
c-- |
140 |
cph( |
141 |
cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO' |
142 |
cph below statement could be replaced by following |
143 |
cph to make it independnet of Nr: |
144 |
cph |
145 |
cph if ( rC(K) .GT. -1000. ) then |
146 |
cph) |
147 |
do j = jmin,jmax |
148 |
do i = imin,imax |
149 |
if (argosobs(i,j,k,bi,bj) .ge. spval .and. |
150 |
$ _hFacC(i,j,13,bi,bj) .ne. 0. .and. |
151 |
$ _hFacC(i,j,k,bi,bj) .ne. 0.) then |
152 |
fctile_argos = fctile_argos + |
153 |
& wsalt2(i,j,k,bi,bj)*cosphi(i,j,bi,bj)* |
154 |
& (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))* |
155 |
& (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj)) |
156 |
endif |
157 |
enddo |
158 |
enddo |
159 |
enddo |
160 |
c-- End of loop over layers. |
161 |
|
162 |
fcthread_argos = fcthread_argos + fctile_argos |
163 |
objf_argos(bi,bj) = objf_argos(bi,bj) + fctile_argos |
164 |
|
165 |
#ifdef ECCO_VERBOSE |
166 |
write(msgbuf,'(a)') ' ' |
167 |
call print_message( msgbuf, standardmessageunit, |
168 |
& SQUEEZE_RIGHT , mythid) |
169 |
write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3,i6)') |
170 |
& ' COST_ARGO_SALT: irec,bi,bj = ',irec,bi,bj,nprof |
171 |
call print_message( msgbuf, standardmessageunit, |
172 |
& SQUEEZE_RIGHT , mythid) |
173 |
write(msgbuf,'(a,d22.15)') |
174 |
& ' COST_ARGO_SALT: cost function = ', fctile_argos |
175 |
call print_message( msgbuf, standardmessageunit, |
176 |
& SQUEEZE_RIGHT , mythid) |
177 |
write(msgbuf,'(a)') ' ' |
178 |
call print_message( msgbuf, standardmessageunit, |
179 |
& SQUEEZE_RIGHT , mythid) |
180 |
#endif |
181 |
|
182 |
enddo |
183 |
enddo |
184 |
|
185 |
#ifdef ECCO_VERBOSE |
186 |
c-- Print cost function for all tiles. |
187 |
c _GLOBAL_SUM_R8( fcthread_argos , myThid ) |
188 |
write(msgbuf,'(a)') ' ' |
189 |
call print_message( msgbuf, standardmessageunit, |
190 |
& SQUEEZE_RIGHT , mythid) |
191 |
write(msgbuf,'(a,i8.8)') |
192 |
& ' cost_ARGOT: irec = ',irec |
193 |
call print_message( msgbuf, standardmessageunit, |
194 |
& SQUEEZE_RIGHT , mythid) |
195 |
write(msgbuf,'(a,a,d22.15)') |
196 |
& ' global cost function value', |
197 |
& ' ( ARGO salt. ) = ',fcthread_argos |
198 |
call print_message( msgbuf, standardmessageunit, |
199 |
& SQUEEZE_RIGHT , mythid) |
200 |
write(msgbuf,'(a)') ' ' |
201 |
call print_message( msgbuf, standardmessageunit, |
202 |
& SQUEEZE_RIGHT , mythid) |
203 |
#endif |
204 |
|
205 |
enddo |
206 |
c-- End of second loop over records. |
207 |
|
208 |
#else |
209 |
c-- Do not enter the calculation of the ARGO salinity contribution |
210 |
c-- to the final cost function. |
211 |
|
212 |
fctile_argos = 0. _d 0 |
213 |
fcthread_argos = 0. _d 0 |
214 |
|
215 |
crg |
216 |
nrec = 1 |
217 |
crg |
218 |
|
219 |
_BEGIN_MASTER( mythid ) |
220 |
write(msgbuf,'(a)') ' ' |
221 |
call print_message( msgbuf, standardmessageunit, |
222 |
& SQUEEZE_RIGHT , mythid) |
223 |
write(msgbuf,'(a,a)') |
224 |
& ' cost_ARGOS: no contribution of ARGO salt ', |
225 |
& ' to cost function.' |
226 |
call print_message( msgbuf, standardmessageunit, |
227 |
& SQUEEZE_RIGHT , mythid) |
228 |
write(msgbuf,'(a,a,i9.8)') |
229 |
& ' cost_ARGOS: number of records that would have', |
230 |
& ' been processed: ',nrec |
231 |
call print_message( msgbuf, standardmessageunit, |
232 |
& SQUEEZE_RIGHT , mythid) |
233 |
write(msgbuf,'(a)') ' ' |
234 |
call print_message( msgbuf, standardmessageunit, |
235 |
& SQUEEZE_RIGHT , mythid) |
236 |
_END_MASTER( mythid ) |
237 |
#endif |
238 |
|
239 |
return |
240 |
end |