Você está na página 1de 33

Scientific Computing I

Module 5: Heat Transfer Discrete and Continuous Models


Michael Bader
Lehrstuhl Informatik V
Winter 2016/2017

Part I: Discrete Models

Motivation: Heat Transfer


Wiremesh Model
A Finite Volume Model
Time Dependent Model

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

Part I
Discrete Models

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

Motivation: Heat Transfer

objective: compute the temperature distribution of some object


under certain prerequisites:

temperature at object boundaries given


heat sources
material parameters

observation from physical experiments:

q k T
heat flux proportional to temperature differences

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Wiremesh Model
consider rectangular plate as fine mesh of wires
compute temperature xi,j at nodes of the mesh

x i,j+1
x i1,j x i,j x i+1,j
x i,j1

hy
hx

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Wiremesh Model (2)


model assumption:

temperatures in equilibrium at every mesh node


equilibrium: steady state (of temperature), energy balance (inflow =

outflow) in each node of the mesh


incoming temperature fluxes at point i,j via the four wires:


from the left: k xi1,j xi,j 
from the right: k xi+1,j xi,j

from below: k xi,j1 xi,j

from above: k xi,j+1 xi,j

equation for steady state: sum over all fluxes = zero:

xi,j =


1
xi1,j + xi+1,j + xi,j1 + xi,j+1
4

for all temperatures xi,j .


Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Wiremesh Model (3)


temperature known at (part of) the boundary; for example

x0,j = Tj
models a heated/cooled wall with constant temperature Tj at the left
boundary.
temperature flux known at (part of) the boundary; for example
xi,0 = xi,1

xi,1 xi,0 = 0

models an isolated wall at the lower boundary.


heat sources: temperature given at a certain position i, j:

xi,j = Ts .
task: solve Linear System of Equations
Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Finite Volume Model


object: a rectangular metal plate (again)
model as a collection of small connected rectangular cells

hy
hx
examine the heat flux across the cell edges
Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Finite Volume Model (2)


model assumption: temperatures in equilibrium in every grid cell
heat flux across a given edge is proportional to

temperature difference (T1 T0 ) between the adjacent cells


length h of the edge

e.g.: heat flux across the left edge:


(left)
qi,j
= kx Ti,j Ti1,j hy
note: heat flux out of the cell (and kx > 0)
heat flux across all edges determines change of heat energy:

qij



= kx Tij Ti1,j hy + kx Tij Ti+1,j hy


+ ky Tij Ti,j1 hx + ky Tij Ti,j+1 hx

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

A Steady-State Model

heat sources: consider additional source term Fi,j due to

external heating
radiation

Fi,j = fi,j hx hy (fi,j heat flux per area)


equilibrium with source term requires qi,j + Fi,j = 0:

fi,j hx hy

= kx hy 2Ti,j Ti1,j Ti+1,j

ky hx 2Ti,j Ti,j1 Ti,j+1

again, Linear System of Equations

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

10

Towards a Time Dependent Model


idea: set up an ODE for each cell
simplification: no external heat sources or sinks, i.e. fi,j = 0
change of temperature per time is proportional to heat flux qi,j (t) into the

cell (no longer 0):


d
Ti,j (t) =
dt
=
+

c qi,j (t)

x
2Tij (t) + Ti1,j (t) + Ti+1,j (t)
hx

y
2Tij (t) + Ti,j1 (t) + Ti,j+1 (t)
hy

solve a system of ODEs

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

11

Boundary Conditions
(Finite Volume Models)

temperature known in boundary layer cells; for example



(left)
q1,j
= kx T1,j T0,j hy = kx T1,j T (x0,j ) hy
with T0,j = T (x0,j ) not an unknown!
(models a heated/cooled wall with constant temperature T (x0,j ) at the left
boundary)
(left)
temperature flux known in boundary layer cells; e.g. q1,j
= 0:

f1,j hx hy

= kx hy T1,j T2,j

ky hx 2T1,j T1,j1 T1,j+1

