<div class="gmail_quote">On Fri, Aug 17, 2012 at 8:54 AM, Alexander Grayver <span dir="ltr"><<a href="mailto:agrayver@gfz-potsdam.de" target="_blank">agrayver@gfz-potsdam.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">I was planning to do it inside ShellPCApply. <br>
The correction itself is calculated as a solution of Poisson
equation with rhs being divergence of current density and current
density is calculated based on <b>x</b>_i<br></div></blockquote><div><br></div><div>Fine, sounds like you are doing divergence cleaning for an incompatible spatial discretization. Since the change lies within the null space of the intended continuous operator, you should be okay. But note that this procedure is fragile and will have different effect with different Krylov methods and preconditioning sides.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
This trick is often applied to suppress spurious solution arising
during solution of Maxwell equations and it works very well. <br><div class="im">
<br>
<blockquote type="cite">
<div class="gmail_quote">
<div>For a general KSP, this is not allowed because the
preconditioner must be constant. (You can do it anyway by
checking the iteration number in your PCShell, but it won't
converge.) You can play these games with a flexible method
like FGMRES, for which you can also do an inner-outer, e.g.</div>
<div><br>
</div>
<div>-ksp_type fgmres -pc_type composite -pc_composite_type
multiplicative -pc_composite_pcs ksp,shell -sub_0_ksp_ksp_type
tfqmr -sub_0_ksp_ksp_max_it 10 -sub_0_ksp_pc_type ilu</div>
</div>
</blockquote>
<br></div>
Looks a bit tricky. The number of fgmres iterations then defines
number of the cycles correction will be applied, doesn't it?</div></blockquote><div><br></div><div>Yes.</div><div> </div></div><br>