[petsc-users] SetVariableBounds vs ComputeVariableBounds

Justin Chang jychang48 at gmail.com
Sat Jun 25 15:31:59 CDT 2016


Hi all,

So I modified SNES ex9.c so that one has the option to use TAO's
complementarity solvers for this problem. Attached is the file.

I expect the TAO solvers to behave the same as the SNESVI ones, but I am
having the same issues as before - SSILS and SSFLS do not work whatsoever
but for some reason ASILS and ASFLS work. Although the latter two produce
the same results as the SNES VI counterparts, they converge much slower,
and something tells me I am not doing something correctly. Based on what I
have seen from the two TAO complementarity examples, I would also expect
the AS and SS solvers to be roughly the same.

BTW, in the modified code, I made some "shortcuts." Instead of explicitly
forming the Tao versions of the Gradient and Jacobian, I first assemble the
residual r and Jacobian J through the SNESComputeXXX functions. Then I pass
them into the TaoSetConstraints and TaoSetJacobian routines. Because this
is a linear system, I have:

f = r - J*u^0
gradient g = J*u - f = J*(u + *u^0) + r

were u^0 is the initial vector. I am not sure if this "shortcut" has
anything to do with the issue at hand. Attached is the makefile which has
instructions on how to run the problem.

Any ideas what is going on??

Thanks!
Justin

On Wed, Jun 22, 2016 at 9:42 PM, Ed Bueler <elbueler at alaska.edu> wrote:

> Justin --
>
> Yeah, good point.  SNESVISetVariableBounds() works fine, at least in ex9.c
> (see attached patch).  The reason for the other choice, which I found in my
> 5 year old email, was some bug in petsc3.2.
>
> Ed
>
> Date: Wed, 22 Jun 2016 08:42:33 +0100
>> From: Justin Chang <jychang48 at gmail.com>
>> To: petsc-users <petsc-users at mcs.anl.gov>
>> Subject: [petsc-users] SetVariableBounds vs ComputeVariableBounds
>>
>> Hi all,
>>
>> I am looking at the SNES tutorials ex9.c and ex58.c and am wondering why
>> SNESVISetComputeVariableBounds() is called instead of just
>> SNESVISetVariableBounds(). When would it be appropriate to use only using
>> the latter?
>>
>> Thanks,
>> Justin
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160625/4abf34f2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex9_TAO.c
Type: text/x-csrc
Size: 12704 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160625/4abf34f2/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile
Type: application/octet-stream
Size: 708 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160625/4abf34f2/attachment-0001.obj>


More information about the petsc-users mailing list