Solving the linear system of equations using PETSc BlockSparseMatrix

61 views
Skip to first unread message

Masoud Ahmadi

unread,
Aug 22, 2022, 9:02:28 AM8/22/22
to deal.II User Group
Dear All,

The following system of equations:
KQ=R
where,
Screenshot from 2022-08-22 13-45-45.png
were solved using BlockSparseMatrix to form tangent matrix K. It was solved by:

SparseDirectUMFPACK A_direct;

A_direct.initialize(K);

A_direct.vmult(Q_stp, R);

Now, I'm trying to run my code with MPI using PETSc/Trilinos, but the solver does not except  PETSc/Trilinos BlockSparseMatrix. How do we solve such a general system of equations?

Bruno Turcksin

unread,
Aug 22, 2022, 10:51:03 AM8/22/22
to deal.II User Group
Hi,

If you search for "block solver" here https://dealii.org/developer/doxygen/deal.II/Tutorial.html, you will see all the tutorials that use block solvers. I think that only deal.II's own solvers support BlockSparseMatrix directly.

Best,

Bruno

Masoud Ahmadi

unread,
Aug 23, 2022, 6:43:01 AM8/23/22
to deal.II User Group
Dear Bruno,

Thanks for your reply.
I had seen those before, but, unfortunately none of those solve a general PETSc/Trilinos BlockSparseMatrix problem.

Bruno Turcksin

unread,
Aug 23, 2022, 8:57:18 AM8/23/22
to dea...@googlegroups.com
They do. Take for example step-70, the matrix is a LA::MPI::BlockSparseMatrix which is a PETSc or a Trilinos BlockSpaceMatrix depending on how deal.II was configured.

Bruno

--
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 a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/vRkKqpMC21E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/96e7565f-4e69-4bb9-8de8-ddcf4f3d4067n%40googlegroups.com.

Masoud Ahmadi

unread,
Aug 23, 2022, 9:19:42 AM8/23/22
to deal.II User Group
Thanks for the reply.
I had seen that, they solve it for the "diagonal" blocks; I want a general method. My system of equations is not like any special cases in the Tutorials.
As I said, I solve the one without Trilinos/PETSc by:

SparseDirectUMFPACK A_direct;
A_direct.initialize(K);

A_direct.vmult(Q_stp, R);

I am looking for something similar.

Bruno Turcksin

unread,
Aug 23, 2022, 10:26:15 AM8/23/22
to dea...@googlegroups.com
I am not sure what you mean by solving for diagonal blocks. The solver is general; it is the preconditioner that is block diagonal. If you want to use MPI, I assume that you have a large system. In this case, direct solvers are not very effective and you need to use an iterative solver. deal.II's iterative solvers work with any BlockSparseMatrix. The tutorials show you how to take advantage of the blocks to build a good preconditioner. If you don't want to use a preconditioner, that's fine. The code will be similar to what you have now but it will be slow.

Daniel Arndt

unread,
Aug 23, 2022, 11:11:12 AM8/23/22
to dea...@googlegroups.com
Adding to what Bruno is saying,

If you are not taking advantage of the block structure, you should be able to treat the block matrix as "regular", i.e., non-block, matrix possibly by copying it to a corresponding non-block type.

Best,
Daniel

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/9c70b7e9-08ed-4cd6-bfd7-7eefe5eb2159n%40googlegroups.com.

Masoud Ahmadi

unread,
Aug 30, 2022, 11:23:31 AM8/30/22
to deal.II User Group
Dear Bruno and Daniel,

Thanks for your replies.
I used linear_operator and then solve the problem like step-70.
I guess there is no "Direct solver" for this situation, the one like we had for dealii BlockSparseMatrix.

Best regards,
Masoud
Reply all
Reply to author
Forward
0 new messages