Sunteți pe pagina 1din 34

Differential Equation

We take the heat diffusion equation as an example to demonstrate


the numerical methods to solve such equations.
H e a t D iffu s io n E q u a tio n
T  2T  2T  2T 2
c p  k( 2
 2
 2
)  
q  k  T  q
t x y z

 This equation governs the temperature distribution for a


three-dimensional unsteady, heat flow problem involving
heat generation.
 For steady state / t = 0
 No generation q  0
 To solve for the full equation, it requires a total of
six boundary conditions: two for each co-ordinate. Only
one initial condition is needed to account for the
transient behavior.
Two-Dimensional, Steady State
Case
For a 2 - D, steady state situation, the heat equation is simplified to
2T 2T
2
 2  0, it needs two boundary conditions in each direction.
x y

There are three approaches to solve this equation:


 Numerical Method: Finite difference or finite element
methods, usually will be solved using computers.
 Graphical Method: Limited use. However, the conduction
shape factor concept derived under this concept can be
useful for specific configurations.
 Analytical Method: The equation can be solved using
method of separation of variables.
Numerical Methods
 Due to the increasing complexities encountered in the development
of modern technology, analytical solutions usually are not available.
For these problems, numerical solutions obtained using
high-speed computer are very useful, especially when the geometry
of the object is irregular, or the boundary conditions are nonlinear.
In numerical analysis, three different approaches are commonly
used:
(a) finite difference, (b) finite volume and (c) finite element methods.
In this chapter, the finite difference and finite element methods will
be introduced. The finite volume method, which has become
quite popular for fluid flow and heat transfer problems, will be
covered in a detailed manner in the subsequent chapters.
The Finite Difference Method
The finite difference method involves the following steps:
 Discretize the domain into nodes (nodal networks). If the
distance between points is small enough, the differential
equation can be approximated locally by a set of finite
difference equations. Each node now represents a small region
where the nodal temperature is a measure of the average
temperature of the region.
 Derive finite difference approximations for the governing
equation at both interior and boundary nodes
 Develop an algebraic equation for each unknown node, and
establish a system of linear algebraic equations
 Solve the system of equations using numerical schemes
Approximating derivatives using finite
differences

f(x+h/2)
f'(x)

f(x-h/2)

x-h x-h/2 x x+h/2 x+h

f ( x  h / 2)  f ( x  h / 2)
f ' ( x) 
h

f ( x  h)  2 f ( x )  f ( x  h)
f ' ' ( x)
h2
Grid generation in 2D domain
m is the grid point counter in x direction (m ranging from 1 to MM)
n is the grid point counter in y direction (n ranging from 1 to NN)

x=mDx, y=nDy m,n+1


Dx

m-1,n m,n m+1, n

Dy
m,n

m,n-1

m-½,n m+½,n
Discretization of differential
equation
Take the example of heat diffusion equation:
2 q 1 T
T 
k  t
k
where   is thermal diffusivity, and q is the heat generation.
C p
Assuming steady state and no heat generation,  2T  0
The 1st order differential at intermediate points (m+1/2,n) & (m-1/2,n)

T DT Tm 1,n  Tm,n
 
x ( m  12 , n ) Dx ( m  12 , n ) Dx

T DT Tm ,n  Tm1,n
 
x ( m  12 , n ) Dx ( m  12 , n ) Dx
Finite Difference
Approximation (contd...)
Discretization of the second order differentiation at (m,n)
T T

 2T x m  12 , n x m  12 , n Tm 1,n  Tm1,n  2Tm,n
 
x 2 ( m,n )
Dx (Dx) 2

Similarly, the y direction derivative will be

 2T Tm ,n 1  Tm ,n 1  2Tm,n

y 2 ( m ,n )
( Dy ) 2
Finite Difference
Approximation (contd...)
2 2
2   T  T Tm1,n  Tm1, n  2Tm, n Tm, n 1  Tm, n 1  2Tm,n
 T   2  2   2
 2
  x  y  ( m,n) ( Dx ) ( Dy )

For Dx  Dy, and for  2T  0 (steady state, no heat generation)

Tm1, n  Tm 1, n  Tm ,n 1  Tm, n 1  4Tm,n  0

The nodal equations derived above are valid for all interior points.
For each node, there is one such equation.
For example: for nodal point m=2, n=3, the equation is
T3,3 + T1,3 + T2,4 + T2,2 - 4T2,3 =0
Hence, the temperature at (2,3) can be expressed as
T2,3=(1/4)(T3,3 + T1,3 + T2,4 + T2,2)
Nodal Equations for boundary nodes

• Nodal relations for boundary nodes (with unknown temperature)


