From: al davis <ad212@fr...>  20130723 17:41:26

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. > 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. It might be worth investigating someday. Note that the inductor is a plugin. The core engine has no knowledge of any specific component. > The only thing that makes me a bit skeptical is the fact that > leaving out the node makes the resulting equation even more > nonlinear. Such equations aren't that wellresearched for > their theoretical and numerical properties, and the > algorithm that I'd like to implement later requires > linearity in the derivatives. What makes me more skeptical is that preanalysis can take a significant amount of time. You might argue that it is only done once, but if the preanalysis takes quadratic time, with a big enough circuit the quadratic part will dominate. 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. 