nschloe/meshio

Error when importing .med file from code aster ('TypeError: len() of unsized object')

multibody opened this issue · 2 comments

Hi,
I have a problem using meshio for importing results from a .med file. This problem only occurs, when the model contains contacts. I used meshio version 5.3.0 .

When using the meshio.read() method I get the following console output:

File "C:\Users\user1\anaconda3\envs\p37\lib\site-packages\meshio\_helpers.py", line 71, in read
    return _read_file(Path(filename), file_format)
  File "C:\Users\user1\anaconda3\envs\p37\lib\site-packages\meshio\_helpers.py", line 103, in _read_file
    return reader_map[file_format](str(path))
  File "C:\Users\user1\anaconda3\envs\p37\lib\site-packages\meshio\med\_med.py", line 115, in read
    points, cells, point_data=point_data, cell_data=cell_data, field_data=field_data
  File "C:\Users\user1\anaconda3\envs\p37\lib\site-packages\meshio\_mesh.py", line 181, in __init__
    if len(data[k]) != len(self.cells[k]):
TypeError: len() of unsized object

Here is an example of a .med results file of a simple model to reproduce the error.
code_aster_med.zip

The .med file is perfectly readable by GMSH.

Thanks for any help or advice!

Hi,
I had the same problem and was able to solve it.
It always generated me an empty matrix for "CONT_NOEU", therefore meshio wasn't able to convert it from .med to .vtk.

I added this to the post-processing:

_F(RESULTAT=xy, NOM_CHAM='CONT_NOEU', NOM_CMP=('CONT','JEU',), NOM_CHAM_MED='xy',

Probably this will help you.

Hi,
I opened this file in Salome and there is an empty field RESU___SIEF_ELGA that causes the problem. It has also the same name as one of the actual fields with data. I am pretty sure code_aster does not let you write an rmed file like this, it throws an error.

salome