Re: [Qucs-devel] Adams methods From: Soeren D. Schulze - 2013-07-23 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 >>> voltage-source 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 > low-rank 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 low-rank 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 in-between? Does it >> merge all three nodes into a super-node? 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 state-variable > formulation instead of a modified-nodal 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 non-linear 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 well-conditioned, and the LU decomposition needs to be up-to-date 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 ```