<div dir="ltr"><div><div><div><div><div>Dear PETSc team,<br><br></div>I have interfaced our fortran legacy code with PETSC SNES. I mainly followed the examples you provide. What I conceptually used is : <br><br>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br><br>    call SNESCreate(PETSC_COMM_WORLD,<wbr>snes,ierr)<br><br>    call SNESSetFromOptions(snes,ierr)<br><br>    call SNESSETFunction(snes, pf, nonlinFormFunction, PETSC_NULL_OBJECT, ierr)<br><br>    call SNESSetJacobian(snes, mat, mat, nonlinFormJacobian, PETSC_NULL_OBJECT, ierr)<br><br>    call SNESSetKSP(snes, myksp, ierr)<br>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br><br></div>The code runs fine with -snes_type newtonls or newtontr. But when using -snes_type fas, it complains with the message : <br><br>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>[0]PETSC ERROR: Corrupt argument: <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[0]PETSC ERROR: Fortran callback not set on this object<br>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[0]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016 <br>[0]PETSC ERROR:                                                                                                                                                                                                                                                                  on a arch-linux2-c-debug named dsp0780450 by niko Thu Jun  1 16:18:43 2017<br>[0]PETSC ERROR: Configure options --prefix=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/Install --with-mpi=yes --with-x=yes --download-ml=/home/niko/dev/codeaster-prerequisites/petsc-3.7.2/ml-6.2-p3.tar.gz --with-mumps-lib="-L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Mumps-502_consortium_aster1/MPI/lib -lzmumps -ldmumps -lmumps_common -lpord -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Scotch_aster-604_aster6/MPI/lib -lesmumps -lptscotch -lptscotcherr -lptscotcherrexit -lscotch -lscotcherr -lscotcherrexit -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Parmetis_aster-403_aster/lib -lparmetis -L/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Metis_aster-510_aster1/lib -lmetis -L/usr/lib -lscalapack-openmpi -L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi -L/usr/lib/x86_64-linux-gnu -lgomp " --with-mumps-include=/home/niko/dev/codeaster-prerequisites/v13/prerequisites/Mumps-502_consortium_aster1/MPI/include --with-scalapack-lib="-L/usr/lib -lscalapack-openmpi" --with-blacs-lib="-L/usr/lib -lblacs-openmpi -lblacsCinit-openmpi -lblacsF77init-openmpi" --with-blas-lib="-L/usr/lib -lopenblas -lcblas" --with-lapack-lib="-L/usr/lib -llapack"<br>[0]PETSC ERROR: #1 PetscObjectGetFortranCallback() line 263 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/sys/objects/inherit.c<br>[0]PETSC ERROR: #2 oursnesjacobian() line 105 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/ftn-custom/zsnesf.c<br>[0]PETSC ERROR: #3 SNESComputeJacobian() line 2312 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c<br>[0]PETSC ERROR: #4 SNESSolve_NEWTONLS() line 228 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/ls/ls.c<br>[0]PETSC ERROR: #5 SNESSolve() line 4008 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c<br>[0]PETSC ERROR: #6 SNESFASDownSmooth_Private() line 512 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c<br>[0]PETSC ERROR: #7 SNESFASCycle_Multiplicative() line 816 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c<br>[0]PETSC ERROR: #8 SNESSolve_FAS() line 987 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/impls/fas/fas.c<br>[0]PETSC ERROR: #9 SNESSolve() line 4008 in /home/niko/dev/codeaster-prerequisites/petsc-3.7.2/src/snes/interface/snes.c<br>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br><br></div>When exploring a little bit with a debugger, it seems that the object snes->vec_rhs which is used is fas.c is a null pointer. <br><br>What is this object vec_rhs and how to set it?<br><br></div>Thank you in advance,<br></div>Nicolas<br><div><div><br></div></div></div>