[petsc-users] using PCFieldSplitGetSubKSP in c++

Klaij, Christiaan C.Klaij at marin.nl
Wed Mar 14 02:53:16 CDT 2012


> > Thanks, I get the idea now and changed the code to:
> >
> >  KSP *subksp;
> >   PetscInt n=2;
> >  ierr = PCFieldSplitGetSubKSP(pc,&n,&subksp); CHKERRQ(ierr);
> >
> > which removes the compiler error but gives the following runtime
> > error in MatSchurComplementGetKSP():
> >
> > [0]PETSC ERROR: --------------------- Error Message
> > ------------------------------------
> > [0]PETSC ERROR: Null argument, when expecting valid pointer!
> > [0]PETSC ERROR: Null Object: Parameter # 1!
> >
>
> You have to have set the matrix and called PCSetUp() for this inner context
> to have been created. This is an unfortunate property of nested methods
> (with every programming system I know of), it's difficult to bootstrap so
> that a certain inner object is configured without setting up more than is
> strictly necessary. If it's just the constant null space, then you can do
> it on the command line. Note that with petsc-dev, you can use
> MatSetNullSpace() and it will be used by the KSP, thus avoiding the need to
> drill down into the KSP like this.

Thanks, no more problems after PCSetUP(). I am using petsc-dev,
so are you saying that MatSetNullSpace() on the block matrix [A00
A01, A10 A11] will be enough? Can/will the null space of the
Schur complement be deduced from this? Otherwise one would still
need to "drill down" to get Schur complement matrix, right?


dr. ir. Christiaan Klaij
CFD Researcher
Research & Development
E mailto:C.Klaij at marin.nl
T +31 317 49 33 44

MARIN
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
T +31 317 49 39 11, F +31 317 49 32 45, I www.marin.nl



More information about the petsc-users mailing list