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

Matthew Knepley knepley at gmail.com
Mon May 29 19:27:49 CDT 2017


On Mon, May 29, 2017 at 5:43 PM, Fabian Jakub <
Fabian.Jakub at physik.uni-muenchen.de> wrote:

> Hi,
>
> I did just as Matt suggested which works nicely... thanks by the way!
>
> Inserted in the petsc_gen_xdmf.py the "6: 'Wedge' " entry .
>
> Calling the example with:
>
> <example_program> -show_plex hdf5:output.h5 -show_vector
> hdf5:output.h5::append
>
> exports the mesh and a vector to hdf5.
>
> Then calling
>
> $PETSC_DIR/bin/petsc_gen_xdmf.py output.h5
>
> correctly creates the descriptor file and just loads to visit.
>
>
> Many thanks again to you, Matt :)
>

Great! I will make a test and push it soon. I'll put you on the ChangeSet.

  Thanks,

     Matt


> Fab
>
>
>
> On 30.05.2017 00:13, Adrian Croucher wrote:
>
>> hi,
>>
>> I was asking about support for exactly these 6-node wedge elements in
>> DMPlex back in January.
>>
>> At the time, there was no support for them. Has there been some progress
>> since then?
>>
>> We are going to need them before we can release our software, which we're
>> aiming to do by the end of the year.
>>
>> Cheers, Adrian
>>
>> Message: 4
>>> Date: Fri, 26 May 2017 22:40:40 -0500
>>> From: Matthew Knepley <knepley at gmail.com>
>>> To: "Fabian.Jakub" <Fabian.Jakub at physik.uni-muenchen.de>
>>> Cc: PETSc <petsc-users at mcs.anl.gov>
>>> Subject: Re: [petsc-users] DMPlex export to hdf5/vtk for
>>>     triangle/prism mesh
>>> Message-ID:
>>>     <CAMYG4GkVOTtFL_OBpUBPGEcBTikMbLOb5ruz=VU7tVTO6JQHTQ at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> 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/1731673c3fe570066779d4
>>> 6b51a4aee7a45775ed/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/20170529/0f1f9081/attachment.html>


More information about the petsc-users mailing list