You are on page 1of 7

Computational Fluid Dynamics

http://www.nd.edu/~gtryggva/CFD-Course/!

Computational Fluid Dynamics


Godunovs Theorem! Godunov Theorem (1959):! Monotone behavior of a numerical solution cannot be assured for linear nite-difference methods with more than rst-order accuracy. !
1.5

Advection !
Grtar Tryggvason! Spring 2011!

0.5

-0.5

10

20

30

40

50

60

70

80

Computational Fluid Dynamics


Computational Fluid Dynamics


Higher Order Methods! The separation of space and time discretization is generalized in the Method of Lines, where we convert the PDE into a set of ODEs for each grid point by writing:!

Flux Limiters ! Review !

df j dt

1 n F Fjn1/ 2 h j +1/ 2

The time integration can, in principle, be done by any standard ODE solver, although in practice we often use second order Runge-Kutta methods!

Computational Fluid Dynamics


Higher Order Methods! For the Linear Advection equation we have:!

Computational Fluid Dynamics


Higher Order Upwind!

1 FjL = f j + ( r ) f j f j 1 + 1/ 2 2

r=

f j +1 f j f j f j 1

1 Second order upwind! (r ) = ; 2 r 1 ( r ) = + ; Fromms scheme! 2 2 (r ) = r ; Centered scheme (Beam-Warming)!

For the linear advection equation, it is possible to do the advection step exactly, since the solution simply moves with uniform velocity. This allows us to see the central role played by the reconstructed slopes in each cell!

(r ) = 1 (r ) = 0

Lax-Wendroff! First order upwind!

Computational Fluid Dynamics


Higher Order Upwind!
U!t
fj

Computational Fluid Dynamics


Higher Order Upwind! Near shocks the linear reconstruction leads to over and undershoots.!

