[Python] Plots comparison to find parameters using scipy

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm solving a problem of finding parameters of a well using pressure type curves. By converting pressure P and time t to their dimensionless analogs P_D and t_D with selecting optimal parameters k, C_s using: Formulas and then comparing two plots, which must be the same shape, except values: Two plots I then compare values from each plot, finding parameters i need, using: Finding parameters The problem occurs when i try to use scipy.optimize tools, because they try to fit pressure and dimensionless pressure values (to the point they are equal), when i just need to overlay them.

    The results are wrong:

    def dimP(k,P):
    # dimensionless pressure
    P_D = (k * h) / (18.41 * q * B * μ) * P
    return P_D

    P_D=dimP(10,P) #10 for k because it has a dimension of 2
    popt, pcov = curve_fit(model1, P,P_D)
    k_opt = popt[0]


    I tried to compare tan of curves (because they should be equal), but again, no success:

    def dimensionless(t,P,k,C_s):
    P_D = (k * h) / (18.41 * q * B * μ) * P
    C_D = 0.159 * C_s / (h * φ * C_t * r_w ** 2)
    t_D = (0.00036 * k * t) / (φ * μ * C_t * r_w ** 2)
    return P_D/(t_D/C_D)

    tg_D=func2(P,t, 10,0.1) #0.1 for C_s because it has a dimension of -1

    popt,cov=curve_fit(func2,tg,tg_D)
    k=popt[1]
    C_s=popt[0]


    Are there any tools that could help me in my task? What am i doing wrong? ty

    Continue reading...

Compartilhe esta Página