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

Contents of /MITgcm/pkg/ecco/cost_mean_saltflux.F

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


Revision 1.3 - (show annotations) (download)
Thu Feb 16 21:48:55 2006 UTC (18 years, 3 months ago) by heimbach
Branch: MAIN
Changes since 1.2: +0 -66 lines
o Use space and time-mean cost (and update to swflux convention)
o clean up routines

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 integer i,j,kk
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 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 if (maskC(i,j,kk,bi,bj) .ne. 0.) then
118 fctilemm = fctilemm+tmpx*cos(yc(i,j,bi,bj)*deg2rad)
119 sumcos = sumcos + cos(yc(i,j,bi,bj)*deg2rad)
120 endif
121 enddo
122 enddo
123
124 if(sumcos.eq.0) sumcos=1.0
125 fctilemm = (fctilemm / sumcos)
126 fctilemm = wsfluxmm(bi,bj) * (fctilemm )
127
128 objf_sfluxmm(bi,bj) = fctilemm
129 fcthreadmm = fcthreadmm + fctilemm
130
131 enddo
132 enddo
133
134 #endif
135
136 return
137 end
138

  ViewVC Help
Powered by ViewVC 1.1.22