• No results found

Introduction to Differential Algebraic Equations

N/A
N/A
Protected

Academic year: 2021

Share "Introduction to Differential Algebraic Equations"

Copied!
59
0
0

Loading.... (view fulltext now)

Full text

(1)

Introduction to Differential Algebraic Equations

Dr. Abebe Geletu

Ilmenau University of Technology

Department of Simulation and Optimal Processes (SOP)

Winter Semester 2011/12

(2)

A system of equations that is of the form

F(t, x,x) = 0˙

is called adifferential algebraic equation(DAE) if the Jacobian matrix ∂Fx˙ is singular (non-invertible); where, for each t,x(t)∈Rn and F(t, x(t),x(t)) =˙      F1(t, x(t),x(t))˙ F2(t, x(t),x(t))˙ .. . Fn(t, x(t),x(t))˙      .

(3)

4.1 Definition and Properties of DAEs ...

Example: The system

x1−x˙1+ 1 = 0 (1)

˙

x1x2+ 2 = 0 (2)

is a DAE. To see this, determine the Jacobian ∂Fx˙ of

F(t, x,x) =˙ x1−x˙1+ 1 ˙ x1x2+ 2 withx˙ = ˙ x1 ˙ x2 , so that ∂F ∂x˙ = ∂F1 ∂x˙1 ∂F1 ∂x˙2 ∂F2 ∂x˙1 ∂F2 ∂x˙2 ! = −1 0 x2 0

, ( see that, det

∂F ∂x˙

= 0).

⇒the Jacobian is a singular matrix irrespective of the values of x2.

Observe that: in this example the derivativex˙2 does not appear. Introduction to Differential Algebraic Equations

(4)

Solving forx˙1 from the first equationx1−x˙1+ 1 = 0we get

˙

x1 =x1+ 1. Replace this for x˙1 in the second equationx˙1x2+ 2 = 0 to wire the DAE in equations (23) & (23) equivalently as:

˙

x1 = x1+ 1 (3)

(x1+ 1)x2+ 2 = 0 (4)

In this DAE:

•equation (3) is a differential equation; while •equation (4) is an algebraic equation.

⇒There are several engineering applications that have such model equations.

(5)

4.1 Definition and Properties of DAEs ...

SupposeF(t, x,x) =˙ A(t) ˙x+B(t)x+d(t).

Hence, for the systemF(t, x,x) = 0˙ the Jacobian will be ∂Fx˙ =A(t). IIfA(t) is a non-singular (an invertible) matrix, then

[A(t)]−1(A(t) ˙x(t) +B(t)x(t) +d(t)) = [A(t)]−10

⇒x(t) + [A(t)]˙ −1B(t)x(t) + [A(t)]−1d(t)) = 0

⇒x(t) =˙ −[A(t)]−1B(t)x(t)−[A(t)]−1d(t)).

This is an ordinary differential equation.

Remark

In general, if theJacobian matrix ∂Fx˙ is non-singular (invertible), then the systemF(t, x,x) = 0˙ can be transformed into an ordinary differential equation (ODE) of the formx˙ =f(t, x). Some numerical solution methods for ODE models have been already discussed. ITherefore, the most interesting case is when ∂Fx˙ is singular. Introduction to Differential Algebraic Equations

(6)

applications

•There are several engineering applications that lead DAE model equations.

Examples: process engineering, mechanical engineering and

mechatronics ( multibody Systems eg. robot dynamics, car dynamics, etc), electrical engineering (eg. electrical network systems, etc), water distribution network systems, thermodynamic systems, etc.

Frequently, DAEs arise from practical applications as:

Idifferential equations describing the dynamics of the process, plus Ialgebraic equations describing:

•laws of conservation of energy, mass, charge, current, etc. •mass, molar, entropy balance equations, etc.

(7)

4.2. Some DAE models from engineering

applications ... CSTR

An isothermal CSTR AB →C. Model equation: ˙ V = Fa−F (5) ˙ CA = Fa V (CA0 −CA)−R1 (6) ˙ CB = − Fa V CB+R1−R2 (7) ˙ CC = − Fa V CC+R2 (8) 0 = CA− CB Keq (9) 0 = R2−k2CB (10)

(8)

...a CSTR...

•Fa-feed flow rate of A •CA0-feed concentration of A •R1, R2 - rates of reactions •F - product withdrawal rate

•CA, CB, CC - concentration of speciesA,B and C, resp., in the mixture.

Definining

x = (V, CA, CB, CC)>

z = (R1, R2)>

the CSTR model equation can be written in the form

˙

x = f(x, z) 0 = g(x, z).

(9)

Some DAE models from practical applications...a

