1 |
c ian fenty |
C $Header$ |
2 |
#include "COST_CPPOPTIONS.h" |
C $Name$ |
3 |
|
|
4 |
|
#include "SEAICE_OPTIONS.h" |
5 |
|
|
6 |
c read the area dat file and compare against the averaged salinity file |
c read the area dat file and compare against the averaged salinity file |
7 |
|
|
8 |
subroutine seaice_cost_sss( |
subroutine seaice_cost_sss( |
9 |
& nnzbar, localbarfile, localbar, xx_localbar_mean_dummy, |
& nnzbar, localbarfile, localbar, xx_localbar_mean_dummy, |
10 |
& areabarfile, areabar, xx_areabar_mean_dummy, |
& areabarfile, areabar, xx_areabar_mean_dummy, |
11 |
& nnzobs, localobsfile, localobs, mult_local, |
& nnzobs, localobsfile, localobs, mult_local, |
17 |
|
|
18 |
implicit none |
implicit none |
19 |
|
|
20 |
|
c ian fenty |
21 |
c == global variables == |
c == global variables == |
22 |
|
|
23 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
27 |
# include "cal.h" |
# include "cal.h" |
28 |
#endif |
#endif |
29 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
|
# include "ecco_cost.h" |
|
30 |
# include "optim.h" |
# include "optim.h" |
31 |
|
# ifdef ALLOW_ECCO |
32 |
|
# include "ecco_cost.h" |
33 |
|
# endif |
34 |
# ifdef ALLOW_SEAICE |
# ifdef ALLOW_SEAICE |
35 |
# include "SEAICE_COST.h" |
# include "SEAICE_COST.h" |
36 |
|
# include "SEAICE_SIZE.h" |
37 |
# include "SEAICE_PARAMS.h" |
# include "SEAICE_PARAMS.h" |
38 |
# endif |
# endif |
39 |
#endif |
#endif |
52 |
|
|
53 |
_RL localobs (1-olx:snx+olx,1-oly:sny+oly,nnzobs,nsx,nsy) |
_RL localobs (1-olx:snx+olx,1-oly:sny+oly,nnzobs,nsx,nsy) |
54 |
_RL localweight(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL localweight(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
55 |
_RL localmask (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
_RS localmask (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
56 |
_RL xx_localbar_mean_dummy |
_RL xx_localbar_mean_dummy |
57 |
_RL xx_areabar_mean_dummy |
_RL xx_areabar_mean_dummy |
58 |
_RL mult_local |
_RL mult_local |
68 |
character*(MAX_LEN_FNAM) localbarfile |
character*(MAX_LEN_FNAM) localbarfile |
69 |
character*(MAX_LEN_FNAM) localobsfile |
character*(MAX_LEN_FNAM) localobsfile |
70 |
|
|
71 |
#ifdef ALLOW_COST |
#if (defined (ALLOW_ECCO) && defined (ALLOW_COST)) |
72 |
c == local variables == |
c == local variables == |
73 |
|
|
74 |
integer bi,bj |
integer bi,bj |
91 |
_RL localcost |
_RL localcost |
92 |
_RL junk |
_RL junk |
93 |
|
|
94 |
_RL cmask (1-olx:snx+olx,1-oly:sny+oly,nnzobs) |
_RL cmask (1-olx:snx+olx,1-oly:sny+oly,nnzobs) |
95 |
|
|
96 |
character*(128) fname1, fname2,fname3 |
character*(128) fname1, fname2,fname3 |
97 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
147 |
write(fname3(1:128),'(80a)') ' ' |
write(fname3(1:128),'(80a)') ' ' |
148 |
|
|
149 |
il=ilnblnk( localbarfile ) |
il=ilnblnk( localbarfile ) |
150 |
write(fname1(1:128),'(2a,i10.10)') |
write(fname1(1:128),'(2a,i10.10)') |
151 |
& localbarfile(1:il),'.',optimcycle |
& localbarfile(1:il),'.',optimcycle |
152 |
|
|
153 |
csss |
csss |
154 |
il=ilnblnk( areabarfile ) |
il=ilnblnk( areabarfile ) |
155 |
write(fname3(1:128),'(2a,i10.10)') |
write(fname3(1:128),'(2a,i10.10)') |
156 |
& areabarfile(1:il),'.',optimcycle |
& areabarfile(1:il),'.',optimcycle |
157 |
|
|
158 |
if ( .NOT. ( localobsfile.EQ.' ' ) ) then |
if ( .NOT. ( localobsfile.EQ.' ' ) ) then |
162 |
|
|
163 |
if ( nnzbar .EQ. 1 ) then |
if ( nnzbar .EQ. 1 ) then |
164 |
call active_read_xy( fname1, localbar, irec, doglobalread, |
call active_read_xy( fname1, localbar, irec, doglobalread, |
165 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
166 |
& xx_localbar_mean_dummy ) |
& xx_localbar_mean_dummy ) |
167 |
else |
else |
168 |
call active_read_xyz( fname1, localbar, irec, doglobalread, |
call active_read_xyz( fname1, localbar, irec, doglobalread, |
169 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
170 |
& xx_localbar_mean_dummy ) |
& xx_localbar_mean_dummy ) |
171 |
endif |
endif |
172 |
|
|
173 |
csss |
csss |
174 |
if ( nnzbar .EQ. 1 ) then |
if ( nnzbar .EQ. 1 ) then |
175 |
call active_read_xy( fname3, areabar, irec, doglobalread, |
call active_read_xy( fname3, areabar, irec, doglobalread, |
176 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
177 |
& xx_areabar_mean_dummy ) |
& xx_areabar_mean_dummy ) |
178 |
else |
else |
179 |
call active_read_xyz( fname3, areabar, irec, doglobalread, |
call active_read_xyz( fname3, areabar, irec, doglobalread, |
180 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
181 |
& xx_areabar_mean_dummy ) |
& xx_areabar_mean_dummy ) |
182 |
endif |
endif |
183 |
|
|
205 |
print *,'ymod, yday ', ymod,yday |
print *,'ymod, yday ', ymod,yday |
206 |
print *,'smrarstrtdt(1) ', smrareastartdate(1) |
print *,'smrarstrtdt(1) ', smrareastartdate(1) |
207 |
print *,'smrarstartdate ', smrareastartdate |
print *,'smrarstartdate ', smrareastartdate |
208 |
#endif SEAICE_DEBUG |
#endif /* SEAICE_DEBUG */ |
209 |
|
|
210 |
if ( ymod .EQ. yday ) then |
if ( ymod .EQ. yday ) then |
211 |
middate(1) = smrareastartdate(1) |
middate(1) = smrareastartdate(1) |
212 |
else |
else |
213 |
middate(1) = yday*10000+100+1 |
middate(1) = yday*10000+100+1 |
214 |
endif |
endif |
227 |
print *,'middate(3,4) ', middate(3),middate(4) |
print *,'middate(3,4) ', middate(3),middate(4) |
228 |
print *,'difftime,diffsecs',difftime,diffsecs |
print *,'difftime,diffsecs',difftime,diffsecs |
229 |
print *,'localrec ',localrec |
print *,'localrec ',localrec |
230 |
#endif |
#endif |
231 |
|
|
232 |
il=ilnblnk(localobsfile) |
il=ilnblnk(localobsfile) |
233 |
write(fname2(1:128),'(2a,i4)') |
write(fname2(1:128),'(2a,i4)') |
246 |
#endif |
#endif |
247 |
endif |
endif |
248 |
|
|
249 |
if ( localrec .GT. 0 ) then |
if ( localrec .GT. 0 ) then |
250 |
|
|
251 |
#ifdef SEAICE_DEBUG |
#ifdef SEAICE_DEBUG |
252 |
print *,'calling mdsreadfile',fname2,localrec |
print *,'calling mdsreadfile',fname2,localrec |
253 |
#endif |
#endif |
254 |
|
|
255 |
call mdsreadfield( fname2, cost_iprec, cost_yftype, nnzobs, |
call mdsreadfield( fname2, cost_iprec, cost_yftype, nnzobs, |
256 |
& localobs, localrec, mythid ) |
& localobs, localrec, mythid ) |
257 |
else |
else |
258 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
310 |
localwww = localweight(i,j,bi,bj)*cmask(i,j,k) |
localwww = localweight(i,j,bi,bj)*cmask(i,j,k) |
311 |
|
|
312 |
c only accumulate cost if there is ice observed but not simulated.. |
c only accumulate cost if there is ice observed but not simulated.. |
313 |
if ( localobs(i,j,k,bi,bj) .GT. 0.0 .AND. |
if ( localobs(i,j,k,bi,bj) .GT. 0.0 .AND. |
314 |
& areabar(i,j,1,bi,bj) .LE. 0.0) then |
& areabar(i,j,1,bi,bj) .LE. 0.0) then |
315 |
|
|
316 |
c if ( localobs(i,j,k,bi,bj) .GT. |
c if ( localobs(i,j,k,bi,bj) .GT. |
317 |
c & areabar(i,j,1,bi,bj)) then |
c & areabar(i,j,1,bi,bj)) then |
318 |
|
|
319 |
junk = ( localbar(i,j,k,bi,bj) - SEAICE_clamp_salt ) |
junk = ( localbar(i,j,k,bi,bj) - SEAICE_clamp_salt ) |
338 |
|
|
339 |
print '(A,2i4,2(1x,1P2E15.3))', |
print '(A,2i4,2(1x,1P2E15.3))', |
340 |
& 'costg i j bar-obs,wgt,loCost ',i,j, |
& 'costg i j bar-obs,wgt,loCost ',i,j, |
341 |
& junk, |
& junk, |
342 |
& localwww, |
& localwww, |
343 |
& localcost |
& localcost |
344 |
endif |
endif |
345 |
#endif |
#endif |