Convection in a cylinder

13 views
Skip to first unread message

Michael Andrew Calkins

unread,
Jan 26, 2026, 9:59:55 PM (10 days ago) Jan 26
to nek...@googlegroups.com
Hey there,

I am attempting to model convection in a cylinder and I've encountered some issues.

I've generated the mesh with Gmsh (successful -- image attached) and used gmsh2nek to convert to a .re2 file (also successful, or so I think). For the present mesh, I count 714 faces that need BCs, and this seems consistent with what's reported in logfile.out, but I get the "Error in generalev" reported in some earlier posts. I've attached all of the necessary files in case someone has any tips.

On a related note I did use the 2D mesh generated by Gmsh for a disk successfully with Nek. The cylinder was generated in Gmsh by extruding this disk.

Any advice would be appreciated!

Michael

cylinder.geo
cylinder.msh
logfile.out
rrbc_cylinder.ma2
rrbc_cylinder.par
rrbc_cylinder.re2
rrbc_cylinder.usr
SIZE

hy...@anl.gov

unread,
Jan 26, 2026, 10:25:38 PM (10 days ago) Jan 26
to Nek5000
Hi,
Can you try the following:

1, declare id_face as integer.
2, use boundaryID(ifc,iel) intead of BoundaryID(ifc,iel)

let me know if this helps.

Michael Andrew Calkins

unread,
Jan 26, 2026, 10:39:02 PM (10 days ago) Jan 26
to hy...@anl.gov, Nek5000
Hello,

Unfortunately those changes did not remove the original error. Thanks for the suggestion. 

Michael

On Jan 26, 2026, at 8:25 PM, 'hy...@anl.gov' via Nek5000 <nek...@googlegroups.com> wrote:

[External email - use caution]

--
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 visit https://groups.google.com/d/msgid/nek5000/171cc08e-81cf-4d51-a93f-bcfe47804b84n%40googlegroups.com.

YuHsiang Lan

unread,
Jan 26, 2026, 11:29:32 PM (10 days ago) Jan 26
to Nek5000
Hi Michael,

> mg_nx:           1           3           7
> Error in generalev, info=           7           6          -1

The logfile suggests this happens inside the multigrid setup for pressure solve.
At mid level, mg_nx = 3, there are 4 points + 2 extended points = 6 points each direction.
generalev info and the "-1" indicates the first diagonal entry breaks the positive definite.
This typically happens when there is a missing BC, so the overlapping Schwarz can't find the values outside the domain.

>  2.2204E-16  2.2204E-16  2.2204E-16  2.2204E-16  2.2204E-16  0.0000E+00 xyz repair 1
>  2.2204E-16  2.2204E-16  2.2204E-16  3.8987E-16  3.9562E-16  2.8917E-16 xyz repair 2
>  2.2204E-16  1.1102E-16  1.1102E-16  2.6507E-16  2.4384E-16  2.0780E-16 xyz repair 3
>  1.1102E-16  1.1102E-16  1.1102E-16  1.1102E-16  1.1102E-16  1.1102E-16 xyz repair 4
fix_geom says there are no gaps for the coordinates, so it's less likely to be a connectivity issue.

Since you said the number of tagged BC is right, I suspect the BC are assigned at the wrong location.
I'd suggest visualize the location of the BC to make sure it's not accidentally assigned to the interior. 

  subroutine usrdat2
  include 'SIZE'
  include 'TOTAL'

  ! after setting up CBC
  call rzero(vx,lx1*ly1*lz1*nelv)

  do iel = 1,nelv
  do ifc = 1,2*ldim
    if (cbc(ifc,iel,1).eq.'W  ') call facev(vx,iel,ifc,1.0,lx1,ly1,lz1)
  enddo
  enddo

  call outpost(vx,vy,vz,pr,t,'aaa')
  return
  end

Then, you can open it with paraview and check whether the values > 0.5 are indeed your desired BC location

Another check is to use multiplicity to check whether the CBC is set at the right location.

  call rone(vy,lx1*ly1*lz1*nelv)
  ifield = 1
  call dssum(vy,lx1,ly1,lz1) 

  ! for a internal face point (not on edges nor corners)
  ! vy = 1 on bdry face, 2 on internal face

  ierr1 = 0
  ierr2 = 0
  do iel = 1,nelv
  do ifc = 1,2*ldim
    call facind(kx1,kx2,ky1,ky2,kz1,kz2,lx1,ly1,lz1,ifc)
    mx = (1 + kx1) / 2 ! index of the face center, only works when lx1 > 2
    my = (1 + ky1) / 2
    mz = (1 + kz1) / 2 ! also works in 2D

    val_fc = vy(mx,my,mz,iel) ! vy at face center

    ! err1: you assign 'W  ' to an internal face
    if (cbc(ifc,iel,1).eq.'W  '.AND.val_fc.gt.1.5) ierr1 = ierr1 + 1

    ! err2: you didn't assign 'W  ' to a boundary face
    if (cbc(ifc,iel,1).ne.'W  '.AND.val_fc.lt.1.5) ierr2 = ierr2 + 1
  enddo
  enddo
  ierr1 = iglsum(ierr1,1) ! all reduce 
  ierr2 = iglsum(ierr2,1)
  if (nid.eq.0) write(*,*)'err',ierr1,ierr2

Hope this helps,
Yu-Hsiang
--

Michael Andrew Calkins

unread,
Jan 27, 2026, 12:19:02 AM (10 days ago) Jan 27
to YuHsiang Lan, Nek5000
Thanks, YuHsiang, I appreciate the help. 

I tried your second suggestion below since it didn't require firing up paraview. Here is the print out from the logfile after making that change to usrdat2:

 call usrdat2

 err         713          27

 done :: usrdat2


I think this result implies that most of the BCs are not assigned correctly? However, now I am left wondering how? Am I misunderstanding how boundaryID is working? gmsh2nek assigned the boundaries to the following ids: 

1=sidewall, 2=bottom, 3=top


Dillon Shaver

unread,
Jan 27, 2026, 1:31:31 PM (10 days ago) Jan 27
to Nek5000
Michael,

I took a quick look at the geo file. The WALL boundary isn't assigned to correct faces in gmsh. If you fix that, it should fix the issues.

-Dillon

Michael Andrew Calkins

unread,
Feb 2, 2026, 12:42:36 PM (4 days ago) Feb 2
to Dillon Shaver, Nek5000
Thank you Dillon for the advice! 

It took a bit more work to get those faces identified correctly. I'm attaching working example files for rotating convection in a cylinder in case someone finds this useful. Gmsh version = 4.15.0



rotating_cylinder.tar.gz
Reply all
Reply to author
Forward
0 new messages