Dear Chunheng,
The code below (also included as attachment) shows how to compute
a surface integral over a desired patch.
surface_flux() is a similar routine, also found in navier5.f
Hth.
Best,
Paul
c-----------------------------------------------------------------------
subroutine test
include 'SIZE'
include 'TOTAL'
integer e,f
nface = 2*ndim
pr_int = 0. ! Integrate pressure over given section
ar_int = 0. ! Compute area over given section
do e=1,nelv
xbar = xm1(2,2,1,e)
if (-1.lt.xbar.and.xbar.lt.1) then ! Near the origin
do f=1,nface
if (cbc(f,e,1).eq.'v ') then ! on the "moving" wall
call surface_int(pr_loc,ar_loc,pr,e,f)
pr_int = pr_int + pr_loc ! Integrated pressure
ar_int = ar_int + ar_loc ! Integrated area
endif
enddo
endif
enddo
pr_int = glsum(pr_int,1) ! Sum across all processors
ar_int = glsum(ar_int,1) ! Sum across all processors
pr_avg = pr_int / ar_int ! Average pressure
return
end
c-----------------------------------------------------------------------