subroutine fluidvolume(volume)
! calculates fluid volume of domain excluding blocks
use modglobal, only : ib,ie,ih,jb,je,jh,kb,ke,kh,dy,dxf,dzf
use modfields, only : IIc, IIcs
use modmpi, only : sumy_ibm, avexy_ibm
implicit none
real, intent(out) :: volume
real, dimension(ib:ie,kb:ke) :: sumy
real, dimension(kb:ke+kh) :: sumxy
integer k
sumy = 0.
sumxy = 0.
! ! integrate fluid volume in y
! call sumy_ibm(sumy,IIc(ib:ie,jb:je,kb:ke)*dy,ib,ie,jb,je,kb,ke,IIc(ib:ie,jb:je,kb:ke))
!
! ! integrate fluid area in x
! do k=kb,ke
! sumxy(k) = sum(sumy(ib:ie,k)*dxf(ib:ie))
! end do
! Equidistant x
call avexy_ibm(sumxy(kb:ke+kh),IIc(ib:ie,jb:je,kb:ke+kh)*dxf(1)*dy,ib,ie,jb,je,kb,ke,ih,jh,kh,IIc(ib:ie,jb:je,kb:ke+kh),IIcs(kb:ke+kh),.false.)
! integrate fluid area in z
volume = sum(sumxy(kb:ke)*dzf(kb:ke))
end subroutine fluidvolume