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

Contents of /MITgcm/pkg/ecco/cost_obcsn.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_obcsn.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_OBCSN
8 C !INTERFACE:
9 subroutine cost_obcsn(
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_obcsn
20 c ==================================================================
21 c
22 c o cost function contribution obc
23 c
24 c ==================================================================
25 c SUBROUTINE cost_obcsn
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_OBCSN_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 = 0
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_obcsn: 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_obcsn_file )
139 write(fnamefld(1:80),'(2a,i10.10)')
140 & xx_obcsn_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_obcsn_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_xz( 'maskobcsn', maskxz,
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 i = imin,imax
169 c j = OB_Jn(I,bi,bj)
170 cgg if (maskS(i,j+jp1,k,bi,bj) .ne. 0.) then
171 tmpx = tmpfield(i,k,bi,bj)
172 CMM fctile = fctile + wobcsn2(i,k,bi,bj,iobcs)
173 fctile = fctile + wobcsn(k,iobcs)
174 & *tmpx*tmpx*maskxz(i,k,bi,bj)
175 cgg endif
176 CMM if (wobcsn2(i,k,bi,bj,iobcs)*maskxz(i,k,bi,bj).ne.0.)
177 if (wobcsn(k,iobcs)*maskxz(i,k,bi,bj).ne.0.)
178 & num_obcsn(bi,bj) = num_obcsn(bi,bj) + 1. _d 0
179 cgg print*,'S fctile',fctile
180 enddo
181 enddo
182
183 objf_obcsn(bi,bj) = objf_obcsn(bi,bj) + fctile
184 fcthread = fcthread + fctile
185 enddo
186 enddo
187
188 #ifdef ECCO_VERBOSE
189 c-- Print cost function for all tiles.
190 _GLOBAL_SUM_RL( fcthread , myThid )
191 write(msgbuf,'(a)') ' '
192 call print_message( msgbuf, standardmessageunit,
193 & SQUEEZE_RIGHT , mythid)
194 write(msgbuf,'(a,i8.8)')
195 & ' cost_obcsn: irec = ',irec
196 call print_message( msgbuf, standardmessageunit,
197 & SQUEEZE_RIGHT , mythid)
198 write(msgbuf,'(a,a,d22.15)')
199 & ' global cost function value',
200 & ' (obcsn) = ',fcthread
201 call print_message( msgbuf, standardmessageunit,
202 & SQUEEZE_RIGHT , mythid)
203 write(msgbuf,'(a)') ' '
204 call print_message( msgbuf, standardmessageunit,
205 & SQUEEZE_RIGHT , mythid)
206 #endif
207
208 enddo
209 c-- End of loop over records.
210
211 #endif /* ALLOW_OBCSN_COST_CONTRIBUTION */
212
213 return
214 end

  ViewVC Help
Powered by ViewVC 1.1.22