models an isolated wall at the left boundary.


Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

12

Part II: A Continuous Model The Heat Equation

From Discrete to Continuous


Derivation of the Heat Equation
Variants of the Heat Equation
Boundary and Initial Conditions

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

13

Part II
A Continuous Model The Heat
Equation

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

14

From Discrete to Continuous


remember the discrete model:

fi,j


kx
2Ti,j Ti1,j Ti+1,j
hx

ky

2Ti,j Ti,j1 Ti,j+1


hy

assumption: heat flux across edges is proportional to temperature

difference


(left)
qi,j
= kx Ti,j Ti1,j hy

in reality: heat flux proportional to temperature gradient


(left)
khy
qi,j

Ti,j Ti1,j
hx

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

15

From Discrete to Continuous (2)


replace kx by k/hx , ky by k /hy , and get:


k
2Ti,j Ti1,j Ti+1,j
2
hx

k
2 2Ti,j Ti,j1 Ti,j+1
hy

fi,j

consider arbitrarily small cells: hx , hy 0:


fi,j = k

2T
x 2


k
i,j

2T
y 2


i,j

leads to a partial differential equation (PDE):


k

2 T (x, y ) 2 T (x, y )
+
x 2
y 2


= f (x, y )

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

16

Derivation of the Heat Equation


finite volume model, but with arbitrary control volume D
change of heat energy (per time) is a result of

transfer of heat energy across Ds surface,


heat sources and sinks in D (external influences)

resulting integral equation:

Z
cT dV =

Z
q dV +

kT ~n dS

density , specific heat c, and heat conductivity k are material parameters


heat sources and sinks are modelled in term q

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

17

Derivation of the Heat Equation (2)


according to theorem of Gauss:

k T ~n dS =

Z
kT dV
D

leads to integral equation for any domain D:

Z
cTt q k T dV = 0
D

hence, the integrand has to be identically 0:

Tt = T +

q
,
c

:=

k
c

> 0 is called the thermal diffusion coefficient (since the Laplace

operator models a (heat) diffusion process)


Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

18

Variants of the Heat Equation


Different scenarios:
vanishing external influence, q = 0:

Tt = T
alternative notation
T
=
t

2T
2T
2T
+
+
x 2
y 2
z 2

equilibrium solution, Tt = 0:

0 = T +

q
c

T =

q
c

Poissons Equation
Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

19

Boundary Conditions
Dirichlet boundary conditions:
fix T on (part of) the boundary

T (x, y , z) = (x, y , z)
Neumann boundary conditions:
fix T s normal derivative on (part of) the boundary:

T
(x, y , z) = (x, y , z)
n
special case: insulation

T
(x, y , z) = 0
n

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

20

Part III
Discretization: Finite Difference and
Finite Volume Methods

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

21

Part III: Discretization: Finite Difference and Finite


Volume Methods
From Continuous Back To Discrete Models
Finite Difference Methods
Meshes for Finite Difference Discretisation
Finite Difference Discretisation
Resulting Linear System of Equations
Discretisation Stencils
Finite Volume Methods
Finite Volume Meshes
Finite Volume Discretisation

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

22

From Continuous Back To Discrete Models


Continuous Models:
result from a limit process (h 0) from discrete model

(wire mesh, finite volume)


opposite route discretisation

Discretisation methods:
Finite Differences:

replace derivative by difference quotients


Finite Volumes:

compute fluxes on boundary of control volumes and examine


conservation laws

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

23

The Model Problem

2D Poisson Equation:

2
2
u(x,
y
)
+
u(x, y) = f (x, y )
x 2
y 2
on the unit square = (0, 1)2
with Dirichlet boundary conditions:

u(x, y) = g(x, y )

on

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

24

Meshes for Finite Difference Discretisation


regular, Cartesian mesh; analogous to the wire-mesh model:

x i,j+1

hy

x i1,j x i,j x i+1,j


x i,j1

hy
hx

hz
hx

compute approximate value of u for each mesh point:

