Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2022-09-23 16:16:19

Johannes_ACKVA
Member
From: Ingenieurbüro für Mechanik, DE
Registered: 2009-11-04
Posts: 761
Website

meshio-created .med-file is buggy

Bonjour / Hello

I try to create a .med-file using meshio. When trying to open it with gmsh (versions 3., 4.) or to import in SalomeMeca it fails (seems corrupted). When trying to read it with LIRE_MAILLAGE (tryed several Code-Aster versions) the following error is reported:

  Mesh = LIRE_MAILLAGE(FORMAT='MED',
                       UNITE=20,
                       INFO_MED=1,
                       VERI_MAIL=_F(VERIF='OUI',
                                    APLAT=1.E-3,),
                       INFO=1,)

   
   !-------------------------------------------------------!
   ! <EXCEPTION> <DVP_97>                                  !
   !                                                       !
   ! Erreur signalée dans la bibliothèque MED              !
   !      nom de l'utilitaire : mmhmii                     !
   !              code retour : -2328                      !
   !                                                       !
   !                                                       !
   !                                                       !
   ! Il y a probablement une erreur dans la programmation. !
   ! Veuillez contacter votre assistance technique.        !
   !-------------------------------------------------------!
   

  Destruction du concept 'Mesh'.
 <S> ERREUR UTILISATEUR RECUPEREE PAR LE SUPERVISEUR

.. __stg1_txt6

I append the folder with the code-aster run. The mesh in question is
box_2_1_4_nas.med
It has been created with meshio from a nastran mesh with this command:

meshio-convert --input-format nastran --output-format med box_2_1_4.nas box_2_1_4_nas.med

Very strangly, when transfering the corrupted med-file further, to gmsh format:

python3
>>> import meshio
>>> mesh = meshio.read('box_2_1_4_nas.med', file_format='med')
>>> dir(meshio)
['CellBlock', 'Mesh', 'ReadError', 'WriteError', '__about__', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_cli', '_common', '_exceptions', '_files', '_helpers', '_mesh', 'abaqus', 'ansys', 'avsucd', 'cgns', 'dolfin', 'exodus', 'extension_to_filetype', 'flac3d', 'gmsh', 'h5m', 'hmf', 'mdpa', 'med', 'medit', 'nastran', 'neuroglancer', 'obj', 'off', 'permas', 'ply', 'read', 'stl', 'su2', 'svg', 'tecplot', 'tetgen', 'ugrid', 'vtk', 'vtu', 'wkt', 'write', 'write_points_cells', 'xdmf']
>>> points=mesh.points
>>> cells_dic=mesh.cells_dict
>>> new_mesh=meshio.Mesh(points,cells_dic)
>>> new_mesh.write("box_2_1_4_nas_med.msh",file_format="gmsh22",binary=False)
WARNING:root:Appending zeros to replace the missing physical tag data.
WARNING:root:Appending zeros to replace the missing geometrical tag data.

the resulting gmsh-mesh "box_2_1_4_nas_med.msh" can be read without problems with

Mesh=LIRE_MAILLAGE(FORMAT='GMSH')

so it seems like the .med-file from meshio is not really buggy but meshio has it's own .med rules

I wonder if I use meshio in a wrong way, or if there is a bug in meshio's med-writer. If the latter is true, I wonder if I m the first to discover it?

Btw: I have made a post on the meshio forum, but no answer so far,:
https:   //github.com/nschloe/meshio/issues/1357

many thanks for your help

Best regards
Johannes_ACKVA
---------------------------------------------------------------------------
CODE-ASTER-courses at Ingenieurbüro für Mechanik, Germany
NEW: ONLINE- and video courses


Attachments:
med_file_is_buggy.zip, Size: 12.67 KiB, Downloads: 21

Ingenieurbüro für Mechanik
D 91717 Wassertrüdingen / Germany

www.code-aster.de                                                Training & Support for NASTRAN and CODE-ASTER

Offline