hmwk_6_2010_solutions

Hmwk_6_2010_solution - CE 30125 Computational Methods Assignment 6 KEY Courtesy of Jake T Lussier December 9 2010 Problem 1 For this problem we

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CE 30125 Computational Methods: Assignment 6 KEY Courtesy of Jake T. Lussier December 9, 2010 Problem 1 For this problem, we formulate a second order accurate approximation to the following three dimen- sional partial differential equation at node ( i, j, k ): ∂ 2 f ∂x 2 + ∂ 2 f ∂y 2 + ∂ 2 f ∂z 2 + ∂ 2 f ∂x∂y + ∂ 2 f ∂y∂z = B ( x,y,z ) To do so, we first express each of the terms using second-order central difference approximations to the second derivative (since cancellation of terms results in increased accuracy for this approximation). ∂ 2 f ∂x 2 = f i +1 ,j,k- 2 f i,j,k + f i- 1 ,j,k Δ x 2 ∂ 2 f ∂y 2 = f i,j +1 ,k- 2 f i,j,k + f i,j- 1 ,k Δ y 2 ∂ 2 f ∂z 2 = f i,j,k +1- 2 f i,j,k + f i,j,k- 1 Δ z 2 ∂ 2 f ∂x∂y = ∂ ∂y ∂f ∂x = ∂ ∂y f i +1 ,j,k- f i- 1 ,j,k 2Δ x = 1 4Δ x Δ y [( f i +1 ,j +1 ,k- f i +1 ,j- 1 ,k )- ( f i- 1 ,j +1 ,k- f i- 1 ,j- 1 ,k )] = 1 4Δ x Δ y [ f i +1 ,j +1 ,k- f i +1 ,j- 1 ,k- f i- 1 ,j +1 ,k + f i- 1 ,j- 1 ,k ] ∂ 2 f ∂y∂z = ∂ ∂z ∂f ∂y = ∂ ∂z f i,j +1 ,k- f i,j- 1 ,k 2Δ y = 1 4Δ y Δ z [( f i,j +1 ,k +1- f i,j +1 ,k- 1 )- ( f i,j- 1 ,k +1- f i,j- 1 ,k- 1 )] = 1 4Δ y Δ z [ f i,j +1 ,k +1- f i,j +1 ,k- 1- f i,j- 1 ,k +1 + f i,j- 1 ,k- 1 ] B( x, y, z ) is then the sum of these five terms. 1 0.5 1 1.5 2 2.5 3 3.5 4-2-1 1 2 3 4 5 6 7 Time (t) y(t) Problem 2 Solutions for varying time steps dt=0.002 dt=0.02 dt=0.2 Figure 1: Solutions using Euler’s Method. Problem 2 For this problem, we solve the problem dy dt = y 2 t (5- y ) 5 , y (0) = 1 Using a forward Euler method for 0 ≤ t ≤ 4 with time steps equal to Δ t = 0.2, Δ t = 0.02, and Δ t = 0.002. To do so, we first discretize the o.d.e at a general node i y 2 i t (5- y i ) 5 We then approximate dy dt using a forward difference approximation y i +1- y i Δ t = y 2 i t (5- y i ) 5 = ⇒ y i +1 = y i + t i y 2 i Δ t (5- y i ) 5 This can be implemented in MATLAB using a code such as the program Prob2.m. The solutions for Δ t = 0 . 2, Δ t = 0 . 02 and Δ t = 0 . 002 are shown in Figure 1. As can be seen, time steps of 0.02 and 0.002 seem to give stable solutions to the equation, and are likely good approximations to the actual solution. However, using a time step of 0.2 gives different answers initially and eventually becomes unstable and inaccurate, jumping between different values as time approaches 4. 2 Figure 2: Domains for Δ x = 2.5, Δ x = 0.5, Δ x = 0.1, and Δ x = 0.001. Problem 3 For this problem, we solve the problem d 2 y dx 2 + x dy dx + 1 6 y = 3 , ≤ x ≤ 10 given the initial conditions y (0) = 12 , dy dx (10) = 2 We do so by using a second order accurate Finite Difference method and time steps of 2.5, 0.5, 0.1, and 0.001....
View Full Document

This note was uploaded on 03/02/2012 for the course CE 30125 taught by Professor Westerink,j during the Fall '08 term at Notre Dame.

Page1 / 18

Hmwk_6_2010_solution - CE 30125 Computational Methods Assignment 6 KEY Courtesy of Jake T Lussier December 9 2010 Problem 1 For this problem we

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online