Tutorial 8 Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Sec 51

85-220 Numerical Analysis of Engineering Systems


Winter 2014
Tutorial 8

1. Use the portion of the given steam table for superheated water at 200MPa to find
a) The corresponding entropy s for v=0.118m3/kg using linear interpolation
b) The corresponding entropy s for v=0.118m3/kg using quadratic interpolation
c) The volume corresponding to entropy s=6.45kJ/(kg K) using quadratic fit and inverse
interpolation
v, m3/kg 0.10377 0.11144 0.12547
s, kJ/(kg K) 6.4147 6.5453 6.7664

Solution:
a) Answer s= 6.6472
v = [0.10377 0.11144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,1)
polyval(p,0.118)

b) Answer s= 6.6515
v = [0.10377 0.1144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,2)
polyval(p,0.118)

c) Answer v= 0.1058.
v = [0.10377 0.1144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,2)
p(3)=p(3)-6.45
roots(p)
ans =
0.4007
0.1058

2. The drag coefficient for spheres such as sporting balls is known to vary as a function of
the Reynolds number Re, a dimensionless number that gives a measure of the ratio of
inertial forces to viscous forces:
Re = ρVD/μ

1
where ρ = the fluid.s density (kg/m3), V = its velocity (m/s), D = diameter (m), and μ =
dynamic viscosity (N.s/m2). Although the relationship of drag to the Reynolds number is
sometimes available in equation form, it is frequently tabulated. For example, the
following table provides values for a smooth spherical ball:

Re103 2 5.8 16.8 27.2 29.9 33.9 36.3 40 46 60 100 200 400
CD 0.52 0.52 0.52 0.5 0.49 0.44 0.18 0.074 0.067 0.08 0.12 0.16 0.19

(a) Plot the drag coefficient CD vs. velocity D = 22 cm, ρ = 1.3 kg/m3, and μ = 1.78 ×
10−5 Pa.s.
(b) Use spline interpolation and find the CD value at V= 2 m/s.
(c) Use piecewise Hermit interpolation and find the CD value at V=2 m/s
Solution:
clear,clc
Re=[2 5.8 16.8 27.2 29.9 33.9 36.3 40 46 60 100 200 400]*1e3
D=22e-2
ro=1.3
mu=1.78e-5
V=Re.*mu./ro./D;
Cd=[0.52 0.52 0.52 0.5 0.49 0.44 0.18 0.074 0.067 0.08 0.12 0.16 0.19]
plot(V,Cd,'db')
VV=linspace(0,25);
yfit1=interp1(V,Cd,VV,'spline');
yfita=interp1(V,Cd,2.0,'spline')
hold on
plot(VV,yfit1)
yfit2=interp1(V,Cd,VV,'pchip');
yfitb=interp1(V,Cd,2.0,'pchip')
plot(VV,yfit2,'r')
% yfita = 0.5091
% yfitb = 0.4714
0.55

0.5

0.45

0.4

0.35

0.3

0.25

0.2

0.15

0.1

0.05
0 5 10 15 20 25

2
3. Water exerts pressure on the upstream face of a dam as shown in Figure. The pressure
can be characterized by
p(z) = ρg(D − z)
where p(z) = pressure in pascals (or N/m2) exerted at an elevation z meters above the reservoir
bottom; ρ = density of water, which for this problem is assumed to be a constant 1000 kg/m3; g =
acceleration due to gravity (9.81 m/s2); and D = elevation (in m) of the water surface above the
reservoir bottom. Because both pressure and area vary with elevation, the total force is obtained
by evaluating

Determine the resultant force acting on the dam in Newton.

Figure 2.

z, m 0 12.5 25 37.5 50 62.5 75


,m 122 130 135 160 175 190 200

Solution:
clear,clc
z=[0 12.5 25 37.5 50 62.5 75];
w=[122 130 135 160 175 190 200];
rho= 1000
g=9.81
y=rho.*9.81.*w.*(max(z)-z)
F=trapz(z,y)
% F =3.9485e+009 N

4. Evaluate the triple integral with tolerance  10-9

3
Solution:
clear,clc
tol=1e-9;
I=triplequad(@(x,y,z)tut9p2(x,y,z),-5,1,1,2,-2,2,tol)
%Ans: I=-624.00
With
function y=tut9p2(x,y,z)
y=x.^3-5.*y.*z-z;

4
Sec 52
85-220 Numerical Analysis of Engineering Systems
Winter 2014
Tutorial 8

1. The following data defines the sea-level concentration of dissolved O2 for fresh water
as a function of temperature

(a) determine the concentration of dissolved O2 at T=27 °C


(b) determine the temperature of the water if concentration of the dissolved O2 is 10 mg/L using
inverse interpolation with second degree polynomial.

Solution:
%Problem 1
T=[0 8 16 24 32 40];
C=[14.621 11.843 9.870 8.418 7.305 6.413];
% plot(T,C,'o')
Ci=interp1(T,C,27)
% Answer Ci= 8.0006 mg/L
p=polyfit(T,C,2)
Cf=polyval(p,T);
plot(T,C,'o',T,Cf)
%inverse interpolation
p(3)=p(3)-10
Ti=roots(p)
% Ti = 80.0891 No physical meaning
% Answer T = 15.7117deg C

