[petsc-users] snes test fails

Dharmendar Reddy dharmareddy84 at gmail.com
Wed Apr 17 19:03:29 CDT 2013


I am using DMSNESSet<Function,Jacobian>Local . I have attached the solution
of the solve with boundary conditions V(0) = 0 and V(L) = 1.0 using normal
solve and senes_fd

I printed the  <gridPoinid> and V_at grid point id.  The grid points id are
not sorted in increasing x but You can see that the solution is as
expected. I have 431 grid points and delV is expected to be 1/431 ~ = 0.0023
.

I have used the subroutines i pass for set function and set jacobian
earlier and i had no issues. Now, restructured the code to use DMPlex
object. I may have messed up in process but looking at the obtained
solution it doesn't seem to be the case.

In my earlier code i used to mark the boundary nodes with negative indices
and had VEC and MAt objects set to ignore negative indieces during
assembly. I am not sure how this is done for DMPlex<Vec,Mat>SetClosure

I insert the boundary values into the local vector before assembly of the
function and jacobain



On Wed, Apr 17, 2013 at 6:31 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

>
> On Apr 17, 2013 6:25 PM, "Dharmendar Reddy" <dharmareddy84 at gmail.com>
> wrote:
> >
> > 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 ?
>
> Yes, it is the initial guess. SNES Test does not actually solve the
> problem.
>
> >
> > 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 ?
>
> How do you define the function evaluation? Is the Jacobian code really
> independent of the state vector? (It should be.)
>
> >
> > 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
> >>> > login2.stampede.tacc.utexas.edu
> >>> >  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
> >>> > [0]PETSC ERROR: Configure options   --download-blacs=1
> --download-ctetgen=1
> >>> > --download-
> >>> > metis=1 --download-mumps=1 --download-parmetis=1
> --download-scalapack=1
> >>> > --download-supe
> >>> > rlu_dist=1 --download-triangle=1 --download-umfpack=1
> >>> > --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
> >>> > Graduate Student
> >>> > 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
> >> Graduate Student
> >> 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
> > Graduate Student
> > 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
Graduate Student
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130417/e3d7592d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phi.res
Type: application/octet-stream
Size: 16943 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130417/e3d7592d/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phi_fd.res
Type: application/octet-stream
Size: 17026 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130417/e3d7592d/attachment-0003.obj>


More information about the petsc-users mailing list