Sie sind auf Seite 1von 10

ChemE 109 - Numerical and Mathematical Methods in Chemical and Biological Engineering Fall 2007 Solution to Homework Set

6 1. The following conservation equation describes the steady-state temperature distribution in a metal square: 2T 2T + =0 x2 y 2 subject to the following boundary conditions: T T (x, 0) = 0, (x, 1) = 0 y y T (0, y ) = 0, T (1, y ) = f (y )

(a) The centered nite dierence method will be employed to compute the temperature prole in the rectangle. Set up the grid in (x, y ) dimensions, with (i, j ) serving as local indices, as shown below:

(i, j+1)

(i1, j) (i, j) (i, j1)

(i+1, j)

Use three equidistant interior nodes and the same discretization step in both x and y dimensions (i.e. i = 1, . . . , 5, j = 1, . . . , 5 and x = y ). Show the exact form of the equations needed to compute Tij , for i = 2, 3, 4 and j = 2, 3, 4. (b) Use the method of separation of variables to compute an analytic series solution for the above problem. Solution: (a) In the gure below, the shadowed area is the metal square. j = 0, 6 are ctitious nodes due to the boundary conditions on x-sides. The unknown variable is Tij , where the upper

6 5 4

3 2 1 j=0 i=1

Tij

subindex denotes x-coordinate and the lower subindex denotes y-coordinate. The black dots in the gures denote the unknown nodes. Since the lattice is equidistantly divided x = y = h where h = 1 = 0.25. 4 Discretization of the nodes and boundary conditions using centered nite dierence method Tij+1 2Tij + Tij1 2T = x2 h2 2T Tij +1 2Tij + Tij 1 = y 2 h2

j 1 T T j +1 yi = i y 2h

B. C. 1:

T (x, 0) = 0 Ti1 = Ti3 , y T (x, 1) = 0 Ti3 = Ti5 , y


2

i = 0, 1, 2, 3, 4

B. C. 2:

i = 0, 1, 2, 3, 4

B. C. 3: B. C. 4:

i T (0, y ) = 0 T1 = 0,

i = 0, 1, 2, 3, 4 i = 0, 1, 2, 3, 4

i T (1, y ) = f (y ) T5 = f (yi ),

Node at (i,j ), i = 2, 3, 4 and j = 1, 2, 3, 4, 5: Tij+1 2Tij + Tij1 Tij +1 2Tij + Tij 1 + =0 h2 h2 The equations are linear regardless of the format of f (y ), so Jacobi or Gauss-Seidal are applicable to solve the solution. (b) Use the method of separation of variables to compute an analytic series solution for the above problem. This is an elliptic PDE 2T 2T + =0 x2 y 2 Separation of variables

T (x, y ) =
n=1

Tn (x, y ) =
n=1

Xn (x)Yn (y )

Substitute back into the PDE Xn (x)Yn (y ) + Xn (x)Yn (y ) = 0 i. for Yn (y ) Xn (x) Y (x) = n = const. = 2 n Xn (x) Yn (x)

Yn (y ) + 2 n Yn (y ) = 0 D = b2 4ac = 42 n < 0

For this second-order ODE, a = 1, b = 0, c = 2 n The general solution Yn (y ) is Yn (y ) = An sin(n y ) + Bn cos(n y ) The derivative of Yn (y ) is Yn (y ) = An n sin(n y ) + Bn n cos(n y ) For B. C. 1:
T (x, 0) = Xn (x)Yn (0) = 0 y n=1

Yn (0) = [An n sin(0) + Bn n cos(0)] = 0 Bn = 0 Thus Yn (y ) = An cos(n y ) For B. C. 2: T (x, 1) = Xn (x)Yn (1) = 0 y n=1 n = 1, 2,

Yn (1) = [An n sin(n )] = 0 sin(n ) = 0 n = n, Thus Yn (y ) = An cos(ny )


3

ii. for Xn (x)

Xn (x) 2 n xn ( x) = 0 D = b2 4ac = 42 n > 0

For this second-order ODE, a = 1, b = 0, c = 2 n

The general solution Xn (x) is Xn (x) = Cn en x + Dn en x = Cn enx + Dn enx

For B. C. 3: T (0, y ) =
n=1

Xn (0)Yn (y ) = 0

Yn (y ) = (Cn + Dn )Yn (y ) = 0 Cn = Dn Thus Xn (x) = Cn enx enx = 2Cn sinh(nx)

For B. C. 4: T (1, y ) =
n=1

Xn (1)Yn (y ) = f (y )

n=1