need to be derived separately depending on the node location
and boundary conditions. The table subsequently shown in
this presentation lists the possible cases, with case 1
corresponding to the interior node, while the other cases
corresponding to various location and boundary conditions.
• Once we have one equation for each nodal point (including both
interior and unknown boundary points) in the system of interest,
the result is a system of N algebraic equations for a total of N
nodal points.
Summary of nodal finite difference methods
Summary of nodal finite difference methods (contd…)
The System of Equations
We have N unknown nodes, hence a system of N equations

... … … …

In a matrix form: [A][T]=[B]


Numerical Solutions
Matrix form: [A][T]=[C].
The solution for temperature would be:
[A]-1[A][T]=[A]-1[C], [T]=[A]-1[C]
where [A]-1 is the inverse of matrix [A].
• Usually, for most practical problems, the order of matrix will
be quite high as N would be large. As this will require
enormous amount of computational effort, direct matrix
inversion for solution of temperature will be impractical.
• For high order matrix, iterative methods are usually more
efficient. The popular Jacobi & Gauss-Seidel iteration
methods are introduced subsequently.
Jacobi Iteration Method

The general algebraic equation for the nodal point can be


written as:
i 1 N

a T
j 1
ij j aiiTi  a T
j i 1
ij j  Bi

Rewrite the equation in the form:

Bi i 1 aij ( k ) N a
ij
Ti (k )
   T j   T j( k 1)
aii j 1 aii j i 1aii

Replace (k) by (k-1)


for the Jacobi iteration
Jacobi Iteration Method (contd…)

• (k) denotes the level of the iteration, (k-1) means the


present level and (k) represents the new level.
• An initial guess (k=0) is needed to start the iteration.
• By substituting iterated values at (k-1) into the equation,
the new values at iteration (k) can be estimated.

• The iteration will be stopped when max Ti(k)-Ti(k-1)  ,


where  specifies a predetermined value of acceptable error
Gauss-Seidel Iteration Method
First, the generalized discretization equation is considered:
*

aPTP   anbTnb  b Or, TP   a nb nb  b


T
aP
where T*nb is the current estimate of temperature on any grid
point
This can be solved if T*nb’s are known.

Procedure:
(i) Start with an initial guess temperature distribution
(ii) Visit a grid point, substitute latest estimate for Tnb , get new T
(iii) Visit all points in this manner
(iv) Iterate until convergence
The Finite Element Method
• The domain is broken into a set of discrete elements.
• The shape of the elements can be arbitrary. In two
dimensions, that are usually triangles or quadrilaterals,
while in three dimensions, tetrahedral or hexahedral
elements are often used.
• The equations are multiplied by a weight function before
they are integrated over the entire domain.
• The solution is approximated by simple piecewise functions
(shape functions) valid on elements to describe the local
variations of the unknown variable (or scalars). Such a
function can be constructed from its values at the corners of
the elements called nodes.
Finite Element Method (contd…)
• This approximation is then substituted into the weighted
integral of the governing equation, and a residual is defined
to measure the deviation from the actual solution. The
algebraic equations to be solved are derived by minimizing
the residual.
• The continuum has an infinite number of degrees-of-freedom
(DOF), while the discretized model has a finite number of
DOF.
• The number of equations is usually large for most practical
applications. Hence, the solution of such large system of
equations requires a computational method.
• The ever-increasing computational power of modern day
digital computers and creation of advanced user friendly
softwares have brought FEM within reach of engineers
working in small industries, and college students.
Theoretical Basis for FEM
Formulation

• There are several approaches to convert a differential equation


into a discretized finite element formulation.

• If the physical formulation is described as a differential


equation, then the most popular solution method is the
Method of Weighted Residuals (MWR).

• If the physical formulation is presented as the minimization of


a function, then the Variational Formulation (VF) is usually
used.
Method of Weighted Residuals (MWR)

In the MWR, an approximate solution is substituted into the differential equation.


Since the approximate solution does not identically satisfy the equation, a residual
is obtained.

Consider a differential equation


Dy( x)  Q  0 (1)

Suppose that y = h(x) is an approximate solution to (1). Substitution then gives


Dh( x)  Q  R , where R is a nonzero residual. The MWR then requires that

(2), where Wi(x) are the weighting functions.


 W ( x) R( x)  0
i

The number of weighting functions equals the number of unknown


coefficients in the approximate solution.
Galerkin’s Method

• There are several choices for the weighting functions, Wi.

• In the Galerkin’s method, the weighting functions are the same functions
that were used in the approximating equation.
Variational Method (VM)
• The VM involves the integral of a function to produce a number.
Integration of each function produces a number.
• The function that produces the lowest number has the additional
property of satisfying a specific differential equation.
• Consider the integral

