[petsc-users] Reuse direct solver

Feng Xing snakexf at gmail.com
Tue Dec 22 07:51:05 CST 2015


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);

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

    


More information about the petsc-users mailing list