Xn (1)Yn (y ) =
n=1

2An Cn sinh(n ) cos(ny ) = f (y )

Due to the orthogonal properties of the sinusoidal functions


1 0

cos(ny ) cos(my )dy =

1 , m=n

m=n

The coecient An Cn can be obtained


1 0

f (y ) cos(ny )dy 2Ai Ci sinh(i ) cos(iy ) cos(ny )dy


1 0

1 0 i=1

=
i=1

2Ai Ci sinh(i )

cos(iy ) cos(ny )dy


1 0

= 0 + 0 + + 2An Cn sinh(n ) = An Cn sinh(n ) Thus An Cn = Therefore the whole solution is


1 0

cos2 (ny )dy + 0 +

f (y ) cos(ny )dy sinh(n )

T (x, y ) = 2
n=1

1 0

f (y ) cos(ny )dy sinh(nx) cos(ny ) sinh(n )


4

2. Consider the following wave equation subject to external force: 2v 2v 2 = f (x, t) t2 x where f (x, t) denotes a nonlinear function of space and time, subject to the following boundary and initial conditions: v v (0, t) = 0, (1, t) = 0 x x v (x, 0) = 0, v (x, 0) = v0 t

(a) The solution, v (x, t), will be computed using the centered nite dierence method for spatial discretization and the explicit Euler method for integration in time. Set up the grid in (x, t) dimensions, with (i, l) serving as local indices, as shown below:

l=2

1 l=1 1

i1 i i+1 i1 i i+1

N N

Use 3 equidistant interior nodes in the x direction (i.e. i = 1, . . . , 5) and show the exact 2 form of all equations needed to compute, vi for i = 2, 3, 4. (b) When f (x, t) = 0, use the method of separation of variables to compute an analytic series solution for the above problem. Solution: (a) In the gure below, l = 0, i = 0, 6 are ctitious nodes due to the initial condition at t = 0 and the boundary conditions at x = 0 and x = 1. The black dots in the gures l denote the unknown nodes. The unknown variable is vi , where the upper subindex denotes t-coordinate and the lower subindex denotes x-coordinate.

vil

t
1 l=0 i=1

Since the lattice is equidistantly divided x = h = 0.25. where h = 1 4 Discretization of the nodes and boundary conditions using centered nite dierence method
l l l vi 2v +1 2vi + vi1 = x2 h2 l v l vi v 1 = i+1 x 2h l+1 l1 l 2v vi 2vi + vi = t2 t2 l1 v v l+1 vi = i t 2t

B. C. 1: B. C. 2: I. C. 1: I. C. 2:

v l l , = v2 (0, t) = 0 v0 x v l l = v6 , (1, t) = 0 v4 x
1 = 0, v (x, 0) = 0 vi

i = 0, 1, 2, 3, 4 i = 0, 1, 2, 3, 4 i = 0, 1, 2, 3, 4 i = 0, 1, 2, 3, 4

v 0 2 (x, 0) = v0 vi = vi 2v0 t, t Node at (i,1), i = 1, 2, 3, 4, 5, l = 1:

1 1 1 2 1 0 vi vi 2vi + vi +1 2vi + vi1 + = f (xi , t1 ) h2 t2

where xi = (i 1)h and t1 = 0. 2 So the exact form of the equations needed to solve vi is
2 2vi 1 2v0 t 2 = f ((i 1)h, 0) vi = ( f ((i 1)h, 0) + v0 )t t 2

(b) When f (x, t) = 0, use the method of separation of variables to compute an analytic series solution for the above problem. This is an hyperbolic PDE 2v 2v 2 = f (x, t) f (x, t) = 0 t2 x Separation of variables

v (x, t) =
n=1

vn (x, t) =
n=1

Xn (x)Tn (t)

Substitute back into the PDE Xn (x)Tn (t) Xn (x)Tn (t) = 0 Xn (x) T (t) = n = 2 n Xn (x) Tn (t)

i. for Xn (x)

Xn (y ) + 2 n Xn (x) = 0 D = b2 4ac = 42 n < 0

For this second-order ODE, a = 1, b = 0, c = 2 n

The general solution Xn (x) is Xn (x) = An cos(n x) + Bn sin(n x) The derivative of Xn (x) is Xn (x) = An n sin(n x) + Bn n cos(n x) For B. C. 1:
v (0, t) = Xn (0)Tn (t) = 0 x n=1

Xn (0) = [An n sin(0) + Bn n cos(0)] = 0 Bn = 0 Thus Xn (x) = An cos(n x) For B. C. 2:


