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

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

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


Revision 1.4 - (show annotations) (download)
Mon Mar 28 19:40:59 2005 UTC (19 years, 3 months ago) by heimbach
Branch: MAIN
Changes since 1.3: +5 -2 lines
Updating ECCO package
o clean up some masks to avoid dependencies
o add some crude limiters
o remove some print * output

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_argo_salt.F,v 1.3 2004/10/11 16:38:53 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 _RL spmax
66
67 character*(80) fnamesalt
68
69 logical doglobalread
70 logical ladinit
71
72 character*(MAX_LEN_MBUF) msgbuf
73
74 cnew(
75 integer il
76 integer mody, modm
77 integer iyear, imonth
78 character*(80) fnametmp
79 logical exst
80 cnew)
81
82 c == external functions ==
83
84 integer ilnblnk
85 external ilnblnk
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 = 25.
99 spmax = 40.
100
101 c-- Read state record from global file.
102 doglobalread = .false.
103 ladinit = .false.
104
105 #ifdef ALLOW_ARGO_SALT_COST_CONTRIBUTION
106
107 if (optimcycle .ge. 0) then
108 ilu=ilnblnk( sbarfile )
109 write(fnamesalt(1:80),'(2a,i10.10)')
110 & sbarfile(1:ilu),'.', optimcycle
111 endif
112
113 fcthread_argos = 0. _d 0
114
115 cnew(
116 mody = modelstartdate(1)/10000
117 modm = modelstartdate(1)/100 - mody*100
118 cnew)
119
120 c-- Loop over records.
121 do irec = 1,nmonsrec
122
123 c-- Read time averages and the monthly mean data.
124 call active_read_xyz( fnamesalt, sbar, irec,
125 & doglobalread, ladinit,
126 & optimcycle, mythid
127 & , xx_sbar_mean_dummy )
128
129 cnew(
130 iyear = mody + INT((modm-1+irec-1)/12)
131 imonth = 1 + MOD(modm-1+irec-1,12)
132 il=ilnblnk(argosfile)
133 write(fnametmp(1:80),'(2a,i4)')
134 & argosfile(1:il), '_', iyear
135 inquire( file=fnametmp, exist=exst )
136 if (.NOT. exst) then
137 write(fnametmp(1:80),'(a)') argosfile(1:il)
138 imonth = irec
139 endif
140
141 call mdsreadfield( fnametmp, cost_iprec, 'RL', nr, argosobs,
142 & imonth, mythid)
143 cnew)
144
145 c-- Loop over this thread's tiles.
146 do bj = jtlo,jthi
147 do bi = itlo,ithi
148 c-- Loop over the model layers
149
150 fctile_argos = 0. _d 0
151 do k = 1,nr
152
153 c--
154 cph(
155 cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO'
156 cph below statement could be replaced by following
157 cph to make it independnet of Nr:
158 cph
159 cph if ( rC(K) .GT. -1000. ) then
160 cph)
161 do j = jmin,jmax
162 do i = imin,imax
163 if (argosobs(i,j,k,bi,bj) .ge. spval .and.
164 $ argosobs(i,j,k,bi,bj) .lt. spmax .and.
165 $ _hFacC(i,j,13,bi,bj) .ne. 0. .and.
166 $ _hFacC(i,j,k,bi,bj) .ne. 0.) then
167 fctile_argos = fctile_argos +
168 & wsalt2(i,j,k,bi,bj)*cosphi(i,j,bi,bj)*
169 & (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))*
170 & (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))
171 endif
172 enddo
173 enddo
174 enddo
175 c-- End of loop over layers.
176
177 fcthread_argos = fcthread_argos + fctile_argos
178 objf_argos(bi,bj) = objf_argos(bi,bj) + fctile_argos
179
180 #ifdef ECCO_VERBOSE
181 write(msgbuf,'(a)') ' '
182 call print_message( msgbuf, standardmessageunit,
183 & SQUEEZE_RIGHT , mythid)
184 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3,i6)')
185 & ' COST_ARGO_SALT: irec,bi,bj = ',irec,bi,bj
186 call print_message( msgbuf, standardmessageunit,
187 & SQUEEZE_RIGHT , mythid)
188 write(msgbuf,'(a,d22.15)')
189 & ' COST_ARGO_SALT: cost function = ', fctile_argos
190 call print_message( msgbuf, standardmessageunit,
191 & SQUEEZE_RIGHT , mythid)
192 write(msgbuf,'(a)') ' '
193 call print_message( msgbuf, standardmessageunit,
194 & SQUEEZE_RIGHT , mythid)
195 #endif
196
197 enddo
198 enddo
199
200 #ifdef ECCO_VERBOSE
201 c-- Print cost function for all tiles.
202 c _GLOBAL_SUM_R8( fcthread_argos , myThid )
203 write(msgbuf,'(a)') ' '
204 call print_message( msgbuf, standardmessageunit,
205 & SQUEEZE_RIGHT , mythid)
206 write(msgbuf,'(a,i8.8)')
207 & ' cost_ARGOT: irec = ',irec
208 call print_message( msgbuf, standardmessageunit,
209 & SQUEEZE_RIGHT , mythid)
210 write(msgbuf,'(a,a,d22.15)')
211 & ' global cost function value',
212 & ' ( ARGO salt. ) = ',fcthread_argos
213 call print_message( msgbuf, standardmessageunit,
214 & SQUEEZE_RIGHT , mythid)
215 write(msgbuf,'(a)') ' '
216 call print_message( msgbuf, standardmessageunit,
217 & SQUEEZE_RIGHT , mythid)
218 #endif
219
220 enddo
221 c-- End of second loop over records.
222
223 #else
224 c-- Do not enter the calculation of the ARGO salinity contribution
225 c-- to the final cost function.
226
227 fctile_argos = 0. _d 0
228 fcthread_argos = 0. _d 0
229
230 crg
231 nrec = 1
232 crg
233
234 _BEGIN_MASTER( mythid )
235 write(msgbuf,'(a)') ' '
236 call print_message( msgbuf, standardmessageunit,
237 & SQUEEZE_RIGHT , mythid)
238 write(msgbuf,'(a,a)')
239 & ' cost_ARGOS: no contribution of ARGO salt ',
240 & ' to cost function.'
241 call print_message( msgbuf, standardmessageunit,
242 & SQUEEZE_RIGHT , mythid)
243 write(msgbuf,'(a,a,i9.8)')
244 & ' cost_ARGOS: number of records that would have',
245 & ' been processed: ',nrec
246 call print_message( msgbuf, standardmessageunit,
247 & SQUEEZE_RIGHT , mythid)
248 write(msgbuf,'(a)') ' '
249 call print_message( msgbuf, standardmessageunit,
250 & SQUEEZE_RIGHT , mythid)
251 _END_MASTER( mythid )
252 #endif
253
254 return
255 end

  ViewVC Help
Powered by ViewVC 1.1.22