<div dir="ltr"><div>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<br><br></div><div>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 ~ = <span class="" dir="ltr" id="cwos">0.0023 .<br>
<br></span></div><div><span class="" dir="ltr" id="cwos">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. <br>
<br></span></div><div><span class="" dir="ltr" id="cwos">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<br>
<br></span></div><div><span class="" dir="ltr" id="cwos">I insert the boundary values into the local vector before assembly of the function and jacobain<br></span></div><div><span class="" dir="ltr" id="cwos"><br></span> </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 6:31 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"><p dir="ltr"><br>
On Apr 17, 2013 6:25 PM, "Dharmendar Reddy" <<a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a>> wrote:<br>
><br>
> Sorry, I do not know how the reply went to your id. I replied the usual way.<br>
><br>
><br>
><br>
> I am solving :  div(grad(V)) = 0  for x  in [0, L]  and V(0) = V1 and V(L) = V1<br>
><br>
> I get a solution V(x) = V1 after solving with intial guess V(X) = 0 for x in (0, L)<br>
><br>
> Now, what is the user defined ? is it V(X) = 0 ? or V(x) =  V1 ?</p>
</div><p dir="ltr">Yes, it is the initial guess. SNES Test does not actually solve the problem.</p><div class="im">
<p dir="ltr">><br>
> Is the user defined state is V(X) = V1 then it means the Jacobin is tested after doing a solve first ?<br>
><br>
> 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 ?</p>
</div><p dir="ltr">How do you define the function evaluation? Is the Jacobian code really independent of the state vector? (It should be.)</p><div class="HOEnZb"><div class="h5">
<p dir="ltr">><br>
> Thanks<br>
><br>
><br>
> On Wed, Apr 17, 2013 at 5:55 PM, Dharmendar Reddy <<a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a>> wrote:<br>
>><br>
>> I am confused. <br>
>><br>
>> I am solving :  div(grad(V)) = 0  for x  in [0, L]  and V(0) = V1 and V(L) = V1<br>
>><br>
>> I get a solution V(x) = V1 after solving with intial guess V(X) = 0 for x in (0, L)<br>
>><br>
>> Now, what is the user defined ? is it V(X) = 0 ? or V(x) =  V1 ?<br>
>><br>
>> Is the user defined state is V(X) = V1 then it means the Jacobin is tested after doing a solve first ?<br>
>><br>
>> 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 ?<br>
>><br>
>> Thanks<br>
>> Reddy<br>
>><br>
>><br>
>><br>
>><br>
>> On Wed, Apr 17, 2013 at 5:36 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>> wrote:<br>
>>><br>
>>> Dharmendar Reddy <<a href="mailto:dharmareddy84@gmail.com" target="_blank">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>
>>> 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>
>>><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" target="_blank">dharmareddy84@gmail.com</a><br>
>>> > Phone: <a href="tel:%2B1-512-350-9082" value="+15123509082" target="_blank">+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>
>><br>
>><br>
>><br>
>><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: <a href="tel:%2B1-512-350-9082" value="+15123509082" target="_blank">+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>
><br>
><br>
><br>
><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: <a href="tel:%2B1-512-350-9082" value="+15123509082" target="_blank">+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>
</p>
</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>