D 
p    y( x)  Qy  dx  0 (1)
2 
• The numerical value of p can be calculated given a specific
equation y = f(x).
• Variational calculus shows that the particular equation y = g(x)
which yields the lowest numerical value for p is the solution to
the differential equation
Dy( x)  Q  0 (2)
Heat Conduction in a 2D domain: FEM
solution
Select triangular shaped element to discretize a 2D domain
Choose a linear temperature function for each element as:

t ( x, y )  a1  a2 x  a3 y
a1 
 
  a1  a2 x  a3 y  1 x y a2 
a 
 3

where u and v describe temperature gradients at (xi,yi).

1 Element, 3 Nodes, with 2 degrees of freedom (x, y)


FEM solution (contd…)
Choose a Temperature Function

T  N i ti  N j t j  N m t m
In matrix form :
ti 
 
 
T   N i  N j  N m t j 
 
t m 
T  temperature function, N  shape function,
t  nodal temperature
FEM solution (contd…)
Define Temperature Gradient Relationships

 T   N i N j N m 
 x   x  ti 
x x   
g      tj 
 T   N i N j N m   
 y   y  tm 
y y 
 1  i  j  m 
B  N    
x x  i j  m 
Heat flux/Temperature Gradient :
q x  K xx 0 
    g  Dg
q y  0 K yy 
FEM solution (contd…)
Derive element matrix and equations for heat diffusion
with a convective boundary condition:

T
k   B DBdV   hN  N dS
T

V S

 x
L 1 
 L  x x 
 tAB  D B 
T
 hP   1  dx
0
x  L L 
 L 
AK xx  1 - 1 hPL 2 1
 - 1 1 
L   6 1 2
FEM solution (contd…)
For heat source term:
1
T QV  
f Q   Q V  dV  1 for constant heat source
V
3 
1
 f   k t for each element
Solution:
Assemble element equations, apply BC’s
F   K t
Solve for Nodal Temperatures
Solve for Element Temperature Gradient & Heat Flux
Solving PDEs
• Finite element method
• Finite difference method (our focus)
– Converts PDE into matrix equation
• Linear system over discrete basis elements
– Result is usually a sparse matrix
– Matrix-based algorithms represent matrices
explicitly
– Matrix-free algorithms represent matrix values
implicitly (our focus)
Class of Linear
Second-order PDEs
• Linear second-order PDEs are of the form
Auxx  2Buxy  Cu yy  Eux  Fuy  Gu  H
where A - H are functions of x and y only
• Elliptic PDEs: B2 - AC < 0
(steady state heat equations with heat source)
• Parabolic PDEs: B2 - AC = 0
(transient heat transfer equations)
• Hyperbolic PDEs: B2 - AC > 0
(wave equations)
MODULE 2: Review Questions
• How do numerical solution methods differ from analytical methods?
What are the advantages and disadvantages of numerical and analytical
methods?

• What is the basis of energy balance method in numerical analysis?


How does it differ from the formal finite difference method using
Taylor series approximation? For a specified nodal network, will these
two methods result in the same or a different set of equations?

• Consider a medium in which the finite difference formulation of a


general interior node is given in its simplest form as
• Is heat transfer in this medium steady or transient?
• Is heat transfer one-, two-, or three-dimensional?
• Is there heat generation in the medium?
• Is the nodal spacing constant or variable?
• Is thermal conductivity of the medium constant or variable?
MODULE 2 Review Questions (contd...)
• Consider a medium in which the finite difference formulation of a general interior node is
given in its simplest form as
• Is heat transfer in this medium steady or transient?
• Is heat transfer one-, two-, or three-dimensional?
• Is there heat generation in the medium?
• Is the nodal spacing constant or variable?
• Is thermal conductivity of the medium constant or variable?

• What is an irregular boundary? What is a practical way of handling irregular boundary


surfaces with the finite difference method?

• When performing numerical calculations of heat diffusion on a structured Cartesian grid in


two dimensions, a simplified form of the equations states that the temperature at a node is
simply the average of its four adjacent neighbours. What assumption is NOT required to
allow this simplified form
a) must have no heat generation
b) must not be at a domain boundary
c) must have uniform cell dimensions in both directions
d) must be a solid medium
MODULE 2 Review Questions (contd...)
• Show that the central difference scheme is more accurate than
forward or backward difference schemes.

• What is meant by conservative formulation of a differential


equation?

• What is the basis of the finite volume method? State the main
difference between the FVM and FDM?

• Describe the method of weighted residuals in Finite element


method. Show that the Finite Volume Method is a special case
of the Finite Element Method.

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