<div dir="ltr">Under what condition, SNESGetFunctionNorm() will output different results from SENEGetFunction + VecNorm (with NORM_2)? <div><br></div><div>For most of my test cases, it is the same. However, when I have some special (trivial) initial guess to the SNES problem, I see different norms.</div>
<div><br></div><div>Another phenomenon I noticed with this is that KSP in SNES squeeze my matrix by eliminating rows. I have a Jacobian supposed to be 50-by-50. When I use KSPGetOperators/rhs/solutions, I found that the operator is 25-by-25, and the rhs and solution is with length 25. Do you have any clue on what triggered this? To my surprise, when I output the Jacobian inside the FormJacobianLocal, it outputs the correct matrix 50-by-50 with correct numerical entries. Why does the operator obtained from KSP is different and got rows eliminated? These rows got eliminated have only one entries per row, but the rhs in that row is not zero. Eliminating these rows would give wrong solutions.</div>
<div><br></div><div>Thank you.</div><div><br></div><div>Xiangdong</div><div><br></div><div><br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 29, 2014 at 3:12 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Tue, Apr 29, 2014 at 2:09 PM, Xiangdong <span dir="ltr"><<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It turns out to a be a bug in my FormFunctionLocal(DMDALocalInfo *info,PetscScalar **x,PetscScalar **f,AppCtx *user). I forgot to initialize the array f. Zero the array f solved the problem and gave consistent result.<div>
<br></div><div>Just curious, why does not petsc initialize the array f to zero by default inside petsc when passing the f array to FormFunctionLocal?</div></div></blockquote><div><br></div></div><div>If you directly set entires, you might not want us to spend the time writing those zeros.</div>
<div class="">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have another quick question about the array x passed to FormFunctionLocal. If I want to know the which x is evaluated, how can I output x in a vector format? Currently, I created a global vector vecx and a local vector vecx_local, get the array of vecx_local_array, copy the x to vecx_local_array, scatter to global vecx and output vecx. Is there a quick way to restore the array x to a vector and output?</div>
</div></blockquote><div><br></div></div><div>I cannot think of a better way than that.</div><div><br></div><div> Matt</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>Thank you.</div><div><br></div><div>Best,</div><div>Xiangdong</div><div><br></div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 28, 2014 at 10:28 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
On Apr 28, 2014, at 3:23 PM, Xiangdong <<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>> wrote:<br>
<br>
> Hello everyone,<br>
><br>
> When I run snes program,<br>
<br>
</div> ^^^^ what SNES program”?<br>
<div><br>
> it outputs "SNES Function norm 1.23456789e+10". It seems that this norm is different from residue norm (even if solving F(x)=0)<br>
<br>
</div> Please send the full output where you see this.<br>
<div><br>
> and also differ from norm of the Jacobian. What is the definition of this "SNES Function Norm”?<br>
<br>
</div> The SNES Function Norm as printed by PETSc is suppose to the 2-norm of F(x) - b (where b is usually zero) and this is also the same thing as the “residue norm”<br>
<br>
Barry<br>
<br>
><br>
> Thank you.<br>
><br>
> Best,<br>
> Xiangdong<br>
<br>
</blockquote></div><br></div></div></div>
</blockquote></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</font></span></div></div>
</blockquote></div><br></div>