Too many iterations without convergence

Help
jlu
2014-06-16
2014-06-17
  • jlu
    jlu
    2014-06-16

    Hello,
    I am running the following circuit and ngspice says "too many iterations without convergence". Can anyone help to point out the problem of the circuit? Thanks.

    Title
    .param V1= 0.5807781314272854
    .param V2= 0.5729973511589843
    .param V3= 0.007784790364188221
    .param IC_L1= 0.004023158557320163
    .param IC_L2= 0.004023158557305253
    .param Vm= 0.85074763738479
    .param dt= 8.289813665123563e-14

    .option noacct

    .tran {dt/2} {dt} uic
    .ic v(1)={V1}
    .ic v(2)={V2}
    .ic v(3)={V3}

    vin 1 0 pwl(0 {V1} {dt} {Vm})

    L1 1 2 0.6n IC={IC_L1}

    C1 2 3 0.35p
    D1 2 3 Diode

    L2 3 0 0.6n IC={IC_L2}

    .model Diode D (IS=0.5p, N=1.3,VJ=0.5, M=0.235, RS=0.00,IBV=10u, BV=60,TT=30n,FC=0.8)

    .probe V(1) V(2) V(3) I(L1) I(L2) I(vin)

    .end

     
  • Justin Fisher
    Justin Fisher
    2014-06-16

    What happens if you add some resistance either to the diode model or add some series resistance to the inductor?

     
    • jlu
      jlu
      2014-06-17

      Thanks for your reply. But I got the same problem for a another set of parameters.

      Title
      .param V1= 0.2227857410542457
      .param V2= 0.2436948776665285
      .param V3= 0.2436940948945558
      .param V4= -0.02090965713042856
      .param IC_L1= 0.001811037646870565
      .param IC_L2= 0.00181103764686996
      .param Vm= 0.2220159807804962
      .param dt= 8.289813665123563e-14

      .option noacct

      .tran {dt/2} {dt} uic
      .ic v(1)={V1}
      .ic v(2)={V2}
      .ic v(3)={V3}
      .ic v(4)={V4}

      vin 1 0 pwl(0 {V1} {dt} {Vm})

      L1 1 2 0.6n IC={IC_L1}

      C1 2 4 0.35p
      R1 2 3 0.13
      D1 3 4 Diode

      L2 4 0 0.6n IC={IC_L2}

      .model Diode D (IS=0.5p, N=1.3,VJ=0.5, M=0.235, RS=0.00,IBV=10u, BV=60,TT=30n,FC=0.8)

      .probe V(1) V(2) V(3) V(4) I(L1) I(L2) I(vin)

      .end

       
      • marcel hendrix
        marcel hendrix
        2014-06-17

        * initcond2.asc
        V1 1 0 PWL(0 {V1} {dt} {Vm})
        L1 1 2 0.6n ic={ic_L1}
        C1 2 4 0.35pF
        D1 3 4 diode
        L2 4 0 0.6n ic={ic_L2}
        R1 3 2 0.13
        .param V1= 0.2227857410542457
        .param V2= 0.2436948776665285
        .param V3= 0.2436940948945558
        .param V4= -0.02090965713042856
        .param IC_L1= 0.001811037646870565
        .param IC_L2= 0.00181103764686996
        .param Vm= 0.2220159807804962
        .param dt= 8.289813665123563e-14
        .tran 0 1ns 0 10p uic
        .ic v(1)={V1}
        .ic v(2)={V2}
        .ic v(3)={V3}
        .ic v(4)={v4}
        .model diode D (IS=0.5p, N=1.3, VJ=0.5, M=0.235, RS=0.00,IBV=10u, BV=60,TT=30n,FC=0.8)
        .options method=gear reltol=0.00001
        
        .control
        run
        write initcon2.raw
        quit
        .endc
        
        .end
        
         
  • Can you post the entire GMIN Stepping log?

     
    • jlu
      jlu
      2014-06-17

      How do I print the Gmin stepping log in ngspice?

       
      • marcel hendrix
        marcel hendrix
        2014-06-17

        Your circuit is special in that the needed time steps
        are too small for double precision. Therefore the
        simulator can't even start Gmin stepping. I think you
        will see Gmin stepping in action if you scale the
        problem from THz to MHz or something (watch stdout
        and stderr).

        -marcel

         
        • You should have GMIN Stepping in your log on screen. If you don't have it, NGSPICE skips the Operating Point calculation and go directly to transient analysis. Consider that THz isn't a good frequency for a simple circuit simulator, as far as I know.

          Fra

           
  • marcel hendrix
    marcel hendrix
    2014-06-16

    The problem is your dt=8e-14s parameter. This forces NGSPICE to make
    (a) step(s) smaller than 1e-16 (impossible with double precision).

    The following netlist approximates what you wanted to do:

    The outcome looks good, but the reltol cannot be decreased further.
    (same eps problem).

    -marcel

    * initial condition
    V1 1 0 PWL(0 {V1} {dt} {Vm})
    L1 1 2 0.6n ic={ic_L1}
    C1 2 3 0.35pF
    D1 3 4 diode
    L2 4 0 0.6n ic={ic_L2}
    .param V1= 0.5807781314272854
    .param V2= 0.5729973511589843
    .param V3= 0.007784790364188221
    .param IC_L1= 0.004023158557320163
    .param IC_L2= 0.004023158557305253
    .param Vm= 0.85074763738479
    .param dt= 8.289813665123563e-14
    .tran 0 1ns 0 0.01ps uic
    .ic v(1)={V1}
    .ic v(2)={V2}
    .ic v(3)={V3}
    .model diode D (IS=0.5p, N=1.3,VJ=0.5, M=0.235, RS=0.00,IBV=10u, BV=60,TT=30n,FC=0.8)
    .options method=gear reltol=1u
    
    .control
    run
    write initcond.raw
    quit
    .endc 
    
    .end
    
     
    • jlu
      jlu
      2014-06-17

      Thanks for the reply. But this doesn't work for the following parameters
      .param V1= 0.5129123947646534
      .param V2= 0.5092301024275252
      .param V3= 0.003682065093030373
      .param IC_L1= 0.002363720526097682
      .param IC_L2= 0.002363720525939674
      .param Vm= 0.5137225627782168
      .param dt= 8.289813665123563e-14

      As you suggested, increasing the value of reltol still helps. But how to predict the value of reltol before running the netlist? Or it is impossible?

      And I cannot understand the why a number of double precision cannot be less than 1e-16?

       
  • marcel hendrix
    marcel hendrix
    2014-06-17

    Dear jlu,

    Actually, increasing reltol does not help, it makes the problem harder.
    As you probably noticed, setting reltol = 0.001 (the default), lets the
    simulation finish without problems. I set reltol as high as possible
    because you seem to want very accurate results. In practice you
    can kill every simulation by increasing reltol too much.

    Your first problem has a discontinuity that really needs reltol=1e-6 to
    show realistic results. Your second circuit is nicely behaved and
    works for reltol=0.001 (the result is clearly wrong for reltol=0.01).

    But how to predict the value of reltol before running the netlist?
    Or it is impossible?

    It sets the 'quality' you demand. It normally does not influence the
    convergence, but the signals may be wrong for too high values. Once
    the circuit converges you can run it for two different values of
    reltol. Stop when the results differ 'insignificantly' (as defined by you).

    And I cannot understand the why a number of double precision cannot
    be less than 1e-16?

    It can (down to 1e-308 or so). However, the minimum mantissa difference
    between two fp numbers is about 1e-16. You run into that here for the
    time step.

    It is possible to recompile NGSPICE for long double or even double
    double (but the config fails currently). That would be an interesting
    experiment (double double would be very slow).

    -marcel

     
    • Could KCL Verification help in this case?
      If so, I have to update the diode model to take advantage of it.

      Fra

       
    • jlu
      jlu
      2014-06-17

      Thanks very much for the explanation, marcel.

       
  • marcel hendrix
    marcel hendrix
    2014-06-17

    Hi Francesco,

    As I understand it KCL should have less convergence
    problems (although with THz circuit it simply can't
    help), and also allow smaller time steps (i.e. more
    accurate results when reltol is decreased).

    Please update KCL regardless, it would be great
    if we can use it for all (X)SPICE work :-)

    -marcel

     
  • Hi Marcel,
    as far as I know, KCL solves the False Convergence Phenomenon, so it should help convergence. I can try to update the diode model; this will help also to if my implementation is correct, as I hope! :)