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

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

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


Revision 1.11 - (show annotations) (download)
Tue Sep 18 18:07:39 2012 UTC (11 years, 9 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, checkpoint64, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65d, checkpoint65e
Changes since 1.10: +15 -19 lines
comment out unused code

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

  ViewVC Help
Powered by ViewVC 1.1.22