[petsc-users] Creating PCFieldSplit Preconditioner in source	code
    Barry Smith 
    bsmith at mcs.anl.gov
       
    Mon Nov 19 07:45:28 CST 2012
    
    
  
On Nov 19, 2012, at 1:29 AM, Thomas Witkowski <thomas.witkowski at tu-dresden.de> wrote:
> 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.
    These are just little stubs, they don't take but a trivial amount of memory and time to create they are not complete solvers so you shouldn't worry about them.
   Barry
> 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