Scattering vectors with different DA stencil types

Shao-Ching Huang schuang at ats.ucla.edu
Wed Apr 22 19:26:41 CDT 2009


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


More information about the petsc-users mailing list