hf jn +1 = f jn ( h ! U"t ) + U"tf jn!1 f i n +1 = f jn (1 ! ") + "f jn!1

f j !1

!=

U"t h

To prevent oscillations, apply LIMITERS to reduce the slopes where they will cause oscillations but leave then where they do not!
f j 1 fj f j +1 f j+2

j-1

j!

U!t
fj

f jn +1 = f jn + s j ( x ! x j )

f j !1

sj hf jn +1 = f jn U t h U t 2

)
j-1
!

j-1

j!

s j 1 + f jn1 + h U t U tf jn1 2 h f jn +1 = f jn (1 ) + f jn1 (1 ) ( s j s j 1 ) 2

j!

j+1

j+2

Many possible limiters can be designed!

Computational Fluid Dynamics


Higher Order Upwind! In Gudunov like methods, the solution process consists of three steps:! 1. Reconstruction of the solution in each cell! 2. Advection of the solution, using the uxes from one cell to the next one! 3. Construction of the average solution in each cell! Only the reconstruction of the solution can lead to oscillations!

Computational Fluid Dynamics


Designing Limiters: ! The Sweeby diagram !

Computational Fluid Dynamics


Limiters!

Computational Fluid Dynamics


Limiters!

1 f jL = f j + ( r ) f j f j 1 + 1/ 2 2

r=

f j +1 f j f j f j 1

r<0 local change of sign of the slopes! r<1 slope change! r=1: same slopes (linear f)! r>1 slope change!

To design schemes that prevent the emergence of unphysical oscillations, we need a precise denition of what we mean by no oscillations. A few such criteria have been proposed but the most widely used on is based on the Total Variation, dened by!

TV =

f dx x

r<0: revert to low order uxes by taking the limiter to be zero! r=1: take the limiter to be 1!

It can be shown that many equations have the property that the Total Variation of the solution cannot grow in time. Schemes that preserve that behavior are generally referred to as Total Variation Diminishing (TVD) schemes.!

Computational Fluid Dynamics


Limiters! It can be shown that for a scheme to be second order and TVD, the limiter must lie in the shaded region.!

Computational Fluid Dynamics


Limiters! It has been found that it is also best to take the limiter to be between Lax-Wendroff and Beam Warming!

0 (r ) r
!( r)

r 0
r= f j +1 f j f j f j 1

! = 2r

!=r

Beam-Warming!

2
Lax-Wendroff!
=1

r=

f j +1 f j f j f j 1

Generally we also require the limiters to be symmetric!

(r ) 1 = ( ) r r
In many papers, r is dened as the inverse of the one used here!

3
r

Computational Fluid Dynamics


Limiters! Using the limitations given by second order accuracy, TVD and the requirement that the limiters lie between Lax-Wendroff and Beam-Warming, gives the Sweby-Diagram. ! The limiters must lie in the shaded region!
!( r)

Computational Fluid Dynamics


Limiters! The Sweby region is not the only one that is used to design limiters, but it is by far the most widely used. A very large number of limiters have been proposed that fall within this region. See, for example:! N. P. Waterson and H. Deconinck. Design Principles for bounded high-order convection schemesa unied approac. JCP 224 (2007), 182-207! This paper treats only steady state problems.!

! = 2r

!=r

Beam-Warming!

2
Lax-Wendroff!

r=

f j +1 f j f j f j 1

3
r

Computational Fluid Dynamics


Limiters! The Minmod Limiter (Roe and others)!

Computational Fluid Dynamics


Limiters!

r=

f j +1 f j f j f j 1

minmode!
2 1.8

( r ) = max[0,min(1, r )]
!( r)

1.6

1.4

! = 2r

!=r

2
minmod!

Simple and generally works well. Fairly dissipative!

1.2

0.8

0.6

0.4

0.2

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

3
r

T=1.0; h=0.01; dt=h/3!

Computational Fluid Dynamics


Limiters! The Superbee Limiter (Roe)!

Computational Fluid Dynamics


Limiters!

r=

f j +1 f j f j f j 1
2 1.8

Superbee!

( r ) = max[0,min(2r ,1),min( r ,2)]


!( r)

1.6

1.4

! = 2r

!=r

1.2

superbee! Superbee is generally found to be too compressive and generates steps in smooth regions!

0.8

0.6

0.4

0.2

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

3
r

T=1.0; h=0.01; dt=h/3!

Computational Fluid Dynamics


Limiters! The original van Leer limiter!

Computational Fluid Dynamics


Limiters!

r=

f j +1 f j f j f j 1
2 1.8

van Leer limiter!

(r ) =
!( r)

r+ r 1+ r
!=r

1.6

1.4

! = 2r

1.2

van Leer limiter! Smooth variationno abrupt switches! 1


2
3
r

0.8

0.6

0.4

0.2

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

T=1.0; h=0.01; dt=h/3!

Computational Fluid Dynamics


Limiters! The MUSCL Limiter!

Computational Fluid Dynamics


Limiters!

r=

f j +1 f j f j f j 1

The MUSCL Limiter!


2 1.8

( r ) = max[0,min(2r ,( r + 1) / 2,2)]
!( r)

1.6

1.4

! = 2r

!=r

1.2

MUSCL! One of the original suggestions by van Leer! 1


2
3
r

0.8

0.6

0.4

0.2

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

T=1.0; h=0.01; dt=h/3!

Computational Fluid Dynamics


Limiters! The Sweby Limiter (Sweby)!

Computational Fluid Dynamics


Limiters!

r=

f j +1 f j f j f j 1

The Sweby Limiter (Sweby)!


2 1.8

( r ) = max[0,min( r ,1),min( r , )]; 1 2


!( r)

1.6

1.4

! = 2r

!=r

1.2

Sweby, beta=1.5! An example of a limiter with abrupt switching that traverses the interior of the allowable region!

0.8

0.6

0.4

0.2

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

3
r

T=1.0; h=0.01; dt=h/3!

Computational Fluid Dynamics


Limiters! minmode! van Leer limiter! Sweby!

Computational Fluid Dynamics


Limiters!
% one-dimensional linear advection using ux limiters! % This looks like the nal and complete version of the program! % Feb. 21, 2011! %------------------------------------------------------------! n=101; nstep=300; length=1.0;h=length/(n-1);! dt=0.333333333*h; time=0.0; for i=1:n, x(i)=h*(i-1);end! f=zeros(n,1);fo=zeros(n,1);fh=zeros(n,1);foo=zeros(n,1);! fu=zeros(n,1);fuo=zeros(n,1);! for i=1:n, if (x(i)>=0.0 & x(i)<=0.6), f(i)=exp(-100*(x(i)-0.3)^2); end; end;! for i=1:n, if (x(i)>=0.6 & x(i)<=0.8), f(i)=1.0; end; end; %initial conditions! fu=f;! for m=1:nstep,m,time! hold off;plot(x,f,'linewidt',2); %axis([1 n 2.0, 4.5]); %plot solution! hold on;plot(x,fu,'r','linewidt',2);axis([0 length 0 2]); pause(0.1)! foo=f;! for is=1:2 %two steps per timestep! fo=f;! for i=2:n-1, ! bot=(fo(i)-fo(i-1));top=(fo(i+1)-fo(i)); r=top*bot/(bot^2+0.00001);! % Limiters! % psi=max([0, min([2*r,0.5*(r+1),2])]); % monotonized central (MC)! psi=max([0, min([1.5*r,1]),min([r,1.5]) ]); % Sweby ! % psi=max([0, min([2*r,1]),min([r,2])]); % superbee gtext('superbee')! % psi=max([0, min([r,1])]); % minmod gtext('MINMOD')! % psi=(r+abs(r))/(r+1); % van Leer! % psi=0; % upwind! % psi=r;! fh(i)=fo(i)+0.5*psi*(fo(i)-fo(i-1));! end;! bot=(fo(1)-fo(n-1));top=(fo(2)-fo(1)); r=top*bot/(bot^2+0.00001);! % psi=max([0, min([2*r,0.5*(r+1),2])]); % monotonized central (MC)! psi=max([0, min([1.5*r,1]),min([r,1.5]) ]); % Sweby ! % psi=max([0, min([2*r,1]),min([r,2])]); % superbee! % psi=max([0, min([r,1])]); % minmod! % psi=(r+abs(r))/(r+1); %van Leer! % psi=0; % upwind! % psi=r;! fh(1)=fo(1)+0.5*psi*(fo(1)-fo(n-1)); fh(n)=fh(1);! for i=2:n-1,! f(i)=fo(i)-(dt/h)*(fh(i)-fh(i-1) );! end;! f(1)=fo(1)-(dt/h)*(fh(1)-fh(n-1) );f(n)=f(1);! end! for i=1:n,f(i)=0.5*(f(i)+foo(i)); end % average the solution for second oder time step!

Superbee!

MUSCL!

SEE CODE ON RIGHT!

%-----------------------! % rst order upwind! fuo=fu; for i=2:n-1,fu(i)=fuo(i)-(dt/h)*(fuo(i)-fuo(i-1)); end! fu(1)=fuo(1)-(dt/h)*(fuo(1)-fuo(n-1));fu(n)=fu(1);! time=time+dt;! end;! f=zeros(n,1);! for i=1:n, if (x(i)>=0.0 & x(i)<=0.6), f(i)=exp(-100*(x(i)-0.3)^2); end; end; ! for i=1:n, if (x(i)>=0.6 & x(i)<=0.8), f(i)=1.0; end; end; %initial conditions! hold on;plot(x,f,'k','linewidt',2);! % print -depsc tempg!

Computational Fluid Dynamics


Limiters!

Computational Fluid Dynamics


Limiters!

abdquckest!

And many, many more!!

Computational Fluid Dynamics


Limiters! Limiting the variables:! Predictor step! f
n +1/ 2 j

Computational Fluid Dynamics


Limiters! Limiting the Fluxes!

t = f ( F jn+1/ 2 F jn1/ 2 ) 2h
n j

Predictor step! Variables!

Variables!

1 L n +1/ 2 1/ 2 (fj f jn+ ) 1 2 1 R n +1/ 2 R n +1/ 2 n +1/ 2 f j +1/ 2 = f j +1 ( f j +1 f j ) 2 f jL+1/ 2 = f jn +1/ 2 +


1/ 2 L R F jn++ 1/ 2 = F ( f ) j +1/ 2 , ( f ) j +1/ 2 n +1/ 2 n +1/ 2

= 1

t n (F j +1/ 2 F jn1/ 2 ) 2h 1 1/ 2 f jL+1/ 2 = f jn +1/ 2 + ( f jn +1/ 2 f jn+ ) 1 2 1 1/ 2 1/ 2 f jR+1/ 2 = f jn++ ( f jn++ f jn +1/ 2 ) 1 1 2 f jn +1/ 2 = f jn
1/ 2 L R F jn++ 1/ 2 = F ( f ) j +1/ 2 , ( f ) j +1/ 2 n +1/ 2 n +1/ 2

= 1

Find:!

Find:! Final step!

)
n +1/ 2 j 1/ 2

