On 3/9/20 8:26 AM, Michał Wichrowski wrote:
> I've got matrix-free multigrid solver for Stokes problem. The main
> bottleneck is solution of coarse problem, so I tried to assemble the
> regular sparse matrix and use direct solver. Since the coarse problem is
> (relatively) small, I used vmults by unit vector to obtain columns of
> the matrix.
This is unrelated to your original question, but worth mentioning
anyway: Conceptually, you are multiplying a unit vector by a sparse
matrix, and what you should get is a vector with nonzero entries in only
those rows for which the matrix has a nonzero entry in the column
corresponding to the unit vector.
This is inefficient, because you will have to do N such matrix-vector
products. But if you know which entries of the matrix are non-zero
(which you do, because you know which DoFs couple with each other), then
you can multiply with a sum of unit vectors, get an output vector, and
you will know which entries of the output vector correspond to the
product with each of these unit vectors. You should be able to get the
number of matrix-vector products down from N to N/100 or N/1000 for
sufficiently large problems -- i.e., *much much faster*.
(In fact, I think that we should at one point add a function that takes
an operator and that computes a matrix representation. If we would also
give that function a SparsityPattern, it could do the algorithm outlined
above automatically. As always, any help would be welcome!)
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/