[Nek5000-users] linear stability tool

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Mon Mar 21 04:24:45 CDT 2016


Hi

Sorry for late reply (I was busy with other stuff). First of all, when 
you write you do not see evolution of the perturbation do you mean lack 
of output files or something else? By default nek outputs only the 
non-linear fields not the perturbation, so if you would like to see the 
evolution of the perturbation itself you need to add in the userchk 
something like this

       include 'SIZE'            ! NX1, NY1, NZ1, NELV, NIO
       include 'TSTEP'           ! ISTEP, IOSTEP
       include 'SOLN'            ! V[XYZ]P, TP

!     write perturbation field
       if (mod(ISTEP,IOSTEP).eq.0) then
          call outpost2(VXP,VYP,VZP,PRP,TP,0,'prt')
       endif

Other stuff is initialisation of the perturbation. You do it in useric 
only. To distinguish between base-flow (non-linear solution) and 
perturbation you use jp integer from SOLN. So the code should look in 
the following way:
       subroutine useric (ix,iy,iz,ieg)
       include 'SIZE'
       include 'NEKUSE'          ! U[XYZ], X, Y
       include 'SOLN'              ! JP

       real amp, ran


       if (JP.eq.0) then

c      place for base flow

       else
c     velocity for perturbation
c     random distribution
       amp = 1.0
       ran = 3.e4*(ieg+X*sin(Y)) - 1.5e3*ix*iy + .5e5*ix
       ran = 1.e3*sin(ran)
       ran = 1.e3*sin(ran)
       ran = cos(ran)
       UX  = ran*amp

       ran = 2.3e4*(ieg+X*sin(Y)) + 2.3e3*ix*iy - 2.e5*ix
       ran = 1.e3*sin(ran)
       ran = 1.e3*sin(ran)
       ran = cos(ran)
       UY  = ran*amp

       UZ = 0.0
       endif
c     no temperature this time

       return
       end

This would set initial values for base flow and perturbation, but it is 
called only once (as should be). There is not need to average element 
faces after this routine as code does it by itself. Next question. Why 
do you use global element number lelg in you arrays with combination of 
gop? It SHOUDLN'T be used this way unless you have no other way. This 
prevents any scaling, as you force the code to store the whole global 
mesh on every processor. You can do it with small toy problem, but not 
with the real case running on 10k processors. Nek is the distributed 
memory software, and avoids storing non-local data unless it is really 
need it (e.g. global-to-local element numbering). You should work with 
local grid only (lelt, nelt; lelv, nelv) and perform global face 
averaging with dssum.
Under
ftp://ftp.mech.kth.se/pub/adam/Nek5000/Creta/
you can find some linear example for lid driven cavity. It you can start 
to play with it and later introduce time dependent base flow. The 
easiest solution would be changing sing of param31.
Regards
Adam


