[petsc-users] Load mesh as DMPlex along with Solution Fields obtained from External Codes

Matthew Knepley knepley at gmail.com
Tue Jun 28 06:46:56 CDT 2022


On Wed, Jun 8, 2022 at 12:15 AM Mike Michell <mi.mike1021 at gmail.com> wrote:

> Dear PETSc developer team,
>
> I am a user of PETSc DMPlex for a finite-volume solver. So far, I have
> loaded a mesh file made by Gmsh as a DMPlex object without pre-computed
> solution field.
> But what if I need to load the mesh as well as solution fields that are
> computed by other codes sharing the same physical domain, what is a smart
> way to do that? In other words, how can I load a DM object from a mesh file
> along with a defined solution field?
> I can think of that; load mesh to a DM object first, then declare a local
> (or global) vector to read & map the external solution field onto the PETSc
> data structure. But I can feel that this might not be the best way.
>

Here was my idea for this. PetscSection is an abstraction for laying out
data over a DMPlex. In parallel, each local Section lays out local data,
and a PetscSF points "ghost" mesh points at the owner. From this we can
make a _global_ Section automatically that lays out globally consistent
data. Thus, in order to match an external layout, you need to:

1) Match the mesh topology with DMPlex

2) Match the mesh parallel layout with a PetscSF

3) Match the local data layout with a PetscSection (might require
specifying a permutation of the mesh points to the section)

Then you should be able to load your data with VecLoad(). Let me know if
this is unclear or does not work for you.

  Thanks,

     Matt


> Thanks,
> Mike
>


-- 
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/20220628/cd99c0c3/attachment.html>


More information about the petsc-users mailing list