[petsc-users] Creating PCFieldSplit Preconditioner in source code

Thomas Witkowski thomas.witkowski at tu-dresden.de
Mon Nov 19 02:54:16 CST 2012


Jed: To you think that I can write a work-around in just using 
PetscOptionsInsertString before KSPSetUp with some settings that I don't 
will use later but which would make KSPSetUp on the corresponding solver 
object cheap?

Thomas

Am 19.11.2012 09:48, schrieb Jed Brown:
> Unfortunately, options are currently the only way to avoid the initial 
> setup. We could add a special setup routine to the PCFieldSplit 
> interface that you could call, but there are lots of other PCs that 
> you sometimes want to reconfigure after "partial setup". I've been 
> unhappy with this for years, but have not found a general and 
> maintainable way to support, and configuration via options is a better 
> approach most of the time.
>
>
> On Mon, Nov 19, 2012 at 2:29 AM, Thomas Witkowski 
> <thomas.witkowski at tu-dresden.de 
> <mailto: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. 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
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121119/31e709ca/attachment.html>


More information about the petsc-users mailing list