Ejemplo n.º 1
0
    def __calc_pipe__(self, pipe_object, option_last_calc_boolean=False):
        """
        Расчет трубы (НКТ или ОК) в текущей точке всех параметров, сохранение их в атрибуты класса и в хранилище
        data_workflow - self.data, а после вычисление параметров в следующей точке.

        :param pipe_object: экзмепляр класс Pipe - НКТ или ОК
        :param option_last_calc_boolean: опция последнего расчета - не вычисляются параметры в следующей точке
        :return: None
        """
        pipe_object.t_earth_init_c = self.t_calculated_earth_init
        pipe_object.angle_to_horizontal_grad = self.well_profile.get_angle_to_horizontal_grad(
            self.h_calculated_mes_m)

        self.p_grad_calculated_barm = uc.Pa2bar(
            pipe_object.calc_p_grad_pam(self.p_calculated_bar,
                                        self.t_calculated_c))
        self.t_grad_calculated_cm = pipe_object.calc_t_grad_cm(
            self.p_calculated_bar, self.t_calculated_c)

        self.data.get_data(self)
        if not option_last_calc_boolean:
            self.step_lenth_calculated_along_vert_m = np.abs(
                self.well_profile.get_h_vert_m(
                    self.h_calculated_mes_m -
                    self.step_lenth_in_calc_along_wellbore_m) -
                self.well_profile.get_h_vert_m(self.h_calculated_mes_m))
            self.p_calculated_bar -= self.p_grad_calculated_barm * self.step_lenth_in_calc_along_wellbore_m
            self.t_calculated_c -= self.t_grad_calculated_cm * self.step_lenth_in_calc_along_wellbore_m
            self.h_calculated_mes_m -= self.step_lenth_in_calc_along_wellbore_m
            self.h_calculated_vert_m = self.well_profile.get_h_vert_m(
                self.h_calculated_mes_m)
            self.t_calculated_earth_init -= self.geothermal_grad_cm * self.step_lenth_calculated_along_vert_m
Ejemplo n.º 2
0
    def test_6(self):
        p0_bar = 50
        t0_C = 20
        pipe = HE2_WaterPipeSegment()
        pipe.inner_diam_m = 0.05
        pipe.roughness_m = 1e-5
        pipe.L_m = 100

        pipe.uphill_m = 0
        x_kgs = 10
        p_fwd_0, t = pipe.calc_segment_pressure_drop(p0_bar, t0_C, x_kgs, 1)

        pipe.uphill_m = -10
        x_kgs = 10
        p_fwd_downhill, t = pipe.calc_segment_pressure_drop(
            p0_bar, t0_C, x_kgs, 1)

        pipe.uphill_m = 10
        x_kgs = 10
        p_fwd_uphill, t = pipe.calc_segment_pressure_drop(
            p0_bar, t0_C, x_kgs, 1)

        pipe.uphill_m = 0
        x_kgs = -10
        p_back_0, t = pipe.calc_segment_pressure_drop(p0_bar, t0_C, x_kgs, 1)

        pipe.uphill_m = -10
        x_kgs = -10
        p_back_downhill, t = pipe.calc_segment_pressure_drop(
            p0_bar, t0_C, x_kgs, 1)

        pipe.uphill_m = 10
        x_kgs = -10
        p_back_uphill, t = pipe.calc_segment_pressure_drop(
            p0_bar, t0_C, x_kgs, 1)

        p10m_bar = uc.Pa2bar(9.81 * 10 * 1000)
        self.assertAlmostEqual(p_fwd_downhill, p_fwd_0 + p10m_bar, 3)
        self.assertAlmostEqual(p_fwd_uphill, p_fwd_0 - p10m_bar, 3)

        self.assertAlmostEqual(p_back_downhill, p_back_0 + p10m_bar, 3)
        self.assertAlmostEqual(p_back_uphill, p_back_0 - p10m_bar, 3)

        self.assertAlmostEqual(p_back_0 + p_fwd_0, 2 * p0_bar, 3)
        self.assertAlmostEqual(p_back_downhill + p_fwd_uphill, 2 * p0_bar, 3)
        self.assertAlmostEqual(p_back_uphill + p_fwd_downhill, 2 * p0_bar, 3)
