Sunteți pe pagina 1din 8

Homework 3 (ENAE684)

Moon Soo, Navadeep & Eli (3.1) GIVEN:

2x Periodic boundary condition (L = 2*) REQUIRED: A computer program to approximate first derivative of function at 8, 16, 32, 64, 128, and 256 point meshes Plot 1: Approximate first derivative values versus x for three coarsest meshes (M=8, 16, 32) and exact first derivative Plot 2: Actual error of first derivative values versus x for three coarsest meshes Plot 3: Actual error of first derivative values versus x for three finest meshes (M=64, 128, 256) Description of errors for each plot Explanation of shape of errors for three coarsest meshes and three finest meshes. Table of predicted values and errors at x = /8 as a function of x. Comparison with answers from problem 2.5 Plot 4: L1 norm of grid error versus x on a log-log plot. Observations about the increased accuracy.
j

3-pt central differencing: x u

u j +1 + u j 1

SOLUTION: a) The problem is to write the 3-point central difference scheme for the given periodic function and see how the grid refinements affect the approximated derivative of the function. b) Attached c) Attached d) Attached e) Attached f) The coarse grids resolutions are not dense enough to capture the wavelength of our function. According Nyquist sampling theorem 2dx is the shortest wavelength that may be captured. So the error oscillation for coarse grids looks very random compared to the dense grids. g) Table of predicted values and errors at x=pi/8
Dx M= M= M= 16 dx = 3.92699082e-001 32 dx = 1.96349541e-001 64 dx = 9.81747704e-002 Exact du -3.4142 -3.4142 -3.4142 -3.4142 -3.4142 Approximate du Absolute error

M = 128 dx = 4.90873852e-002 M = 256 dx = 2.45436926e-002

1.1035 -1.6696 -2.9271 -3.2890 -3.3827

-4.5177 -1.7446 -0.4872 -0.1252 -0.0315

h) Attached

du/dx vs x for M=8,16,32 10 ux exact 8 u for M=8


x x x

u for M=16 6 u for M=32

4 du/dx

-2

-4 0

3 x

error vs x for M=8,16,32 10 error for M=8 error for M=16 error for M=32

error 0 -5 0

3 x

du/dx vs x for M=64,128,256 10 u exact


x x x x

u for M=64 u for M=128

u for M=256

4 du/dx

-2

-4 0

3 x

error vs x for M=64,128,256 0.8 error for M=64 error for M=128 error for M=256

0.6

0.4

0.2 error 0 -0.2 -0.4 -0.6

3 x

10

L-norm of error vector vs delta X

L-norm of error vector

10

10

-1

10

-2

10

-2

10 delta X

-1

10

(3.2) GIVEN:

4-pt backward-biased differencing: x u Periodic boundary condition (L = 2*)

2 u j +1 + 3 u j 6 u j 1 + u j 2 6x

REQUIRED: Comparison of coefficients with problem 2.3 A computer program to approximate first derivative of function at 8, 16, 32, 64, 128, and 256 point meshes Plot 1: Approximate first derivative values versus x for three coarsest meshes (M=8, 16, 32) and exact first derivative Plot 2: Actual error of first derivative values versus x for three coarsest meshes Plot 3: Actual error of first derivative values versus x for three finest meshes (M=64, 128, 256) Description of errors for each plot Explanation of shape of errors for three coarsest meshes and three finest meshes. Table of predicted values and errors at x = /8 as a function of x. Comparison with answers from problem 2.5 Plot 4: L1 norm of grid error versus x on a log-log plot. Observations about the increased accuracy.

SOLUTION: a) They are the same coefficients. b) Attached c) Attached d) Attached e) Table of predicted values and errors at x=pi/8
M= M= M= M= 8 dx = 7.85398163e-001 16 dx = 3.92699082e-001 32 dx = 1.96349541e-001 64 dx = 9.81747704e-002 0 -3.4142 -3.4142 -3.4142 -3.4142 -3.4142 0 0

M = 128 dx = 4.90873852e-002 M = 256 dx = 2.45436926e-002

1.8403 -2.820 7 -3.407 6 -3.418 7 -3.415 1

-5.2545 -0.593 6 -0.006 6 0.004 5 0.000 9

f) Attached

du/dx vs x for M=8,16,32 10 u exact 8


x

ux for M=8 u for M=16


x x

u for M=32

4 du/dx

-2

-4 0

3 x

error vs x for M=8,16,32 10 8 6 4 error 2 0 -2 -4 -6 error for M=8 error for M=16 error for M=32

3 x

du/dx vs x for M=64,128,256 10 ux exact u for M=64


x

ux for M=128 ux for M=256

4 du/dx

-2

-4 0

3 x

error vs x for M=64,128,256 0.3

0.2

0.1

0 error -0.1 -0.2 error for M=64 error for M=128 error for M=256 0 1 2 3 x L-norm of error vector vs delta X 4 5 6 7 -0.3 -0.4 10
1

10 L-norm of error vector

10

-1

10

-2

10

-3

10

-2

10 delta X

-1

10

(3.3) GIVEN: 3-pt central Hermetian (compact) differencing: u + u j 1 1 x u j +1 + 4 x u j + x u j 1 = j +1 6 2x

Periodic boundary condition (L = 2*)

REQUIRED: Description of Sherman-Morrison algorithm A computer program to approximate first derivative of function at 8, 16, 32, 64, 128, and 256 point meshes Plot 1: Approximate first derivative values versus x for three coarsest meshes (M=8, 16, 32) and exact first derivative Plot 2: Actual error of first derivative values versus x for three coarsest meshes Plot 3: Actual error of first derivative values versus x for three finest meshes (M=64, 128, 256) Description of errors for each plot Explanation of shape of errors for three coarsest meshes and three finest meshes. Table of predicted values and errors at x = /8 as a function of x. Comparison with answers from problem 2.5 Plot 4: L1 norm of grid error versus x on a log-log plot. Observations about the increased accuracy. SOLUTION: a) The Sherman-Morrison Algorithm is a more efficient periodic tridiagonal solution solver. It breaks the problem into two linear combinations. b) Attached c) Attached d) Attached e) Attached f) For the higher order compact scheme the convergence to the exact solution is much faster.
A p p r o x im a te firs t d e r iv a tiv e s w ith m e s h s iz e = 8 , 1 6 , 3 2 10 E M M M xa ct =8 =1 6 =3 2

4 du 2 0 -2 -4 0

3 x

E rs rro 5

0 Error -5

E ac x t M8 = M 16 = 2 4 x Er r r os 6 8

-1 0

0 1 .0 5 0 1 .0 0 0 .0 5 Error 0 -0 0 .0 5 -0 1 .0 -0 1 .0 5 -0 2 .0 0 2 4 x 6

M6 =4 M1 8 =2 M2 6 =5

1 0

L o o e r v cto v d lta X -n rm f rro e r s e

1 0

L-norm of error vector

1 0

-1

1 0

-2

1 0

-3

1 0

-4

1 0

-5

1 0

-6

1 0

-2

1 0 d lta X e

-1

1 0

S-ar putea să vă placă și