You are on page 1of 14

1

ODEs: Boundary-Value Problems


1. Introduction and Background
What are Boundary-Value Problem?
An ordinary differential equation has the conditions which are specified
at different values of the independent variable.

Figure 1 (a) An initial-value problem (b) A boundary-value problem


2

Figure 2 A heat balance for a differential element of a heated rod subject to


conduction and convection.

2. Boundary-Value Problems in Engineering and Science


The simulation of the steady-state temperature distribution for a long
thin rod positioned between two constant-temperature walls (Fig.2 )

A heat balance can be taken around a differential element of thickness


∆𝑥 as
0 = 𝑞 𝑥 𝐴𝑐 − 𝑞 𝑥 + ∆𝑥 𝐴𝑐 + ℎ𝐴𝑠 (𝑇∞ − 𝑇) …(1)

where 𝑞(𝑥) = flux into the element due to conduction [J/(m2s)]


𝑞(𝑥 + ∆𝑥)= flux out of the element due to conduction
[J/(m2s)]
𝐴𝑐 = 𝜋𝑟 2 = cross-sectional area [m2]
𝑟= the radius [m]
ℎ= the convection heat transfer coefficient [J/(m2Ks)]
𝐴𝑠 = 2𝜋𝑟∆𝑥= the element’s surface area [m2]
𝑇∞ = the temperature of the surrounding gas [K]
𝑇= the rod’s temperature [K]
3

Eq. (1) can be divided by the element’s volume (𝜋𝑟 2 ∆𝑥) to yield

𝑞 𝑥 − 𝑞 𝑥 + ∆𝑥 2ℎ
0= + 𝑇 −𝑇 … (2)
∆𝑥 𝑟 ∞

Take the limit ∆𝑥 → 0 gives

𝑑𝑞 2ℎ
0=− + 𝑇 −𝑇 … (3)
𝑑𝑥 𝑟 ∞

𝑑𝑇
Fourier’s Law: 𝑞 = −𝑘
𝑑𝑥

where 𝑘 = the coefficient of thermal conductivity [J/(smK)]

Substituted into Eq.(3), and the result devided by 𝑘 to yield,

𝑑2 𝑇
0 = 2 + ℎ′ (𝑇∞ − 𝑇) … (4)
𝑑𝑥

2ℎ
where ℎ′ = = a bulk heat-transfer parameter reflecting the relative
𝑟𝑘
impacts of convection and conduction [m-2]

Equation (4) represents a mathematical model that can be used to compute the
temperature along the rod’s axial dimension. Because it is a second-order ODE,
two conditions are required to obtain a solution. These maybe fixed boundary
conditions or Dirichlet boundary condition:
𝑇(0) = 𝑇𝑎 𝑇(𝐿) = 𝑇𝑏
4

The Alternative, derivative boundary conditions or Neumann boundary


condition:
𝑑𝑇 𝑑𝑇
(0) = 𝑇′𝑎 (𝐿) = 𝑇′𝑏
𝑑𝑥 𝑑𝑥
These maybe combined boundary condition too.

3. Finite-Difference Methods
The most common numerical methods, to solve this problems, are finite-
difference approaches.

Centered finite-difference formulas


First Derivative
𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖−1 )
𝑓′(𝑥𝑖 ) =
2ℎ
or 𝑓(𝑥𝑖−1 ) = 𝑓(𝑥𝑖+1 ) − 2ℎ 𝑓′(𝑥𝑖 )
𝑓(𝑥𝑖+1 ) = 𝑓(𝑥𝑖−1 ) + 2ℎ 𝑓′(𝑥𝑖 )
Second Derivative
𝑓 𝑥𝑖+1 − 2𝑓 𝑥𝑖 + 𝑓 𝑥𝑖−1
𝑓 ′′ 𝑥𝑖 =
ℎ2
where ℎ = 𝑥𝑖+1 − 𝑥𝑖 = 𝑥𝑖 − 𝑥𝑖−1 = ∆𝑥
5

Figure 3 In order to implement the finite-difference approach, the heated rod is divided
into a series of nodes.

Finite-Difference Methods: Fixed Boundary Conditions


For the heated rod model, Eq. (4):
𝑑2 𝑇
0 = 2 + ℎ′ 𝑇∞ − 𝑇
𝑑𝑥
The solution domain is first divided into a series of nodes. At each node,
finite difference approximations can be written for the derivatives in the
equation. For example at node i, the second derivative can be represented by

𝑑2 𝑇 𝑇𝑖−1 − 2𝑇𝑖 + 𝑇𝑖+1


= … (5)
𝑑𝑥 2 ∆𝑥 2

