+ All Categories
Home > Documents > indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index...

indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index...

Date post: 14-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
31
Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic Differentiation Dagmar Monett René Lamour Andreas Griewank DFG Research Center Matheon Mathematics for key technologies AD 2008 The Fifth International Conference on Automatic Differentiation August 11-15, 2008, Bonn, Germany
Transcript
Page 1: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using theLibrary indexdet and the ADOL-C Package

for Algorithmic Differentiation

Dagmar Monett

René Lamour

Andreas Griewank

DFG Research Center MatheonMathematics for key technologies

AD 2008The Fifth International Conference on Automatic Differentiation

August 11-15, 2008, Bonn, Germany

Page 2: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 2

Motivation

Some applications Circuit simulation (focus of original project)

Electromechanical problems (dynamo, plate condenser)

Multiple pendulum

Robotic arm

Criteria forindex 3 or higher:

CV-loops&LI-cutsets

Page 3: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 3

Background

• MATHEON - Mathematics for key technologies: Modeling, simulation and optimization of real-world processes

• MATHEON is a Research Centre funded by the DFG, Deutsche Forschung Gemeinschaft (German Research Foundation)

Project D7Numerical simulation of integrated circuits

for future chip generations

Page 4: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 4

Background

Occurring challenges

Determination of the tractability index

Computation of consistent initial values

D7 history

First funding period Circuit-device coupled simulations

Determination of suitable discretizations

Second funding period, first stage (Tischendorf) Incorporation of a system integrator

Discretization of new semiconductor device models

Inclusion of 2D models by applying the Scharfetter-Gummel approach

treated insecond stage

Page 5: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 5

Index determination

DAEs given by the general equation:

Ittxtxdf ,0))(,))'((((

“Random” path yields linearized system with coefficients:)(tx

)),(),(()( txtzzftA

)),(),(()( txtzzftB

))(()( txxdtD

))'(()( txdtz

Page 6: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 6

Index determination

Continuous matrix function sequence:

Originally: differentiation approximated by finite differences!!!

( if det( ) 0 return index = i + 1 )

1iG

Repeated Differentiations Taylor series arithmetic+ Shift op. on original specification!!

[R.Lamour. Index Determination and Calculation of Consistent Initial Values for DAEs. Computers and

Mathematics with Applications, 50:1125-1140, 2005]

Page 7: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 7

Results

“Algorithmic Differentiation” yields the matrices of polynomials

Quadratic complexity in degree

Elapsed running time by the program varying the number of Taylor coefficients (averages over 20 independent runs)

0

0,1

0,2

0,3

0,4

0,5

0,6

0,7

1 2 3 4 5 10 30 50 70 90 110 130 160 190 230 270 310

Nr. of Taylor coefficients

Elap

sed

runn

ing

time

(sec

)

No truncation errors

–(t - 1)4

2.785e-13(t - 1)3

2.094e-13(t - 1)2

1.404e-13(t - 1)1

6.790e-14(t - 1)0

Q2,13 rel.err.Term

6.153e-15(t - 1)4

1.478e-15(t - 1)3

2.000e-16(t - 1)2

5.000e-16(t - 1)1

0.0(t - 1)0

