Genbox

518 views
Skip to first unread message

Eva Muñoz Salamanca

unread,
Feb 24, 2020, 4:36:28 AM2/24/20
to Nek5000
Hello,

I am trying to study the flow in this 2 pipes. If the mesh is done with Gmsh it is no possible to do it the axilsimetric, only in 2d.
Is there any posibility of doing this with genbox to be able to do the pipe axilsimetric?

Thanks,

Eva.

Philipp Schlatter

unread,
Feb 24, 2020, 8:09:05 AM2/24/20
to nek...@googlegroups.com
Hi, this flow - if I understand it correctly - cannot be axisymmetric
because you break the symmetry with the bends. So I guess you need to
run 3D if you want a circular crosssection. You might be able to have a
symmetry condition in the middle to get away with just half the effort.

Philipp
> --
> You received this message because you are subscribed to the Google
> Groups "Nek5000" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to nek5000+u...@googlegroups.com
> <mailto:nek5000+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nek5000/851c5cfd-ce5c-4ae5-8afd-9523ab0e3ca6%40googlegroups.com
> <https://groups.google.com/d/msgid/nek5000/851c5cfd-ce5c-4ae5-8afd-9523ab0e3ca6%40googlegroups.com?utm_medium=email&utm_source=footer>.

Eva Muñoz Salamanca

unread,
Feb 26, 2020, 5:19:35 AM2/26/20
to Nek5000
Thanks Philipp,

And, after finishing the 3D mesh en gmsh, how can a convert it to a Nek5000 format?

Thanks,
Eva.

Akshay Patil

unread,
Feb 26, 2020, 5:53:41 AM2/26/20
to Eva Muñoz Salamanca, Nek5000
Hi Eva,

You can run gmsh2nek to convert the Gmsh .mesh to Nek5000 file. According to my experience, you need to make sure that your mesh is at least 2nd order and the mesh version is 2.2. You can ensure this by adding the following lines to the top of your script and then generating the mesh.

//Sets the mesh element order
Mesh.ElementOrder = 2;

//Sets the mesh version for exporting the mesh
Mesh.MshFileVersion = 2.2;

If you have periodic boundaries, the tool will ask you to input the 'Pair' of periodic boundaries. It is pretty straight forward. However, I am curious if someone can answer how exactly are the non-periodic boundary conditions specified in userbc() subroutine (When one has say 2 different types of boundaries).


Hope this helps!

--
You received this message because you are subscribed to the Google Groups "Nek5000" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nek5000+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nek5000/505d2cba-c9ca-45c2-8f06-0645f31ae3aa%40googlegroups.com.


--
Regards,
Akshay Patil

Daniyal Ahmed Khan

unread,
May 6, 2021, 2:22:21 AM5/6/21
to Nek5000
Has anyone figured out a way to impose non-periodic boundaries in .usr file after specifying periodic boundaries in gmsh2nek?

hy...@anl.gov

unread,
May 6, 2021, 1:22:35 PM5/6/21
to Nek5000
However, I am curious if someone can answer how exactly are the non-periodic boundary conditions specified in userbc() subroutine (When one has say 2 different types of boundaries).

you should use some code like this :

do iel=1,nelv 
do ifc=1,2*ndim 
 id_face = bc(5,ifc,iel,1)
if (id_face.eq.1) then ! surface 1 for inlet 
 cbc(ifc,iel,1) = 'v ' 
 elseif (id_face.eq.2) then ! surface 2 for outlet 
 cbc(ifc,iel,1) = 'O ' 
 elseif (id_face.eq.3) then ! surface 3 for wall 
 cbc(ifc,iel,1) = 'W ' 
 endif 
 enddo 
 enddo

just avoid surfaces with periodicity.

however, if you are solving temperature and passive scalar, then you have to add
 cbc(ifc,iel,2) = 'P ' 
to  all periodic surfaces.

Jundi He

unread,
Jun 14, 2021, 8:21:11 AM6/14/21
to Nek5000
Hi,

I am running a simulation using the .re2 file converted by gmsh2nek, and these are the physical groups defined in the .msh file: 

$MeshFormat
2.2 0 8
$EndMeshFormat
$PhysicalNames
4
2 1 "inlet"
2 2 "outlet"
2 3 "wall"
3 4 "fluid"
$EndPhysicalNames


In the .usr file, I have defined the boundary conditions in subroutine userbc: 

c-----------------------------------------------------------------------
      subroutine userbc(ix,iy,iz,iside,eg) ! set up boundary conditions
c
c     NOTE ::: This subroutine MAY NOT be called by every process
c
c      implicit none

      integer ix,iy,iz,iside,eg, id_face

      include 'SIZE'
      include 'TOTAL'
      include 'NEKUSE'

c      if (cbc(iside,gllel(eg),ifield).eq.'v01')

       do iel = 1,nelv
          do ifc = 1,2*ndim
            id_face = bc(5,ifc,iel,1)
            if (id_face .eq. 1) then   ! inlet 
               cbc(ifc,iel,1)= 'v'
               cbc(ifc,iel,2)= 't'
            elseif(id_face .eq. 2) then   ! outlet
               cbc(ifc,iel,1)= 'O'
               cbc(ifc,iel,2)= 'I'
            elseif(id_face .eq. 3) then   ! wall
               cbc(ifc,iel,1)= 'W'
               cbc(ifc,iel,2)= 'I'
            endif
         enddo
      enddo

      !inlet

      if(ifield .eq. 1) then
      ux   = 10.0       ! inlet velocity
      uy   = 0.0
      uz   = 0.0
      elseif(ifield .eq. 2) then
      temp = 50.0     ! inlet temperature
      endif

      return
      end

But when I looked at the simulation result, it seems that the inlet condition is not correctly imposed. Can anyone spot some mistakes from the subroutine userbc? Thanks! 

Regards!
Jundi

Fischer, Paul

unread,
Jun 14, 2021, 9:20:22 AM6/14/21
to Jundi He, Nek5000

Dear Jundi,

You need to set your cbc() arrays outside​ of userbc....

It will call userbc only for those element/faces where user input is
needed (e.g., for the 'v  ' and 't ' faces, in your case).

Also, I strongly recommend setting the cbc to be 'v-space-space'

3 characters, v, followed by 2 spaces.

Same for 't  '

I recommend setting the bcs in usrdat2().  Just pull your first set of
loops and put them there along with include of SIZE and TOTAL.

hth,
Paul

From: nek...@googlegroups.com <nek...@googlegroups.com> on behalf of Jundi He <jh...@sheffield.ac.uk>
Sent: Monday, June 14, 2021 7:21 AM
To: Nek5000 <nek...@googlegroups.com>
Subject: Re: [nek5000] Re: Genbox
 

Jundi He

unread,
Jun 14, 2021, 9:38:26 AM6/14/21
to Nek5000
Dear Paul,

Many thanks for the explanation, the problem has been solved! 

Regards!
Jundi

Reply all
Reply to author
Forward
0 new messages