=
Fitting the straight line
(y = mx + b) to three points;
Degrees of freedom: 1
) ; (
) ; (
) ; (
3 3
2 2
1 1
y x
y x
y x
)] ( [ 2 )] ( [ 2 )] ( [ 2 0
3 3 3 2 2 2 1 1 1
b mx y x b mx y x b mx y x
m
Q
+ + + =
=
Select m and b to minimize the Objective Function
Two equations, two unknowns: m and b
Objective function:
Dr. Do Quang Khanh 5
HCMUT
3
) ( ) (
3 2 1 3 2 1
x x x m y y y
b
+ + + +
=
2
3 2 1
2
3
2
2
2
1
3 2 1 3 2 1 3 3 2 2 1 1
) ( ) ( 3
) )( ( ) ( 3
x x x x x x
y y y x x x y x y x y x
m
+ + + +
+ + + + + +
=
3 3 2 2 1 1 3 2 1
2
3
2
2
2
1
) ( ) ( y x y x y x x x x b x x x m + + = + + + + +
3 2 1 3 2 1
3 ) ( y y y b x x x m + + = + + +
Multiply by 3 and by (x
1
+x
2
+x
3
), subtract, get m, then get b
Dr. Do Quang Khanh 6
HCMUT
Formulas for m & b, & programming
HW: Programming using arrays
2
1 1
2
1 1 1

.

\


.

\


.

\


.

\


.

\

=
= =
= = =
n
i
i
n
i
i
n
i
i
n
i
i
n
i
i i
x x n
y x y x n
m
n
x m y
b
n
i
i
n
i
i

.

\


.

\

=
= = 1 1
How to improve the program efficiency for very large values of n?
Think about calculating the same something several times!
Dr. Do Quang Khanh 7
HCMUT
Transformations to Straight Line
Dr. Do Quang Khanh 8
HCMUT
Means to Achieve SL Form
Only two unknown parameters, m and b
Number of points should be at least 3
(Degrees of freedom at least 1)
Needs ingenuity
Dr. Do Quang Khanh 9
HCMUT
Examples
FlowAfterFlow
Test of a Gas Well
Material Balance
of Volumetric Dry
Gas Reservoir
n
wf
p
p
q q
(
(


.

\

=
2
max
1
(
(


.

\

+ =
2
max
1 ln ln ln
p
p
n q q
wf
p
i
i
i
i
G
G z
p
z
p
z
p
=


.

\

=
G
G
z
z p
p
p
i
i
1
Dr. Do Quang Khanh 10
HCMUT
FlowAfterFlow Test of a Gas Well:
the Cast
Real World Straight Line World
(
(


.

\

+ =
2
max
1 log log log
p
p
n q q
wf
n
q
p
p
q
wf
max
2
log
1 log
log
(
(


.

\

m
b
x
y
x m b y + =
n
wf
p
p
q q
(
(


.

\

=
2
max
1
intercept
slope
Independent
variable
dependent
variable
Dr. Do Quang Khanh 11
HCMUT
Mat. Balance of Vol. DryGas Res.:
The Cast
Real World
Straight Line World
( )
i i
i i
p
Gz p
z p
G
z p
/
/
/
m
b
x
y
p
i
i
i
i
G
G z
p
z
p
z
p
=
x m b y + =
Measured
From measured p; z is a known function of p
Measured
There are other forms
Dr. Do Quang Khanh 12
HCMUT
Programming services
Add Trendline
Options: show equation
Select model
(Does not help you unless you
understand)
For nonlinear least squares: Solver
Dr. Do Quang Khanh 13
HCMUT
Nonlinear leastsquares
Minimize sum of squared deviation
(residual)
Use Excels Solver
Example: Hubbard curve (Egypt)
( )
2
) (
:
i i
x f y
function Objective
Dr. Do Quang Khanh 14
HCMUT
Hubbert Model
Hubbert curve:
Derivative of the logistics curve
Production rate (q) vs. time
 
2
) (
) (
) (
2
2
2
1
:
,
1
: Pr
: var
,
0 / ;
o
o
o
o o
t t a
o
t t a
o
o
o
o
t t a
o
t
t
Q
Q
e N
e aN
Q
dt
dQ
q
time to respect with Q ting Differntia
Q
Q Q
N where
e N
Q
Q
oduction e Cummulativ
dt a
Q
Q
Q
dQ
iables Separating
Q
Q
a
aQ
dt
dQ
Q
a
b Then
dt dQ Q Q When
bQ aQ
dt
dQ
+
= =
=
+
=
=


.

\

+ =
=
= =
+ =
Logistics curve
Cumulative production (Q) Vs. time
Dr. Do Quang Khanh 15
HCMUT
Minimize objective
function
Change variables
HCMUT
HCMUT
Weighting Factors
Account for the importance of each data
point by using a weighting factor, w
i
( )
2
) (
:
i i i
x f y w
function Objective
Dr. Do Quang Khanh
18
HCMUT
Straightline: formation volume factor model 1
Given: p
b
= 2012 psi, bubble point pressure
Data (observed):
P, psi B
o
, resBBL/STB
1500 1.262
1600 1.279
1800 1.298
Determine the parameters of the nonlinear model
describing the B
o
:
What is the best estimate of the Bo at the bubble point?
Dr. Do Quang Khanh 20
ASSIGNMENTS, TEST PROBLEMS
HCMUT
Straightline: formation volume factor model 2
Consider the following model of Formation Volume Factor,
B
o
as a function of pressure, p: B
o
= ae
b
(pp
b
)
where B
o
is in resBBL/STB, p in psi, and p
b
is the known
bubble point press.(p
b
= 3007 psi). The model paras. a &
b are to be find. The following lab. data are available:
P, psi B
o
, resBBL/STB
500 1.070
1500 1.175
2500 1.301
Determine the Formation Volume Factor at the bubble
point (pb) using the above model.
Dr. Do Quang Khanh 21
ASSIGNMENTS, TEST PROBLEMS
HCMUT
Straightline: Gas in place
Production and static (field) pressure data for a gas field
is given below. (Craft and Hawkins)
Dr. Do Quang Khanh 22
ASSIGNMENTS, TEST PROBLEMS
HCMUT
Straightline: FlowAfterFlow Test (IPR)
A frequently used IPR equation:
Find the Absolute Open Flow Potential.
Hint: fill out the following table first.
Dr. Do Quang Khanh 23
ASSIGNMENTS, TEST PROBLEMS
HCMUT
Nonlinear least squares: oil viscosity as a
function of pressure and temperature
Consider the following model of oil viscosity (
o
) for a
certain field as a function of pore pressure, p and layer
temperature T:
The model parameters a, b & c are to be determined by
the method of nonlinear least squares using a general
purpose minimization program (e.g, Solver).
The available data are:
Program to calculate the obj. function to be minimized.
Dr. Do Quang Khanh 24
ASSIGNMENTS, TEST PROBLEMS