1 |
heimbach |
1.1 |
|
2 |
|
|
#include "COST_CPPOPTIONS.h" |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
subroutine cost_mean_saltflux( |
6 |
|
|
I myiter, |
7 |
|
|
I mytime, |
8 |
|
|
I mythid |
9 |
|
|
& ) |
10 |
|
|
|
11 |
|
|
c ================================================================== |
12 |
|
|
c SUBROUTINE cost_mean_saltflux |
13 |
|
|
c ================================================================== |
14 |
|
|
c |
15 |
|
|
c o Evaluate cost function contribution of sea surface salinity. |
16 |
|
|
c |
17 |
|
|
c started: Elisabeth Remy 19-mar-2001 copy from cost_sst.F |
18 |
|
|
c |
19 |
|
|
c ================================================================== |
20 |
|
|
c SUBROUTINE cost_mean_saltflux |
21 |
|
|
c ================================================================== |
22 |
|
|
|
23 |
|
|
implicit none |
24 |
|
|
|
25 |
|
|
c == global variables == |
26 |
|
|
|
27 |
|
|
#include "EEPARAMS.h" |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
#include "GRID.h" |
30 |
|
|
#include "DYNVARS.h" |
31 |
|
|
#include "PARAMS.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 |
heimbach |
1.2 |
integer i,j,kk |
49 |
heimbach |
1.1 |
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 fctilemm |
59 |
|
|
_RL fcthreadmm |
60 |
|
|
_RL tmpx |
61 |
|
|
_RL sumcos |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
character*(80) fnamesflux |
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 |
|
|
c-- Read tiled data. |
88 |
|
|
doglobalread = .false. |
89 |
|
|
ladinit = .false. |
90 |
|
|
|
91 |
|
|
#ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION |
92 |
|
|
|
93 |
|
|
if (optimcycle .ge. 0) then |
94 |
|
|
ilsalt = ilnblnk( sfluxbarfile ) |
95 |
|
|
write(fnamesflux(1:80),'(2a,i10.10)') |
96 |
|
|
& sfluxbarfile(1:ilsalt),'.',optimcycle |
97 |
|
|
endif |
98 |
|
|
|
99 |
|
|
fcthreadmm = 0. _d 0 |
100 |
|
|
|
101 |
|
|
irec = 1 |
102 |
|
|
|
103 |
|
|
c-- Read time averages and the monthly mean data. |
104 |
|
|
call active_read_xy( fnamesflux, tmpfld2d, irec, |
105 |
|
|
& doglobalread, ladinit, |
106 |
|
|
& optimcycle, mythid, |
107 |
|
|
& xx_sflux_mean_dummy ) |
108 |
|
|
|
109 |
|
|
do bj = jtlo,jthi |
110 |
|
|
do bi = itlo,ithi |
111 |
|
|
kk = 1 |
112 |
|
|
fctilemm = 0. _d 0 |
113 |
|
|
sumcos = 0. _d 0 |
114 |
|
|
do j = jmin,jmax |
115 |
|
|
do i = imin,imax |
116 |
|
|
tmpx=tmpfld2d(i,j,bi,bj) |
117 |
heimbach |
1.2 |
if (maskC(i,j,kk,bi,bj) .ne. 0.) then |
118 |
|
|
fctilemm = fctilemm+tmpx*cos(yc(i,j,bi,bj)*deg2rad) |
119 |
heimbach |
1.1 |
sumcos = sumcos + cos(yc(i,j,bi,bj)*deg2rad) |
120 |
|
|
endif |
121 |
|
|
enddo |
122 |
|
|
enddo |
123 |
|
|
|
124 |
heimbach |
1.2 |
if(sumcos.eq.0) sumcos=1.0 |
125 |
heimbach |
1.1 |
fctilemm = (fctilemm / sumcos) |
126 |
heimbach |
1.2 |
fctilemm = wsfluxmm(bi,bj) * (fctilemm ) |
127 |
heimbach |
1.1 |
|
128 |
|
|
objf_sfluxmm(bi,bj) = fctilemm |
129 |
|
|
fcthreadmm = fcthreadmm + fctilemm |
130 |
|
|
|
131 |
|
|
enddo |
132 |
|
|
enddo |
133 |
|
|
|
134 |
|
|
#endif |
135 |
|
|
|
136 |
|
|
return |
137 |
|
|
end |
138 |
|
|
|