simple pendulum

Newton’s Law: m¨x=−Flx m¨y=mgFly Conservation of mechanical energy: x2+y2 =l2 (DAE) x˙1 = x3 ˙ x2 = x4 ˙ x3 = − F m lx1 ˙ x4 = g F l x2 0 = x2+y2−l2.

(10)

RLC circuit

Kirchhoff’s voltage and current laws yield: conservation of current: iE =iR, iR=iC, iC =iL conservation of energy: VR+VL+VC+VE = 0 Ohm’s Laws: CV˙C =iC, LV˙L=iL, VR=RiR

(11)

Some DAE models from practical applications...an

RLC circuit...

After replacingiR withiE andiC with iL we get a reduced DAE: ˙ VC = 1 CiL (11) ˙ VL = 1 LiL (12) 0 = VR+RiE (13) 0 = VE+VR+VC +VL (14) 0 = iL−iE (15) (16) Definex(t) = (VC, VL, VR, iL, iE)

(12)

RLC circuit...

The RLC system can be written as:

˙ x =       1 C 0 0 0 0 0 L1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       x (17) 0 =   0 0 1 0 R 1 1 1 0 0 0 0 0 1 −1  x+   0 1 0  VE (18)

which is of the form

˙

x = Ax (19)

(13)

4.3. Classification of DAEs

•Frequently, DAEs posses mathematical structure that are specific to a given application area.

•As a result we have non-linear DAEs, linear DAEs, etc. •In fact, a knowledge on the mathematical structure of a DAE facilitates the selection of model-specific algorithms and appropriate software.

Nonlinear DAEs:

In the DAEF(t, x,x) = 0˙ if the functionF is nonlinear w.r.t. any one oft,x or x˙, then it is said to be a nonlinear DAE.

Linear DAEs: A DAE of the form

A(t) ˙x(t) +B(t)x(t) =c(t),

whereA(t) andB(t) aren×nmatrices, is linear. If A(t)≡A and

B(t)≡B, then we have time-invariant linear DAE. Introduction to Differential Algebraic Equations

(14)

Semi-explicit DAEs:

A DAE given in the form

˙

x = f(t, x, z) (21)

0 = g(t, x, z) (22)

•Note that the derivative of the variablezdoesn’t appear in the DAE. •Such a variable zis called an algebraic variable; while xis called a

differential variable.

•The equation0 =g(t, x, z) calledalgebraic equation or a

constraint.

Examples:

•The DAE model given for the RLC circuit, the CSTR and the simple pendulum are all semi-explicit form.

(15)

4.3. Classification of DAEs...

A fully-implicit DAEs: The DAE F(t, x,x) = 0˙ is infully-implicitform. Examples:

(i)F(t, x,x) =˙ Ax˙+Bx+b(t)is a fully-implicit DAE. (ii) The equation (see equations (23) & (23) )

x1−x˙1+ 1 = 0

˙

x1x2+ 2 = 0 is a fully-implicit DAE.

IAny fully-implicit DAE can be always transformed into a semi-explicit DAEs .

(16)

Example(transformation of a fully-implicit DAE into a semi-explicit DAE):

•Consider the linear time-invariant DAE Ax˙+Bx+b(t) = 0 , where

λA+B is nonsingular, for some scalarλ. Then there are non-singular

n×n matricesGand H such that:

GAH= Im O O N andGBH = J O O In−m (23) whereIm them×m identity matrix (herem≤n),N is an

(n−m)×(n−m) nilpotent matrix; i.e., there is a positive integer

psuch that Np= 0,J ∈Rm×m andI

n−m is the (n−m)×(n−m) identity matrix.

INow, we can writeAx˙+Bx+b(t) = 0equivalently as

(17)

4.3. Classification of DAEs...

•Use the block decomposing given in equation (23) to write Im O O N (H−1) ˙x+ J O O In−m (H−1)x+Gb(t) = 0. (25) •Use thevariable transformation w(t) =H−1x(t) to write

Im O O N ˙ w+ J O O In−m w+Gb(t) = 0. (26)

•Decompose the vector w(t) asw(t) =

w1(t)

w2(t)

, with w1(t)∈Rm

andw2(t)∈Rn−m and correspondingly the vectorGb(t) = b1(t) b2(t) so that: ˙ w1(t) +J w1(t) +b1(t) = 0 (27) N w1(t) +w2(t) +b2(t) = 0. (28) Introduction to Differential Algebraic Equations

(18)

•Use now the nilpotent property of the matrix N; i.e., multiply the second set of equation byNp−1 to get

˙

w1(t) +J w1(t) +b1(t) = 0 (29)

