Advanced-numerical-method-2

106 359 0
Advanced-numerical-method-2

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

University of Technical Education HCM City, 2013 Chapter – Numerical methods for ODE and PDE problems ODE 5.1 Euler Method 5.2 Runge-Kutta method 5.3 Laplace’s Transform 5.4 Analytic solution PDE 5.5 Examples  Initial Valuation Problem Mô hình thực tế Mô hình vật lí dy = f (t , y ); dt y (0) = y0 Phương pháp Cho h = t – t điều kiện ban đầu, y Euler = y(t0), tính : y1 = y + hf (t , y ) y = y1 + hf (t1 , y1 ) y j +1 = y j + hf (t j , y j ) Hoaëc y j = y j −1 + hf (t j −1 , y j −1 ) + O(h ) Dùng pháp Euler Tính dy = t − 2y dt Kết xác y(0) = 1 y = [2t − + 5e − 2t ] j tj f (t j −1 , y j −1 ) Euler yj=yj+hf(tj-1,yj-1) C.xaùc y(tj) 0.0 0.2 0.4 0.6 NaN 0-(2)(1) = - 2.000 0.2 – (2)(0.6) = -1.000 0.4 – (2)(0.4) = -0.4 (Đk ban đầu) 1.000 1.0 + (0.2)(-2.0) = 0.60 0.6 + (0.2)(-1.0) = 0.40 0.4 + (0.2)(- 0.4) = 0.32 1.000 0.688 0.512 0.427 Sai soá yj-y(tj) -0.0879 -0.1117 -0.1065 So sánh với đồ thò : Đối với h biết, sai số lớn kết số sai số rời rạc toàn cuïc max (∑ ( y j − y (t j )) ) j Đánh giá sai số : Sai số đòa phương bước là: ej = yj – y(tj) với y(tj) kết xác tj GDE = max( ej ) 1, … h max(ej ) 0.200 0.100 0.050 0.025 0.1117 0.0502 0.0240 0.0117 j= Giaûi baèng Matlab: function [t,y] = odeEuler(diffeq,tn,h,y0)] t = (0:h:tn)’; n = length(t); y = y0 + zeros(n , 1); for j = : n y(j) = y(j – 1) + h* feval(diffeq,t(j -1),y(j- 1)); >> rhs = inline(‘cos(t)’,’t’,’y’) ; end >> [t,Y] = odeEuler(rhs,2*pi,0.01, 0) ; >> plot(t,Y,’o’) ; Matlab code 2.4 % (i) Exact solution 2.2 sol = dsolve('Dz = z^2 * cos(2*t)', 'z(0)=1', 't'); pretty(sol) 1.8 t = linspace(0, 6, 601); z = eval(vectorize(sol)); 1.6 % (ii) Euler's method 1.4 tn = 6; z0 = 1; h = 0.125; [teul,zeul] =odeEuler(@f,tn,h,z0); 1.2 % Exact solution - Euler approximate solution plot(t,z, teul,zeul,'r-.') legend('Exact', 'Euler') 0.8 grid on 0.6 % 0.4 echo off; diary off % -function [t,z]=odeEuler(f,tn,h,z0) % Function M-file f.m t=(0:h:tn)'; function zp = f(t,z) n=length(t); zp = z.^2 * cos(2.*t); z=z0+zeros(n,1); % - for j=2:n z(j)=z(j-1)+h*feval(f,t(j-1),z(j-1)); end Exact Euler dz = z cos 2t z (0) = dt z (6) = 0.788465 Phương pháp RungeTính độ dốc vò trí ứng với bước laëp: Kutta k1 = f (t j , y j ) h h k = f (t j + , y j + k1 ) 2 h h k = f (t j + , y j + k ) 2 y j +1 k = f (t j + h, y j + hk )  k1 k2 k3 k4  = y j + h  + + + ÷+ O (h5 ) 6 3 6 Sử dụng hàm thư viện Matlab: Sử dụng ode45 Cú pháp : [t,Y] = ode45(diffep,tn,y0) [t,Y] = ode45(diffep,[t0 tn],y0) [t,Y] = ode45(diffep,[t0 tn],y0,options) [t,Y] = ode45(diffep,[t0 tn],y0,options,arg1,arg2,…) Giải Matlab >> rhs = inline(‘cos(t)’,’t’,’y’) ; >> [t,Y] = odeRK4(rhs,2*pi,0.01, function [t,y] = odeRK4(diffeq,tn,h,y0) >> plot(t,Y,’o’) ; t = (0:h:tn)’; n = length(t) ; y = y0+ zeros(n , 1) ; h2= h /2 ; h3= h /3 ; h6= h /6 ; for j = : n k1 = feval(diffeq, t(j -1), y(j-1)) ; k2 = feval(diffeq , t(j -1)+h2, y(j1)+h2*k1 ) ; k3 = feval(diffeq , t(j -1)+h2, y(j1)+h2*k2 ) ; k4 = feval(diffeq , t(j -1)+h , y(j1)+h*k3) ; y(j) = y(j – 1) + h6* (k1+k4) + Hàm thư vieän Matlab [t,Y] = ode45(diffeq,tn,y0) >> rhs = inline(‘cos(t)’,’t’,’y’) ; >> [t,Y] = ode45(rhs,[0 2*pi], >> plot(t,Y,’r’,’linewidth’,2) ; Apply the initial conditions (ii) a sin(0) + b cos(0) = a cos(σ l ) − b sin(σ l ) =   ⇒ b = and det  =0  cos(σ l ) − sin(σ l )  2n −  cos σ l = ⇒ σ n = 2l π , ⇒  X ( x) = a sin( (2n − 1)π x ), n  n 2l n = 1, 2,3,L n = 1, 2,3,L The time response equation 2  2n −  & & Tn (t ) + c  π ÷ T (t ) =  2l  (2n − 1)cπ (2n − 1)cπ ⇒ Tn (t ) = An sin t + Bn cos t 2l 2l Thus the solution implies oscillation with Frequencies (2n − 1)cπ (2n − 1)π ωn = = 2l 2l E , ρ n = 1, 2,3L (6.63) w (x,t) BENDING VIBRATIONS OF A BEAM f (x,t) f(x,t) h1 h2 x M(x,t)+Mx(x,t)dx M(x,t) ·Q w(x,t) V(x,t)+Vx(x,t)dx V(x,t) dx A(x)= h1h2 bending stiffness = EI (x) E = Youngs modulus I (x) = cross-sect area moment of inertia about z ∂ w(x,t) M (x,t) = EI(x) ∂ x2 x x +dx Next sum forces in the y - direction (up, down) Sum moments about the point Q Use the moment given from stenght of materials Assume sides not bend (no shear deformation) Summing forces and moments  ∂V (x,t)  ∂ w(x,t) dx  − V (x,t) + f (x,t)dx = ρA(x)dx V (x,t) +   ∂x ∂t   ∂M(x,t)  ∂V (x,t)  dx  − M(x,t) + V (x,t) + dxdx  M(x,t) +     ∂x ∂x dx + f (x,t)dx =0 ∂M(x,t)  ∂V (x,t) f (x,t)  ⇒ + V (x,t)dx +  + (dx) =0   ∂x   ∂x  ∂M(x,t) ⇒ V (x,t) = − ∂x Substitute into force balance equation yields: ∂ M(x,t) ∂ w(x,t) − dx + f (x,t)dx = ρA(x)dx ∂x ∂t Dividing by dx and substituting for M yields ∂ w(x,t) ∂  ∂ w(x,t)  ρA(x) + EI(x)  = f (x,t) 2 ∂t ∂x  ∂x  Assume constant stiffness to get: ∂ w(x,t) ∂ w(x,t) EI +c = 0, c = ∂t ∂x ρA The possible boundary conditions Free end ∂ 2w bending moment = EI = ∂x ∂  ∂ 2w  shear force = EI  = ∂x  ∂x  Clamped (or fixed) end deflection = w = ∂w slope = =0 ∂x Pinned (or simply supported) end Sliding end deflection = w = ∂w slope = =0 ∂x ∂  ∂ 2w  shear force = EI  = ∂x  ∂x  ∂ 2w bending moment=EI = ∂x Solution of the time equation yields the oscillatory nature & & ′′′′ X ( x ) T (t ) c =− = ω2 ⇒ X ( x) T (t ) &(t ) + ω 2T (t ) = ⇒ T& T (t ) = A sin ωt + B cos ωt Two initial conditions: w( x, 0) = w0 ( x), wt ( x, 0) = w&0 ( x ) Spatial equation results in a boundary value problem (BVP) ω  X ′′′′(x) −   X(x) = c 2   ω ρAω Define β =   = c EI σx Let X(x) = Ae to get : X(x) = a1 sin βx + a2 cos βx + a3 sinh βx + a4 cosh βx Apply boundary conditions to get constants and the characteristic equation Example compute the mode shapes and natural frequencies for a clampedpinned beam At fixed end x = and X(0) = ⇒ a2 + a4 = X ′(0) = ⇒ β (a1 + a3 ) = At the pinned end, x = l and X(l ) = ⇒ a1 sin βl + a2 cos βl + a3 sinh βl + a4 cosh βl = EIX ′′(l ) = ⇒ β (−a1 sin βl − a2 cos βl + a3 sinh βl + a4 cosh βl ) = The boundary conditions in the constants can be written as the matrix equation:   a1  0 1      β β  a2  = 0  sin βl cos βl sinh βl cosh βl a3  0      2 βl −β cos βl β sinh βl β cosh βl a4  0 1−β4 sin 4 4 4 44 4 4 4 4 43 { a B Ba = 0,a ≠ ⇒ det(B) = ⇒ tan βl = βl The characteristic equation Solve numerically (fsolve) to obtain solution to transcendental (characteristic) equation β1l = 3.926602 β 2l = 7.068583 β 3l = 10.210176 β l = 13.351768 β5l = 16.493361 K n >5⇒ (4n + 1)π βnl = Next solve Ba=0 for of the constants: With the eigenvalues known, now solve for the eigen-functions Ba = yields constants in terms of the 4th : Choose a a1 = −a3 from the first equation a2 = −a4 from the second equation (sinh β n l − sin β n l )a3 + (cosh β n l − cos β n l )a4 = from the third (or fourth) equation Solving yields : cosh β n l − cos β n l a3 = − a4 sinh β n l − sin β n l cosh β n l − cos β n l  ⇒ X n (x) = (a4 ) n  (sinh β n l x − sin β n l x) − cosh β n l x + cos β n l x  sinh β n l − sin β n l  Plot the mode shapes to the system response X n, x cosh n cos n sinh n x sin n sinh n sin n x cosh n x cos n x 1.5 Mode Mode Note zero slope 0.5 X 3.926602 , x X 7.068583 , x X 10.210176 , x 0.2 0.4 0.6 0.8 0.5 1.5 Mode x Non zero slope

Ngày đăng: 11/06/2019, 21:23

Mục lục

  • PowerPoint Presentation

  • Slide 2

  • Slide 3

  • Slide 4

  • Slide 5

  • Slide 6

  • Slide 7

  • Slide 8

  • Slide 9

  • Slide 10

  • Slide 11

  • Slide 12

  • Slide 13

  • Slide 14

  • Slide 15

  • Slide 16

  • Slide 17

  • Slide 18

  • Slide 19

  • Slide 20

Tài liệu cùng người dùng

Tài liệu liên quan