2 c---------------------------------------------------------------------
3 c---------------------------------------------------------------------
7 c---------------------------------------------------------------------
8 c---------------------------------------------------------------------
15 c---------------------------------------------------------------------
17 c---------------------------------------------------------------------
19 integer ibeg, ifin, ifin1
20 integer jbeg, jfin, jfin1
21 integer iglob, iglob1, iglob2
22 integer jglob, jglob1, jglob2
24 double precision phi1(0:isiz2+1,0:isiz3+1),
25 > phi2(0:isiz2+1,0:isiz3+1)
26 double precision frc1, frc2, frc3
27 double precision dummy
32 c---------------------------------------------------------------------
33 c set up the sub-domains for integeration in each processor
34 c---------------------------------------------------------------------
39 if (iglob1.ge.ii1.and.iglob2.lt.ii2+nx) ibeg = 1
40 if (iglob1.gt.ii1-nx.and.iglob2.le.ii2) ifin = nx
41 if (ii1.ge.iglob1.and.ii1.le.iglob2) ibeg = ii1 - ipt
42 if (ii2.ge.iglob1.and.ii2.le.iglob2) ifin = ii2 - ipt
47 if (jglob1.ge.ji1.and.jglob2.lt.ji2+ny) jbeg = 1
48 if (jglob1.gt.ji1-ny.and.jglob2.le.ji2) jfin = ny
49 if (ji1.ge.jglob1.and.ji1.le.jglob2) jbeg = ji1 - jpt
50 if (ji2.ge.jglob1.and.ji2.le.jglob2) jfin = ji2 - jpt
53 if (ipt + ifin1.eq.ii2) ifin1 = ifin -1
54 if (jpt + jfin1.eq.ji2) jfin1 = jfin -1
56 c---------------------------------------------------------------------
58 c---------------------------------------------------------------------
73 phi1(i,j) = c2*( u(5,i,j,k)
74 > - 0.50d+00 * ( u(2,i,j,k) ** 2
81 phi2(i,j) = c2*( u(5,i,j,k)
82 > - 0.50d+00 * ( u(2,i,j,k) ** 2
89 c---------------------------------------------------------------------
90 c communicate in i and j directions
91 c---------------------------------------------------------------------
92 call exchange_4(phi1,phi2,ibeg,ifin1,jbeg,jfin1)
98 frc1 = frc1 + ( phi1(i,j)
109 c---------------------------------------------------------------------
110 c compute the global sum of individual contributions to frc1
111 c---------------------------------------------------------------------
113 call MPI_ALLREDUCE( dummy,
121 frc1 = dxi * deta * frc1
123 c---------------------------------------------------------------------
125 c---------------------------------------------------------------------
134 if (jglob.eq.ji1) then
139 phi1(i,k) = c2*( u(5,i,jbeg,k)
140 > - 0.50d+00 * ( u(2,i,jbeg,k) ** 2
141 > + u(3,i,jbeg,k) ** 2
142 > + u(4,i,jbeg,k) ** 2 )
150 if (jglob.eq.ji2) then
155 phi2(i,k) = c2*( u(5,i,jfin,k)
156 > - 0.50d+00 * ( u(2,i,jfin,k) ** 2
157 > + u(3,i,jfin,k) ** 2
158 > + u(4,i,jfin,k) ** 2 )
164 c---------------------------------------------------------------------
165 c communicate in i direction
166 c---------------------------------------------------------------------
168 call exchange_5(phi1,ibeg,ifin1)
171 call exchange_5 (phi2,ibeg,ifin1)
177 frc2 = frc2 + ( phi1(i,k)
188 c---------------------------------------------------------------------
189 c compute the global sum of individual contributions to frc2
190 c---------------------------------------------------------------------
192 call MPI_ALLREDUCE( dummy,
200 frc2 = dxi * dzeta * frc2
202 c---------------------------------------------------------------------
204 c---------------------------------------------------------------------
213 if (iglob.eq.ii1) then
218 phi1(j,k) = c2*( u(5,ibeg,j,k)
219 > - 0.50d+00 * ( u(2,ibeg,j,k) ** 2
220 > + u(3,ibeg,j,k) ** 2
221 > + u(4,ibeg,j,k) ** 2 )
229 if (iglob.eq.ii2) then
234 phi2(j,k) = c2*( u(5,ifin,j,k)
235 > - 0.50d+00 * ( u(2,ifin,j,k) ** 2
236 > + u(3,ifin,j,k) ** 2
237 > + u(4,ifin,j,k) ** 2 )
243 c---------------------------------------------------------------------
244 c communicate in j direction
245 c---------------------------------------------------------------------
247 call exchange_6(phi1,jbeg,jfin1)
250 call exchange_6(phi2,jbeg,jfin1)
257 frc3 = frc3 + ( phi1(j,k)
268 c---------------------------------------------------------------------
269 c compute the global sum of individual contributions to frc3
270 c---------------------------------------------------------------------
272 call MPI_ALLREDUCE( dummy,
280 frc3 = deta * dzeta * frc3
281 frc = 0.25d+00 * ( frc1 + frc2 + frc3 )
282 c if (id.eq.0) write (*,1001) frc
286 1001 format (//5x,'surface integral = ',1pe12.5//)