Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scientific Computing Partial Differential Equations Explicit Solution of Wave Equation.

Similar presentations


Presentation on theme: "Scientific Computing Partial Differential Equations Explicit Solution of Wave Equation."— Presentation transcript:

1 Scientific Computing Partial Differential Equations Explicit Solution of Wave Equation

2 Partial Differential Equations Our study of PDE’s is focused on linear, second-order equations The following general form will be evaluated for B 2 - 4AC (Variables – x and y/t)

3 Partial Differential Equations B 2 -4AC Category Example < 0 EllipticLaplace equation (steady state with 2 spatial dimensions) = 0 ParabolicHeat conduction equation (time variable with one spatial dimension) >0HyperbolicWave equation (time-variable with one spatial dimension)

4 Wave Equation Mechanical vibrations of a guitar string, or in the membrane of a drum, or a cantilever beam are governed by a partial differential equation, called the wave equation. To derive the wave equation we consider an elastic string vibrating in a plane, as the string on a guitar. Assume u(x,t) is the displacement of the string away from its equilibrium position u=0.

5 Wave Equation u(x,t) x u T(x+  x,t) T(x,t) x x+  x  

6 Wave Equation Newton’s Law: F=ma Vertical: where ρ is the mass density function of the string Horizontal: As we assume there is only vertical motion of the string T(x+  x,t) T(x,t)  

7 Wave Equation Let Then, So, F vert = ma implies, from the previous slide, that Or,

8 Wave Equation Now, tan β is just the slope of the string at x+Δx and tan α is the slope at x. Thus, So, T(x+  x,t) T(x,t)  

9 Wave Equation Now, take the limit as Δx -> 0, to get This the Wave Equation in one dimension (x)

10 Wave Equation-Boundary Since the wave equation is second order in space and time, we need two boundary conditions for each variable. We will assume the string x parameter varies from 0 to 1. Typical set-up is to give boundary conditions at the ends of the string in time: u(0,t) = g 0 (t) u(1,t) = g 1 (t) and space initial conditions for the displacement and velocity: u(x,0) = f 1 (x) u t (x,0)=f 2 (x)

11 Wave Equation

12 We will solve this equation for x and t values on a grid in x-t space: One Dimensional Wave Equation Approximate solution u ij= u(x i, t j ) at grid points

13 To approximate the solution we use the finite difference approximation for the two derivatives in the wave equation. We use the centered-difference formula for the space and time derivatives: Finite Difference Approximation

14 Then the wave equation (u tt =c 2 u xx ) can be approximated as Or, Let p = (ck/h) Solving for u i,j+1 we get: Finite Difference Approximation

15 Note that this formula uses info from the j-th and (j- 1)st time steps to approximate the (j+1)-st time step: One Dimensional Wave Equation

16 The solution is known for t=0 (j=0) but the formula uses values for j-1, which are unknown. So, we use the initial condition u t (x,0)=f 2 (x) and the cenetered difference approximation for u t to get At the first time step, we then get One Dimensional Wave Equation

17 Simplifying, we get So, One Dimensional Wave Equation

18 function z = explicitWave(f1, f2, g0, g1, T, n, m, c) %Explicit solution to wave equation % Constants, x and t vectors h = 1/n; k = T/m; p = c*k/h; x = 0:h:1; t = 0:k:T; % Boundary conditions u(1:n+1, 1) = f1(x)’; uprime(1:n+1, 1) = f2(x)'; u(1, 1:m+1) = g0(t); u(n+1, 1:m+1) = g1(t); % Solution for second row u(2:n, 2) = 0.5*(p^2)*u(1:n-1,1) + (1-p^2)*u(2:n,1)+0.5*(p^2)*u(3:n+1,1)+k*uprime(2:n,1); % compute solution forward in time from j=3 for j = 2:m u(2:n,j+1) = (p^2)*u(1:n-1,j) + 2*(1-p^2)*u(2:n,j) + (p^2)*u(3:n+1,j) - u(2:n,j-1); end z=u’; mesh(x,t,z); end Matlab Implementation

19 Usage: f1= inline(‘ x.*(1-x) ’); f2=inline(‘0*x’); g0 = inline(‘0*t’); g1 = inline(‘0*t’); n=5; m=5; c=1; T=1.0; z = explicitWave(f1, f2, g0, g1, T, n, m, c); Matlab Implementation

20 Calculated solution appears correct: Matlab Implementation

21 It can be shown that the algorithm for the explicit solution is stable if |p| <= 1. (Michael Heath – Scientific Computing: An Introductory Survey, McGraw-Hill) Stability


Download ppt "Scientific Computing Partial Differential Equations Explicit Solution of Wave Equation."

Similar presentations


Ads by Google