[1D] Fixed a case where the Newton solver could get stuck
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.
This commit is contained in:
parent
021f578ebd
commit
80f3c9d24d
1 changed files with 5 additions and 0 deletions
|
|
@ -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) {
|
||||
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue