[petsc-users] Calculating the PETSc index of a DMComposite vector

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 12 13:43:54 CST 2013


Anush Krishnan <anush at bu.edu> writes:

> Around each body point, I choose a small rectangular region of velocity
> grid points and perform an interpolation with these values to obtain the
> velocity at the body point. 

How large are these rectangular regions?

> This can be represented as: [C][u] = [b]
>
> where [C] contains the interpolation coefficients, [u] contains velocity
> values from the small rectangular region and [b] is the velocity at the
> body point. These matrices can be expanded to include the entire velocity
> field and all the body points.

What are you doing with the C once it is built?

Depending on the distribution and access pattern, it could make sense to
assemble C^T instead, but it likely doesn't matter.

> Currently, my fix is to loop over all the velocity grid points, check if
> they come under the influence of any of the body points, and
> correspondingly set the interpolation coefficient value in the matrix. But
> this procedure requires a double loop.

I would loop over the body points and classify them as being "within
range" of the grid points that you own.  Ignore the points that are out
of range.  From the interpolation patch size, you know analytically
which owned grid points need to contribute values.  Call MatSetValues()
or MatSetValuesLocal() for that partial row of C.  (Don't worry about
whether you own the body point or not, and only set entries for velocity
points that you own---because the other process will be setting the
entries for the points they own.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131112/9cd233d8/attachment.pgp>


More information about the petsc-users mailing list