<div dir="ltr">On Mon, Apr 22, 2013 at 7:56 AM, David Scott <span dir="ltr"><<a href="mailto:d.scott@ed.ac.uk" target="_blank">d.scott@ed.ac.uk</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
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.<br>

<br>
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.<br>
</blockquote><div><br></div><div style>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</div>
<div style><br></div><div style>  -pc_type gamg -pc_gamg_agg_nsmooths 1</div><div style><br></div><div style>   Thanks,</div><div style><br></div><div style>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I have attached relevant excerpts from the code.<br>
<br>
Yours sincerely,<br>
<br>
David Scott<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Dr. D. M. Scott<br>
Applications Consultant<br>
Edinburgh Parallel Computing Centre<br>
Tel. 0131 650 5921<br>
<br>
The University of Edinburgh is a charitable body, registered in<br>
Scotland, with registration number SC005336.<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>