Running turbJet with laminar flow inlet condition

235 views
Skip to first unread message

Nadeem Malik

unread,
Apr 5, 2024, 5:27:39 PM4/5/24
to Nek5000
Hi Neks,
Having successfully run the example turbJet with TurbPipe inlet turbulent pipe flow condition, I now want to make adjustments. 

The first is to run with laminar pipe flow inlet condition. This off course has an exact solution and should not require the turbPipe precursor simulation. The laminar flow enters through a circular orifice of diameter D in a vertical plane at x=0. 

So can I run just the turbJet with given laminar inlet flow? In turbJet.usr there are two routines for BC's, userbc and useric -- which one, or both, should I adjust for this -- and how? 

I need to understand what the following subroutines do marked "WHAT DOES THIS DO?" below?

userbc is:

e = gllel(ieg)
bID = boundaryID(iside,e).               -> WHAT DOES THIS DO?
pa = 0.0
if (cbu.eq.'o ') then
U0 = 1.0 ! characteristic velocity
delta = 0.1 ! small positive constant
pa = dongOutflow(ix,iy,iz,e,iside,U0,delta).         -> WHAT DOES THIS DO?

elseif (bID.eq.3) then ! coflow
ux = 0.0
uy = 0.0
uz = sstep(0.0, U_CO, 0.6, 0.035, r).       -> WHAT DOES sstep DO?

else ! jet
ux = valint(ix,iy,iz,e,1)                                 -> WHAT DOES valint DO?
uy = valint(ix,iy,iz,e,2)
uz = valint(ix,iy,iz,e,3)
endif

and useric is:

if (r.le.0.5) then
uz = 24*(0.5**4 - r**4)
else
uz = sstep(0.0, U_CO, 0.6, 0.035, r)    
endif

Thank you
Nadeem

YuHsiang Lan

unread,
Apr 7, 2024, 12:36:37 AM4/7/24
to Nek5000
Hi Nadeem,

The turbJet example first uses the turbPipe case to generate the turbulent flow as the turbulent inlet BC.
This saves you computational resource to have a long inlet domain for a fully developed turbulent flow.

The two cases are coupled through interpolation, which is what we called NekNek that runs two instances of Nek and interpolate solutions at given BC.
NekNek can be complicated to set up. I suggest to get familiar with the NekNek tutorial first.

Regarding to your questions
1. userbc is for boundary condition while useric is for initial condition.
    They should match at t=0 that's why they are usually similar.
2. boundaryID(iside,e) is another way to identify the boundary condition. 
    Typically, when the mesh is generate from .exo or gmsh, the sideset index is stored in the re2 after the mesh conversion.
    Nek reads the id and store it into 5th slot of the variable "bc" and copies the value to boundaryID.
3. dongOutflow is the turbulent outflow boundary condition proposed by Dong et. al. JCP 2014
    See also this chapter for comparison between Nek5000's turb_outflow.
4. sstep is just a function to evaluate a approximated step function via tanh. You should find the function in usr file.
5. valint is where the interpolated solution from other NekNek session.
    In short, NekNek interpolate the solution from other mesh(es) and use it as the value for Dirichlet boundary condition.
    In your case, this is your turbulent inflow BC coming from the turbPipe mesh. 

Hope this helps,
Yu-Hsiang
--

Nadeem Malik

unread,
Apr 7, 2024, 1:49:31 PM4/7/24
to Nek5000
Thanks Yu-Hsiang. 

That is a lot to digest, but I will go through it. There is also the documentation in Multicomponent RANS which I will work through.

Just one quick query. For the laminar flow inlet case where we have an exact flow solution, can it be simplified in any way?

Thanks
Nadeem

YuHsiang Lan

unread,
Apr 7, 2024, 2:07:11 PM4/7/24
to Nek5000
Hi Nadeem,

If you have an analytic expression for your inflow BC, you don't need neknek.
You should be able to run the turbJet standalone after these changes:
1. replace valint with your inflow profile in both useric and userbc
   For example, a parabola:  vx = 4y(1-y)

   I guess you want to define it based on the radius,
   rr = sqrt(x*x+y*y) ! x = xm1(ix,iy,iz,ie) and y = xm1(ix,iy,iz,ie) has already been assigned and stored in NEKUSE

2. replace "int" with "v  "/"t  " at the end of usrdat2 like this
     do iel=1,nelt
     do ifc=1,2*ldim
       if (cbc(ifc,iel,1).eq.'int') then
          cbc(ifc,iel,1) = 'v  '
          cbc(ifc,iel,2) = 't  '
       endif
     enddo
     enddo

Hope this helps,
Yu-Hsiang
--




Nadeem Malik

unread,
Apr 9, 2024, 11:09:24 PM4/9/24
to Nek5000
One more thing. In turbJet.usr, I see references to NEKNEK:

      call neknek_exchange  -- in userchk

      include 'NEKNEK'          -- in some subroutines.

So, I presume that I should comment these out. But, will this disrupt the rest of the code if I am to use turbJet as a stand alone code?

Thanks

Nadeem


Nadeem Malik

unread,
Jun 12, 2024, 3:30:22 PM6/12/24
to Nek5000

Hi YuHsiang,

I am trying to implement what you suggested (I could not obtain the turbulent jet velocity field even after running  running the neknek with turbPipe turbJet - even after running it for 2000 times: neknek turbPipe turbJet 24 168).

But I have a different version on turbJet: I do not see the do-loop with "cbc" in my version.Hoqw do I update userbc, useric, and usrdat in line with your suggestion in my code:

C-----------------------------------------------------------------------

      subroutine userbc (ix,iy,iz,iside,ieg)

      include 'SIZE'

      include 'TOTAL'

      include 'NEKUSE'

      include 'NEKNEK'

      integer e, bID

      e = gllel(ieg)

      bID = boundaryID(iside,e)

      pa = 0.0

      if (cbu.eq.'o  ') then

         U0 = 1.0                  ! characteristic velocity

         delta = 0.1               ! small positive constant

         pa = dongOutflow(ix,iy,iz,e,iside,U0,delta)

      elseif (bID.eq.3) then ! coflow

         ux = 0.0

         uy = 0.0

         uz = sstep(0.0, U_CO, 0.6, 0.035, r)

      else ! jet

         ux  = valint(ix,iy,iz,e,1)

         uy  = valint(ix,iy,iz,e,2)

         uz  = valint(ix,iy,iz,e,3)

      endif

      return

      end

C-----------------------------------------------------------------------

      subroutine useric (ix,iy,iz,ieg)

      include 'SIZE'

      include 'TSTEP'

      include 'NEKUSE'

      if (r.le.0.5) then

         uz = 24*(0.5**4 - r**4)

      else

         uz = sstep(0.0, U_CO, 0.6, 0.035, r)

      endif

      return

      end

C-----------------------------------------------------------------------

      subroutine usrdat2

      include 'SIZE'

      include 'TOTAL'

c set velocity BCs

      call setbc(1,1,'int') ! upstream inflow

      call setbc(2,1,'W  ') ! upstream pipe wall

      call setbc(3,1,'v  ') ! coflow

      call setbc(4,1,'SYM') ! lateral farfield

      call setbc(5,1,'o  ')

c      call setbc(5,1,'O  ')

      call neknek_setup

      return

      end

C-----------------------------------------------------------------------

Thanks
Nadeem
Reply all
Reply to author
Forward
0 new messages