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

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

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


Revision 1.2 - (show annotations) (download)
Wed Dec 3 23:08:40 2003 UTC (20 years, 7 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint53f_post, checkpoint54a_pre, checkpoint55c_post, checkpoint53b_pre, checkpoint52l_pre, checkpoint52e_pre, hrcube4, hrcube5, checkpoint52j_post, checkpoint52e_post, checkpoint52d_pre, checkpoint53c_post, checkpoint53d_post, checkpoint55d_pre, checkpoint52j_pre, checkpoint54a_post, checkpoint52n_post, checkpoint54b_post, checkpoint54d_post, checkpoint54e_post, checkpoint55b_post, checkpoint52m_post, checkpoint55, checkpoint53a_post, checkpoint55a_post, checkpoint52l_post, checkpoint52k_post, checkpoint54, checkpoint53b_post, checkpoint53, checkpoint52d_post, checkpoint53g_post, checkpoint52f_post, checkpoint54f_post, checkpoint53d_pre, checkpoint54c_post, checkpoint52i_post, checkpoint52i_pre, checkpoint52h_pre, checkpoint52f_pre, hrcube_1, hrcube_2, hrcube_3
Branch point for: netcdf-sm0
Changes since 1.1: +1 -7 lines
adjustments in ecco cost terms:
o ARGO: replace cost_readargo*
o cost_drift: change weights
o cost_hyd: SIO misses cost_sst and doesnt use
            cost_ctd?clim terms
o XBT: active_file was wrong (needs xyz instead of xy)

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_sst.F,v 1.1 2003/11/06 22:10:08 heimbach Exp $
2
3 #include "COST_CPPOPTIONS.h"
4
5
6 subroutine cost_sst(
7 I myiter,
8 I mytime,
9 I mythid
10 & )
11
12 c ==================================================================
13 c SUBROUTINE cost_sst
14 c ==================================================================
15 c
16 c o Evaluate cost function contribution of temperature.
17 c
18 c started: Ralf Giering 17-Jan-2001 copy from cost_theta.F
19 c
20 c ==================================================================
21 c SUBROUTINE cost_sst
22 c ==================================================================
23
24 implicit none
25
26 c == global variables ==
27
28 #include "EEPARAMS.h"
29 #include "SIZE.h"
30 #include "GRID.h"
31 #include "DYNVARS.h"
32
33 #include "cal.h"
34 #include "ecco_cost.h"
35 #include "ctrl.h"
36 #include "ctrl_dummy.h"
37 #include "optim.h"
38
39 c == routine arguments ==
40
41 integer myiter
42 _RL mytime
43 integer mythid
44
45 c == local variables ==
46
47 integer bi,bj
48 integer i,j,k
49 integer itlo,ithi
50 integer jtlo,jthi
51 integer jmin,jmax
52 integer imin,imax
53 integer irec
54 integer levmon
55 integer levoff
56 integer iltheta
57
58 _RL fctile_sst
59 _RL fcthread_sst
60
61 _RL cmask (1-olx:snx+olx,1-oly:sny+oly)
62 _RL spval
63
64 character*(80) fnametheta
65
66 logical doglobalread
67 logical ladinit
68
69 character*(MAX_LEN_MBUF) msgbuf
70
71 c == external functions ==
72
73 integer ilnblnk
74 external ilnblnk
75
76 c == end of interface ==
77
78 jtlo = mybylo(mythid)
79 jthi = mybyhi(mythid)
80 itlo = mybxlo(mythid)
81 ithi = mybxhi(mythid)
82 jmin = 1
83 jmax = sny
84 imin = 1
85 imax = snx
86
87 spval = -9990.
88
89 c-- Read tiled data.
90 doglobalread = .false.
91 ladinit = .false.
92
93 #ifdef ALLOW_SST_COST_CONTRIBUTION
94
95 #ifdef ECCO_VERBOSE
96 _BEGIN_MASTER( mythid )
97 write(msgbuf,'(a)') ' '
98 call print_message( msgbuf, standardmessageunit,
99 & SQUEEZE_RIGHT , mythid)
100 write(msgbuf,'(a,i8.8)')
101 & ' cost_sst: number of records to process = ',nmonsrec
102 call print_message( msgbuf, standardmessageunit,
103 & SQUEEZE_RIGHT , mythid)
104 write(msgbuf,'(a)') ' '
105 call print_message( msgbuf, standardmessageunit,
106 & SQUEEZE_RIGHT , mythid)
107 _END_MASTER( mythid )
108 #endif
109
110 if (optimcycle .ge. 0) then
111 iltheta = ilnblnk( tbarfile )
112 write(fnametheta(1:80),'(2a,i10.10)')
113 & tbarfile(1:iltheta),'.',optimcycle
114 endif
115
116 fcthread_sst = 0. _d 0
117
118 c-- Loop over records.
119 do irec = 1,nmonsrec
120
121 c-- Read time averages and the monthly mean data.
122 call active_read_xyz( fnametheta, tbar, irec,
123 & doglobalread, ladinit,
124 & optimcycle, mythid,
125 & xx_tbar_mean_dummy )
126
127 do bj = jtlo,jthi
128 do bi = itlo,ithi
129
130 c-- Loop over the model layers
131 fctile_sst = 0. _d 0
132 k = 1
133
134 call cost_ReadSSTFields( irec, mythid )
135
136 c-- Determine the mask on weights
137 do j = jmin,jmax
138 do i = imin,imax
139 cmask(i,j) = 1. _d 0
140 if (sstdat(i,j,bi,bj) .eq. 0.) then
141 cmask(i,j) = 0. _d 0
142 endif
143
144 if (sstdat(i,j,bi,bj) .lt. spval) then
145 cmask(i,j) = 0. _d 0
146 endif
147
148 cph(
149 cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO'
150 cph below statement could be replaced by following
151 cph to make it independnet of Nr:
152 cph
153 cph if ( rC(K) .GT. -1000. ) then
154 cph)
155 c set cmask=0 in areas shallower than 1000m
156 if (_hFacC(i,j,13,bi,bj) .eq. 0.) then
157 cmask(i,j) = 0. _d 0
158 endif
159
160 enddo
161 enddo
162
163 c-- Compute cost rel. to monthly SST climatology field.
164 do j = jmin,jmax
165 do i = imin,imax
166 if (_hFacC(i,j,k,bi,bj) .ne. 0.) then
167 fctile_sst = fctile_sst +
168 & wsst(i,j,bi,bj)*cosphi(i,j,bi,bj)*cmask(i,j)*
169 & ( (tbar(i,j,k,bi,bj)-sstdat(i,j,bi,bj))*
170 & (tbar(i,j,k,bi,bj)-sstdat(i,j,bi,bj))*
171 & sstmask(i,j,bi,bj) )
172 endif
173 enddo
174 enddo
175
176
177 fcthread_sst = fcthread_sst + fctile_sst
178 objf_sst(bi,bj) = objf_sst(bi,bj) + fctile_sst
179
180 #ifdef ECCO_VERBOSE
181 c-- Print cost function for each tile in each thread.
182 write(msgbuf,'(a)') ' '
183 call print_message( msgbuf, standardmessageunit,
184 & SQUEEZE_RIGHT , mythid)
185 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
186 & ' cost_sst: irec,bi,bj = ',irec,bi,bj
187 call print_message( msgbuf, standardmessageunit,
188 & SQUEEZE_RIGHT , mythid)
189 write(msgbuf,'(a,d22.15)')
190 & ' cost function (sst) = ',
191 & fctile_sst
192 call print_message( msgbuf, standardmessageunit,
193 & SQUEEZE_RIGHT , mythid)
194 #endif
195
196 enddo
197 enddo
198
199 #ifdef ECCO_VERBOSE
200 c-- Print cost function for all tiles.
201 _GLOBAL_SUM_R8( fcthread_sst , myThid )
202 write(msgbuf,'(a)') ' '
203 call print_message( msgbuf, standardmessageunit,
204 & SQUEEZE_RIGHT , mythid)
205 write(msgbuf,'(a,i8.8)')
206 & ' cost_sst: irec = ',irec
207 call print_message( msgbuf, standardmessageunit,
208 & SQUEEZE_RIGHT , mythid)
209 write(msgbuf,'(a,a,d22.15)')
210 & ' global cost function value',
211 & ' ( SST ) = ',fcthread_sst
212 call print_message( msgbuf, standardmessageunit,
213 & SQUEEZE_RIGHT , mythid)
214 write(msgbuf,'(a)') ' '
215 call print_message( msgbuf, standardmessageunit,
216 & SQUEEZE_RIGHT , mythid)
217 #endif
218
219 enddo
220 c-- End of loop over records.
221
222 #else
223 c-- Do not enter the calculation of the temperature contribution to
224 c-- the final cost function.
225
226 fctile_sst = 0. _d 0
227 fcthread_sst = 0. _d 0
228
229 #ifdef ECCO_VERBOSE
230 _BEGIN_MASTER( mythid )
231 write(msgbuf,'(a)') ' '
232 call print_message( msgbuf, standardmessageunit,
233 & SQUEEZE_RIGHT , mythid)
234 write(msgbuf,'(a,a)')
235 & ' cost_sst: no contribution of temperature field ',
236 & 'to cost function.'
237 call print_message( msgbuf, standardmessageunit,
238 & SQUEEZE_RIGHT , mythid)
239 write(msgbuf,'(a,a,i9.8)')
240 & ' cost_sst: number of records that would have',
241 & ' been processed: ',nmonsrec
242 call print_message( msgbuf, standardmessageunit,
243 & SQUEEZE_RIGHT , mythid)
244 write(msgbuf,'(a)') ' '
245 call print_message( msgbuf, standardmessageunit,
246 & SQUEEZE_RIGHT , mythid)
247 _END_MASTER( mythid )
248 #endif
249
250 #endif
251
252 return
253 end
254

  ViewVC Help
Powered by ViewVC 1.1.22