Final step!

f jn +1 = f jn

t n +1/ 2 (F j +1/ 2 F jn+1/1/22 ) h

n +1 j

t n +1/ 2 n = f F jn+1/ 2 + L j +1/ 2 ( F j +1/ 2 F j +1/ 2 ) h


n j

([

[F

n j 1/ 2

L j 1/ 2

(F

n j 1/ 2

] )])

Computational Fluid Dynamics


Computational Fluid Dynamics


The approach described here has, on the whole, been a very successful one, but the difculty of preserving sharp discontinuity at the same time as we accurately advect smooth solutions continues to be a challenge and several groups continue to advance the state of the art.! We will discuss some of those very briey next time and talk about the challenges in applying these ideas to the full nonlinear and multidimensional Euler equations! In addition to the use of nonlinear methods to capture shocks, such methods are increasingly being used for the advection part of Navier-Stokes solvers!

Multi-dimensional ow !

Computational Fluid Dynamics


Multidimensional Flow!

Computational Fluid Dynamics


Multidimensional Flow! Split versus unsplit advection!

f f f +u +v =0 t x y

Multidimensional hyperbolic problems are generally done using SPLITTING, where each coordinate direction is treated separately!

Unsplit!

f i,nj+1 = f i,nj +

ut n vt ( f i1, j f i,nj ) + h ( f i,nj1 f i,nj ) h