Npw1(t) +Np−1w2(t) +Np−1b2(t) = 0. (30) From this it follows that (sinceNpw1(t) = 0)

˙

w1(t) =−J w1(t)−b1(t) (31)

0 =−Np−1w2(t)−Np−1b2(t). (32) Therefore, we have transformed the fully-implicit DAE

Ax˙+Bx+b(t) = 0 into a semi-explicit form.

•Similarly, using mathematician manipulations, any nonlinear fully-implicit DAE can be transformed into a semi-explicit DAE.

(19)

4.4. Index of a DAE

•DAEs are usually very complex and hard to be solved analytically. ⇒DAEs are commonly solved by using numerical methods.

Question:

Is it possible to use numerical methods of ODEs for the solution of DAEs?

Idea:

Attempt to transform the DAE into an ODE.

•This can be chieved through repeated derivations of the algebraic equationsg(t, x, z) = 0with respect to time t.

Definition

The minimum number of differentiation steps required to transform a DAE into an ODE is known as the (differential)indexof the DAE. Introduction to Differential Algebraic Equations

(20)

Example:

(DAE) x˙1 = x1+ 1

(x1+ 1)x2+ 2 = 0. Herex2 the algebraic variable (i.e. z=x2). Differentiate

g(x1, x2) = 0 to find a description for the time-derivative x˙2 of the algebraic variable. So d dt[g(x1, x2)] = d dt[0]⇒ d dt[(x1+ 1)x2+ 2] = 0 ⇒x˙1x2+ (x1+ 1) ˙x2 = 0. ⇒x˙2 =− ˙ x1x2 (x1+ 1) = −(x1+ 1)x2 (x1+ 1) =−x2

IOnly one differentiation step is required to describex˙2. So, the DAE is of index 1.

(21)

4.4. Index of a DAE...

•The CSTR model is of index 2.

•The DAE model for the simple penudulum is of index 3.

IDAEs with index greater than 1 are commonly known ashigher

indexDAEs.

IThe higher the index, the more difficult will be the DAE to solve. ITransformation of a higher index DAE into a lower index DAE (or to an ODE) is commonly known asindex reduction. In general, index reduction for higher index DAE simplifies computational complexities.

Two serious issues to consider when solving DAEs

•The solutions of the lower index DAE may not be a solution of the original DAE. This is known as adrift offeffect.

•Finding initial conditions that satisfy both the differential and algebraic parts of a DAE may not be trivial, known asconsistency of initial conditions.

(22)

Therefore, computational algorithms for a DAE should:

be cable of identifying consistent initial conditions to the DAE; as well as,

provide automatic index reduction mechanisms to simplify the DAE.

IModern software like Sundials, Modelica, use strategies for index-reduction coupled with methods of consistent initialization. In the following we consider only index 1 semi-explicit DAEs:

(DAE) x˙ = f(t, x, z) (33)

0 = g(t, x, z). (34)

Since ∂g∂t +∂x∂gdxdt + ∂g∂zdzdt = 0. Hence, a semi-explicit DAE is of index 1 iff

h ∂g ∂z

i−1

exists. That is, one differentiation step yields the differential equation: dzdt =−h∂g∂zi−1h∂x∂gi(f(t, x, z))−h∂g∂zi−1 ∂g∂t.

(23)

4.5. An overview of numerical Methods for DAEs

•Using mathematical principles and transformation of variables, fully-implicit DAEs can be transformed to semi-explicit DAEs. •Note that, in the semi-explicit DAE

˙

x = f(t, x, z) (35)

0 = g(t, x, z). (36)

if Jacobian matrixh∂g∂zisingular (non-invertible), then the DAE is of higher index.

ISince many applications have model equations as semi-explicit DAEs, the discussion next is restricted to this form.

•In the DAE above, if bothf and g do not explicitly depend on time

t; i.e. f(t, x, z) =f(x, z)and g(t, x, z) =g(x, z), then the model is

anautonomous DAE.

(24)

IBDFandcollocation methods are two most widely used methods for numerical solution of DAEs.

(I)BDF for DAEs:

Consider the initial value DAE

˙

x = f(t, x, z), x(t0) =x0 (37)

0 = g(t, x, z). (38)

Ideas of BDF:

ISelect a time steph so thatti+1=ti+h, i= 0,1,2, . . . IGivenxi=x(ti) andzi=z(ti), determine the value

xi+1 =x(ti+1) by using (extrapolating) valuesxi, xi−1, . . . , xi−m+1 of the current and earlier time instants ofx(t).

(25)

4.5. An overview of numerical Methods for

DAEs...BDF

•There is a unique m-th degree polynomialP that interpolates the

