Dear All,

It appears to me that preallocation of blocked PETSc matrices may be computed incorrectly in libMesh under certain circumstances. Consider the following 9-node mesh:

8--7--9

| | |

4--3--6

| | |

1--2--5

with two first order Lagrange variables on it. Assume that _dof_coupling is "diagonal" (i.e., the variables are not coupled to one another - a real use case in Moose, at least in moose_test).

Then the "unblocked" n_nz would be (since there are 2 identical dofs per node):

4,4,6,6,9,9,6,6,4,4,6,6,6,6,4,4,4,4

The nodes, identified with the matrix blocks, have a similar connectivity, although there are half as many of them:

4,6,9,6,6,4,6,6,4,4.

This blocked preallocation is transformed, however, into the following blocked version b_n_nz:

2,3,4(sic!),3,3,2,3,3,2,2,

which is incorrect.

This subsequently leads to extra mallocs during matrix assembly. It seems to me that correct preallocation will only result for "full coupling" -- _dof_coupling of all ones.

Dmitry.