Pasha,
> *if* (direct_solver)
>
> {
>
> SolverControl cn;
>
> TrilinosWrappers::SolverDirect solver(cn);
>
> solver.*solve*(system_pde_matrix.block(0,0),
>
> newton_update.block(0), system_pde_residual.block(0));
>
>
> constraints_update.distribute(newton_update);
>
>
> *return* 1;
>
> }
>
>
>
> block(0,0) of system matrix and block(0) of residual and Newton update
> vectors are selected but all block is solved simultaneously!! So I cant
> solve specific block using direct solver and it is the first problem.
>
This is really strange. None of the objects you are using should see the
other blocks. Can you confirm that the first block really does not contain
the whole system? Can you just check the sizes of these objects?
>
> The second problem is when working with iterative solver. I cant set an
> AMG Precondition for specific block of the system. For example I define a
> class like this:
>
>
> *template* <*class* *PreconditionerA*>
>
> *class* BlockDiagonalPreconditioner_one
>
> {
>
> *public*:
>
> *BlockDiagonalPreconditioner_one*(*const* LA::MPI::BlockSparseMatrix &M,
>
> *const* *PreconditionerA* &pre_A)
>
> : matrix(M),
>
> prec_A (pre_A)
>
> {
>
> }
>
>
> *void* *vmult* (LA::MPI::BlockVector &dst,
>
> *const* LA::MPI::BlockVector &src) *const*
>
> {
>
> prec_A.vmult(dst.block(0), src.block(0));
>
> }
>
>
>
> *const* LA::MPI::BlockSparseMatrix &matrix;
>
> *const* *PreconditionerA* &prec_A;
>
> };
>
>
> for solving block(0,0) as,
>
>
> BlockDiagonalPreconditioner_one<LA::MPI::PreconditionAMG>
>
> preconditioner(system_pde_matrix.block(0,0), preconditioner_solid);
>
>
> solver.*solve*(system_pde_matrix.block(0,0), newton_update.block(0),
>
> system_pde_residual.block(0), preconditioner);
>
>
> But there are two errors:
>
>
> 1) no matching function for call to
> ‘BlockDiagonalPreconditioner_one<dealii::TrilinosWrappers::PreconditionAMG>::BlockDiagonalPreconditioner_one(dealii::BlockMatrixBase<dealii::TrilinosWrappers::SparseMatrix>::BlockType&,
>
> dealii::LinearAlgebraTrilinos:
>
:MPI::PreconditionAMG&)’
>
The type of an individual block is Trilinos::Wrappers::SparseMatrix and not
LA::MPI::BlockSparseMatrix. You need to change the definition in your
Preconditioner class.
>
> 2) Invalid arguments '
>
> Candidates are:
>
> void solve(const #10000 &, dealii::TrilinosWrappers::MPI::BlockVector &,
> const dealii::TrilinosWrappers::MPI::BlockVector &, const #10001 &)
>
This hopefully goes away after you fixed the first error.
>
> the first error may be due to sending block(0,0) of TrilinosWrappers
> BlockMatrix as first argument of *BlockDiagonalPreconditioner_one*
> constructor.
>
> Finally how I can set precondition for specific block and how I can solve
> that block when working with TrilinosWrappers?
>
Doing a `$ grep -r "TrilinosWrappers::BlockSparseMatrix" .` tells me that
step-31, step-32, step-43 and step-45 use
TrilinosWrappers::BlockSparseMatrix
and all of these use preconditioners for specific blocks. That said, I
would assume that what you are doing should work as well.
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 [email protected].
For more options, visit https://groups.google.com/d/optout.