Skip to content

Commit

Permalink
[1D] Fixed a case where the Newton solver could get stuck
Browse files Browse the repository at this point in the history
Sometimes, while trying to solve the steady-state problem, the Newton solver
would get stuck in a loop where it couldn't find a suitable damping ratio even
after re-revaluating the Jacobian, causing it to get stuck in an loop where it
would keep re-evaluating the Jacobian at the same point (i.e. without having
made a successful damped step).

This change detects this condition and stops the Newton solver so that the 1D
solver can advance the solution by timestepping before trying to solve the
steady-state problem again.
  • Loading branch information
speth committed Jan 22, 2013
1 parent 021f578 commit 80f3c9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/oneD/MultiNewton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ int MultiNewton::solve(doublereal* x0, doublereal* x1,
bool frst = true;
doublereal rdt = r.rdt();
int j0 = jac.nEvals();
int nJacReeval = 0;

while (1 > 0) {

Expand Down Expand Up @@ -370,6 +371,10 @@ int MultiNewton::solve(doublereal* x0, doublereal* x1,
else if (m < 0) {
if (jac.age() > 1) {
forceNewJac = true;
if (nJacReeval > 3) {
goto done;
}
nJacReeval++;
if (loglevel > 0)
writelog("\nRe-evaluating Jacobian, since no damping "
"coefficient\ncould be found with this Jacobian.\n");
Expand Down

0 comments on commit 80f3c9d

Please sign in to comment.