[petsc-dev] DMPlexCreateMedFromFile broken

Vaclav Hapla vaclav.hapla at erdw.ethz.ch
Thu Nov 9 10:15:29 CST 2017


> 7. 11. 2017 v 19:51, Matthew Knepley <knepley at gmail.com>:
> 
> On Tue, Nov 7, 2017 at 11:44 AM, Vaclav Hapla <vaclav.hapla at erdw.ethz.ch <mailto:vaclav.hapla at erdw.ethz.ch>> wrote:
> Nico Schlömer just introduced MED support into his meshio tool, based on my issue request. When I convert blockcylinder-50.exo directly to the MED format with meshio, the result can be loaded into GMSH and looks reasonable. But DMPlexCreateMedFromFile denies to open it with the following error:
> 
> _MEDmeshAdvancedRd236.c [285] : Erreur de valeur invalide du filtre 
> _MEDmeshAdvancedRd236.c [285] : 
> _MEDmeshAdvancedRd236.c [286] : geotype = 0
> _MEDmeshAdvancedRd236.c [286] : meshname = "mesh0"
> _MEDmeshAdvancedRd236.c [286] : _datagroupname2 = "NOE"
> _MEDmeshAdvancedRd236.c [287] : (*_filter).storagemode = 2
> [0]PETSC ERROR: #1 DMPlexCreateMedFromFile() line 86 in /scratch/petsc-dev/src/dm/impls/plex/plexmed.c
> [0]PETSC ERROR: #2 DMPlexCreateFromFile() line 2815 in /scratch/petsc-dev/src/dm/impls/plex/plexcreate.c
> [0]PETSC ERROR: #3 main() line 38 in /scratch/petsc-dev/src/dm/impls/plex/examples/tutorials/ex5.c
> 
> Can you see whether it's a bug in DMPlexCreateMedFromFile or the MED file is broken?
> 
> It appears to be an MED incompatibility
> 
>   https://bitbucket.org/petsc/petsc/src/17bd883d72f40a596f2d89b5afda5a233b621464/src/dm/impls/plex/plexmed.c?at=master&fileviewer=file-view-default#plexmed.c-86 <https://bitbucket.org/petsc/petsc/src/17bd883d72f40a596f2d89b5afda5a233b621464/src/dm/impls/plex/plexmed.c?at=master&fileviewer=file-view-default#plexmed.c-86>
> 
> We should ask Nico about it.

I tried to load the MED file from meshio (attached) by the MED-supplied test $PETSC_ARCH/externalpackages/med-3.2.0/tests/c/test5.c, and it didn't complain. I compared it with DMPlexCreateMedFromFile, replaced MED_COMPACT_STMODE flag by MED_GLOBAL_PFLMODE in MEDfilterBlockOfEntityCr calls (patch attached), and it started to work magically.

But I have no idea what's the meaning of this flag - I found no documentation of the MED library.

Note also that your knepley/fix-plex-med-orientation fix is still needed so I mean this should be applied generally - Nico's meshio is independent of GMSH.

Vaclav


> 
>   Thanks,
> 
>      Matt
>  
> Thanks
> 
> Vaclav
> 
> 
>> 5. 11. 2017 v 18:48, Matthew Knepley <knepley at gmail.com <mailto:knepley at gmail.com>>:
>> 
>> On Thu, Nov 2, 2017 at 12:08 PM, Vaclav Hapla <vaclav.hapla at erdw.ethz.ch <mailto:vaclav.hapla at erdw.ethz.ch>> wrote:
>> It seems that DMPlexCreateMedFromFile leaves out some mesh elements. I found it out when investigating why ParMetis redistribution crashes.
>> 
>> I attach the datafile $PETSC_DIR/share/petsc/datafiles/meshes/blockcylinder-50.exo converted to GMSH and MED format.
>> The conversion EXO to GMSH was done by meshio (github.com/nschloe/meshio <http://github.com/nschloe/meshio>), and GMSH to MED by GMSH itself.
>> 
>> I did:
>> 
>> cd $PETSC_DIR/src/dm/impls/plex/examples/tutorials
>> make ex5
>> FILE=blockcylinder-50.exo && ./ex5 -filename $FILE -dm_view hdf5:$FILE.h5 && $PETSC_DIR/bin/petsc_gen_xdmf.py $FILE.h5
>> FILE=blockcylinder-50.msh && ./ex5 -filename $FILE -dm_view hdf5:$FILE.h5 && $PETSC_DIR/bin/petsc_gen_xdmf.py $FILE.h5
>> FILE=blockcylinder-50.med && ./ex5 -filename $FILE -dm_view hdf5:$FILE.h5 && $PETSC_DIR/bin/petsc_gen_xdmf.py $FILE.h5
>> 
>> While the output from blockcylinder-50.exo and blockcylinder-50.msh looks OK, that from blockcylinder-50.med is corrupted.
>> 
>> I also attach my HDF5/XDMF outputs and screenshots from ParaView.
>> 
>> It appears that MED, at least coming from GMsh, inverts hexes just like GMsh does. I have fixed this in branch
>> 
>>   knepley/fix-plex-med-orientation
>> 
>> If you run your test in this, everything should be fine.
>> 
>> Michael, can you check whether this is a general fix, or it only applied to MED from GMsh?
>> 
>>   Thanks,
>> 
>>      Matt
>>  
>> 
>> Vaclav
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> -- 
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>> -- Norbert Wiener
>> 
>> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171109/86a54b48/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blockcylinder-50.med
Type: application/octet-stream
Size: 18112 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171109/86a54b48/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171109/86a54b48/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plexmed.patch
Type: application/octet-stream
Size: 1733 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171109/86a54b48/attachment-0003.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171109/86a54b48/attachment-0005.html>


More information about the petsc-dev mailing list