Professional Documents
Culture Documents
m
= m
out vA
dM
dm d ( mv )
= F F=ma, m=mv ,
=
dt
dt
dt
V + h= QW
d=
dx+
dy+
dz+
dt
x
y
z
t
we can then solve for the derivative we are interested in, for example if we wanted
dt
d dx dy dz
=
+
+
+
dt x dt y dt z dt t
Divergence operator
^ ^ ^
i+
j+
k
x y x
^ ^j+ w k^
V =u i+v
u v w
(
V )=
V= +
+
x y z
= ( x , y , x , t )
the substantial derivative of an intensive fluid property is defined as the time rate
of change following a moving fluid element
d dx dy dz
=
+
+
+
dt t x
dt y
dt z
dt
u
=
+
u+
v+
w
dt t x
y
z
D
D
=
+ V ( )
=
+(
V )
Dt t
Dt t
D
Dt
total derivative
D
DT
T
)T
= +(
V )
=
+(
V
Dt t
Dt
t
local
derivative
convective
derivative
[ 3.1 ] DT = T + V
T
Dt
local
derivative
convective
derivative
d ^s points normal
vnds= v d ^s (ds by convention)
therefore, if flow exits,
v d s^
d s^
m=
V
s
for the right side consider a very small element inside out CV,
dm=d V m= d V
V
dv
m=
d
dt
{ }
[ 3.2 ]
d V
d V + V d ^s =0
V
[ 3.3 ] D
Dt
[ ]
d V =0
mass ( u ) dydz
mass out = u+
( u )
dx dydz
x
u+
( u )
( u )
dx dydz [ ( u ) dydz ] =
dxdydz
x
x
( v )
dxdydz
y
and z-direction:
( w )
dxdydz
z
therefore net mass flow through the element:
[ LS ] =
( u ) ( v ) ( w )
+
+
d xdydz
x
y
z
dV
[ RS ] =
dxdydz
t
LS=RS
[ 3.4 ]
+ (
V)
t
( V )
d
( V )= V
+
=
dt
t
t
( V )
[ 3.5 ] + 1
=0
t
F=ma
ij
[ (
p p+
)]
[(
P
dx dydz + xx + xx dx xx + +++
x
x
[
]
F x=
P xx yx zx
+
+
+
dxdydz + f x dxdydz
x x y z
body forces
surface forces
[ 4.1 ]
Du P xx yx zx
=
+
+
+
+ Fx
Dt
x
x y z
)=u (
) u
( uV
V )+ ( V
Du P xx yx zx
=
+
+
+
+ f x
Dt
x
x y z
Du
du
=
V u
Dt
dt
Also:
( u )
u
=
+u
t
t
t
u ( u )
=
u
t
t
t
(
V ) u= ( u
V )u (
V)
Du ( u )
)
=
u
u (
V ) + ( u V
Dt
t
t
( u )
u
+(
V ) + ( u
V)
t
Du ( u )
)
=
+ ( u V
Dt
t
Going back to our x-direction equation from lecture 4, and substituting for the left
hand side:
( u )
P xx yx zx
+ ( u
V )=
+
+
+
+ f x
t
x
x y z
Isaac Newton stated that the sheer stress in a fluid is proportional to the time rate
of strain (i.e. velocity gradients). Such fluids are known as Newtonian fluids. Fluids
that are not proportional are known as non-Newtonian fluids (blood, shampoo, ink,
some salad dressings). Most fluids in our application are Newtonian. For Newtonian
fluids we have the Stokes equations (1845)
xx = ( ) +2
u
x
xy =
yy = ( )+2
v
y
xz =
zz = ( )+ 2
w
z
yz=
[
[
[
]
]
]
v u
+
= yx
x y
u w
+
= zx
x x
w v
+
= zy
y z
ij
lecture, we can obtain the momentum equation in terms of our flow field variables:
in the x direction:
( u ) ( u 2) ( uv ) ( uw )
P
u
w
+
+
+
=
+
( )+ 2
+
( )+ 2
+
( )+ 2
+p
t
x
y
z
x x
x y
y z
z
] [
] [
A=B+C
rate of change of energy = net flux of heat + rate of work done on element + surface forces
inside fluid element
into element
due
work in simple terms is a force acting on an object to move it a certain distance.
W =Fd
=F distance =FV
W
time
[ (
uP uP+
)]
( uP )
( uP )
dx dydz=
dxdydz
x
x
[(
u yx +
u yx ) dy u yx dxdz =
(
( u yx ) dxdydz
y
y
( uP ) ( u xx ) ( u yx ) ( u zx )
+
+
+
dxdydz=C x
x
x
y
z
[(
C=
( uP ) ( vP ) ( ) ( u xx ) ( u yx ) ( u zx ) ( v xy ) ( v yy ) ( v zy ) ( w xz ) ( w yz ) ( w
+
+
+
+
+
+
+
+
+
x
y
z
x
y
z
x
y
z
x
y
qx
where
[ (
q x q x +
)]
q x
q x
dx dydz=
dxdydz
x
x
q x =k
T
T
, q y =k
, etc
x
y
B= q +
( ) ( ) ( )]
T
k
+
k
+
k
dxdydz
x x y y z z
1
v2
2
since we are following the fluid element, the time rate of change is the substantial
derivative
A=
D
V2
e+
dxdydz
Dt
2
D
=
+
V time rate of change of
Dt
t
local
convective
is a scalar and
is a vector
( a
F ) (a
F )+ (
F a )
Divergent Theorem from vector calculus (Gauss Theorem) a surface integral can be
expressed as a volume integral:
F d S = F d V
S
then:
change volume V =[
(
V t ) n^ ] ds
altitude
base
area
V t d s
Over the increment
t ) d s
d V = ( V
s
If we divide by
control volume
DV
d s
= V
Dt
s
And using the divergence theorem:
DV
= (
V ) dV
Dt
V
If we imagine that the CV is shrunk to an infinitesimally small volume, with a volume
D( V )
) d V
= ( V
Dt
V
If
V
V
then:
D ( V )
) V
=( V
Dt
1 D ( V )
(
V )=
V Dt
Therefore,
[ 3.2 ]
d V + V ds=0
t V
s
[ 3.3 ] D
Dt
[ ]
d V =0
[ 3.4 ]
+ (
V )=0
t
[ 3.5 ]
D
+
V =0
Dt
Since all four equations were derived to solve the same physical principle, they are
therefore equal and can be converted from one to another with some manipulation:
d V + V ds=0
t V
s
Density is fixed in space so we can move the derivative inside:
t d V + V ds=0
V
V ds= ( V ) d V
s
Then we have:
+(
V ) d V =0
t
This integral can only be zero if the integrand is zero at every point, therefore:
+
V =0
t
(
V ) (
V )+ (
V )
+(
V ) +(
V )=0
t
D
Dt
D
=0
+ V
Dt
[ 9.1 ]
u F G H
+
+
+
=J
t x y z
Equation [9.1] can represent the entire system of GEs in conservation form if u, F, G,
H, and J are interpreted as column vectors then:
[ ][
2
u + P xx
u
v
vu xy
u=
, F=
w
wu xz
2
V
V2
T
e+
e
+
u
+ Pu
2
2
x
FDM is the oldest method. Good for simple geometries where it is easiest to
implement. The starting point is the differential conservative form. The solution is
governed by a grid with nodes spaced at a finite distance apart. At each point the
DE is approximated by replacing the PDs with approximations, which all functions
are terms in the neighbouring grid nodes. The result is one algebraic equation per
grid point and a certain number of neighbouring grid points appearing as unknowns.
Taylor series expansion is commonly used to obtain the approximations of the
derivatives. Examples will be done in class.
Lecture 9 Continued
9.4 Finite Volume Methods
The starting point for FVM is the integral form of the GE. The domain is divided into
a finite number of continuous CVs. the CV can be polyhedral, tetrahedral, or
hexahedral. For each CV the variable values are approximated at a computational
node at the centroid of the CV (cell centered method) or at the nodes of the CV
(node centered FV). Interpolation is then used to express values at the CV surfaces.
Advantages of the FV method are that it is suitable to any fluid or grid, so that
complicated geometries can be accommodated. A disadvantage is that FV
discretization requires higher than second order systems which are harder to
develop in 3D. Thus for a given grid it can have reduced accuracy.
Skewedness of Cells:
highly skewed
results in errors when the
10.1 consistency
the difference between the exact continuous PDE and the approximate discrete
equation is termed the truncation error. the magnitude of error is a function of the
grid spacing. for a method to be consistent the error must approach zero as the grid
spacing heads to zero
10.3 stability
a discretization scheme is table if it does not magnify small errors in numerical
calculations. magnification of errors will cause the solution to diverge.
10.4 convergence
a numerical method is convergent if the difference in the solution of the discretized
equation and the exact solution tends to zero as grid spacing goes to zero.
convergence can be tested by refining a mesh.
10.5 conservation
as the equations that are solved are conservation laws, the numerical solution
should ensure that conservation is respected. conservation places a constraint on
the solution error. because if mass, momentum, and energy are conserved within
the solution domain errors can improperly redistribute the qualities only.
10.6 boundedness
the solution to the DE must lie within proper bounds. physically non-negative
quantities (pressure, density) must always be positive. the ability of the
discretization scheme to respect these bounds is termed boundedness
10.7 accuracy
The solutions of the DE are only approximate so an amount of error is associated
with any numerical method
2
2
2
+b
+c
+d
+e
+f +g=0
2
2
xdy
x
y
x
dy
2
2
2
+b
+c
= d
+e
+ f + g =H
2
2
xdy
x
y
x
dy
The transmission of info occurs along lines called characteristic lines or simple
characteristics.
the equations for the characteristic curves are given by:
dy b b 24 ac
=
dx
2a
We can see that
( b2 4 ac )
( b2 4 ac ) >0
( b2 4 ac ) =0
( b2 4 ac ) <0
Example 1:
Consider the following PDE:
2 2
+ 2 =0
2
x y
a= y ,b=0, c=1
D=( b24 ac )
D=04 ( y )(1)
( x , y )=(1,1) ?
D=4 y
At
Steady
Elliptic
M<1 elliptic
M>1 hyperbolic
parabolic
Unsteady
Parabolic
Hyperbolic
parabolic
Example 2:
The equation that governs the potential function in steady, inviscid, isentropic
flow past a slender body with a free stream Mach number
2
( 1M )
+
=0
x2 d y2
M >1
M >1 hyperbolic
M <1 elliptic
is:
( u j )
+
=
+q
t
x j
xj xj
u j , ,q
may not be true as the velocity field may not have been computed yet and the
properties of the fluid may depend on the temperature or velocity field. but as we
will see, the iterative schemes used to solve the equations assume that is the
only unknown and fix all other variable at their last known value (calculated at the
previous iteration)
the first step is to discretize the domains. If we use a structured gird for 1D:
( x )
( )
xi
= lim
x 0
( xi + x ) ( x i )
x
can be expressed
as a Taylor series:
2
+ ( xx i ) n
( xx i ) 2 ( xxi ) 3
( x )= ( x i ) + ( xx i )
+
+
+...
+
x i
2!
3!
n!
x2 i
x3 i
xn
( )
( )
( )
( )
with
( x+1 ) we can
x i+1
( xi +1x i ) 2
( xi +1 )= ( x i ) + ( x i+1x i )
+
+
2
x i
2!
x i
( )
( )
x i1
and
x i2 , etc...
( x )
i x i+1 xi 2
( x i+1x i ) 3
= i+1
+
+
+ H [ Forward ]
2
3
x i x i+1x i
2
2
x i
x i
( )
if we write TD for
( )
(x i1)
( )
( x )
in terms of
x i1 ,x i
i1 xi x i1 2
( x ix i1 ) 3
= i
+
+
+ H [backwards]
2
3
x i x ix i1
2
2
x i
x i
( )
( )
and in terms of
x i+1
and
( )
x i1
2
2
i+1 i1 ( x i+1x i ) ( xi x i1 ) 2
=
+
+ H [Centered ]
x i x i+1x i1
2 ( x i+1x i1 )
x2 i
( )
( )
Lecture 13 Continued
the equations for forward differencing scheme (FDS), BDS, and CDS are all exact if
all terms on the right hand side are retained. The higher order terms are multiplied
by the grid spacing to some power.
Assuming the distance between grid points is small, the higher order terms shall be
small and can be truncated to obtain the following approximations of the first
derivative:
i+1 i
(FDS)
i+1x i
( x ) x
i
i i1 ( BDS )
x i x ix i1
( )
i+1 i1
(CDS)
i+1x i1
( x ) x
i
the terms dropped from the right hand side constitute the truncation error. The
principal source of truncation error I the term with the lowest exponent (largest
number). If this term has an exponent m, the scheme is said to be m th order
accurate.
example:
what is the order accuracy of FDS BDS and CDS
FDS m=1 1st order dropped
1
( xi +1x i ) 2
( )
x2
m=1 1st
BDS
( xi xi1 ) 2
CDS
( )
x2
m=2 2nd
2
( xi +1x i ) ( x ix i1 ) 2
2 ( x i+ 1xi 1 )
x2
( )
( )
2
x
(
(
x )
x )
=
i+1 /2
i1 /2
1
( x x )
2 i+1 i1
and similar for the others. the second derivative reduces to:
2
1
x i
( x x )( x x )( x x )
2 i i1 i +1 i i +1 i1
2
( )
if the spacing between points in the grid is the same, and equal to
x , then the
equation becomes
2 i + i1
2
i+1
2
x i
( x )2
( )
= + dh
d
Where
(I.e. error)
dh =
h 2 h
p
2 1
; p=
log ( 2 h 4 h )
log 2
2 =0 is an
example of an elliptic equation. It governs the steady state conduction and inviscid
incompressible flow.
The equation we will consider in this lecture is the 2D steady state heat equation
that governs the steady state temperature distribution T in a solid
2 T 2 T
0 x 1
+ 2 =0
2
0 y1
x y
subject to the following Boundary Conditions:
T=
T 1 if x=0 T 3 if y=0
T 2 if x=1 T 4 if y=1
an 1 T 1 +a n2 T 2+ +ann T n =Cn
Or in matrix form:
[ A ] T =C
(n+1)!
Gaussian-Seidel
Jacobi
T
2 T
[ 15.1 ] = 2
t
x
subject to:
[ 15.2 ] T ( x ,t )= A n e k t sin ( kx )
n =1
where:
1
A n=2 f ( x ) sin ( kx ) dx
0
k =n
comparing the finite difference methods to this exact solution provides us with a
measure of the accuracy of the method used for our discretization.
n+1
T j T j T j +12T j +T j1
=
2
t
( x)
Here, j is used a spatial index in the x-direction and n is used as the temporal index
in the t-direction. The subscript is used to denote the time iteration. The simple
explicit method has an order of accuracy of
O[ t , ( x )2 ]
1
t
0 r where ,r =
2
( x )2
Dufort-Frankel Method:
This method uses information at two previous time steps to achieve second order
accuracy both in time and space with an error of
O[ ( t ) , ( x ) ]
( 1+2 r )=T n1
T n+1
+2 ( T nj+1T n1
+T nj1 )
j
j
j
Explicit methods (like the presented above), march the solution forward in the
temporal direction from initial data line, one point at a time.
Note: For parabolic equations this may be problematic
15.2.2 Implicit methods
Simple implicit method:
The simplest implicit scheme for solving the 1-D heat equation:
n +1
n +1
n+1
T j T j
( T j+1 2T j +T j 1 )
=
t
( x )2
n+1
This scheme is
O [ ( t )2 , ( x )2 ]
O[ ( t )2 , ( x )2 ] .
T
2 T 2 T
=
+
t
x2 y2
n
T n+1
T n 2 T i , j +T ni1, j T ni+1, j2 T i , j +T ni1, j
j T j
= i+1, j
+
t
( x )2
( y )2
1
1
1
+
2
2
2
(x) ( y)
1
2
[ 16.1 ]
2 2 2
=c
2
2
t
x
For simplicity we will instead use a first order equation with similar properties:
[ 16.2 ]
u
u
+c
=0 c >0
t
x
this linear hyperbolic equation describes a wave propagating in the x-direction with
a velocity c. it can be used in rudimentary fashion to model non-linear equations
governing inviscid flow. for the remainder of the lecture we will refer to [16.2] as the
wave equation.
1
( st order )
n+1
n
n
u j u j
u un
2
+c j+1 j1 =0 error :O [ t , ( x ) ]
t
2x
Unfortunately this scheme is unconditionally unstable and thus is worthless or
hyperbolic equations.
First order upwind method
Lets modify the Euler explicit method by using a backwards differencing
approximation, for the spatial derivative, assuming the wave equation is positive:
n
u n+1
u nj unj1
j u j
+c
=0 c> 0
t
x
O [ ( t )2 , ( x )2 ]
0 1 =c
T
x
Lax-method
The Euler explicit method can be made stable by replacing
term
unj
with an average
n
n
u n+1
un u n
j ( u j +1+ u j1 ) /2
+c j+1 j1 =0
t
2x
O [ ( t )2 , ( x )2 /2 ]
and is stable if
|| 1
O [ ( t )2 , ( x )2 ]
|| 1
McCormack method
previous schemes were all one step. this method is 2-step, where a value of
is predicted in the 1st step and corrected in the 2nd
the McCormack method is called a predictor-corrector scheme
Predictor:
1=un ( un un )
un+
j
n
j +1
j
Corrector:
n+ 1
uj =
1 n n+1
n+1
n+1
u + u ( u j u j1 )
2 j j
O [ ( t )2 , ( x )2 ]
u j =un ( u j u j1 )
n+ 1
Corrector:
1
un+
j =
1 n n+1
un+1
) ( un2 un un )
u + u ( un+1
j
j1
j
j 1
j2
2 j j
|| 1
1
un+
j
1
1
n
n
n
un+
( 1 ) ( unj 2 unj1unj 2 )
j =u j ( u j u j1 ) +
2
Stable for
02
rate of increase of
the CV
dA + S d V =0
d
dx
CV
+ S d
t CV
net rate
creationof
intern
sourc
Two: defines the locations of the CV and assigns the computational nodes to
the centroids of the CVs
the advantage of the first approach is that the centered difference approximations
of derivatives at CV faces are more accurate because the faces are midway
between the points.
the advantage of the second approach is that the nodal value represents the mean
over the entire CV to a higher accuracy because it is located at the centroid of the
CV. The second variant is more common and will be used here.
17.3 Discretization
x PE
and
the east and west faces of the CV and pint P are denoted
respectively. the control volume width is
s x
and
s x pe
d
d
dA+ S d V =( A ) ( A )
d
dx
dx
dx
A
CV
+ S V
where A is the cross sectional area of the control volume of the CV. this discretized
equation has clear physical meaning: it states that the diffusive flux of leaving
east minus that entering the west is equal to the generation of . in other words, it
is a balance equation for within the CV.
the fact that the discretized equation has this built in physical meaning is a very
attractive feature of FVM.
d
dx
Following the established notation, values of and are evaluated and defined at
the node locations P W E etc. to approximate the fluxes through the CV faces we
must assume something about the distribution of and between nodal points. A
common approximation is that these properties vary linearly between nodes.
Assuming a uniform grid, the face values of and are therefore approximated by:
w=
W + P
+
e= E p
2
2
e p
PW
= A e e
A
= Aw w
x e
x PE
x w
x
)(
S V =Su + S p P
Ae e
e p
P W
Aw w
+ ( Su + S p P )=0
x PE
x
re-arranging:
w
e
A e + w A w S P P=
A w w +
A S
x PE
x PW
x PW
x PE e e u
) (
) (
E ,w,P :
P P = W w + e e + S u [canonical FVM ]
PWE
as
e=
Ae w = w A w p= w + e S P
x PE
x PW
we can eventually express the equation for the canonical FVM as:
p p = nb nb + Su
nb
[ 18.1 ]
T j T j u j+1 2u j +u j1
=
2
t
( x)
[ 18.2 ] T j =T nj +
T n
u 2unj +u nj1 )
2 ( j+1
( x)
Let the exact solution of this equation be denoted D. this is the solution that would
be obtained using a computer with infinite accuracy. (i.e. an infinite number of
floating point digits). Similarly, denote the numerical solution using a real machine
with finite accuracy as N. if the analytical solution of the PDE is denoted A then:
x, y,z
conditionally stable
[18.5] N =D+
this computed numerical solution must satisfy the difference equation [18.2].
t
n
n
[ 18.6 ] Dnj +1+ n+1
Dnj +1+ nj+1 2 Dnj 2 nj + D nj1+ nj1 ]
j =D j + j +
2[
x
[ 18.7 ] nj +1= nj +
t
+ nj+12 nj + nj1 ]
2[
x
at
j =e
nj
by a sinusoid.
i ( x ) k
where:
i=1
k =the wave number(2 divided by wavelength)
by using this definition for
t
, =kx
x2
if the round off error does not grow in time (stable) we can state:
| |
t n +1
1
tn
( )|
|
14 r sin 2
1
2
|G|1
14 r sin 2
( 2 )|1
1
r for this scheme be stable
2
Von-Neumann can be conducted for other schemes:
simple Explicit Method:
G=1+2 r ( cos 1 )
simple implicit method:
1
Crank-Nicholson method:
G=
1r ( 1cos )
1+r ( 1cos )