cse 245: computer aided circuit simulation and verification

51
CSE 245: Computer Aided Circuit Simulation and Verification Spring 2010 Nonlinear Equation

Upload: jordan-huffman

Post on 30-Dec-2015

31 views

Category:

Documents


1 download

DESCRIPTION

CSE 245: Computer Aided Circuit Simulation and Verification. Spring 2010 Nonlinear Equation. Outline. Nonlinear problems Iterative Methods Newton ’ s Method Derivation of Newton Quadratic Convergence Examples Convergence Testing Multidimensonal Newton Method Basic Algorithm - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSE 245: Computer Aided Circuit Simulation and Verification

CSE 245: Computer Aided Circuit Simulation and Verification

Spring 2010

Nonlinear Equation

Page 2: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 2 courtesy Alessandra Nardi UCB

Outline Nonlinear problems Iterative Methods Newton’s Method

Derivation of Newton Quadratic Convergence Examples Convergence Testing

Multidimensonal Newton Method Basic Algorithm Quadratic convergence Application to circuits

Improve Convergence Limiting Schemes

Direction Corrupting Non corrupting (Damped Newton)

Continuation Schemes Source stepping

Page 3: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 3 courtesy Alessandra Nardi UCB

Need to Solve

( 1) 0d

t

VV

d sI I e

Nonlinear Problems - Example

0

1

IrI1 Id

0)1(1

0

11

1

1

IeIeR

III

tV

e

s

dr

11)( Ieg

Page 4: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 4 courtesy Alessandra Nardi UCB

Nonlinear Equations Given g(V)=I It can be expressed as: f(V)=g(V)-I

Solve g(V)=I equivalent to solve f(V)=0

Hard to find analytical solution for f(x)=0

Solve iteratively

Page 5: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 5 courtesy Alessandra Nardi UCB

Nonlinear Equations – Iterative Methods

Start from an initial value x0

Generate a sequence of iterate xn-1, xn, xn+1 which hopefully converges to the solution x*

Iterates are generated according to an iteration function F: xn+1=F(xn)

Ask• When does it converge to correct solution ?• What is the convergence rate ?

Page 6: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 6 courtesy Alessandra Nardi UCB

Newton-Raphson (NR) Method

Consists of linearizing the system.Want to solve f(x)=0 Replace f(x) with its linearized version and solve.

Note: at each step need to evaluate f and f’

functionIterationxfdx

xdfxx

xxdx

xdfxfxf

iesTaylor Serxxdx

xdfxfxf

kk

kk

kkk

kk

)()(

)()(

)()(

)()(

)()(

1

1

11

**

*

Page 7: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 7 courtesy Alessandra Nardi UCB

Newton-Raphson Method – Graphical View

Page 8: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 8 courtesy Alessandra Nardi UCB

Newton-Raphson Method – Algorithm

Define iteration

Do k = 0 to ….

until convergence

How about convergence? An iteration {x(k)} is said to converge with order q if

there exists a vector norm such that for each k N:

qkk xxxx ˆˆ1

)()(

1

1 kk

kk xfdx

xdfxx

)(

)(1

1 kk

kk xfdx

xdfxx

)(

)(1

1 kk

kk xfdx

xdfxx

Page 9: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 9 courtesy Alessandra Nardi UCB

Mean Value theoremtruncates Taylor seriesBut

by Newtondefinition

Newton-Raphson Method – Convergence

2*2

2** )(

)~()(

)()()(0 kk

kk xx

dx

xfdxx

dx

xdfxfxf

)()(

)(0 1 kkk

k xxdx

xdfxf

Page 10: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 10 courtesy Alessandra Nardi UCB

Subtracting

21 * 1 * 2

2 ( ) [ ( )] ( )( )k k kdf d f

x x x x x xdx d x

Convergence is quadratic

Dividing through

21

2

21 * *

Let [ ( )] ( )

then

k k

k k k

df d fx x K

dx d x

x x K x x

Newton-Raphson Method – Convergence

2*2

2*1 )(

)~()(

)(xx

dx

xfdxx

dx

xdf kkk

Page 11: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 11 courtesy Alessandra Nardi UCB

Local Convergence Theorem

If

Then Newton’s method converges given a sufficiently close initial guess (and

convergence is quadratic)

boundedisK

boundeddx

fdb

roay from zebounded awdx

dfa

)

)

