[petsc-users] Obtain the preconditioned matrix
我
dayedut123 at 163.com
Sat Mar 24 07:15:23 CDT 2018
Hi Matt,
Sorry to distribute you again. I still have trouble with KSPComputeExplicitOperator. I reduced the matrix size to around 1000*1000. The time-cost of this function is acceptable, but when I output the preconditioned matrix, all the values are equal to zero! Here is part of my codes, do I operate error with this function?
PC pc;
KSP ksp;
Mat A,PA;
Vec b,x;
ierr=KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
ierr=KSPSetOperators(ksp,A,A);CHKERRQ(ierr);
ierr=KSPGetPC(ksp,&pc);CHKERRQ(ierr);
ierr=PCSetType(pc,PCHYPRE);CHKERRQ(ierr);
ierr=KSPSetType(ksp,KSPGMRES);CHKERRQ(ierr);
ierr=KSPSetFromOptions(ksp);CHKERRQ(ierr);
ierr=KSPSolve(ksp,b,x);CHKERRQ(ierr);
ierr=KSPComputeExplicitOperator(ksp,&PA);
ierr=MatAssemblyBegin(PA,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr=MatAssemblyEnd(PA,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr=MatView(PA,viewer);CHKERRQ(ierr);
Thank you very much!
Daye
At 2018-03-23 07:41:26, "Matthew Knepley" <knepley at gmail.com> wrote:
On Thu, Mar 22, 2018 at 8:29 PM, 我 <dayedut123 at 163.com> wrote:
Hi all,
I want to analyze the preconditioned matrix. But the KSPComputeExplicitOperator costs too much time to obtain the matrix. My origin matrix is about 3000*3000 sparse one. I noticed this function is applicable for the relative small system. What's the matrix-size limitation for this function? And for my case, any suggestions to solve it with less time?
This is just a really expensive operation. There is no way around it.
Matt
Thank you very much!
daye
--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180324/58a463a0/attachment.html>
More information about the petsc-users
mailing list