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

Contents of /MITgcm/pkg/cost/cost_sss.F

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


Revision 1.1.2.1 - (show annotations) (download)
Tue Feb 5 20:23:57 2002 UTC (22 years, 4 months ago) by heimbach
Branch: ecco-branch
CVS Tags: ecco_c44_e16, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5
Changes since 1.1: +224 -0 lines
Starting from ecco-branch, replacing packages
cost, ctrl, ecco, obcs by ECCO packages.
Will create tag ecco-branch-mod1 after this modif.

1 C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cost/cost_sss.F,v 1.1 2001/05/18 16:09:17 heimbach Exp $
2
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 "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 character*(80) fnamesalt
62
63 logical doglobalread
64 logical ladinit
65
66 character*(MAX_LEN_MBUF) msgbuf
67
68 c == external functions ==
69
70 integer ilnblnk
71 external ilnblnk
72
73 c == end of interface ==
74
75 jtlo = mybylo(mythid)
76 jthi = mybyhi(mythid)
77 itlo = mybxlo(mythid)
78 ithi = mybxhi(mythid)
79 jmin = 1
80 jmax = sny
81 imin = 1
82 imax = snx
83
84 c-- Read tiled data.
85 doglobalread = .false.
86 ladinit = .true.
87
88 #ifdef ALLOW_SSS_COST_CONTRIBUTION
89
90 #ifdef ECCO_VERBOSE
91 _BEGIN_MASTER( mythid )
92 write(msgbuf,'(a)') ' '
93 call print_message( msgbuf, standardmessageunit,
94 & SQUEEZE_RIGHT , mythid)
95 write(msgbuf,'(a,i8.8)')
96 & ' cost_sss: number of records to process = ',nmonsrec
97 call print_message( msgbuf, standardmessageunit,
98 & SQUEEZE_RIGHT , mythid)
99 write(msgbuf,'(a)') ' '
100 call print_message( msgbuf, standardmessageunit,
101 & SQUEEZE_RIGHT , mythid)
102 _END_MASTER( mythid )
103 #endif
104
105 if (optimcycle .ge. 0) then
106 ilsalt = ilnblnk( sbarfile )
107 write(fnamesalt(1:80),'(2a,i10.10)')
108 & sbarfile(1:ilsalt),'.',optimcycle
109 else
110 print*
111 print*,' cost_sss: optimcycle has a wrong value.'
112 print*,' optimcycle = ',optimcycle
113 print*
114 stop ' ... stopped in cost_sss.'
115 endif
116
117 fcthread_sss = 0. _d 0
118
119 c-- Loop over records.
120 do irec = 1,nmonsrec
121
122 c-- Read time averages and the monthly mean data.
123 call active_read_xyz( fnamesalt, sbar, irec,
124 & doglobalread, ladinit,
125 & optimcycle, mythid,
126 & xx_salt_dummy )
127
128 do bj = jtlo,jthi
129 do bi = itlo,ithi
130
131 c-- Loop over the model layers
132 fctile_sss = 0. _d 0
133 k = 1
134
135 c-- Compute cost rel. to monthly SSS field.
136 call cost_ReadSSSFields( irec, mythid )
137 do j = jmin,jmax
138 do i = imin,imax
139 if (_hFacC(i,j,k,bi,bj) .ne. 0.) then
140 fctile_sss = fctile_sss +
141 & wsss(i,j,bi,bj)*cosphi(i,j,bi,bj)*
142 & ( (sbar(i,j,k,bi,bj)-sssdat(i,j,bi,bj))*
143 & (sbar(i,j,k,bi,bj)-sssdat(i,j,bi,bj))*
144 & sssmask(i,j,bi,bj) )
145 endif
146 enddo
147 enddo
148
149
150 fcthread_sss = fcthread_sss + fctile_sss
151 objf_sss(bi,bj) = objf_sss(bi,bj) + fctile_sss
152
153 #ifdef ECCO_VERBOSE
154 c-- Print cost function for each tile in each thread.
155 write(msgbuf,'(a)') ' '
156 call print_message( msgbuf, standardmessageunit,
157 & SQUEEZE_RIGHT , mythid)
158 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
159 & ' cost_sss: irec,bi,bj = ',irec,bi,bj
160 call print_message( msgbuf, standardmessageunit,
161 & SQUEEZE_RIGHT , mythid)
162 write(msgbuf,'(a,d22.15)')
163 & ' cost function (sss) = ',
164 & fctile_sss
165 call print_message( msgbuf, standardmessageunit,
166 & SQUEEZE_RIGHT , mythid)
167 #endif
168
169 enddo
170 enddo
171
172 #ifdef ECCO_VERBOSE
173 c-- Print cost function for all tiles.
174 _GLOBAL_SUM_R8( fcthread_sss , myThid )
175 write(msgbuf,'(a)') ' '
176 call print_message( msgbuf, standardmessageunit,
177 & SQUEEZE_RIGHT , mythid)
178 write(msgbuf,'(a,i8.8)')
179 & ' cost_sss: irec = ',irec
180 call print_message( msgbuf, standardmessageunit,
181 & SQUEEZE_RIGHT , mythid)
182 write(msgbuf,'(a,a,d22.15)')
183 & ' global cost function value',
184 & ' ( SST ) = ',fcthread_sss
185 call print_message( msgbuf, standardmessageunit,
186 & SQUEEZE_RIGHT , mythid)
187 write(msgbuf,'(a)') ' '
188 call print_message( msgbuf, standardmessageunit,
189 & SQUEEZE_RIGHT , mythid)
190 #endif
191
192 enddo
193 c-- End of loop over records.
194
195 #else
196 c-- Do not enter the calculation of the temperature contribution to
197 c-- the final cost function.
198
199 fctile_sss = 0. _d 0
200 fcthread_sss = 0. _d 0
201
202 _BEGIN_MASTER( mythid )
203 write(msgbuf,'(a)') ' '
204 call print_message( msgbuf, standardmessageunit,
205 & SQUEEZE_RIGHT , mythid)
206 write(msgbuf,'(a,a)')
207 & ' cost_sss: no contribution of temperature field ',
208 & 'to cost function.'
209 call print_message( msgbuf, standardmessageunit,
210 & SQUEEZE_RIGHT , mythid)
211 write(msgbuf,'(a,a,i9.8)')
212 & ' cost_sss: number of records that would have',
213 & ' been processed: ',nmonsrec
214 call print_message( msgbuf, standardmessageunit,
215 & SQUEEZE_RIGHT , mythid)
216 write(msgbuf,'(a)') ' '
217 call print_message( msgbuf, standardmessageunit,
218 & SQUEEZE_RIGHT , mythid)
219 _END_MASTER( mythid )
220 #endif
221
222 return
223 end
224

  ViewVC Help
Powered by ViewVC 1.1.22