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

Annotation of /MITgcm/pkg/ecco/cost_sss.F

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


Revision 1.2 - (hide 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 heimbach 1.2 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_sss.F,v 1.1 2003/11/06 22:10:08 heimbach Exp $
2 heimbach 1.1
3     #include "COST_CPPOPTIONS.h"
4    
5    
6     subroutine cost_sss(
7     I myiter,
8     I mytime,
9     I mythid
10     & )
11    
12     c ==================================================================
13     c SUBROUTINE cost_sss
14     c ==================================================================
15     c
16     c o Evaluate cost function contribution of sea surface salinity.
17     c
18     c started: Elisabeth Remy 19-mar-2001 copy from cost_sst.F
19     c
20     c ==================================================================
21     c SUBROUTINE cost_sss
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 ilsalt
57    
58     _RL fctile_sss
59     _RL fcthread_sss
60    
61     _RL cmask (1-olx:snx+olx,1-oly:sny+oly)
62     _RL spval
63    
64     character*(80) fnamesalt
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 = -9.0
88    
89     c-- Read tiled data.
90     doglobalread = .false.
91     ladinit = .false.
92    
93     #ifdef ALLOW_SSS_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_sss: 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     ilsalt = ilnblnk( sbarfile )
112     write(fnamesalt(1:80),'(2a,i10.10)')
113     & sbarfile(1:ilsalt),'.',optimcycle
114     endif
115    
116     fcthread_sss = 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( fnamesalt, sbar, irec,
123     & doglobalread, ladinit,
124     & optimcycle, mythid,
125     & xx_sbar_mean_dummy )
126    
127     do bj = jtlo,jthi
128     do bi = itlo,ithi
129    
130     c-- Loop over the model layers
131     fctile_sss = 0. _d 0
132     k = 1
133    
134     call cost_ReadSSSFields( 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 (sssdat(i,j,bi,bj) .eq. 0.) then
141     cmask(i,j) = 0. _d 0
142     endif
143    
144     if (sssdat(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 SSS field.
164     do j = jmin,jmax
165     do i = imin,imax
166     if (_hFacC(i,j,k,bi,bj) .ne. 0.) then
167     fctile_sss = fctile_sss +
168     & wsss(i,j,bi,bj)*cosphi(i,j,bi,bj)*cmask(i,j)*
169     & ( (sbar(i,j,k,bi,bj)-sssdat(i,j,bi,bj))*
170     & (sbar(i,j,k,bi,bj)-sssdat(i,j,bi,bj))*
171     & sssmask(i,j,bi,bj) )
172     endif
173     enddo
174     enddo
175    
176    
177     fcthread_sss = fcthread_sss + fctile_sss
178     objf_sss(bi,bj) = objf_sss(bi,bj) + fctile_sss
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_sss: 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 (sss) = ',
191     & fctile_sss
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_sss , myThid )
202     write(msgbuf,'(a)') ' '
203     call print_message( msgbuf, standardmessageunit,
204     & SQUEEZE_RIGHT , mythid)
205     write(msgbuf,'(a,i8.8)')
206     & ' cost_sss: 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_sss
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_sss = 0. _d 0
227     fcthread_sss = 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_sss: 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_sss: 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