Error while importing the mesh: KeyError: (np.int64(2005), np.int64(4155), np.int64(4464), np.int64(225339))

Hello,
I was trying to simulate the flow around an airfoil using a 3D mesh obtained by extruding a 2D mesh along the z-axis. However, during the execution of the command pyfr import mesh.msh mesh.pyfrm, the following error occurred:

KeyError: (np.int64(2005), np.int64(4155), np.int64(4464), np.int64(225339))

Here is the link to the mesh and the .geo file:

Please provide the full backtrace.

Regards, Freddie.

$ pyfr import mesh.msh rae2822.pyfrm
Traceback (most recent call last):
  File "/lustre/home/pscavella/pyfr-venv/bin/pyfr", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/__main__.py", line 124, in main
    args.process(args)
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/__main__.py", line 138, in process_import
    mesh = reader.to_pyfrm(args.lintol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/readers/base.py", line 22, in to_pyfrm
    mesh = self._to_raw_pyfrm(lintol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/readers/gmsh.py", line 424, in _to_raw_pyfrm
    pyfrm = mesh.get_connectivity(p)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/readers/base.py", line 189, in get_connectivity
    pfpairs, pmap = self._pair_periodic_fluid_faces(bpart, resid)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/readers/base.py", line 151, in _pair_periodic_fluid_faces
    lf = resid.pop(tuple(sorted(lfn)))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: (np.int64(2005), np.int64(4155), np.int64(4464), np.int64(221979))

If you do not extrude the mesh does everything work as expected?

Regards, Freddie.

Yes, the 2d simulation works as expected.

Next step is to try replacing the periodic boundary conditions with regular conditions and seeing if that resolves the issue. If so, you can be almost certain that the mistake is in how you are specifying the periodic connectivity.

Regards, Freddie.

I tried different conditions but nothing changes.
Regards, Luca

Do you still get the following error even without periodic interfaces?

File “/lustre/home/pscavella/pyfr-venv/lib/python3.12/site-packages/pyfr/readers/base.py”, line 151, in _pair_periodic_fluid_faces
lf = resid.pop(tuple(sorted(lfn)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: (np.int64(2005), np.int64(4155), np.int64(4464), np.int64(221979))

I solved this problem by changing the way I created the mesh

Hello,

I’m encountering the same error that you posted

"
KeyError: (np.int64(7), np.int64(11), np.int64(2502), np.int64(4889))
"

I created the mesh in the same way you described. Could you share how you changed your approach to generating the mesh?