niconc.c, Robert's patch on NaN
This commit is contained in:
parent
ee269e437d
commit
db5c33efb0
|
|
@ -13,7 +13,7 @@ Author: 1985 Thomas L. Quarles
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
#include "ngspice/cktdefs.h"
|
#include "ngspice/cktdefs.h"
|
||||||
#include "ngspice/smpdefs.h"
|
#include "ngspice/smpdefs.h"
|
||||||
|
extern bool ft_ngdebug;
|
||||||
|
|
||||||
int
|
int
|
||||||
NIconvTest(CKTcircuit *ckt)
|
NIconvTest(CKTcircuit *ckt)
|
||||||
|
|
@ -38,6 +38,12 @@ NIconvTest(CKTcircuit *ckt)
|
||||||
node = node->next;
|
node = node->next;
|
||||||
new = ckt->CKTrhs [i] ;
|
new = ckt->CKTrhs [i] ;
|
||||||
old = ckt->CKTrhsOld [i] ;
|
old = ckt->CKTrhsOld [i] ;
|
||||||
|
if (isnan(new)) {
|
||||||
|
if (ft_ngdebug) {
|
||||||
|
fprintf(stderr, "Warning: non-convergence, node %s is nan\n", CKTnodName(ckt, i));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if(node->type == SP_VOLTAGE) {
|
if(node->type == SP_VOLTAGE) {
|
||||||
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
||||||
ckt->CKTvoltTol;
|
ckt->CKTvoltTol;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue