From: Soeren D. Schulze <soeren.d.schulze@gm...>  20130723 21:42:12

Am 23.07.2013 19:41, schrieb al davis: > On Tuesday 23 July 2013, Soeren D. Schulze wrote: >>> Another way is to add another equation, the equivalent of >>> an extra node, representing the current. (Nullor >>> model) Gnucap could do it this way, but doesn't. Another >>> voltagesource plugin would give you a choice. It messes >>> up the pattern of the matrix. >> >> Is it only a performance issue or are there other reasons why >> this is bad? If I interpret the source code correctly, >> gnucap makes use of the matrix being positive definite by >> doing LU decomposition without pivoting. (If so, have you >> considered using Cholesky decomposition, by the way?) > > Only passive circuits are truly symmetric, which is why not > Cholesky decomposition. > > Gnucap allocates the matrix as structurally symmetric, but not > numerically symmetric. Strictly, this is not the most efficient > at storage space or matrix solve time, but it pays off in other > ways, such as a simpler allocation scheme, preservation of > blocks, vector storage. So it is a good tradeoff. > > Preservation of blocks is important. Gnucap does not update or > solve the whole matrix every step. Most of the time it does > lowrank updates and partial solutions. Often, it will only > solve the whole matrix once for a complete simulation. But at > all times, it gives the illusion of doing and having it all. OK, so the structure that you want to preserve is having appropriate pivot elements on the diagonal, so lowrank updates can be done. Is that correct? >> What does gnucap do if you put two inductors in series, with >> something else connected to the node inbetween? Does it >> merge all three nodes into a supernode? That's also >> interesting because doing so could eliminate another source >> of accidental differentiations. > > There is no collapsing of nodes. Then I don't understand how inductors are modeled in gnucap, sorry. > It seems you have indicated a preference for a statevariable > formulation instead of a modifiednodal formulation, or perhaps > just a curiosity about it. There were experiments with this > long ago ... around 1970. An early book on simulation discusses > it at length. I don't have it handy, don't know the title, but > I believe the author was Leon Chua. As I recall, it works well > for simple problems but when the circuits get large and complex, > the complexity of generating the formulation gets out of hand. > In this context, large is by 1970 standards. Well, I'm considering them from a mathematical perspective. Even if they don't work well for large circuits, they may still be interesting for circuits that are small but tricky. On the other hand, the mathematical papers argue like this: "Everybody uses MNA, so we'll do the same thing", and they make huge efforts to improve the mathematical properties... like http://opus.kobv.de/tuberlin/volltexte/2007/1524/pdf/baechle_simone.pdf I'm still surprised that nobody has ever questioned the practice of obtaining the next integration step directly from the nonlinear equation ("factoring out the Jacobian") rather than computing an update and adding that to the previous one, which is, according to the theory, much better. If you implement Newton's method like xnew = J^(1) * (... something dependent on xold ...), then J needs to be absolutely accurate and wellconditioned, and the LU decomposition needs to be uptodate in every step. If, on the other hand, you do it like: xnew = xold  J^(1) * f(xold), then J resp. its LU decomposition can be held constant for at least one integration step (resulting in simplified Newton's method) or maybe even more than one (such as implemented in the code radau5). The former is what Qucs does. If I understand it right, Spice and gnucap do the same thing, essentially. Is that correct? Sören 