[petsc-users] Questions about Field Data using DMPlex

Matthew Knepley knepley at gmail.com
Thu Aug 8 13:44:03 CDT 2019


On Thu, Aug 8, 2019 at 11:59 AM Daniel Mckinnell via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi,
> I have a DMPlex mesh stored in a dm object with an associated PetscSection
> containing the information on the layout of field0 and field1, I can create
> a local Vec with the layout from the PetscSection and edit that data. I
> have a couple of questions about what I can do from this point:
>
> 1. Is there a way of attaching my field data to the dm object so that
> everything associated with my mesh is contained in a single object?
>

You can use


https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMGetNamedLocalVector.html

We tend to discourage this organization, but it might work for you.  If you
use DMCreateLocalVector(), then
VecGetDM() will get you back the DM.


> 2. Is there a way of creating a Vec object with the data from just field0?
>

Yes, use DMCreateSubDM() selecting only field0, and then
DMCreateLocalVector()


> 3. What is the best way to export my data to a VTK file, everything I have
> tried so far has just created meaningless vector fields on the vertices?
>

VTK files only understand vertex fields and cell fields. Is that what you
have?

  Thanks,

    Matt


> Any help would be greatly appreciated.
> Thanks,
> Daniel Mckinnell
>


-- 
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.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190808/00e2281d/attachment.html>


More information about the petsc-users mailing list