<div class="gmail_quote">On Wed, Feb 16, 2011 at 20:39, Juha Jäykkä <span dir="ltr">&lt;<a href="mailto:juhaj@iki.fi">juhaj@iki.fi</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":1on">Which function, F(u) or my u*, which satisfies F(u*)=0? I.e. the unknown or<br>
the function evaluated by FormFunction?<br>
<br>
I find it unlikely that the solution would not be at least twice<br>
differentiable (apart from the endpoints, where it is not): it is almost<br>
guaranteed to be since the equation is the Euler-Lagrange equation of a well<br>
behaved action integral.<br>
<br>
As for F(u), the function is a polynomial of u and x (x being the coordinate),<br>
so it is smooth, if u is.<br></div></blockquote><div><br></div><div>We just want F(u) to be continuously differentiable as a function from R^n to R^n (were n is the size of u).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":1on">
<div class="im"><br>
&gt; Unlikely possibility #3:<br>
&gt;<br>
&gt;   You have written an equation with no real solutions, meaning there is a<br>
&gt; mistake in your function.<br>
<br>
</div>But my initial guess is an exact solution.</div></blockquote><div><br></div><div>So the initial SNES residual is nearly zero? Then the differencing and the solve could be dominated by rounding error.</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":1on"> I have two free parameters in the<br>
equation and for a single choice I can find an exact solution - it happens to<br>
be u(x) = x, so the discrete derivatives are exactly the same as the<br>
continuous ones (apart from floating point rounding errors, of course).<br>
<br>
Now, it is quite possible that my problem is poorly scaled or ill-conditioned,<br>
like Jed Brown suggested. Can I check the eigenvalues of the KSP matrices<br>
somehow?</div></blockquote></div><br><div>There are a few ways to do it automatically as part of the solve. These shows you spectral information for the preconditioned operator so run with -pc_type none to see the true spectrum. You typically need to use GMRES for these to work:</div>
<div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  -ksp_monitor_singular_value &lt;stdout&gt;: Monitor singular values (KSPMonitorSet)</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  -ksp_compute_singularvalues: &lt;FALSE&gt; Compute singular values of preconditioned operator (KSPSetComputeSingularValues)</font></div>
</div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  -ksp_compute_eigenvalues: &lt;FALSE&gt; Compute eigenvalues of preconditioned operator (KSPSetComputeSingularValues)</font></div><div>
<font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  -ksp_plot_eigenvalues: &lt;FALSE&gt; Scatter plot extreme eigenvalues (KSPSetComputeSingularValues)</font></div></div>