/[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.16 - (show annotations) (download)
Fri Aug 10 19:45:26 2012 UTC (11 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63r, checkpoint63s, checkpoint64, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65d, checkpoint65e
Changes since 1.15: +2 -2 lines
include ECCO_OPTIONS.h instead of COST_CPPOPTIONS.h

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_mean_saltflux.F,v 1.15 2012/08/06 20:41:55 heimbach Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5
6
7 subroutine cost_mean_saltflux(
8 I myiter,
9 I mytime,
10 I mythid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE cost_mean_saltflux
15 c ==================================================================
16 c
17 c o Evaluate cost function contribution of sea surface salinity.
18 c
19 c started: Elisabeth Remy 19-mar-2001 copy from cost_sst.F
20 c
21 c ==================================================================
22 c SUBROUTINE cost_mean_saltflux
23 c ==================================================================
24
25 implicit none
26
27 c == global variables ==
28
29 #include "EEPARAMS.h"
30 #include "SIZE.h"
31 #include "GRID.h"
32 #include "DYNVARS.h"
33 #include "PARAMS.h"
34
35 #include "cal.h"
36 #include "ecco_cost.h"
37 #include "CTRL_SIZE.h"
38 #include "ctrl.h"
39 #include "ctrl_dummy.h"
40 #include "optim.h"
41
42 c == routine arguments ==
43
44 integer myiter
45 _RL mytime
46 integer mythid
47
48 c == local variables ==
49
50 integer bi,bj
51 integer i,j,kk
52 integer itlo,ithi
53 integer jtlo,jthi
54 integer jmin,jmax
55 integer imin,imax
56 integer irec
57 integer levmon
58 integer levoff
59 integer ilsalt
60
61 _RL tmpx
62 _RL sumtot
63 _RL fctiletot
64
65
66 character*(80) fnamesflux
67
68 logical doglobalread
69 logical ladinit
70
71 character*(MAX_LEN_MBUF) msgbuf
72
73 c == external functions ==
74
75 integer ilnblnk
76 external ilnblnk
77
78 c == end of interface ==
79
80 jtlo = mybylo(mythid)
81 jthi = mybyhi(mythid)
82 itlo = mybxlo(mythid)
83 ithi = mybxhi(mythid)
84 jmin = 1
85 jmax = sny
86 imin = 1
87 imax = snx
88
89 c-- Read tiled data.
90 doglobalread = .false.
91 ladinit = .false.
92
93 #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION
94
95 if (optimcycle .ge. 0) then
96 ilsalt = ilnblnk( sfluxmeanbarfile )
97 write(fnamesflux(1:80),'(2a,i10.10)')
98 & sfluxmeanbarfile(1:ilsalt),'.',optimcycle
99 endif
100
101 do irec = 1, MAX(1,nyearsrec)
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 sumtot = 0.
110 fctiletot = 0.
111 do bj = jtlo,jthi
112 do bi = itlo,ithi
113 kk = 1
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 fctiletot = fctiletot
119 & + tmpx* _rA(i,j,bi,bj)/rhoConstFresh
120 sumtot = sumtot
121 & + _rA(i,j,bi,bj)
122 num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1
123 endif
124 enddo
125 enddo
126 enddo
127 enddo
128
129 _GLOBAL_SUM_RL( sumtot , myThid )
130 _GLOBAL_SUM_RL( fctiletot , myThid )
131
132 if (sumtot.eq.0.) sumtot = 1.
133
134 if ( wmean_sflux .NE. 0. ) then
135 objf_sfluxmm = objf_sfluxmm
136 & + ( (fctiletot/sumtot)/wmean_sflux )**2
137 else
138 objf_sfluxmm = 0. _d 0
139 endif
140
141 c-- diagnostic: imbalance per year:
142 write(standardmessageunit,'(A,I5,2(X,D22.14))')
143 & ' --> bal_sfluxmm =', irec,
144 & fctiletot/sumtot,
145 & objf_sfluxmm
146
147 enddo
148
149 #endif
150
151 return
152 end
153

  ViewVC Help
Powered by ViewVC 1.1.22