2

2

Newton-Raphson Method – Convergence

Page 12: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 12 courtesy Alessandra Nardi UCB

21

2 21 * * *

* 2

2

1 *

*

( ) 2

( ) 1 0,

2 ( ) 1

2 ( ) 2 ( )

1( ) (

( 1

)2

)

k k

k k k k

k k k k k

k kk

dfx x

dx

x x x x

x x x x x x x

f x x fin

x

d x x

or x x x xx

Convergence is quadratic

Newton-Raphson Method – Convergence

Example 1

Page 13: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 13 courtesy Alessandra Nardi UCB

1 2

1 *

* *1

2 *

( ) 2

2 ( 0) ( 0)

10 0

( ) 0,

for 02

1( ) ( )

2

0

k k

k k k

k k k

k k

dfx x

dx

x x x

x x x x

or x x x

f x

x

x x

Convergence is linear

Note : not bounded

away from zero

1df

dx

Newton-Raphson Method – Convergence

Example 2

Page 14: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 14 courtesy Alessandra Nardi UCB

Newton-Raphson Method – Convergence

Example 1,2

Page 15: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 15 courtesy Alessandra Nardi UCB

0 Initial Guess,= 0x k

Repeat { 1

k

k k kf x

x x f xx

} Until ?

1 1? ?k k kf x thresholdx x threshold

1k k

Newton-Raphson Method – Convergence

Page 16: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 16 courtesy Alessandra Nardi UCB

Need a "delta-x" check to avoid false convergence

X

f(x)

1kx kx *x

1 a

kff x

1 1 a r

k k kx xx x x

Newton-Raphson Method – Convergence

Convergence Check

Page 17: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 17 courtesy Alessandra Nardi UCB

Also need an " " check to avoid false convergencef x

X

f(x)

1kx kx

*x

1 a

kff x

1 1 a r

k k kx xx x x

Newton-Raphson Method – Convergence

Convergence Check

Page 18: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 18 courtesy Alessandra Nardi UCB

demo2

Newton-Raphson Method – Convergence

Page 19: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 19 courtesy Alessandra Nardi UCB

X

f(x)

Convergence Depends on a Good Initial Guess

0x

1x2x 0x

1x

Newton-Raphson Method – Convergence

Local Convergence

Page 20: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 20 courtesy Alessandra Nardi UCB

Convergence Depends on a Good Initial Guess

Newton-Raphson Method – Convergence

Local Convergence

Page 21: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 21 courtesy Alessandra Nardi UCB

Nodal Analysis

1 2At Node 1: 0i i

1bv

+

-

1i2i 2

bv

3i+ -

3bv

+

-

NonlinearResistors

i g v

1v2v

1 1 2 0g v g v v

3 2At Node 2: 0i i

3 1 2 0g v g v v

Two coupled nonlinear equations in two unknowns

Nonlinear Problems – Multidimensional Example

Page 22: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 22 courtesy Alessandra Nardi UCB

Outline Nonlinear problems Iterative Methods Newton’s Method

Derivation of Newton Quadratic Convergence Examples Convergence Testing

Multidimensonal Newton Method Basic Algorithm Quadratic convergence Application to circuits

Improve Convergence Limiting Schemes

Direction Corrupting Non corrupting (Damped Newton)

Continuation Schemes Source stepping

Page 23: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 23 courtesy Alessandra Nardi UCB

* *Problem: Find such tha 0t x F x * N N N and : x F

Multidimensional Newton Method

functionIterationxFxJxx

atrixJacobian M

x

xF

x

xF

x

xF

x

xF

xJ

iesTaylor SerxxxJxFxF

kkkk

N

NN

