# [petsc-users] snes test fails

Dharmendar Reddy dharmareddy84 at gmail.com
Wed Apr 17 18:25:48 CDT 2013

```Sorry, I do not know how the reply went to your id. I replied the usual way.

I am solving :  div(grad(V)) = 0  for x  in [0, L]  and V(0) = V1 and V(L)
= V1

I get a solution V(x) = V1 after solving with intial guess V(X) = 0 for x
in (0, L)

Now, what is the user defined ? is it V(X) = 0 ? or V(x) =  V1 ?

Is the user defined state is V(X) = V1 then it means the Jacobin is tested
after doing a solve first ?

But then, for a linear Poisson problem, The Jacobin should be independent
of V(X). I seem to get correct solution but snes_type test (fails ?) can
you give me some pointers on how to debug this ?

Thanks

On Wed, Apr 17, 2013 at 5:55 PM, Dharmendar Reddy
<dharmareddy84 at gmail.com>wrote:

> I am confused.
>
> I am solving :  div(grad(V)) = 0  for x  in [0, L]  and V(0) = V1 and V(L)
> = V1
>
> I get a solution V(x) = V1 after solving with intial guess V(X) = 0 for x
> in (0, L)
>
> Now, what is the user defined ? is it V(X) = 0 ? or V(x) =  V1 ?
>
> Is the user defined state is V(X) = V1 then it means the Jacobin is tested
> after doing a solve first ?
>
> But then, for a linear Poisson problem, The Jacobin should be independent
> of V(X). I seem to get correct solution but snes_type test (fails ?) can
> you give me some pointers on how to debug this ?
>
> Thanks
> Reddy
>
>
>
>
> On Wed, Apr 17, 2013 at 5:36 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> Dharmendar Reddy <dharmareddy84 at gmail.com> writes:
>>
>> > Hello,
>> >          I am solving a one dimensional (linear) Poisson equation. I
>> have
>> > setup a snes problem using DM object. I am using Dirichlet boundary
>> > conditons at both ends of the one dimensional domain. For the test case
>> i
>> > use the same value for potential at both ends.
>> >
>> > I am using DMplex object for the mesh and dof lay out.
>> >
>> > If i run the solver, i get a constant potential profile as expected.
>> > However, If i run the solver with snes_type test
>> > It is giving an error. what could i have done wrong ?
>> > Testing hand-coded Jacobian, if the ratio is
>> > O(1.e-8), the hand-coded Jacobian is probably correct.
>> > Run with -snes_test_display to show difference
>> > of hand-coded and finite difference Jacobian.
>> > Norm of matrix ratio 1.0913e-10 difference 5.85042e-10 (user-defined
>> state)
>> > Norm of matrix ratio 0.5 difference 5.36098 (constant state -1.0)
>> > Norm of matrix ratio 0.666667 difference 10.722 (constant state 1.0)
>> > [0]PETSC ERROR: --------------------- Error Message
>> > -----------------------------------
>> > -
>> > [0]PETSC ERROR: Object is in wrong state!
>> > [0]PETSC ERROR: SNESTest aborts after Jacobian test!
>>
>> This is what '-snes_type test' is supposed to do.  So you're fine and
>> your Jacobian is fine at the initial state, but not at the constant
>> value 1.0 or -1.0.  (That's okay if those are non-physical states,
>> otherwise your Jacobian evaluation is incorrect.)
>>
>> > [0]PETSC ERROR:
>> > -----------------------------------------------------------------------
>> > -
>> > [0]PETSC ERROR: Petsc Development GIT revision:
>> > e0030536e6573667cee5340eb367e8213e67d68
>> > 9  GIT Date: 2013-04-16 21:48:15 -0500
>> > [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: ./PoisTest on a mpi_rScalar_Debug named
>> >  by Reddy135 Wed Apr 17 17:22:02 2013
>> > [0]PETSC ERROR: Libraries linked from
>> > /home1/00924/Reddy135/LocalApps/petsc/mpi_rScalar
>> > _Debug/lib
>> > [0]PETSC ERROR: Configure run at Tue Apr 16 22:30:58 2013
>> > --with-blas-lapack-dir=/opt/apps/
>> > intel/13/composer_xe_2013.2.146/mkl/lib/intel64/ --with-debugging=1
>> > --with-mpi-dir=/opt
>> > /apps/intel13/mvapich2/1.9/ --with-petsc-arch=mpi_rScalar_Debug
>> > --with-petsc-dir=/home1
>> > /00924/Reddy135/LocalApps/petsc PETSC_ARCH=mpi_rScalar_Debug
>> > [0]PETSC ERROR:
>> > -----------------------------------------------------------------------
>> > -
>> > [0]PETSC ERROR: SNESSolve_Test() line 127 in
>> > /home1/00924/Reddy135/LocalApps/petsc/src/
>> > snes/impls/test/snestest.c
>> > [0]PETSC ERROR: SNESSolve() line 3755 in
>> > /home1/00924/Reddy135/LocalApps/petsc/src/snes
>> > /interface/snes.c
>> >  SNESDivergedReason            0
>> >  Exiting solve
>> > --
>> > -----------------------------------------------------
>> > Dharmendar Reddy Palle
>> > Microelectronics Research center,
>> > University of Texas at Austin,
>> > 10100 Burnet Road, Bldg. 160
>> > MER 2.608F, TX 78758-4445
>> > e-mail: dharmareddy84 at gmail.com
>> > Phone: +1-512-350-9082
>> > United States of America.
>> > Homepage: https://webspace.utexas.edu/~dpr342
>>
>
>
>
> --
> -----------------------------------------------------
> Dharmendar Reddy Palle
> Microelectronics Research center,
> University of Texas at Austin,
> 10100 Burnet Road, Bldg. 160
> MER 2.608F, TX 78758-4445
> e-mail: dharmareddy84 at gmail.com
> Phone: +1-512-350-9082
> United States of America.
> Homepage: https://webspace.utexas.edu/~dpr342
>

--
-----------------------------------------------------
Dharmendar Reddy Palle
Microelectronics Research center,
University of Texas at Austin,