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

Anush Krishnan anush at bu.edu
Wed Nov 13 13:53:07 CST 2013


>
> > For memory allocation, I know that every row of C contains exactly 12
> > non-zeros (since I interpolate from a 3x4 grid). But I have no idea if
> they
> > are in the diagonal or the off-diagonal region of the matrix. For C^T, I
> > can't predict beforehand how many non-zeros will be present in each row.
> > Most rows will in fact be empty. But if I assume a "nice" solid
> boundary, I
> > would imagine each velocity grid point should not be influenced by more
> > than ~4 body points.
>
> Can you just make one pass to count and another to insert?
>

Yes I could do that. I'll try that out.


> C * C^T is the influence of particles on each other?  Why can't you
> compute that analytically (without referencing the grid directly)?
>

I haven't thought about that. The interpolation coefficients would depend
upon the relative positions of the body points with respect to the grid,
and the product matrix will depend on their positions with respect to each
other. I don't know if this can be done without referencing the grid.

I also have a couple of related questions:

[1] Suppose my body moves, and the positions of the body points change,
will I have to completely deallocate C^T and reallocate the new rows on
each process? It's possible that the number of non-zeros on each process
can change. What would you suggest as the best strategy to do this?

[2] For a two dimensional staggered grid, I would need to interpolate both
the x- and y- velocity components. So my system [C][u]=[b] will be:

/Cx 0 \ /u\ = /bx\
\0  Cy/ \v/   \by/

Currently, I set up the right hand side as a single vector of size
2*numBodyPoints using VecCreate, and use the global index of the rows when
I want to assemble the matrix C. Suppose I made it a DMComposite of bx and
by (which I can create as 1-D DAs), how can I reference the correct row of
the vector?

Also, is it possible to create a composite vector of two vectors that are
not distributed arrays?

Thank you,
Anush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131113/2864d4c3/attachment.html>


More information about the petsc-users mailing list