N

)()(

)()(

)()(

)(

))(()()(

11

1

1

1

1

***

Page 24: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 24 courtesy Alessandra Nardi UCB

Multidimensional Newton Method

)()()( :solve Instead

sparse).not is(it )( computenot Do

)()(:

1

1

11

kkkk

k

kkkk

xFxxxJ

xJ

xFxJxxIteration

Each iteration requires:1. Evaluation of F(xk)2. Computation of J(xk) 3. Solution of a linear system of algebraic

equations whose coefficient matrix is J(xk) and whose RHS is -F(xk)

Computational Aspects

Page 25: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 25 courtesy Alessandra Nardi UCB

0 Initial Guess,= 0x k

Repeat {

1 1Solve for k k k k kFJ x x x F x x

} Until 11 , small en ug o hkk kx x f x

1k k

Compute ,k kFF x J x

Multidimensional Newton Method

Algorithm

Page 26: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 26 courtesy Alessandra Nardi UCB

If

1) Inverse is boundedkFa J x

) Derivative is Lipschitz ContF Fb J x J y x y

Then Newton’s method converges given a sufficiently close initial guess (and

convergence is quadratic)

Multidimensional Newton Method

Local Convergence TheoremConvergence

Page 27: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 27 courtesy Alessandra Nardi UCB

Application of NR to Circuit Equations

Applying NR to the system of equations we find that at iteration k+1: all the coefficients of KCL, KVL and of BCE of the

linear elements remain unchanged with respect to iteration k

Nonlinear elements are represented by a linearization of BCE around iteration k

This system of equations can be interpreted as the STA of a linear circuit (companion network) whose elements are specified by the linearized BCE.

Companion Network

Page 28: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 28 courtesy Alessandra Nardi UCB

Application of NR to Circuit Equations

General procedure: the NR method applied to a nonlinear circuit whose eqns are formulated in the STA form produces at each iteration the STA eqns of a linear resistive circuit obtained by linearizing the BCE of the nonlinear elements and leaving all the other BCE unmodified

After the linear circuit is produced, there is no need to stick to STA, but other methods (such as MNA) may be used to assemble the circuit eqns

Companion Network

Page 29: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 29 courtesy Alessandra Nardi UCB

Note: G0 and Id depend on the iteration count k G0=G0(k) and Id=Id(k)

Application of NR to Circuit Equations

Companion Network – MNA templates

Page 30: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 30 courtesy Alessandra Nardi UCB

Application of NR to Circuit Equations

Companion Network – MNA templates

Page 31: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 31 courtesy Alessandra Nardi UCB

Modeling a MOSFET (MOS Level 1, linear regime)

d

Page 32: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 32 courtesy Alessandra Nardi UCB

Modeling a MOSFET (MOS Level 1, linear regime)

Page 33: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 33 courtesy Alessandra Nardi UCB

DC Analysis Flow Diagram

For each state variable in the system

Page 34: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 34 courtesy Alessandra Nardi UCB

Implications Device model equations must be continuous

with continuous derivatives (not all models do this - - be sure models are decent - beware of user-supplied models)

Watch out for floating nodes (If a node becomes disconnected, then J(x) is singular)

Give good initial guess for x(0)

Most model computations produce errors in function values and derivatives. Want to have convergence criteria || x(k+1) - x(k) || < such that > than model errors.

Page 35: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 35 courtesy Alessandra Nardi UCB

Outline Nonlinear problems Iterative Methods Newton’s Method

Derivation of Newton Quadratic Convergence Examples Convergence Testing

Multidimensonal Newton Method Basic Algorithm Quadratic convergence Application to circuits

Improve Convergence Limiting Schemes

Direction Corrupting Non corrupting (Damped Newton)

Continuation Schemes Source stepping

Page 36: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 36 courtesy Alessandra Nardi UCB

Improving convergence Improve Models (80% of problems) Improve Algorithms (20% of

problems)

Focus on new algorithms:Limiting SchemesContinuations Schemes

Page 37: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 37 courtesy Alessandra Nardi UCB

Improve Convergence

Limiting Schemes Direction Corrupting Non corrupting (Damped Newton)

Globally Convergent if Jacobian is Nonsingular

Difficulty with Singular Jacobians

Continuation Schemes Source stepping

Page 38: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 38 courtesy Alessandra Nardi UCB

At a local minimum, 0f

x

LocalMinimum

Multidimensional Case: is singularFJ x

Multidimensional Newton Method

Convergence Problems – Local Minimum

Page 39: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 39 courtesy Alessandra Nardi UCB

f(x)

X0x

1x

Must Somehow Limit the changes in X

Multidimensional Newton Method

Convergence Problems – Nearly singular

