From 55ba9279739cca83b4129c6316d48a9221b10568 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 14 Nov 2023 16:57:14 +0100 Subject: [PATCH] If nan occurs during op calculation, issue the warning no more than 10 times. --- src/maths/ni/niconv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/maths/ni/niconv.c b/src/maths/ni/niconv.c index c147caf43..6acf3688b 100644 --- a/src/maths/ni/niconv.c +++ b/src/maths/ni/niconv.c @@ -26,6 +26,7 @@ NIconvTest(CKTcircuit *ckt) double old; double new; double tol; + static int nancount = 0; node = ckt->CKTnodes; size = SMPmatSize(ckt->CKTmatrix); @@ -41,8 +42,13 @@ NIconvTest(CKTcircuit *ckt) new = ckt->CKTrhs [i] ; old = ckt->CKTrhsOld [i] ; if (isnan(new)) { - if (ft_ngdebug) + if (ft_ngdebug && nancount < 10) { fprintf(stderr, "Warning: non-convergence, node %s is nan\n", CKTnodName(ckt, i)); + nancount++; + } + else if (ft_ngdebug && nancount == 10) { + fprintf(stderr, " non-convergence warnings (nan) limited to 10\n", CKTnodName(ckt, i)); + } return 1; } if(node->type == SP_VOLTAGE) {