Issue running a 2D coarse mesh

32 views
Skip to first unread message

Filipe Brandao

unread,
Dec 5, 2025, 12:19:02 PM (8 days ago) Dec 5
to Nek5000
Hi, I am trying to run a very simple and coarse 2D backstep geometry. Mesh was generated in CUBIT as a .exo file and converted by using exo2nek and genmap tools without errors.

The mesh is 2D and only contains 465 elements. 'lpmin' is set to 1 in SIZE file. However when running, it crashes with the following error:

Error: Nek has has been compiled for
         number of elements/proc  (lelt):         468
         total number of elements (lelg):         465

  This run requires:
     lelt >=            0  for np =            2
     lelg >=            0

I tried running w/ 2 processors, but the error is the same if I run in serial. 

Appreciate any help here.
 Filipe

Fischer, Paul

unread,
Dec 5, 2025, 4:33:50 PM (8 days ago) Dec 5
to Filipe Brandao, Nek5000
Can you paste your SIZE file here?

Best,
Paul


From: nek...@googlegroups.com <nek...@googlegroups.com> on behalf of Filipe Brandao <filipe....@gmail.com>
Sent: Friday, December 5, 2025 11:19 AM
To: Nek5000 <nek...@googlegroups.com>
Subject: [nek5000] Issue running a 2D coarse mesh
 
--
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/21a69820-b5a0-465e-97cb-4976e53f6792n%40googlegroups.com.

Filipe Brandao

unread,
Dec 5, 2025, 4:49:19 PM (8 days ago) Dec 5
to Nek5000
Hi Paul,

Sure, it is below:

c
c     Include file to dimension static arrays
c     and to set some hardwired run-time parameters
c
      integer ldim,lx1,lxd,lx2,lx1m,lelg,lelt,lpmin,ldimt
      integer lpelt,lbelt,toteq,lcvelt
      integer lelx,lely,lelz,mxprev,lgmres,lorder,lhis
      integer maxobj,lpert,nsessmax,lxo
      integer lfdm,ldimt_proj,lelr

      ! BASIC
      parameter (ldim=2)               ! domain dimension (2 or 3)
      parameter (lx1=4)                ! GLL points per element along each direction
      parameter (lxd=6)               ! GL  points for over-integration (dealiasing)
      parameter (lx2=lx1)              ! GLL points for pressure (lx1 or lx1-2)

      parameter (lelg=465)             ! max number of global elements
      parameter (lpmin=1)              ! min number of MPI ranks
      parameter (lelt=lelg/lpmin + 3)  ! max number of local elements per MPI rank
      parameter (ldimt=1)              ! max auxiliary fields (temperature + scalars)

      ! OPTIONAL
      parameter (ldimt_proj=1)         ! max auxiliary fields residual projection
      parameter (lelr=lelt)            ! max number of local elements per restart file
      parameter (lhis=3)               ! max history/monitoring points
      parameter (maxobj=1)             ! max number of objects
      parameter (lpert=1)              ! max number of perturbations
      parameter (toteq=1)              ! max number of conserved scalars in CMT
      parameter (nsessmax=1)           ! max sessions to NEKNEK
      parameter (lxo=lx1)              ! max GLL points on output (lxo>=lx1)
      parameter (mxprev=20)            ! max dim of projection space
      parameter (lgmres=30)            ! max dim Krylov space
      parameter (lorder=3)             ! max order in time
      parameter (lx1m=1)               ! GLL points mesh solver
      parameter (lfdm=0)               ! unused
      parameter (lelx=1,lely=1,lelz=1) ! global tensor mesh dimensions

      parameter (lbelt=1)              ! lelt for mhd
      parameter (lpelt=1)              ! lelt for linear stability
      parameter (lcvelt=1)             ! lelt for cvode

      ! INTERNALS
      include 'SIZE.inc'


YuHsiang Lan

unread,
Dec 7, 2025, 2:49:32 PM (6 days ago) Dec 7
to Nek5000
Hi Filipe,

Can you check the header of the re2 file?
  head -c 80 *re2

Somehow, the nelgt becomes 0 and might come from an invalid re2 file.

Thanks,
Yu-Hsiang
--

Filipe Brandao

unread,
Dec 7, 2025, 4:31:43 PM (6 days ago) Dec 7
to Nek5000
Hi YuHsiang,

this is what I have in the header of re2 file:

#v004             465  2             465   1 hdr                                

YuHsiang Lan

unread,
Dec 7, 2025, 4:47:35 PM (6 days ago) Dec 7
to Nek5000
Hi Filipe,

What version of Nek5000 are you using?

Can you check whether your code is newer than this commit?
Or, open reader_re2.f, see if "#v004" is in the subroutine "read_re2_hdr".

The older header (v002) uses "i9i3i9" but the newer one (v004) has "i16i3i16". I think that's why nek reads nelgt=0 from the header:
  12345123456789123123456789
  #v004             465  2             465   1 hdr  

Two solutions if it's the case:
a. Use the latest Nek5000 from GitHub master 
b. Manually change the first 80 characters of your re2 to this format (and keep the rest the same): 
  0        1         2         3         4         5         6         7         8|      
  12345678901234567890123456789012345678901234567890123456789012345678901234567890|
  12345123456789123123456789
  #v002      465  2      465            hdr                                       |<binary>

You should see the exact same size from "ls -ltra *re2" before and after the modification.
Also, "head -c 81 *re2" will print binary code at 81st character.

Hope this helps,
Yu-Hsiang
--

Filipe Brandao

unread,
Dec 8, 2025, 3:54:42 PM (5 days ago) Dec 8
to Nek5000
I just pulled the latest master branch and the error persists. 

Filipe Brandao

unread,
Dec 8, 2025, 4:56:56 PM (5 days ago) Dec 8
to Nek5000
It works when adjusting the header of the .re2 file. However when doing the same for a 3D mesh, it crashes with the error:

reading mesh data ...

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f3fe4c5b171 in ???
#1  0x7f3fe4c5a313 in ???
#2  0x7f3fe40eab4f in ???
#3  0x40dff8 in ???
#4  0xffffffffffffffff in ???
Segmentation fault (core dumped)

For 3D meshes, the binary starts at the 81st character too?
Reply all
Reply to author
Forward
0 new messages