Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-16 Thread Xiangdong
Hi Barry, I need some help on the parallel version of MatBAIJBlockDiagonalScale. My understanding is that MatBAIJBlockDiagonalScale_MPIBAIJ would be a wrapper on the MatBAIJBlockDiagonalScale_SeqBAIJ. However, I am not clear about how to get the local part of MPIBAIJ. Does the local part of

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-14 Thread Xiangdong
Thanks a lot, Barry! I see that you had implemented the bs=3 special case. I will play with these codes and add at least bs=2 case and try to get it working for parallel baij. I will let you know the update. Thank you. Xiangdong On Wed, Feb 14, 2018 at 2:57 PM, Smith, Barry F.

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-14 Thread Smith, Barry F.
In the PETSc git branch barry/feature-baij-blockdiagonal-scale I have done the "heavy lifting" for what you need. See https://bitbucket.org/petsc/petsc/branch/barry/feature-baij-blockdiagonal-scale It scales the Seq BAIJ matrix by its block diagonal. You will need to write a routine to

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-14 Thread Xiangdong
The idea goes back to the alternate-block-factorization (ABF) method https://link.springer.com/article/10.1007/BF01932753 and is widely used in the reservoir simulation, where the unknowns are pressure and saturation. Although the coupled equations are parabolic, the pressure equations/variables

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-14 Thread Smith, Barry F.
Hmm, I never had this idea presented to me, I have no way to know if it is particularly good or bad. So essentially you transform the matrix "decoupling the physics alone the diagonal" and then do PCFIELDSPLIT instead of using PCFIELDSPLIT directly on the original equations. Maybe in the

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-14 Thread Xiangdong
The reason for the operation invdiag(A)*A is to have a decoupled matrix/physics for preconditioning. For example, after the transformation, the diagonal block is identity matrix ( e.g. [1,0,0;0,1,0;0,0,1] for bs=3). One can extract a submatrix (e.g. corresponding to only first unknown) and apply

Re: [petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-13 Thread Smith, Barry F.
In general you probably don't want to do this. Most good preconditioners (like AMG) rely on the matrix having the "natural" scaling that arises from the discretization and doing a scaling like you describe destroys that natural scaling. You can use PCPBJACOBI to use point block Jacobi

[petsc-users] multiply a mpibaij matrix by its block diagonal inverse

2018-02-13 Thread Xiangdong
Hello everyone, I have a block sparse matrices A created from the DMDA3d. Before passing the matrix to ksp solver, I want to apply a transformation to this matrix: namely A:= invdiag(A)*A. Here invdiag(A) is the inverse of the block diagonal of A. What is the best way to get the transformed