chiefenne / PyAero

PyAero is an open-source airfoil contour analysis and CFD meshing tool.
MIT License
171 stars 31 forks source link

su2 export problem #28

Closed sn1979c closed 2 years ago

sn1979c commented 2 years ago

Hi, I'm trying to study your code in the recent days, and when exporting su2 format files, I met with a bug as below:

When exporting su2 in the debug mode, vscode report a bug to me:

Report is as below:

  File "c:\Users\liziyu\Anaconda3\lib\site-packages\meshio\su2\_su2.py", line 340, 
in write
    for index, (cell_type, data) in enumerate(mesh.cells):
    TypeError: cannot unpack non-iterable CellBlock object

The su2 file still exits, but it seems that only half of the file is exported.

Here is my solve method:

mesh.cells is a list that contains 2 CellBlock class objects.

It seems that meshio is trying to unzip the object CellBlock which is a unzippable class.

I checked several versions of meshio code, this problem always exists. So I changed the code of __su2.py in line 340

for index, (cell_type, data) in enumerate(mesh.cells):

to

for index, cell_block in enumerate(mesh.cells):
    cell_type = cell_block.type
    data = cell_block.data

Then it seems that the bug was solved, but I'm not familiar with su2, I'm not sure is this change suitable in real calculation. would you please help me check all the things above? Changed meshio rep will be pushed to my page sooner, if this is really the bug of meshio, I need to remind them of this problem.

chiefenne commented 2 years ago

Hi, at the moment I am quite busy with other topics. I will check it, but not really sure when. I do not remember if I did the export in debug mode so far (although during testing the probability was high). Anyway, I did not come across that problem before and I can use the SU2 files including boundary definitions for calculation in SU2 without problems. I'll have a look.

sn1979c commented 2 years ago

Thanks for your reply, I will check it in further tests. By the way, did you compile it in Linux?

chiefenne commented 2 years ago

I did not check yet on Linux. I run it mainly on macOS and Windows. macOS is at least similar to Linux, so I don't expect too much problems on Linux.

sn1979c commented 2 years ago

Well, I did it on Windows, I will do a further check.

chiefenne commented 2 years ago

I checked your fix for the SU2 export, maybe you have seen that I commented it already on the meshio site. The fix works for me and I did SU2 test runs and they were fine. I think that export broke with meshio version 5.1.0 and/or some changes which were made before.

sn1979c commented 2 years ago

Good to see it works for you. Hope meshio can fix it, but it seems that the manager didn't work on meshio recently, issues of it were all unsettled.

I checked your fix for the SU2 export, maybe you have seen that I commented it already on the meshio site. The fix works for me and I did SU2 test runs and they were fine. I think that export broke with meshio version 5.1.0 and/or some changes which were made before.