<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Dear all,
I'm using a matrix free formulation of the Newton-Krylov method.
My code is running when I use a constant matrix as a preconditioner.
However, when I want to use another matrix (problem specific) I read to the
manual that I have to use the -snes_mf_operator option, with
appropriately setting
snessetjacobian function. I do that in my code as follows:
ierr = MatCreateSNESMF(sys.snes, &sys.J);
CHKERRQ(ierr);
ierr = SNESSetJacobian(sys.snes, sys.J, sys.P, jacobian_matrix, &sys);
CHKERRQ(ierr);
I have preallocated space for matrix sys.P, but when I start running I
get the following error:
[1]PETSC ERROR: --------------------- Error Message
------------------------------------
[1]PETSC ERROR: Null argument, when expecting valid pointer!
[1]PETSC ERROR: Null Object: Parameter # 1!
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
- Ignored:
14:26:37 CST 2010
[1]PETSC ERROR: See docs/changes/index.html for recent updates.
[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[1]PETSC ERROR: See docs/index.html for manual pages.
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: ./hoac_forth on a linux-gnu named localhost by
kontzialis Wed Mar 23 04:42:52 2011
[1]PETSC ERROR: Libraries linked from
/home/kontzialis/PETSC/petsc-3.1-p7/linux-gnu-c-debug/lib
[1]PETSC ERROR: Configure run at Mon Feb 21 14:55:24 2011
[1]PETSC ERROR: Configure options --with-debugging=1 --with-cc=mpicc
--with-fc=mpif90 --with-shared=1 --with-shared-libraries --wi[0]PETSC
ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Null argument, when expecting valid pointer!
[0]PETSC ERROR: Null Object: Parameter # 1!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
14:26:37 CST 2010
[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:
------------------------------------------------------------------------
[0]PETSC ERROR: ./hoac_forth on a linux-gnu named localhost by
kontzialis Wed Mar 23 04:42:52 2011
[0]PETSC ERROR: Libraries linked from
/home/kontzialis/PETSC/petsc-3.1-p7/linux-gnu-c-debug/lib
[0]PETSC ERROR: Configure run at Mon Feb 21 14:55:24 2011
[0]PETSC ERROR: Configure options --with-debugging=1 --with-cc=mpicc
--with-fc=mpif90 --with-shared=1 --with-shared-libraries
--with-large-file-io=1 --with-precision=double --with-blacs=1
--download-blacs=yes --download-f-blas-lapack=yes --with-plapack=1
--download-plapack=yes --with-scalapack=1 --download-scalapack=yes
--with-superlu=1 --download-superlu=yes --with-superlu_dist=1
--download-superlu_dist=yes --with-ml=1 --download-ml=yes
--with-umfpack=1 --download-umfpack=yes --with-mpi=1 --download-mpich=1
--with-sundials=1 --download-sundials=1 --with-parmetis=1
--download-parmetis=1 --with-hypre=1 --download-hypre=1
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: PetscObjectGetComm() line 34 in src/sys/objects/gcomm.c
[1]PETSC ERROR: VecNormBegin() line 495 in src/vec/vec/utils/comb.c
[1]PETSC ERROR: MatMFFDCompute_WP() line 73 in src/mat/impls/mffd/wp.c
[1]PETSC ERROR: MatMult_MFFD() line 315 in src/mat/impls/mffd/mffd.c
[1]PETSC ERROR: MatMult() line 1899 in src/mat/interface/matrix.c
[1]PETSC ERROR: PCApplyBAorAB() line 585 in src/ksp/pc/interface/precon.c
[1]PETSC ERROR: Gth-large-file-io=1 --with-precision=double
--with-blacs=1 --download-blacs=yes --download-f-blas-lapack=yes
--with-plapack=1 --download-plapack=yes --with-scalapack=1
--download-scalapack=yes --with-superlu=1 --download-superlu=yes
--with-superlu_dist=1 --download-superlu_dist=yes --with-ml=1
--download-ml=yes --with-umfpack=1 --download-umfpack=yes --with-mpi=1
--download-mpich=1 --with-sundials=1 --download-sundials=1
--with-parmetis=1 --download-parmetis=1 --with-hypre=1 --download-hypre=1
[0]PETSC ERROR:
------------------------------------------------------------------------
[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 315 in src/mat/impls/mffd/mffd.c
[0]PETSC ERROR: MatMult() line 1899 in src/mat/interface/matrix.c
[0]PETSC ERROR: PCApplyBAorAB() line 585 in src/ksp/pc/interface/precon.c
[0]PETSC ERROR: GMREScycle() line 161 in src/ksp/ksp/impls/gmres/gmres.c
[1]PETSC ERROR: KSPSolve_GMRES() line 241 in src/ksp/ksp/impls/gmres/gmres.c
[1]PETSC ERROR: KSPSolve() line 396 in src/ksp/ksp/interface/itfunc.c
[1]PETSC ERROR: SNES_KSPSolve() line 2944 in src/snes/interface/snes.c
[1]PETSC ERROR: SNESSolve_LS() line 191 in src/snes/impls/ls/ls.c
[1]PETSC ERROR: SNESSolve() line 2255 in src/snes/interface/snes.c
[1]PETSC ERROR: User provided function() line 33 in
"unknowndirectory/"../crank_nickolson.c
[1]PETSC ERROR: User provided function() line 84 in
"unknowndirectory/"../implicit_time.c
[1]PETSC ERROR: User provided function() line 1158 in
"unknowndirectory/"../hoac.c
MREScycle() line 161 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 396 in src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: SNES_KSPSolve() line 2944 in src/snes/interface/snes.c
[0]PETSC ERROR: SNESSolve_LS() line 191 in src/snes/impls/ls/ls.c
[0]PETSC ERROR: SNESSolve() line 2255 in src/snes/interface/snes.c
[0]PETSC ERROR: User provided function() line 33 in
"unknowndirectory/"../crank_nickolson.c
[0]PETSC ERROR: User provided function() line 84 in
"unknowndirectory/"../implicit_time.c
[0]PETSC ERROR: User provided function() line 1158 in
"unknowndirectory/"../hoac.c
Please help.
Costas
- Done.
</pre>
<br>
<fieldset class="mimeAttachmentHeader"><legend
class="mimeAttachmentName">matrix free and preconditioner.eml</legend></fieldset>
<table class="header-part1" border="0" cellpadding="0"
cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<div class="headerdisplayname" style="display: inline;">Subject:
</div>
matrix free and preconditioner</td>
</tr>
<tr>
<td>
<div class="headerdisplayname" style="display: inline;">From:
</div>
Kontsantinos Kontzialis <a class="moz-txt-link-rfc2396E" href="mailto:ckontzialis@lycos.com"><ckontzialis@lycos.com></a></td>
</tr>
<tr>
<td>
<div class="headerdisplayname" style="display: inline;">Date:
</div>
Wed, 23 Mar 2011 04:43:43 +0200</td>
</tr>
</tbody>
</table>
<table class="header-part2" border="0" cellpadding="0"
cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<div class="headerdisplayname" style="display: inline;">To:
</div>
<a class="moz-txt-link-abbreviated" href="mailto:petsc-users-request@mcs.anl.gov">petsc-users-request@mcs.anl.gov</a></td>
</tr>
</tbody>
</table>
<br>
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 12px;" lang="x-western">Dear Petsc team,
<br>
<br>
I'm using a matrix free formulation of the Newton-Krylov method.
<br>
My code is running when I use a constant matrix as a
preconditioner.
<br>
However, when I want to use another matrix (problem specific) I
read to the
<br>
manual that I have to use the -snes_mf_operator option, with
appropriately setting
<br>
snessetjacobian function. I do that in my code as follows:
<br>
<br>
ierr = MatCreateSNESMF(sys.snes, &sys.J);
<br>
CHKERRQ(ierr);
<br>
<br>
ierr = SNESSetJacobian(sys.snes, sys.J, sys.P, jacobian_matrix,
&sys);
<br>
CHKERRQ(ierr);
<br>
<br>
I have preallocated space for matrix sys.P, but when I start
running I get the following error:
<br>
<br>
[1]PETSC ERROR: --------------------- Error Message
------------------------------------
<br>
[1]PETSC ERROR: Null argument, when expecting valid pointer!
<br>
[1]PETSC ERROR: Null Object: Parameter # 1!
<br>
[1]PETSC ERROR:
------------------------------------------------------------------------
<br>
[1]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
14:26:37 CST 2010
<br>
[1]PETSC ERROR: See docs/changes/index.html for recent updates.
<br>
[1]PETSC ERROR: See docs/faq.html for hints about trouble
shooting.
<br>
[1]PETSC ERROR: See docs/index.html for manual pages.
<br>
[1]PETSC ERROR:
------------------------------------------------------------------------
<br>
[1]PETSC ERROR: ./hoac_forth on a linux-gnu named localhost by
kontzialis Wed Mar 23 04:42:52 2011
<br>
[1]PETSC ERROR: Libraries linked from
/home/kontzialis/PETSC/petsc-3.1-p7/linux-gnu-c-debug/lib
<br>
[1]PETSC ERROR: Configure run at Mon Feb 21 14:55:24 2011
<br>
[1]PETSC ERROR: Configure options --with-debugging=1
--with-cc=mpicc --with-fc=mpif90 --with-shared=1
--with-shared-libraries --wi[0]PETSC ERROR: ---------------------
Error Message ------------------------------------
<br>
[0]PETSC ERROR: Null argument, when expecting valid pointer!
<br>
[0]PETSC ERROR: Null Object: Parameter # 1!
<br>
[0]PETSC ERROR:
------------------------------------------------------------------------
<br>
[0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
14:26:37 CST 2010
<br>
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
<br>
[0]PETSC ERROR: See docs/faq.html for hints about trouble
shooting.
<br>
[0]PETSC ERROR: See docs/index.html for manual pages.
<br>
[0]PETSC ERROR:
------------------------------------------------------------------------
<br>
[0]PETSC ERROR: ./hoac_forth on a linux-gnu named localhost by
kontzialis Wed Mar 23 04:42:52 2011
<br>
[0]PETSC ERROR: Libraries linked from
/home/kontzialis/PETSC/petsc-3.1-p7/linux-gnu-c-debug/lib
<br>
[0]PETSC ERROR: Configure run at Mon Feb 21 14:55:24 2011
<br>
[0]PETSC ERROR: Configure options --with-debugging=1
--with-cc=mpicc --with-fc=mpif90 --with-shared=1
--with-shared-libraries --with-large-file-io=1
--with-precision=double --with-blacs=1 --download-blacs=yes
--download-f-blas-lapack=yes --with-plapack=1
--download-plapack=yes --with-scalapack=1 --download-scalapack=yes
--with-superlu=1 --download-superlu=yes --with-superlu_dist=1
--download-superlu_dist=yes --with-ml=1 --download-ml=yes
--with-umfpack=1 --download-umfpack=yes --with-mpi=1
--download-mpich=1 --with-sundials=1 --download-sundials=1
--with-parmetis=1 --download-parmetis=1 --with-hypre=1
--download-hypre=1
<br>
[1]PETSC ERROR:
------------------------------------------------------------------------
<br>
[1]PETSC ERROR: PetscObjectGetComm() line 34 in
src/sys/objects/gcomm.c
<br>
[1]PETSC ERROR: VecNormBegin() line 495 in
src/vec/vec/utils/comb.c
<br>
[1]PETSC ERROR: MatMFFDCompute_WP() line 73 in
src/mat/impls/mffd/wp.c
<br>
[1]PETSC ERROR: MatMult_MFFD() line 315 in
src/mat/impls/mffd/mffd.c
<br>
[1]PETSC ERROR: MatMult() line 1899 in src/mat/interface/matrix.c
<br>
[1]PETSC ERROR: PCApplyBAorAB() line 585 in
src/ksp/pc/interface/precon.c
<br>
[1]PETSC ERROR: Gth-large-file-io=1 --with-precision=double
--with-blacs=1 --download-blacs=yes --download-f-blas-lapack=yes
--with-plapack=1 --download-plapack=yes --with-scalapack=1
--download-scalapack=yes --with-superlu=1 --download-superlu=yes
--with-superlu_dist=1 --download-superlu_dist=yes --with-ml=1
--download-ml=yes --with-umfpack=1 --download-umfpack=yes
--with-mpi=1 --download-mpich=1 --with-sundials=1
--download-sundials=1 --with-parmetis=1 --download-parmetis=1
--with-hypre=1 --download-hypre=1
<br>
[0]PETSC ERROR:
------------------------------------------------------------------------
<br>
[0]PETSC ERROR: PetscObjectGetComm() line 34 in
src/sys/objects/gcomm.c
<br>
[0]PETSC ERROR: VecNormBegin() line 495 in
src/vec/vec/utils/comb.c
<br>
[0]PETSC ERROR: MatMFFDCompute_WP() line 73 in
src/mat/impls/mffd/wp.c
<br>
[0]PETSC ERROR: MatMult_MFFD() line 315 in
src/mat/impls/mffd/mffd.c
<br>
[0]PETSC ERROR: MatMult() line 1899 in src/mat/interface/matrix.c
<br>
[0]PETSC ERROR: PCApplyBAorAB() line 585 in
src/ksp/pc/interface/precon.c
<br>
[0]PETSC ERROR: GMREScycle() line 161 in
src/ksp/ksp/impls/gmres/gmres.c
<br>
[1]PETSC ERROR: KSPSolve_GMRES() line 241 in
src/ksp/ksp/impls/gmres/gmres.c
<br>
[1]PETSC ERROR: KSPSolve() line 396 in
src/ksp/ksp/interface/itfunc.c
<br>
[1]PETSC ERROR: SNES_KSPSolve() line 2944 in
src/snes/interface/snes.c
<br>
[1]PETSC ERROR: SNESSolve_LS() line 191 in src/snes/impls/ls/ls.c
<br>
[1]PETSC ERROR: SNESSolve() line 2255 in src/snes/interface/snes.c
<br>
[1]PETSC ERROR: User provided function() line 33 in
"unknowndirectory/"../crank_nickolson.c
<br>
[1]PETSC ERROR: User provided function() line 84 in
"unknowndirectory/"../implicit_time.c
<br>
[1]PETSC ERROR: User provided function() line 1158 in
"unknowndirectory/"../hoac.c
<br>
MREScycle() line 161 in src/ksp/ksp/impls/gmres/gmres.c
<br>
[0]PETSC ERROR: KSPSolve_GMRES() line 241 in
src/ksp/ksp/impls/gmres/gmres.c
<br>
[0]PETSC ERROR: KSPSolve() line 396 in
src/ksp/ksp/interface/itfunc.c
<br>
[0]PETSC ERROR: SNES_KSPSolve() line 2944 in
src/snes/interface/snes.c
<br>
[0]PETSC ERROR: SNESSolve_LS() line 191 in src/snes/impls/ls/ls.c
<br>
[0]PETSC ERROR: SNESSolve() line 2255 in src/snes/interface/snes.c
<br>
[0]PETSC ERROR: User provided function() line 33 in
"unknowndirectory/"../crank_nickolson.c
<br>
[0]PETSC ERROR: User provided function() line 84 in
"unknowndirectory/"../implicit_time.c
<br>
[0]PETSC ERROR: User provided function() line 1158 in
"unknowndirectory/"../hoac.c
<br>
<br>
Please help.
<br>
<br>
Costas
<br>
</div>
</body>
</html>