Gradient at ghost cells only?

billy at billy at
Sat Mar 4 19:09:36 CST 2006

Firstly, I would like to congratulate the PETSc team for such a great code! 

I send you an image of my case (all indices are global). Ghost cells are in
yellow and white cells are the interior cells. To calculate the gradient at a
cell, I use the gauss theorem so I need all neighbor cells for that. The
interior points are easy I can calculate them each time in each processor since
I have a ghost cell layer. My problem is the gradient in ghost cells because I
need the values at pink cells but they belong to another process. I guess I
could include these pink cells also as ghost cells and then I would have access
to their values. Or I could calculate the gradient and exchange it through
processes using VecCreateGhost().

For now I have the code working because I only use these cell-centered gradients
for non-orthogonal corrections. So, if the grid orthogonal this term is zero.

Quoting Barry Smith <bsmith at>:

> On Sat, 4 Mar 2006, billy at wrote:
> >
> > Hi,
> >
> > I need the gradient of 5 scalars at ghost cells and I was thinking of
> creating
> > 5x3 vectors with VecCreateGhost(). Right now, I calculate the gradient
> during
> > each iteration and I don't store it's value.
> > I would like to calculate, store and exchange the gradient at the ghost
> cells
> > only, to minimize memory requirements. How is the best way to do that?
> ^^^^^^^
>     Do you not need the gradient values for the interior points? Or are you
> willing to recompute the gradients for the interior points? Why different?
>     If the gradient is the same each time why not just calculate it the
> first
> time and store it for later? Don't make live complicated by using 
> VecCreateGhost(), just compute them and store them in some array.
>     Barry
> >
> > Billy.
> >
> >

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cells.png
Type: image/png
Size: 10524 bytes
Desc: not available
URL: <>

More information about the petsc-users mailing list