Use of MatCreateMPIAIJ and VecCreateMPI when ghost cells are present

Jed Brown jed at
Tue Apr 14 09:31:10 CDT 2009

On Tue 2009-04-14 22:17, Wee-Beng TAY wrote:
> Supposed for my 8x8 grid, there's ghost cells on the edge, hence  
> changing to 0->9 x 0->9 no. of grids.

It is very important to distinguish between the global vector which the
solver sees and local vectors which often have ghost values.  The global
vector should have exactly one entry per global degree of freedom---no
ghost entries.  It sounds like you are using a structured grid so you
probably want to look at the DA object which manages the global vectors
and local vectors with ghosting.

If you insist on doing it yourself, you should partition the domain so
that each node is owned by exactly one process.  Create a global vector
based on this decomposition, it is what the solver will see.  Then
create a (sequential) local vector on each process that includes the
ghost points.  Now create a global-to-local scatter to update the local

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the petsc-users mailing list