[Nek5000-users] New code+recycling BC

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Tue May 11 09:22:48 CDT 2010


Hi Markus,

      izero(glo_num,n)

should be rewritten as a loop, since glo_num is int8 but izero
is looking for i4.

Also, if glo_num is declared locally in that routine, it needs
to be updated to integer*8.

And, finally, if you anticipate more than 2 billion points (total)
then ishift and nxyz should be declared to be integer*8

Thanks for bringing this to my attention - I can see that I need
to do the same in my codes.

Paul






On Tue, 11 May 2010, nek5000-users at lists.mcs.anl.gov wrote:

> Hi,
>
> thanks for the update. I looked at the jet example and can't quite figure out 
> what to change such that my case works with the new code.
>
> My domain has a box consisting of 9 elements in the "periodic" x-direction, 
> 12 elements in y and 8 elements in z. The inflow is the y/z plane.
> The numbering is such that the first periodic slab is from element 1 (inflow) 
> to 9, then 10 to 19, ... 12 times (in y) to 100-108. Then all other elements 
> (the "non-periodic" part) follow, which are a total of 444 per x/y plane. 
> Thus, the next 12 slabs (at the second level in z) would start with 445-453, 
> 454-462, ...12 times, and so forth.
>
> Here is the part that is giving me trouble, since I don't know what to assign 
> for n_in_pipe and ne_per_slab.
>
> c     Connect slab next to the last with inflow (recycling method)
>      if(istep.eq.0) then
>        call izero(glo_num,n)
>        do e=1,nelv
>           eg = lglel(e)
>           if (eg.le.n_in_pipe) then
>              do j=1,nx1*ny1             ! Only on FACE 5 (inflow)
>                 iloc          = j + nxyz*(e -1)
>                 glo_num(iloc) = j + nxyz*(eg-1)
>                 ieshift       = eg + (nslab-1)*ne_per_slab
>                 ishift        = j + nxyz*(ieshift-1)
>                 if (eg.le.ne_per_slab) glo_num(iloc) = ishift
>              enddo
>           endif
>        enddo
>        call gs_setup(gs_bc_hndl,glo_num,n,nekcomm,mp)
>      endif
>
> Thanks,
> Markus
>
>
>
> nek5000-users at lists.mcs.anl.gov wrote:
>> Hi Markus,
>> 
>> yes we changed glo_num to be an 8-byte integer array. Unfortunately we did 
>> not update the examples. I'll update the turbJet example.
>> 
>> Stefan
>> 
>> 
>> On May 5, 2010, at 12:39 AM, nek5000-users at lists.mcs.anl.gov wrote:
>> 
>>> Hiu,
>>> 
>>> sorry about the delay, to make sure I regenerated the problem.
>>> 
>>> I did as you suggested, it is still messed up when opening the first fld 
>>> dump in
>>> VisIt with the meta file containing only one file.
>>> 
>>> What I meant by element ordering is the way the recycling b.c. is set up, 
>>> where
>>> the "outflow" face of recycling box is established by counting a number of
>>> elements downstream from the inflow, as it is done in the jet example. I 
>>> have a
>>> suspicion that something changed there (not in my .rea file, though).
>>> The problem came about when updating Nek from 404 to 503, I did not change
>>> Visit.
>>> 
>>> Thanks,
>>> Markus
>>> 
>>> 
>>> 
>>> Quoting nek5000-users at lists.mcs.anl.gov:
>>> 
>>>> Can you dump a field file including the geometry and then visualize it 
>>>> using
>>>> VisIt (your metadata file should only contain one single fld). Is it 
>>>> still
>>>> messed up?
>>>> 
>>>> Stefan
>>>> 
>>>> 
>>>> On May 3, 2010, at 5:24 PM, nek5000-users at lists.mcs.anl.gov wrote:
>>>> 
>>>>> 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
>>>>> _______________________________________________
>>>>> Nek5000-users mailing list
>>>>> Nek5000-users at lists.mcs.anl.gov
>>>>> https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
>>>> _______________________________________________
>>>> Nek5000-users mailing list
>>>> Nek5000-users at lists.mcs.anl.gov
>>>> https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
>>>> 
>>> 
>>> _______________________________________________
>>> Nek5000-users mailing list
>>> Nek5000-users at lists.mcs.anl.gov
>>> https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
>> 
>> _______________________________________________
>> Nek5000-users mailing list
>> Nek5000-users at lists.mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
>> 
> _______________________________________________
> 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