I am currently working with fitting decline curves to real-world production data. I have had good luck with creating a hyperbolic and using curve_fit
from scipy.optimize
. The current function I use:
def hyp_func(x,qi,b,di):
return qi*(1.0-b*di*x)**(-1.0/b)
What I would like to do now, is at a certain rate of decline, transition to an exponential function. How would i go about this and still be able to use in curve_fit (I think below works)? I am trying the code below, is this the way to do it? or is there a better way?
def hyp_func2(x,qi,b,di):
dlim = -0.003
hy = qi*(1.0-b*di*x)**(-1.0/b)
hdy = di/(1.0-b*di*x)
ex = x[hdy>dlim]
qlim = qi*(dlim/di)**(1/b)
xlim = ((qi/qlim)**b-1)/(b*-di)
ey = qlim*np.exp(dlim*(ex-xlim))
y = np.concatenate((hy[hdy<dlim],ey))
return y
hy
is the hyperbolic equation
hdy
is the hy derivative
ex
is the part of x after derivative hits dlim
ey
is the exponential equation
I am still working out the equations, I am not getting a continuous function.
edit: data here, and updated equations