<div class="gmail_quote">On Tue, Jul 10, 2012 at 3:29 PM, Paul T. Bauman <span dir="ltr"><<a href="mailto:ptbauman@gmail.com" target="_blank">ptbauman@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 class="HOEnZb"><div class="h5">On Tue, Jul 10, 2012 at 1:34 PM, Paul T. Bauman <span dir="ltr"><<a href="mailto:ptbauman@gmail.com" target="_blank">ptbauman@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_quote">
<div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Greetings,<div><br></div><div>This question is somewhat related to this thread: <a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009583.html" target="_blank">http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009583.html</a> but instead of resurrecting that thread, I decided to start a new one.</div>


<div><br></div><div>Summary: In the libMesh wrapper of PETSc's KSP, a call is made to KSPSetOperators; I gather this is in order to allow reusing the same preconditioner, if desired. However, I've noticed that when I use the following options, the sub-preconditioner type gets reset:</div>


<div><br></div><div>-pc_type bjacobi -sub_pc_type ilu -sub_pc_factor_mat_solver_package superlu</div><div><br></div><div>In particular, the first linear solve uses what I asked for, but in all following linear solves, the petsc ilu solver is used instead of superlu. If I remove the KSPSetOperators call, everything is peachy.</div>


<div><br></div><div>My question: Does a call need to be made to PCSetFromOptions (or something similar...) to keep the superlu ilu solver around or would that wipe out the KSPSetOperators effect? Is this a PETSc bug? Other?</div>
</blockquote></div></div></div></blockquote><div><br></div><div>Thanks for your test case. Yes, this is a PETSc bug associated with handling of DIFFERENT_NONZERO_PATTERN. Fixed here and will be in the next patch release.</div>
<div><br></div><div><a href="http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/rev/09d701958d66">http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/rev/09d701958d66</a></div><div><br></div><div>We recommend that you only call KSPSetFromOptions (or PCSetFromOptions) once.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br></div><div>This is with petsc-3.3-p1.</div></blockquote></div></div><div><br>Sorry to reply to myself, but I read this and realized I was rather imprecise.<br>
<br>
The KSPSetOperators call I referred to is in the solve step. In 
particular, KSPSetFromOptions is called during initilization, only once,
 but KSPSetOperators is called each time solve is called. I was able to 
mimic my problem in the attached, slightly modified ksp/ex5.c, running with:<br><br>mpiexec -np 6 ./ex5 -ksp_type gmres -pc_type bjacobi -sub_pc_type ilu -ksp_view -ksp_monitor -sub_pc_factor_mat_solver_package superlu -sub_pc_factor_levels 1<br>

<br>Is the 
correct solution just to call KSPSetFromOptions every time? Will that be noticeable at all? I hope this was less vague than my original 
message. Thanks again.<br><br>Best,<br><br>Paul<br></div></div>
</blockquote></div><br>