ni/niiter.c, bug fix, CKTrhsOld is meant to return the solution

when solving
  circuitmatrix . x = rhs
in function NIiter()

The result es expected to be delivered in CKTrhsOld.
CKTrhs is meant to store leftover garbage when returning from NIiter()

this can be seen most notably in CKTdump(), and in other iters,
  for example NIacIter()

as a consequence the solution of the second to last iteration
  was used, instead of the very last iteration.
This can be quite inaccurate if the second to last iteration
  was marked CKTnoncon by somebody.
In my case this was the caused by the convlimit option in xpsice
  which intentionally uses incorrect values and correctly markes
  the results unusable with CKTnoncon.
This commit is contained in:
rlar 2018-01-29 17:53:07 +01:00
parent caf3115733
commit 7fd4a22060
1 changed files with 1 additions and 0 deletions

View File

@ -237,6 +237,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
if (ckt->CKTnoncon == 0) {
ckt->CKTstat->STATnumIter += iterno;
FREE(OldCKTstate0);
SWAP(double *, ckt->CKTrhs, ckt->CKTrhsOld);
return(OK);
}
} else if (ckt->CKTmode & MODEINITJCT) {