[Nek5000-users] New code+recycling BC

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Mon May 3 10:24:04 CDT 2010


Markus,

is it only a viz issue or do you have some problems in Nek after upgrading to the latest release.

Stefan


On May 3, 2010, at 4:25 PM, nek5000-users at lists.mcs.anl.gov wrote:

> Hi,
> 
> when updating the code from rev. 404 (oldvel.png) to 503
> (newvel.png), I realized a problem with the recycling
> (periodic) boundary condition for a channel simulation I am doing -
> compare the attached pictures of velocity on the inflow plane (the inflow is the Y/Z plane). For the two cases, SIZE/SIZEu, .rea, the restart step and .usr are the exact same.
> 
> Here are the relevant pieces from .usr. Have any of the functions
> changed or am I doing something wrong? It seems as if the element
> ordering is not what it was before.
> I did this based on the jet example.
> 
> Thanks,
> Markus
> 
> 
> c-----------------------------------------------------------------------
>       subroutine userbc (ix,iy,iz,iside,eg)
>       include 'SIZE'
>       include 'TOTAL'
>       include 'NEKUSE'
> 
>       common /cvelbc/ uin(lx1,ly1,lz1,lelv)
>      $              , vin(lx1,ly1,lz1,lelv)
>      $              , win(lx1,ly1,lz1,lelv)
>      $              , tin(lx1,ly1,lz1,lelv)
> 
>       integer e,eg
> 
>       e = gllel(eg)
> 
>       ux=uin(ix,iy,iz,e)
>       uy=vin(ix,iy,iz,e)
>       uz=win(ix,iy,iz,e)
> .
> ....
> 
> c-----------------------------------------------------------------------
>       subroutine userchk
>       include 'SIZE'
>       include 'TOTAL'
>       include 'ZPER'  ! for nelx,nely,nelz
>       include 'RESTART' !Needs to be here for prepost to work
>       common /cvlmsk/ vlmsk(lx1,ly1,lz1,lelt),vvol,
>      &                wt(lx1*ly1*lz1,lelt),vol_per
> 
>       integer e,f,eg,ninx,niny,ninz
> 
> .c-----Computations for recycling BC
>       speed = glsc2(vx,wt,n)/vol_per ! Where vol_per is the volume of
> the recycling box
>       starg = 1.0
>       addtemp = 1.0
>       call set_inflow(starg,speed,addtemp)   ! set up inflow BCs
> .
> ....
> 
> c-----------------------------------------------------------------------
>       subroutine set_inflow(starg,speed,addtemp)   ! set up inflow BCs
> 
>       include 'SIZE'
>       include 'TOTAL'
> 
>       integer icalld,e,eg,f
>       save    icalld
>       data    icalld /0/
> 
>       common /cvelbc/ uin(lx1,ly1,lz1,lelv)
>      $              , vin(lx1,ly1,lz1,lelv)
>      $              , win(lx1,ly1,lz1,lelv)
>      $              , tin(lx1,ly1,lz1,lelv)
> 
>       common /scruz/  ptr(lx1,ly1,lz1,lelv)
>       integer ptr,gs_bc_hndl
>       save        gs_bc_hndl
> 
>       real ratio
>       save ratio
>       data ratio / 1. /
> 
>       common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
> 
>       n = nx1*ny1*nz1*nelv
> 
>       if (icalld.eq.0) then
>          icalld = 1
>          nxyz = nx1*ny1*nz1
> 
>          do e=1,nelv
>             eg = lglel(e)
>             eo = nxyz*(eg-1)    ! offset
>             do i=1,nxyz
>                ptr(i,1,1,e) = i+eo
>             enddo
> 
>             do k=2,nz1-1        ! get rid of interior pointers
>             do j=2,ny1-1            do i=2,nx1-1
>                ptr(i,j,k,e) = 0
>             enddo
>             enddo
>             enddo
> 
>             nface = 2*ndim
>             do f=1,nface        ! connect inflow to elems downstream
>                ioff = nxyz*8    ! 5 elements in X to end of "periodic" sec.
>                if (cbc(f,e,1).eq.'v  ') then
>                  call iface_add(ptr,f,e,ioff,nx1,ny1,nz1)
>                endif
>             enddo
> 
>          enddo
> 
>          call gs_setup(gs_bc_hndl,ptr,n,nekcomm,np) ! connect v +
> downstream
> 
>       endif
> 
>       call copy(uin,vx,n)
>       call copy(vin,vy,n)
>       call copy(win,vz,n)
>       call copy(tin,t,n)
> 
>       call col2(uin,v1mask,n)
>       call col2(vin,v2mask,n)
>       call col2(win,v3mask,n)
>       call col2(tin,tmask,n)
> 
>       call gs_op(gs_bc_hndl,uin,1,1,0)  ! 1 ==> +  ! uin(inflow) =
> vx(slab_k)
>       call gs_op(gs_bc_hndl,vin,1,1,0)  ! 1 ==> +
>       call gs_op(gs_bc_hndl,win,1,1,0)  ! 1 ==> +
>       call gs_op(gs_bc_hndl,tin,1,1,0)  ! 1 ==> +
> 
>       if (speed.gt.0) then
>          ratio = .5*(starg/speed + ratio)
>          call cmult(uin,ratio,n)
>          call cmult(vin,ratio,n)
>          call cmult(win,ratio,n)
>          call cadd(tin,addtemp,n) !Substract added heat
>       endif
> 
>       return
>       end
> 
> 
> 
> <oldvel.png><newvel.png>_______________________________________________
> Nek5000-users mailing list
> Nek5000-users at lists.mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users




More information about the Nek5000-users mailing list