1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/Attic/cost_argo_salt.F,v 1.1.2.2 2003/06/19 15:21:16 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 |
call cost_readargos( irec, mythid ) |
128 |
|
129 |
c-- Loop over this thread's tiles. |
130 |
do bj = jtlo,jthi |
131 |
do bi = itlo,ithi |
132 |
c-- Loop over the model layers |
133 |
|
134 |
fctile_argos = 0. _d 0 |
135 |
do k = 1,nr |
136 |
|
137 |
c-- |
138 |
cph( |
139 |
cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO' |
140 |
cph below statement could be replaced by following |
141 |
cph to make it independnet of Nr: |
142 |
cph |
143 |
cph if ( rC(K) .GT. -1000. ) then |
144 |
cph) |
145 |
do j = jmin,jmax |
146 |
do i = imin,imax |
147 |
if (argosobs(i,j,k,bi,bj) .ge. spval .and. |
148 |
$ _hFacC(i,j,13,bi,bj) .ne. 0. .and. |
149 |
$ _hFacC(i,j,k,bi,bj) .ne. 0.) then |
150 |
fctile_argos = fctile_argos + |
151 |
& wsalt2(i,j,k,bi,bj)*cosphi(i,j,bi,bj)* |
152 |
& (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))* |
153 |
& (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj)) |
154 |
endif |
155 |
enddo |
156 |
enddo |
157 |
enddo |
158 |
c-- End of loop over layers. |
159 |
|
160 |
fcthread_argos = fcthread_argos + fctile_argos |
161 |
objf_argos(bi,bj) = objf_argos(bi,bj) + fctile_argos |
162 |
|
163 |
#ifdef ECCO_VERBOSE |
164 |
write(msgbuf,'(a)') ' ' |
165 |
call print_message( msgbuf, standardmessageunit, |
166 |
& SQUEEZE_RIGHT , mythid) |
167 |
write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3,i6)') |
168 |
& ' COST_ARGO_SALT: irec,bi,bj = ',irec,bi,bj,nprof |
169 |
call print_message( msgbuf, standardmessageunit, |
170 |
& SQUEEZE_RIGHT , mythid) |
171 |
write(msgbuf,'(a,d22.15)') |
172 |
& ' COST_ARGO_SALT: cost function = ', fctile_argos |
173 |
call print_message( msgbuf, standardmessageunit, |
174 |
& SQUEEZE_RIGHT , mythid) |
175 |
write(msgbuf,'(a)') ' ' |
176 |
call print_message( msgbuf, standardmessageunit, |
177 |
& SQUEEZE_RIGHT , mythid) |
178 |
#endif |
179 |
|
180 |
enddo |
181 |
enddo |
182 |
|
183 |
#ifdef ECCO_VERBOSE |
184 |
c-- Print cost function for all tiles. |
185 |
c _GLOBAL_SUM_R8( fcthread_argos , myThid ) |
186 |
write(msgbuf,'(a)') ' ' |
187 |
call print_message( msgbuf, standardmessageunit, |
188 |
& SQUEEZE_RIGHT , mythid) |
189 |
write(msgbuf,'(a,i8.8)') |
190 |
& ' cost_ARGOT: irec = ',irec |
191 |
call print_message( msgbuf, standardmessageunit, |
192 |
& SQUEEZE_RIGHT , mythid) |
193 |
write(msgbuf,'(a,a,d22.15)') |
194 |
& ' global cost function value', |
195 |
& ' ( ARGO salt. ) = ',fcthread_argos |
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 |
c-- End of second loop over records. |
205 |
|
206 |
#else |
207 |
c-- Do not enter the calculation of the ARGO salinity contribution |
208 |
c-- to the final cost function. |
209 |
|
210 |
fctile_argos = 0. _d 0 |
211 |
fcthread_argos = 0. _d 0 |
212 |
|
213 |
crg |
214 |
nrec = 1 |
215 |
crg |
216 |
|
217 |
_BEGIN_MASTER( mythid ) |
218 |
write(msgbuf,'(a)') ' ' |
219 |
call print_message( msgbuf, standardmessageunit, |
220 |
& SQUEEZE_RIGHT , mythid) |
221 |
write(msgbuf,'(a,a)') |
222 |
& ' cost_ARGOS: no contribution of ARGO salt ', |
223 |
& ' to cost function.' |
224 |
call print_message( msgbuf, standardmessageunit, |
225 |
& SQUEEZE_RIGHT , mythid) |
226 |
write(msgbuf,'(a,a,i9.8)') |
227 |
& ' cost_ARGOS: number of records that would have', |
228 |
& ' been processed: ',nrec |
229 |
call print_message( msgbuf, standardmessageunit, |
230 |
& SQUEEZE_RIGHT , mythid) |
231 |
write(msgbuf,'(a)') ' ' |
232 |
call print_message( msgbuf, standardmessageunit, |
233 |
& SQUEEZE_RIGHT , mythid) |
234 |
_END_MASTER( mythid ) |
235 |
#endif |
236 |
|
237 |
return |
238 |
end |