Page 40: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 40 courtesy Alessandra Nardi UCB

Multidimensional Newton Method

f(x)

X0x 1x

Must Somehow Limit the changes in X

Convergence Problems - Overflow

Page 41: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 41 courtesy Alessandra Nardi UCB

0 Initial Guess,= 0x k

Repeat {

1 1Solve for k k k kFJ x x F x x

} Until 1 1 , small enoughkkx F x 1k k

Compute ,k kFF x J x

Newton Algorithm for Solving 0F x

1 1limitedk k kx x x

Newton Method with Limiting

Page 42: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 42 courtesy Alessandra Nardi UCB

1limited k

ix

• NonCorrupting

1 1 if k ki ix x

1 otherwisekisign x

1kx 1limited kx • Direction Corrupting

1 1limited k kx x

1min 1,

kx

1kx 1limited kx

Heuristics, No Guarantee of Global Convergence

Newton Method with Limiting

Limiting Methods

Page 43: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 43 courtesy Alessandra Nardi UCB

General Damping Scheme

Key Idea: Line Search

21

2Pick to minimize k k k kF x x

Method Performs a one-dimensional search in Newton Direction

21 1 1

2

Tk k k k k k k k kF x x F x x F x x

1 1k k k kx x x

1 1Solve for k k k kFJ x x F x x

Newton Method with LimitingDamped Newton Scheme

Page 44: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 44 courtesy Alessandra Nardi UCB

If

1) Inverse is boundedkFa J x

) Derivative is Lipschitz ContF Fb J x J y x y

Then

There exists a set of ' 0,1 such thatk s

1 1 with <1k k k k kF x F x x F x

Every Step reduces F-- Global Convergence!

Newton Method with Limiting

Damped Newton – Convergence Theorem

Page 45: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 45 courtesy Alessandra Nardi UCB

0 Initial Guess,= 0x k Repeat {

1 1Solve for k k k kFJ x x F x x

} Until 1 1 , small enoughkkx F x

1k k

Compute ,k kFF x J x

1Find 0,1 such that is minimi e z dk k kk F x x 1 1k k k kx x x

Newton Method with Limiting

Damped Newton – Nested Iteration

Page 46: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 46 courtesy Alessandra Nardi UCB

X0x1x

2x1Dx

Damped Newton Methods “push” iterates to local minimumsFinds the points where Jacobian is Singular

Newton Method with LimitingDamped Newton – Singular Jacobian Problem

Page 47: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 47 courtesy Alessandra Nardi UCB

Solve , 0 where:F x

a) 0 ,0 0 is easy to solveF x

b) 1 ,1F x F x

c) is sufficiently smoothx

Starts the continuation

Ends the continuation

Hard to insure!

Newton with Continuation schemes

Newton converges given a close initial guess Idea: Generate a sequence of problems, s.t.

a problem is a good initial guess for the following one

0)(xF

Basic Concepts - General setting

Page 48: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 48 courtesy Alessandra Nardi UCB

Solve 0 ,0 , 0prevF x x x

While 1 {

}

=0.01,

0prevx x

Try to Solve , 0 with NewtonF x

If Newton Converged

, 2,prevx x Else

,1

2 prev

Newton with Continuation schemes

Basic Concepts – Template Algorithm

Page 49: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 49 courtesy Alessandra Nardi UCB

Newton with Continuation schemes

Basic Concepts – Source Stepping Example

Page 50: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 50 courtesy Alessandra Nardi UCB

+-Vs

R

Diode

1, 0diode sf v i v v V

R

v

, 1Not dependent!diodef v i v

v v R

Source Stepping Does Not Alter Jacobian

Newton with Continuation schemes

Basic Concepts – Source Stepping Example

Page 51: CSE 245: Computer Aided Circuit Simulation and Verification

April 19, 2023 51 courtesy Alessandra Nardi UCB

Transient Analysis Flow Diagram Predict values of variables at tl

Replace C and L with resistive elements via integration formula

Replace nonlinear elements with G and indep. sources via NR

Assemble linear circuit equations

Solve linear circuit equations

Did NR converge?

Test solution accuracy

Save solution if acceptable

Select new t and compute new integration formula coeff.

Done?

YES

NO

NO