This approximation can be substituted into Eq. (4) to give

𝑇𝑖−1 − 2𝑇𝑖 + 𝑇𝑖+1


0= + ℎ′ 𝑇∞ − 𝑇
∆𝑥 2
Thus, the differential equation has been converted into an algebraic equation.
Collecting terms gives

−𝑇𝑖−1 + 2 + ℎ′∆𝑥 2 𝑇𝑖 − 𝑇𝑖+1 = ℎ′∆𝑥 2 𝑇∞ …(6)


This equation can be written for each of the n-1 interior nodes of the rod. The
first and last nodes 𝑇0 and 𝑇𝑛 , respectively, are specified by the boundary
6

condition. Therefore, the problem reduces to solving n-1 simultaneous linear


algebraic equations for the n-1 unknowns.

Example 1. Use the finite-difference approach to solve Eq. (4) for a 10-m rod
with ℎ′ = 0.05 m-2, 𝑇∞ = 200 K, and the boundary conditions:
𝑇(0) = 300 K 𝑇(10) = 400 K
Use four interior nodes. With a segment length of ∆𝑥 = 2 m

T0  300 K T1 T2 T3 T4 T5  400 K

node 0 1 2 3 4 5
x  2 m

Solution From Eq. (6)

−𝑇𝑖−1 + 2 + ℎ′∆𝑥 2 𝑇𝑖 − 𝑇𝑖+1 = ℎ′∆𝑥 2 𝑇∞


Substituting all parameter ℎ′, ∆𝑥 and 𝑇∞ yields
−𝑇𝑖−1 + 2.2𝑇𝑖 − 𝑇𝑖+1 = 40
node 1 i=1 −𝑇0 + 2.2𝑇1 − 𝑇2 = 40
node 2 i=2 −𝑇1 + 2.2𝑇2 − 𝑇3 = 40
node 3 i=3 −𝑇2 + 2.2𝑇3 − 𝑇4 = 40
node 4 i=4 −𝑇3 + 2.2𝑇4 − 𝑇5 = 40
The equation can be assembled in matrix form as
7

𝑇0
−1 2.2 −1 0 0 0 𝑇1 40
0 −1 2.2 −1 0 0 𝑇2 40
=
0 0 −1 2.2 −1 0 𝑇3 40
0 0 0 −1 2.2 −1 𝑇4 40
𝑇5
Substituting the boundary condition 𝑇0 = 𝑇(0) = 300 K and 𝑇5 = 𝑇(10) =
400 K gives
2.2 −1 0 0 𝑇1 40 + 𝑇0 340
−1 2.2 −1 0 𝑇2 40 40
= =
0 −1 2.2 −1 𝑇3 40 40
0 0 −1 2.2 𝑇4 40 + 𝑇5 440
Notice that the coefficient matrix is both tridiagonal and diagonally dominant.
Solve this system of equation and the solution gives
𝑇1 283.2660
𝑇2 283.1853
=
𝑇3 299.7416
𝑇4 336.2462
𝑇1 = 283.2660 K 𝑇2 = 283.1853 K
𝑇3 = 299.7416 K 𝑇4 = 336.2462 K Ans

Finite-Difference Methods: Derivative Boundary Conditions


We will prescribe a derivative boundary condition at one end of the rod:
𝑑𝑇
(0) = 𝑇′𝑎
𝑑𝑥
And a fixed boundary condition at the other:
𝑇(𝐿) = 𝑇𝑏
8

Figure 4 A boundary node at the left end of a heated rod. To approximate the derivative
at the boundary, an imaginary node is located a distance x to the left of the rod’s end

Fig. 4 depicts the node (0) at the left edge of a heated plate for which the
derivative boundary condition applies. Write Eq. (6) for this node gives

−𝑇−1 + 2 + ℎ′ ∆𝑥 2 𝑇0 − 𝑇1 = ℎ′ ∆𝑥 2 𝑇∞ … (7)
The first derivative in the x dimension at (0) by the centered difference
𝑑𝑇 𝑇1 − 𝑇−1
=
𝑑𝑥 2∆𝑥
Which can be solved for
𝑑𝑇
𝑇−1 = 𝑇1 − 2∆𝑥
𝑑𝑥
Now we have a formula for 𝑇−1 that actually reflects the impact of the
derivative. It can be substituted into Eq. (7) to give
𝑑𝑇
2 + ℎ′ ∆𝑥 2 𝑇0 − 2𝑇1 = ℎ′ ∆𝑥 2 𝑇∞ − 2∆𝑥 … (8)
𝑑𝑥
Consequently, we have incorporated the derivative into the balance.
9

