46
Computational Fluid Dynamics I P P PI I I W W W Elementary Numerical Analysis: Finite Difference Approximations-II Instructor: Hong G. Im University of Michigan Fall 2001

WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

  • Upload
    others

  • View
    3

  • Download
    1

Embed Size (px)

Citation preview

Page 1: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

ElementaryNumerical Analysis:

Finite Difference Approximations-II

Instructor: Hong G. ImUniversity of Michigan

Fall 2001

Page 2: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW• The linear advection-diffusion equation• Finite difference approximations• Finite Difference Approximation of the linear

advection-diffusion equation• Accuracy• Stability• Consistency• Higher order finite difference approximations in

space• Time integration: implicit versus explicit and higher

accuracy • Finite Volume Approximations

Outline

Page 3: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Solving a partial differential

equation

Page 4: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

∂f∂t

+ U∂f∂x

= D∂ 2 f∂x 2

We will use the model equation:

Although this equation is much simpler than the full Navier Stokes equations, it has both an advection term and a diffusion term. Before attempting to solve the equation, it is useful to understand how the analytical solution behaves.

to demonstrate how to solve a partial differential equation numerically.

Model Equations

Page 5: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWFor initial conditions of the form:

)2sin()0,( kxAtxf π==

))(2sin(),(2)2( UtxkAetxf tkD −= − ππ

It can be verified by direct substitution that the solution is given by:

which is a decaying traveling wave

Model Equations

k = 1.0U = 1.0D = 0.05A = 1.0

Page 6: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Finite Difference Approximations of

the Derivatives

Page 7: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWDerive a numerical approximation to the governing equation, replacing a relation between the derivatives by a relation between the discrete nodal values.

h h

f(t,x-h) f(t,x) f(t,x+h)∆ t

∆ t

f (t)

f (t + ∆t)

f (t + 2∆t)

Finite Difference Approximations

Page 8: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

The Time Derivative is found using a FORWARD EULER method. The approximation can be found by using a Taylor series

h h

f(x-h) f(x) f(x+h)∆ t

Finite Difference Approximations

Page 9: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

TheTime Derivative

Finite Difference Approximations

Page 10: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

f (t + ∆t) = f (t) +∂f (t)

∂t∆t +

∂ 2 f (t)∂t2

∆t2

2+"

∂f (t)∂t

=f (t + ∆t) − f (t)

∆t+

∂ 2 f (t)∂t 2

∆t2

+"

Solving this equation for the time derivative gives:

Time derivative

Finite Difference Approximations

Page 11: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

TheSpatial Derivative:

First Order

Finite Difference Approximations

Page 12: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

When using FINITE DIFFERENCE approximations, the values of f are stored at discrete points.

h h

f(x-h) f(x) f(x+h)

The derivatives of the function are approximated using a Taylor series:

Finite Difference Approximations

Page 13: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Subtracting the second equation from the first:

f ( x + h) = f (x) +∂f (x)

∂xh +

∂ 2 f (x)∂x 2

h2

2+

∂ 3 f (x)∂x3

h3

6+

∂ 4 f (x)∂x 4

h4

24+"

f ( x − h) = f (x) −∂f (x)

∂xh +

∂ 2 f (x)∂x 2

h2

2−

∂ 3 f ( x)∂x3

h3

6+

∂ 4 f (x)∂x 4

h4

24−"

!!f (x + h) − f (x − h) = 2 ∂f (x)

∂xh + 2 ∂ 3 f (x)

∂x3h3

6+"

Start by expressing the value of f(x+h) and f(x-h) in terms of f(x)

Finite Difference Approximations

Page 14: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

!!

∂f (x)∂x

=f (x + h) − f (x − h)

2h+

∂ 3 f (x)∂x3

h2

6+"

Rearranging this equation to isolate the first derivative:

f (x + h) − f (x − h) = 2 ∂f (x)∂x

h + 2 ∂ 3 f (x)∂x3

h3

6+"

Finite Difference Approximations

The result is:

Page 15: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

TheSpatial Derivative:

Second Order

Finite Difference Approximations

Page 16: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

!!f ( x + h) = f (x) +

∂f (x)∂x

h +∂ 2 f (x)

∂x 2h2

2+

∂ 3 f (x)∂x3

h3

6+

∂ 4 f (x)∂x 4

h4

24+"

f ( x − h) = f (x) −∂f (x)

∂xh +

∂ 2 f (x)∂x 2

h2

2−

∂ 3 f ( x)∂x3

h3

6+

∂ 4 f (x)∂x 4

h4

24−"

Start by expressing the value of f(x+h) and f(x-h) in terms of f(x)

Adding the second equation to the first:

!!f (x + h) + f (x − h) = 2 f (x) + 2 ∂f 2(x)

∂x2h2

2+ 2 ∂ 4 f (x)

∂x4h4

24+"

Finite Difference Approximations

Page 17: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

!!

∂ 2 f (x)∂x2 =

f (x + h) − 2 f + f (x − h)h2 +

∂ 4 f (x)∂x4

h2

12+"

f (x + h) + f (x − h) = 2 f (x) + 2 ∂f 2(x)∂x2

h2

2+ 2 ∂ 4 f (x)

∂x4

h4

24+"

Rearranging this equation to isolate the second derivative:

The result is:

Finite Difference Approximations

Page 18: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Solving the partial differential equation

Finite Difference Approximations

Page 19: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

∂f∂t

+ U∂f∂x

= D∂ 2 f∂x 2

A numerical approximation to

Is found by replacing the derivatives by the following approximations

Finite Difference Approximations

∂f∂t

j

n

+ U ∂f∂x

j

n

= D ∂ 2 f∂x2

j

n

h h

fjn+1

fjn fj +1

nfj −1n ∆t

Page 20: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

f jn = f (t, x j )

f jn+1 = f (t + ∆t, x j )

f j +1n = f (t, x j + h)

f j −1n = f (t, x j − h)

Using the shorthand notation

Finite Difference Approximations

∂f∂t

j

n

=fj

n+1 − fjn

∆t+ O(∆t)

∂f∂x

j

n

=fj +1

n − fj −1n

2h+ O(h2 )

∂ 2 f∂x 2

j

n

=fj +1

n − 2 fjn + fj −1

n

h2 + O(h2 )

gives

Page 21: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWSubstituting these approximations into:

gives

∂f∂t

+ U∂f∂x

= D∂ 2 f∂x 2

Finite Difference Approximations

f jn+1 − fj

n

∆t+ U

f j +1n − fj −1

n

2h= D

fj +1n − 2 f j

n + f j −1n

h2 + O(∆t, h2)

fjn+1 = fj

n − U∆t2h

( fj +1n − fj −1

n ) + D∆th2 ( fj +1

n − 2 f jn + fj −1

n )

Solving for the new value and dropping the error terms yields

Page 22: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

fjn+1 = fj

n − U∆t2h

( fj +1n − fj −1

n ) + D∆th2 ( fj +1

n − 2 f jn + fj −1

n )

The value of every point at level n+1 is given explicitly in terms of the values at the level n

h h

fjn+1

fjn fj +1

nfj −1n ∆t

Finite Difference Approximations

Thus, given f at one time (or time level), f at the next time level is given by:

Page 23: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Example

Page 24: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

A short MATLAB programThe evolution of a sine wave is followed as it is advected and diffused. Two waves of the infinite wave train are simulated in a domain of length 2. To model the infinite train, periodic boundary conditions are used. Compare the numerical results with the exact solution.

Page 25: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW% one-dimensional advection-diffusion by the FTCS schemen=21; nstep=100; length=2.0; h=length/(n-1); dt=0.05; D=0.05;f=zeros(n,1); y=zeros(n,1); ex=zeros(n,1); time=0.0;for i=1:n, f(i)=0.5*sin(2*pi*h*(i-1)); end; % initial conditionsfor m=1:nstep, m, time

for i=1:n, ex(i)=exp(-4*pi*pi*D*time)*...0.5*sin(2*pi*(h*(i-1)-time)); end; % exact solution

hold off; plot(f,'linewidt',2); axis([1 n -2.0, 2.0]); % plot solutionhold on; plot(ex,'r','linewidt',2);pause; % plot exact solutiony=f; % store the solutionfor i=2:n-1,

f(i)=y(i)-0.5*(dt/h)*(y(i+1)-y(i-1))+...D*(dt/h^2)*(y(i+1)-2*y(i)+y(i-1)); % advect by centered differences

end;f(n)=y(n)-0.5*(dt/h)*(y(2)-y(n-1))+...

D*(dt/h^2)*(y(2)-2*y(n)+y(n-1)); % do endpoints forf(1)=f(n); % periodic boundariestime=time+dt;

end;

Page 26: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Evolution forU=1; D=0.05; k=1

N=21∆t=0.05

Exact

Numerical

Page 27: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Accuracy

Page 28: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWIt is clear that although the numerical solution is qualitatively similar to the analytical solution, there are significant quantitative differences.

The derivation of the numerical approximations for the derivatives showed that the error depends on the size of h and ∆t.

First we test for different ∆t.

Number of time steps= T/ ∆t

Page 29: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1m = 10, time = 0.50Evolution

forU=1; D=0.05; k=1

N=21∆t=0.05

Exact

Numerical

Accuracy

Page 30: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1m = 20, time = 0.50Repeat with

a smaller time-step∆t=0.025

Exact

Numerical

Accuracy

Page 31: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1m = 40, time = 0.50Repeat with

a smaller time-step∆t=0.0125

Exact

Numerical

Accuracy

Page 32: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1

x

f(x,t)

0 0.5 1 1.5 2

-1

-0.5

0

0.5

1m = 1000, time = 0.50

U=1; D=0.05; k=1

N=201∆t=0.0005

Exact

Numerical

Accuracy

Very fine spatial resolution and a small time step

Page 33: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Quantifying the ErrorI. Order of Accuracy

Page 34: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

E = h ( fj − fexact )2

j =1

N

n=11; E = 0.1633n=21; E = 0.0403n=41; E = 0.0096n=61; E = 0.0041n=81; E = 0.0022n=101; E = 0.0015n=121; E = 0.0011n=161; E = 9.2600e-04

Exact

Numerical

Order of Accuracy

time=0.50

Page 35: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

100 101 10210-4

10-3

10-2

10-1

100

Accuracy. Effect ofspatial resolution

1/ h

dt=0.0005N=11 to N=161 E

Order of Accuracy

time=0.50

Page 36: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

E = Ch2 = CLn

2

= CL2n−2

E = ˜ C n−2

ln E = ln ˜ C n−2( )= ln ˜ C − 2ln n

On a log-log plot, the E versus n curve should therefore have a slope -n

If the error is of second order:

Order of Accuracy

Page 37: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

100 101 10210-4

10-3

10-2

10-1

100Accuracy. Effect ofspatial resolution

21

1/ h

dt=0.0005

N=11 to N=161E

Order of Accuracy

time=0.50

?

Page 38: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Why is does the error deviate from the line for the highest values of N?

Number of Steps, N = 1/h

Erro

r Total

Roundoff

Truncation

Page 39: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Quantifying the ErrorII. Modified Wave Number

Page 40: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

Order of Accuracy

- how mesh refinement improves the accuracy

Modified Wave Number

- how the difference scheme maintains accuracy at high wave numbers

Modified Wave Number

Page 41: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

ikxexf =)(

Consider a pure harmonic of period L

where k can take on any of the following values

2/,22/,12/2 NNNnnL

k "+−+−== π

Modified Wave Number

The exact derivative isikxikexf =′ )(

We now ask how the second order central difference computes the derivative of f

Page 42: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

.1,2,1,0, −== NjjNLx j "

Discretize the x axis with a uniform mesh

Substituting

Modified Wave Number

NLff

xf jj

j

/,2

11 =∆∆−

= −+

δδ

Finite-difference approximation:

,)( /2 Nnjiikx eexf π==

Page 43: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWModified Wave Number

Modified Wave Number:

∆−=

−+

2

/)1(2/)1(2 NjniNjni

j

eexf ππ

δδ

jj

j

NniNni

fkifNni

fee

′=∆

=

∆−=

)/2sin(2

/2/2

π

ππ

∆=′ )/2sin( Nnk π

Page 44: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWModified Wave Number

Summary:

)2sin(;)/2sin(

2;2

NnkNnk

Nnkn

Lk

ππ

ππ

=′∆∆

=′

=∆=

Page 45: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWW

k∆

k'∆

0 1 2 30

1

2

3 Exact2nd Order Central4th Order Central6th Order Central4th Order Pade6th Order Pade

Modified Wave Number

Page 46: WPI Computational Fluid Dynamics Iphoenics/SITE_PHOENICS/Apostilas/CFD... · 2003-09-23 · WPIPI Computational Fluid Dynamics I ∂f ∂t + U ∂f ∂x = D ∂2 f ∂x2 We will use

Computational Fluid Dynamics IPPPPIIIIWWWWEnhancing Accuracy - Padé Scheme

4th Order Padé Scheme:v

jjjjjj fhffh

fff30

)(344

1111 +−=′+′+′ −+−+

2nd Order Central Difference:

jjjj fhffh

f ′′′−−=′ −+ 6)(

21 2

11

4th Order Central Difference:

)()88(12

1 42112 hOffff

hf jjjjj +′−+−=′ ++−−

Tridiagonal system of equations for jf ′