[petsc-users] Reuse direct solver

Matthew Knepley knepley at gmail.com
Tue Dec 22 08:53:41 CST 2015


On Tue, Dec 22, 2015 at 7:51 AM, Feng Xing <snakexf at gmail.com> wrote:

> Hello everyone,
>
> I want to solve Ax=b with a direct LU method many times where A is a
> parallel aij matrix. I found two ways in the doc and in some slides (maybe
> not updated).
>
> 1.   KSPSetType(ksp,KSPPREONLY);
>       PCSetType(pc,PCLU);
>       PCFactorSetMatSolverPackage(pc,MATSOLVERSUPERLU_DIST);
>       KSPSetReusePreconditioner(ksp, PETSC_TRUE);
>       KSPSolve(A,b,x);
>

Use the first method. In fact, if your matrix does not change, you do not
even need
the Reuse flag. PETSc will automatically reuse the PC. The flag allows you
to reuse
the PC for a changing matrix.

  Thanks,

    Matt


> 2.   MatGetOrdering(A, MATORDERINGNATURAL, &isr, &isc);
>       MatGetFactor(A, MATSOLVERMUMPS, MAT_FACTOR_LU, &A_fact);
>       MatLUFactorSymbolic(A_fact, A, isr, isc, &info);
>       MatLUFactorNumeric(A_fact, A, &info);
>       MatSolve(A_fact,b,x);
>
> I would like to ask if both of them allow to do one time LU factorisation,
> then implement backward/forward LU each KSPSolve or MatSolve?
> Besides, does the ways support superlu_dist and mumps?
>
> Thank you very much.
>
> Feng Xing
> Postdoc in France
>
>




-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151222/3f252efb/attachment.html>


More information about the petsc-users mailing list