[petsc-users] Conditional Constraints

Barry Smith bsmith at mcs.anl.gov
Fri Jul 22 16:20:04 CDT 2011


On Jul 22, 2011, at 4:16 PM, Jonathan Backs wrote:

> Barry,
> 
> Thank you so much for your response. Lucky, indeed! I look forward to trying out these new features.
> 
> I neglected to mention in my original post that my electrical problem is part of a DAE, which includes a time-dependent heating problem. Can SNESVI constraints be used in conjunction with TSSetIFunction() and TSSetIJacobian() as well? (Of course, I only need the constraints for the time-independent electrical portion.)

   We have not yet put that in but Shri is starting to look at that just now. Basically we would have a TSVISetVariableBounds() and handle everything from there. I suggest you start with a simple time electrical portion with constraints to explore and we'll go from there. Shri is actually a electrical networks guy and so can speak your language.

   Barry



> 
> Thank you again,
> 
> Jon
> 
> On 2011-07-22, at 2:46 PM, Barry Smith wrote:
> 
>> 
>> Jon,
>> 
>>    You may be in luck. In PETSc-dev http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html we have now implemented variational inequality non-linear solvers with box constraints. 
>> 
>>    That is one has a set of variables u and algebraic equations F(u) = 0 (say of size n each) but in addition one has constraints    lu <=   u <= uu  where some or all of lu may be negative infinity (no constraints) and some or all of uu may be infinity (no constraints).  There is also a constraint on the sign of F() for those equations associated with active constraints.  If your constraints are not in this form sometimes you can introduce new additional variables to get it in this form.  Read up a little on variational inequalities on the web. 
>> 
>>    To use this you provide the usual SNES function and Jacobian but you also provide SNESVISetVariableBounds()  there is a manual page for this function and for for SNESVI at http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/index.html (the link is broken right now but Satish is fixing it). Plus several examples in src/snes/examples/tutorials (in petsc-dev).
>> 
>>    This is all new code so we would be interested in your feedback.
>> 
>> 
>>  Barry
>> 
>> 
>> 
>> 
>> 
>> On Jul 22, 2011, at 3:33 PM, Jonathan Backs wrote:
>> 
>>> Hi,
>>> 
>>> I am trying to add a constraint feature to my first PETSc application, which uses the finite difference method to calculate the potential distribution produced by a collection of electrodes in a resistive medium. I would like to make this simulation more realistic by imposing a maximum electric current and a maximum potential difference that can be supplied to each electrode by the power supply. If the medium between the electrodes is very conductive, the current maximum would be exceeded by the maximum potential difference, so the potential difference should be decreased from maximum until it produces the maximum current. On the other hand, the potential difference between the electrodes should remain at maximum as long as the current remains below maximum (say, for a less conductive medium).
>>> 
>>> I added an extra degree of freedom (the electrode voltages) to my DMDA, and I developed a set of conditional expressions that describe the above constraints, but one problem is that the logic relies on if-then-else decisions that are made when forming the function/residual and the Jacobian. Once these decisions are made, of course, the conditions are not checked again until the next function or Jacobian evaluation. The non-linear solver then tends to oscillate between extreme solutions to the opposing conditions with each iteration, and never converges towards a reasonable solution.
>>> 
>>> Is there a better strategy for solving such problems? Does PETSc offer mechanisms to aid in their solution? I would very much appreciate any hints.
>>> 
>>> Thank you for your time,
>>> 
>>> Jon
>> 
> 



More information about the petsc-users mailing list