m+ 1points

(ti+1, xi+1),(ti, xi),(ti−1, xi−1), . . . ,(ti+1−m, xi+1−m). •This interpolating polynomials P can be written as

P(t) =

m X

j=0

xi+1−jLj(t)

with the Lagrange polynomial

Lj(t) = m Y l= 0 l6=j t−ti+1−l ti+1−j−ti+1−l , j= 0,1, . . . , m.

(26)

•Observe that

P(ti+1−j) =xi+1−j, j = 0,1, . . . , m. In particularP(ti+1) =xi+1.

•Thus, replace x˙i+1 byP(t˙ i+1) to obtain

˙ P(ti+1) =f(ti+1, xi+1). (∗) But ˙ P(ti+1) = m X j=0 xi+1−jL˙j(ti+1) =xi+1L˙0(ti+1) + m X j=1 xi+1−jL˙j(t)

Putting this into (*) we get:

xi+1=− m X j=1 xi+1−j ˙ Lj(ti+1) ˙ L0(ti+1) + 1 ˙ L0(ti+1) f(ti+1, xi+1)

(27)

4.5. ....BDF for DAEs...

Define aj = ˙ Lj(ti+1) ˙ L0(ti+1) , bm = 1 hL˙0(ti+1) .

•The valuesaj, j = 1, . . . , mandbm can be read from lookup tables.

Anm-step BDF Algorithm (BDF m) for a DAE:

Givena1, . . . , am,bm xi+1 = − m X j=1 ajxi+1−j +bmhf(ti+1, xi+1, zi+1) (39) 0 = g(ti+1, xi+1, zi+1). (40) •Each iteration of the BDF requires a Newton algorithm for the solution a system of nonlinear equations. Hence, the Jacobian ∂w∂g needs to be well-conditioned, wherew= (t, x, z).

(28)

•Given x0 =x(t0), BDF requires consistent initial conditions to be obtained by solving

g(t0, x0, z0) = 0. to determinez0 =z(t0).

Them-step BDF algorithm converges ifm≤6; i.e.

xi−x(ti)≤O(hm), zi−z(ti)≤O(hm) for consistent initial conditions.

•BDF is commonly used to solve DAEs of index 1 or 2

Software based on BDF for DAEs:

Matlab: ode15i

