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

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

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


Revision 1.12 - (show annotations) (download)
Mon Oct 20 03:16:12 2014 UTC (9 years, 7 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65g, HEAD
Changes since 1.11: +4 -1 lines
- CTRL_OPTIONS.h is needed when including ctrl.h, etc

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_obcse.F,v 1.11 2014/10/09 00:50:16 gforget Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5 #ifdef ALLOW_CTRL
6 # include "CTRL_OPTIONS.h"
7 #endif
8
9 CBOP
10 C !ROUTINE: COST_OBCSE
11 C !INTERFACE:
12 subroutine cost_obcse(
13 I myiter,
14 I mytime,
15 I startrec,
16 I endrec,
17 I mythid
18 & )
19
20 C !DESCRIPTION: \bv
21 c ==================================================================
22 c SUBROUTINE cost_obcse
23 c ==================================================================
24 c
25 c o cost function contribution obc
26 c
27 c ==================================================================
28 c SUBROUTINE cost_obcse
29 c ==================================================================
30 C \ev
31
32 C !USES:
33
34 implicit none
35
36 c == global variables ==
37
38 #include "EEPARAMS.h"
39 #include "SIZE.h"
40 #include "PARAMS.h"
41 #include "GRID.h"
42 c#ifdef ALLOW_OBCS
43 c# include "OBCS_GRID.h"
44 c#endif
45
46 #ifdef ALLOW_CAL
47 # include "cal.h"
48 #endif
49 #ifdef ALLOW_CTRL
50 # include "CTRL_SIZE.h"
51 # include "ctrl.h"
52 # include "ctrl_dummy.h"
53 # include "optim.h"
54 # include "CTRL_OBCS.h"
55 #endif
56
57 C !INPUT/OUTPUT PARAMETERS:
58 c == routine arguments ==
59
60 integer myiter
61 _RL mytime
62 integer mythid
63 integer startrec
64 integer endrec
65
66 #if (defined (ALLOW_CTRL) && defined (ALLOW_OBCS))
67
68 #ifdef ALLOW_OBCSE_COST_CONTRIBUTION
69
70 c == external functions ==
71 integer ilnblnk
72 external ilnblnk
73
74 C !LOCAL VARIABLES:
75 c == local variables ==
76
77 integer bi,bj
78 integer j,k
79 integer itlo,ithi
80 integer jtlo,jthi
81 integer jmin,jmax
82 integer imin,imax
83 integer irec
84 integer il
85 integer iobcs
86 c integer i, ip1
87 integer nrec
88 integer ilfld
89 integer igg
90
91 _RL fctile
92 _RL fcthread
93 _RL dummy
94 _RL gg
95 _RL tmpx
96 cgg(
97 _RL tmpfield (1-oly:sny+oly,nr,nsx,nsy)
98 _RL maskyz (1-oly:sny+oly,nr,nsx,nsy)
99
100 character*(80) fnamefld
101
102 logical doglobalread
103 logical ladinit
104
105 #ifdef ECCO_VERBOSE
106 character*(MAX_LEN_MBUF) msgbuf
107 #endif
108 c == end of interface ==
109 CEOP
110
111 jtlo = mybylo(mythid)
112 jthi = mybyhi(mythid)
113 itlo = mybxlo(mythid)
114 ithi = mybxhi(mythid)
115 jmin = 1
116 jmax = sny
117 imin = 1
118 imax = snx
119
120 c-- Read tiled data.
121 doglobalread = .false.
122 ladinit = .false.
123
124 c Number of records to be used.
125 nrec = endrec-startrec+1
126
127 c ip1 = 1
128 fcthread = 0. _d 0
129
130 #ifdef ECCO_VERBOSE
131 _BEGIN_MASTER( mythid )
132 write(msgbuf,'(a)') ' '
133 call print_message( msgbuf, standardmessageunit,
134 & SQUEEZE_RIGHT , mythid)
135 write(msgbuf,'(a)') ' '
136 call print_message( msgbuf, standardmessageunit,
137 & SQUEEZE_RIGHT , mythid)
138 write(msgbuf,'(a,i9.8)')
139 & ' cost_obcse: number of records to process: ',nrec
140 call print_message( msgbuf, standardmessageunit,
141 & SQUEEZE_RIGHT , mythid)
142 write(msgbuf,'(a)') ' '
143 call print_message( msgbuf, standardmessageunit,
144 & SQUEEZE_RIGHT , mythid)
145 _END_MASTER( mythid )
146 #endif
147
148 if (optimcycle .ge. 0) then
149 ilfld=ilnblnk( xx_obcse_file )
150 write(fnamefld(1:80),'(2a,i10.10)')
151 & xx_obcse_file(1:ilfld), '.', optimcycle
152 endif
153
154 c-- Loop over records.
155 do irec = 1,nrec
156
157 call active_read_yz( fnamefld, tmpfield, irec, doglobalread,
158 & ladinit, optimcycle, mythid
159 & , xx_obcse_dummy )
160
161 cgg Need to solve for iobcs would have been.
162 gg = (irec-1)/nobcs
163 igg = int(gg)
164 iobcs = irec - igg*nobcs
165
166 call active_read_yz( 'maskobcse', maskyz,
167 & iobcs,
168 & doglobalread, ladinit, 0,
169 & mythid, dummy )
170
171 c-- Loop over this thread s tiles.
172 do bj = jtlo,jthi
173 do bi = itlo,ithi
174
175 c-- Determine the weights to be used.
176 fctile = 0. _d 0
177
178 do k = 1, Nr
179 do j = jmin,jmax
180 c i = OB_Iw(j,bi,bj)
181 cgg if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
182 tmpx = tmpfield(j,k,bi,bj)
183 CMM fctile = fctile + wobcse2(j,k,bi,bj,iobcs)
184 fctile = fctile + wobcse(k,iobcs)
185 & *tmpx*tmpx*maskyz(j,k,bi,bj)
186 cgg endif
187 CMM if (wobcsw2(j,k,bi,bj,iobcs)*maskyz(j,k,bi,bj).ne.0.)
188 if (wobcse(k,iobcs)*maskyz(j,k,bi,bj).ne.0.)
189 & num_obcse(bi,bj) = num_obcse(bi,bj) + 1. _d 0
190 enddo
191 enddo
192
193 objf_obcse(bi,bj) = objf_obcse(bi,bj) + fctile
194 fcthread = fcthread + fctile
195 enddo
196 enddo
197
198 #ifdef ECCO_VERBOSE
199 c-- Print cost function for all tiles.
200 _GLOBAL_SUM_RL( fcthread , myThid )
201 write(msgbuf,'(a)') ' '
202 call print_message( msgbuf, standardmessageunit,
203 & SQUEEZE_RIGHT , mythid)
204 write(msgbuf,'(a,i8.8)')
205 & ' cost_obcse: irec = ',irec
206 call print_message( msgbuf, standardmessageunit,
207 & SQUEEZE_RIGHT , mythid)
208 write(msgbuf,'(a,a,d22.15)')
209 & ' global cost function value',
210 & ' (obcse) = ',fcthread
211 call print_message( msgbuf, standardmessageunit,
212 & SQUEEZE_RIGHT , mythid)
213 write(msgbuf,'(a)') ' '
214 call print_message( msgbuf, standardmessageunit,
215 & SQUEEZE_RIGHT , mythid)
216 #endif
217
218 enddo
219 c-- End of loop over records.
220
221 #endif /* ALLOW_OBCSE_COST_CONTRIBUTION */
222
223 #endif /* ALLOW_CTRL and ALLOW_OBCS */
224
225 return
226 end

  ViewVC Help
Powered by ViewVC 1.1.22