Q1,13 rel.err.Term

)(),(),( tDtBtA

Page 8: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 8

Use of Algorithmic Differentiation techniques

User class

Globalparameters

daeIndexDet.cpp

problem dimensions,

E.g. print out parameters,degree of Taylor coefficients

‘asectra‘active section and calculation of the

trajectory,

‘asecdyn‘active section and calculation of the dynamic, and its derivative

using shift operator

‘asecdae‘active section and calculation of the

DAE,

Constructmatrices

A, B, and D

tag 0forward mode

tag 1forward and

reverse modes

tag 2forward and

reverse modes

active and passive variables,initial Taylor coefficients of

Taylor coefficients of independent (i.e., )and dependent variables (i.e. )

active and passive variables,initial Taylor coefficients of and

Taylor coefficients of independent(i.e., and ) and dependent variables (i.e. ) and adjoints

active and passive variables,initial Taylor coefficients of ,

and

Taylor coefficients of independent(i.e., and ) and dependent variables (i.e. ) and adjoints

ADOL-C),,(),,(,,0 txzftxdxt

)(tx

)),(( ttxd

)),(()( ttxdtz

)),(),(( ttxtzf

)(txt

)(tx

)(tx t

t

t

)),(( ttxd

)),(( ttxd

)),(( ttxd

)),(),(( ttxtzf)(tx

)(tx t

Page 9: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 9

Workflow overview

Terminate

Constructmatrices

A, B, and D

‘asectra‘Calculate

trajectory )(tx

‘asecdyn‘Calculate

dynamic and its derivative

using shift operator

)),(( ttxd

)),(()( ttxdtz

‘asecdae‘Calculate

DAE )),(),(( ttxtzf

User class

Globalparameters

daeIndexDet.cpp

A D O L - C

‘hqrfcp‘Householder QR

of matrix A

‘hqrfcp‘Householder QR

of matrix D

‘hqrfcp‘Householder QR of matrix G0=A*D

rA rD

rA

rD

Not properly stated

leading term YESNO

rA r0

r0YES

ComputeV0, U0

1, G0

ComputeD =G0

* A Initialize matrices

and variablesi = 1, dim = r0

NOdim m

NO

i++Compute Pi, Wi, Qi

YES

2

Qi2 Qi 0

ErrorYES

Qi * Qi1 0 Gi * Qi 0

YES

NO NO NO when i = 0,P0 D * D

YES

YES

NO

Matrix sequence loop

Initial computations

Init. + AD

Page 10: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 10

Index determination and AD

daeIndexDet.cppEDynamo1.h

adolc.lib

daeIndexDet.exe

indexdet.lib

matrixseq.h

daeIndexDet: A program for the index determination in DAEs

using the indexdet library and the ADOL-C package for Automatic Differentiation

Page 11: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 11

Index determination and AD

daeIndexDet.cppEDynamo1.h

adolc.lib

daeIndexDet.exe

indexdet.lib

matrixseq.h

daeIndexDet: A program for the index determination in DAEs

using the indexdet library and the ADOL-C package for Automatic Differentiation

Page 12: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 12

Index determination and AD

daeIndexDet.cppEDynamo1.h

adolc.lib

daeIndexDet.exe

indexdet.lib

matrixseq.h

daeIndexDet: A program for the index determination in DAEs

using the indexdet library and the ADOL-C package for Automatic Differentiation

Page 13: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 13

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){}void dyn(adouble *px, adouble t, adouble *pd){}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){}

};#endif /*EDYNAMO1_H_*/

Page 14: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 14

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){}void dyn(adouble *px, adouble t, adouble *pd){}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){}

};#endif /*EDYNAMO1_H_*/

Class name

Page 15: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 15

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){}void dyn(adouble *px, adouble t, adouble *pd){}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){}

};#endif /*EDYNAMO1_H_*/

Nr. equations in dyn(...),nr. equations in dae(...),t0, andtext used for printout

Page 16: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 16

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){/*...*/}void dyn(adouble *px, adouble t, adouble *pd){/*...*/}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){/*...*/}

};#endif /*EDYNAMO1_H_*/

Trajectory

Page 17: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 17

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){/*...*/}void dyn(adouble *px, adouble t, adouble *pd){/*...*/}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){/*...*/}

};#endif /*EDYNAMO1_H_*/

Dynamic

Page 18: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 18

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){/*...*/}void dyn(adouble *px, adouble t, adouble *pd){/*...*/}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){/*...*/}

};#endif /*EDYNAMO1_H_*/

DAE

Page 19: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 19

EDynamo1.h

#ifndef EDYNAMO1_H_#define EDYNAMO1_H_#include "IDExample.h"class EDynamo1 : public IDExample{public:EDynamo1(void) : IDExample(4, 5, 0.1, "EDynamo1-01"){}void tra(adouble t, adouble *ptra){/*...*/}void dyn(adouble *px, adouble t, adouble *pd){/*...*/}void dae(adouble *py, adouble *px,

adouble t, adouble *pf){/*...*/}

};#endif /*EDYNAMO1_H_*/

{/*...*/pf[0] = dp - v;pf[1] = dv - f( v, jL, t, k0, k, m, alpha );pf[2] = C*de + G*e - jL;pf[3] = dfi - e;pf[4] = fi - fiL( v, t, k0, k, r );

}

Page 20: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 20

Index determination and AD

daeIndexDet.cppEDynamo1.h

adolc.lib

daeIndexDet.exe

indexdet.lib

matrixseq.h

daeIndexDet: A program for the index determination in DAEs

using the indexdet library and the ADOL-C package for Automatic Differentiation

Page 21: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 21

Classes and supporting files

daeIndexDet.cppEDynamo1.h

adolc.lib

matrixseq.h matrixseq.cpp

linalg.h linalg.cpp

