From 091b48dc74b9a9390ceef7434dc3f9cdbd422a84 Mon Sep 17 00:00:00 2001 From: rzyu45 Date: Sun, 4 Aug 2024 19:08:27 +0800 Subject: [PATCH] fix: update fdaesolver --- Solverz/solvers/fdesolver.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Solverz/solvers/fdesolver.py b/Solverz/solvers/fdesolver.py index 68d5719..0a065c4 100644 --- a/Solverz/solvers/fdesolver.py +++ b/Solverz/solvers/fdesolver.py @@ -90,10 +90,9 @@ def fdae_solver(fdae: nFDAE, sol = nr_method(ae, u0, Opt(ite_tol=opt.ite_tol, stats=True)) u1 = sol.y - ite = sol.stats - stats.ndecomp = stats.ndecomp + ite - stats.nfeval = stats.nfeval + ite + 1 - if ite >= 100: + stats.ndecomp = stats.ndecomp + sol.stats.ndecomp + stats.nfeval = stats.nfeval + stats.nfeval + if stats.nstep >= 100: print(f"FDAE solver broke at time={tt} due to non-convergence") break