[petsc-users] snesgetfunction calling sequence

Gideon Simpson gideon.simpson at gmail.com
Thu Sep 10 10:40:22 CDT 2015


If I want to get the residual vector from a SNES, what is the correct calling order?

Currently, I have

    VecDuplicate(U,&F);


  SNESSetFunction(snes, F, form_function, ctx);

  SNESSolve(snes, NULL, U);

SNESGetFunction(snes,&F,NULL,NULL);
VecDestroy(&U);
VecDestroy(&F);

But this generates an error, 

[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Wrong type of object: Parameter # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.6.1, unknown 
[0]PETSC ERROR: ./blowup_refine on a arch-darwin-c-debug named gs_air by gideon Thu Sep 10 11:36:10 2015
[0]PETSC ERROR: Configure options --download-mpich=yes --download-suitesparse=yes --download-superlu=yes --download-superlu_dist=yes --download-mumps=yes --download-sprng=yes --with-cxx=clang++ --with-cc=clang --with-fc=gfortran --download-metis=yes --download-parmetis=yes --download-scalapack=yes
[0]PETSC ERROR: #1 VecDestroy() line 424 in /opt/petsc/src/vec/vec/interface/vector.c



-gideon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150910/af1121bc/attachment.html>


More information about the petsc-users mailing list