Docsity

5 Problems on Computational Methods - Homework 6 | CE 30125, Assignments of Civil Engineering

Toggle sidebar
bg1
UNIVERSITY OF NOTRE DAME
Department of Civil Engineering
and Geological Sciences
CE 30125 Computational Methods November 3, 2009
J.J. Westerink Due: November 10, 2009
Homework Set #6
Problem 1
Evaluate the following approximations for .
a) ; b) ; c)
Problem 2
Use a five node Newton forward interpolation formula to derive central approximation to the second deriva-
tive. Also, derive the error associated with your formula.
Problem 3
Consider:
a) Draw a molecular diagram for the fourth-order accurate central difference formulation.
b) If you used this approximation for computing and , which nodal values would be
shared in both approximations?
Problem 4
Solve the problem
Using a forward Euler method for with time steps equal to and . Compare, by
plotting, to the exact solution given and comment. (Develop your own MATLAB or Fortran code to do this
problem).
10
212
372
4 240
5 600
y4
4yi
h4
----------
3yi
h4
---------------
22yi
h4
-----------------
f22f
x2
--------2f
y2
--------+
2fi1j–
2fi2j1++
ty 1 2y–2t4
=
1t5
t0.2=
t0.02=
t
yexact t
pf2

Partial preview of the text

Download 5 Problems on Computational Methods - Homework 6 | CE 30125 and more Assignments Civil Engineering in PDF only on Docsity!

UNIVERSITY OF NOTRE DAME

Department of Civil Engineering

and Geological Sciences

CE 30125 Computational Methods November 3, 2009

J.J. Westerink Due: November 10, 2009

Homework Set

Problem 1

Evaluate the following approximations for.

a) ; b) ; c)

Problem 2

Use a five node Newton forward interpolation formula to derive central approximation to the second deriva-

tive. Also, derive the error associated with your formula.

Problem 3

Consider:

a) Draw a molecular diagram for the fourth-order accurate central difference formulation.

b) If you used this approximation for computing and , which nodal values would be

shared in both approximations?

Problem 4

Solve the problem

Using a forward Euler method for with time steps equal to and. Compare, by

plotting, to the exact solution given and comment. (Develop your own MATLAB or Fortran code to do this

problem).

y ^4 

^4 y (^) i h

^3  y (^) i h

^2 ^2 y (^) i h

^2 f^ 

(^2) fx^2

(^2) fy^2

2 f (^) i – 1  j  2 f (^) i + 2  j + 1

ty  1 

  • 2 y 2 t 4 = y  1  = 0

1  t  5  t = 0.2  t =0.

t y (^) exact   t

Problem 5

Solve the following problem using a second order accurate Finite Difference method

and

using a space step , , ,.

a) Draw the domain showing all the nodes. Define the unknowns

b) Write the system of equations.

c) Write all your equations in matrix form and solve your system of equations using MATLAB.

Hint: You may want to use the sparse matrix definition command in matlab. Prior to specifying the entries

of matrix A , you designate it as sparse by entering:

A =sparse([])

When you do this, only nonzero locations will be stored. You then solve for the system A x=b using

x=A \ b

Matlab will automatically select an appropriate sparse matrix solver. This will save you lots of time when

the matrix is sparse!!! (which for discrete solutions to p.d.e.’s using lots of discrete points, it always is!)

d) Plot all 4 solutions on the same graph. Now assume that the uses a grid so small that it’s

errors are small compared to the other three grids. (This is a reasonable assumption given the other grid

sizes. If any of the other grid sizes were within a factor of 4 or so for a typical second order method,

this would not be a good assumption.) Then plot the difference between each of the 3 coarse grid

solutions and the solution against x

e) Finally quantify the error for each of your 3 coarse grids by computing the root mean square error

(RMS) between the computed solution at all the nodes and the truth solution. This is

computed as:

where equals the solution at the nodes for spacing and equals the fine grid

solution at that node. Plot on a log-log plot for your 3 grids , , , the error

versus grid spacing. What conclusions can you draw?

d^2 y dx

  • --- y = 5 0  x  10

y  0  = 21 dy dx

x = 10

x = 2.5  x = 0.5  x = 0.1  x =0.

x =0.

x =0.

x =0.

E (^) h

N + 1

-------------  f (^) i – h – f (^) i –  x =0.001^2 i = 0

N

f (^) i – h N + 1 h

N

= ------ f (^) i –  x =0.

x = 2.5  x = 0.5  x =0.