<div dir="ltr"><div><div>Hello,<br></div>          Found the bug in my code. I forgot the call MatZeroEntries on the Jacobin.  I think the linear problem would make only one call to compute jacobain and i was getting correct answer. But the test was making three consecutive calls where it obviously was failing.<br>
<br></div>Thanks<br>Reddy<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 5:36 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Dharmendar Reddy <<a href="mailto:dharmareddy84@gmail.com">dharmareddy84@gmail.com</a>> writes:<br>

<br>
> Hello,<br>
>          I am solving a one dimensional (linear) Poisson equation. I have<br>
> setup a snes problem using DM object. I am using Dirichlet boundary<br>
> conditons at both ends of the one dimensional domain. For the test case i<br>
> use the same value for potential at both ends.<br>
><br>
> I am using DMplex object for the mesh and dof lay out.<br>
><br>
> If i run the solver, i get a constant potential profile as expected.<br>
> However, If i run the solver with snes_type test<br>
> It is giving an error. what could i have done wrong ?<br>
> Testing hand-coded Jacobian, if the ratio is<br>
> O(1.e-8), the hand-coded Jacobian is probably correct.<br>
> Run with -snes_test_display to show difference<br>
> of hand-coded and finite difference Jacobian.<br>
> Norm of matrix ratio 1.0913e-10 difference 5.85042e-10 (user-defined state)<br>
> Norm of matrix ratio 0.5 difference 5.36098 (constant state -1.0)<br>
> Norm of matrix ratio 0.666667 difference 10.722 (constant state 1.0)<br>
> [0]PETSC ERROR: --------------------- Error Message<br>
> -----------------------------------<br>
> -<br>
> [0]PETSC ERROR: Object is in wrong state!<br>
> [0]PETSC ERROR: SNESTest aborts after Jacobian test!<br>
<br>
</div>This is what '-snes_type test' is supposed to do.  So you're fine and<br>
your Jacobian is fine at the initial state, but not at the constant<br>
value 1.0 or -1.0.  (That's okay if those are non-physical states,<br>
otherwise your Jacobian evaluation is incorrect.)<br>
<div class="HOEnZb"><div class="h5"><br>
> [0]PETSC ERROR:<br>
> -----------------------------------------------------------------------<br>
> -<br>
> [0]PETSC ERROR: Petsc Development GIT revision:<br>
> e0030536e6573667cee5340eb367e8213e67d68<br>
> 9  GIT Date: 2013-04-16 21:48:15 -0500<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>
> -----------------------------------------------------------------------<br>
> -<br>
> [0]PETSC ERROR: ./PoisTest on a mpi_rScalar_Debug named<br>
> <a href="http://login2.stampede.tacc.utexas.edu" target="_blank">login2.stampede.tacc.utexas.edu</a><br>
>  by Reddy135 Wed Apr 17 17:22:02 2013<br>
> [0]PETSC ERROR: Libraries linked from<br>
> /home1/00924/Reddy135/LocalApps/petsc/mpi_rScalar<br>
> _Debug/lib<br>
> [0]PETSC ERROR: Configure run at Tue Apr 16 22:30:58 2013<br>
> [0]PETSC ERROR: Configure options   --download-blacs=1 --download-ctetgen=1<br>
> --download-<br>
> metis=1 --download-mumps=1 --download-parmetis=1 --download-scalapack=1<br>
> --download-supe<br>
> rlu_dist=1 --download-triangle=1 --download-umfpack=1<br>
> --with-blas-lapack-dir=/opt/apps/<br>
> intel/13/composer_xe_2013.2.146/mkl/lib/intel64/ --with-debugging=1<br>
> --with-mpi-dir=/opt<br>
> /apps/intel13/mvapich2/1.9/ --with-petsc-arch=mpi_rScalar_Debug<br>
> --with-petsc-dir=/home1<br>
> /00924/Reddy135/LocalApps/petsc PETSC_ARCH=mpi_rScalar_Debug<br>
> [0]PETSC ERROR:<br>
> -----------------------------------------------------------------------<br>
> -<br>
> [0]PETSC ERROR: SNESSolve_Test() line 127 in<br>
> /home1/00924/Reddy135/LocalApps/petsc/src/<br>
> snes/impls/test/snestest.c<br>
> [0]PETSC ERROR: SNESSolve() line 3755 in<br>
> /home1/00924/Reddy135/LocalApps/petsc/src/snes<br>
> /interface/snes.c<br>
>  SNESDivergedReason            0<br>
>  Exiting solve<br>
> --<br>
> -----------------------------------------------------<br>
> Dharmendar Reddy Palle<br>
> Graduate Student<br>
> Microelectronics Research center,<br>
> University of Texas at Austin,<br>
> 10100 Burnet Road, Bldg. 160<br>
> MER 2.608F, TX 78758-4445<br>
> e-mail: <a href="mailto:dharmareddy84@gmail.com">dharmareddy84@gmail.com</a><br>
> Phone: <a href="tel:%2B1-512-350-9082" value="+15123509082">+1-512-350-9082</a><br>
> United States of America.<br>
> Homepage: <a href="https://webspace.utexas.edu/~dpr342" target="_blank">https://webspace.utexas.edu/~dpr342</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-----------------------------------------------------<br>Dharmendar Reddy Palle<br>Graduate Student<br>Microelectronics Research center,<br>University of Texas at Austin,<br>
10100 Burnet Road, Bldg. 160<br>MER 2.608F, TX 78758-4445<br>e-mail: <a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a><br>Phone: +1-512-350-9082<br>United States of America.<br>Homepage: <a href="https://webspace.utexas.edu/~dpr342" target="_blank">https://webspace.utexas.edu/~dpr342</a><br>

</div>