[petsc-users] Creating PCFieldSplit Preconditioner in source code

Thomas Witkowski thomas.witkowski at tu-dresden.de
Mon Nov 19 01:29:43 CST 2012


In the implementation of my Navier-Stokes solver, I initialize the 
PCFieldSplit preconditioner in my source code (thus not on the command 
line) in the following way:

     PCSetType(pc, PCFIELDSPLIT);
     PCFieldSplitSetType(pc, PC_COMPOSITE_SCHUR);
     PCFieldSplitSetSchurFactType(pc, PC_FIELDSPLIT_SCHUR_FACT_FULL);
     ...
     KSPSetUp(ksp);
     KSP *subKsp;
     PetscInt nSubKsp;
     PCFieldSplitGetSubKSP(pc, &nSubKsp, &subKsp);
     KSP kspVelocity = subKsp[0];
     KSP kspSchur = subKsp[1];
     ...

And then kspVelocity and kspSchur are filled with appropriate options. 
The point is now, that to get the sub solver objects, I have to run 
KSPSetUp before. In this case, the sub solver objects are also 
initialized with some predefined options (block jacobi ILU), which I 
don't need and what takes some time and memory. Is there any other way 
to get the sub solver objects before and to initialize than the outer 
solver correctly with the inner solver I have specified?


Thomas


More information about the petsc-users mailing list