<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'><div style="font-family: Times New Roman; font-size: 12pt; color: #000000">Jon,</div><div style="font-family: Times New Roman; font-size: 12pt; color: #000000"><div> <br>> I do not want Ve to be constant, however; I would like it to either decrease in response to Imag > Imag_max or increase in response to Imag < Imag_max, providing > the condition Vmag <= Vmag_max remains true. </div><div>> Should I then have something like f(Ve_ijk) = Imag - Imag_max?</div><div><br></div><div>Note here that (a) f(Ve_ijk) is a complex function while Imag and Imag_max are real. So the above equation does not hold.</div><div> (b) In your previous email, you had bounds on Imag, 0 < Imag < Imag_max. Now you want Ve_ijk to increase if Imag > Imag_max and decrease if Imag < Imag_max. Are you trying to find the value of Ve at which the current is maximum, i.e. Imag = Imag_max, by doing this?</div><div><br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div>Shri,</div><div><br></div><div>Thanks very much for your response. In fact, -snes_converged_reason revealed that the solution was not converging, as you suggested: "Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH." I had not realized this earlier since the voltage distribution in the solution appeared to be correct, even though the SNES_VI constraints were not satisfied.</div><div><br></div><div id="DWT207">Given that and your explanation, I am sure something is wrong with my choices of f. I do not want Ve to be constant, however; I would like it to either decrease in response to Imag > Imag_max or increase in response to Imag < Imag_max, providing the condition Vmag <= Vmag_max remains true. Should I then have something like f(Ve_ijk) = Imag - Imag_max?</div><div id="DWT210"></div></blockquote><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div><br></div><div>Note that you have</div><div id="DWT208"><br></div></blockquote><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div></div><div><br></div><div>One more thing from your response:</div><div><blockquote><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><div style="font-family: 'Times New Roman'; font-size: 12pt; color: rgb(0, 0, 0); "><div><div>>If a block (with coordinates i, j, k) is <b>not</b> <b>occupied by an electrode</b>, C_e is set to zero in the expression for Vb_ijk and all function and Jacobian entries for Ve, >Vmag, and Imag are either not set or set to zero.</div></div></div></div></span></blockquote><br><blockquote><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><div style="font-family: 'Times New Roman'; font-size: 12pt; color: rgb(0, 0, 0); "><div><div>Does this mean f(Ve_ijk) = f(Vmag_ijk) = f(Imag_ijk) = 0? If so, then Ve_ijk, Vmag_ijk, and Imag_ijk would retain their initial values for all time steps.</div></div></div></div></span></blockquote><br></div><div>In my present scheme, f(Ve_ijk) = f(Vmag_ijk) = 0 and f(Imag_ijk) is non-zero for electrode blocks; all three are zero for non-electrode blocks. Depending on the choice of initial conditions, I can make f(Vmag_ijk) non-zero as well (until Ve changes to match Ve_max).</div><div><br></div><div>Thanks again,</div><div><br></div><div>Jon</div><br><div><div>On 2011-09-08, at 3:42 PM, Shri wrote:</div><br class="Apple-interchange-newline"><blockquote><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><div style="font-family: 'Times New Roman'; font-size: 12pt; color: rgb(0, 0, 0); ">Jon,<div><br><div>> for Ve_ijk, f = 0.0 + 0.0*i, and all corresponding Jacobian entries are zero as well. Ve_ijk is set to the maximum voltage for each electrode when the initial solution >is - set. Since the magnitude of Ve is constrained rather than Ve itself, I believe this is correct, but could this be why Ve does not change as it should when the >problem is - being solved? </div><div><br></div><div>This f(Ve_ijk) seems very odd to me since normally you would always have f(some/all variables) = 0 as the function. If f=0.0+0.0*i for all steps, then you don't need a seperate variable Ve_ijk, you can treat it as a constant since Ve_ijk will not change its value during the solutions.<br><br></div><div>Moroever, the Jacobian rows for df(Ve_ijk)/d(all variables) would be all zeros which implies a singular matrix. I am not sure how the solution converged for this case. Were you using -pc_type lu with some shift or some external direct solver such as superlu? What do you get for -snes_monitor -snes_converged_reason?</div><div><br></div><div><br></div><div>> Ve_ijk is set to the maximum voltage for each electrode when the initial solution is set. Since the magnitude of Ve is constrained rather than Ve itself.</div><div>> for Vmag_ijk, f = abs(Ve_ijk) - abs(Ve_ijk_max)</div><div><br></div><div>Since Ve_ijk = Ve_ijk_max, f for Vmag_ijk = 0.0 and hence Vmag_ijk also will also retain its initial value throughout.</div><div><br></div><div>>If a block (with coordinates i, j, k) is <b>not</b> <b>occupied by an electrode</b>, C_e is set to zero in the expression for Vb_ijk and all function and Jacobian entries for Ve, >Vmag, and Imag are either not set or set to zero.</div><div>Does this mean f(Ve_ijk) = f(Vmag_ijk) = f(Imag_ijk) = 0? If so, then Ve_ijk, Vmag_ijk, and Imag_ijk would retain their initial values for all time steps.</div><div><br></div><div>> When I run my program with -snes_vi_type rs, the solution converges quickly but Vmag voltages remain the same as Ve_max for every electrode. As a result, Imag > currents are far larger than abs(iE_max).</div><div>Seems to me like the problem is not converging, or giving the incorrect solution, since the solution of a variational inequality problem has to satisfy Imag < iE_max, which in your case is not happening.</div><div><br></div><div>Thanks for the detailed explanation. Would you mind if I (or you) forward this to petsc-users list so that others could share their thoughts too.</div><div><br></div><div>Shri</div><div><br></div><div><br></div><div><br><hr id="zwchr"><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; "><div><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Shri,</div></span></div></span></div></span></span></div><div><br class="webkit-block-placeholder"></div><div>Thanks again for your patience with my being away this past month. I have spent some more time with this problem and I have added Jacobian entries for 'cross terms' such as d(f(Vb)) / d(Ve). However, this did not appear to change the solution arrived at by PETSc.</div><div><br></div><div>I will give you some examples of the f functions and corresponding Jacobian entries as you suggested, with the hope you will be able to see where I may be going wrong. I will use Vb = V_block, Ve = V_electrode, Vmag = magnitude(V_electrode), Imag = magnitude(I_electrode) to name the four degrees of freedom. </div><div><br></div><div>In my 3D finite differencing grid, there are two types of blocks: blocks occupied by electrodes, and blocks occupied by a resistive medium. The block type of the current block and its neighbouring blocks determines the form of f. This is complicated by the fact that individual electrodes generally occupy three vertically-contiguous blocks, and I want to limit the electric current flowing from the whole electrode rather than the current through each block. Note that Ve, Vmag, and Imag are thus computed or recorded only for the top block of each electrode.</div><div><br></div><div>If a block (with coordinates i, j, k in the x, y, and z directions, respectively)<span class="Apple-converted-space"> </span><b>is</b><span class="Apple-converted-space"> </span><b>occupied by an electrode</b>,</div><div>- for Vb_ijk, f = C_posX * Vb_posX + C_posY * Vb_posY + C_posZ * Vb_posZ</div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span> - (C_posX + C_posY + C_posZ + C_negX + C_negY + C_negZ - C_e) * Vb_ijk</div><div><span class="Apple-tab-span" style="white-space: pre; ">                        </span>+ C_negX * Vb_negX + C_negY * Vb_negY + C_negZ * Vb_negZ</div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span> - C_e * Ve,</div><div> where all C's are calculated constants that do not depend on the other degrees of freedom, but do depend on the type of the neighbouring block in their assigned directions. Then,</div><div> the Jacobian entries for Vb_ijk are </div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_negZ = C_negZ (col.i = i, col.j = j, col.k = k - 1)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_negY = C_negY (col.i = i, col.j = j - 1, col.k = k)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_negX = C_negX (col.i = i - 1, col.j = j, col.k = k)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_ijk = - (C_posX + C_posY + C_posZ + C_negX + C_negY + C_negZ - C_e) (col.i = i, col.j = j, col.k = k)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_posX = C_posX (col.i = i + 1, col.j = j, col.k = k)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_posY = C_posY (col.i = i, col.j = j + 1, col.k = k)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_posZ = C_posZ (col.i = i, col.j = j, col.k = k + 1)</div><div> For each of these, row.i = i, row.j = j, row.k = k, and row.c = DOF_VB (the DOF index for Vb). Also, col.c = DOF_VB.</div><div> The only cross term for the Vb_ijk function is</div><div> <span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVe_ijk = -C_e (row.i = i, row.j = j, row.k = k, row.c = DOF_VB, col.i = i, col.j = j, col.k = k col.c = DOF_VE)</div><div><br></div><div>- for Ve_ijk, f = 0.0 + 0.0*i, and all corresponding Jacobian entries are zero as well. Ve_ijk is set to the maximum voltage for each electrode when the initial solution is set. Since the magnitude of Ve is constrained rather than Ve itself, I believe this is correct, but could this be why Ve does not change as it should when the problem is being solved?</div><div><br></div><div>- for Vmag_ijk, f = abs(Ve_ijk) - abs(Ve_ijk_max). The idea was to provide some 'pressure' towards Ve = Ve_max. The corresponding Jacobian entries are</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVmag_ijk = 1.0 + 0.0*i (row.i = i, row.j = j, row.k = k, row.c = DOF_VMAG, col.i = i, col.j = j, col.k = k, col.c = DOF_VMAG)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVe_ijk = 0.5 * conj(Ve_ijk) / abs(Ve_ijk) (row.i = i, row.j = j, row.k = k, row.c = DOF_VMAG, col.i = i, col.j = j, col.k = k, col.c = DOF_VE)</div><div> (However, since d(abs(Ve_ijk))/dVe_ijk does not have satisfied Cauchy-Reimann equations for the entire complex plane, this derivative does not technically exist.)</div><div><br></div><div>- for Imag_ijk, f = abs(iE) - iE_max. Again, the idea was to provide some 'pressure' towards iE = iE_max. iE is calculated by adding iE_block currents for each block occupied by an electrode. iE_block for block i,j,k is found from</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>iE_block_ijk = aE_ijk * (Ve - Vb_ijk)</div><div>where aE_ijk is a constant that does not depend on any degrees of freedom. There is one Ve value per electrode. The Jacobian entries are then</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dImag_ijk = 1.0 + 0.0*i (row.i = i, row.j = j, row.k = k, row.c = DOF_IMAG, col.i = i, col.j = j, col.k = k, col.c = DOF_IMAG)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVe = 0.5 * aE_sum * conj(iE) / abs(iE) (row.i = i, row.j = j, row.k = k, row.c = DOF_IMAG, col.i = i, col.j = j, col.k = k, col.c = DOF_VE)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_ijk = - 0.5 * aE_ijk * conj(iE) / abs(iE) (row.i = i, row.j = j, row.k = k, row.c = DOF_IMAG, col.i = i, col.j = j, col.k = k, col.c = DOF_VB)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_ij(k-1) = - 0.5 * aE_ij(k-1) * conj(iE) / abs(iE) (row.i = i, row.j = j, row.k = k, row.c = DOF_IMAG, col.i = i, col.j = j, col.k = k-1, col.c =<span class="Apple-converted-space"> </span><span class="Apple-tab-span" style="white-space: pre; ">                </span>DOF_VB)</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>df/dVb_ij(k-2) = - 0.5 * aE_ij(k-2) * conj(iE) / abs(iE) (row.i = i, row.j = j, row.k = k, row.c = DOF_IMAG, col.i = i, col.j = j, col.k = k-2, col.c =<span class="Apple-converted-space"> </span><span class="Apple-tab-span" style="white-space: pre; ">                </span>DOF_VB)</div><div><br></div><div>If a block (with coordinates i, j, k) is <b>not</b> <b>occupied by an electrode</b>, C_e is set to zero in the expression for Vb_ijk and all function and Jacobian entries for Ve, Vmag, and Imag are either not set or set to zero.</div><div><br></div><div>My SNES_VI constraints are set as follows for every block:</div><div>xl_ijk_DOF_V = -SNES_VI_INF</div><div>xu_ijk_DOF_V = SNES_VI_INF</div><div><div>xl_ijk_DOF_VE = -SNES_VI_INF</div><div>xu_ijk_DOF_VE = SNES_VI_INF</div></div><div><div>xl_ijk_DOF_VMAG = 0.0</div><div>xu_ijk_DOF_VMAG = abs(Ve_max)</div></div><div><div><div>xl_ijk_DOF_IMAG = 0.0</div><div>xu_ijk_DOF_IMAG = abs(iE_max)</div></div></div><div><br></div><div><br></div><div>When I run my program with -snes_vi_type rs, the solution converges quickly but Vmag voltages remain the same as Ve_max for every electrode. As a result, Imag currents are far larger than abs(iE_max). Are you able to see from here what the problem might be? Again, my hunches are that the complex derivatives do not work in my Jacobian because they do not exist, or that my choices of f for Ve, Vmag, and Imag are not correct.</div><div><br></div><div>Please let me know if you would like clarification on any portion of my description., and thank you again for all your help with this.</div><div><br></div><div>Jon</div><div><br></div><div><div>On 2011-07-29, at 12:13 PM, Shri wrote:</div><br class="Apple-interchange-newline"><blockquote><div>Jon,<br> I am trying to compile petsc with complex data type right now and will try to test the VI solver with complex variables within the next few hours.<span class="Apple-converted-space"> </span><br><br><br><blockquote>My understanding is that comparison operators (such as < and >) are<br></blockquote><blockquote>not defined for complex numbers, so would it be correct to say that<br></blockquote><blockquote>anyone using complex scalars within PETSc will encounter this problem<br></blockquote><blockquote>with SNESVI? In other words, SNESVI inequality constraints can only be<br></blockquote><blockquote>applied to real variables or real-valued functions of complex<br></blockquote><blockquote>variables?<br></blockquote><br>For complex scalars, we only compare the real part of the complex variable and bound,i.e.,<br>real(xl) <= real(x) <= real(x_u). For your application, this real part comparison is sufficient<span class="Apple-converted-space"> </span><br>since the magnitude is saved in the real part.<br><br><br><blockquote><blockquote><blockquote>The residuals are set as follows, and the Jacobian entries are set<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>correspondingly:<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[V_block] = {function of adjacent V_blocks, V_electrode}<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[V_electrode] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[magnitude(V_electrode)] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[magnitude(I_electrode)] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><br>Can you give an example of f for all dofs maybe just for one grid point with the following dof names<br>Vb - V_block<br>Ve - V_electrode<br>Vmag - magnitude(V_electrode)<br>Imag - magnitude(I_electrode)<span class="Apple-converted-space"> </span><br><br><blockquote>Since I set all the residuals for both magnitude variables to zero,<br></blockquote><blockquote>and each entry in the Jacobian matrix is a partial derivative of a<br></blockquote><blockquote>residual, I believe the Jacobian entries for both magnitudes would all<br></blockquote><blockquote>be zero as well. However, your point made me realize I have no<br></blockquote><blockquote>Jacobian entry for the partial derivative of f[V_block] w.r.t.<br></blockquote><blockquote>V_electrode. Is that needed?<span class="Apple-converted-space"> </span><br></blockquote><br>Since f[V_block] is a function of V_electrode, you would need to set the partial derivatives of f[V_block] w.r.t V_electrode<br>for correct jacobian evaluation and for having a good newton convergence.<br><br>How would one enter it with<br><blockquote>MatSetValuesStencil?<span class="Apple-converted-space"> </span><br></blockquote>ex28.c,<br><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/src/ksp/ksp/examples/tutorials/ex28.c.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/src/ksp/ksp/examples/tutorials/ex28.c.html</a>,<br>is a petsc example which shows how to use MatSetValuesStencil with multiple degrees of freedom.<span class="Apple-converted-space"> </span><br>See the routine ComputeMatrix in the example.<br><br>My working understanding was that each degree of<br><blockquote>freedom conceptually has its own residual and Jacobian, even though<br></blockquote><blockquote>all residuals are contained in one Vec and all Jacobians contained in<br></blockquote><blockquote>one Mat.<br></blockquote><blockquote><br></blockquote><br>Please bare with us as we are trying to figure out whether the issue is with our VI implementation or something in<span class="Apple-converted-space"> </span><br>your code is amiss. I appreciate your patience on this matter.<br><br>Btw, one quick question, are all the problem formulations in your field done using complex variables or by decomposing the complex term into real/imaginary or magnitude/angle? My background is in electrical power grid and we mostly use either real/imaginary part or magnitude/angle as the variables.<br><br><br>Shri<br><br><br>----- Original Message -----<br><blockquote>Thanks for your reply, Shri. Responses below:<br></blockquote><blockquote><br></blockquote><blockquote>On 2011-07-28, at 1:03 PM, Shri wrote:<br></blockquote><blockquote><br></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>----- Original Message -----<br></blockquote></blockquote><blockquote><blockquote><blockquote>Hi Barry, Shri,<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>I reworked my implementation to include only the time-independent<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>electrical problem, and to make use of SNESVISetVariableBounds().<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>However, it does not work quite as I expected: Constraints on<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>variables that are functions of other variables have no effect on<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>variables by which the functions are defined.<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>My constraints are set on the four degrees of freedom as follows:<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>-SNES_VI_INF <= V_block <= SNES_VI_INF<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>-SNES_VI_INF <= V_electrode <= SNES_VI_INF<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>0.0 + 0.0i <= magnitude(V_electrode) <= magnitude(V_electrode_max)<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>0.0 + 0.0i <= magnitude(I_electrode) <= magnitude(I_electrode_max)<br></blockquote></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>Note that while V_block and V_electrode and complex quantities,the<br></blockquote></blockquote><blockquote><blockquote>magnitude terms are actually real numbers. What function did you use<br></blockquote></blockquote><blockquote><blockquote>to compute the magnitude? abs()? sqrt of product of complex number<br></blockquote></blockquote><blockquote><blockquote>with its conjugate?<br></blockquote></blockquote><blockquote><br></blockquote><blockquote>I used the "0.0 + 0.0i" there to emphasize that I built PETSc with<br></blockquote><blockquote>complex scalars, so all the scalars are stored as complex even if the<br></blockquote><blockquote>imaginary components are always zero. I have been using std::abs()<br></blockquote><blockquote>from the C++ standard library complex template class<br></blockquote><blockquote>(std::complex<double>). I believe the values of type 'double' returned<br></blockquote><blockquote>by std::abs() are implicitly cast to the real part of<br></blockquote><blockquote>std::complex<double> or PetscScalar, though I usually try to cast<br></blockquote><blockquote>explicitly.<br></blockquote><blockquote><br></blockquote><blockquote><blockquote>This seems like an application where the variables are of type<br></blockquote></blockquote><blockquote><blockquote>complex but the constraints need to be set for functions of the<br></blockquote></blockquote><blockquote><blockquote>variables which are actually real numbers. I am not sure whether<br></blockquote></blockquote><blockquote><blockquote>this can be supported. Maybe Barry or others can shed more<br></blockquote></blockquote><blockquote><blockquote>light on this.<br></blockquote></blockquote><blockquote><br></blockquote><blockquote>My understanding is that comparison operators (such as < and >) are<br></blockquote><blockquote>not defined for complex numbers, so would it be correct to say that<br></blockquote><blockquote>anyone using complex scalars within PETSc will encounter this problem<br></blockquote><blockquote>with SNESVI? In other words, SNESVI inequality constraints can only be<br></blockquote><blockquote>applied to real variables or real-valued functions of complex<br></blockquote><blockquote>variables?<br></blockquote><blockquote><br></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>The residuals are set as follows, and the Jacobian entries are set<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>correspondingly:<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[V_block] = {function of adjacent V_blocks, V_electrode}<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[V_electrode] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[magnitude(V_electrode)] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>f[magnitude(I_electrode)] = 0.0 + 0.0i<br></blockquote></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>What equations do you use for the partial derivatives of the<br></blockquote></blockquote><blockquote><blockquote>magnitude functions w.r.t. the actual complex variables (V_block and<br></blockquote></blockquote><blockquote><blockquote>V_electrode) in the jacobian evaluation?<br></blockquote></blockquote><blockquote><br></blockquote><blockquote>Since I set all the residuals for both magnitude variables to zero,<br></blockquote><blockquote>and each entry in the Jacobian matrix is a partial derivative of a<br></blockquote><blockquote>residual, I believe the Jacobian entries for both magnitudes would all<br></blockquote><blockquote>be zero as well. However, your point made me realize I have no<br></blockquote><blockquote>Jacobian entry for the partial derivative of f[V_block] w.r.t.<br></blockquote><blockquote>V_electrode. Is that needed? How would one enter it with<br></blockquote><blockquote>MatSetValuesStencil? My working understanding was that each degree of<br></blockquote><blockquote>freedom conceptually has its own residual and Jacobian, even though<br></blockquote><blockquote>all residuals are contained in one Vec and all Jacobians contained in<br></blockquote><blockquote>one Mat.<br></blockquote><blockquote><br></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>The first two potentials, V_block and V_electrode, are independent,<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>while magnitude(V_electrode) is a function of V_electrode only and<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>electrode current magnitude(I_electrode) is a function of V_block<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>and<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>V_electrode. Note that V_electrode acts as a source term in the<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>finite<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>difference formulation for V_block. While all of these variables<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>are<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>complex, the latter two always have zero imaginary parts. I suppose<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>I<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>am assuming that PETSc knows to compare only the real parts if the<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>imaginary parts are zero. (Is this a bad assumption?)<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>When solving with PETSc (using -snes_vi_type rs)<br></blockquote></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>Did you also use -snes_type vi?<br></blockquote></blockquote><blockquote><br></blockquote><blockquote>I have been using SNESSetType(snes, SNESVI) in my code, and the use of<br></blockquote><blockquote>-snes_type vi in the command line does not seem to change any<br></blockquote><blockquote>behaviour.<br></blockquote><blockquote><br></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>V_electrode stays at<br></blockquote></blockquote><blockquote><blockquote><blockquote>its maximum, as set in the initial guess, and the V_block<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>distribution<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>falls properly from that. However, measurements of<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>magnitude(I_electrode) are way above maximum and do not move<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>downwards<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>with successive SNES iterations. I can also set the constraint on<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>magnitude(V_electrode) to less than maximum and it does not affect<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>value of V_electrode. How can I tell PETSc to change V_electrode<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>when<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>the magnitude(V_electrode) or magnitude(I_electrode) constraints<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>are<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>not met?<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote>Send the code for your application with instructions on how to run<br></blockquote></blockquote><blockquote><blockquote>it and we'll try to figure out what needs to be<br></blockquote></blockquote><blockquote><blockquote>done.<br></blockquote></blockquote><blockquote><br></blockquote><blockquote>I really appreciate this generous offer of your time, and I will<br></blockquote><blockquote>certainly take you up on it if we cannot resolve this otherwise.<br></blockquote><blockquote>Unfortunately, I will be travelling for the next few weeks and it may<br></blockquote><blockquote>take me some time to isolate the PETSc-dependent parts of my<br></blockquote><blockquote>application. Please bear with me as I will try to keep in touch while<br></blockquote><blockquote>I am away.<br></blockquote><blockquote><br></blockquote><blockquote>As I mentioned above, I think the issue may lie in the conceptual<br></blockquote><blockquote>incompatibility of complex variables and inequality constraints, but I<br></blockquote><blockquote>would appreciate your thoughts on that.<br></blockquote><blockquote><br></blockquote><blockquote>Thanks again,<br></blockquote><blockquote><br></blockquote><blockquote>Jon<br></blockquote><blockquote><br></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote>Shri<br></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><blockquote><blockquote><blockquote>Thanks again for your help.<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>Jon<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote>On 2011-07-25, at 8:58 PM, Barry Smith wrote:<br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>On Jul 25, 2011, at 5:50 PM, Jonathan Backs wrote:<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Hi Shri,<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Thanks for your message and all the helpful tips. If the<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>TSVISetVariableBounds() functions are available now, I would like<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>to try them as well. Is the interface essentially the same as<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>with<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>SNESVISetVariableBounds()? I will get back to you and Barry when<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>I<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>have had a chance to modify my application.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>For my problem, I believe it makes sense to have bounds on one of<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the variables as well as one function of the variables. The two<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>relevant degrees of freedom are the block voltage (one for each<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>finite difference block) and the electrode voltage (one for each<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrode, which may be present in multiple blocks). The<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrode<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>voltage should keep a constant phase while the magnitude is<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>constrained between zero and some maximum. The block voltages<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>near<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the electrodes depend on the electrode voltages as well as the<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>neighbouring block voltages. The electrode current for a given<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrode is a function of its electrode voltage and several<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>nearby<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>block voltages, and should be constrained in magnitude between<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>zero<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>and some maximum (and the phase unconstrained). Would I need to<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>use<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>SNESVISetComputeVariableBounds since the electrode current is a<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>function of the other variables? Would any other provisions need<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>to<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>be made for the block voltages, since they depend on the<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrode<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>voltages?<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>You cannot directly make a bound on some function of other<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>variables. Instead you need to introduce another variable that is<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>defined to be equal to that function and put the bound on that<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>new<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>variable.<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote>Barry<br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Thank you again,<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Jon<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>On 2011-07-25, at 11:58 AM, Shri wrote:<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>----- Original Message -----<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>On Jul 22, 2011, at 4:16 PM, Jonathan Backs wrote:<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Barry,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Thank you so much for your response. Lucky, indeed! I look<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>forward<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>to trying out these new features.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>I neglected to mention in my original post that my electrical<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>problem is part of a DAE, which includes a time-dependent<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>heating<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>problem. Can SNESVI constraints be used in conjunction with<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>TSSetIFunction() and TSSetIJacobian() as well? (Of course, I<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>only<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>need the constraints for the time-independent electrical<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>portion.)<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>We have not yet put that in but Shri is starting to look at<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>that<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>just<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>now. Basically we would have a TSVISetVariableBounds() and<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>handle<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>everything from there. I suggest you start with a simple time<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrical portion with constraints to explore and we'll go<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>from<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>there. Shri is actually a electrical networks guy and so can<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>speak<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>your language.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>I've added TSVISetVariableBounds() for setting the bounds on the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>variables using the TS object directly.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>A few things that i want to mention here about using the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>variational inequality nonlinear solver (SNESVI).<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>i) Use the runtime option -snes_type vi or explicitly set<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>SNESSetType(snes,SNESVI).<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>ii) There are two tested algorithms currently available, (a)<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>semismooth (-snes_vi_type ss) and (b) active set or reduced<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>space<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>(-snes_vi_type rs).<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>iii) Take a look at example,ex61.c, in<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>src/snes/examples/tutorials<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>which is a time-stepping nonlinear problem with constraints on<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>variables. This example does not use the TS object directly but<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>rather a time-loop is explicitly written. Another example,ex8.c,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>in src/snes/examples/tests/ is a minimum surface area problem<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>which uses SNESVI.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>By the way, does your problem have bounds on the variables or<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>bounds on some function of the variables?<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Shri<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Barry<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Thank you again,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Jon<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>On 2011-07-22, at 2:46 PM, Barry Smith wrote:<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Jon,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>You may be in luck. In PETSc-dev<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><a href="http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html</a><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>we<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>have now implemented variational inequality non-linear<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>solvers<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>with box constraints.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>That is one has a set of variables u and algebraic equations<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>F(u) = 0 (say of size n each) but in addition one has<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>constraints lu <= u <= uu where some or all of lu may be<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>negative infinity (no constraints) and some or all of uu may<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>be<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>infinity (no constraints). There is also a constraint on the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>sign of F() for those equations associated with active<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>constraints. If your constraints are not in this form<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>sometimes<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>you can introduce new additional variables to get it in this<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>form. Read up a little on variational inequalities on the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>web.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>To use this you provide the usual SNES function and Jacobian<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>but<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>you also provide SNESVISetVariableBounds() there is a manual<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>page for this function and for for SNESVI at<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/index.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/index.html</a><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>(the link is broken right now but Satish is fixing it). Plus<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>several examples in src/snes/examples/tutorials (in<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>petsc-dev).<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>This is all new code so we would be interested in your<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>feedback.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Barry<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>On Jul 22, 2011, at 3:33 PM, Jonathan Backs wrote:<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Hi,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>I am trying to add a constraint feature to my first PETSc<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>application, which uses the finite difference method to<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>calculate<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the potential distribution produced by a collection of<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrodes<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>in a resistive medium. I would like to make this simulation<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>more<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>realistic by imposing a maximum electric current and a<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>maximum<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>potential difference that can be supplied to each electrode<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>by<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>power supply. If the medium between the electrodes is very<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>conductive, the current maximum would be exceeded by the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>maximum<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>potential difference, so the potential difference should be<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>decreased from maximum until it produces the maximum<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>current.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>On<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the other hand, the potential difference between the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>electrodes<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>should remain at maximum as long as the current remains<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>below<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>maximum (say, for a less conductive medium).<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>I added an extra degree of freedom (the electrode voltages)<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>to<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>my<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>DMDA, and I developed a set of conditional expressions that<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>describe the above constraints, but one problem is that the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>logic<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>relies on if-then-else decisions that are made when forming<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>function/residual and the Jacobian. Once these decisions are<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>made,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>of course, the conditions are not checked again until the<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>next<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>function or Jacobian evaluation. The non-linear solver then<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>tends<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>to oscillate between extreme solutions to the opposing<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>conditions<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>with each iteration, and never converges towards a<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>reasonable<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>solution.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Is there a better strategy for solving such problems? Does<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>PETSc<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>offer mechanisms to aid in their solution? I would very much<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>appreciate any hints.<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Thank you for your time,<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>Jon<br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><blockquote><blockquote><br></blockquote></blockquote></blockquote></blockquote><blockquote><blockquote><br></blockquote></blockquote><br></div></blockquote></div><br></blockquote><br></div></div></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></blockquote><br></div></div></div></body></html>