-ksp_type fgmres -pc_type ksp -ksp_ksp_type gmres -ksp_pc_type none 

   But this is just nesting unpreconditioned GMRES inside FGMRES. It is trivial 
to do but I doubt that it buys you anything over just

 -ksp_type gmres -pc_type none

  Barry


On Jan 16, 2011, at 7:05 PM, Darcoux Christine wrote:

> 2011/1/16 Barry Smith <bsmith at mcs.anl.gov>
> 
> On Jan 16, 2011, at 5:59 PM, Darcoux Christine wrote:
> 
> > I am new to PETSc and I am interested to use the nonlinear solver in a CFD 
> > code for low speed compressible fluid.
> >
> > According to some papers, it seems that GMRES (or any other Krylov method) 
> > could be used to precondition FGMRES in a way that is completely 
> > matrix-free. Is it something possible with the fgmres implementation 
> > provided by PETSc ?
> 
>   Yes, but like anything with "matrix-free" is the question how you provide a 
> decent preconditioner without forming any matrices. If you can do that then 
> you are all set.
> 
>  KSPSetOperators(ksp,A,B,...)   or SNESSetJacobian(snes,A,B, ....)  where A 
> is a a MATSHELL that does matrix vector products or use MatCreateMFFD()
> 
> -ksp_type fgmres -pc_type ksp -ksp_ksp_type gmres  -ksp_view
> 
>  If B is some approximate representation of A then B will be used to 
> construct the preconditioner, if you never have a matrix-representation but 
> have a function/subroutine that is supposedly a good preconditioner then you 
> would use PCSHELL to provide it. So there are several possibilities depending 
> on what you have and what you want to do.
> 
>  Barry
> 
> > Christine
> >
> 
> 
> Thank you for the detailled explanations. My idea is to simply precondition 
> fGMRES with GMRES to avoid creating a B that is an approximate representation 
> of A. If A is represented by a mat-vec routine, I think that the 
> preconditionner M (approximation of the inverse of A) could be defined by the 
> action of GMRES. Here's a code pseudo-code showing how I would like to define 
> such an M. 
> 
> 1. Define matrix A as a mat-vec operation (matrix free), right-hand-side b 
> and x0 a zero vector 
> 2. The tricky part is now to define M by a mat-vec function like this
> 
> function precon_matvec(x) { 
>     //Basically, GMRES approximates inverse(A) with a polynomial 
>     // P(A) so that x = x0 + P(A)*r, where r is the residual.  Thus in the 
>     // call to GMRES, x0 is a zero vector and the right-hand-side is x. 
>     return gmres(A, x, x0, tolerance=gmres_tol, maxiter=10) 
> }
> 
> M = CreateMatrixFreePreconditionne
> r (precon_matvec)
> 
> 3. Now call fGMRES with the above M preconditionner
> 
> Is it possible to acheive something like this with PETSc ?
> 
> Cheers,
> 
> Christine
> 

Reply via email to