<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 18pt; color: #000000"><div>I am disparate to implement the petsc library gmres in an CFD code and need a little help to get going.<br></div><div><br></div><div>23 years ago, gmres was implemented/written in the code by Y. Saad, modified by A. Malevsky, version February 1, 1995.</div><div><br></div><div>petsc, most likely started with the same version, added new solvers, ...etc and maintained and corrected bugs reported by users<br></div><div>and I would like to use the latest petsc version of gmres<br></div><div><br></div><div>Why?<br></div><div>Normally we have no convergence problems using gmres.<br></div><div>However sometimes gmres diverges instantaneously, no warning, just a negative density.<br></div><div>Our code is parallel mpi, unstructured, uses a low Mach preconditioner, FV Roe scheme.<br></div><div><br></div><div>Thus I would like to add an petsc option.<br></div><div>Would someone outline, in detail, the steps that I need to follow?<br></div><div>I need all the encourage that I can get to add the option in the code.<br></div><div>petsc is installed on our computers<br></div><div>Thanks in advance,<br></div><div>Stephen<br></div><div><br></div><div><br></div><div> IF ( petsc .EQ. 1 ) THEN<br>c petsc CALL MatAssembleBegin<br>c petsc CALL MatAssembleEnd</div><div>... add steps<br> ELSE<br> CALL GMRESASR ! from our code<br> ENDIF<br><div><br></div></div><div><br></div><div><br></div><div>This is from our code which may be useful information<br></div><div>c-----------------------------------------------------------------------<br>c flexible GMRES routine. This is a version of GMRES which allows a <br>c a variable preconditioner. Implemented with a reverse communication <br>c protocole for flexibility -<br>c DISTRIBUTED VERSION (USES DISTDOT FOR DDOT) <br>c explicit (exact) residual norms for restarts <br>c written by Y. Saad, modified by A. Malevsky, version February 1, 1995<br>c-----------------------------------------------------------------------<br>c This Is A Reverse Communication Implementation. <br>c------------------------------------------------- <br>c USAGE: (see also comments for icode below). CGMRES<br>c should be put in a loop and the loop should be active for as<br>c long as icode is not equal to 0. On RETURN fgmres will<br>c 1) either be requesting the new preconditioned vector applied<br>c to wk1 in case icode.eq.1 (result should be put in wk2) <br>c 2) or be requesting the product of A applied to the vector wk1<br>c in case icode.eq.2 (result should be put in wk2) <br>c 3) or be terminated in case icode .eq. 0. <br>c on entry always set icode = 0. So icode should be set back to zero<br>c upon convergence.<br>c-----------------------------------------------------------------------<br>c Here is a typical way of running fgmres: <br>c<br>c icode = 0<br>c 1 continue<br>c CALL fgmres (n,im,rhs,sol,i,vv,w,wk1, wk2,eps,maxits,iout,icode)<br>c<br>c if (icode .eq. 1) then<br>c CALL precon(n, wk1, wk2) <--- user's variable preconditioning<br>c goto 1<br>c else if (icode .ge. 2) then<br>c CALL matvec (n,wk1, wk2) <--- user's matrix vector product. <br>c goto 1<br>c else <br>c ----- done ---- <br>c .........<br> </div></div></body></html>