Hi Peter,
Running with "snes_linesearch_monitor" would give the following results
which I presented in my original email:
My simulation input consists of two scalar values (p1 and p2), each
of which acts as a constant pressure boundary condition.
Case 1, diverge:
p1= -10.190869 p2= -2.367555
NL step 0, |residual|_2 = 1.621402e-02
Line search: Using full step: fnorm 1.621401550027e-02 gnorm
7.022558235262e-05
NL step 1, |residual|_2 = 7.022558e-05
Line search: Using full step: fnorm 7.022558235262e-05 gnorm
1.636418730611e-06
NL step 2, |residual|_2 = 1.636419e-06
Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH
iterations 2
------------------------------------------------------------------------
Case 2: converge:
p1= -10.190747 p2= -2.367558
NL step 0, |residual|_2 = 1.621380e-02
Line search: Using full step: fnorm 1.621379778276e-02 gnorm
6.976373804153e-05
NL step 1, |residual|_2 = 6.976374e-05
Line search: Using full step: fnorm 6.976373804153e-05 gnorm
4.000992847275e-07
NL step 2, |residual|_2 = 4.000993e-07
Line search: Using full step: fnorm 4.000992847275e-07 gnorm
1.621646014441e-08
NL step 3, |residual|_2 = 1.621646e-08
Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 3
------------------------------------------------------------------------
Also, running with "-snes_stol=0" effectively suppressed the occurrence
of CONVERGED_SNORM_RELATIVE. Instead, most nonlinear solves took more
iterations and ended with CONVERGED_FNORM_RELATIVE at a smaller residual
error. In some cases (roughly 10 out of 5000), the nonlinear solves
failed with DIVERGED_LINE_SEARCH
Cheers,
Dafang
On 03/18/2014 10:15 AM, Peter Brune wrote:
Is there more output from the line search? What happens when you run
with -snes_linesearch_monitor? I remember there being a reason that I
didn't put this update in the maintenance branch. Let me figure out
exactly why and get back to you.
On Mon, Mar 17, 2014 at 5:37 PM, Dafang Wang <[email protected]
<mailto:[email protected]>> wrote:
Hi Peter,
My version of PETSc (v3.4.3) does not contain the bug fix you
mentioned:
"+ ierr =
SNESLineSearchSetNorms(linesearch,xnorm,fnorm,ynorm);CHKERRQ(ierr);"
Would that be a problem?
I typically used the default value of -snes_stol, never setting it
to zero. I will let you know soon if you believe this is important.
It would certainly be worth a try.
- Peter
Cheers,
Dafang
On 03/17/2014 06:27 PM, Peter Brune wrote:
This may be related to a bug we had reported before to petsc-maint:
https://bitbucket.org/petsc/petsc/commits/ced04f9d467b04aa83a18d3f8875c7f72c17217a
What version of PETSc are you running? Also, what happens if
you set -snes_stol to zero?
Thanks,
- Peter
On Mon, Mar 17, 2014 at 5:19 PM, Dafang Wang <[email protected]
<mailto:[email protected]>> wrote:
Hi Barry,
Thanks for your tips. I have read the webpage you mentioned
many times before, but still I have been stuck on the
line-search problem for weeks.
I cannot guarantee my Jacobian is correct but I believe an
incorrect Jacobian is very unlikely. My Jacobian-calculation
code has been under test for a year with both analytical and
realistic models, and the results have been good until
recently when I ran a very realistic physical model.
Also, I looked up the implementation of SNESSolve_NEWTONLS()
in "ls.c". According to the algorithm, when the function
"SNESLineSearchApply()" does not succeed, one may encounter
two possible outcomes: CONVERGED_SNORM_RELATIVE (if the
search step is too small) or otherwise, DIVERGED_LINE_SEARCH.
Does this mean that both these two outcomes indicate that the
line search fails?
I ask this question because my simulation encountered many
CONVERGED_SNORM_RELATIVE. I treated them as if my nonlinear
system converged, accepted the nonlinear solution, and then
proceeded to the next time step of my simulation. Apparently,
such practice has worked well in most cases, (even when I
encountered suspicious DIVERGED_LINE_SEARCH behaviors).
However, I wonder if there are any potential pitfalls in my
practice such as missing a nonlinear solve divergence and
taking a partial solution as the correct solution.
Thank you very much for your time and help.
Best,
Dafang
On 03/15/2014 11:15 AM, Barry Smith wrote:
Failed line search are almost always due to an
incorrect Jacobian. Please let us know if the suggestions
at
http://www.mcs.anl.gov/petsc/documentation/faq.html#newton don't
help.
Barry
On Mar 14, 2014, at 8:57 PM, Dafang Wang
<[email protected] <mailto:[email protected]>> wrote:
Hi,
Does anyone know what the error code
DIVERGED_LINE_SEARCH means in the SNES nonlinear
solve? Or what scenario would lead to this error code?
Running a solid mechanics simulation, I found that
the occurrence of DIVERGED_LINE_SEARCH was very
unpredictable and sensitive to the input values to my
nonlinear system, although my system should not be
that unstable. As shown by the two examples below, my
system diverged in one case and converged in the
other, although the input values in these two cases
differed by only 1e-4,
Moreover, the Newton steps in the two cases were very
similar up to NL step 1. Since then, however, Case 1
encountered a line-search divergence whereas Case 2
converged successfully. This is my main confusion.
(Note that each residual vector contains 3e04 DOF, so
when their L2 norms differ within 1e-4, the two
systems should be very close.)
My simulation input consists of two scalar values (p1
and p2), each of which acts as a constant pressure
boundary condition.
Case 1, diverge:
p1= -10.190869 p2= -2.367555
NL step 0, |residual|_2 = 1.621402e-02
Line search: Using full step: fnorm
1.621401550027e-02 gnorm 7.022558235262e-05
NL step 1, |residual|_2 = 7.022558e-05
Line search: Using full step: fnorm
7.022558235262e-05 gnorm 1.636418730611e-06
NL step 2, |residual|_2 = 1.636419e-06
Nonlinear solve did not converge due to
DIVERGED_LINE_SEARCH iterations 2
Case 2: converge:
p1= -10.190747 p2= -2.367558
NL step 0, |residual|_2 = 1.621380e-02
Line search: Using full step: fnorm
1.621379778276e-02 gnorm 6.976373804153e-05
NL step 1, |residual|_2 = 6.976374e-05
Line search: Using full step: fnorm
6.976373804153e-05 gnorm 4.000992847275e-07
NL step 2, |residual|_2 = 4.000993e-07
Line search: Using full step: fnorm
4.000992847275e-07 gnorm 1.621646014441e-08
NL step 3, |residual|_2 = 1.621646e-08
Nonlinear solve converged due to
CONVERGED_SNORM_RELATIVE iterations 3
Aside from the input values, the initial solution in
both cases may differ very slightly. (Each case is
one time step in a time-sequence simulation. The two
cases behaved nearly identically up to the last time
step before the step shown above, so their initial
solutions may differ by a cumulative error but such
error should be very small.) Is it possible that
little difference in initial guess leads to different
local minimum regions where the line search in Case 1
failed?
Any comments will be greatly appreciated.
Thanks,
Dafang
--
Dafang Wang, Ph.D
Postdoctoral Fellow
Institute of Computational Medicine
Department of Biomedical Engineering
Johns Hopkins University
Hackerman Hall Room 218
Baltimore, MD, 21218
--
Dafang Wang, Ph.D
Postdoctoral Fellow
Institute of Computational Medicine
Department of Biomedical Engineering
Johns Hopkins University
Hackerman Hall Room 218
Baltimore, MD, 21218
--
Dafang Wang, Ph.D
Postdoctoral Fellow
Institute of Computational Medicine
Department of Biomedical Engineering
Johns Hopkins University
Hackerman Hall Room 218
Baltimore, MD, 21218
--
Dafang Wang, Ph.D
Postdoctoral Fellow
Institute of Computational Medicine
Department of Biomedical Engineering
Johns Hopkins University
Hackerman Hall Room 218
Baltimore, MD, 21218