import CGNS mesh

46 views
Skip to first unread message

Junting Chen

unread,
Jan 22, 2020, 4:57:12 PM1/22/20
to PyFR Mailing List
hello, when trying to import a CGNS mesh (YF-17 from cgns website), I am getting:

jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ pyfr import yf17.cgns qqq.pyfrm
Traceback (most recent call last):
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/cgns.py", line 114, in _errcheck
    raise self._statuses[status]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pyfr", line 11, in <module>
    load_entry_point('pyfr==1.9.0', 'console_scripts', 'pyfr')()
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/__main__.py", line 110, in main
    args.process(args)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/__main__.py", line 121, in process_import
    reader = get_reader_by_extn(extn, args.inmesh)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/__init__.py", line 19, in get_reader_by_extn
    return reader_map[extn](*args, **kwargs)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/cgns.py", line 375, in __init__
    self._file = file = cgns.open(msh.name)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/cgns.py", line 120, in open
    self.lib.cg_open(bytes(name, 'utf-8'), self.CG_MODE_READ, file)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/cgns.py", line 116, in _errcheck
    raise CGNSError
pyfr.readers.cgns.CGNSError


I have CGNS 3.4 installed, also created a path variable PYFR_LIBRARY_PATH and link to libcgns.so. Previously, it was complaining libcgns.so not found.

Thanks in advance!

Junting Chen

Yoshiaki Abe

unread,
Feb 4, 2020, 10:15:56 PM2/4/20
to PyFR Mailing List
Hi Junting,

