[petsc-users] Manually setting PetscSF

Matthew Knepley knepley at gmail.com
Mon Nov 7 14:30:26 CST 2022


On Mon, Nov 7, 2022 at 1:15 PM Nicholas Arnold-Medabalimi <
narnoldm at umich.edu> wrote:

> Hi Petsc Users,
>
>
> I am working on setting up the star forest to connect my meshes on
> different processors.
>
> For a 2-processor example, I have set up a dmplex object and read in the
> coordinates nodes and cell2node charts on each one. But right now they are
> independent effectively.
>
> For simplicity lets just say each process has 4 cells.
>
> [image: image.png]
>
> I'm trying to build the star forest that sets the edge between the two
> partitions. (see fig)
>
> To my understanding, I do this using PetscSFSetGraph. I choose either 9-10
> on rank 0 or 1-2 on rank 1 to be the "roots". For simplicity lets say the
> 1-2 on rank 1 are roots.
>
> (also for the rest of the discussion I'm switching 1 and 2 to be 0 and 1
> and 9 and 10 to be 8 9 ) (the figure is 1 indexed but for the code below it
> will be 0)
>
> So on rank 0 I would set
>
> nleaves=2
> nroots= 8+c1  (graph is only cells and verts so its 8 verts plus the cell
> count(c1)
>
> remote[0].rank=1
> remote[0].index=0+(cell count on rank1)
> leaf[0]=8+c1
>
> remote[1].rank=1
> remote[1].index=0+(cell count on rank1)
>

I think this is wrong, instead you want

  remote[1].index=1+(cell count on rank1)


> leaf[1]=9+c1
>
>
> and on rank 1 we would set
>
> nroots= ncells+nverts
> nleaves=0
>
> Since its all roots I don't think I need to set anything else?
>
>
>
>
> PetscSFSetGraph(sf,nroots,nleaves,leaves,PETSC_COPY_VALUES,remote,PETSC_COPY_VALUES)
>
> I am certain I am making a mistake somewhere since I get an error when I
> then call PetscSFSetup. I am working in C++ right now but this is just
> testing out before implementation in fortran which is why I am using
> PETSC_COPY.
>

You could also probably use


https://petsc.org/main/docs/manualpages/DMPlex/DMPlexCreateFromCellListParallelPetsc/

  Thanks,

      Matt


> Any help and clarification would be appreciated.
>
>
> Sincerely
> Nicholas
>
>
>
> --
> Nicholas Arnold-Medabalimi
>
> Ph.D. Candidate
> Computational Aeroscience Lab
> University of Michigan
>


-- 
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/20221107/5b6a994d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 18794 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221107/5b6a994d/attachment-0001.png>


More information about the petsc-users mailing list