CHAPTER 8e. DIFFERENTIAL EQUATIONS • A. J. Clark School of Engineering •Department of Civil and Environmental Engineering by Dr. Ibrahim A. Assakkaf Spring 2001 ENCE 203 - Computation Methods in Civil Engineering II Department of Civil and Environmental Engineering University of Maryland, College Park First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Galerkin Method Procedure for Deriving Galerkin Approximating Polynomial 1. For a given ordinary differential equation, assume that the solution is a differentiable function such as given by the following polynomial: yˆ = b0 + b1 x + b2 x 2 + L + bn x n (29) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 157 1 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Galerkin Method 2. Use the boundary condition of the ordinary differential equation to evaluate one of the coefficients of the assumed function or to provide a condition toward the solution of the coefficients. 3. Provide an expression for the error e as e= dyˆ dy − dx dx (30) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 158 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Galerkin Method 4. Compute the weight wi for each coefficient, where wi = dyˆ dbi (31) 5. The normal equations are computed from ∫ w e dx = 0 x i for i = 1,2, L, n (32) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 159 2 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 15 – Galerkin Method Using the Galerkin method with a linear model ( i.e. ŷ = bo + b1x) and for 0 ≤ x ≥ 1 to find an approximating function for the following differential: dy = xy such that y = 1 at x = 0 dx Using this function, estimate y at x = 0.6 and compare with the true value. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 160 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 15 (cont’d) – Galerkin Method yˆ = b0 + b1 x yˆ (0 ) = 1 = b0 + b1 (0) ⇒ b0 = 1 dyˆ dy e= − dx dx dyˆ yˆ = 1 + b1 x = b1 and dx © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 161 3 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 15 (cont’d) – Galerkin Method dy (given by the DE) = xy dx dyˆ dy e= − = b1 − xy = b1 − x(1 − b1 x ) dx dx dyˆ =x w1 = db1 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 162 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 15 (cont’d) – Galerkin Method 1 1 ∫ w e dx = ∫ x[b − x(1 − b x )] dx = 0 1 1 0 1 0 1 ∫ [xb − x 1 2 ] + b1 x 3 dx = 0 0 1 x 2b1 x 3 x 4b1 b 1 b − + = 1 − + 1 =0 2 3 4 0 2 3 4 3b1 1 4 = ⇒ b1 = 4 3 9 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 163 4 First-order Ordinary Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 15 (cont’d) – Galerkin Method Therefore the approximating function (linear polynomial) is given by yˆ = b0 + b1 x = 1 + 4 x 9 4 and yˆ (0.6) = 1 + 9 (0.6) = 1.2667 The true value is given by y (0.6 ) = e x 2 error (%) = /2 = e ( 0.6) 2 /2 = 1.1972 1.1972 - 1.2667 ×100 = 5.8% 1.1972 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 164 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Many engineering problems require the solution of higher-order differential equations. ! For example a second-order differential equation can be given as d2y dy = f x, y , 2 dx dx (33) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 165 5 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! The function f(.) does not need to include all the parameters x, y, and dy/dx. ! Examples of higher-order differential equations are dy d2y = 2 x such that y = 0 and = 0 at x = 0 2 dx dx d3y − 2 x − yx + 4 = 0 dx 3 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 166 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! The methods previously introduced can be used to solve higher-order differential equations after transforming them into systems of first-order differential equations. ! The procedure for transforming the DE’s for the following example is as follows: © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 167 6 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering dy d2y = f x, y , 2 dx dx becomes dy2 = f (x, y, y2 ) dx dy1 where y1 = y2 = y2 dx dy dy y2 = 1 = dx dx © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 168 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Higher-order Differential Equations dy1 = f1 (x, y1 , y2 , L, yn ) dx dy2 = f1 (x, y1 , y2 , L , yn ) dx M (34) dyn = f n (x, y1 , y2 , L , yn ) dx © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 169 7 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example – Simply Supported Beam w = 2 k/ft x 10 ft d 2 y M (x ) = dx 2 EI © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 170 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam M w = 2 k/ft x 10 kips V x ∑ M = −M + 10 x − 2 x 2 = 0 − M + 10 x − x 2 = 0 M = 10 x − x 2 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 171 8 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example – Simply Supported Beam Let dy = rotation dx d 2 y dθ M (x ) = = dx 2 dx EI θ= Hence dθ 10 x − x 2 = dx EI dy =θ dx © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 172 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam Assume that EI = 3600 kip/ft2 and at x = 0, y = 0 and θ = - 0.02314, and h = 0.1. Using basic Euler’s method for example, the following equations result: θ i +1 = θ i + fθ (xi , yi ,θ i ) h yi +1 = yi + f y (xi , yi ,θ i ) h © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 173 9 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam First Iteration (i = 0) x0 = 0, θ 0 = −0.02314, and y = 0 fθ (xi ,θ i , yi ) = fθ (x0 ,θ 0 i , y0 ) = dθ dx x = x0 θ =θ 0 y = y0 = 10 x − x 2 EI 10(0) − (0 ) =0 3600 θ1 = θ 0 + fθ (0,−0.0231481,0) h fθ (0,−0.0231481,0 ) = 2 θ1 = −0.0231481 + 0 = −0.0231481 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 174 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam dy = θ0 dx f y (0,−0.0231481,0 ) = θ 0 = −0.0231481 f y (xi ,θ i , yi ) = f y (x0 ,θ 0 , y0 ) h = y1 = y0 + f y (x0 ,θ 0 , y0 ) h = y0 + f y (0,−0.0231481,0 ) y1 = 0 − 0.0231481(0.1) = −0.00231481 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 175 10 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam Second Iteration (i = 1) x1 = 1.1, θ1 = −0.02314, and y = −0.00231481 fθ (xi ,θ i , yi ) = fθ (x1 ,θ1i , y1 ) = dθ dx x = x1 θ =θ1 y = y1 = 10 x − x 2 EI 10(0.1) − (0.1) = 0.00025 fθ (0.1,−0.0231481,−0.00231481) = 3600 θ 2 = θ1 + fθ (0.1,−0.0231481,−0.00231481)h 2 θ 2 = −0.0231481 + 0.000275(0.1) = −0.0231206 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 176 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam dy = θ1 dx f y (0.1,−0.0231206,0 ) = θ1 = −0.0231206 f y (xi ,θ i , yi ) = f y (x1 ,θ1 , y1 ) h = y2 = y1 + f y (x1 ,θ1 , y1 ) h = y1 + f y (0,−0.0231206,0 ) y2 = −0.00231481 − 0.0231206(0.1) = −0.0046269 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 177 11 Higher-order Differential Equations • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example (cont’d) – Simply Supported Beam The exact solution is given by x3 1 − 0.0231481 θ = 5 x 3 − 3 3600 5x3 x4 1 y = − − 0.0231481 x 3 12 3600 x (ft) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2 3 4 5 6 7 8 9 10 dθ dx 0 0.0002750 0.0005444 0.0008083 0.0010667 0.0013194 0.0015667 0.0018083 0.0020444 0.0022750 0.0025000 0.0044444 0.0058333 0.0066667 0.0069444 0.0066667 0.0058333 0.0044444 0.0025000 0.0000000 dy dx -0.0231481 -0.0231481 -0.0231206 -0.0230662 -0.0229853 -0.0228787 -0.0227467 -0.0225900 -0.0224092 -0.0222048 -0.0219773 -0.0185564 -0.0134412 -0.0071870 -0.0003495 0.0065158 0.0128533 0.0181075 0.0217227 0.0231436 θ= y (ft) 0 -0.0023148 -0.0046296 -0.0069417 -0.0092483 -0.0115468 -0.0138347 -0.0161094 -0.0183684 -0.0206093 -0.0228298 -0.0434304 -0.0598018 -0.0704996 -0.0746349 -0.0718744 -0.0624403 -0.0471104 -0.0272179 -0.0046518 Exact θ -0.0231481 -0.0231343 -0.0230933 -0.0230256 -0.0229318 -0.0228125 -0.0226681 -0.0224993 -0.0223066 -0.0220906 -0.0218518 -0.0183333 -0.0131481 -0.0068518 0.0000000 0.0068519 0.0131482 0.0183334 0.0218519 0.0231482 Exact y (ft) 0 -0.0023143 -0.0046260 -0.0069321 -0.0092302 -0.0115176 -0.0137919 -0.0160504 -0.0182909 -0.0205110 -0.0227083 -0.0429629 -0.0588193 -0.0688887 -0.0723377 -0.0688886 -0.0588191 -0.0429626 -0.0227079 0.0000000 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 178 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! The previous methods for solving ordinary differential equations can be used to solve higher-order differential equations as discussed earlier. ! These methods require the initial conditions to be at the same x value. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 179 12 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! For example, the initial conditions in Example 15 were given as x0 = 0 y0 = 0 θ 0 = −0.0231481 ! The rotationθ is not usually known. ! However, in Ex. 15 it is known that at x = 0, y = 0 and at x = 10, y = 0 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 180 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! The two conditions have different x values. Therefore, they cannot be used in solving the differential equation based on the previous methods. ! In this case, we are dealing with a boundary-value problem. ! Boundary-value problems can be solved numerically using Shooting and Finitedifference methods. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 181 13 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Shooting Method – The shooting method is a trial-and-error method that uses any of the previously introduced methods for solving differential equations. – The shooting method is based on converting the boundary-value problem into an equivalent initial-value problem. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 182 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Finite-Difference Method Recall the finite-difference expressions for approximating the first and second derivatives based on two-step method f (xi +1 ) − f (xi ) 2h f (xi −1 ) − 2(xi ) + f (xi +1 ) f ′′(xi ) ≈ h2 f ′(xi ) ≈ (35) (36) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 183 14 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Finite-Difference Method – In this method, the derivatives in the differential equation are replaced by finitedifference equations (formulas). – Then, the resulting DE, which is now in a finite-difference form, is used at some interior points using a selected step size h and the boundary conditions. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 184 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Finite-Difference Method – Each use of the finite-difference equation results in a linear equation in terms of the unknown solutions at the selected interior points. – In this case, we get a system of linear equations that need to be solved simultaneously to obtain the solution at the interior points. © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 185 15 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 – Simply Supported Beam The simply supported beam is subjected to distributed loading w as shown in the figure. Numerically, find the bending moment M at each node along its span. w = 2 k/ft x 10 ft © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 186 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 – Simply Supported Beam B.C.' s : at x = 0, M = 0 and at x = 10, M = 0 M2 M1 2.5 M3 2.5 M4 2.5 M5 2.5 10 ft x © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 187 16 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam The governing differential equation in this case is given by d 2M = w = distributed load dx 2 or d 2M = -2 dx 2 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 188 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply f (x f ′′(x ) ≈ Supported Beam i i −1 ) − 2(xi ) + f (xi +1 ) h2 (Eq. 36) The original differential equation can be converted to a finite-difference equation (see Eq. 36) as follows: d 2 M M i −1 − 2 M i + M i +1 ≈ dx 2 h2 M i −1 − 2 M i + M i +1 = −2 h2 (37) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 189 17 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam h, is case, is equal to 2.5 ft, therefore Eq. 37 can be simplified as follows. M i −1 − 2M i + M i +1 = −2 (2.5)2 or M i −1 − 2M i + M i +1 = −2(6.25) M i −1 − 2M i + M i +1 = −12.5 (38) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 190 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam Application of Eq. 38 at the interior nodes 2, 3, and 4, yields a set of three simultaneous equations as follows: M M M M M At Node 2: 2 1 2.5 0 3 2.5 4 2.5 5 2.5 10 ft x M 1 − 2M 2 + M 3 = −12.5 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 191 18 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam M M M 2 1 At Node 3: 2.5 M4 3 2.5 2.5 M5 2.5 10 ft x M 2 − 2M 3 + M 4 = −12.5 M2 M1 At Node 4 2.5 M3 2.5 M4 M5 2.5 2.5 10 ft 0 x M 3 − 2M 4 + M 5 = −12.5 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 192 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam − 2M 2 + M 3 = −12.5 M 2 − 2M 3 + M 4 = −12.5 M 3 − 2M 4 = −12.5 0 M 2 − 12.5 − 2 1 1 − 2 1 M = − 12.5 3 0 1 − 2 M 4 − 12.5 (39) © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 193 19 Boundary-Value Problems • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ! Example 16 (cont’d) – Simply Supported Beam Equation 39 yields the solution as follows: M2 M1 2.5 M3 2.5 M4 2.5 10 ft x M5 2.5 M 2 18.75 M = 25.00 ft - kips 3 M 4 18.75 © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 194 • A. J. Clark School of Engineering • Department of Civil and Environmental Engineering ☺ I wish you good luck in your final ☺ Exams © Assakkaf ENCE 203 – CHAPTER 8e. DIFFERENTIAL EQUATIONS Slide No. 195 20