[petsc-users] DMPlex export to hdf5/vtk for triangle/prism mesh

Matthew Knepley knepley at gmail.com
Fri May 26 22:40:40 CDT 2017


On Fri, May 26, 2017 at 12:27 PM, Fabian.Jakub <
Fabian.Jakub at physik.uni-muenchen.de> wrote:

> Dear Petsc Team,
>
> I am playing around with DMPlex, using it to generate the Mesh for the
> ICON weather model(http://doi.org/10.1002/2015MS000431), which employs a
> triangle mesh horizontally and columns, vertically.
>
> This results in a grid, looking like prisms, where top and bottom faces
> are triangles and side faces are rectangles.
>
> I was delighted to see that I could export the triangle DMPlex (2d Mesh)
> to hdf5 and use petsc_gen_xdmf.py to then visualize the mesh in
> visit/paraview.
> This is especially nice when exporting petscsections/vectors directly to
> VTK.
>

Great.


> I then tried the same approach for the prism grid in 3D.
> I attached the code for one single cell, as well as the output in hdf5.
>
> However, trying to convert the hdf5 output, it fails with:
>
> make prism.xmf
>
> $PETSC_DIR/bin/petsc_gen_xdmf.py prism.h5
> Traceback (most recent call last):
>   File
> "/software/meteo/xenial/x86_64/petsc/master/debug_gcc/..//
> bin/petsc_gen_xdmf.py",
> line 241, in <module>
>     generateXdmf(f)
>   File
> "/software/meteo/xenial/x86_64/petsc/master/debug_gcc/..//
> bin/petsc_gen_xdmf.py",
> line 235, in generateXdmf
>     Xdmf(xdmfFilename).write(hdfFilename, topoPath, numCells,
> numCorners, cellDim, geomPath, numVertices, spaceDim, time, vfields,
> cfields)
>   File
> "/software/meteo/xenial/x86_64/petsc/master/debug_gcc/..//
> bin/petsc_gen_xdmf.py",
> line 193, in write
>     self.writeSpaceGridHeader(fp, numCells, numCorners, cellDim, spaceDim)
>   File
> "/software/meteo/xenial/x86_64/petsc/master/debug_gcc/..//
> bin/petsc_gen_xdmf.py",
> line 75, in writeSpaceGridHeader
>     ''' % (self.cellMap[cellDim][numCorners], numCells, "XYZ" if
> spaceDim > 2 else "XY"))
> KeyError: 6
>
>
> Also, if I try to export a vector directly to vtk, visit and paraview
> fail to open it.
>
> My question is:
> Is this a general limitation of these output formats, that I can not mix
> faces with 3 and 4 vertices or is it a limitation of the
> petsc_gen_xdmf.py or the VTK Viewer.
>

petsc_gen_xdmf. Take a look here


https://bitbucket.org/petsc/petsc/src/1731673c3fe570066779d46b51a4aee7a45775ed/bin/petsc_gen_xdmf.py?at=master&fileviewer=file-view-default#petsc_gen_xdmf.py-9

This is what fails. You need to add something like

  6: "Wedge"

in the dictionary. See http://www.xdmf.org/index.php/XDMF_Model_and_Format


> I'd also welcome any thoughts on the prism mesh in general.
> Is it that uncommon to use and do you foresee other complications with it?
>

You need an element that works with prisms, but it seems you already have
one. I know
there is good work from here: https://arxiv.org/abs/1411.2940


> I fear I cannot change the discretization of the host model but maybe it
> makes sense to use a different grid for my radiative transfer code?
>

I do not really do RT, but would be happy to try and think about it.

  Thanks,

     Matt


> Many thanks,
>
>
> Fabian
>



-- 
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

http://www.caam.rice.edu/~mk51/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170526/0718e460/attachment.html>


More information about the petsc-users mailing list