[Nek5000-users] New code+recycling BC

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Fri May 14 22:36:19 CDT 2010


Hi,

Thanks for the help, I guess I based my approach on a much older version 
since pointer numbering was done much differently.
Anyhow, I got it to work now, if someone wants to build a recycling 
inflow boundary condition based on the jet example here are some 
hopefully useful hints (that were not obvious to me):
in the jet example, the inflow pipe is build on the x/y plane (where on 
each x/y plane there are 84 elements, which is ne_per_slab), and there 
are 8 layers in z (n_slab). The rest of the domain (surroundings where 
jet flows into) has all element numbers higher than 8*84.
For these reasons, it works to define a pointer to the recycling face 
for each inlet face element (which you know are elements 1-84 globally) 
as "ieshift=eg+(nslab-1)*ne_per_slab".

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
> 



More information about the Nek5000-users mailing list