[Nek5000-users] Energy source term

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Fri Nov 24 08:41:44 CST 2017


Yes -- you will want a smooth forcing in space - unless the jump occurs at an element boundary.


If the forcing has a jump discontinuity across element boundaries it's usually easier to set a flag in (say) usrdat2() that identifies which elements are to have the source term and which are not.  Then add something like the following to userq:


      common /myflag/ qflag(lx1,ly1,lz1,lelt)

      integer qflag,e


      qvol=0

      e=gllel(ieg)

      if (qflag(ix,iy,iz,e).eq.1) qvol=ampli*sin(2.0*pi*frec*time) ! pi defined by nek


       etc.


In usrdat2(), use something like


     common /myflag/ qflag(lx1,ly1,lz1,lelt)

      integer qflag,e


      integer e

      n = lx1*ly1*lz1*nelt

      nxyz=lx1*ly1*lz1


      call izero(qflag,n)

      do e=1,nelt

            xtest = xm1(2,2,1,e)

            ytest = ym1(2,2,1,e)

            if  ..... xtest and ytest in your bounds ....    call ione(qtest(1,1,1,e),nxyz)

      enddo


hth,

Paul


________________________________
From: Nek5000-users <nek5000-users-bounces at lists.mcs.anl.gov> on behalf of nek5000-users at lists.mcs.anl.gov <nek5000-users at lists.mcs.anl.gov>
Sent: Friday, November 24, 2017 3:20 AM
To: nek5000-users at lists.mcs.anl.gov
Subject: Re: [Nek5000-users] Energy source term

Hi,
The lines appear fine, however I would not use a force that goes from
zero to the final value within on grid point; this might lead to
oscillations in the solution. Perhaps a smoothing might be a better
solution.

Philipp

On 2017-11-24 05:07, nek5000-users at lists.mcs.anl.gov wrote:
> Hi all,
>
> If I need to add an oscillating source term in the energy equation for a
> small region in a 2D domain would it be fine to do it this way, with
> these variables: ?
>
> c =============================
>        subroutine userq  (ix,iy,iz,ieg)
>        include 'SIZE'
>        include 'TOTAL'
>        include 'NEKUSE'
>
>
>        real pii,frec,ampli
>
>        pii=4.0*atan(1.0)
>        frec=0.005
>        ampli=1.0
>
>
>        if (x .ge. 0 .and. x .le. 0.02 .and.
>       $ y .ge. 0 .and. y .le. 0.02) then
>
>            qvol = ampli*sin(2.0*pii*frec*time)
>
>        else
>
>            qvol = 0.0
>
>        end if
>
>
>        source = 0.0
>
>        return
>        end
> c ==================================
>
>
> Thanks in advance,
>
> JP.
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/nek5000-users/attachments/20171124/f5ae3f5e/attachment.html>


More information about the Nek5000-users mailing list