Matrix.h Matrix.cpp

TPolyn.h TPolyn.cpp

IDException.h IDException.cpp

ioutil.cppioutil.h

defs.h

defaults.h

IDOptions.h

IDOptions.cpp IDExample.h

33

42

195 79

33

110 965 53 517

164 3107

76 2780

328066

38 114

207 193

Page 22: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 22

Example: Bike Dynamo

(In cooperation with project MATHEON Project D13)

GCkkm ,,,, 0 are known

: position of the mass point

: velocity

: voltage

: magnetic flow

: conductanceLj

evp

CRL

Electromechanical problem

Page 23: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 23

Example: Bike Dynamo

).,(0

0)(0

),,(~

tve

jGeeCtzp

tjvfv

vp

L

L

L

)2sin(2),,(~0 kvtjk

mkmftjvf L

mechL

with

)2cos(),( 0 kvtrktvL

)tan(gmfmech

Singular point0t

The new method correctly computes the index even at problem singularities!!!

E.g.

(Index 4)

Page 24: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 24

Example: Bipolar ring oscillator with inductor

0)6(0'00300)(0)(00)(0)(00)(0)(

87542111

11

10

9,89,721

9,826118

9,715117

6,56,465

6,564115

6,453114

3,23,143

3,242112

3,131111

L

L

v

EE

BC

BC

EE

BC

BC

EE

BC

BC

jeeeeeeeGeLj

vuij

jjijjjjjeeGjjjeeGjjijjjjjeeGjjjeeGjjijjjjjeeGjjjeeG

)(, baba eeqj

iIGvvvL SBTr ,,,,,,,, are known

)1()1(

T

BC

T

BEv

v

r

Svv

S

BCBEB

eIeI

jjj

BB v

vvvq 1104)( 11

BCrBEC jjj )1(

(Index 2)Circuit simulation

Page 25: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 25

Achievements

Exact differentiations without explicit specification of derivatives expressions

High accurate results (e.g. checking eps-conditions: equal to 0 up to machine precision). Accurate calculation of the index / consistent initial values (for the linear case)

New matrix-algebra operations to deal with AD (e.g. implementation of special matrix-matrix multiplications, QR decomposition of matrices of Taylor polynomials, etc.) with operator overloading in C++

New program and library for the index determination and the consistent initialization

Main achievements

Page 26: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 26

Software

daeIndexDet: Program for the index determination in DAEs

indexdet: Corresponding libraryUsing Algorithmic Differentiation techniques (ADOL-C package for AD)

http://www.mathematik.hu-berlin.de/~monett/indexdet/indexdet.html

Page 27: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 27

Consistent initialization

• Lots of variables are used from previous computations and structure• Classes and supporting files are already available

Algorithm

Taylor coefficients (ADOL-C) of x, d, f and matrixes A, B, D

Index computation,projectors and other variables

Calculate variables viand conform solution x

Calculatexi+1 = xi + λ zi

Verify convergence

Page 28: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 28

Further work

1. Computation of consistent initial values

Nonlinear case

2. Sparse implementation Sparse LU-based implementation using Taylor arithmetic

3. Structural analysis Exploration of extension of [Pantelides/Pryce] to computational graphs

4. If 3. promising

Development and implementation of method

Page 29: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 29

Topic

DAE Example

gfhyxyxhygyxhxf

,,,,0),(,0),(,

Corresponding

computational graph

x

y

x

yh

f

g

Jacobian

has rank 1

Structural Analysis à la Pantelides fails!!!

yh

xh

hg

hf

yxgf

),(),(

Transformation to ODE for impossible!),( yx

Page 30: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 30

Plans for 2008/2009 and beyond

Solution of introductory example based on graph

Expanded system Maximal Degree of Variables

0),(0),(0),(

zygzxfyxhz

00–

0–0

011

zyx

Page 31: indexdet and the ADOL-C Package for Algorithmic ...monettdiaz.com/papers/AD08-Monett.pdf · Index Determination in DAEs using the Library indexdet and the ADOL-C Package for Algorithmic

Index Determination in DAEs using indexdet and ADOL-C 31

Plans for 2008/2009 and beyond

Expanded system Maximal Degree of Variables

0),(0),(0),(

zygzxfyxhz

00–

0–0

011

zyx

Occurrence of derivatives determinesstructural index via maximal transversal

Combinatorial subtasks:

Identification of replicated subgraphs

Maximal Weighted Matching on DAG

Linear Assignment Problem on Matrix

Solution of introductory example based on graph


Recommended