Notes

BENG 221: Mathematical Methods in Bioengineering
Lecture 6
Solution to the Inhomogeneous Heat Equation with
Fourier Series Eigenmode Expansions
References
Haberman APDE, Ch. 2.
Haberman APDE, Ch. 3.
BENG 221
M. Intaglietta
Lecture 6
Analytic solution of the diffusion/heat equation
The partial differential equation that governs diffusion processes can be solved
analytically. If the boundary conditions are simple we can compute this solution readily.
The method requires the use of some fundamental mathematical properties.
Linearity
A linear operator L has the property:
L(c1u1 + c2u2 ) = c1 L(u1 ) + c2 L(u2 )
∂
∂t
and
∂2
∂x 2
are linear operators, therefore the “diffusion operator”
∂
∂2
− 2 is a linear operator.
∂t ∂x
A linear equation for u = u(x,t) has the form:
L(u) = f(x,t)
∂u
∂ 2u
− k 2 = f ( x) is a linear operator on u(x,t) since:
∂t
∂x
∂ (c1u1 + c2u2 )
∂ 2 (c1u1 + c2u2 )
−k
= f ( x, t ) =
∂t
∂x 2
⎛ ∂ 2u1
∂u1
∂u2
∂ 2 u2 ⎞
c1
+ c2
− k ⎜ c1 2 + c2 2 ⎟ = f ( x, t )
∂t
∂t
∂x ⎠
⎝ ∂x
If f(x,t) = 0 then L(u) = 0 is a linear homogeneous equation.
A fundamental principle:
If u1 and u2 satisfy a linear homogenous equation then any arbitrary linear combination
c1u1 + c2u2 satisfies the same linear homogenous equation.
The concept of linearity also applies to boundary conditions.
The complete diffusion equation is:
1
∂C
∂ 2C
= D 2 + G ( x, t )
∂t
∂x
where G(x,t) is the material generated or consume within the control volume. The
diffusion equation is linear and homogeneous if G(x,t) = 0.
Solution of the diffusion equation with specified concentration at the ends of the
region, and no sources. Separation of variables.
We propose to solve the linear homogeneous diffusion equation:
∂u ( x, t )
∂ 2 u ( x, t )
−k
= 0 B.C.s u (0, t ) = u ( L, t ) = 0 I .C. u ( x, 0) = f ( x)
∂t
∂x 2
(11)
in terms of solutions of the form:
u ( x, t ) = w( x ) g (t )
(12)
which reduces PDEs to ODEs.
Accordingly, and to obtain terms that are present in the diffusion equation we take the
partial derivatives of (12) and obtain:
∂u ( x, t )
dg (t )
= w( x)
∂t
dt
and
∂ 2u ( x, t ) d 2 w( x)
=
g (t )
∂x 2
dx 2
Leading to a new form of the diffusion equation which can now be written as an ordinary
differential equation:
w( x)
1 dg (t )
1 d 2 w( x)
dg (t )
d 2 w( x)
=
− kg (t )
=
0
which
can
be
also
written
as:
kg (t ) dt
w( x) dx 2
dt
dx 2
where each side is the function of only one variable. One side of this equation, a function
of t, is equal to function of x. This is only possible if both sides equal a constant, which
for convenience is taken as −λ or:
1 dg (t )
1 d 2 w( x)
=
= −λ
kg (t ) dt
w( x) dx 2
(13)
which results into two ODEs, namely:
dg
= −λ kg
dt
and
d 2w
= −λ w
dx 2
2
General solution of the time dependent equation:
g (t ) = ce − λ kt
where c is an arbitrary constant. Note that if λ > 0 the solution decays in time, which we
expect.
Boundary value problems and solution of the x dependent equation
Note that w(x) = 0 satisfies (11). However this is a trivial solution. Other non trivial
solutions that also satisfy the B.C.s exist for specific values of λ . These are called
eigenvalues, and a non trivial w(x) that exists only for the eigenvalues is called an
eigenfunction.
d 2w
= −λ w solution is obtained by substituting w( x) = e rx and
2
dx
obtaining the characteristic polynomial r 2 = −λ which yields 3 different types of
solutions:
The second order O.D.E.
1. λ > 0 roots are imaginary and complex conjugates, r = ±i λ .
2. λ = 0, r = 0,0.
3. λ < 0, roots a real, r = ± −λ .
Solutions for λ > 0.
For λ > 0 the exponential solutions have imaginary exponents, namely e ± i
combinations of these exponents yield trigonometric function, namely:
1 i
(e
2
λx
+ e−i
λx
) = cos λ x and
1 i
(e
2i
λx
− e−i
λx
λx
. Linear
) = sin λ x
Therefore w( x) = c1 cos λ x + c2 sin λ x is a solution since it is a linear combination of
solutions.
The B.C. w(0) = 0 implies that c1 = 0 and the cosine term vanishes. In order to satisfy
the other boundary condition w(L) = 0 either c2 = 0 in which case w(x) = 0 is a trivial
solution, or we search for values of λ that satisfy the relationship sin λ L = 0 , namely
the zeros of the sine function which occur at λ L = nπ . Therefore
⎛ nπ ⎞
⎟
⎝ L ⎠
λ =⎜
2
n = 1, 2,3,...
3
are the eigenvalues λ and the corresponding eigenfunctions are:
⎛ nπ x ⎞
w( x) = c2 sin λ x = c2 sin ⎜
⎟
⎝ L ⎠
Is λ = 0 a non trivial solution?
The equation being solved is:
d 2 w( x)
= −λ w( x) = 0
dx 2
Which this leads to w( x) = c1 + c2 x and in order to satisfy the boundary conditions w(x) =
0 at x = L then c1 = c2 = 0 , a trivial solution, and the only one possible.
Solutions for λ < 0.
When λ < 0 the roots of the characteristic are r = ± −λ which is a real number. To
avoid confusion it is convenient to set λ = − s which results in two independent solutions
e
sx
e−
and
w( x) = c1e
sx
sx
leading to the general solution:
+ c2 e −
sx
which can be expressed as hyperbolic functions, since these are linear combinations of
exponentials functions, namely
cosh x =
(
1 x −x
e +e
2
)
sinh x =
(
1 x −x
e −e
2
)
leading to the solution:
w( x) = c3 cosh sx + c4 sinh sx
Which has a solution that satisfies the boundary conditions only if c3 = c4 = 0 or w(x) = 0
a trivial solution since sinh sL is never zero for a positive argument.
Product solution of the P.D.E with specified boundary conditions
The product solution of (11) therefore exists for λ > 0 and is of the form:
4
⎛ nπ ⎞
⎟ t
L ⎠
nπ x − k ⎜⎝
u ( x, t ) = An sin
e
L
2
n = 1, 2,3,...
Note that as there is a different solution for each n, and that as t increases all special
solutions exponentially decay in time. Furthermore u(x,t) satisfies the special initial
condition
u ( x, 0) = An sin
nπ x
L
and in general, given the principle of superposition:
⎛ nπ ⎞
⎟ t
L ⎠
2
nπ x − k ⎜⎝
u ( x, t ) = ∑ An sin
e
L
n =1
M
(14)
It should be noted that (14) should satisfy the initial boundary condition u(x,0) = f(x)
which requires finding a way to link An and f(x) for t = 0.
This can be done by noting that the eigenfunctions sin
L
∫ sin
0
nπ x
satisfy the integral property:
L
nπ x
mπ x
L
dx = 0(m ≠ n); = (m = n)
sin
L
L
2
In other words:
L
∫ sin
0
2
nπ x
L
dx =
2
L
Note that this integral is associated with calculation of average power in periodic
phenomena. In general the average power is calculated by taking the integral
2π / ω
∫
0
2π / ω
⎡1 1
⎤
sin 2ωtdt = ⎢ t − sin 2ωt ⎥
⎣2 4
⎦0
=
π
ω
Therefore in (14), for t = 0 when u(x,0) = f(x) we can set up the following relationship:
L
∫
0
∞
mπ x
mπ x
nπ x
dx = ∑ An ∫ sin
sin
dx
L
L
L
n =1
0
L
f ( x)sin
and whenever m = n
5
L
∫
∞
mπ x
mπ x
dx = ∑ Am ∫ sin 2
dx
L
L
n =1
0
L
f ( x)sin
0
and since
L
∫ sin
2
0
mπ x
L
dx =
2
L
2
mπ x
f ( x) sin
dx
∫
L0
L
L
Am =
A vector view of the computation of An
Consider the sample problem we just worked with the same boundary conditions.
Consider now an ordinary vector, F, with components in three dimensional space with
coordinates x, y, and z. The vector is defined by a basis set of the three perpendicular (or
orthogonal) unit vectors, ex, ey and ez, pointing in the three dimensions. To describe the
vector F, each unit vector has some magnitude, A, so that:
F = Ax e x + Ay e y + Az e z
If F is known we can find the Ai coefficients by taking the inner (or dot) product of the
whole expression with each of the unit vectors in turn. As an example:
Ax = F ⋅ e x
15
Now consider the expression:
A1 sin(π x) + A2 sin(2π x) + A3 sin(3π x) + ... = f ( x)
We can assume that each function sin(nπx) is a basis vector. We can define:
1
∫ f ( x) sin(n2π x)dx
= inner product of f ( x) with n th basis vector sin( nπ x)
0
which satisfies the same conditions as our usual operation with three dimensional basis
vectors, where we get zero for the inner product of any combination of basis functions,
except when we take the inner product with itself. For example:
6
1
2 ∫ sin(π x) sin(2π x)dx = 0
0
1
2 ∫ sin(π x) sin(π x)dx = 1
0
This expression is analogous to e x ⋅ e y = 0 and e x ⋅ e x = 1 .
Following this analogy to find the coefficients in front of each basis function we take the
inner product of the whole expression with the first basis function (n = 1) as in equation
15:
1
∫ [ A sin(π x) + A sin(2π x) + A sin(3π x) + ... = f ( x)]sin(π x)dx
1
2
3
0
Since the basis functions are orthogonal, the inner product is zero for any combination of
unlike functions. Therefore the only non zero terms are:
1
1
A
∫0 [ A1 sin(π x) sin(π x)dx = 21 = ∫0 f ( x) sin(π x)dx
an analogous expression to 15, and for any coefficient:
1
An = 2 ∫ f ( x ) sin( nπ x) dx
0
The term on the right is the inner product of the first basis function with the known
function f(x). Furthermore, just like F ⋅ e x gives the projection of F in the x direction,
1
∫ f ( x) sin(nπ x)dx
gives the projection of f(x) on sin(nπx).
0
7