Confused with MDUMP and MRDUMP commands !

Help
2012-03-01
2013-06-12
  • Mansour. RD.

    Mansour. RD. - 2012-03-01

    Hi,

    I was trying to understand how the newly added commands (mdump and mrdump), to dump circuit matrices,  work. I ran a simple resistive circuit in ngspice:

    Simple resisitive network
    R1 n1 n2 1
    R2 n2 n3 1
    R3 n2 0 0.5
    R4 n3 0 1
    V1 n1 0 DC 2
    .END

    According to the circuit, for a DC analysis, the command "mdump" should give me a matrix like:
    1  -1  0  1
    -1  4  -1  0
    0  -1  2 0
    and the RHS vector should be
    0
    0
    0
    2

    but, mdump gives:

    Matrix after factorization:
                 1         2         3         4

       1         1        -1       …         1
       2        -1      0.25     -0.25       …
       3       …        -1     0.571       …
       4         1       …       …       …

    and mrdump gives:
    2
    0.571428571428571
    0.285714285714286
    -1.42857142857143
    which is in fact the solution vector not RHS !

    Can anyone help me please with this?

    Thanks,
    M. R. darabad

     
  • Holger Vogt

    Holger Vogt - 2012-03-06

    Hi,

    if I load the circuit

    Simple resisitive network
    R1 n1 n2 1
    R2 n2 n3 1
    R3 n2 0 0.5
    R4 n3 0 1
    V1 n1 0 DC 2
    .END

    in interactive mode, e.g. by the source command, then run an operating point analysis
    op
    I get the following output:
    ngspice 4 -> mrdump
    0
    0
    0
    2
    ngspice 5 -> mdump
    MATRIX SUMMARY

    Size of matrix = 4 x 4.

    Matrix before factorization:
                 1         2         3         4

       1         1        -1       …         1
       2        -1         4        -1       …
       3       …        -1         2       …
       4         1       …       …       …

    Largest element in matrix = 4.
    Smallest element in matrix = 1.

    Largest pivot element = 4.
    Smallest pivot element = 1.

    Density = 56.25%.
    Number of originals = 9.
    Number of fill-ins = 0.

    Holger

     
  • Mansour. RD.

    Mansour. RD. - 2012-03-06

    Dear Holger,

    Many thanks for your great help. During the previous few weeks, your replies to a couple of my posts made a great impact on the progress of my project. I really appreciate that.

    Best,
    Mansour

     
  • Mansour. RD.

    Mansour. RD. - 2012-03-07

    Dear Holger,

    I performed the Operation Point analysis and got the matrix before factorization. But the problem is that when using OP analysis elements such as capacitors and inductors will be taken as redundant.

    Is there any way to access the matrix before factorization during each step of for example Transient analysis?

    In the presence of non-linear elements, at each iteration SPICE linearises the non-linear equations and then solves it. In fact, I need the matrix right after linearisation and before factorization. Is it possible?

    Cheers,
    Mansour

     
  • Holger Vogt

    Holger Vogt - 2012-03-08

    Mansour,
    mdump prints out ckt->CKTmatrix of the actual circuit, mrdump prints out ckt->CKTrhs and, if available ckt->CKTirhs (imaginary part). Iam not aware of any other easily accessible data structure of the matrix.

    Of course ngspice is Open Source, so you may delve into the source code and figure out how the matrix is generated, stored and manipulated at every internal step. Unfortunately I cannot do this job for you. Maybe somebody else, being more literate in these internals, may give you an advice where to look at.

    Regards

    Holger

     
  • Mansour. RD.

    Mansour. RD. - 2012-03-08

    Dear Holger,

    Thank you for your advice. I will try to somehow sort it out my self by looking at the source code.

    Best,
    Mansour

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks