Roy Stogner <roystgnr@ices.utexas.edu> wrote on 06/10/2011 10:11:16 AM:

>
> On Fri, 10 Jun 2011, Derek Gaston wrote:
>
> > On Jun 10, 2011, at 9:35 AM, Roy Stogner wrote:
> >
> >> Could you identify where in your failure case the solution vector is
> >> getting left open?
> >
> > This happens during the call to update() in the Petsc callback to
> > compute the residual (and other callbacks).  It's not from user code
> > at all.  Petsc is actually giving us a vector that isn't closed.
>
> Ah!  So PetscVector::PetscVector(Vec) has been assuming _is_closed but
> we've been getting Vecs for which that isn't the case?
>
> > If operator= is working for you in localize() without a close() then
> > we should maybe think about moving this close to the PetsC
> > interface.
>
> I think the safe thing to do is move the close() to
> PetscVector::PetscVector(Vec).  Really we should have done that
> already: even if it was a true assumption that the SNES is handing us
> (and in all future versions will hand us) closed vectors, we could
> never be sure that user code would always do the same.
>
> David, would you try adding this->close() before line 695 of
> petsc_vector.h and see if that solves the problem for you?


That fixed the issue with non-closed PetscVectors in our nonlinear system.  However we have some other systems hanging around where we change the solution vector, but we can call close() ourselves there and fix it (in this case it really is our responsibility).

In addition, I spotted one more place that is still failing and it is ExodusII_IO::copy_nodal_solution, where the solution is modified and then update() is called, so there is another missing call to close()? And possibly in other IO::copy_nodal_solution()?

--
David