Set 2

advertisement
EGR 599
Advanced Engineering Math II
_____________________
LAST NAME, FIRST
Problem set #2
1. Use Newton’s Homotopy with x(0) = [4 2] to compute x(2) for the following nonlinear systems:
f1 ( x1 , x2 )  x12  x22  36  0
f 2 ( x1 , x2 )  2 x12  3x2  16  0
dx2
dt
so that
> 0.
dp
dp
Use Euler integration to determine the next value for the homotopy parameter t and the guessed
values for x1 and x2. Use Newton method to find the correct values for x1 and x2 at each value of
t.
Choose x2 as the independent variable and use p = 0.5. Choose the sign of
% Set 2, problem 1, Homotopy continuation
% Solve the following equations
%
f1s='x1^2+x2^2-36';f2s='x1^2-3*x2-16';
% Initial guesses
%
x1=4;x2=2;t=0;
f1o=eval(f1s);f2o=eval(f2s);
b1=(1-t)*f1o;b2=(1-t)*f2o;
dp=.5;
% x2 is the independent continuation variable
%
for ni=1:2
A=[2*x1 f1o; 2*x1 f2o];
B=[2*x2; -3];
a=-A\B;a1=a(1);at=a(2);
%
% Choose dx2dp so that dtdp>0
%
if at>0
dx2dp=1/sqrt(1+a1^2+at^2);
else
dx2dp=-1/sqrt(1+a1^2+at^2);
end
dx1dp=a1*dx2dp; dtdp=at*dx2dp;
x1=x1+dp*dx1dp;
x2=x2+dp*dx2dp;
t=t+dp*dtdp;
b1=(1-t)*f1o;b2=(1-t)*f2o;
% Find the correct values for x1 and x2 at the new value of t
for i=1:15
A=[2*x1 2*x2; 2*x1 -3];
B=[eval(f1s)-b1; eval(f2s)-b2];
dx=-A\B;
x1=x1+dx(1);x2=x2+dx(2);
if max(abs(dx))<.001; break ;end
end
fprintf(' t = %7.5f\n',t);
fprintf(' # of iteration = %g , x1 = %7.5f , x2 = %7.5f\n',i,x1,x2);
end
>> s2p1
t = 0.23078
# of iteration = 2 , x1 = 4.28149 , x2 = 2.31547
t = 0.47885
# of iteration = 2 , x1 = 4.55593 , x2 = 2.62778
2. The temperatures (K) at the nodal points of a two dimensional system are
shown. The left-side surface is held at a uniform temperature of 500oK,
while the surface A is subjected to a convection boundary condition with a
fluid temperature of 300oK and a heat transfer coefficient of 10 W/m2oK.
Calculate the heat rate leaving the surface A per unit thickness normal to the
page. Estimate the thermal conductivity of the material.
Ans: Heat rate 349 W/m, thermal conductivity 0.77 W/mK
Solution
Heat rate leaving the surface A per unit thickness normal to the page
q’conv = 100.2{0.5(337  300) + (356  300) + 0.5(500  300)} = 349 W/m
Thermal conductivity of the material
Node with T = 337oK
k
y (356  337)
x ( 414  337)
x
+k
=h
(337  300)
2
x
2
2
y
48k = 10
0 .2
37  k = 0.77 W/mK
2
3. The steady state temperature (oC) associated with selected
nodal points of a two-dimensional system having a thermal
conductivity of 1.5 W/moK are shown. The isothermal
boundary is at 200oC.
a) Determine the temperature at nodes 1, 2, and 3.
b) Calculate the heat transfer rate per unit thickness normal to
the page from the system to the fluid.
Ans: a) Node 1: 160.7 oC, node 2: 95.6 oC, node 3: 48.73 oC
b) 743 W/m
a)
T1 = 0.25(132.8 + 200 + 172.9 + 137) = 160.7 oC
T2 = 0.25(45.8 + 2103.5 + 129.4) = 95.6 oC
Node 3:
ky
(103.5  T3 )
x (67  T3 )
x (T3  45.8)
+k
= k
+ hy(T3  30)
x
2
2
y
y
103.5 + 67/2  1.5T3 = 0.5T3  45.8/2 + h
103.5  67 / 2  45.8 / 2 
T3 =
2
5
1.5
y
y
T3  h
30
k
k
5  30
1.5 = 48.73 oC
b)
q’conv = 500.1{0.5(45.8  30) + (48.7  30) + (67  30) + 0.5(200  30)} = 743 W/m
4. Solve the following equation
 2T  2T
