[Nek5000-users] Volume average (local)

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Mon Jan 18 09:02:36 CST 2016


Hi Neks,
I am interested in the scalar average inside a specified volume (similar to
the glsc2 routine, but only in a small volume). The volume is given by
means of the x/y/z-coordinate. V=(x_2-x_1)*(y_2-y_1)*(z_2-z_1), where “1”
indicates the lower and “2” the upper coordinate.

My first idea was (e.g. for the velocity in streamwise direction):
=========================================================
real x1, x2, y1, y2, z1, z2
real lval, lvol, gval, gvol
real vxavg
integer i,j,k,e

[...]

! Specify the volume
x1=1.0
x2=2.0
y1=0.0
y2=0.5
z1=0.0
z2=1.0

! Init
lvol=0.0
lval=0.0
gval=0.0
gvol=0.0

! Loop
do e=1,nelt
do k=1,nz1
do j=1,ny1
do i=1,nx1
    if (xm1(i,j,k,e)>=x1 .and. xm1(i,j,k,e)<=x2
     & .and.
     & ym1(i,j,k,e)>=y1 .and. ym1(i,j,k,e)<=y2
     & .and.
     & zm1(i,j,k,e)>=z1 .and. zm1(i,j,k,e)<=z2
     & ) then

        lvol=lvol+bm1(i,j,k,e) ! Volume
        lval=lval+vx(i,j,k,e)*bm1(i,j,k,e) ! Weighted scalar value

    end if
end do
end do
end do
end do

! MPI
call gop(gval,lval,'+  ',1)
call gop(gvol,lvol,'+  ',1)

! Volume averaged streamwise velocity
vxavg=gval/gvol
=========================================================

This unfortunately doesn't work. Do you see where the problem is?

Thanks in advance!
Jan F.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/nek5000-users/attachments/20160118/bec28dfd/attachment.html>


More information about the Nek5000-users mailing list