Hi Amal,

I don't think it is a good idea to set petsc options in the code because
this will lose flexibility and petsc has a billion of options. Even worse,
some internal objects such as pc possibly will destroyed and rebuilt (in
some cases), and then the options you set possibly do not work any more.


Fande,


On Thu, Sep 15, 2016 at 9:30 AM, Sahai, Amal <sah...@illinois.edu> wrote:

> I thought of directly accessing the ksp/pc object via ksp() or pc() and
> setting the correct options right before I solve the linear system. But my
> fear is would the Petsclinearsolver reformat the ksp / pc object when it
> executes solve. So, I guess my next question would be where should I set
> these options, does doing them before a call to solve is made makes sense?
>
> Regards
> Amal
> ________________________________________
> From: Roy Stogner [royst...@ices.utexas.edu]
> Sent: Thursday, September 15, 2016 10:25 AM
> To: Sahai, Amal
> Cc: libmesh-users@lists.sourceforge.net
> Subject: Re: [Libmesh-users] Setting size of ksp parameters
>
> On Thu, 15 Sep 2016, Sahai, Amal wrote:
>
> > I have an equation system consisting of multiple Linear Implicit
> > systems which I am solving using Petsc. What would be the easiest
> > way to set the size of krylov subspace and the preconditioner being
> > employed for a particular system? I don't want to use command line
> > arguments because those get applied across systems.
>
> Hmm... for KSP options we do call KSPSetOptionsPrefix, so you ought to
> be able to use -MySystemNameksp_type cg and such.
>
> However:
>
> We don't have any test coverage of this in libMesh (or GRINS or FIN-S
> IIRC), so unless Moose has our back I'm not sure we're doing it
> properly.  It didn't seem to work for me when I gave it a quick try.
>
> IMHO we ought to be sticking an underscore at the end of the system
> name before using it as a prefix...
>
> I don't see PCSetOptionsPrefix anywhere, and I'm not sure whether it
> defaults to "" or to "whatever the KSP was set to".
>
>
> If that's not working right now, we do have ways to set the most basic
> options in C++ via abstract base classes, but for anything even mildly
> sophisticated I think you need to cast to PetscLinearSolver, extract
> the ksp() or pc() reference, and use PETSc methods on those.
> ---
> Roy
> ------------------------------------------------------------
> ------------------
> _______________________________________________
> Libmesh-users mailing list
> Libmesh-users@lists.sourceforge.net
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.
> sourceforge.net_lists_listinfo_libmesh-2Dusers&d=CwICAg&c=
> 54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=DUUt3SRGI0_
> JgtNaS3udV68GRkgV4ts7XKfj2opmiCY&m=RO0UXOYnMab2MDIK2WpGcNUinCpTcy
> 8b-iduRpClR04&s=jtQuUyMjsDuAJKHnB5V6t7JkWAWV___pfLTFis6Lg-U&e=
>
------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to