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

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

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


Revision 1.6 - (show annotations) (download)
Fri Aug 10 19:45:27 2012 UTC (11 years, 10 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.5: +2 -2 lines
include ECCO_OPTIONS.h instead of COST_CPPOPTIONS.h

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_theta_ini_fin.F,v 1.5 2012/08/06 20:41:55 heimbach Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5
6
7 subroutine cost_theta_ini_fin(
8 I myiter,
9 I mytime,
10 I mythid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE cost_theta_ini_fin
15 c ==================================================================
16 c
17 c ==================================================================
18 c SUBROUTINE cost_theta_ini_fin
19 c ==================================================================
20
21 implicit none
22
23 c == global variables ==
24
25 #include "EEPARAMS.h"
26 #include "SIZE.h"
27 #include "GRID.h"
28 #include "DYNVARS.h"
29
30 #include "ecco_cost.h"
31 #include "CTRL_SIZE.h"
32 #include "ctrl.h"
33 #include "ctrl_dummy.h"
34 #include "optim.h"
35
36 c == routine arguments ==
37
38 integer myiter
39 _RL mytime
40 integer mythid
41
42 c == local variables ==
43
44 integer bi,bj
45 integer i,j,k
46 integer itlo,ithi
47 integer jtlo,jthi
48 integer jmin,jmax
49 integer imin,imax
50 integer nrec
51 integer irec
52 integer ilfld
53
54 _RL fctile
55 _RL fcthread
56 _RL tmpx
57
58 logical doglobalread
59 logical ladinit
60
61 character*(80) fnamefld
62
63 character*(MAX_LEN_MBUF) msgbuf
64
65 c == external functions ==
66
67 integer ilnblnk
68 external ilnblnk
69
70 c == end of interface ==
71
72 jtlo = mybylo(mythid)
73 jthi = mybyhi(mythid)
74 itlo = mybxlo(mythid)
75 ithi = mybxhi(mythid)
76 jmin = 1
77 jmax = sny
78 imin = 1
79 imax = snx
80
81 c-- Read state record from global file.
82 doglobalread = .false.
83 ladinit = .false.
84
85 irec = 1
86
87 #ifdef ALLOW_COST_INI_FIN
88
89 ilfld = ilnblnk( xx_theta_ini_fin_file )
90 write(fnamefld(1:80),'(2a,i10.10)')
91 & xx_theta_ini_fin_file(1:ilfld),'.',optimcycle
92
93 fcthread = 0. _d 0
94
95 call active_read_xyz( fnamefld, tmpfld3d, irec, doglobalread,
96 & ladinit, optimcycle, mythid,
97 & xx_theta_ini_fin_dummy )
98
99 c-- Loop over this thread tiles.
100 do bj = jtlo,jthi
101 do bi = itlo,ithi
102
103 c-- Determine the weights to be used.
104
105 fctile = 0. _d 0
106 do k = 1,nr
107 do j = jmin,jmax
108 do i = imin,imax
109 if (_hFacC(i,j,k,bi,bj) .ne. 0.) then
110 tmpx = tmpfld3d(i,j,k,bi,bj) - theta(i,j,k,bi,bj)
111 fctile = fctile
112 & + wtheta(k,bi,bj)*cosphi(i,j,bi,bj)
113 & *tmpx*tmpx
114 endif
115 enddo
116 enddo
117 enddo
118
119 objf_theta_ini_fin(bi,bj) =
120 & objf_theta_ini_fin(bi,bj) + fctile
121 fcthread = fcthread + fctile
122
123 #ifdef ECCO_VERBOSE
124 c-- Print cost function for each tile in each thread.
125 write(msgbuf,'(a)') ' '
126 call print_message( msgbuf, standardmessageunit,
127 & SQUEEZE_RIGHT , mythid)
128 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
129 & ' cost_theta_ini_fin: irec,bi,bj = ',irec,bi,bj
130 call print_message( msgbuf, standardmessageunit,
131 & SQUEEZE_RIGHT , mythid)
132 write(msgbuf,'(a,d22.15)')
133 & ' cost_theta_ini_fin: irec,bi,bj = ',
134 & fctile
135 call print_message( msgbuf, standardmessageunit,
136 & SQUEEZE_RIGHT , mythid)
137 #endif
138 enddo
139 enddo
140
141 #ifdef ECCO_VERBOSE
142 c-- Print cost function for all tiles.
143 _GLOBAL_SUM_RL( fcthread , myThid )
144 write(msgbuf,'(a)') ' '
145 call print_message( msgbuf, standardmessageunit,
146 & SQUEEZE_RIGHT , mythid)
147 write(msgbuf,'(a,i8.8)')
148 & ' cost_: irec = ',irec
149 call print_message( msgbuf, standardmessageunit,
150 & SQUEEZE_RIGHT , mythid)
151 write(msgbuf,'(a,d22.15)')
152 & ' global cost function value = ',
153 & fcthread
154 call print_message( msgbuf, standardmessageunit,
155 & SQUEEZE_RIGHT , mythid)
156 write(msgbuf,'(a)') ' '
157 call print_message( msgbuf, standardmessageunit,
158 & SQUEEZE_RIGHT , mythid)
159 #endif
160
161 #else
162 c-- Do not enter the calculation of the salinity increment
163 c-- contribution to the final cost function.
164
165 fctile = 0. _d 0
166 fcthread = 0. _d 0
167
168 #ifdef ECCO_VERBOSE
169 _BEGIN_MASTER( mythid )
170 write(msgbuf,'(a)') ' '
171 call print_message( msgbuf, standardmessageunit,
172 & SQUEEZE_RIGHT , mythid)
173 write(msgbuf,'(a,a)')
174 & ' cost_theta_ini_fin : no contribution of the IC in salin. ',
175 & ' to cost function.'
176 call print_message( msgbuf, standardmessageunit,
177 & SQUEEZE_RIGHT , mythid)
178 write(msgbuf,'(a)') ' '
179 call print_message( msgbuf, standardmessageunit,
180 & SQUEEZE_RIGHT , mythid)
181 _END_MASTER( mythid )
182 #endif
183
184 #endif
185
186 return
187 end
188
189

  ViewVC Help
Powered by ViewVC 1.1.22