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

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

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


Revision 1.12 - (show annotations) (download)
Thu Oct 29 13:39:54 2015 UTC (8 years, 7 months ago) by gforget
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
- remove codes that have been replaced with generic function calls.

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_kapgm.F,v 1.11 2014/10/18 18:15:44 gforget Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5
6
7 subroutine cost_kapgm(
8 I myiter,
9 I mytime,
10 I mythid
11 & )
12
13 C o==========================================================o
14 C | subroutine cost_kapgm |
15 C | o GM coefficient adjustment penalization |
16 C o==========================================================o
17
18 implicit none
19
20 c == global variables ==
21
22 #ifdef ALLOW_KAPGM_COST_CONTRIBUTION
23 #include "EEPARAMS.h"
24 #include "SIZE.h"
25 #include "GRID.h"
26 #include "DYNVARS.h"
27 #ifdef ALLOW_GMREDI
28 # include "GMREDI.h"
29 #endif
30
31 #include "ecco_cost.h"
32 #include "CTRL_SIZE.h"
33 #include "ctrl.h"
34 #include "ctrl_dummy.h"
35 #include "optim.h"
36 #endif
37
38 c == routine arguments ==
39
40 integer myiter
41 _RL mytime
42 integer mythid
43
44 c == local variables ==
45
46 #ifdef ALLOW_KAPGM_COST_CONTRIBUTION
47
48 integer bi,bj
49 integer i,j,k
50 integer itlo,ithi
51 integer jtlo,jthi
52 integer jmin,jmax
53 integer imin,imax
54 integer nrec
55 integer irec
56 integer ilfld
57
58 _RL fctile
59 _RL fcthread
60 _RL tmpx
61
62 logical doglobalread
63 logical ladinit
64
65 character*(80) fnamefld
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 state record from global file.
86 doglobalread = .false.
87 ladinit = .false.
88
89 irec = 1
90
91 if (optimcycle .ge. 0) then
92 ilfld = ilnblnk( xx_kapgm_file )
93 write(fnamefld(1:80),'(2a,i10.10)')
94 & xx_kapgm_file(1:ilfld),'.',optimcycle
95 endif
96
97 fcthread = 0. _d 0
98
99 call active_read_xyz( fnamefld, tmpfld3d, irec, doglobalread,
100 & ladinit, optimcycle, mythid
101 & , xx_kapgm_dummy )
102
103 c-- Loop over this thread tiles.
104 do bj = jtlo,jthi
105 do bi = itlo,ithi
106
107 c-- Determine the weights to be used.
108
109 fctile = 0. _d 0
110 do k = 1,nr
111 do j = jmin,jmax
112 do i = imin,imax
113 if (_hFacC(i,j,k,bi,bj) .ne. 0.) then
114 c tmpx = (tmpfld3d(i,j,k,bi,bj)-GM_background_K)
115 tmpx = tmpfld3d(i,j,k,bi,bj)
116 IF ( .NOT.ctrlSmoothCorrel3D ) THEN
117 fctile = fctile
118 & + wkapgmFld(i,j,k,bi,bj)*cosphi(i,j,bi,bj)
119 & *tmpx*tmpx
120 ELSE !IF ( .NOT.ctrlSmoothCorrel3D ) THEN
121 fctile = fctile + tmpx*tmpx
122 ENDIF !IF ( .NOT.ctrlSmoothCorrel3D ) THEN
123 endif
124 enddo
125 enddo
126 enddo
127
128 objf_kapgm(bi,bj) = objf_kapgm(bi,bj) + fctile
129 fcthread = fcthread + fctile
130
131 #ifdef ECCO_VERBOSE
132 c-- Print cost function for each tile in each thread.
133 write(msgbuf,'(a)') ' '
134 call print_message( msgbuf, standardmessageunit,
135 & SQUEEZE_RIGHT , mythid)
136 write(msgbuf,'(a,i8.8,1x,i3.3,1x,i3.3)')
137 & ' cost_kapgm: irec,bi,bj = ',irec,bi,bj
138 call print_message( msgbuf, standardmessageunit,
139 & SQUEEZE_RIGHT , mythid)
140 write(msgbuf,'(a,d22.15)')
141 & ' cost function (dT(0)) = ',
142 & fctile
143 call print_message( msgbuf, standardmessageunit,
144 & SQUEEZE_RIGHT , mythid)
145 #endif
146 enddo
147 enddo
148
149 #ifdef ECCO_VERBOSE
150 c-- Print cost function for all tiles.
151 _GLOBAL_SUM_RL( fcthread , myThid )
152 write(msgbuf,'(a)') ' '
153 call print_message( msgbuf, standardmessageunit,
154 & SQUEEZE_RIGHT , mythid)
155 write(msgbuf,'(a,i8.8)')
156 & ' cost_kapgm: irec = ',irec
157 call print_message( msgbuf, standardmessageunit,
158 & SQUEEZE_RIGHT , mythid)
159 write(msgbuf,'(a,d22.15)')
160 & ' global cost function value = ',
161 & fcthread
162 call print_message( msgbuf, standardmessageunit,
163 & SQUEEZE_RIGHT , mythid)
164 write(msgbuf,'(a)') ' '
165 call print_message( msgbuf, standardmessageunit,
166 & SQUEEZE_RIGHT , mythid)
167 #endif
168
169 #endif
170
171 return
172 end
173
174

  ViewVC Help
Powered by ViewVC 1.1.22