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

Reply via email to