Open source: DASSL ; CVODE, CVODES, and IDA (under

(29)
(30)

•To collocate a function x(t) through another function p(t)= to captur the properties ofx(t) by using p(t).

•In general, we use a simpler functionp(t)to collocatex(t); eg., p(t)

can be a polynomial, a trigonometric function, etc.

⇒polynomial and trigonometric functions are usually simpler to work with. (The discussion here is restricted to polynomilas)

Weirstraß’ Theorem

Ifx(t) is a continuous function on[a, b], then for any given ε >0, there is a polynomialp(t) such that

max

a≤t≤b|x(t)−p(t)|< ε •Hence, we use the polynomialp(t) instead ofx(t).

•However, Weirstraß’ theorem doese not specifye how to construct the approximating polynomialp(t) .

(31)

•Supposep(t) =a0+a1t+. . .+amtm is the approximating polynomial tox(t) on[a, b].

Note: If the coefficientsa0, a1, . . . , am are given, then the approximating polynomial is exactly known.

Question: How to determine a0, a1, . . . , am?

Question: How to construct the apprximating polynomial? •There are several ways to construct p(t) to approximates x(t)

according to Weirstraß’ theorem.

Here we requirep(t)to satisfy the following property: • p(ti) =x(ti) =:xi, i= 1, . . . , N.

for someselected time instants t1, t2, . . . , tN from the interval[a, b]. •This property relates p(t) andx(t) and is known as interpolatory property.

Uniqueness of an interpolating polynamial

There is a unique interpolatory polynomialp(t) for the N data points

(t1, x1),(t2, x2),. . .,(tN, xN) with degreedeg(p) =m=N −1. Introduction to Differential Algebraic Equations

(32)
(33)

According to the interpolatory property, we have x1=p(t1) = a0+a1t1+. . .+amtm1 (41) x2=p(t2) = a0+a1t2+. . .+amtm2 (42) .. . (43) xm+1=p(tm+1) = a0+a1tm+1+. . .+amtmm+1. (44) ⇒      x1 x2 .. . xm+1      =      1 t1 t21 . . . tm1 1 t2 t22 . . . tm2 .. . ... ... . . . ... 1 tm+1 t2m+1 . . . tmm+1           a0 a1 .. . am     

Thus, if we knownx1, x2, . . . , xm+1 then we can compute

a0, a1, . . . , am and vice-versa.

•But, since x(t) is not yet known,x1, x2, . . . , xm+1 are unknown.

(34)

Hence, both     x2 .. . xm+1     and     a1 .. . am     are unkowns.

•To avoid working with two unknown vectors, we can define the polynamialp(t) in a better way as:

p(t) =

m+1 X

i=1

xiLi(t) (45)

whereLi(t) are Lagrange polynomials given by

Li(t) = m+1 Y j= 1 j6=i t−tj ti−tj = (t−t1) (t−t2). . .(t−ti−1) (t−ti+1). . .(t−tm+1) (ti−t1) (ti−t2). . .(ti−ti−1) (ti−ti+1). . .(ti−tm+1) .

(35)

Properties: Li(tj) =    1, ifi=j 0, ifi6=j ?(satisfaction of the interpolatory property)

p(ti) =xi, i= 1,2, . . . , m+ 1.

?(approximation of x(t)byp(t))

The polynomialp(t)in equation (45) can be made to satisfy the Weirstraß’ theorem by taking sufficiently large number of time instantst1, t2, . . . , tm+1 from[a, b].

Question: What is the best choice fort1, t2, . . . , tm+1?

(36)

An idea to determine collocation points:

Select valuesτ1, τ2, . . . , τN from the interval [0,1]and define theti’s as follows:

ti=a+τi(b−a), i= 1, . . . , N.

•This is a good idea, since the same values τ1, τ2, . . . , τN from [0,1] can be used to generate collocation points onvarious intervals[a, b].

Example:

(i) If[a, b] = [2,10], thenti = 2 +τi(10−2), i= 1, . . . , N; (ii) If[a, b] = [0,50], thenti = 0 +τi(50−0), i= 1, . . . , N; etc.

Question: What is the best way to select the values τ1, τ2, . . . , τN from [0,1]?

(37)

Determination of collocation Points...

IRecall that: solution of a differential equation (or DAEs) is an integration process.

⇒Numerical methods for one-dimensional integrals can give us information on how to selectτ1, τ2, . . . , τN.

⇒Gauss quadrature rules are one of the best numerical integration methods.

To approximate the integral

I[f] =

Z 1

0

f(τ)dτ,

by the (iterpolatory) quadrature ruleQN[f] =PNk=1wkf(τk), where: •the integration nodes τ1, τ2, . . . , τN ∈[0,1]

•weightsw1, w2, . . . , wN

are constructed based on the interval[0,1]. Introduction to Differential Algebraic Equations

(38)

Thus we would like to obtain the approximation I[f] = Z 1 0 f(τ)dτ ≈QN[f] = N X i=1 wif(τi).

•Once a quadrature rule QN[·]is constructed it can be used to approximate integrals of various functions.

Question: How to determine the 2N unknowns τ1, τ2, . . . , τN, w1, w2, . . . , wN?

We require the quadrature rule to satisfy the equality: Z b a W(τ)p(τ)dτ = N X i=1 wip(τi)

(39)

That is,QN[·]should integrate each of the polynomials

p(t) = 1, τ, τ2, . . . , τ2N

exactly. This implies Z 1 0 1dτ = X i=1 wi (46) Z 1 0 τ dτ = X i=1 wiτi (47) Z 1 0 τ2dτ = X i=1 wiτi2 (48) .. . (49) Z 1 0 τ2Ndτ = X i=1 wiτi2N. (50)

(40)

1 = w1+w2+. . .+wN (51) 1 2 = w1τ1+w2τ2+. . .+wNτN (52) (53) 1 3 = w1τ 2 1 +w2τ22+. . .+wNτN2 (54) .. . (55) 1 2N = w1τ 2N 1 +w2τ22N +. . .+wNτN2N. (56) From the equation1 =w1+w2+. . .+wN we can solve for w1 and replace for it in the remaining equations.

⇒It remains to determine the 2N −1 unknownsτ2, . . . , τN and

w1, w2, . . . , wN from the reduced set of2N −1 equations. • Unfortunately, this system of equations is difficult to solve.

(41)

Orthogonal polynomials

•There is a simpler way if we useorthogonal polynomials.

IThe concept of orthogonality requires a definition of scalar product.

•Thescalar product of functions h andg with respect on the

interval[0,1] is

hh, gi=

Z 1

0

h(τ)g(τ)dτ.

•Two functions h andg are orthogonalon the interval [0,1]if

hh, gi=

Z 1

0

h(τ)g(τ)dτ = 0.

•In this lecture, we are only interested in set of polynomials that are orthogonal to each other.

(42)

•Orthogonal polynomials on [0,1](as defined above) are known as

shifted Legendre polynomials.

Theorem (Three-term recurrence relation)

Suppose{p0, p1, . . .} the set of shifted Legendre orthogonal

polynomials on[0,1]with deg(pn) =nand leading coefficient equal to 1. The shifted Legendre polynomials are generated by the relation

pn+1(τ) = (τ−an)pn(τ)−bnpn−1(τ)

withp0(τ) = 1 andp−1(τ) = 0, where the recurrence coefficients are given as

an= 12, n= 0,1,2, . . .

bn= n 2

(43)

Orthogonal polynomials...

The first four shifted Legendre orthogonal polynomials are

p0(τ) = 1, p1(τ) = 2τ −1, p2(τ) = 6τ2−6τ+ 1, p3(τ) =

20τ3−30τ2+ 12τ−1.

Further important properties of orthogonal polynomials:

Given any set of orthogonal polynomials{p0, p1, p2, . . .}the following hold true:

•Any finite set of orthogonal polynomials{p0, p1, . . . , pN−1} is linearly independent.

•The polynomial PN is orthogonal to each ofp0, p1, . . . , pN−1 . •Any non-zero polynomial q with degree deg(q)≤N−1can be written as a linear combination:

q(τ) =c0p0(τ) +c1p1(τ) +. . . , cN−1pN−1(τ) where at least one of the scalarsc0, c1, . . . , cN−1 is non-zero. Introduction to Differential Algebraic Equations

(44)

• We demand the quadrature rule is exact for polynomials up to degree2N −1.

•Let P(τ) be any polynomial of degree2N −1. Hence, I[P] =QN[P]⇒ Z 1 0 P(τ)dτ = N X i=1 wiP(τi).

•Given the N-th degree orthogonal polynomial pN, the polynomialP can be written as

P(τ) =pN(τ)q(τ) +r(τ)

whereq(τ) andr(τ) are polynomials such that 0< deg(r)≤N−1

and

•deg(q) =N −1, since

(45)

Orthogonal polynomials...

•Now, from the equation R01P(τ)dτ =PNk=1wkP(τk) it follows that Z b a (pN(τ)q(τ) +r(τ))dτ = N X i=1 wi(pN(τi)q(τk) +r(τi)). ⇒ Z b a pN(τ)q(τ)dτ | {z } =0 + Z b a r(τ)dτ = N X i=1 wipN(τi)q(τi)+ N X i=1 wir(τi).

Observe the following:

•Using polynomial exactness: Rb

ar(τ)dτ = PN

i=1wir(τi). •Orthogonality implies< pN, pk>= 0, k= 1, . . . , N−1. Thus, Rb apN(τ)q(τ) = Z b a pN(τ) N−1 X i=1 ckpk(τ)dτ = N−1 X k=1 ck Z b a pN(τ)pk(τ)dτ | {z } =0 = 0.

(46)

It follows thatPN

k=1wkpN(τk)q(τk) = 0. (?)

Theorem

If the quadrature nodesτ1, τ2, . . . , τN are zeros of the N−th degree

shifted Legendre polynomialpN(τ), then •all the rootsτ1, τ2, . . . , τN lie inside (0,1); •the quadrature weights are determined from

wi= Z 1

0

Li(τ)dτ,

whereLi(τ), i= 1, . . . , N is the Lagrange function defined using

τ1, τ2, . . . , τN and wi >0, i= 1, . . . , N.

•The quadrature rule QN[·]integrates polynomials degree up to

2N−1exactly.

(47)

Orthogonal polynomials...

•Therefore, the quadrature nodesτ1, τ2, . . . , τN are chosen as the zeros of theN-th degree shifted Legendre orthogonal polynomial.

Question:

Is there a simple way to compute the zerosτ1, τ2, . . . , τN of an orthogonal polynomialpN and the quadrature weights

w1, w2, . . . , wN?

The answer is give by a Theorem of Welsch & Glub (see next slide).

(48)

Theorem (Welsch & Glub 1969 )

The quadrature nodesτ1, τ2, . . . , τN and weightsw1, w2, . . . , wN can be computed from the spectral factorization of

JN =V>ΛV; Λ =diag(λ1, λ2, . . . , λN), V V>=IN; of the symmetric tri-diagonalJacobi matrix

JN=            a0 √ b1 √ b1 a1 √ b2 √ b2 .. . .. . . .. aN−2 p bN−1 p bN−1 aN−1            where

a0, an, bn, n= 1, . . . , N−1 are the known coefficients from the recurrence relation. In particular ...

(49)

Theorem ... τk = λk, k= 1, . . . , N; (57) wk = e>V ek 2 , k= 1, . . . , N, (58) wheree1, ek are the 1st and thek−the unit vectors of length N. A Matlab program:

n = 5; format short

beta = .5./sqrt(1-(2*(1:n-1)).^(-2)); % recurr. coeffs

J = diag(beta,1) + diag(beta,-1) % Jacobi matrix

[V,D] = eig(J); % Spectral decomp.

tau = diag(D); [tau,i] = sort(tau); % Quad. nodes

w = 2*V(1,i).^2; % Quad. weights

(50)

τ1, τ2, . . . , τN and corresponding weights w1, w2, . . . , wN.

The collocation pointst1, t2, . . . , tN ∈[a, b]can be determined by using the quadrature pointsτ1, τ2, . . . , τN ∈[0,1]through the relation:

ti =a+τi(b−a).

Example: Suppose we would like to collocatex(t)on [a, b] = [0,10]

using a polynomialx(t)ˆ with deg(ˆx) =m= 3.

•Required number of collocation points=N =m+ 1 = 3 + 1 = 4. ⇒First, determine the zeros of the 4-th degree shifted Legendre polynomialp4(τ); i.e., findτ1, τ2, τ3, τ4 .

•These value can be determined to be:

τ1 = 0.0694318442, τ2 = 0.3300094783,

(51)

•Next, determine the collocation points :

t1 = 0 + (10−0)∗τ1= 0.694318442, t2 = 0 + (10−0)∗τ2=

3.300094783,

t3= 0 + (10−0)∗τ3= 6.699905218,

t4= 0 + (10−0)∗τ4= 9.305681558.

(52)

The collocation polynomial isp(t) = i xiLi(t). where L1(t) = (t−t2)(t−t3)(t−t4) (t1−t2)(t1−t3)(t1−t4) (59) L2(t) = (t−t1)(t−t3)(t−t4) (t2−t1)(t2−t3)(t2−t4) (60) L3(t) = (t−t1)(t−t2)(t−t4) (t3−t1)(t3−t2)(t3−t4) (61) L4(t) = (t−t1)(t−t2)(t−t3) (t4−t1)(t4−t2)(t4−t3) . (62)

Hence, we approximatex(t) using the third degree polynomial

p(t) =bx(t) =x1L1(t) +x2L2(t) +x3L3(t) +x4L4(t) It remains to determine the coefficientsx1, x2, x3, x4.

(53)

Discretization of DAEs using orthogonal collocations

Given the DAE:

˙

x = f(t, x, z), t0 ≤t≤tf (63)

0 = g(t, x, z) (64)

wherex(t)>= (x1(t), x2(t), . . . , xn(t)) and

z(t)> = (z1(t), z2(t), . . . , zm(t)).

•Determine the a set of collocation pointst1,t2,. . .,tN. •corresponding to each differential and algebraic variable define collocation polynomials: xk(t)−→p(k)(t) = N X i=1 x(ik)Li(t), k= 1, . . . , n; (65) zj(t)−→p(j)(t) = N X i=1 zi(j)Li(t), j= 1, . . . , m. (66)

(54)

•In the DAE, replace xk(t) andzj(t)byq(k)(t) andp(j)(t) so that ˙ p(1)(t) = f1(t, p(1)(t), p(2)(t), . . . , p(n)(t) , q(1)(t), q(2)(t), . . . , q(m)(t) ) (67) ˙ p(2)(t) = f2(t, p(1)(t), p(2)(t), . . . , p(n)(t),q(1)(t), q(2)(t), . . . , q(m)(t)(68)) .. . (69) ˙ p(n)(t) = f1(t, p(1)(t), p(2)(t), . . . , p(n)(t) , q(1)(t), q(2)(t), . . . , q(m)(t) ) (70) 0 = g1(t, p(1)(t), p(2)(t), . . . , p(n)(t),q(1)(t), q(2)(t), . . . , q(m)(t)(71)) 0 = g2(t, p(1)(t), p(2)(t), . . . , p(n)(t) , q(1)(t), q(2)(t), . . . , q(m)(t) ) (72) .. . (73) 0 = gm(t, p(1)(t), p(2)(t), . . . , p(n)(t) , q(1)(t), q(2)(t), . . . , q(m)(t) ) (74)

(55)

... orthogonal collocation of DAEs

•Next discretize the system above usingt1, t2, . . . , tN to obtain:

˙ p(1)(ti) = f1 ti, x(1)i , x(2)i , . . . , x(in) , zi(1), z(2)i , . . . , zi(m) ˙ p(2)(ti) = f2 ti, x(1)i , x(2)i , . . . , x(in) , zi(1), z(2)i , . . . , zi(m) .. . ˙ p(n)(ti) = fn ti, x(1)i , x(2)i , . . . , x(in) , zi(1), zi(2), . . . , z(im) 0 = g1 ti, x(1)i , x(2)i , . . . , x(in),zi(1), zi(2), . . . , zi(m) 0 = g2 ti, x(1)i , x(2)i , . . . , x(in) , zi(1), zi(2), . . . , zi(m) .. . 0 = gm ti, x(1)i , x(2)i , . . . , x(in),z(1)i , zi(2), . . . , zi(m), i= 1,2, . . . , N.

(56)

•Solve the system of (n+m)×N equations to determine the

(n+m)×N unknwonsxi(k), k= 1, . . . , n,i= 1, . . . , N and

zi(j), j = 1, . . . , m,i= 1, . . . , N.

Example: Use a four point orthogonal collocation to solve the DAE

˙

x1 = x1+ 1,0≤t≤1.

0 = (x1+ 1)x2+ 2.

Solution: we use the collocation polynomials

p(1)(t) = 4 X i=1 x(1)i (t)Li(t)and p(2)(t) = 4 X i=1 x(2)i (t)Li(t)

(57)

Advantages and disadvantages collocation methods

•can be used for higher index DAEs.

•efficient for both initial value as well as boundary values DAEs. •more accurate

Disadvantages:

•Can be computationally expensive

•The approximating polynomials may display oscillatory properties, impacting accuracy

•computational expenses become high if t1, t2, . . . , tN−1 are considered variables.

(58)

References:

•U. M. Ascher, L. R. Petzold : Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations. SIAM 1998.

•K. E. Brenan, S. L. Campbell, and L.R. Petzold: (1996). Numerical Solution of Initial-Value Problems in Differential-Algebraic Equations., SIAM, 1996.

•Campbell, S. and Griepentrog, E., Solvability of General Differential Algebraic Equations, SIAM J. Sci. Comput. 16(2) pp. 257-270, 1995. •M. S. Erik and G. Sderlind: Index Reduction in

Differential-Algebraic Equations Using Dummy Derivatives. SIAM Journal on Scientific Computing, vol. 14, pp. 677-692, 1993. •C. W. Gear : Differential-algebraic index transformation. SIAM J. Sci. Stat. Comp. Vol. 9, pp. 39 – 47, 1988.

•Walter Gautschi: Orthogonal polynomials (in Matlab). Journal of Computational and Applied Mathematics 178 (2005) 215– 234 Introduction to Differential Algebraic Equations

(59)

Resources - Literature .. Software

•Pantelides Costas. (1988) ”The consistent initialization of differential algebraic systems.” SIAM Journal on Scientific and Statistical Computing, vol. 9: 2, pp. 213–231, 1988.

•L. Petzold: Differential/Algebraic Equations Are Not ODEs, SIAM J. Sci. Stat. Comput. 3(3) pp. 367-384, 1982.

Open source software:

•DASSL - - FORTRAN 77:

http://www.cs.ucsb.edu/ cse/software.html •DASSL Matlab interface:

http://www.mathworks.com/matlabcentral/fileexchange/16917-dassl-mex-file-compilation-to-matlab-5-3-and-6-5

•Sundials - https://computation.llnl.gov/casc/sundials/main.html •Modelica - https://modelica.org/

•Odepack - http://www.cs.berkeley.edu/ kdatta/classes/lsode.html •Scicos- http://www.scicos.org/

References

Related documents

Corpus and cauda (F) of diabetic rat treated with metformin or pioglitazone (G and H, respectively), or sitagliptin (I and J, respectively) show decreased ERb expression in

a) The International Military Tribunal (IMT), Nuremberg: this refers to the Tribunal established by the Allied Powers „for the just and prompt trial and punishment of

The more controversial policy, Putonghua Medium of Instruction for Chinese (PMIC), i.e., the use of PTH for the teaching of the Chinese language, has not been made mandatory

rlstp:cell=DPPBR1A; rlstp:cell=DPPBR1A; rlstp:cell=ALL; rlstp:cell=ALL; rlstc:cell=DPPBR1A,state=halted; rlstc:cell=DPPBR1A,state=halted;

This paper has discussed the use of fuzzy linear programming for solving a production planning problem.

The objective of the Weight Measurement Test is to verify the measured weight of the conductor against the manufacturer’s stated conductor weight..

homes as long as possible was identified as being critically important for seniors’ health and wellness, with many asking, “How can we care for more people at home, and how do we

Table 1 Non- accidental injury syndrome types and affected areas 18 Table 2 The standard radiological procedure for children of suspected non-accidental injury 26 Table 3 Criteria