On 2016-03-17 06:07, nek5000-users at lists.mcs.anl.gov wrote:
> Thank you Adam,
>
> to start with the implementation, I am re-defining the base flow (as 
> function of t) each time step. The base flow is time dependent, 
> however, I cannot see any evolution of the perturbation variables. I 
> have set param31=-1. At the beginning of the simulation I am adding 
> some random noise to the perturbed variables in the following way:
>
>       common /scrns/ uf(lx1,ly1,lz1,lelg),vf(lx1,ly1,lz1,lelg),
>      +    wf(lx1,ly1,lz1,lelg)
>
>       n = nelgv*nx1*ny1*nz1
>
>       if (istep.eq.0) then
>          call rzero(uf,n)   ! zero-out u on all processors
>          call rzero(vf,n)
>          call rzero(wf,n)
>
>          eps = 0.1
>          call add_noise(uf,vf,wf,n,eps) ! Subroutine that calculates 
> random noise variables
>
>          call gop(uf,work,'+  ',n)
>          call gop(vf,work,'+  ',n)
>          call gop(wf,work,'+  ',n)
>
>          call opcopy(vxp(1,jp),vyp(1,jp),vzp(1,jp),uf,vf,wf) ! COPY TO 
> PERTURBATION VARIABLES
>
>        end if
>
> In SIZE: lpert=1
>
>
> However the perturbed variables don't seem to change and they don't 
> seem to have any effect on the flow. If I plot my results, I can only 
> see the base flow varying with time (following its definition), but 
> nothing else. In addition, vz is always maintained to 0 (or to any 
> initial condition).
>
> Should I initialize (or define) the perturbation variables in a 
> different way?
>
> Best regards,
> SL
>
>
> El 16-03-2016 10:02, nek5000-users at lists.mcs.anl.gov escribió:
>> Hi
>>
>> I didn't work with time dependent base flow, so I'm not sure if there
>> are some serious problem in implementation or not. First of all, the
>> base flow is stored in the arrays for non linear solution (vx, vy, vz)
>> and the perturbation in (vxp,vyp,vzp) (both in SOLN). Negative value
>> of param(31) sets the logical ifbase to .false. excluding call to
>> fluid in nek_advance. In this case only fluidp is executed. To get
>> time dependent base flow you could set positive param(31) and comment
>> ifbase check in arnoldi initialisation routine. This would activate
>> fluid and evolve both perturbation and base flow. In this case you
>> would need to resent vx,vy,vz to your initial conditions for base flow
>> at the end of every arnoldi cycle (where pressure is set to zero).
>> Other solution would be keeping ifbase=.false. and recalculating vx,
>> vy,vz at every step within arnoldi cycle. That what you wrote in your
>> mail, but this should be mostly local operation. I do not see any
>> reason to use gop routines. If you have analytical solution for base
>> flow you simply replace vx,vy,vz with new values base on the position
>> of the gll point (xm1,ym1,zm1 arrays in GEOM) and the time within the
>> given cycle. If you are not 100% sure the function is continuous at
>> the element faces, edges and vertices, you can add averaging step:
>> !     face averaging
>>             call opdssum(VX,VY,VZ)
>>             call opcolv (VX,VY,VZ,VMULT)
>> vmult is inverse of grid point multiplicity and is stored in SOLN. No
>> more global operations is required. However, I'm not sure if this
>> method would work, as ifbase shows up in navier5.f as well, and one
>> would need to check the code to see what variables are really used. I
>> would guess it should work, but I cannot guarantee it. You can try.
>> You have to be sure the base flow evolution is exactly the same in
>> each arnoldi cycle, to mimic the matrix operation properly.
>> Regards
>> Adam
>>
>> On 2016-03-15 13:18, nek5000-users at lists.mcs.anl.gov wrote:
>>> Hi Adam,
>>>
>>> thank you, it works now.
>>>
>>> However I still have a question about this tool. My base flow is 
>>> time dependent, so I did in usrchk
>>>
>>> call opcopy (u,v,w,vx,vy,vz)
>>> u=u*function(time)
>>> v=v*function(time)
>>> w=w*function(time)
>>>
>>> call gop(u,work,'+  ',n)
>>> call gop(v,work,'+  ',n)
>>> call gop(w,work,'+  ',n)
>>>
>>> do e=1,nelv
>>>    eg = lglel(e)
>>>    call copy(vx(1,1,1,e),u(1,1,1,eg),nxyz)
>>>    call copy(vy(1,1,1,e),v(1,1,1,eg),nxyz)
>>>    call copy(vz(1,1,1,e),w(1,1,1,eg),nxyz)
>>> enddo
>>>
>>> However, I am not sure how to specify this velocity filed as the 
>>> base flow each time step...
>>>
>>> Thank you in advance.
>>> SL
>>>
>>> El 15-03-2016 19:06, nek5000-users at lists.mcs.anl.gov escribió:
>>>> Hi
>>>>
>>>> To force base flow to be constant you have to set negative param(31)
>>>> in your ###.rea file. Something like
>>>>    -1.00000     p031 NPERT: #perturbation modes
>>>> Of course you need the base flow as well. It could be analytical one
>>>> set in useric, or just a field read during initialisation.
>>>> Regards
>>>> Adam
>>>>
>>>>
>>>> On 2016-03-15 08:49, nek5000-users at lists.mcs.anl.gov wrote:
>>>>> Hi Neks,
>>>>>
>>>>> I'm trying to use the linear stability tool of Nek5000.
>>>>>
>>>>> To start with, I am trying to run the ext_cyl example. However, I 
>>>>> have found the following problem:
>>>>>
>>>>> ERROR: arnoldi assumes constant base flow.
>>>>>
>>>>> I have found on the README tutorial that the base flow has to be 
>>>>> specified on the .rea file. I have included a file in the 
>>>>> PRESOLVE/RESTART option, however I still have the same error.
>>>>>
>>>>> What should I modify?
>>>>>
>>>>> Finally, I have also used a subroutine defined in the .usr file 
>>>>> that reads the file containing the base flow. However, the error 
>>>>> persist...
>>>>>
>>>>> Could you help me, please?
>>>>>
>>>>> Cheers
>>>>> SL
>>>>> _______________________________________________
>>>>> 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