Sei sulla pagina 1di 27

Ho Chi Minh City University of Technology

Faculty of Geology & Petroleum Engineering


Modeling & Simulation Division

Presenter: Dr. Do Quang Khanh
Email: doquangkhanh@yahoo.com
Website: www.hcmut.edu.vn

APPROXIMATION & ERRORS
HCMUT
Accuracy, Precision, Errors
Dr. Do Quang Khanh 2
HCMUT
Accuracy, Precision, Errors
Taylor series expansion for multi-variable
function, Error Propagation

A new perspective: The result of a
computation is a multi-variable function of
the input values
3 Dr. Do Quang Khanh
HCMUT
... ) , ( ) , ( +

+ = + + y
y
f
x
x
f
y x f y y x x f
y
y
f
x
x
f
f


Error calculus (here is positive)
Two variables, first order Taylor Approximation:
4 Dr. Do Quang Khanh
HCMUT
Derive
DERIVE
What are the two partial derivatives of
f= x+y
f=x-y
f = x*y
f = x/y
For summation/substraction the
absolute errors are added
For multiplication and division the
relative errors are added
5 Dr. Do Quang Khanh
HCMUT
Oil in Place

Advanced: Assuming undersaturated reservoir with formation volume factor

Bo =1.63 resBbl/STB, calculate the oil in place.

Assuming $ 20/ STB (+/- 50 %) and Ultimate Recovery 32-48 %, express
the reserve in US $ with the associated uncertainty (+/- $)

6 Dr. Do Quang Khanh
HCMUT
Example: Find the error in a laboratory determination of the gas Z-factor, given that:
p =3245 psi

p = 3 psi (meaning:

3 psi)
v =1.977 ft
3

v = 0.003 ft
3
n =1 lb_mole

n = 0.001 lb_mole
T =739.67
o
R

T = 0.03
o
R
Differentiating z =pv/(nRT) we obtain
z
v
nRT
p
p
nRT
v
pv
n RT
n
pv
nRT
T = + +

+

2 2
A simpler form is


z
pv
nRT
p
p
v
v
n
n
T
T
= + + +

=

28 10
3
.
(Does the result have any dimension? Why did we not use more decimal figures? Why do we use "absolute value"?
Why do we not use "absolute value" in the

p term? Does it matter that T is in the denominator?


(Notice:
lb_mole is a rather obsolete unit: it is 453.592 mol, or sometimes the mass or weight of it;
R = 10.73 psi ft
3
/(lb_mole
o
R) is the universal gas constant in the "English" or "field" system of units)
Class homework: Do the whole computation in SI changing all input data to SI first.
R = 8.3144 J /(mol K) is the SI value for the universal gas constant
(Submit HW into the submission folder of U02.)
7 Dr. Do Quang Khanh
HCMUT
Total error: truncation and round-off
Error propagation in a numerical method:
what happens with the error "inherited"

Stability of a computational algorithm:
errors (originated from truncation and
round-off) are not amplified from step to
step but are rather kept under control
A problem is ill-conditioned, if results are
very sensitive to input data (regardless of
the method used)
8 Dr. Do Quang Khanh
HCMUT
Accuracy, Precision, Errors
Taylor series expansion for multi-variable
function, Error Propagation

A new perspective: The result of a
computation is a multi-variable function of
the input values
9 Dr. Do Quang Khanh
HCMUT
BASIC CONCEPTS
Existence and uniqueness of solution
Graphical versus numerical solution
Analytical versus numerical method to get
the solution numerically
Direct vs iterative (explicit vs implicit)
Iteration: convergence, divergence
Order of the method
Single variable, multi variable
Linear, nonlinear
10 Dr. Do Quang Khanh
HCMUT
Basic trade-offs

Step size - Approximation Order

Truncation error - Round-off error

Simplicity - Complexity

11 Dr. Do Quang Khanh
HCMUT
Trade-Off Regarding "step-size"
Log "stepsize"
more steps less steps
12 Dr. Do Quang Khanh
HCMUT
Trade-Off Regarding Complexity
Higher order, more
complex method
Less sophisticated,
robust method
13 Dr. Do Quang Khanh
HCMUT
COURSE STRUTURE
Single variable (nonlinear) methods
Root of equation
Minimum of function
Manipulation of functions (differentiation,
integration)
functions given in form of expression or
algorithm
discrete data point (smoothing, curve
fitting + diff and int)
Ordinary Differential Equation (ODE)

14 Dr. Do Quang Khanh
HCMUT
Multi variable problems
Linear
Matrices, vectors
Systems of linear eqs.: direct, special, iterative
Nonlinear
System of nonlinear eqs.
Minimum of multi variable function (general and
least squares)
System of ODE
Partial Differential Equation
Reservoir simulation

COURSE STRUTURE
15 Dr. Do Quang Khanh
HCMUT
The book has a
somewhat
different
structure.

16 Dr. Do Quang Khanh
HCMUT
Example Problem
A cylindrical tank is to store 1 bbl liquid.
Express the surface area as a function of the
ratio= H/D, where H is the height and D is
the diameter.
How should we select this ratio to obtain the
least surface area? (Least material needed
to make the barrel.)
What is the optimum diameter, height,
surface area expressed in conveniently
selected units?
What kind of problem is to find the
optimum?
What methods can we use?
17 Dr. Do Quang Khanh
HCMUT
CONVERGENCE
Mathematically a series converges to a
limit if the difference of the n-th term
and the limit can be made smaller than
any selected positive "epsilon" by
selecting a "large enough" n.
In numerical methods we do not know
the limit. What we really see is how
near two subsequent approximations
are to each other.
Convergence criterion is a requirement
posed on the nearness of two (or more)
subsequent approximants.
18 Dr. Do Quang Khanh
HCMUT
Convergence criterion
Sometimes it make more sense to
require "near" in absolute terms,
sometimes in relative terms.
It has to be related to the engineering
content. Do not forget the dimension!
19 Dr. Do Quang Khanh
HCMUT
Question
What convergence criterion (relative?
Absolute?) would you use if you have to
find the temperature of a stream from
energy balance?
a) The temperature you are looking for is expressed in Rankine
(or Kelvin) and you know, that the thermo functions used are
about 0.01 % accurate?
b) The temperature is expressed in Celsius and can be easily
near to the freezing point of water?
20 Dr. Do Quang Khanh
HCMUT
Question
You solve an equation for bubble point
pressure. The subroutine is written in
"strict SI" so the pressure is in Pascal.
Is it wise to use a convergence criterion:
eps = 1E-6 ?
21 Dr. Do Quang Khanh
HCMUT
Order of convergence error ~
Theoretical order of a method
one thing is order for the formula
other thing is order for the method (formula
repeated and errors inherited)
Practical rate of convergence
If we plot estimates of errors on a log-log plot,
what will we see, if the error is decreasing with
first power of "step-size"
second power of step size?
) (
n
x O
22
Dr. Do Quang Khanh
HCMUT
Reckon order from error estimates
step-size
estimated
error
0.5 4.25E-02
0.2 6.80E-03
0.1 1.70E-03
0.05 4.25E-04
0.02 6.80E-05
0.01 1.70E-05

HW: Use Excel or MATLAB to make Cartesian and log-log plot
23 Dr. Do Quang Khanh
HCMUT
1. Error propagation: borehole volume
A 6000 ft ( 1 %) deep borehole has a
diameter: 5 inch ( 0.04 inch). What is the
volume in bbl? (Give your answer with error
estimate!)

2. Error propagation: one-gallon cube
What is the side length of a one-gallon (5 %)
cube? Indicate the unit and error
estimate of your answer!
ASSIGNMENTS, TEST PROBLEMS
25 Dr. Do Quang Khanh
HCMUT

3. Error propagation: barrel
Consider a right circular cylinder that has a
volume 1 BBL (British barrel) (0.06 %).
The height is exactly twice the diameter.
Estimate the diameter, indicating the unit
and the uncertainty.
ASSIGNMENTS, TEST PROBLEMS
26 Dr. Do Quang Khanh
HCMUT
4. Error propagation: hydrocarbon volume
The volume occupied by hydrocarbons in a
certain reservoir can be calculated from
V
HC
= V (1S
w
) where V is the reservoir volume,
is the porosity, and S
w
is the water saturation.
Assuming V = 2.5 105 ft
3
(15%) and S
w
= 0.65
( 0.12) calculate the hydrocarbon volume and
give both the absolute and the relative errors of
the calculated value.
Note that the water saturation error is given as
an absolute error!
ASSIGNMENTS, TEST PROBLEMS
27 Dr. Do Quang Khanh