[petsc-users] create PC, KSP, ST separately and use in EPS
Jose E. Roman
jroman at dsic.upv.es
Thu Oct 29 12:39:47 CDT 2015
> El 29/10/2015, a las 13:32, Denis Davydov <davydden at gmail.com> escribió:
>
> Dear all,
>
> I am currently looking at ways to extend deal.II PETSc/SLEPc wrappers classes to allow
> specification of linear solvers and preconditioners to be used in SLEPc eigensolvers
> using deal.II objects and NOT the command line arguments.
Yes, current deal.II wrappers for SLEPc are quite limited.
>
> All examples and unit tests I came across in SLEPc work with EPSCreate() followed by
> EPSGetST(), STGetKSP() and KSPGetPC(). This however does not fit well into object-oriented C++ code.
> Thus I plan to create each objects separately and pass them around.
>
> I would like to ask if the way I see it (in terms of PETSc/SLEPc functions called) is conceptually correct:
>
> — PETSc: Preconditioner class:
> PCCreate()
> PCSetType()
> PCSetFromOptions();
> —
>
> — PETSc: Solver class (uses Preconditioner class):
> KSPCreate()
> KSPSetType()
> KSPSetPC() // set PC created above
> KSPSetConvergenceTest()
> KSPSetFromOptions()
> —
>
> — SLEPc: SpectralTransformation class (uses Solver class)
> STCreate()
> STSetType()
> STSetShift() // some specific settings to transformation
> STSetKSP() // set KSP created above
> —
>
> — SLEPc: Eigensolver class (uses SpectralTransformation class)
> EPSCreate()
> EPSSetTolerances()
> EPSSetConvergenceTest()
> EPSSetWhichEigenpairs()
> EPSSetProblemType()
> EPSSetType()
> EPSArnoldiSetDelayed() // any specific options to eigensolver
> EPSSetST() // set spectral transformation created above
> // solve
> EPSSetDimensions()
> EPSSetFromOptions()
> EPSSolve()
> —
>
> Do this usage model sounds correct from SLEPc perspective?
I see no problem with this approach.
> What bothers me is that i do not call PCSetOperators()/PCSetUp() and KSPSetOperators()/KSPSetUp(),
> which one would call while setting up PETSc objects to solve SLAE.
> Nonetheless I assume those functions are executed somewhere inside SLEPc depending on
> SHEP/GHEP and ST to be used.
Correct, EPS/ST handle the KSP coefficient matrix so KSPSetUp() must be done at EPSSetUp() and not before.
Jose
>
> Kind regards,
> Denis.
More information about the petsc-users
mailing list