[petsc-users] Return value of PCFactorGetMatrix
Uwe Schlifkowitz
uwe.schlifkowitz at uibk.ac.at
Mon Dec 12 11:49:45 CST 2011
I'm continuing Clemens Domanig's work. Currently I'm stuck at his problem as described here: http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009571.html
As far as I understand, getting the diagonal matrix from MUMPS is not possible, so Clemens (and I) resort to MATSOLVERPETSC to obtain D.
Uwe
On 12.12.2011, at 18:40, Barry Smith wrote:
>
> A "factored" matrix in PETSc whether with a PETSc implementation or an external implementation such as MUMPS, or SuperLU is a weird beast. It is likely in some strange convoluted data structure from which extracting information is not easy.
>
> What information, exactly do you want to obtain from the factored matrix? If we know that we might be able to help you get it.
>
> Barry
>
> On Dec 12, 2011, at 11:35 AM, Uwe Schlifkowitz wrote:
>
>> Dear list,
>>
>> following advice from this list and petsc documentation (especially http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex52.c.html ), i have the following code:
>>
>> //---------
>> ierr = KSPCreate( coml,&kspBA);CHKERRQ(ierr);
>> ierr = KSPSetOperators( kspBA, Kt, Kt, DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
>>
>> ierr = KSPSetType(kspBA,KSPPREONLY);CHKERRQ(ierr);
>>
>> ierr = KSPGetPC(kspBA, &pcba);
>>
>> ierr = PCSetType(pcba, PCCHOLESKY);CHKERRQ(ierr);
>>
>> ierr = PCFactorSetMatSolverPackage(pcba, MATSOLVERPETSC);CHKERRQ(ierr);
>> ierr = PCFactorSetUpMatSolverPackage(pcba);CHKERRQ(ierr);
>> ierr = MatGetFactor(Kt,"petsc",MAT_FACTOR_CHOLESKY,&DiagM);CHKERRQ(ierr);
>> ierr = PCFactorGetMatrix(pcba, &DiagM);CHKERRQ(ierr);
>>
>> ierr = KSPSetUp(kspBA);CHKERRQ(ierr);
>> //ierr = MatView(DiagM,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>> //ierr = MatView(DiagM,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>> ierr = VecDuplicate(fin,&diag);CHKERRQ(ierr);
>> ierr = MatGetDiagonal(DiagM,diag);CHKERRQ(ierr);
>> //-----------
>>
>> where Kt is a stiffness matrix. I was hoping that PCFactorGetMatrix() makes DiagM become D from a LDL^T factorization, but to me it seems as if this is not true.
>>
>> Can anyone clarify?
>>
>> Regards,
>> Uwe
More information about the petsc-users
mailing list