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://lists.sourceforge.net/lists/listinfo/libmesh-users