Scattering vectors with different DA stencil types

Matthew Knepley knepley at gmail.com
Wed Apr 22 19:44:01 CDT 2009


I believe this should work since they have the same overlap size. The
stencil shape
should only determine the scatter.

   Matt

On Wed, Apr 22, 2009 at 7:26 PM, Shao-Ching Huang <schuang at ats.ucla.edu>wrote:

> Hi,
>
> I am trying to use DA type "STENCIL_STAR" for matrix solve, while
> using DA type "STENCIL_BOX" for some auxiliary operations.
>
> My question is: is the following sequence of operations valid
> (especially step 3 below):
>
> 1. create two DA's, one with DA_STENCIL_STAR and the other with
>   DA_STENCIL_BOX:
>
>   DA da1, da2;
>   DACreate3d(..., DA_STENCIL_STAR, ... , &da1);
>   DACreate3d(..., DA_STENCIL_BOX, ...,   &da2);
>
>   (All other parameters of the two DA's are identical, on all
>   processors.)
>
> 2. Create a global vector "x1" associated with "da1" (STENCIL_STAR):
>
>   Vec x1;
>   Mat A;
>   DACreateGlobalVector(da1, &x1);
>   ...
>   DAGetMatrix(da1,..., &A);
>   ... (compute RHS, requiring STENCIL_STAR) ...
>   ... (solve matrix) ...
>
> 3. Scatter global vector "x1" onto a local vector "y2", which is
>   assocoated with da2 (STENCIL_BOX):
>
>   Vec y2;
>   DAGetLocalVector(da2, &y2);
>   DAGlobalToLocalBegin(da1, x1, INSERT_VALUES, y2);
>   DAGlobalToLocalEnd  (da1, x1, INSERT_VALUES, y2);
>   ... (operations on y2, requiring STENCIL_BOX) ...
>
>
> The main reason to use "da1" (STENCIL_STAR) for matrix solve is that
> it introduces much less number of entries per row (9 in STENCIL_STAR
> vs. 27 in STENCIL_BOX). All operations on "x1" only require
> STENCIL_STAR. The computation on "y2" (requiring STENCIL_BOX) is only
> a small fraction of the entire code.
>
> Thanks,
>
> Shao-Ching
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090422/d58a5aba/attachment.htm>


More information about the petsc-users mailing list