[petsc-dev] controlling vector values while doing matrix free operations

Barry Smith bsmith at mcs.anl.gov
Wed Dec 14 19:55:19 CST 2011


  Bobby,

    What Matt is trying to tell you is that changing values at this level to prevent function evaluations outside of the function domain inside Newton is a total hack that rarely works well and should be avoided. You really don't want to do this.

    PETSc 3.2 introduced the ability to solve variational inequalities which allow you to define algebraic systems with inequality constraints on variables. See http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESVI.html and http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESVISetVariableBounds.html

   Barry

On Dec 14, 2011, at 7:34 PM, Philip, Bobby wrote:

> Matt:
>  
>  
> From: petsc-dev-bounces at mcs.anl.gov [mailto:petsc-dev-bounces at mcs.anl.gov] On Behalf Of Matthew Knepley
> Sent: Wednesday, December 14, 2011 5:15 PM
> To: For users of the development version of PETSc
> Subject: Re: [petsc-dev] controlling vector values while doing matrix free operations
>  
> On Wed, Dec 14, 2011 at 4:07 PM, Philip, Bobby <philipb at ornl.gov> wrote:
> Hi:
> 
> When doing the following operation in PETSc using FD approximations to a  Jacobian vector product
> 
> J'(u)*a = [J(u+h*a) - J(u)]/h
>  
> Usually, we would put in F where you have J.
>  
> Actually this is taken from PETSc documentation so you may want to modify it. I normally do use F also.
>  
>  
> is there a way for the user to specify that the entries of u+h*a cannot be negative for example?
> Browsing the PETSc documentation it was not obvious whether I could do this.
>  
> You can do whatever you want in your F function, but you should really investigate SNESVI if
> you have bounds on your variables.
>  
> I do indeed control F and u but I do not control h*a. This is determined by PETSc. Hence the possibility
> exists that u+h*a is outside the domain of the function. This is what I would like to control. Being able to
> check whether u+h*a lies in the domain of the function and then potentially modifying it so it does much
> in the flavor of the LineSearchPost and PreCheck functions. Any suggestions?
>  
>   Thanks,
>  
>      Matt
>  
> Thanks,
> Bobby
> 
> 
>  
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener




More information about the petsc-dev mailing list