2. Given the data


x 0 100 200 400 600 800 1000
f(x) 0 0.82436 1.0 0.73576 0.40601 0.19915 0.09158
Use
(d) spline interpolation and find the function value at x=150
(e) Piecewise Hermit interpolation and find the function value at x=150
In both cases, create a plot and compare the fit with the exact function given by

5
x  x / 200 1
f ( x)  e
200

Solution:
x=[0 100 200 400 600 800 1000];
y=[0 0.82436 1.0 0.73576 0.40601 0.19915 0.09158];
plot(x,y,'o')
tt=linspace(0,1000)
yfita=interp1(x,y,tt,'spline');
ya150=interp1(x,y,150,'spline')
plot(x,y,'o',tt,yfita)
yfitb=interp1(x,y,tt,'pchip');
yb150=interp1(x,y,150,'pchip')
plot(x,y,'o',tt,yfita,tt,yfitb)
f=tt./200.*exp(-tt./200+1);
f150=150./200.*exp(-150./200+1)
plot(x,y,'o',tt,yfita,tt,yfitb,tt,f)
% Ans: ya150 = 0.9656
% yb150 = 0.9484
% f150 = 0.9630 exact value

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 100 200 300 400 500 600 700 800 900 1000

3. The total mass of a variable density rod is given by

6
where m=mass, density, cross-sectional area, x=the distance along the
rod and L=total length of the rod. The following data has been measured for 12m long
rod. Determine the mass of the rod in grams.

x, m 0 2 4 5 7 9 12
, g/cm3 14.00 13.95 13.89 13.80 13.60 13.41 13.30
, cm2 99 103 106 113 120 133 145
Solution:
x=[0 2 4 5 7 9 12];
x=x*100;
Ac=[99 103 106 113 120 133 145];
rho=[14 13.95 13.89 13.80 13.60 13.41 13.30 ]
y=rho.*Ac;
m=trapz(x,y)
%Ans m = 1.9423e+006

4. Evaluate the triple integral with tolerance  10-9

Solution:
clear,clc
tol=1e-9;
I=triplequad(@(x,y,z)tut9p2(x,y,z),-5,1,1,2,-2,2,tol)
%Ans: I=-624.00
With
function y=tut9p2(x,y,z)
y=x.^3-5.*y.*z-z;

7
Sec 53
85-220 Numerical Analysis of Engineering Systems
Winter 2014
Tutorial 8

3. Use the portion of the given steam table for superheated water at 200MPa to find
d) The corresponding entropy s for v=0.118m3/kg using linear interpolation
e) The corresponding entropy s for v=0.118m3/kg using quadratic interpolation
f) The volume corresponding to entropy s=6.45kJ/(kg K) using quadratic fit and inverse
interpolation
v, m3/kg 0.10377 0.11144 0.12547
s, kJ/(kg K) 6.4147 6.5453 6.7664

Solution:
d) Answer s= 6.6472
v = [0.10377 0.11144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,1)
polyval(p,0.118)

e) Answer s= 6.6515
v = [0.10377 0.1144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,2)
polyval(p,0.118)

f) Answer v= 0.1058.
v = [0.10377 0.1144 0.12547];
s = [6.4147 6.5453 6.7664];
p = polyfit(v,s,2)
p(3)=p(3)-6.45
roots(p)
ans =
0.4007
0.1058

4. The drag coefficient for spheres such as sporting balls is known to vary as a function of
the Reynolds number Re, a dimensionless number that gives a measure of the ratio of
inertial forces to viscous forces:

8
Re = ρVD/μ

where ρ = the fluid.s density (kg/m3), V = its velocity (m/s), D = diameter (m), and μ =
dynamic viscosity (N.s/m2). Although the relationship of drag to the Reynolds number is
sometimes available in equation form, it is frequently tabulated. For example, the
following table provides values for a smooth spherical ball:

Re103 2 5.8 16.8 27.2 29.9 33.9 36.3 40 46 60 100 200 400
CD 0.52 0.52 0.52 0.5 0.49 0.44 0.18 0.074 0.067 0.08 0.12 0.16 0.19

(f) Plot the drag coefficient CD vs. velocity D = 22 cm, ρ = 1.3 kg/m3, and μ = 1.78 ×
10−5 Pa.s.
(g) Use spline interpolation and find the CD value at V= 2 m/s.
(h) Use piecewise Hermit interpolation and find the CD value at V=2 m/s
Solution:
clear,clc
Re=[2 5.8 16.8 27.2 29.9 33.9 36.3 40 46 60 100 200 400]*1e3
D=22e-2
ro=1.3
mu=1.78e-5
V=Re.*mu./ro./D;
Cd=[0.52 0.52 0.52 0.5 0.49 0.44 0.18 0.074 0.067 0.08 0.12 0.16 0.19]
plot(V,Cd,'db')
VV=linspace(0,25);
yfit1=interp1(V,Cd,VV,'spline');
yfita=interp1(V,Cd,2.0,'spline')
hold on
plot(VV,yfit1)
yfit2=interp1(V,Cd,VV,'pchip');
yfitb=interp1(V,Cd,2.0,'pchip')
plot(VV,yfit2,'r')
% yfita = 0.5091
% yfitb = 0.4714

