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

Contents of /MITgcm/pkg/ecco/cost_obcsw.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_obcsw.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_obcsw(
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_obcsw
20 c ==================================================================
21 c
22 c o cost function contribution obc
23 c
24 c ==================================================================
25 c SUBROUTINE cost_obcsw
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_OBCSW_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 j,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 i, ip1
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-oly:sny+oly,nr,nsx,nsy)
87 _RL maskyz (1-oly:sny+oly,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 ip1 = 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_obcsw: 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_obcsw_file )
139 write(fnamefld(1:80),'(2a,i10.10)')
140 & xx_obcsw_file(1:ilfld), '.', optimcycle
141 endif
142
143 c-- Loop over records.
144 do irec = 1,nrec
145
146 call active_read_yz( fnamefld, tmpfield, irec, doglobalread,
147 & ladinit, optimcycle, mythid
148 & , xx_obcsw_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
155 call active_read_yz( 'maskobcsw', maskyz,
156 & iobcs,
157 & doglobalread, ladinit, 0,
158 & mythid, dummy )
159
160 c-- Loop over this thread s tiles.
161 do bj = jtlo,jthi
162 do bi = itlo,ithi
163
164 c-- Determine the weights to be used.
165 fctile = 0. _d 0
166
167 do k = 1, Nr
168 do j = jmin,jmax
169 c i = OB_Iw(j,bi,bj)
170 cgg if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
171 tmpx = tmpfield(j,k,bi,bj)
172 CMM fctile = fctile + wobcsw2(j,k,bi,bj,iobcs)
173 fctile = fctile + wobcsw(k,iobcs)
174 & *tmpx*tmpx*maskyz(j,k,bi,bj)
175 cgg endif
176 CMM if (wobcsw2(j,k,bi,bj,iobcs)*maskyz(j,k,bi,bj).ne.0.)
177 if (wobcsw(k,iobcs)*maskyz(j,k,bi,bj).ne.0.)
178 & num_obcsw(bi,bj) = num_obcsw(bi,bj) + 1. _d 0
179 enddo
180 enddo
181
182 objf_obcsw(bi,bj) = objf_obcsw(bi,bj) + fctile
183 fcthread = fcthread + fctile
184 enddo
185 enddo
186
187 #ifdef ECCO_VERBOSE
188 c-- Print cost function for all tiles.
189 _GLOBAL_SUM_RL( fcthread , myThid )
190 write(msgbuf,'(a)') ' '
191 call print_message( msgbuf, standardmessageunit,
192 & SQUEEZE_RIGHT , mythid)
193 write(msgbuf,'(a,i8.8)')
194 & ' cost_obcsw: irec = ',irec
195 call print_message( msgbuf, standardmessageunit,
196 & SQUEEZE_RIGHT , mythid)
197 write(msgbuf,'(a,a,d22.15)')
198 & ' global cost function value',
199 & ' (obcsw) = ',fcthread
200 call print_message( msgbuf, standardmessageunit,
201 & SQUEEZE_RIGHT , mythid)
202 write(msgbuf,'(a)') ' '
203 call print_message( msgbuf, standardmessageunit,
204 & SQUEEZE_RIGHT , mythid)
205 #endif
206
207 enddo
208 c-- End of loop over records.
209
210 #endif /* ALLOW_OBCSW_COST_CONTRIBUTION */
211
212 return
213 end

  ViewVC Help
Powered by ViewVC 1.1.22