Example 2. Solve the same problem as in example 1. But use the boundary
condition as
𝑑𝑇
a) (0) = 𝑇′𝑎 = 0 and 𝑇(𝐿) = 𝑇𝑏 = 400
𝑑𝑥
𝑑𝑇
b) (0) = 𝑇′𝑎 = −20 and 𝑇(𝐿) = 𝑇𝑏 = 400
𝑑𝑥

Solution a)

T1 T0 T1 T2 T3 T4 T5  400 K

node -1 0 1 2 3 4 5
x  2 m

Node 0 From Eq.(8)


𝑑𝑇
(2 + ℎ′∆𝑥 2 )𝑇0 − 2𝑇1 = ℎ′∆𝑥 2 𝑇∞ − 2∆𝑥
𝑑𝑥
Substituting all parameter ℎ′, ∆𝑥 and 𝑇∞ yields

𝑑𝑇
2.2𝑇0 − 2𝑇1 = 40 − 4 …(E1)
𝑑𝑥
𝑑𝑇
Apply derivative boundary condition (0) = 0 gives
𝑑𝑥

2.2𝑇0 − 2𝑇1 = 40
The equations, for node 1 to 4, are same as the example 1. The final system of
equations can be assembled in matrix form as
10

𝑇0
2.2 −2 0 0 0 0 𝑇1 40
−1 2.2 −1 0 0 0 𝑇2 40
0 −1 2.2 −1 0 0 = 40
𝑇3
0 0 −1 2.2 −1 0 40
𝑇4
0 0 0 −1 2.2 −1 40
𝑇5
Substituting the fixed boundary condition 𝑇5 = 𝑇(10) = 400 K gives
2.2 −2 0 0 0 𝑇0 40 40
−1 2.2 −1 0 0 𝑇1 40 40
0 −1 2.2 −1 0 𝑇2 = 40 = 40
0 0 −1 2.2 −1 𝑇3 40 40
0 0 0 −1 2.2 𝑇4 40 + 𝑇5 440
These equations can be solved for
𝑇0 = 243.0278 K
𝑇1 = 247.3306 K
𝑇2 = 261.0994 K Ans.
𝑇3 = 287.0882 K
𝑇4 = 330.4946 K
𝑑𝑇
b) From Eq. (E1) Apply derivative boundary condition (0) = −20 gives
𝑑𝑥

2.2𝑇0 − 2𝑇1 = 120


The simultaneous equations are

2.2 −2 0 0 0 𝑇0 120 120


−1 2.2 −1 0 0 𝑇1 40 40
0 −1 2.2 −1 0 𝑇2 = 40 = 40
0 0 −1 2.2 −1 𝑇3 40 40
0 0 0 −1 2.2 𝑇4 40 + 𝑇5 440
Which can be solved for
11

𝑇0 = 328.2710 K
𝑇1 = 301.0981 K
𝑇2 = 294.1448 K Ans.
𝑇3 = 306.0204 K
𝑇4 = 339.1002 K
As in Fig. 5 the solution at x = 0 now curves downward due to the negative
derivative we imposed at the boundary.

Figure 5 The solution of a second-order ODE with a derivative boundary condition at


one end and fixed boundary condition at the other. Two cases are shown reflecting
different derivative values at x = 0.
12

Example 3. Use the finite-difference approach with ∆𝑥 = 5 to solve


𝑑2 𝑦 𝑑𝑦
7 2−2 −𝑦+𝑥 =0
𝑑𝑥 𝑑𝑥
With the boundary conditions
a) 𝑦 0 = 5 and 𝑦 20 = 8
𝑑𝑦 𝑑𝑦
b) 0 = −2 and 20 = −2
𝑑𝑥 𝑑𝑥
𝑑𝑦
c) 0 = −2 and 𝑦 20 = 9
𝑑𝑥
13

Problem
Use the Finite-Difference approach to approximate the solution to the
following boundary value problems.
𝜋
a. 𝑦 ′′ = −3𝑦 ′ + 2𝑦 + cos 𝑥 , 0≤𝑥≤ , 𝑦 0 = −0.3,
2

𝜋 𝜋
𝑦 = −0.1; use ∆𝑥 = .
2 8

𝑦′ 2 ln 𝑥
b. 𝑦 ′′ = + 𝑦+ −1, 1 ≤ 𝑥 ≤ 2, 𝑦′ 1 = 0,
𝑥 𝑥2 𝑥
1
𝑦 2 = 0; use ∆𝑥 = .
3
Example 3 (Δ x = 0.01)
16

14 a)
b)
12

10

8
y

0
0 2 4 6 8 10 12 14 16 18 20
x

You might also like