+
=0
x 2
y 2
when the boundaries are held as shown
0
60
120
180
240
300
225
0
150
75
0
0
% Set 2, problem 4
T=zeros(5,6);
T(1,:)=[0 60 120 180 240 300];
T(:,6)=[300 225 150 75 0]';
for n=1:100
Tsave=T;
for i=2:4
for j=2:5
T(i,j)=.25*(T(i,j-1)+T(i,j+1)+T(i-1,j)+T(i+1,j));
end
end
if max(abs(T-Tsave))<.0001, break, end
end
fprintf('# of iterations = %g\n',n)
disp('T =');disp(T)
# of iterations = 26
T =
0
60.0000
0
44.9999
0
29.9999
0
15.0000
0
0
120.0000
89.9999
59.9999
30.0000
0
180.0000
134.9999
89.9999
45.0000
0
240.0000
180.0000
120.0000
60.0000
0
300.0000
225.0000
150.0000
75.0000
0
5. Solve the following equation
 2T  2T
+
=0
x 2
y 2
x = 0, T = 500
y = 0,
T
= 10(T - 300)
y
x = 1, T = 400
y = 1, T = 500
by finite difference (x = y = 0.25), using Gauss-Seidel method. Error tolerance = 0.0001
% Set 2, problem 5
T=450*ones(5,5);
T(1,:)=400;T(5,:)=500;T(:,5)=500;
for n=1:100
Tsave=T;
for i=2:4
T(i,1)=(T(i-1,1)+T(i+1,1)+2*T(i,2)+1500)/9;
for j=2:4
T(i,j)=.25*(T(i,j-1)+T(i,j+1)+T(i-1,j)+T(i+1,j));
end
end
if max(abs(T-Tsave))<.0001, break, end
end
fprintf('# of iterations = %g\n',n)
disp('T =');disp(T)
# of iterations = 13
T =
400.0000 400.0000
333.6889 386.2133
330.7737 394.6658
353.9421 427.3525
500.0000 500.0000
400.0000
416.4985
434.3237
460.8022
500.0000
400.0000
445.4567
465.3283
481.5326
500.0000
500.0000
500.0000
500.0000
500.0000
500.0000
6. A long bar of rectangular cross section is 60 mm by 90 mm on a side and have a
thermal conductivity of 1 W/moK. The top surface is exposed to a convection
process with air at 100oC and a convection coefficient of 100 W/m2oK, while the
remaining surfaces are maintained at 50oC. Using a grid spacing of 30 mm and the
Gauss-Seidel iteration method, determine the nodal temperatures and the heat
transfer rate per unit length normal to the page into the bar from the air.
T1
T2
50
50
T3
T1 = 81.69oC, T2 = 58.45oC, T3 = 52.11oC, q’ = 205 W/m
50
100  0.03
hx
=
=3
1
k
The system is symmetrical with respect to the vertical line through the center. For node 1 we
have
y (T1  50)
(T  T2 )
h(T  T1)x = kx 1
+ 2k
2
x
y
hx
hx
T 
T1 = T1  T2 + T1  50
k
k
T1 =
T2  50  3  100
1
= (T2 + 350)
5
5
Node 2:
T2 = 0.25(T1 + T2 + 100)
Node 3:
T3 = 0.25(T2 + 150)
7. Find the directional derivative of f(x, y) = 2x2 + y2 at x = 2 and y = 2 in the direction of h = 3i +
2j.
Ans: 8.875
Solution
f(x, y) = 2x2 + y2
f
= 4x = 8 at x = 2 and y = 2
x
f
= 4y = 4 at x = 2 and y = 2
y
2
 
 = tan-1  3  = 0.588
g’ = directional derivative
g’ =
f
f
cos +
sin = 8cos(0.588) + 4sin(0.588) = 8.875
x
y
8. Find the gradient vector and Hessian matrix for each of the following functions:
a) f(x, y) = 2xy2 + 3exy
b) f(x, y, z) = x2 + y2 + 2z2
c) f(x, y) = ln(x2 + 2xy + 3y2)
Ans:
2 y 2  3 ye xy 
(a) f = 
,H=
xy 
 4 xy  3xe 
2 x 
(b) f = 2 y  , H =
 
 4 z 
(c) f =

3 y 2 e xy

2 xy
xy
4 y  3 y e  3e
4 y  3 y 2 e xy  3e xy 

4 x  3x 2 e xy

 2 0 0
 0 2 0


0 0 4
2 x  2 y 
1
1
,H=

2
2 
x  2 xy  3 y 2 x  6 y 
x 2  2 xy  3 y 2 2
  2 x 2  2 y 2  4 xy  2 x 2  6 y 2  12 xy


2
2
2
2
 2 x  6 y  12 xy 2 x  18 y  12 xy 
Download