nicomcof.c: xmu used to calculate trap integration coefficient

This commit is contained in:
h_vogt 2013-06-09 11:06:05 +02:00
parent 2c5b78c18b
commit d269bd3805
1 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,11 @@ Author: 1985 Thomas L. Quarles
#include "ngspice/cktdefs.h"
#include "ngspice/sperror.h"
/* xmu=0: Backward Euler, xmu=0.5: trapezoidal (standard),
xmu=0.48: good damping of current ringing, e.g. in R.O.s.
SpiceOpus adapts xmu to lower values if numerical oscillations
of current in capacitors are detected, t.b.d. */
#define xmu 0.5
int
NIcomCof(CKTcircuit *ckt)
@ -17,6 +22,7 @@ NIcomCof(CKTcircuit *ckt)
double arg;
double arg1;
/* this routine calculates the timestep-dependent terms used in the
* numerical integration.
*/
@ -35,10 +41,8 @@ NIcomCof(CKTcircuit *ckt)
break;
case 2:
ckt->CKTag[0]=1.0/ckt->CKTdelta/(1.0-0.5) ;
ckt->CKTag[1]=0.5/(1.0 - 0.5) ;
/* above lines should have 'xmu' instead of .5 eventually */
/* (in all three places) */
ckt->CKTag[0] = 1.0 / ckt->CKTdelta/(1.0 - xmu) ;
ckt->CKTag[1] = xmu / (1.0 - xmu) ;
break;
default: