<div dir="ltr"><div>Hi Matt, I was able to find the problem after reading your note. I was calling VecDestroy() at the end of my SNESSetUpdate() function in an attempt to just destroy the local Vec variable, but apparently it does more than that. Removing the call to VecDestroy() removed the error code. Here's a code snippet of the relevant portions of the function for reference.</div><div><br></div><div>PetscErrorCode FormBounds(SNES snes,PetscInt step)</div><div>{<br></div><div style="margin-left:40px">Vec                                       x;</div><div style="margin-left:40px">PetscScalar                 *xx;</div><div style="margin-left:40px">ierr = SNESGetSolution(snes,&x);CHKERRQ(ierr);</div><div style="margin-left:40px">ierr = VecGetArray(x,&xx);CHKERRQ(ierr);</div><div style="margin-left:40px"><br></div><div style="margin-left:40px">..... do stuff that updates the VI bounds .....</div><div style="margin-left:40px"><br></div><div style="margin-left:40px">ierr = VecRestoreArray(x,&xx);</div><div style="margin-left:40px">ierr = VecDestroy(&x);CHKERRQ(ierr);</div>}<br><div><div><br></div><div>Best,</div><div>Alexander<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 11, 2020 at 5:47 PM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p style="text-align:center"><font color="red"><strong>External Email</strong><br></font></p><div dir="ltr"><div dir="ltr">On Fri, Sep 11, 2020 at 8:09 PM Alexander B Prescott <<a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Barry, thanks for the help, I've done as you suggested. Now, I get an error that I'm unfamiliar with that goes away if I comment out SNESSetUpdate(). This error pops up after several successful iterations, so I'm not sure what's goin on here. The full message is copied below.</div></div></blockquote><div><br></div><div>It thinks snes>vec_sol has been freed. It seems like something illegal was done in Update(). Can you run under valgrind?</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>mpirun -n 1 a -snes_type vinewtonrsls -snes_monitor -snes_mf -snes_converged_reason</div><div><br></div><div>  0 SNES Function norm 1.319957381248e+02 <br>  1 SNES Function norm 3.164228677282e+01 <br>  2 SNES Function norm 5.157408019535e+00 <br>  3 SNES Function norm 2.290604723696e-01 <br>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>[0]PETSC ERROR: Corrupt argument: <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[0]PETSC ERROR: Object already free: Parameter # 2<br>[0]PETSC ERROR: See <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[0]PETSC ERROR: Petsc Release Version 3.13.2, unknown <br>[0]PETSC ERROR: a on a arch-linux2-c-debug named alexprescott-ThinkPad-T420s by alexprescott Fri Sep 11 16:49:38 2020<br>[0]PETSC ERROR: Configure options <br>[0]PETSC ERROR: #1 SNESComputeJacobian() line 2676 in /home/alexprescott/Documents/petsc/src/snes/interface/snes.c<br>[0]PETSC ERROR: #2 SNESSolve_VINEWTONRSLS() line 386 in /home/alexprescott/Documents/petsc/src/snes/impls/vi/rs/virs.c<br>[0]PETSC ERROR: #3 SNESSolve() line 4519 in /home/alexprescott/Documents/petsc/src/snes/interface/snes.c<br>[0]PETSC ERROR: #4 PetscWrapperFcn() line 222 in petscshell_leq9nodes.c<br>[0]PETSC ERROR: #5 main() line 285 in petscshell_leq9nodes.c<br>[0]PETSC ERROR: PETSc Option Table entries:<br>[0]PETSC ERROR: -snes_converged_reason<br>[0]PETSC ERROR: -snes_mf<br>[0]PETSC ERROR: -snes_monitor<br>[0]PETSC ERROR: -snes_type vinewtonrsls<br>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div><div><br></div><div>Best,</div><div>Alexander<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 10, 2020 at 4:27 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p style="text-align:center"><font color="red"><strong>External Email</strong><br></font></p><div><br></div>  Yes, it should be simple to write the code to do this.<div><br></div><div>  Provide a function that calls SNESVISetVariableBounds() using your criteria then call SNESSetUpdate() to have that function called on each iteration of SNES to reset the bounds.</div><div><br></div><div>  If this will converge to what you desire I have no clue. But each step will find a result that satisfies the current bounds you set.</div><div><br></div><div>  Barry</div><div><br></div><div>  <br><div><br><div><br><blockquote type="cite"><div>On Sep 10, 2020, at 5:15 PM, Alexander B Prescott <<a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a>> wrote:</div><br><div><div dir="ltr"><div>Hi there,</div><div><br></div><div>I have a quick question (hopefully)  that I didn't find addressed in the documentation or user list archives. Is it possible to change the SNES Variational Inequality bounds from one solver iteration to the next?</div><div>My goal is to update the bounds such that a specific entry in the solution vector remains the supremum throughout the entire execution.</div><div><br></div><div>Best,</div><div>Alexander<br></div><div><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:arial,sans-serif">Alexander</span><span style="font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif">Prescott</span><br></div><div style="font-size:12.8px"><span style="font-family:arial,sans-serif"><a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px"><div style="font-family:arial,sans-serif"><span>PhD</span> <span>Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif">Department of Geosciences</div><div style="font-family:arial,sans-serif">1040 E. 4th Street</div><div style="font-family:arial,sans-serif">Tucson, AZ, 85721</div></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:arial,sans-serif">Alexander</span><span style="font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif">Prescott</span><br></div><div style="font-size:12.8px"><span style="font-family:arial,sans-serif"><a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px"><div style="font-family:arial,sans-serif"><span>PhD</span> <span>Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif">Department of Geosciences</div><div style="font-family:arial,sans-serif">1040 E. 4th Street</div><div style="font-family:arial,sans-serif">Tucson, AZ, 85721</div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:arial,sans-serif">Alexander</span><span style="font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif">Prescott</span><br></div><div style="font-size:12.8px"><span style="font-family:arial,sans-serif"><a href="mailto:alexprescott@email.arizona.edu" target="_blank">alexprescott@email.arizona.edu</a></span></div><div style="font-size:12.8px"><div style="font-family:arial,sans-serif"><span>PhD</span> <span>Candidate</span>, The University of Arizona</div><div style="font-family:arial,sans-serif">Department of Geosciences</div><div style="font-family:arial,sans-serif">1040 E. 4th Street</div><div style="font-family:arial,sans-serif">Tucson, AZ, 85721</div></div></div></div></div></div></div></div>