Upload
alan-gonzalez
View
15
Download
0
Embed Size (px)
Citation preview
26/08/2013
1
School of Chemical Engineering
Sunday, August 25, 2013
Life Impact | The University of Adelaide
Introduction to Process Modeling - Introduction to Excel - Statistical analysis - Regression analysis - Solving a nonlinear algebraic equation
School of Chemical Engineering
Life Impact | The University of Adelaide Slide 1
• finding v for a given p and T
Poling, B. E., J. M. Prausnitz, et al. (2001). The properties of gases and liquids. New York,
McGraw-Hill.
Volume of a real gas
Slide 1
vvbv
RTp
2
2
21
2
2
2
12699.05422.137464.01
;2
0778.0 ;
45724.0
c
c
c
c
cc
c
c
c
TT
bb
RT
bP
RT
vPZ
RT
ap
is critical pressure is critical temperature is critical volume is the acentric factor
cp
cT
cv
26/08/2013
2
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations
Slide 2
• graphical method
• bisection
• secant
• false position
• Newton-Raphson
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: graphical method
Slide 3
• to calculate when
axf x
axfxg
26/08/2013
3
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: graphical method
Slide 4
• Find the molar volume of propane at 300 K and 10 bar by using the following EoS.
where
vvbv
RTp
2
2212
22
2
c
13
126992.054226.137464.01
45724.0 0778.0
2 0.152
2762.0 Z 0.200 48.42 83.369
r
c
c
c
c
ccc
Ta
p
TRa
p
RTb
bb
molcmvbarpKT
School of Chemical Engineering
Life Impact | The University of Adelaide
-20.0000
-15.0000
-10.0000
-5.0000
0.0000
5.0000
10.0000
15.0000
20.0000
0 500 1000 1500 2000 2500 3000
pa
nd
p-
10
(b
ar)
v (cm3/mol)
p(v) 10 bar p(v) - 10 bar
Numerical methods for solving nonlinear equations: graphical method
Slide 5
• Find the molar volume of propane at 300 K and 10 bar by using the following EoS.
vvbv
RTp
2
Vg
Vl
26/08/2013
4
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 6
The bisection method is based on the following theorem:
An equation f(x) = 0, where f(x) is a real continuous function, has at least one root between xl and xu only if f(xl)×f(xu) < 0.
xl
xu
f(x)
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 7
What about if f(x) is a real continuous function and f(xl)×f(xu) > 0.
xl xu
f(x)
xl xu
f(x)
26/08/2013
5
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 8
Algorithm
1. Select two points xl and xu such that f(xl)×f(xu) < 0.
xl
xu
f(x)
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 9
Algorithm
2. Calculate a new point xm as xm = (xl + xu) / 2.
xl
xu
f(x)
26/08/2013
6
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 10
Algorithm
3. Change the xl or xu according to the following criteria:
a) if f(xl)×f(xm) < 0, then the root lies between xl and xm; then xl = xl, xu = xm;
b) if f(xm)×f(xu) < 0, then the root lies between xm and xu; then xl = xm, xu = xu;
c) if f(xm) < tolerance value, then xm is the root; stop the algorithm.
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 11
Algorithm
2. Calculate the next point xm as xm = (xl + xu) / 2.
xl
xu
f(x)
xm
26/08/2013
7
School of Chemical Engineering
Life Impact | The University of Adelaide Slide 12
• Excel example
Find the molar volume of propane at 300 K and 10 bar by using the following EoS.
where
vvbv
RTp
2
2212
22
2
c
13
126992.054226.137464.01
45724.0 0778.0
2 0.152
2762.0 Z 0.200 48.42 83.369
r
c
c
c
c
ccc
Ta
P
TRa
P
RTb
bb
molcmvbarpKT
Numerical methods for solving nonlinear equations: bisection method
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Slide 13
Excel example
• First we set up the information:
26/08/2013
8
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Excel example
We calculate values in the table according to the bisection algorithm.
first two input values vm = (vl + vu) / 2
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Excel example
We calculate values in the table according to the bisection algorithm.
Use the IF function to set up vl and vu. vm = (vl + vu) / 2
26/08/2013
9
School of Chemical Engineering
Life Impact | The University of Adelaide
Numerical methods for solving nonlinear equations: bisection method
Excel example
We calculate values in the table according to the bisection algorithm.
solution
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
Excel has a built in function that allows calculating the root of a function. Example in Excel 2007
26/08/2013
10
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
Excel has a built in function that allows calculating the root of a function. Example in Excel 2007
This is the cell where we have f(x).
This is the value that we need, so it is 0 if f(x) – a = 0.
This is the cell where x is stored.
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
In our example
pcal - p is defined in $G$27.
26/08/2013
11
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
In our example
We need: pcal - p = 0.
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
In our example
We change the volume in $G$25 in order to find the value for which pcal - p = 0.
vvbv
RTp
2
26/08/2013
12
School of Chemical Engineering
Life Impact | The University of Adelaide
Goal Seek
In our example
The solution depends on the initial value selected.
If the first value is v = 85 cm3/mol:
If the first value is v = 2600 cm3/mol:
vvbv
RTp
2
Goal Seek
Goal Seek
School of Chemical Engineering
Life Impact | The University of Adelaide
-20.0000
-15.0000
-10.0000
-5.0000
0.0000
5.0000
10.0000
15.0000
20.0000
0 500 1000 1500 2000 2500 3000
pa
nd
p-
10
(b
ar)
v (cm3/mol)
p(v) 10 bar p(v) - 10 bar
Goal Seek
The solution depends on the initial value selected.
initial condition for the liquid phase
solution for the liquid phase
initial condition for the gas phase
solution for the gas phase
Goal Seek