Ejemplo n.º 3
0
    def __calc_dvdp_msecpam__(self):
        """
        Рассчитывается производная скорости смеси (без проскальзывания - vm) по давлению

        Необходимо в дальнейшем для определения градиента скорости смеси
        :return: dv/dp
        """

        delta_p_bar = uc.Pa2bar(10)
        p2_bar = self.p_bar + delta_p_bar
        p1_bar = self.p_bar - delta_p_bar
        self.__calc_velosities__(p2_bar, self.t_c)
        v2_msec = self.vm_msec
        self.__calc_velosities__(p1_bar, self.t_c)
        v1_msec = self.vm_msec

        self.__calc_velosities__(self.p_bar, self.t_c)
        return (v2_msec - v1_msec) / 2 / uc.bar2Pa(delta_p_bar)
Ejemplo n.º 4
0
 def calc_segment_pressure_drop(self,
                                P_bar,
                                T_C,
                                X_kgsec,
                                calc_direction,
                                unifloc_direction=-1):
     P_fric_grad_Pam = self.calc_P_friction_gradient_Pam(
         P_bar, T_C, abs(X_kgsec))
     dP_fric_Pa = P_fric_grad_Pam * self.L_m
     Rho_kgm3 = self.fluid.rho_wat_kgm3
     dP_gravity_Pa = Rho_kgm3 * uc.g * self.uphill_m
     grav_sign, fric_sign, t_sign = self.decode_direction(
         X_kgsec, calc_direction, unifloc_direction)
     P_drop_bar = uc.Pa2bar(grav_sign * dP_gravity_Pa +
                            fric_sign * dP_fric_Pa)
     P_rez_bar = P_bar - P_drop_bar
     T_grad_Cm = self.calc_T_gradient_Cm(P_bar, T_C, X_kgsec)
     T_rez_C = T_C - t_sign * T_grad_Cm * self.L_m
     return P_rez_bar, T_rez_C
Ejemplo n.º 5
0
    def BB_gradient(l_array, t_array):

        fl = PVT.FluidMcCain(gamma_oil, gamma_gas, gamma_wat, rsb_m3m3,
                             gamma_gassp, y_h2s, y_co2, y_n2, s_ppm, par_wat,
                             pbcal_bar, tpb_C, bobcal_m3m3, muobcal_cP)
        fl.calc(p1, t_array)
        q_liq = (q_oil_m3d * fl.b_oil_m3m3 + q_water_m3d * fl.b_wat_m3m3)
        q_gas = ((q_gas_m3d - fl.rs_m3m3 * q_oil_m3d) * fl.b_gas_m3m3)
        vel_gas_super_ms = q_gas / (86400 * uc.pi * d_m**2 / 4)
        vel_liq_super_ms = q_liq / (86400 * uc.pi * d_m**2 / 4)
        rho_liq_kgm3 = ((fl.rho_oil_kgm3 + fl.rs_m3m3 * fl.rho_gas_kgm3) / fl.b_oil_m3m3) * (1 - wct) + \
                       fl.rho_wat_kgm3 / fl.b_wat_m3m3 * wct
        rho_gas_kgm3 = fl.rho_gas_kgm3
        mu_liq_cP = fl.mu_oil_cp * (1 - wct) + fl.mu_wat_cp * wct
        mu_gas_cP = fl.mu_gas_cp
        dpdl = uc.Pa2bar(
            unf_BeggsBrill_gradient(vel_gas_super_ms, vel_liq_super_ms,
                                    rho_liq_kgm3, rho_gas_kgm3, mu_liq_cP,
                                    mu_gas_cP, d_m, sigma_liq_Nm, theta, e,
                                    rough_pipe))
        return dpdl
