/[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.11 - (show annotations) (download)
Fri Aug 10 19:45:25 2012 UTC (11 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63r, checkpoint63s, checkpoint64, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65d, checkpoint65e
Changes since 1.10: +2 -2 lines
include ECCO_OPTIONS.h instead of COST_CPPOPTIONS.h

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_argo_salt.F,v 1.10 2012/08/06 20:41:54 heimbach Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5
6
7 subroutine cost_argo_salt(
8 I myiter,
9 I mytime,
10 I mythid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE cost_argo_salt
15 c ==================================================================
16 c
17 c o Evaluate cost function contribution of ARGO salt data.
18 c
19 c started: Elisabeth Remy eremy@ucsd.edu 30-Aug-2000
20 c
21 c
22 c ==================================================================
23 c SUBROUTINE cost_argo_salt
24 c ==================================================================
25
26 implicit none
27
28 c == global variables ==
29
30 #include "EEPARAMS.h"
31 #include "SIZE.h"
32 #include "GRID.h"
33 #include "DYNVARS.h"
34
35 #include "cal.h"
36 #include "ecco_cost.h"
37 #include "CTRL_SIZE.h"
38 #include "ctrl.h"
39 #include "ctrl_dummy.h"
40 #include "optim.h"
41
42 c == routine arguments ==
43
44 integer myiter
45 _RL mytime
46 integer mythid
47
48 c == local variables ==
49
50 integer bi,bj
51 integer i,j,k
52 integer itlo,ithi
53 integer jtlo,jthi
54 integer jmin,jmax
55 integer imin,imax
56 integer nrec
57 integer irec
58 integer ilu
59
60 _RL fctile_argos
61 _RL fcthread_argos
62 _RL www (1-olx:snx+olx,1-oly:sny+oly)
63 _RL wtmp (1-olx:snx+olx,1-oly:sny+oly)
64 _RL tmpobs (1-olx:snx+olx,1-oly:sny+oly)
65 _RL tmpbar (1-olx:snx+olx,1-oly:sny+oly)
66 _RL spval
67 _RL spmax
68
69 character*(80) fnamesalt
70
71 logical doglobalread
72 logical ladinit
73
74 character*(MAX_LEN_MBUF) msgbuf
75
76 cnew(
77 integer il
78 integer mody, modm
79 integer iyear, imonth
80 character*(80) fnametmp
81 logical exst
82 cnew)
83
84 c == external functions ==
85
86 integer ilnblnk
87 external ilnblnk
88
89 c == end of interface ==
90
91 jtlo = mybylo(mythid)
92 jthi = mybyhi(mythid)
93 itlo = mybxlo(mythid)
94 ithi = mybxhi(mythid)
95 jmin = 1
96 jmax = sny
97 imin = 1
98 imax = snx
99
100 spval = 25.
101 spmax = 40.
102
103 c-- Read state record from global file.
104 doglobalread = .false.
105 ladinit = .false.
106
107 #ifdef ALLOW_ARGO_SALT_COST_CONTRIBUTION
108
109 if (optimcycle .ge. 0) then
110 ilu=ilnblnk( sbarfile )
111 write(fnamesalt(1:80),'(2a,i10.10)')
112 & sbarfile(1:ilu),'.', optimcycle
113 endif
114
115 fcthread_argos = 0. _d 0
116
117 cnew(
118 mody = modelstartdate(1)/10000
119 modm = modelstartdate(1)/100 - mody*100
120 cnew)
121
122 c-- Loop over records.
123 do irec = 1,nmonsrec
124
125 c-- Read time averages and the monthly mean data.
126 call active_read_xyz( fnamesalt, sbar, irec,
127 & doglobalread, ladinit,
128 & optimcycle, mythid
129 & , xx_sbar_mean_dummy )
130
131 cnew(
132 iyear = mody + INT((modm-1+irec-1)/12)
133 imonth = 1 + MOD(modm-1+irec-1,12)
134 il=ilnblnk(argosfile)
135 write(fnametmp(1:80),'(2a,i4)')
136 & argosfile(1:il), '_', iyear
137 inquire( file=fnametmp, exist=exst )
138 if (.NOT. exst) then
139 write(fnametmp(1:80),'(a)') argosfile(1:il)
140 imonth = irec
141 endif
142
143 call mdsreadfield( fnametmp, cost_iprec, 'RL', nr, argosobs,
144 & imonth, mythid)
145 cnew)
146
147 c-- Loop over this thread tiles.
148 do bj = jtlo,jthi
149 do bi = itlo,ithi
150 c-- Loop over the model layers
151
152 fctile_argos = 0. _d 0
153 do k = 1,nr
154
155 c--
156 cph(
157 cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO'
158 cph below statement could be replaced by following
159 cph to make it independnet of Nr:
160 cph
161 cph if ( rC(K) .GT. -1000. ) then
162 cph)
163 do j = jmin,jmax
164 do i = imin,imax
165 if ( (argosobs(i,j,k,bi,bj) .ge. spval) .and.
166 $ (argosobs(i,j,k,bi,bj) .lt. spmax) .and.
167 cph $ (_hFacC(i,j,13,bi,bj) .ne. 0.) .and.
168 $ (_hFacC(i,j,k,bi,bj) .ne. 0.) ) then
169 fctile_argos = fctile_argos +
170 & wsalt2(i,j,k,bi,bj)*cosphi(i,j,bi,bj)*
171 & (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))*
172 & (sbar(i,j,k,bi,bj)-argosobs(i,j,k,bi,bj))
173 if ( wsalt2(i,j,k,bi,bj)*cosphi(i,j,bi,bj) .ne. 0. )
174 & num_argos(bi,bj) = num_argos(bi,bj) + 1. _d 0
175 endif
176 enddo
177 enddo
178 enddo
179 c-- End of loop over layers.
180
181 fcthread_argos = fcthread_argos + fctile_argos
182 objf_argos(bi,bj) = objf_argos(bi,bj) + fctile_argos
183
184 #ifdef ECCO_VERBOSE
185 write(msgbuf,'(a)') ' '
186 call print_message( msgbuf, standardmessageunit,
187 & SQUEEZE_RIGHT , mythid)
188 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3,i6)')
189 & ' COST_ARGO_SALT: irec,bi,bj = ',irec,bi,bj
190 call print_message( msgbuf, standardmessageunit,
191 & SQUEEZE_RIGHT , mythid)
192 write(msgbuf,'(a,d22.15)')
193 & ' COST_ARGO_SALT: cost function = ', fctile_argos
194 call print_message( msgbuf, standardmessageunit,
195 & SQUEEZE_RIGHT , mythid)
196 write(msgbuf,'(a)') ' '
197 call print_message( msgbuf, standardmessageunit,
198 & SQUEEZE_RIGHT , mythid)
199 #endif
200
201 enddo
202 enddo
203
204 #ifdef ECCO_VERBOSE
205 c-- Print cost function for all tiles.
206 c _GLOBAL_SUM_RL( fcthread_argos , myThid )
207 write(msgbuf,'(a)') ' '
208 call print_message( msgbuf, standardmessageunit,
209 & SQUEEZE_RIGHT , mythid)
210 write(msgbuf,'(a,i8.8)')
211 & ' cost_ARGOT: irec = ',irec
212 call print_message( msgbuf, standardmessageunit,
213 & SQUEEZE_RIGHT , mythid)
214 write(msgbuf,'(a,a,d22.15)')
215 & ' global cost function value',
216 & ' ( ARGO salt. ) = ',fcthread_argos
217 call print_message( msgbuf, standardmessageunit,
218 & SQUEEZE_RIGHT , mythid)
219 write(msgbuf,'(a)') ' '
220 call print_message( msgbuf, standardmessageunit,
221 & SQUEEZE_RIGHT , mythid)
222 #endif
223
224 enddo
225 c-- End of second loop over records.
226
227 #else
228 c-- Do not enter the calculation of the ARGO salinity contribution
229 c-- to the final cost function.
230
231 fctile_argos = 0. _d 0
232 fcthread_argos = 0. _d 0
233
234 crg
235 nrec = 1
236 crg
237
238 _BEGIN_MASTER( mythid )
239 write(msgbuf,'(a)') ' '
240 call print_message( msgbuf, standardmessageunit,
241 & SQUEEZE_RIGHT , mythid)
242 write(msgbuf,'(a,a)')
243 & ' cost_ARGOS: no contribution of ARGO salt ',
244 & ' to cost function.'
245 call print_message( msgbuf, standardmessageunit,
246 & SQUEEZE_RIGHT , mythid)
247 write(msgbuf,'(a,a,i9.8)')
248 & ' cost_ARGOS: number of records that would have',
249 & ' been processed: ',nrec
250 call print_message( msgbuf, standardmessageunit,
251 & SQUEEZE_RIGHT , mythid)
252 write(msgbuf,'(a)') ' '
253 call print_message( msgbuf, standardmessageunit,
254 & SQUEEZE_RIGHT , mythid)
255 _END_MASTER( mythid )
256 #endif
257
258 return
259 end

  ViewVC Help
Powered by ViewVC 1.1.22