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

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

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


Revision 1.2 - (show annotations) (download)
Mon Oct 11 16:38:53 2004 UTC (19 years, 8 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57b_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint55h_post, checkpoint57e_post, checkpoint56c_post, checkpoint57a_post, checkpoint56, checkpoint55g_post, checkpoint57d_post, checkpoint55f_post, checkpoint57a_pre, checkpoint57, eckpoint57e_pre, checkpoint57c_post, checkpoint55e_post, checkpoint55i_post, checkpoint56a_post, checkpoint55d_post
Changes since 1.1: +0 -18 lines
o ECCO specific cost function terms (up-to-date with 1x1 runs)
o ecco_cost_weights is modified to 1x1 runs
o modifs to allow observations to be read in as
  single file or yearly files

1
2 #include "COST_CPPOPTIONS.h"
3
4
5 subroutine cost_atemp(
6 I myiter,
7 I mytime,
8 I startrec,
9 I endrec,
10 I mythid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE cost_atemp
15 c ==================================================================
16 c
17 c o Calculate the atmos. temp. contribution to the cost function.
18 c
19 c ==================================================================
20 c SUBROUTINE cost_atemp
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
31 #include "ecco_cost.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 startrec
41 integer endrec
42 integer mythid
43
44 c == local variables ==
45
46 integer bi,bj
47 integer i,j,kk
48 integer itlo,ithi
49 integer jtlo,jthi
50 integer jmin,jmax
51 integer imin,imax
52 integer nrec
53 integer irec
54 integer ilfld
55
56 _RL fctile
57 _RL fcthread
58 _RL tmpx
59
60 logical doglobalread
61 logical ladinit
62
63 character*(80) fnamefld
64
65 character*(MAX_LEN_MBUF) msgbuf
66
67 c == external functions ==
68
69 integer ilnblnk
70 external ilnblnk
71
72 c == end of interface ==
73
74 jtlo = mybylo(mythid)
75 jthi = mybyhi(mythid)
76 itlo = mybxlo(mythid)
77 ithi = mybxhi(mythid)
78 jmin = 1
79 jmax = sny
80 imin = 1
81 imax = snx
82
83 c-- Read state record from global file.
84 doglobalread = .false.
85 ladinit = .false.
86
87 c Number of records to be used.
88 nrec = endrec-startrec+1
89
90 #ifdef ALLOW_ATEMP_COST_CONTRIBUTION
91
92 if (optimcycle .ge. 0) then
93 ilfld=ilnblnk( xx_atemp_file )
94 write(fnamefld(1:80),'(2a,i10.10)')
95 & xx_atemp_file(1:ilfld),'.',optimcycle
96 endif
97
98 fcthread = 0. _d 0
99
100 c-- Loop over records.
101 do irec = 1,nrec
102
103 call active_read_xy_loc( fnamefld, tmpfld2d, irec, doglobalread,
104 & ladinit, optimcycle, mythid
105 & , xx_atemp_dummy )
106
107 c-- Loop over this thread's tiles.
108 do bj = jtlo,jthi
109 do bi = itlo,ithi
110
111 c-- Determine the weights to be used.
112 kk = 1
113 fctile = 0. _d 0
114 do j = jmin,jmax
115 do i = imin,imax
116 if (_hFacC(i,j,kk,bi,bj) .ne. 0.) then
117 tmpx = tmpfld2d(i,j,bi,bj)
118 fctile = fctile
119 & + watemp(i,j,bi,bj)*cosphi(i,j,bi,bj)
120 & *tmpx*tmpx
121 endif
122 enddo
123 enddo
124
125 objf_atemp(bi,bj) = objf_atemp(bi,bj) + fctile
126 fcthread = fcthread + fctile
127
128 #ifdef ECCO_VERBOSE
129 c-- Print cost function for each tile in each thread.
130 write(msgbuf,'(a)') ' '
131 call print_message( msgbuf, standardmessageunit,
132 & SQUEEZE_RIGHT , mythid)
133 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
134 & ' cost_atemp: irec,bi,bj = ',irec,bi,bj
135 call print_message( msgbuf, standardmessageunit,
136 & SQUEEZE_RIGHT , mythid)
137 write(msgbuf,'(a,d22.15)')
138 & ' cost function (atemp) = ',
139 & fctile
140 call print_message( msgbuf, standardmessageunit,
141 & SQUEEZE_RIGHT , mythid)
142 #endif
143 enddo
144 enddo
145
146 #ifdef ECCO_VERBOSE
147 c-- Print cost function for all tiles.
148 _GLOBAL_SUM_R8( fcthread , myThid )
149 write(msgbuf,'(a)') ' '
150 call print_message( msgbuf, standardmessageunit,
151 & SQUEEZE_RIGHT , mythid)
152 write(msgbuf,'(a,i8.8)')
153 & ' cost_atemp: irec = ',irec
154 call print_message( msgbuf, standardmessageunit,
155 & SQUEEZE_RIGHT , mythid)
156 write(msgbuf,'(a,d22.15)')
157 & ' global cost function value = ',
158 & fcthread
159 call print_message( msgbuf, standardmessageunit,
160 & SQUEEZE_RIGHT , mythid)
161 write(msgbuf,'(a)') ' '
162 call print_message( msgbuf, standardmessageunit,
163 & SQUEEZE_RIGHT , mythid)
164 #endif
165 c-- End of loop over records.
166 enddo
167 #else
168 c-- Do not enter the calculation of the heat flux contribution
169 c-- to the final cost function.
170
171 fctile = 0. _d 0
172 fcthread = 0. _d 0
173
174 _BEGIN_MASTER( mythid )
175 write(msgbuf,'(a)') ' '
176 call print_message( msgbuf, standardmessageunit,
177 & SQUEEZE_RIGHT , mythid)
178 write(msgbuf,'(a,a)')
179 & ' cost_atemp: no contribution of heat flux ',
180 & ' to cost function.'
181 call print_message( msgbuf, standardmessageunit,
182 & SQUEEZE_RIGHT , mythid)
183 write(msgbuf,'(a,a,i9.8)')
184 & ' cost_atemp: number of records that would have',
185 & ' been processed: ',nrec
186 call print_message( msgbuf, standardmessageunit,
187 & SQUEEZE_RIGHT , mythid)
188 write(msgbuf,'(a)') ' '
189 call print_message( msgbuf, standardmessageunit,
190 & SQUEEZE_RIGHT , mythid)
191 _END_MASTER( mythid )
192 #endif
193
194 return
195 end
196

  ViewVC Help
Powered by ViewVC 1.1.22