uij u(xij )

uijk u(xijk )

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

25

Finite Difference Discretisation


replace partial derivative (at each mesh point) by difference quotient:

2u
(xi,j )
x 2
2u
(xi,j )
y 2

u(xi+1,j ) 2u(xi,j ) + u(xi1,j )


hx2
u(xi,j+1 ) 2u(xi,j ) + u(xi,j1 )
hy2

leads to Linear System of Equations (h := hx = hy ):


1
h2

ui+1,j + ui,j+1 4ui,j




f (xi,j ) xi,j (0, 1)2

u(xi,j )

g(xi,j ) xi,j

+ui,j1 + ui1,j

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

26

Resulting Linear System of Equations

matrix-vector notation of the system:

Ah xh = fh
xh a vector of all unknowns uij

requires numbering of the unknowns


using row-wise numbering, e.g.:

xh = (u1,1 , . . . , u1,n , u2,1 , . . . , u2,n , . . . , un,1 , . . . , un,n )

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

27

Resulting Linear System of Equations (2)

Ah is a sparse matrix (only 5 diagonals are non-zero)


Ah is block-tridiagonal:

Ah =

1
h2

Bh

I
..
.

..

..

..

I
Bh

Bh = tridiag(1, 4, 1), where I is the unit matrix

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

28

Notation: Discretisation Stencils

idea: illustrate the matrix structure via a so-called discretisation stencil


represents one row of the matrix
matrix elements ordered according to their geometrical orientation
discretisation stencil for Poisson equations:

1D:

1 
1 2
h2

2D:

1
1
h2

1
4
1

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

29

Finite Volume Methods Meshes


domain subdivided into grid cells/elements ij :

hy
hx
consider cell averages uij for each cell ij , i.e., u(x, y ) uij
Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

30

Finite Volume Discretisation


integrate over grid cells ij :

2u
2u
(x,
y)
+
(x, y ) dx dy =
x 2
y 2

Z
ij

Z
f (x, y ) dx dy
ij

|
integration by parts:

2u
(x, y ) dx dy
x 2

yj+ 1

ij

Z
=

x 1
i+ 2
u

dy
(x, y)
x
x 1
i

yj 1

ij

{z
}
:= fij hx hy

2u
(x, y ) dx dy
y 2

xi+ 1
2

Z
=
xi 1
2

y 1
j+ 2
u

dx
(x, y)
y
y 1
j

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

31

Finite Volume Discretisation (2)


remember: u(x, y) = uij in each ij
thus approximation of derivatives on edges:


ui+1,j uij
u


x x 1
hx
i+
2
ui,j+1 uij
u

y y 1
hy
j+


uij ui1,j
u


x x 1
hx
i
2
uij ui,j1
u

y y 1
hy
j

again leads to Linear System of Equations:


1
hx


ui+1,j 2ui,j + ui1,j hy +

1
hy


ui,j+1 2ui,j + ui,j1 hx = fij hx hy

More detailed computation for first term:


y

Zj+ 2 

j 1
2

x 1 

Zj+ 2 
i+ 2

ui+1,j uij
uij ui1,j
hy
u

(x, y)
dy =

dy =
ui+1,j 2uij + ui1,j
x
h
h
h
x
x
x
x 1
i

j 1
2

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

32

Finite Volume Discretisation More General . . .


typical formulation for first-order PDEs:

u
F (u(x, y)) G(u(x, y))
+
+
dx dy =
t
x
y

...

ij

and analogously:

yj+ 1

F (u(x, y))
dx dy =
x

xi 1

yj 1

ij

xi+ 1

G(u(x, y))
dx dy =
y

xi 1

ij

for Poisson Equation: F (u) =

Z
2

x u,

x 1
i+ 2
F (u(x, y ))
dy
y 1
j+ 2
G(u(x, y))
dx
yj 1
2

etc.

Michael Bader | Scientific Computing I | Heat Transfer Discr. & Cont. Models | Winter 2016/2017

33

Você também pode gostar