<div dir="ltr">Barry,<div><br></div><div>So I do not believe there is any problem with the ISEqual() per se, because what I am doing is I am solving 5151 different VI problem using the same SNES/KSP/PC/Mat. That is, I am not "resetting" these data structures once I am done with one problem and move on to the next. If I ran each case individually, I get no error; the error comes when I run these problems sequentially without resetting the SNES after each problem.</div><div><br></div><div>I haven't run the C debugger or done any of that yet, but could this be a plausible explanation for my error? Originally I was thinking about creating/destroying SNES for each problem but I was wondering if that might affect performance.</div><div><br></div><div>Thanks,</div><div>Justin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 1, 2015 at 5:58 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Dec 1, 2015, at 5:13 PM, Justin Chang <<a href="mailto:jychang48@gmail.com">jychang48@gmail.com</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> So I am running into some issues with the SNESVINEWTONRSLS solver. I originally had this done in firedrake, but have ported it to petsc4py. Attached is the code as well as the two required input files.<br>
><br>
> First issue, when I run the program like this:<br>
><br>
> python testVI.py psiA_1 psiB_1 2 1<br>
><br>
> I get this error:<br>
><br>
> Traceback (most recent call last):<br>
>   File "testVI.py", line 103, in <module><br>
>     snes.solve(None,X)<br>
>   File "PETSc/SNES.pyx", line 520, in petsc4py.PETSc.SNES.solve (src/petsc4py.PETSc.c:169677)<br>
> petsc4py.PETSc.Error: error code 60<br>
> [0] SNESSolve() line 3992 in /Users/justin/Software/petsc/src/snes/interface/snes.c<br>
> [0] SNESSolve_VINEWTONRSLS() line 507 in /Users/justin/Software/petsc/src/snes/impls/vi/rs/virs.c<br>
> [0] KSPSetOperators() line 544 in /Users/justin/Software/petsc/src/ksp/ksp/interface/itcreate.c<br>
> [0] PCSetOperators() line 1170 in /Users/justin/Software/petsc/src/ksp/pc/interface/precon.c<br>
> [0] Nonconforming object sizes<br>
> [0] Cannot change local size of Amat after use old sizes 2 2 new sizes 3 3<br>
><br>
> No such error occurred when this was ran in firedrake, though I did notice that -snes_view did indicate that some of the iterations had 2x2 instead of 3x3 matrices. Why is this happening? I thought I should be solving a 3x3 system each time so why would a 2x2 ever arise?<br>
<br>
</span>  Justin,<br>
<br>
   For VI's the rs (reduced space solver) solves the linearized problem on a subset of the variables, thus the size of the linear system may change from iteration of Newton to the next iteration of Newton.<br>
<br>
   In the rs solver we have<br>
<br>
    ierr = ISEqual(vi->IS_inact_prev,vi->IS_inact,&isequal);CHKERRQ(ierr);<br>
    if (!isequal) {<br>
      ierr = SNESVIResetPCandKSP(snes,jac_inact_inact,prejac_inact_inact);CHKERRQ(ierr);<br>
    }<br>
<br>
so what __should__ happen is that if the size of the reduced space changes KSPReset() is called on the KSP allowing the KSP/PC to handle a different sized system then before. But why doesn't it work? Why isn't KSPReset() called? Somehow the ISEqual is not working.<br>
<br>
   Can you run the C debugger and put a breakpoint in the ISEqual() then check the inputs and see if it is correctly setting the isequal to false when it should?  Each time the vi->IS_inact changes the KSPReset() should get called. You can check this in the debugger.<br>
<br>
   Barry<br>
<span class=""><br>
><br>
> More issues to come :)<br>
><br>
> Thanks,<br>
> Justin<br>
</span>> <testVI.py><psiA_1><psiB_1><br>
<br>
</blockquote></div><br></div>