[petsc-users] Is there easy to update the ghost value in the vector created using DMCreatLocalVector?

Matthew Knepley knepley at gmail.com
Wed Jan 16 08:15:51 CST 2019


On Wed, Jan 16, 2019 at 8:52 AM leejearl <leejearl at mail.nwpu.edu.cn> wrote:

> Hi Matt,
> Thanks for you reply. If I use DMGlobalToLocal() to update the local
> vector from global vector.
> The value of cStart<=c<cEndinterior is ok. But the value of
> cEndInterior<=c<cEnd is not the right value.
> I do not know whether it has something to do with the DMGlobalToLocal().
> My problem is as follow.
> After the mesh is distributed , the cells and ghost cells (local vector)
> look like
>

Hmm, that sounds like a bug, but I have to think a little bit. I don't see
how TS ex11 can be working in parallel
if overlapping cells are not being updated. We should make a small example
so that we are certainly comparing the
same things.

  Thanks,

    Matt


> processor 0: 0, 1, 2, 3, 4 (cell 4 is the ghost cell)
> processor 1: 0, 1, 2, 3, 4 (cell 4 is the ghost cell)
>
> The value of cell 4 in "processor 0" is same as the value of cell 0 in
> "processor 1". The value of cell 0 in "processor 1" has
> been set in the global vector. I should copy the corresponding global
> value of cell 0 in "processor 1" to cell 4 in "processor 0".
>
> This is my problem. I want to know how to implement it easily. Can you
> give me some advices?
>
> Thanks
>
> leejearl
>
>
> On Wed, 2019-01-16 at 08:07 -0500, Matthew Knepley wrote:
>
> On Tue, Jan 15, 2019 at 8:34 PM leejearl via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
> Hi all Petscer,
>
> I have a question about how to update the ghost value in the vector.
> The prolblem is as follow.
>
> 1. A dmplex dm object is created using DMPlexCreateFromFile
> 2. The dm is distributed using DMPlexDistribute, and the overlap is set
> as 1.
> 3. The ghosted dm is constructed by DMConstructGhostCells.
> 4. A global Vector X and a local vector localX are created by
> DMCreateGlobalVector and DMCreateLocalVector
>
> Now, the problem is that the ghost value are needed in the computation
> using local vector localX. and the ghost value must be update from the
> global vector.
>
> For example, gCellId is the index of ghost cell in the local vector
> localX of process 0, and cellId is the index of cell in the global
> vector of process 1. I must update the data of cellId to gCellId. How
> can I do it easily?
>
> I can implement it use the PetscSFBcastBegin/PetscSFBcastEnd. Is there
> other simple way to do it?
>
>
> Doesn't DMGlobalToLocal() work?
>
>   Thanks,
>
>     Matt
>
>
> Any helps are appreciated.
>
> Thanks.
>
>
>
> leejearl
>
>
>
>
>

-- 
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/20190116/b83ea21c/attachment.html>


More information about the petsc-users mailing list