<div class="gmail_quote">On Fri, Sep 21, 2012 at 6:15 PM, Shao-Ching Huang <span dir="ltr"><<a href="mailto:huangsc@gmail.com" target="_blank">huangsc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am reading this page,<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPRICHARDSON.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPRICHARDSON.html</a><br>
It says:<br>
<br>
"This method often (usually) will not converge unless scale is very<br>
small. </blockquote><div><br>That statement applies if you use a general preconditioner that does not bound the preconditioned spectrum. With LU, you are fine with a scale of 1 (or close).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It is described in "<br>
<br>
and seems to miss a reference there.<br></blockquote><div><br></div><div>The reference is further down the page. Thanks for pointing out the anomaly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
On Fri, Sep 21, 2012 at 4:07 PM, Shao-Ching Huang <<a href="mailto:huangsc@gmail.com">huangsc@gmail.com</a>> wrote:<br>
> I will try the Richardson procedure Jed suggested. Thank you!<br>
><br>
><br>
> On Fri, Sep 21, 2012 at 3:50 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
>><br>
>> Ok, so it is using a FULL LU factorization of A1. Hence with what I outlined below you would use -ksp_type preonly -pc_type lu<br>
>><br>
>> If you reorganize the iteration then in exact arithmetic it is what we in PETSc call Richardson's method with preconditioner defined from M (the LU of M) so I was wrong; you can do as Jed suggested<br>
>> KSPSetOperations(ksp, A,A1,….) and run with -ksp_type richardson to mimic the old algorithm. Simply switch to -ksp_type gmres and you have the late 80's version of the algorithm<br>
>><br>
>><br>
>><br>
>> Barry<br>
>><br>
>><br>
>> On Sep 21, 2012, at 5:30 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
>><br>
>>><br>
>>> On Sep 21, 2012, at 5:26 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>> wrote:<br>
>>><br>
>>>> On Fri, Sep 21, 2012 at 5:21 PM, Shao-Ching Huang <<a href="mailto:huangsc@gmail.com">huangsc@gmail.com</a>> wrote:<br>
>>>> In this particular finite volume discretization, the flux normal to a<br>
>>>> face involves the cell-center values on each side of the face (1),<br>
>>>> plus values from neighboring nodes (2) [due to non-orthogonal mesh<br>
>>>> cell shape]. The A1 part include coefficients from (1). A2 includes<br>
>>>> those in (2).<br>
>>>><br>
>>>> 1. Call KSPSetOperators(ksp,A,A1,flag)<br>
>>>><br>
>>>> You can make A in the above a MATSHELL that applies A1 + A2 matrix-free (or just the A2 part).<br>
>>>><br>
>>>> 2. Use any Krylov method. The specific method -ksp_type richardson will do the defect-correction version of what you have written, but a real Krylov method will almost certainly perform much better. Note that A1^{-1} will be applied using whatever method you choose (via -pc_type). A V-cycle of algebraic multigrid should work very well.<br>
>>><br>
>>> To mimic the exact old algorithm for comparison purposes<br>
>>> I don't think you can get this directly with KSP you'll need to manage the "outer" iteration yourself, something like<br>
>>><br>
>>> for (n=0; n<Nmax ….<br>
>>> MatMultAdd(A2,x,b,c) where A2 is the opposite sign of your A2 above<br>
>>> KSPSolve(ksp,c,x);<br>
>>> }<br>
>>> Your KSP solve could use any solver you like (what does the old code use?, you should use the same thing for comparison purposes)<br>
>>><br>
>>> Of course, this is only for comparison purposes, no one in 2012 except in a legacy code would use such a primitive nested solver.<br>
>>><br>
>>> Barry<br>
>>><br>
>><br>
</div></div></blockquote></div><br>