9
0.55

0.5

0.45

0.4

0.35

0.3

0.25

0.2

0.15

0.1

0.05
0 5 10 15 20 25

3. Water exerts pressure on the upstream face of a dam as shown in Figure. The pressure
can be characterized by
p(z) = ρg(D − z)
where p(z) = pressure in pascals (or N/m2) exerted at an elevation z meters above the reservoir
bottom; ρ = density of water, which for this problem is assumed to be a constant 1000 kg/m3; g =
acceleration due to gravity (9.81 m/s2); and D = elevation (in m) of the water surface above the
reservoir bottom. Because both pressure and area vary with elevation, the total force is obtained
by evaluating

Determine the resultant force acting on the dam in Newton.

Figure 2.

z, m 0 12.5 25 37.5 50 62.5 75


,m 122 130 135 160 175 190 200

Solution:
10
clear,clc
z=[0 12.5 25 37.5 50 62.5 75];
w=[122 130 135 160 175 190 200];
rho= 1000
g=9.81
y=rho.*9.81.*w.*(max(z)-z)
F=trapz(z,y)
% F =3.9485e+009 N

4. Evaluate the triple integral with tolerance  10-9

Solution:
clear,clc
tol=1e-9;
I=triplequad(@(x,y,z)tut9p2(x,y,z),-5,1,1,2,-2,2,tol)
%Ans: I=-624.00
With
function y=tut9p2(x,y,z)
y=x.^3-5.*y.*z-z;

11
Sec 54
85-220 Numerical Analysis of Engineering Systems
Winter 2014
Tutorial 8

5. The following data defines the sea-level concentration of dissolved O2 for fresh water
as a function of temperature

(a) determine the concentration of dissolved O2 at T=27 °C


(b) determine the temperature of the water if concentration of the dissolved O2 is 10 mg/L using
inverse interpolation with second degree polynomial.

Solution:
%Problem 1
T=[0 8 16 24 32 40];
C=[14.621 11.843 9.870 8.418 7.305 6.413];
% plot(T,C,'o')
Ci=interp1(T,C,27)
% Answer Ci= 8.0006 mg/L
p=polyfit(T,C,2)
Cf=polyval(p,T);
plot(T,C,'o',T,Cf)
%inverse interpolation
p(3)=p(3)-10
Ti=roots(p)
% Ti = 80.0891 No physical meaning
% Answer T = 15.7117deg C

6. Given the data


x 0 100 200 400 600 800 1000
f(x) 0 0.82436 1.0 0.73576 0.40601 0.19915 0.09158
Use
(i) spline interpolation and find the function value at x=150
(j) Piecewise Hermit interpolation and find the function value at x=150
In both cases, create a plot and compare the fit with the exact function given by

12
x  x / 200 1
f ( x)  e
200

Solution:
x=[0 100 200 400 600 800 1000];
y=[0 0.82436 1.0 0.73576 0.40601 0.19915 0.09158];
plot(x,y,'o')
tt=linspace(0,1000)
yfita=interp1(x,y,tt,'spline');
ya150=interp1(x,y,150,'spline')
plot(x,y,'o',tt,yfita)
yfitb=interp1(x,y,tt,'pchip');
yb150=interp1(x,y,150,'pchip')
plot(x,y,'o',tt,yfita,tt,yfitb)
f=tt./200.*exp(-tt./200+1);
f150=150./200.*exp(-150./200+1)
plot(x,y,'o',tt,yfita,tt,yfitb,tt,f)
% Ans: ya150 = 0.9656
% yb150 = 0.9484
% f150 = 0.9630 exact value

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 100 200 300 400 500 600 700 800 900 1000

7. The total mass of a variable density rod is given by

13
where m=mass, density, cross-sectional area, x=the distance along the
rod and L=total length of the rod. The following data has been measured for 12m long
rod. Determine the mass of the rod in grams.

x, m 0 2 4 5 7 9 12
, g/cm3 14.00 13.95 13.89 13.80 13.60 13.41 13.30
, cm2 99 103 106 113 120 133 145
Solution:
x=[0 2 4 5 7 9 12];
x=x*100;
Ac=[99 103 106 113 120 133 145];
rho=[14 13.95 13.89 13.80 13.60 13.41 13.30 ]
y=rho.*Ac;
m=trapz(x,y)
%Ans m = 1.9423e+006

8. Evaluate the triple integral with tolerance  10-9

Solution:
clear,clc
tol=1e-9;
I=triplequad(@(x,y,z)tut9p2(x,y,z),-5,1,1,2,-2,2,tol)
%Ans: I=-624.00
With
function y=tut9p2(x,y,z)
y=x.^3-5.*y.*z-z;

14

You might also like