I have succeeded to use the latest pyfr and CGNS3.4.0 to import both yf17.cgns.gz and yf17_hdf5.cgns.gz.
So, I would recommend to build and install from the source using cmake:
$ git clone https://github.com/CGNS/CGNS.git
$ cd CGNS
$ mkdir build
$ cd build
$ cmake ..
$ ccmake .
Then, followings are what I set. I have once experienced enabling 64bit caused error in CGNS3.3.0, so I have turned it off (but not sure if it's ok now).
CGNS_BUILD_CGNSTOOLS             ON                                                                                 
 CGNS_BUILD_SHARED                ON                                                                                 
 CGNS_BUILD_TESTING               OFF                                                                                
 CGNS_ENABLE_64BIT                OFF                                                                                
 CGNS_ENABLE_BASE_SCOPE           OFF                                                                                
 CGNS_ENABLE_FORTRAN              OFF                                                                                
 CGNS_ENABLE_HDF5                 ON                                                                                 
 CGNS_ENABLE_LEGACY               OFF                                                                                
 CGNS_ENABLE_MEM_DEBUG            OFF                                                                                
 CGNS_ENABLE_SCOPING              OFF                                                                                
 CGNS_ENABLE_TESTS                OFF                                                                                
 CGNS_USE_SHARED                  ON                                                                                 
 CMAKE_BUILD_TYPE                 Release                                                                            
 CMAKE_INSTALL_PREFIX             /data/home/yoshiaki/local/CGNS/build                                               
 HDF5_C_LIBRARY_dl                /usr/lib64/libdl.so                                                                
 HDF5_C_LIBRARY_hdf5              /usr/lib64/libhdf5.so                                                              
 HDF5_C_LIBRARY_m                 /usr/lib64/libm.so                                                                 
 HDF5_C_LIBRARY_sz                /usr/lib64/libsz.so                                                                
 HDF5_C_LIBRARY_z                 /usr/lib64/libz.so                                                                 
 HDF5_NEED_MPI                    OFF                                                                                
 HDF5_NEED_SZIP                   OFF                                                                                
 HDF5_NEED_ZLIB                   OFF      
Then, export LD_LIBRARY_PATH=the path to libcgns.so, and install pyfr.
Note that it is also important to appropriately link HDF5 library in libcgns.so, which is discussed in the following thread:
https://groups.google.com/d/msg/pyfrmailinglist/qp5r3nlsONQ/4YzHuyGwEQAJ

I hope it helps you.

Regards,
Yoshiaki


2020年1月23日木曜日 6時57分12秒 UTC+9 Junting Chen:

Junting Chen

unread,
Feb 6, 2020, 5:05:50 PM2/6/20
to PyFR Mailing List
Thanks a lot, Yoshiaki. With your help I have successfully (no error message) installed CGNS and linked it to HDF5, also reinstalled pyfr and linked libcgns.so. I did exactly what you showed me. I have also read the thread you provided.

But still, when when i call "pyfr import yf17_hdf5.cgns aaa.pyfrm", there is no output file with pyfrm extension generated, also no warning or error reported. Can you tell me what went wrong? Thanks!

jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ echo $LD_LIBRARY_PATH
/data/sofrware/mesher/CGNS/build/src/libcgns.so
jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ echo $PYFR_LIBRARY_PATH
/data/sofrware/mesher/CGNS/build/src/libcgns.so
jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ ls
yf17.cgns  yf17_hdf5.cgns
jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ pyfr import -t cgns yf17_hdf5.cgns aaa.pyfrm
jrcc@bilbo:/data/projects/JrcC/pyfr/cgns_test$ ls
yf17.cgns  yf17_hdf5.cgns


Junting Chen

Yoshiaki Abe

unread,
Feb 6, 2020, 8:27:54 PM2/6/20
to PyFR Mailing List
Hi Junting,

Hmm, it is weird.
Could you check if the libcgns.so is correctly linked to other libraries? Mine is
$ ldd ~/local/CGNS/build/lib/libcgns.so
linux-vdso.so.1 =>  (0x00007ffe9c15d000)
/opt/intel/mkl/lib/intel64/libmkl_core.so (0x00002b6f40c38000)
/opt/intel/mkl/lib/intel64/libmkl_sequential.so (0x00002b6f44dc4000)
libhdf5.so.8 => /usr/lib64/libhdf5.so.8 (0x00002b6f46370000)
libsz.so.2 => /usr/lib64/libsz.so.2 (0x00002b6f46967000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00002b6f46b6a000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00002b6f46d80000)
libm.so.6 => /usr/lib64/libm.so.6 (0x00002b6f46f85000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00002b6f47287000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00002b6f47654000)
libaec.so.0 => /usr/lib64/libaec.so.0 (0x00002b6f47871000)
/lib64/ld-linux-x86-64.so.2 (0x000055d3ad492000)

Besides, could you just try
$ export LD_LIBRARY_PATH=/data/sofrware/mesher/CGNS/build/src/:$LD_LIBRARY_PATH
before reinstalling, executing etc? I would suspect that the libcgns.so is not correctly referred.

Regards,
Yoshiaki

2020年2月7日金曜日 7時05分50秒 UTC+9 Junting Chen:

Junting Chen

unread,
Feb 6, 2020, 9:06:32 PM2/6/20
to PyFR Mailing List
Thanks Yoshiaki, it works now! Sorry for being careless, should've checked for typos before posting here. 

Best regards,

Junting

Junting Chen

unread,
Feb 7, 2020, 3:49:11 AM2/7/20
to PyFR Mailing List
So I have successfully imported a sample mesh from CGNS website.

However, when trying to load created with the mesher I am using (cfMesh+ tetMesh), pyfr gives me the following message:

jrcc@bilbo:/data/projects/JrcC/Mesher/cfmesh/PLW_project/case2_coarse$ pyfr import mesh.cgns aaa.pyfrm
Traceback (most recent call last):
  File "/usr/local/bin/pyfr", line 11, in <module>
    load_entry_point('pyfr==1.9.0', 'console_scripts', 'pyfr')()
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/__main__.py", line 110, in main
    args.process(args)
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/__main__.py", line 124, in process_import
    mesh = reader.to_pyfrm()
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/base.py", line 20, in to_pyfrm
    mesh = self._to_raw_pyfrm()
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/cgns.py", line 422, in _to_raw_pyfrm
    rawm.update(mesh.get_connectivity())
  File "/home/jrcc/.local/lib/python3.6/site-packages/pyfr/readers/base.py", line 192, in get_connectivity
    raise ValueError('Unpaired faces in mesh')
ValueError: Unpaired faces in mesh

Can you tell why pyfr doesn't like this mesh? I may be able to ask the mesher provider to improve on the issue.

Junting
Reply all
Reply to author
Forward
0 new messages