Ejemplo n.º 6
0
    def calc(self, p_bar, t_c):
        self.p_intake_bar = p_bar
        self.t_intake_bar = t_c

        self.p_bar = p_bar
        self.t_c = t_c

        self.power_fluid_stage_wt = 0
        self.power_fluid_total_wt = 0
        self.power_ESP_stage_wt = 0
        self.power_ESP_total_wt = 0
        self.dt_stage_c = 0
        self.dt_total_c = 0
        self.dp_stage_bar = 0
        self.dp_total_bar = 0
        self.stage_head_m = 0
        self.ESP_head_total_m = 0

        self.esp_calc_data.clear_data()
        self.fluid_flow_calc_data.clear_data()
        self.fluid_calc_data.clear_data()

        for i in range(self.stage_number):
            self.fluid.calc(self.p_bar, self.t_c)
            self.fluid_flow.calc(self.p_bar, self.t_c)

            self.gas_fraction_d = (
                self.fluid_flow.qgas_m3day * (1 - self.k_sep_total_d) /
                (self.fluid_flow.qliq_m3day + self.fluid_flow.qgas_m3day *
                 (1 - self.k_sep_total_d)))

            self.q_mix_m3day = self.fluid_flow.qliq_m3day + self.fluid_flow.qgas_m3day * (
                1 - self.k_sep_total_d)
            self.q_mix_degr_m3day = self.q_mix_m3day * (
                1 + self.k_rate_degradation_d)
            self.mu_mix_cP = self.fluid_flow.mu_liq_cP * (1 - self.gas_fraction_d) + \
                             self.fluid_flow.fl.mu_gas_cP * self.gas_fraction_d
            self.rho_mix_kgm3 = self.fluid_flow.rho_liq_kgm3 * (1 - self.gas_fraction_d) + \
                                self.fluid_flow.fl.rho_gas_kgm3 * self.gas_fraction_d
            self.stage_head_m = self.get_ESP_head_m(self.q_mix_degr_m3day,
                                                    self.stage_number_in_calc,
                                                    self.mu_mix_cP)
            self.ESP_head_total_m += self.stage_head_m
            self.dp_stage_bar = uc.Pa2bar(self.stage_head_m *
                                          self.rho_mix_kgm3 * uc.g)
            self.dp_total_bar += self.dp_stage_bar

            self.power_fluid_stage_wt = uc.m3day2m3sec(
                self.q_mix_degr_m3day) * uc.bar2Pa(self.dp_stage_bar)
            self.power_fluid_total_wt += self.power_fluid_stage_wt

            self.power_ESP_stage_wt = self.get_ESP_power_Wt(
                self.q_mix_degr_m3day, self.stage_number_in_calc,
                self.mu_mix_cP)
            self.power_ESP_total_wt += self.power_ESP_stage_wt

            if self.power_ESP_total_wt > 0:
                self.ESP_efficiency_total_d = self.power_fluid_total_wt / self.power_ESP_total_wt
            if self.power_ESP_stage_wt > 0:
                self.ESP_efficiency_stage_d = self.power_fluid_stage_wt / self.power_ESP_stage_wt

            if self.ESP_efficiency_stage_d > 0:
                self.dt_stage_c = (uc.g * self.stage_head_m /
                                   self.fluid_flow.heatcapn_jkgc *
                                   (1 - self.ESP_efficiency_stage_d) /
                                   self.ESP_efficiency_stage_d)

            self.dt_total_c += self.dt_stage_c

            if self.save_calculated_data:
                self.esp_calc_data.save_data_from_class_to_storage(self)
                self.fluid_flow_calc_data.save_data_from_class_to_storage(
                    self.fluid_flow)
                self.fluid_calc_data.save_data_from_class_to_storage(
                    self.fluid)

            self.p_bar += self.dp_stage_bar
            self.t_c += self.dt_stage_c
