On Wed, Aug 10, 2011 at 7:19 PM, Graf, Peter <span dir="ltr"><<a href="mailto:Peter.Graf@nrel.gov">Peter.Graf@nrel.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Matt,<br>
Thanks again for the attention. Here's what happens:<br>
<br>
bash-3.2$ ./snes_test -snes_monitor -snes_converged_reason -ksp_converged_reason -snes_view -snes_monitor -ksp_monitor -ksp_type fgmres -snes_fd > log<br>
<br>
same result:<br>
Nonlinear solve did not converge due to DIVERGED_LS_FAILURE<br></blockquote><div><br></div><div>So the linear solve appears to work, FD and analytic Jacobians agree, so either this cannot be solved with Newton using the starting</div>
<div>guess you provide, or there is an error in your residual function. I would try an exact solution to check the residual evaluation.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
log attached.<br>
Barry has my code to fiddle with. I'm pretty sure the model can be solved, and I'm just doing something wrong. Would be happy to have you guys point out what it is!<br>
Thanks again,<br>
-Peter<br>
<br>
<br>
On 8/10/11 12:42 PM, "Matthew Knepley" <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
<br>
On Wed, Aug 10, 2011 at 4:10 PM, Graf, Peter <<a href="mailto:Peter.Graf@nrel.gov">Peter.Graf@nrel.gov</a>> wrote:<br>
Hi Barry,<br>
Thanks for your response. I did not see a "fgmre" option, but "fgmres" works, and here is the output (including -info).<br>
Thanks in advance for any help you can offer<br>
<br>
Okay, the linear system is being solved, but Newton convergence is stalling. It may be that Newton just cannot solve<br>
this system, but it is more likely that there is an error in the Jacobian. In order to test this, you can use<br>
<br>
-snes_fd<br>
<br>
which is very slow, but forms the entire Jacobian using finite differences.<br>
<br>
Thanks,<br>
<br>
Matt<br>
<br>
-Peter<br>
<br>
On 8/10/11 8:53 AM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
<br>
<br>
Peter,<br>
<br>
Matt gave some bad advice. Please rerun with -ksp_type fgmre -ksp_monitor -ksp_converged_reason as well as the -snes_monitor and send the output. (With the preonly it doesn't produce enough useful information about how the linear solver did).<br>
<br>
> Along the way (with -info) I get messages of the form:<br>
> SNESLSCheckResidual_Private(): ||J^T(F-Ax)||/||F-AX|| 208.031 near zero implies inconsistent rhs<br>
><br>
> At the end, I get:<br>
> [0] SNESLSCheckLocalMin_Private(): || J^T F|| 80.3 near zero implies found a local minimum<br>
<br>
These are fine, there is no local minimum. By "near zero" we mean like 10^-7. These are no where near zero.<br>
<br>
<br>
Barry<br>
<br>
On Aug 10, 2011, at 9:06 AM, Graf, Peter wrote:<br>
<br>
> Hi Matt,<br>
> Thanks for your reply. Attached is the output as requested, specifically, of<br>
><br>
> ./snes_test -snes_monitor -snes_converged_reason -ksp_converged_reason -snes_view -snes_monitor -ksp_monitor -ksp_type preonly -pc_type lu<br>
><br>
> For good measure (?), I am also attaching the case with "-info".<br>
><br>
> (R.e. terminology, I was contrasting the case here with the Dirichlet case of, e.g., u(0) =1, u(1) = 1. Actually I think I'm still wrong, in that my BCs are mixed type,... but thanks for being clear)<br>
><br>
> Again, thank you very much for any help.<br>
> -Peter<br>
><br>
> On 8/10/11 7:13 AM, "Matthew Knepley" <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
><br>
> On Wed, Aug 10, 2011 at 12:39 PM, Graf, Peter <<a href="mailto:Peter.Graf@nrel.gov">Peter.Graf@nrel.gov</a>> wrote:<br>
> Dear Petsc-Users,<br>
> I am implementing a 1D solution of the (drift/diffusion) semiconductor equations. The case of Dirichlet boundaries works fine. The case of Neumann boundaries (i.e. current boundary conditions such as occur at semiconductor/metal contacts) does not. In sorting this out, I have modified one of your examples to recreate the problem:<br>
><br>
> The (modified) example seeks to solve<br>
> u`` + u^{2} = f<br>
> on [0,1] with<br>
> u'(0) = U0<br>
> u(1) = 1<br>
><br>
> With U0 = 0, the SNES solver converges. With U0=-2 (for example) it does not:<br>
><br>
> Just to be clear, both of these are Neumann conditions.<br>
><br>
> 11 SNES Function norm 5.018284941187e+00<br>
> Nonlinear solve did not converge due to DIVERGED_LS_FAILURE<br>
><br>
> When asking about convergence, please send the entire output of -snes_view -snes_monitor -ksp_monitor -snes_converged_reason<br>
><br>
> Since the Jacobian becomes more ill-conditioned, its possible the linear solver is not converging. When testing, its best to always use<br>
> -ksp_type preonly -pc_type lu so that the solves are exact to start out.<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
> (interestingly, it still comes up with roughly good solutions, e.g. at least visually, which suggests to me my discretization is not _total_ garbage)<br>
><br>
> Along the way (with -info) I get messages of the form:<br>
> SNESLSCheckResidual_Private(): ||J^T(F-Ax)||/||F-AX|| 208.031 near zero implies inconsistent rhs<br>
><br>
> At the end, I get:<br>
> [0] SNESLSCheckLocalMin_Private(): || J^T F|| 80.3 near zero implies found a local minimum<br>
><br>
> I have used -snes_type test to verify that my Jacobian is accurate.<br>
> I have also dumped the Jacobians to a file and examined their condition numbers. The nonconverged cases have condition numbers around 10^7, whereas the converged cases have condition numbers around 10^3. This seems like a clue, but I'm not sure what to do about it.<br>
><br>
> All this is completely analogous to the real case of interest (in that case, my condition numbers go to 10^13 or more, and there is similar visual evidence that the solver is "trying" to do the right thing).<br>
> I would love to have help getting this to work. Specifically, what does the message about the "inconsistent rhs" tell me I'm doing wrong? What is the evidence of the condition number telling me? Do I have an error somewhere, or do I have a legitimately ill-conditioned Jacobian (in which case, what should I do about that?)?<br>
><br>
> Thank you very much for any advice,<br>
><br>
> Peter Graf<br>
> NREL Scientific Computing Center<br>
> Golden, CO<br>
><br>
><br>
> <verbose_output2><verbose_output_info><br>
<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <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<br>