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

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 12 19:21:14 CST 2013


Anush Krishnan <anush at bu.edu> writes:
> Could you explain why it might be better to assemble C^T? As far as the
> code is concerned, I don't see any difference between the two, except
> interchanging the row and column when I call MatSetValues.

Correct, it's a trivial change for you, but it would mean that all the
entries would be local, rather than being communicated to the owner of
the body point.

> 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?

> Just to give you an idea of the values of d_nz and o_nz that I ended up
> using:
> The test problem consisted of a 20x20 grid in a square domain,
> interpolating on to a circle in the center of the domain with diameter
> equal to half of the domain edge. The circle is represented by 32 boundary
> points.
> For C^T, I used d_nz=5 and o_nz=5 (A smaller number for either would
> produce "Argument out of range!" errors)
> For C, I needed d_nz=12 and o_nz=12.
> (I should clarify: The test problem actually created the matrix [Cx Cy] to
> map from [u v]^T to [bx by]^T. u was of size 19x20, and v was 20x19.)
>
>  What are you doing with the C once it is built?
>>
>
> I need to compute the matrix C * C^T, and use that as the left-hand side
> matrix of a linear system. I will also have to include C^T as part of a
> bigger matrix Q, and calculate Q^T*Q, but I should probably ask questions
> about that on a different thread.

C * C^T is the influence of particles on each other?  Why can't you
compute that analytically (without referencing the grid directly)?
-------------- 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/53670a31/attachment.pgp>


More information about the petsc-users mailing list