[petsc-users] DMPLex ghost indexing

Adrian Croucher a.croucher at auckland.ac.nz
Wed Jul 22 15:53:02 CDT 2015


I have a distributed DMPlex representing a finite volume mesh, and first 
I want to check if I understand the way the indexing of ghost cells 
works, based on my experiments.

As I understand it, there are two types of ghost cells:

1) those created by DMPlexDistribute() (which I call with overlap = 1), 
representing the cells over the edge of the processor partition boundary
2) those created by DMPlexConstructGhostCells(), which I call to add 
ghost cells on the physical boundary of the mesh (using a DMLabel), for 
applying boundary conditions

The type 1 'partition' ghost cells only appear in local vectors, not 
global, and are added on the end after the interior cells.

The type 2 'boundary' ghost cells appear in both local and global 
vectors. In a local vector they are added on the end after the partition 
ghost cells. In a global vector they appear straight after the interior 

Is this correct? If so, I have a question:

If I'm computing fluxes between my finite volume cells, I need a local 
vector to get access to both types of ghost cells.

But if I'm doing another calculation (computing fluid properties in the 
cells, in this case) that does not need access to the partition ghosts, 
but needs to be carried out for all interior cells *and* the boundary 
ghost cells, I figure it would be preferable to do this with a global 
vector (to save needless parallel communication scattering a global 
vector into a local one).

However if I use DMPlexGetHeightStratum() to get the start and end 
cells, the indices it returns apply to a local vector with the partition 
ghosts included.

Is it safe just to subtract off the number of partition ghost cells from 
the end cell index returned by DMPlexGetHeightStratum(), if I want to 
loop over all interior and boundary ghosts cells in a global vector?

Cheers, Adrian

Dr Adrian Croucher
Department of Engineering Science
University of Auckland
New Zealand
tel 64-9-373-7599 ext 84611

More information about the petsc-users mailing list