Ejemplo n.º 7
0
def pressure_drop_BeggsBrill(l,
                             p1,
                             t1,
                             t2,
                             d_m,
                             q_liq_m3d,
                             sigma_liq_Nm,
                             theta,
                             e,
                             wct,
                             rough_pipe=0,
                             gamma_oil=0.86,
                             gamma_gas=0.6,
                             gamma_wat=1.0,
                             rsb_m3m3=200.0,
                             gamma_gassp=0,
                             y_h2s=0,
                             y_co2=0,
                             y_n2=0,
                             s_ppm=0,
                             par_wat=0,
                             pbcal_bar=-1.,
                             tpb_C=80,
                             bobcal_m3m3=1.2,
                             muobcal_cP=0.5):
    """
    Расчет кривой распределения давления по Беггсу-Бриллу

    :param l:
    :param p1:
    :param t1:
    :param t2:
    :param d_m:
    :param q_liq_m3d:
    :param sigma_liq_Nm:
    :param theta:
    :param e:
    :param wct:
    :param rough_pipe:
    :param gamma_oil:
    :param gamma_gas:
    :param gamma_wat:
    :param rsb_m3m3:
    :param gamma_gassp:
    :param y_h2s:
    :param y_co2:
    :param y_n2:
    :param s_ppm:
    :param par_wat:
    :param pbcal_bar:
    :param tpb_C:
    :param bobcal_m3m3:
    :param muobcal_cP:
    :return:
    """
    p_calc = p1
    p_pvt = 0
    t_calc = t1
    step = 20
    delta_l = l / (step - 1)
    delta_t = (t2 - t1) / (step - 1)
    maxiter = 5
    l_calc = 0
    q_oil_m3d = q_liq_m3d * (1 - wct)
    q_gas_m3d = q_oil_m3d * rsb_m3m3
    q_water_m3d = q_liq_m3d * wct
    p_array = [p_calc]
    l_array = [l_calc]
    while l_calc < l:
        delta_p = 0
        counter = 0
        while abs(p_pvt - (p_calc + 0.5 * delta_p)) > 0.5 or counter > maxiter:
            p_pvt = p_calc + 0.5 * delta_p
            t_pvt = t_calc + 0.5 * delta_t
            fl = PVT.FluidMcCain(gamma_oil, gamma_gas, gamma_wat, rsb_m3m3,
                                 gamma_gassp, y_h2s, y_co2, y_n2, s_ppm,
                                 par_wat, pbcal_bar, tpb_C, bobcal_m3m3,
                                 muobcal_cP)
            fl.calc(p_pvt, t_pvt)
            q_liq = (q_oil_m3d * fl.b_oil_m3m3 + q_water_m3d * fl.b_wat_m3m3)
            q_gas = ((q_gas_m3d - fl.rs_m3m3 * q_oil_m3d) * fl.b_gas_m3m3)
            vel_gas_super_ms = q_gas / (86400 * uc.pi * d_m**2 / 4)
            vel_liq_super_ms = q_liq / (86400 * uc.pi * d_m**2 / 4)
            rho_liq_kgm3 = ((fl.rho_oil_kgm3 + fl.rs_m3m3 * fl.rho_gas_kgm3) / fl.b_oil_m3m3) * (1 - wct) + \
                           fl.rho_wat_kgm3 / fl.b_wat_m3m3 * wct
            rho_gas_kgm3 = fl.rho_gas_kgm3
            mu_liq_cP = fl.mu_oil_cp * (1 - wct) + fl.mu_wat_cp * wct
            mu_gas_cP = fl.mu_gas_cp
            dpdl = uc.Pa2bar(
                unf_BeggsBrill_gradient(vel_gas_super_ms, vel_liq_super_ms,
                                        rho_liq_kgm3, rho_gas_kgm3, mu_liq_cP,
                                        mu_gas_cP, d_m, sigma_liq_Nm, theta, e,
                                        rough_pipe))
            delta_p = dpdl * delta_l
            counter += 1
        l_calc += delta_l
        l_array.append(l_calc)
        p_calc += delta_p
        p_array.append(p_calc)
        t_calc += delta_t
    return l_array, p_array