v (1, t) = Xn (1)Tn (t) = 0 x n=1

Xn (1) = [An n sin(n )] = 0 sin(n ) = 0 n = n, Thus Xn (x) = An cos(nx) ii. for Tn (t) Tn (t) 2 n Tn (t) = 0 D = b2 4ac = 42 n < 0 The general solution Tn (t) is Tn (t) = Cn cos(n t) + Dn sin(n t) The derivative of Tn (t) is Tn (t) = Cn n sin(n t) + Dn n cos(n t)

n = 1, 2,

For this second-order ODE, a = 1, b = 0, c = 2 n

For B. C. 3: v (x, 0) =
n=1

Xn (x)Tn (0) = 0

Tn (0) = [Cn n sin(0) + Dn n cos(0)] Cn = 0 Thus Tn (t) = Dn sin(nt) For B. C. 4:


v (x, 0) = Xn (x)Tn (0) = v0 t n=1

n=1

Xn (x)Tn (0) =
n=1

nAn Dn cos(nx) cos(0) =


n=1

nAn Dn cos(nx) = v0

Due to the orthogonal properties of the sinusoidal functions


1 0

cos(nx) cos(mx)dx =

1 , m=n

m=n

The coecient An Cn can be obtained


1 0

v0 cos(nx)dx iAi Di cos(iy ) cos(nx)dx


1 0

1 0 i=1

=
i=1

iAi Di

cos(iy ) cos(nx)dx
1 0

= 0 + 0 + + nAn Dn = Thus 1 nAn Dn 2


1 0

cos2 (nx)dx + 0 +

2 n Therefore the whole solution is A n Dn = v (x, t) = 2

v0 cos(nx)dx =

2v0 sin(n ) (n)2

2v0 sin n cos(nx) sin(nt) 2 n=1 (n)

3. Use separation of variables to solve the following heat equation problem analytically: T 2T = t x2 subject to the following initial and boundary conditions T (, t) = 0, x where f (x) is a known nonlinear function of x. Solution: This is an parabolic PDE 2T 2T = t x2 Separation of variables T (0, t) = 0,

T (x, 0) = f (x)

T (x, t) =
n=1

Tn (x, t) =
n=1

Xn (x)tn (t)

Substitute back into the PDE Xn (x)tn (t) = Xn (x)tn (t)


8

Xn (x) t (t) = n = 2 n Xn (x) tn (t)

(a) for Xn (x)

Xn (y ) + 2 n Xn (x) = 0 D = b2 4ac = 42 n < 0

For this second-order ODE, a = 1, b = 0, c = 2 n

The general solution Xn (x) is Xn (x) = An cos(n x) + Bn sin(n x) The derivative of Xn (x) is Xn (x) = An n sin(n x) + Bn n cos(n x)

For B. C. 1: T (0, t) =
n=1

Xn (0)tn (t) = 0 Xn (0) = An cos(0) + Bn sin(0) = 0 An = 0

Thus Xn (x) = Bn sin(n x) For B. C. 2:


T (, t) = Xn ( )tn (t) = 0 x n=1

1 Xn ( ) = Bn n cos(n ) = 0 cos(n ) = 0 n = n + , 2 Thus 1 Xn (x) = Bn sin (n + )x 2 tn (t) = 2 n tn (t) tn (t) = Cn en t = Cn e(n+ 2 )

2 1 2 t

n = 0, 1, 2,

(b) for tn (t) The general solution tn (t) is

For I. C. 1: T (x, 0) =
n=1

Xn (x)tn (0) = f (x)


1 1 Bn Cn sin (n + )x = f (x) Bn Cn e0 sin (n + )x = 2 2 n=1 n=1

n=1

Xn (x)tn (0) =

Due to the orthogonal properties of the sinusoidal functions


0

1 1 2 sin (n + )x sin (m + )x = 2 2 0

pi , m=n

m=n

The coecient An Cn can be obtained


0

1 f (x) sin (n + )x dx 2 1 1 Bi Ci sin (i + )x sin (n + )x dx 2 2 i=1


0

=
i=1

Bi C i

1 1 sin (i + )x sin (n + )x dx 2 2
0

= 0 + 0 + + Bn Cn = Thus Bn C n = Therefore the whole solution is T (x, t) = 2 n=1


0

1 sin2 (n + )x dx + 0 + 2

Bn Cn 2 2
0

1 f (x) sin (n + )x dx 2

1 2 1 1 f (x) sin (n + )x dxe(n+ 2 ) t sin (n + )x 2 2

10

Das könnte Ihnen auch gefallen