[petsc-users] Creating PCFieldSplit Preconditioner in source code

Matthew Knepley knepley at gmail.com
Mon Nov 19 07:57:34 CST 2012


On Mon, Nov 19, 2012 at 8:48 AM, Thomas Witkowski
<thomas.witkowski at tu-dresden.de> wrote:
> Am 19.11.2012 14:45, schrieb Barry Smith:
>
>> 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
>>
> Just the KSPSetUp takes 4 to 5 seconds, for no computation at all. I don't
> think, this is negligible. It destroys my parallel scaling of initializing
> the solver.

You are wrong. Read my latest reply.

  Matt

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



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


More information about the petsc-users mailing list