[Ktechlab-devel] Converting to Eigen - patch for revision, ver.1
Alan Grimes
agrimes at speakeasy.net
Sun Aug 9 17:26:46 UTC 2009
P Zoltan wrote:
> here is a patch that makes ktechlab to use Eigen for calculations, so
> the internal matrix implementation can be removed.
=)
> Known problems:
> - the caching and changed/unchanged flags probabily don't work as they
> should
I think that's where your memory leak is. It tries to cache everything
and runs out of memory.
> - when inserting a reactive element in the circuit, the cpu usage will
> increase to 100% after a time. Probable causes are that eigen uses great
> precision calculation, so the circuit will never enter in steady state.
> Or just some caching problem...
> Todos:
> - test it :D
> - we'll have to define _clearly_ the algorithms and data structures
> used in the cirucit solving process. Currently I don't know how the A, b
> changed flags should work and what is the purpose of CNode and CBranch
> classes, how/when the iterations shoud be done, and so on...
When the circuit is in a steady state, it doesn't make any sense to
recompute LU. (simply solve LbU = x ) or something like that.
Note: the function call you make "mp_lu->rank() == 0" is equivalent to a
correct version of my "validate()" function. Ie, when rank = 0, the
matrix is singular/invalid/unsolvable. -- IIRC. Since I'm a dunce, I
hacked together the validate() function in an attempt to detect bugs in
the components as early as possible. asking "rank() == 0?" does the same
thing.
> Here is the sketch of the algorithm (should be extended...):
> if a component is added, removed, connected, ... in the circuitdocument:
> split the document in circuits, by connectivity
> create elementset from the circuit
> create the matrix corresponding to the elements
> a step in the simulator:
> if the circuit contains nonlinear elements
> solve the cirucit by iterations
> in each iteration
> call the handler of nonlinear elements
> recreate the LU of the eqation matrix
> update nodes (why?)
Could you point me to a class, method and line number for that so that I
can explain it?
> run logic (here -- why?)
-- cuz you could have triggered a state change.
> check for convergence
> else
> solve as a linear system
> run logic
> (where are the components updated?)
--
New president: Here we go again...
Chemistry.com: A total rip-off.
Powers are not rights.
More information about the Ktechlab-devel
mailing list