<div dir="ltr"><div style="font-size:14px"><span style="font-size:small"><font color="#000000">Thank you very much again Matt.</font></span></div><div style="font-size:14px"><span style="font-size:small"><font color="#000000"><br></font></span></div><div style="font-size:14px"><span style="font-size:small"><font color="#000000">Just another simple question.</font></span></div><div style="font-size:14px"><font color="#a64d79"><span style="font-size:small"><br></span></font></div><div style="font-size:14px"><font color="#a64d79"><span style="font-size:small">2016-08-31 20:00 GMT+09:00 Matthew Knepley </span><span dir="ltr" style="font-size:small"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span><span style="font-size:small">:</span><br></font></div><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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><font color="#a64d79">On Wed, Aug 31, 2016 at 5:46 AM, Choi Kyungjun <span dir="ltr"><<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Matt.<div><br></div><div>I really appreciate your help every time.</div><div><br></div><div><br></div><div>I think I forgot mentioning code info again.</div><div><br></div><div>1) </div><div>I'm working on 2-D/3-D Compressible Euler equation solver, which is completely hyperbolic system.</div></div></blockquote><div><br></div></font></span><div><font color="#a64d79">Okay, then MG is out. I would start by using a sparse direct solver, like SuperLU. Then for parallelism</font></div><div><font color="#a64d79">you could use ASM, and as the subsolver use SuperLU, so something like</font></div><div><font color="#a64d79"><br></font></div><div><font color="#a64d79"> -ksp_type gmres -pc_type asm -sub_pc_type superlu</font></div><div><font color="#a64d79"><br></font></div><div><font color="#a64d79">You could get more sophisticated by</font></div><div><font color="#a64d79"><br></font></div><div><font color="#a64d79"> - Trying to have blocks bigger than 1 process and using SuperLU_dist</font></div><div><font color="#a64d79"><br></font></div><div><font color="#a64d79"> - Splitting up the fields using PCFIELDSPLIT. There are indications that solving one of the fields first</font></div><div><font color="#a64d79"> can really help convergence. I am thinking of the work of David Keyes and LuLu Liu on MSM methods.</font></div></div></div></div></blockquote><div><br></div><div>For the above part,</div><div><br></div><div>It's not compatible with -snes_mf command line option, is it?</div><div><br></div><div>I applied cmd line options like below</div><div><b>-snes_mf -ksp_type gmres -pc_type asm -sub_pc_type superlu -snes_view -snes_monitor -ksp_monitor -snes_converged_reason -ksp_converged_reason</b></div><div><br></div><div><br></div><div>and my code flows like this</div><div><br></div><div><b>- call SNESCreate(PETSC_COMM_WORLD, Mixt%snes, ier)</b></div><div><b>- call SNESSetFunction(Mixt%snes, Mixt%r, FormFunction, userctx, ier)</b></div><div><b>- call SNESSetFromOptions(Mixt%snes, ier)</b></div><div><b>- call SNESGetKSP(Mixt%snes, ksp, ier)</b></div><div><b>- call KSPGetPC(ksp, pc, ier)</b></div><div><b><br></b></div><div><b>- call KSPSetFromOptions(ksp, ier)</b></div><div><b>- call PCSetFromOptions(pc, ier)</b></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>2)</div><div>And I'm trying to implement some implicit time scheme for convergence of my steady state problem.</div><div><br></div><div>I used LUSGS implicit scheme before, but these days GMRES implicit scheme is popular for quadratic convergence characteristics.</div><div></div></div></blockquote><div><br></div></span><div>I am not sure I understand here. Nothing about GMRES is quadratic. However, Newton's method can be quadratic</div><div>if your initial guess is good, and GMRES could be part of a solver for that.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>For implicit time scheme, it is just same as matrix inversion, so I started PETSc library for GMRES, which is one of the greatest mathematical library.<br></div><div><br></div><div><br></div><div>3)</div><div>As I'm using different numerical convective flux scheme (e.g. Roe's FDS, AUSM, etc), it would be really time consuming to derive Jacobian matrix for each scheme.</div></div></blockquote><div><br></div></span><div>Yes. However, the preconditioner matrix only needs to be approximate. I think you should derive one for the easiest flux scheme and</div><div>always use that. The important thing is to couple the unknowns which influence each other, rather than the precise method of influence.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So I was fascinated by matrix-free method (I didn't completely understand this method back then), and I implemented GMRES with no preconditioning matrix with your help.</div><div><br></div><div>After that, I wanted to ask you about any accelerating methods for my GMRES condition.</div><div><br></div><div>I will try applying CHEBY preconditioner as you mentioned first (even if its performance wouldn't be that good).</div><div><br></div><div>In order to constitute user-provided preconditioning matrix, could you tell me any similar examples? </div><div><br></div><div><br></div><div>Thanks again.</div><div><br></div><div>Your best,</div><div><br></div><div>Kyungjun.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-31 19:07 GMT+09:00 Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Wed, Aug 31, 2016 at 3:49 AM, Choi Kyungjun <span dir="ltr"><<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Petsc.<div><br></div><div>I am implementing Petsc library for my CFD flow code.</div><div><br></div><div>Thanks to Matt, I got what I wanted last week. </div><div><br></div><div>It was the GMRES with matrix-free method, no preconditioning matrix and command line options are below.</div><div><br></div><div><b>-snes_mf -pc_type none -..monitor -..converged_reason</b></div><div><br></div><div>The solve worked, but performed very poorly.</div><div><br></div><div><br></div><div>I learned that the efficiency of Krylov-subspace methods depends strongly depends on a good preconditioner.</div><div><br></div><div><div>And in the Petsc manual, the matrix-free method is allowed only with no preconditioning, a user-provided preconditioner matrix, or a user-provided preconditioner shell.<br></div></div><div><br></div><div><br></div><div>Here are my questions.</div><div><br></div><div>1) To improve the solver performance using GMRES, is there any way using snes_mf without preconditioning matrix?</div></div></blockquote><div><br></div></span><div>Not really. The CHEBY preconditioner will work without an explicit matrix, however its not great by itself.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>2) For user-provided preconditioner matrix, I saw some example codes that provide approx. Jacobian matrix as preconditioner matrix. But this means that I should derive approx. Jacobian mat for system, am I right?</div></div></blockquote><div><br></div></span><div>Yes.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>3) I'd like to know which is the fastest way to solve with GMRES method. Could you tell me or let me know any other examples?</div></div></blockquote><div><br></div></span><div>1) The solve depends greatly on the physics/matrix you are using. Without knowing that, we can't say anything. For example, is</div><div>the system elliptic? If so, then using Multigrid (MG) is generally a good idea.</div><div><br></div><div>2) In general, I think its a mistake to think of GMRES or any KSP as a solver. We should think of them as accelerators for solvers,</div><div>as they were originally intended. For example, MG is a good solver for elliptic CFD equations, as long as you somehow deal with</div><div>incompressibility. Then you can use GMRES to cleanup some things you miss when implementing your MG solver.</div><div><br></div><div>3) The best thing to do in this case is to look at the literature, which is voluminous, and find the solver you want to implement. PETSc</div><div>really speeds up the actually implementation and testing.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you very much for your help.</div><div><br></div><div>Sincerely,</div><div><br></div><div>Kyungjun.</div></div>
</blockquote></span></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br><div data-smartmail="gmail_signature">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>
</font></span></font></span></div></div>
</blockquote></div><br></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature">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></div></div></div>
</blockquote></div><br></div></div>