Computational Fluid Dynamics


Multidimensional Flow! Split versus unsplit advection! (1-v)t! vt! ut! (1-u) t!

Computational Fluid Dynamics


Multidimensional Flow!

f f f +u +v =0 t x y
Fully unsplit!
fi ,nj+1 = fi ,nj + uvt 2 n fi 1, j 1 fi ,nj h2 u t n vt + (1 vt ) 2 fi 1, j fi ,nj + (1 u t ) 2 fi ,nj 1 fi ,nj h h u t n vt n = fi ,nj + fi 1, j fi ,nj + fi , j 1 fi ,nj h h uvt 2 n n n + fi 1, j 1 fi n 1, j fi , j 1 + fi , j 2 h

f f f +u +v =0 t x y
Time splitting! First!

n f i* , j = f i, j +

ut n ( f i1, j f i,nj ) h vt * ( f i, j1 f i*, j ) h

then!

f i,nj+1 = f i* ,j +

Computational Fluid Dynamics


Multidimensional Flow!
30
1.5

Computational Fluid Dynamics


Multidimensional Flow!
% two-dimensional timesplit advection using rst order upwind %------------------------------------------------------------ n=32;m=32;nstep=35;length=2.0;h=length/(n-1); dt=0.3*h;f=zeros(n,m);fo=zeros(n,m);f1=zeros(n,m);time=0.0; u=1.0; v=1.0; cx=0.35;cy=0.35; for i=2:n-1, for j=2:m-1 r=sqrt((cx-h*(i-1))^2+(cy-h*(j-1))^2); if(r < 0.2) f(i,j)=1.0;end end,end

25
1

20
0.5

15
0 30 25 20 15 10 5 0 0 5 15 10 20 25 30

10

10

15

20

25

30

30

30

25

25

20

20

15

15

10

10

Time-split!
5 10 15 20 25 30

Unsplit!
5 10 15 20 25 30

for l=1:nstep,l,time hold off;mesh(f); axis([0 n 0 m 0 1.5]);pause; fo=f; for i=2:n-1, for j=2:m-1 f1(i,j)=fo(i,j)-(dt*u/h)*(fo(i,j)-fo(i-1,j)); end,end for i=2:n-1, for j=2:m-1 f(i,j)=f1(i,j)-(dt*v/h)*(f1(i,j)-f1(i,j-1)); end,end time=time+dt; end; f2=gure; contour(f,10);axis square;

Computational Fluid Dynamics


Multidimensional Flow! Splitting thus recovers some properties of the exact advection by allowing ux from diagonal cells. This is one reason for focusing on onedimensional schemes, since doing multidimensional ow by splitting is actually better than multidimensional discretization of the original equations!

You might also like