On 11/21/22 07:45, 'yy.wayne' via deal.II User Group wrote:
However, by copy to and from between LinearAlgebra::distributed::BlockVector
and LinearAlgebra::distributed::Vector, it produces wrong result. Though I
cannot confirm the wrong result comes from transfer between Vector and
BlockVector(I tested simple x=inv(A)*b and result is right, but treating it as
the coarse solver for bigger problem the result is wrong), I reassembled the
matrix in Trilinos BlockSparseMatrix and solve it with a iterative solver and
the result is correct. While solving coarse problem iteratively works for very
small matrix, my system is indefinite so I have to use a direct solver.
So given a BlockSparseMatrix and BlockVector src and dst, is there a
recommended strategy to solve it directly(or block diagonal precondition)? The
matrix has form [A, B; -B^T A]
No, not without copying data back and forth.
But you can test whether the copying introduces the error. Let's say you have
copied the data into a nonblock system, solved it, and copied it back to the
block system. Let's say your block system consists of a matrix A, right hand
side b, and the solution vector x you obtained by copying the solution of the
nonblock version into x. All of these objects consist of blocks.
Then if x solved the nonblock version, you would expect that the residual,
b-Ax
is small. You can test that via the BlockSparseMatrix::residual() function.
Specifically, you would expect that
||b-Ax|| / ||b||
is, say, 1e-12. You can compute this via
BlockVector r(...);
double relative_residual = A.residual (r,x,b) / b.l2_norm();
If the relative residual is not small, then something must have gone wrong
during the copying step. If it is small, then the solution of the nonblock
system, copied into the block vector x, is also the solution of the block system.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/3d195712-2e1f-730b-848d-e90a2aeeb073%40colostate.edu.