Diffusion Equation - Seminar in Engineering Analysis - Lecture Slides, Slides of Engineering Analysis

Course title is Seminar in Engineering Analysis. Analytic and numerical methods applied to the solution of engineering problems at an advanced level. Solution methods are demonstrated on a wide range of engineering topics, including structures, fluids, thermal, thermal energy transport, and mechanical systems.

Typology: Slides

2013/2014

Uploaded on 02/01/2014

sashie
sashie 🇮🇳

4.2

(40)

176 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Diffusion equation January 28, 2009
ME 501B – Engineering Analysis 1
The Diffusion Equation
The Diffusion Equation
Larry Caretto
Mechanical Engineering 501B
Seminar in Engineering
Seminar in Engineering
Analysis
Analysis
January 28, 2009
2
Overview
Review last week
Diffusion equation
Physical meaning and derivation
Relation to Laplace equation
Solution by separation of variables
Sturm-Liouville orthogonal eigenfunction
expansion for initial conditions
Only possible for homogenous boundary
conditions
Treatment of nonhomogenous boundary
conditions
3
Review Sturm-Liouville
Homogenous equations for a x b
Solutions, ymare complete set of
orthogonal eignenfunctions that can be
used to expand any function
[]
0)()(
)(
=+
+
yxpxq
dx
dy
xr
dx
d
λ
0)(
0)(
21
21
=+
=+
=
=
bx
ax
dx
dy
by
dx
dy
kayk
ll
=
=
0
)()(
mmm xyaxf
4
Review Orthogonal Functions
Defined as inner product integral with
p(x) from Sturm-Liouville equation
Get coefficients in eigenfunction
expansions
()
== b
a
mm
b
a
m
mm
m
m
dxxyxyxp
dxxfxyxp
yy
fy
a
)()()(
)()()(
,
),(
()
iji
b
a
jiji ydxxpxyxyyy
δ
2
*)()()(, ==
5
Review Fourier Series
Based on periodic functions defined over
–L < x < L
=
+
+=
1
0sincos)(
nnn L
xn
b
L
xn
aaxf
ππ
=
L
L
dxxf
L
a)(
2
1
0
=
L
L
ndx
L
xn
xf
L
b
π
sin)(
1
=
L
L
ndx
L
xn
xf
L
a
π
cos)(
1
6
Review Even/Odd Functions
Odd function: f(-x)
= -f(x) (like sine)
Even function:
g(-x) = g(x) (like
cosine)
For odd f(x)
0)( =
L
L
dxxf
For even g(x)
=
LL
L
dxxgdxxg
0
)(2)(
Product of odd times even is odd
sine times
cosine
cosine
sine
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Diffusion Equation - Seminar in Engineering Analysis - Lecture Slides and more Slides Engineering Analysis in PDF only on Docsity!

The Diffusion EquationThe Diffusion Equation

Larry Caretto Mechanical Engineering 501B

Seminar in EngineeringSeminar in Engineering

AnalysisAnalysis

January 28, 2009

2

Overview

  • Review last week
  • Diffusion equation
    • Physical meaning and derivation
    • Relation to Laplace equation
    • Solution by separation of variables
    • Sturm-Liouville orthogonal eigenfunction expansion for initial conditions - Only possible for homogenous boundary conditions - Treatment of nonhomogenous boundary conditions

3

Review Sturm-Liouville

  • Homogenous equations for a ≤ x ≤ b
  • Solutions, y (^) m are complete set of

orthogonal eignenfunctions that can be

used to expand any function

[ ( ) ( )] 0

qx px y

dx

dy

rx

dx

d

λ ( )^0

( ) 0

1 2

1 2

  • =

  • =

=

=

x b

xa

dx

dy yb

dx

dy kya k

l l

= 0

( ) () m

fx am ymx 4

Review Orthogonal Functions

  • Defined as inner product integral with

p(x) from Sturm-Liouville equation

  • Get coefficients in eigenfunction

expansions

= = b

a

m m

b

a

m

m m

m m pxy xy xdx

pxy xf xdx

y y

y f a () () ( )

( ) i ij

b

a

yi yj yi xyjxpxdx y δ

  • 2

5

Review Fourier Series

  • Based on periodic functions defined over

–L < x < L

=

⎥ ⎦

⎤ ⎢ ⎣

⎡ ⎟ ⎠

⎞ ⎜ ⎝

⎛ ⎟+ ⎠

⎞ ⎜ ⎝

⎛ = + 1

( ) 0 cos sin n

n n L

n x b L

n x f x a a

=

L

L

f xdx L

a ( ) 2

1 0

L

L

n dx

L

n x

f x

L

b

( ) sin

⎟ ⎠

⎞ ⎜ ⎝

L

L

n dx L

n x f x L

a

( ) cos

1

6

Review Even/Odd Functions

  • Odd function: f(-x)

= -f(x) (like sine)

  • Even function:

g(-x) = g(x) (like

cosine)

  • For odd f(x)

∫ (^ ) =^0

L

L

f xdx

  • For even g(x)

L L

L

gxdx gxdx

0

  • Product of odd times even is odd

sine times cosine

cosine

sine

7

Review Half-Interval Series

  • For even functions, there are no sine

terms in the Fourier series

  • For odd functions there are no cosine

terms in the Fourier series

  • In these cases can use integrals from 0

to L for the coefficients

  • Can also use equations from 0 to L for

all functions, but get periodic behavior

outside this region

8

Review Half-Interval Series II

  • Look at function below for L = 2
  • Full series gives periodic results

Full

Series

9

Review Half-Interval Series III

  • Expanding function for 0 ≤ x ≤ L = 2 with

a sine series gives odd periodic repetition

Sine

Series

10

Review Half-Interval Series IV

  • Expanding function for –L ≤ x ≤ 0 with a

sine series gives odd periodic repetition

Sine

Series

11

Review Half-Interval Series V

  • Cosine series for 0 ≤ x ≤ L = 2 with gives

even periodic repetition

Cosine Series

12

Review Half-Interval Series VI

  • Cosine series for –L ≤ x ≤ 0 gives even

periodic repetition of different region

Cosine Series

19

Variable Properties

  • Included in outer space derivative

∂ φ

∂ ρα φ ∂φ

∂ φ

∂θ

∂ ρα ∂θ

∂ φ

∂ ρα ∂

∂ρ

ρα∂ ∂

+∂ ∂θ

ρα∂ ∂θ

  • ∂ ∂

ρα∂ ∂

= ∂ ∂

∂ρ

∂ ρα ∂

∂ ρα ∂

∂ ρα ∂

∂ρ

u r

u r r

u r t r r

u Sphere

z

u z

u r r

ru t r r

Cylindrical u

z

u y z

u x y

u t x

u Cartesian

sin sin

1 sin

1 1

1 1

2 2 2 2 2

2

( u ) div ( gradu ) t

u =∇⋅ρα∇ = ρα ∂

∂ρ

20

Diffusion Equation Solutions

  • Governs heat conduction and species

diffusion for t ≥ 0 and 0 ≤ x ≤ xmax

  • u(x,t) is temperature, species concentration
  • Initial condition u(x,0) = u 0 (x)
  • Boundaries u(0,t) = uL (t); u(xmax ,t) = uR (t)

2

2

x

u

t

u

α

  • Diffusivity, α, is

material property

(length)^2 /(time)

21

Separation of Variables

  • Assume u(x,t) = X(x)T(t)

[ ]

[ ] 2

2 2

2 2

2

x

Xx

Tt

x

X xTt

x

u

t

Tt

X x

t

X xTt

t

u

  • Divide by αX(x)T(t)

2

x

X x

t X x

Tt

T t ∂

α

Result is

function of t

equal to

function of x 22

Separation of Variables Works

  • Assumed solution, u(x,t) = X(x)T(t), gives

a function of x equal a function of t

  • Since x and t are independent, both sides

must equal a constant for this to be true

  • Choose negative real constant, –λ^2 , to

simplify later solution of resulting ordinary

differential equations (ODE)

2 2

λ α

x

X x

t X x

Tt

Tt

23

Solve ODEs to Get u(x,t)

  • Have simple ODEs with known general

solutions

( )

( ) 2 Tt dt

dTt = −λ α

t Tt Ae

λ^2 α ( )

() 0 ( ) 2 2

2

  • Xx = dx

dXx λ

[ ]

[ sin( ) cos( )]

( ,) () ( ) sin( ) cos( )

1 2

2

2

e C x C x

uxt TtX x Ae B x C x

t

t

λ λ

λ λ λα

λα

X ( x )= B sin( λ x )+ C cos( λ x )

24

Boundary Conditions

  • Look at case where u(0,t) = u(xmax,t) = 0
  • Since u(0,t) = T(t)X(0) and u(xmax,t) =

T(t)X(xmax) we can only satisfy these

boundary conditions if X(0) = X(xmax) = 0

  • Because the ODE for X(x) and its boundary conditions are homogenous, X(x) is the solution to a Sturm-Liouville problem
  • X(x) = Bsin(λx) + Ccos(λx)
  • How do we get X(0) = 0?
  • X(0) = 0 = Bsin(0) + Ccos(0) = C

25

Boundary Conditions II

  • We must have C = 0 for X(0) = 0
    • Thus X(x) = Bsin(λx)
  • How do we get second boundary

condition that X(xmax) = 0?

  • X(xmax) = 0 = Bsin(λxmax)
  • This is true if B = 0 (which gives X

always zero) or if sin(λxmax) = 0

  • sin(λxmax ) = 0 if λxmax = nπ (n an integer)
  • Eigenfunction is X(x) = Bn sin(nπx/xmax) 26

Eigenfunction Solutions

  • Original solution is u(x,t) = T(t)X(x)
  • We found an infinite set of eigen-

functions for X n (x) = B n sin(nπx/xmax)

  • We also found
  • Have an infinite set of solutions where

λn = nπx/xmax:

  • General solution for u(x,t) is sum of all

individual eigenfunction solutions

t

T t Ae

λ^2 α

u xt Ae Bn ( nt )

t n

( ,)= −λ^ n^ α sinλ

2

27

Initial Condition

  • In general solution (sum of all

eigensolutions) write the product of two

constants ABn as Cn

  • Setting t = 0 gives eigenfunction

expansion for the initial condition

(^1) max

( ,) sin( )

2

x

n u xt Ce x n n

n

t n

= λ n^ α λ λ =^ π

=

=

=

1 max 1 max

0

0 ( ) ( ,^0 ) sin sin

n

n n

n

x

n x

C

x

nx

u x ux Ce

28

Finding Cn

  • We already know the answer
  • This is a Sturm-Liouville problem so the

eigenfunctions are a complete,

orthogonal set

  • p(x) = 1 and X (^) n(x) = sin(nπx/xmax )

= = b

a

n n

b

a

n

n n

n n pxX xX xdx

pxX xu xdx

X X

X u C

() () ( )

0 0

29

Derivation of Cn Equation

  • We can derive the Cn equation on the

previous page

  • Since the X(x) is the solution of a Sturm- Liouville problem we have an infinite set of orthogonal eigenfunctions
  • Multiply basic equation for the initial condition by sin(mπx/xmax ) and integrate from 0 to xmax

dx x

nx u x C x

mx

x

n

∫ ∑^ n

⎛ (^) π ⎟⎟ = ⎠

⎛ (^) π ∞

=

max

0 1 max

0 max

sin ( ) sin

30

Derivation of Cn Equation II

  • Consider each side separately

⎛ π ⎟⎟ = ⎠

⎛ π ⎟⎟ ⎠

⎛ π

⎛ (^) π ⎟⎟ ⎠

⎛ (^) π ⎟⎟ = ⎠

⎛ (^) π

=

= max max

max max

0 max

2 (^1 0) max max

0 max 0 1 max max

0

sin sin sin

()sin sin sin

x m n

x n

x

n

n

x

dx x

mx dx C x

nx x

mx C

dx x

mx x

nx dx C x

mx u x

  • Uses orthogonality for eigenfunctions

2

sin sin sin max 0 max

2 0 max max

max max mn

x mn

x x dx x

mx dx x

nx x

mx π δ δ π π ⎟⎟ = ⎠

⎞ ⎜⎜ ⎝

⎛ ⎟⎟ = ⎠

⎞ ⎜⎜ ⎝

⎛ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

37

w(x) Is Steady Solution

  • Solution for d^2 w/dx^2 = 0 with w(0) = u (^) L and

w(xmax) = u R is w = u L + (uR – uL )x/xmax

  • Solution for v is same as previous solution

for u with u(0,t) = u(xmax,t) = 0

1 max

( ,) sin( )

2

x

n

v xt Ce x n

n

n

t n = λ n^ α λ λ =^ π ∑

=

  • Initial condition for v(x,0) = u(x,0) – w(x) =

u 0 (x) – [ uL + (u R – u L )x/xmax ]

38

Nonzero Boundaries IV

x x

u u u x

nx u xt Ce L r L n

t x

n n (^1) max max

(,) sin

2 max (^) + + − ⎟⎟ ⎠

= (^) ∑

=

⎟⎟⎠

⎞ ⎜⎜⎝ −⎛ α π π

x

x

u u

u

x

nx

u x u x C L r L

n

n (^1) max max

( , 0 ) 0 ( ) sin

= =∑

=

π

  • Use eigenfunction expansion for v(x,0) =

u 0 (x) – u L – (u R – uL )x/xmax

  • v(x,0) is a Sturm-Liouville solution

v(x,t) w(x)

39

Nonzero Boundaries V

x x

u u u x

nx u xt Ce L r L n

xn t n (^1) max max

(,) sin

2 max (^) + + − ⎟⎟ ⎠

= (^) ∑

=

⎟⎟⎠ ⎞ ⎜⎜⎝ −⎛ α π π

  • Same eigenfunction expansion used for

zero boundary problem gives

∫ ⎟⎟ ⎠

max

0 max max

0 max

() sin

x R L m L dx x

mx x x

u u u x u x

C

π

  • After Cn is found, solution is

=v(x,0)

40

Nonzero Boundary Example

  • Solution from previous slide

x x

u u u x

n x u xt Ce L r L n

xn t n (^1) max max

(,) sin

2 max (^) + + − ⎟⎟ ⎠

= (^) ∑

=

⎟⎟⎠

⎞ ⎜⎜⎝ −⎛ α π π

∫ ⎟⎟ ⎠

⎛ (^) π ⎥ ⎦

max

0 max max

0 max

() sin

x R L n L dx x

nx x x

u u u x u x

C

  • The solution for u 0 (x) = U, a constant, is

found from equations above by setting

u 0 (x) = U and integrating to get C n

41

Nonzero Boundary Result

  • Solution details (not covered in lecture)

for u 0 (x) = U 0 are on slides 46-

  • Final form shows that (u(x,t) – u (^) L )/(U 0 – u (^) L ) is a function of x/xmax , αt/L 2 and (u (^) R – u (^) L )/(U 0 – u (^) L )

=

⎟⎟α ⎠

⎞ ⎜⎜⎝ −⎛^ π

=

⎟⎟α ⎠

⎞ ⎜⎜⎝ −⎛^ π

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π ⎟

⎟ ⎠

⎞ ⎜

⎜ ⎝

⎛ −

− − π

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π π

− −

K

K

0 : 1 , 3 , 5 , max

0 : 0 : max 2 , 4 , 6 , max

sin 1 2 2

sin (,) 2 1

2 max

2 max

n

xn t L

R L

n

t x

n

L

R L L

L

x

nx e U u n

u u

x

nx e x n

x U u

u u U u

uxt u

42

Non-zero Boundary Plot

t = 0.0001t = 0. t = 0. t = 0.005t = 0. t = 0. t = 0. t = 0. (^) t = 0.

t = 0. t = 0. t = 0.15 t = 0. t = 0. t = 0.

0

0.

0.

0.

0.

0.

0.

0.

0.

0.

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 x/xmax

(u(x,t) - u

L^ )/(U

0 - u

L^ )

(uR - uL) / (U 0 - uL) = 0. t = α (time)/(xmax ) 2

43

Other Boundary Conditions

  • Look at gradient and mixed boundary

conditions

  • Show how making differential equation

dimensionless can lead to Sturm-

Liouville problem in initial formulation

  • Will consider these next class and on

homework for next week

  • Can give cosine eigenfunctions and

irregular eigenvalues

44

Diffusion Equation Summary

  • Create Sturm-Lioville problem for non-

zero spatial boundary conditions

  • Define u(x,t) = v(x,t) + w(x)
  • Use u – u (^) ref in original equation
  • Solve by separation of variables
  • Time solution will be exponential
  • Apply boundary conditions to determine

eigenvalues (also gets constants in

solution)

45

Diffusion Equation Summary II

  • Write solution as sum of all possible

eigenfunctions with individual constants

  • Use eigenfunction expansion to match

initial conditions

  • If a solution for u(x,t) = v(x,t) + w(x) is used the eigenfunction expansion must be for u 0 (x) – w(x)
  • Solution is sum of all eigenfunctions

with constants determined from

matching initial conditions.

46

Nonzero Boundary Example

  • Constant initial condition, u 0 (x) = U 0

( ) ( ) ∫ ∫

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

− ⎛ π ⎟⎟ = ⎠

⎞ ⎜⎜ ⎝

− ⎛ π

⎟⎟ = − ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π ⎥ ⎦

⎤ ⎢ ⎣

⎡ (^) − = − −

max max

max

0 max

2 max

2 max 0 max

0 1

1 2 0 max max

0 max

sin

2 sin

2

sin 2

x R L

x L

x R L m L

dx x

mx x x

u u dx I x

mx x

U u I

dx I I x

mx x x

u u U u x

C

( )

( ) max

max

max 0

max max 22

2 max 2 max

2

max 0

max max

0 1

sin cos 2

cos 2

x R L

x L

x

mx x m

x x

mx m

x x

u u I

x

mx m

x x

U u I

⎥ ⎦

⎤ ⎢

⎢ ⎣

⎡ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ π π ⎟⎟− ⎠

⎞ ⎜⎜ ⎝

⎛ π π

⎥ ⎦

⎤ ⎢

⎢ ⎣

⎡ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π − π

47

Nonzero Boundary Example II

2 cos 2 max[ cos( ) 1 ]

max

0 max 0

max max

0 1

max − π + π

= − ⎥

⎥ ⎦

⎤ ⎢

⎢ ⎣

⎡ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π − π

= − m m

x x

U u x

mx m

x x

I U u L

x L

  • First integral
  • 1 – cos(mπ) = 0 for even m and 2 for

odd m

( )

⎪⎩

π

m even

modd m

U u I

L

0

1

48

Second Integral ( )

( ) ( )

( ) ( ) ( )

( ) [ ]

( ) ( π) π

− −

⎥⎦

⎤ ⎢⎣

⎡ π

π− π

− ⎥

⎥ ⎦

⎤ ⎢

⎢ ⎣

⎡ π− π

⎥ ⎦

⎤ ⎢

⎢ ⎣

⎡ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π π ⎟⎟− ⎠

⎞ ⎜⎜ ⎝

⎛ (^) π π

x m m

x x

u u x

u u

m

x x m m

x x

u u

m m

x x

u u

x

mx x m

x x

mx m

x x

u u I

R L R L

R L

R L

x R L

cos

2 0

2

cos ( 0 )cos 0

2

sin sin 0 2

sin cos 2

max

max 2 max

2 max

max max

max 2 max

22

2 max 2 max

max 0

max (^22) max

2 max 2 max

2

max

⎪ ⎩

⎪ ⎪ ⎨

π

− −

π

= m even m

u u

modd m

u u

I R L

R L

2

2

2

Because cos(mπ) = 1 when m is even and – when m is odd