Ejemplo n.º 8
0
    def __calc_pipe__(self, pipe_object, option_last_calc_boolean=False):
        """
        Расчет трубы (НКТ или ОК) в текущей точке всех параметров, сохранение их в атрибуты класса и в хранилище
        data_workflow - self.data, а после вычисление параметров в следующей точке.

        :param pipe_object: экзмепляр класс Pipe - НКТ или ОК
        :param option_last_calc_boolean: опция последнего расчета - не вычисляются параметры в следующей точке
        :return: None
        """
        #print(f"В начале расчета\n"
        #      f"Давление: {self.p_calculated_bar} и температура {self.t_calculated_c} "
        #      f"на измеренной глубине {self.h_calculated_mes_m}"
        #      f"\n")
        start_calculation_time = time.time()
        if self.direction_up:
            sign = 1
        else:
            sign = -1
        pipe_object.t_earth_init_c = self.t_calculated_earth_init
        pipe_object.angle_to_horizontal_grad = self.well_profile.get_angle_to_horizontal_grad(
            self.h_calculated_mes_m)

        self.p_grad_calculated_barm = uc.Pa2bar(
            pipe_object.calc_p_grad_pam(self.p_calculated_bar,
                                        self.t_calculated_c))
        self.t_grad_calculated_cm = pipe_object.calc_t_grad_cm(
            self.p_calculated_bar, self.t_calculated_c)
        if self.save_all:
            self.data.get_data(self)
        if not option_last_calc_boolean:
            self.step_lenth_calculated_along_vert_m = np.abs(
                self.well_profile.get_h_vert_m(
                    self.h_calculated_mes_m -
                    self.step_lenth_in_calc_along_wellbore_m) -
                self.well_profile.get_h_vert_m(self.h_calculated_mes_m))

            if self.solver_using == 1:
                new_p_calculated_bar_solve_output = solve_ivp(
                    self.calc_p_grad_pam_for_scipy,
                    t_span=(self.h_calculated_mes_m, self.h_calculated_mes_m -
                            self.step_lenth_in_calc_along_wellbore_m * sign),
                    y0=[self.p_calculated_bar],
                    args=(self.t_calculated_c, pipe_object),
                    rtol=0.001,
                    atol=0.001
                )  #на всем участке постоянная температура, что неверно
                #print(new_p_calculated_bar_solve_output)
                #print('\n')
                new_p_calculated_bar = new_p_calculated_bar_solve_output.y[-1][
                    -1]
                #print(f"new_p_calculated_bar = {new_p_calculated_bar}")
                self.p_calculated_bar = new_p_calculated_bar
                self.calculation_number_in_one_step = new_p_calculated_bar_solve_output.nfev
            else:
                self.p_calculated_bar -= self.p_grad_calculated_barm * self.step_lenth_in_calc_along_wellbore_m * sign
                self.calculation_number_in_one_step = 1
            #if self.p_calculated_bar < 1:
            #    self.p_calculated_bar = 1
            self.t_calculated_c -= self.t_grad_calculated_cm * self.step_lenth_in_calc_along_wellbore_m * sign
            self.h_calculated_mes_m -= self.step_lenth_in_calc_along_wellbore_m * sign
            self.h_calculated_vert_m = self.well_profile.get_h_vert_m(
                self.h_calculated_mes_m)
            self.t_calculated_earth_init -= self.geothermal_grad_cm * self.step_lenth_calculated_along_vert_m * sign
            #print(f"Давление: {self.p_calculated_bar} и температура {self.t_calculated_c} "
            #      f"на измеренной глубине {self.h_calculated_mes_m}")
            if self.p_calculated_bar < 1.1:
                self.p_calculated_bar = 1.1

        self.time_calculated_sec = time.time() - start_calculation_time
Ejemplo n.º 9
0
 def calc_p_grad_pam_for_scipy(self, h_m, p_bar, t_c, pipe_object):
     p_bar = float(p_bar)
     t_c = float(t_c)
     p_grad_pam = pipe_object.calc_p_grad_pam(p_bar, t_c)
     return uc.Pa2bar(p_grad_pam)