Problem Solving BlockSparsematrix system blockwise

25 views
Skip to first unread message

Gabriel Peters

unread,
May 20, 2019, 7:56:47 AM5/20/19
to deal.II User Group
Hey everyone,
I have a problem at solving a blocksystem.

I have a matrix called "system_matrix" in Blockform M =  [[A,0],[B,C]]
and I want to solve classical Mx = F. (F = [f,0], x = [x1,x2])

I proceed according to the LinearSolvers class in the step-32 tutorial.
so by blockwise solving the system I want to solve A*x1 = f for x1
and later on I want to solve
C*x2 = 0 - B*x1 for x2.

In the code I use:
std::shared_ptr<TrilinosWrappers::PreconditionJacobi> Mp_preconditioner;

and compute

    TrilinosWrappers::SolverGMRES solver_gmres(solver_control_gmres);

    solver_gmres.solve(system_matrix.block(0,0),distributed_solution.block(0),
                rhs.block(0),Mp_preconditioner);


But when I compile this I get the error

 error: no matching function for call to ‘dealii::TrilinosWrappers::SolverGMRES::solve(dealii::BlockMatrixBase<dealii::TrilinosWrappers::SparseMatrix>::BlockType&, dealii::BlockVectorBase<dealii::TrilinosWrappers::MPI::Vector>::BlockType&, dealii::BlockVectorBase<dealii::TrilinosWrappers::MPI::Vector>::BlockType&, std::shared_ptr<dealii::TrilinosWrappers::PreconditionJacobi>&)’
     rhs.block(0),Mp_preconditioner);



This error also comes up at solving the lower right block
TrilinosWrappers::SolverCG solver_cg(solver_control_cg);   
    solver_cg.solve(system_matrix.block(1,1),
            distributed_solution.block(1),
            u_tmp_p,
            Amg_preconditioner);


Can somebody tell me what actually went wrong? I think I did everything quite similar to the LinearSolvers class which works finely.
Thanks a lot and best regards

Gabriel







Jean-Paul Pelteret

unread,
May 20, 2019, 9:01:27 AM5/20/19
to dea...@googlegroups.com
Dear Gabriel,

It looks to me like you forgot to dereference the shared pointer for the preconditioner. So,

solver_gmres.solve(
  system_matrix.block(0,0),
  distributed_solution.block(0),
  rhs.block(0),
  *Mp_preconditioner); // <— here

You probably have the same problem for the other call.

I hope this was the correct observation to help sole the issue!

Best,
Jean-Paul


--
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/a89681fc-950b-473b-a18b-666feaf89207%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gabriel Peters

unread,
May 20, 2019, 9:15:41 AM5/20/19
to dea...@googlegroups.com
Hey Jean-Paul
Thanks a lot, Now it works finely.
Best regards

Gabriel




Gabriel Peters
Endenicher Str. 310
53121 Bonn
00491525/5478185
Gabriel...@koeln.de

Am 20.05.19 um 15:01 schrieb Jean-Paul Pelteret
> > The deal.II project is located at http://www.dealii.org/ <http://www.dealii.org/>
> > For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <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 <mailto:dealii+un...@googlegroups.com>.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/a89681fc-950b-473b-a18b-666feaf89207%40googlegroups.com <https://groups.google.com/d/msgid/dealii/a89681fc-950b-473b-a18b-666feaf89207%40googlegroups.com?utm_medium=email&utm_source=footer>.
> > For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
>
> --
> 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/62B07170-EA44-4276-8813-4E8C9E25A1BF%40gmail.com.
Reply all
Reply to author
Forward
0 new messages