W dniu wtorek, 10 marca 2020 17:33:43 UTC+1 użytkownik Wolfgang Bangerth 
napisał:
>
> 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!) 
>

Yes, I thought about that, but I my case is not worth an effort. I'm doing 
it to assemble coarse matrix, so the problem is relatively small (N_dof 
around 500). The assemble time is  unnoticeable comparing to solution time, 
even in case of small problems. Moreover, I need to apply inverse of 
some-kind Schur complement matrix (on coarse level only), and for that it 
would be extremely hard to guess sparsity pattern (it is still sparse). 
Fortunately, this matrix is even smaller. 

Your strategy (if implemented correctly) would require constant number of 
matrix-vector multiplications so the complexity will be linear. The number 
of vmults will depend on the mesh connectivity and type of FE. So the 
overall complexity will  be linear with the problem size (instead (O(N^2), 
as I understand from Your email). But indeed, it will be much faster. 
Best,
Michał

>
> Best 
>   W. 
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <javascript:> 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/6992d3bb-ad0e-4c96-b539-f2b5db84cf21%40googlegroups.com.

Reply via email to