problem with -snes_mf_operator option

Vijay S. Mahadevan vijay.m at
Wed Mar 26 16:14:05 CDT 2008

Hi all,

I have a nonlinear solver test code that can use a user specified
Jacobian function directly, set using SNESSetJacobian. Now if I use
-snes_mf option, the solution scheme depends only on the residual and
the convergence is equivalent to the case when using the real Jacobian
matrix itself. But if I try the -snes_mf_operator option, with the
Jacobian=NULL to start with and the preconditioner being correctly
allocated the memory needed, I end up with a NULL argument exception.
I also alternately set the preconditioner to Identity matrix in order
to avoid any problems from user code to trickling in, but to no avail.

Here's the call stack.

[0]PETSC ERROR: Null argument, when expecting valid pointer!
[0]PETSC ERROR: Null Object: Parameter # 1!
[0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 7, Fri Oct 26
14:21:35 CDT 2007 HG revision:
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR: bin/test-dbg on a linux-gnu named grove by vijaysm Wed
Mar 26 16:06:45 2008
[0]PETSC ERROR: Libraries linked from
[0]PETSC ERROR: Configure run at Fri Nov  9 15:02:46 2007
[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=ifort
--with-cxx=g++ --download-f-blas-lapack=1 --download-mpich=1
[0]PETSC ERROR: PetscObjectGetComm() line 34 in src/sys/objects/gcomm.c
[0]PETSC ERROR: VecNormBegin() line 495 in src/vec/vec/utils/comb.c
[0]PETSC ERROR: MatMFFDCompute_WP() line 73 in src/mat/impls/mffd/wp.c
[0]PETSC ERROR: MatMult_MFFD() line 294 in src/mat/impls/mffd/mffd.c
[0]PETSC ERROR: MatMult() line 1632 in src/mat/interface/matrix.c
[0]PETSC ERROR: PCApplyBAorAB() line 584 in src/ksp/pc/interface/precon.c
[0]PETSC ERROR: GMREScycle() line 159 in src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: KSPSolve_GMRES() line 241 in src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: KSPSolve() line 379 in src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: SNES_KSPSolve() line 2578 in src/snes/interface/snes.c
[0]PETSC ERROR: SNESSolve_LS() line 184 in src/snes/impls/ls/ls.c
[0]PETSC ERROR: SNESSolve() line 1871 in src/snes/interface/snes.c

>From what I can understand from the PETSc code (snes.c, mffd.c), the
current_u for MFFD context is NULL here. And that is the reason for
the final exception. But I do not understand how this can be since it
works perfectly fine with -snes_mf option with no changes in the code.

Please do let me know if you think I should specifically be looking
for something to tackle this issue. Any help will be appreciated.


More information about the petsc-users mailing list