[petsc-users] SNESSetConvergenceTest

Dharmendar Reddy dharmareddy84 at gmail.com
Mon Jan 20 19:14:17 CST 2014


Hello,
         I am getting a segmentation fault when i use
SNESSetConvergenceTest from Fortran.

I use the following:

call SNESSetConvergenceTest(this%snes, SNESConvergenceTest_snes,
this,PETSC_NULL_FUNCTION, ierr)   (Line 1)

where the soubtoutine is

subroutine SNESConvergenceTest_snes(snes,it,xnorm,gnorm,fnorm,reason,this, ierr)
  implicit none
#include "finclude/petsc.h"
  ! IO Variables
  SNES :: snes
  integer :: it
  PetscReal :: xnorm
  PetscReal :: gnorm
  PetscReal :: fnorm
  SNESConvergedReason :: reason
  type(Solver_t) :: this
  PetscErrorCode :: ierr
  ! Local Variables
  Vec :: X, dX
  Vec :: F, W, G
  real(WP) :: lambda
  print*, 'Calling custom test',it,xnorm,fnorm,gnorm
  !call SNESLineSearchGetLambda(this%linesearch, lambda, ierr)
  !call SNESLineSearchGetVecs(this%linesearch, X, F, dX, W, G, ierr)
  !call this%SNESConvergenceTest(it, fnorm, lambda, X, dX, reason, ierr)
  reason = SNES_DIVERGED_FUNCTION_COUNT
end subroutine SNESConvergenceTest_snes

Code works fine if  the call at Line 1 is commented i.e, if i donot
set the convergencetest

I have attached the stack trace when the code fails (traceFail.log)
and stack trace of the code which runs well (tracePass.log).



Thanks
Reddy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: traceFail.log
Type: application/octet-stream
Size: 2142 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140120/45c8de1c/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tracePass.log
Type: application/octet-stream
Size: 2209 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140120/45c8de1c/attachment-0003.obj>


More information about the petsc-users mailing list