Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 59 trang
THÔNG TIN TÀI LIỆU
Nội dung
Introduction to Differential Algebraic Equations Dr Abebe Geletu Ilmenau University of Technology Department of Simulation and Optimal Processes (SOP) Winter Semester 2011/12 Introduction to Differential Algebraic Equations TU Ilmenau 4.1 Definition and Properties of DAEs A system of equations that is of the form F (t, x, x) ˙ =0 is called a differential algebraic equation (DAE) if the Jacobian n matrix ∂F ∂ x˙ is singular (non-invertible); where, for each t, x(t) ∈ R and F1 (t, x(t), x(t)) ˙ F2 (t, x(t), x(t)) ˙ F (t, x(t), x(t)) ˙ = Fn (t, x(t), x(t)) ˙ Introduction to Differential Algebraic Equations TU Ilmenau 4.1 Definition and Properties of DAEs Example: The system x1 − x˙ + = (1) x˙ x2 + = (2) is a DAE To see this, determine the Jacobian F (t, x, x) ˙ = with x˙ = ∂F = ∂ x˙ ∂F ∂ x˙ of x1 − x˙ + x˙ x2 + x˙ , so that x˙ ∂F1 ∂ x˙ ∂F2 ∂ x˙ ∂F1 ∂ x˙ ∂F2 ∂ x˙ = −1 , x2 ( see that, det ∂F ∂ x˙ = 0) ⇒ the Jacobian is a singular matrix irrespective of the values of x2 Observe that: in this example the derivative x˙ does not appear Introduction to Differential Algebraic Equations TU Ilmenau 4.1 Definition and Properties of DAEs Solving for x˙ from the first equation x1 − x˙ + = we get x˙ = x1 + Replace this for x˙ in the second equation x˙ x2 + = to wire the DAE in equations (23) & (23) equivalently as: x˙ = x1 + (x1 + 1)x2 + = (3) (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 Introduction to Differential Algebraic Equations TU Ilmenau 4.1 Definition and Properties of DAEs Suppose F (t, x, x) ˙ = A(t)x˙ + B(t)x + d(t) Hence, for the system F (t, x, x) ˙ = the Jacobian will be If A(t) is a non-singular (an invertible) matrix, then ∂F ∂ x˙ = A(t) ˙ + B(t)x(t) + d(t)) = [A(t)]−1 [A(t)]−1 (A(t)x(t) ⇒ x(t) ˙ + [A(t)]−1 B(t)x(t) + [A(t)]−1 d(t)) = ⇒ x(t) ˙ = − [A(t)]−1 B(t)x(t) − [A(t)]−1 d(t)) This is an ordinary differential equation Remark In general, if the Jacobian matrix ∂F ∂ x˙ is non-singular (invertible), then the system F (t, x, x) ˙ = can be transformed into an ordinary differential equation (ODE) of the form x˙ = f (t, x) Some numerical solution methods for ODE models have been already discussed Therefore, the most interesting case is when Introduction to Differential Algebraic Equations TU Ilmenau ∂F ∂ x˙ is singular 4.2 Some DAE models from engineering 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: differential equations describing the dynamics of the process, plus algebraic equations describing: • laws of conservation of energy, mass, charge, current, etc • mass, molar, entropy balance equations, etc • desired constraints on the dynamics of the process Introduction to Differential Algebraic Equations TU Ilmenau 4.2 Some DAE models from engineering applications CSTR An isothermal CSTR A B → C Model equation: V˙ = Fa − F Fa C˙ A = (CA0 − CA ) − R1 V Fa C˙ B = − CB + R1 − R2 V F a C˙ C = − CC + R2 V CB = CA − Keq = R2 − k2 CB Introduction to Differential Algebraic Equations TU Ilmenau (5) (6) (7) (8) (9) (10) 4.2 Some DAE models from practical applications 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 species A, 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) = g(x, z) Introduction to Differential Algebraic Equations TU Ilmenau Some DAE models from practical applications a simple pendulum Newton’s Law: m¨ x = − Fl x m¨ y = mg Fl y Conservation of mechanical energy: x2 + y = l2 (DAE) x˙ = x3 x˙ = x4 F x1 ml F x˙ = g x2 l = x2 + y − l x˙ = − Introduction to Differential Algebraic Equations TU Ilmenau Some DAE models from practical applications an 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 = Ohm’s Laws: C V˙ C = iC , LV˙ L = iL , VR = RiR Introduction to Differential Algebraic Equations TU Ilmenau Orthogonal polynomials • Now, from the equation P (τ )dτ N k=1 wk P (τk ) = it follows that N b (pN (τ )q(τ ) + r(τ )) dτ = a wi (pN (τi )q(τk ) + r(τi )) i=1 b b ✟ ✟✟ ⇒ pN (τ )q(τ )dτ + ✟r(τ )dτ = ✟a a =0 N N ✚ ✚ ✚ w wi pN (τi )q(τi ) + ✚i r(τi ) ✚ i=1 i=1 ✚ Observe the following: b • Using polynomial exactness: a r(τ )dτ = N i=1 wi r(τi ) • Orthogonality implies < pN , pk >= 0, k = 1, , N − Thus, b a pN (τ )q(τ ) = N −1 b pN (τ ) a N −1 ck pk (τ )dτ = i=1 b pN (τ )pk (τ )dτ = ck k=1 a =0 Introduction to Differential Algebraic Equations TU Ilmenau Orthogonal polynomials It follows that N k=1 wk pN (τk )q(τk ) = ( ) Theorem If the quadrature nodes τ1 , τ2 , , τN are zeros of the N −th degree shifted Legendre polynomial pN (τ ), then • all the roots τ1 , τ2 , , τN lie inside (0, 1); • the quadrature weights are determined from wi = Li (τ )dτ, where Li (τ ), 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 − exactly Hence, equation ( ) holds true if p1 (τ1 ) = pN (τ2 ) = , p(τN ) = Introduction to Differential Algebraic Equations TU Ilmenau Orthogonal polynomials • Therefore, the quadrature nodes τ1 , τ2 , , τN are chosen as the zeros of the N -th degree shifted Legendre orthogonal polynomial Question: Is there a simple way to compute the zeros τ1 , τ2 , , τN of an orthogonal polynomial pN and the quadrature weights w1 , w2 , , wN ? The answer is give by a Theorem of Welsch & Glub (see next slide) Introduction to Differential Algebraic Equations TU Ilmenau Orthogonal polynomials Theorem (Welsch & Glub 1969 ) The quadrature nodes τ1 , τ2 , , τN and weights w1 , w2 , , wN can be computed from the spectral factorization of JN = V ΛV ; Λ = diag(λ1 , λ2 , , λN ), V V = IN ; of the symmetric tri-diagonal Jacobi matrix √ a √0 b1 JN = b1 a1 √ b2 √ b2 aN −2 bN −1 bN −1 aN −1 where a0 , an , bn , n = 1, , N − are the known coefficients from the recurrence relation In particular Introduction to Differential Algebraic Equations TU Ilmenau Theorem τk = λk , k = 1, , N ; (57) wk = e V ek , k = 1, , N, (58) where e1 , ek are the 1st and the k−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 Introduction to Differential Algebraic Equations TU Ilmenau • There are standardised lookup tables for the integration nodes τ1 , τ2 , , τN and corresponding weights w1 , w2 , , wN The collocation points t1 , 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 collocate x(t) on [a, b] = [0, 10] using a polynomial x ˆ(t) with deg(ˆ x) = m = • Required number of collocation points = N = m + = + = ⇒ First, determine the zeros of the 4-th degree shifted Legendre polynomial p4 (τ ); i.e., find τ1 , τ2 , τ3 , τ4 • These value can be determined to be: τ1 = 0.0694318442, τ2 = 0.3300094783, τ3 = 0.6699905218, τ4 = 0.9305681558 Introduction to Differential Algebraic Equations TU Ilmenau • Next, determine the collocation points : t1 = + (10 − 0) ∗ τ1 = 0.694318442, 3.300094783, t3 = + (10 − 0) ∗ τ3 = 6.699905218, t4 = + (10 − 0) ∗ τ4 = 9.305681558 Introduction to Differential Algebraic Equations TU Ilmenau t2 = + (10 − 0) ∗ τ2 = The collocation polynomial is p(t) = L1 (t) = L2 (t) = L3 (t) = L4 (t) = i xi Li (t) where (t − t2 )(t − t3 )(t − t4 ) (t1 − t2 )(t1 − t3 )(t1 − t4 ) (t − t1 )(t − t3 )(t − t4 ) (t2 − t1 )(t2 − t3 )(t2 − t4 ) (t − t1 )(t − t2 )(t − t4 ) (t3 − t1 )(t3 − t2 )(t3 − t4 ) (t − t1 )(t − t2 )(t − t3 ) (t4 − t1 )(t4 − t2 )(t4 − t3 ) Hence, we approximate x(t) using the third degree polynomial p(t) = x(t) = x1 L1 (t) + x2 L2 (t) + x3 L3 (t) + x4 L4 (t) It remains to determine the coefficients x1 , x2 , x3 , x4 Introduction to Differential Algebraic Equations TU Ilmenau (59) (60) (61) (62) Discretization of DAEs using orthogonal collocation Given the DAE: x˙ = f (t, x, z), t0 ≤ t ≤ tf (63) = g(t, x, z) (64) where x(t) = (x1 (t), x2 (t), , xn (t)) and z(t) = (z1 (t), z2 (t), , zm (t)) • Determine the a set of collocation points t1 , t2 , , tN • corresponding to each differential and algebraic variable define collocation polynomials: N xk (t) −→ p(k) (t) = (k) (65) (j) (66) xi Li (t), k = 1, , n; i=1 N zj (t) −→ p(j) (t) = zi Li (t), j = 1, , m i=1 Introduction to Differential Algebraic Equations TU Ilmenau orthogonal collocation of DAEs • In the DAE, replace xk (t) and zj (t) by q (k) (t) and p(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) ( p˙(2) (t) = f2 (t, p(1) (t), p(2) (t), , p(n) (t) , q (1) (t), q (2) (t), , q (m) ( p˙(n) (t) = f1 (t, p(1) (t), p(2) (t), , p(n) (t) , q (1) (t), q (2) (t), , q (m) ( = g1 (t, p(1) (t), p(2) (t), , p(n) (t) , q (1) (t), q (2) (t), , q (m) ( = g2 (t, p(1) (t), p(2) (t), , p(n) (t) , q (1) (t), q (2) (t), , q (m) ( = gm (t, p(1) (t), p(2) (t), , p(n) (t) , q (1) (t), q (2) (t), , q (m) Introduction to Differential Algebraic Equations TU Ilmenau orthogonal collocation of DAEs • Next discretize the system above using t1 , t2 , , tN to obtain: (1) (2) (n) , zi , zi , , zi (1) (2) (n) , zi , zi , , zi (1) (2) (n) , zi , zi , , zi (1) (2) (n) , zi , zi , , zi (1) (2) (n) , zi , zi , , zi p˙(1) (ti ) = f1 ti , xi , xi , , xi p˙(2) (ti ) = f2 ti , xi , xi , , xi (1) (2) (m) (1) (2) (m) (1) (2) (m) (1) (2) (m) (1) (2) (m) p˙(n) (ti ) = fn ti , xi , xi , , xi = g1 ti , xi , xi , , xi = g2 ti , xi , xi , , xi (1) (2) (n) = gm ti , xi , xi , , xi i = 1, 2, , N Introduction to Differential Algebraic Equations TU Ilmenau (1) (2) (m) , zi , zi , , zi , orthogonal collocation of DAEs • Solve the system of (n + m) × N equations to determine the (k) (n + m) × N unknwons xi , k = 1, , n, i = 1, , N and (j) zi , j = 1, , m, i = 1, , N Example: Use a four point orthogonal collocation to solve the DAE x˙ = x1 + 1, ≤ t ≤ = (x1 + 1)x2 + Solution: we use the collocation polynomials 4 (1) p(1) (t) = i=1 to collocate x1 (t) and x2 (t), respectively Introduction to Differential Algebraic Equations TU Ilmenau (2) xi (t)Li (t) and p(2) (t) = xi (t)Li (t) i=1 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 Introduction to Differential Algebraic Equations TU Ilmenau Resources - Literature 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 • Lloyd N Trefethen: Is Gauss Quadrature Better than TU Ilmenau Clenshaw.Curtis? SIAM REVIEW, Vol 50, No 1, pp 67 – 87, 2008 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-dasslmex-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/ Introduction to Differential Algebraic Equations TU Ilmenau