Upload
tuanbv93qng
View
26
Download
1
Embed Size (px)
Citation preview
Ho Chi Minh City University of Technology Faculty of Geology & Petroleum Engineering
Modeling & Simulation Division
Presenter: Dr. Do Quang Khanh Email: [email protected] Website: www.hcmut.edu.vn
CURVE FITTING (REGRESSION)
HCMUT
Least Squares
Sum of Squares as a measure of “how good the fit is”. (Other possible measures: Sum of Abs Deviations)
Other requirements: Smoothness, Least number of parameters, Extrapolating power, etc.
Two basic cases Model is based on “first principles” Model is just a convenient vehicle
Dr. Do Quang Khanh 3
HCMUT
Least Squares and its Num. Aspects
Two parameters or more to find? If two parameters Is it in straight line form?
• “Linear regression” Or can we transform it into straight line form?
• “Pseudo-linear regression:” Transformation to straight-line form
More than two parameters (linear):
Generalized least squares Nonlinear least squares: Gauss-Newton-
Marquardt Dr. Do Quang Khanh 4
HCMUT
)]([)]([)]([ 233
222
211 bmxybmxybmxyQMinimize +−++−++−=
)]([2)]([2)]([20 332211 bmxybmxybmxybQ
+−−+−−+−−=∂∂
=
Fitting the straight line (y = mx + b) to three points; Degrees of freedom: 1 );(
);();(
33
22
11
yxyxyx
)]([2)]([2)]([20 333222111 bmxyxbmxyxbmxyxmQ
+−−+−−+−−=∂∂
=
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)()( 321321 xxxmyyyb ++−++
=
2321
23
22
21
321321332211
)()(3))(()(3
xxxxxxyyyxxxyxyxyxm
++−++++++−++
=
33221132123
22
21 )()( yxyxyxxxxbxxxm ++=+++++
321321 3)( yyybxxxm ++=+++
Multiply by 3 and by (x1+x2+x3), subtract, get m, then get b
Dr. Do Quang Khanh 6
HCMUT
Formulas for m & b, & programming
HW: Programming using arrays
2
11
2
111
−
−
=
∑∑
∑∑∑
==
===
n
ii
n
ii
n
ii
n
ii
n
iii
xxn
yxyxnm
n
xmyb
n
ii
n
ii
−
=∑∑== 11
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
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
Flow-After-Flow Test of a Gas Well
Material Balance of Volumetric Dry-Gas Reservoir
n
wf
pp
−=
2
max 1
−+=
2
max 1lnlnlnp
pnqq wf
pi
i
i
i GGzp
zp
zp
−=
−=
GG
zzpp p
i
i 1
Dr. Do Quang Khanh 10
HCMUT
Flow-After-Flow Test of a Gas Well: the Cast
Real World Straight Line World
−+=
2
max 1logloglogp
pnqq wf
nq
pp
q
wf
max
2
log
1log
log
−
mbxy
xmby ×+=
n
wf
pp
−=
2
max 1
intercept
slope
Independent variable
dependent variable
Dr. Do Quang Khanh 11
HCMUT
Mat. Balance of Vol. Dry-Gas Res.: The Cast
Real World Straight Line World
( )ii
ii
p
Gzpzp
Gzp
//
/
mbxy
pi
i
i
i GGz
pzp
zp
−= xmby ×+=
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 least-squares
Minimize sum of squared deviation (residual)
Use Excel’s “Solver” Example: Hubbard curve (Egypt)
( )∑ − 2)(
:
ii xfy
functionObjective
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
oo
ttao
ttao
o
oo
ttao
t
t
Q
Q
eNeaNQ
dtdQq
timetorespectwithQtingDifferntiaQ
QQNwhere
eNQQ
oductioneCummulativ
dta
QQQ
dQ
iablesSeparating
aaQdtdQ
QabThen
dtdQQQWhen
bQaQdtdQ
−−
−−
∞
∞
−−∞
∞
∞
∞
∞
+==
−=
+=
=
−
−+=
−=
==
+=
∫∫
• Logistics curve -Cumulative production (Q) Vs. time
Dr. Do Quang Khanh 15
HCMUT
Weighting Factors
Account for the importance of each data point by using a weighting factor, wi
( )∑ − 2)(
:
iii xfyw
functionObjective
Dr. Do Quang Khanh 18
HCMUT
Straight-line: formation volume factor model 1 Given: pb = 2012 psi, bubble point pressure Data (observed): P, psi Bo, resBBL/STB 1500 1.262 1600 1.279 1800 1.298 Determine the parameters of the nonlinear model describing the Bo: What is the best estimate of the Bo at the bubble point?
Dr. Do Quang Khanh 20
ASSIGNMENTS, TEST PROBLEMS
HCMUT
Straight-line: formation volume factor model 2 Consider the following model of Formation Volume Factor, Bo as a function of pressure, p: Bo = aeb(p−pb) where Bo is in resBBL/STB, p in psi, and pb is the known bubble point press.(pb = 3007 psi). The model paras. a & b are to be find. The following lab. data are available: P, psi Bo, 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
Straight-line: 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
Straight-line: Flow-After-Flow 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