On Fri, Jul 15, 2011 at 5:37 PM, Joaquin Mura <joaquin_mura@...> wrote:
> The first iteration runs ok, but the second iteration stops during the call
> to solve(), throwing the message:
> PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> probably memory access out of range
> Debugging with gdb, I only get that the error is produced during the
> of "libMesh::PetscLinearSolver<double>::solve( ..."
We'd need to see the code itself to pinpoint the error, but it sounds
to me like you're writing a custom Newton iteration, similar to what's
done in ex13?
> So, I would really appreciate if someone could explain why, how and when
> we should use the "clear", "reinit" and "close" member functions (and
> eventually others, if necessary) in order to properly rebuild the matrix and
> the rhs.
The general rule of working with PetscVectors is that they need to be
close()'d after any function that calls VecSetValues() internally, so
PetscVector::set() and add() are the main ones. A similar statement
applies to the use of PetscMatrix.
Unless you are doing adaptivity, you should not need to call
EquationSystems::reinit() directly, but an example of that is given in