1 |
heimbach |
1.1 |
|
2 |
|
|
#include "COST_CPPOPTIONS.h" |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
subroutine cost_mean_heatflux( |
6 |
|
|
I myiter, |
7 |
|
|
I mytime, |
8 |
|
|
I mythid |
9 |
|
|
& ) |
10 |
|
|
|
11 |
|
|
c ================================================================== |
12 |
|
|
c SUBROUTINE cost_mean_heatflux |
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_heatflux |
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 tmpx |
60 |
|
|
_RL sumcos |
61 |
|
|
|
62 |
|
|
character*(80) fnamehflux |
63 |
|
|
|
64 |
|
|
logical doglobalread |
65 |
|
|
logical ladinit |
66 |
|
|
|
67 |
|
|
character*(MAX_LEN_MBUF) msgbuf |
68 |
|
|
|
69 |
|
|
c == external functions == |
70 |
|
|
|
71 |
|
|
integer ilnblnk |
72 |
|
|
external ilnblnk |
73 |
|
|
|
74 |
|
|
c == end of interface == |
75 |
|
|
|
76 |
|
|
jtlo = mybylo(mythid) |
77 |
|
|
jthi = mybyhi(mythid) |
78 |
|
|
itlo = mybxlo(mythid) |
79 |
|
|
ithi = mybxhi(mythid) |
80 |
|
|
jmin = 1 |
81 |
|
|
jmax = sny |
82 |
|
|
imin = 1 |
83 |
|
|
imax = snx |
84 |
|
|
|
85 |
|
|
c-- Read tiled data. |
86 |
|
|
doglobalread = .false. |
87 |
|
|
ladinit = .false. |
88 |
|
|
|
89 |
|
|
#ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION |
90 |
|
|
|
91 |
|
|
if (optimcycle .ge. 0) then |
92 |
|
|
ilsalt = ilnblnk( hfluxbarfile ) |
93 |
|
|
write(fnamehflux(1:80),'(2a,i10.10)') |
94 |
|
|
& hfluxbarfile(1:ilsalt),'.',optimcycle |
95 |
|
|
endif |
96 |
|
|
|
97 |
|
|
irec = 1 |
98 |
|
|
|
99 |
|
|
c-- Read time averages and the monthly mean data. |
100 |
|
|
call active_read_xy( fnamehflux, tmpfld2d, irec, |
101 |
|
|
& doglobalread, ladinit, |
102 |
|
|
& optimcycle, mythid, |
103 |
|
|
& xx_hflux_mean_dummy ) |
104 |
|
|
|
105 |
|
|
do bj = jtlo,jthi |
106 |
|
|
do bi = itlo,ithi |
107 |
|
|
kk = 1 |
108 |
|
|
fctilemm = 0. _d 0 |
109 |
|
|
sumcos = 0. _d 0 |
110 |
|
|
do j = jmin,jmax |
111 |
|
|
do i = imin,imax |
112 |
|
|
tmpx=tmpfld2d(i,j,bi,bj) |
113 |
heimbach |
1.2 |
if (maskC(i,j,kk,bi,bj) .ne. 0.) then |
114 |
heimbach |
1.4 |
fctilemm = fctilemm + tmpx |
115 |
|
|
& *cos(yc(i,j,bi,bj)*deg2rad) |
116 |
|
|
sumcos = sumcos + cos(yc(i,j,bi,bj)*deg2rad) |
117 |
|
|
num_hfluxmm(bi,bj) = num_hfluxmm(bi,bj) + 1 |
118 |
heimbach |
1.1 |
endif |
119 |
|
|
enddo |
120 |
|
|
enddo |
121 |
|
|
|
122 |
heimbach |
1.4 |
_GLOBAL_SUM_R8( sumcos , myThid ) |
123 |
|
|
if (sumcos.eq.0.) sumcos = 1. |
124 |
|
|
|
125 |
|
|
fctilemm = fctilemm / sumcos |
126 |
|
|
objf_hfluxmm(bi,bj) = whfluxmm(bi,bj) * fctilemm |
127 |
heimbach |
1.1 |
|
128 |
|
|
enddo |
129 |
|
|
enddo |
130 |
|
|
|
131 |
|
|
#endif |
132 |
|
|
|
133 |
|
|
return |
134 |
|
|
end |
135 |
|
|
|