Browse Source

If nan occurs during op calculation, issue the warning

no more than 10 times.
pre-master-46
Holger Vogt 2 years ago
parent
commit
55ba927973
  1. 8
      src/maths/ni/niconv.c

8
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) {

Loading…
Cancel
Save