<div class="gmail_extra">Here is my procedure:<br><br>Define:<br><br>KSP mon_ksp;<br>PC mon_pre;<br>.<br>.<br>.<br>if( res_n &lt; 1e-1 &amp;&amp; c_test == 0 )<br>{<br>        KSPGetPC  ( mon_ksp,  &amp;mon_pre );
<br>        ierr = PCFactorSetLevels( mon_pre, 4 ); CHKERRQ( ierr );<br>        KSPSetPC  ( mon_ksp,   mon_pre );<br>        SNESSetKSP( snes, mon_ksp );
<br>        ierr = SNESSetUp( snes ); CHKERRQ( ierr );<br>        c_test = 1;
<br>}<br><br>and did get the error: &quot;Object is in wrong state...&quot; <br><br></div>