Thanks for the suggestion. I had tried '-pc_type gamg -pc_gamg_agg_nsmooths 1' with an earlier version of the code without success. I have tried it again but I get NaN's after only 90 time steps whereas with block Jacobi it runs quite happily for 36,000 time steps and produces physically sensible results.
David On 22/04/2013 13:12, Matthew Knepley wrote: > On Mon, Apr 22, 2013 at 7:56 AM, David Scott <d.scott at ed.ac.uk > <mailto:d.scott at ed.ac.uk>> wrote: > > Hello, > > I am working on a fluid-mechanical code to solve the two-phase > Navier?Stokes equations with levelset interface capturing. I have > been asked to replace the pressure calculation which uses the SOR > and Jacobi iterative schemes with a Krylov subspace method. I have > done this and the code is working but as I have never used PETSc > before I would like to know if improvements to my code, or the run > time parameters that I am using, could be made. > > I am using GMRES with a Block Jacobi pre-conditioner. I have tried > Conjugate Gradient with a Block Jacobi pre-conditioner but it > diverges. If I use GMRES for the first few thousand time steps and > then swap to CG it does converge but the speed of execution is > somewhat reduced. > > > Krylov methods do not work with preconditioners. You have a Poisson > problem, so as abundantly documented in the literature, you should use > multigrid. The easiest thing to try is > > -pc_type gamg -pc_gamg_agg_nsmooths 1 > > Thanks, > > Matt > > I have attached relevant excerpts from the code. > > Yours sincerely, > > David Scott > -- > Dr. D. M. Scott > Applications Consultant > Edinburgh Parallel Computing Centre > Tel. 0131 650 5921 > > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener -- Dr. D. M. Scott Applications Consultant Edinburgh Parallel Computing Centre Tel. 0131 650 5921 The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
