def __init__(self, fluid=PVT.FluidStanding(), hydr_cor=hydr_cor_BB.Beggs_Brill_cor(), temp_cor=temp_cor_HK.Hasan_Kabir_cor()): """ Инизицализация подъемника газожидкостной смеси :param fluid: модель флюида, класс :param hydr_cor: гидравлическая корреляция, класс :param temp_cor: температурная корреляция, класс """ self.fluid_flow = PVT.FluidFlow(fluid = fluid) self.hydr_cor = hydr_cor self.temp_cor = temp_cor self.section_casing = False # если True, будет считать ОК self.time_sec = 100 * 24 * 60 * 60 self.t_earth_init_c = 45 self.angle_to_horizontal_grad = 90 self.p_bar = None self.t_c = None self.p_grad_pam = None self.t_grad_cm = None
def test_FluidFlow(self): pressure_bar = 100 temp_c = 80 fluid_flow = PVT_fluids.FluidFlow() fluid_flow.calc(pressure_bar, temp_c) sum = 0 for i in fluid_flow.__dict__.items(): if type(i[-1]) != type(PVT_fluids.FluidStanding()): sum += i[-1] self.assertAlmostEqual(sum, 52964.45783497338, delta=0.0001)
def test_FluidMcCain(self): pressure_bar = 100 temp_c = 80 fluid = PVT_fluids.FluidMcCain() fluid.calc(pressure_bar, temp_c) sum = 0 for i in fluid.__dict__.items(): sum += i[-1] self.assertAlmostEqual(sum, 2622.8782700132388, delta=0.0001) # TODO cлишком большая разница со Стендингом, проверить (плотность и др.)
def test_FluidStanding(self): pressure_bar = 100 temp_c = 80 fluid = PVT_fluids.FluidStanding() fluid.calc(pressure_bar, temp_c) sum = 0 for i in fluid.__dict__.items(): sum += i[-1] self.assertAlmostEqual(sum, 11690.655158519261, delta=0.0001)
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
def test_calc_depletion_above_and_below_pb(self): p_res_init_bar = 250 t_res_init_c = 80 r_drainage_m = 250 porosity_d = 0.25 q_oil_surf_m3day = 50 h_eff_res_m = 8 c_system_1bar = 7.5 * 10**(-5) t_end_year = 1 t_step_days = 30.33 S_wat_connate_d = 0.25 fluid = PVT.FluidStanding() fluid.pbcal_bar = 100 fluid.rsb_m3m3 = 100 fluid.calc(p_res_init_bar, t_res_init_c) STOIIP_by_VOL_m3 = uc.pi * r_drainage_m**2 * h_eff_res_m * porosity_d * ( 1 - S_wat_connate_d) / fluid.b_oil_m3m3 N_cum_oil_recovery_m3 = q_oil_surf_m3day * t_step_days * 45 MB = MatBalance.MatBalance() MB.fluid = fluid MB.rp_m3m3 = MB.fluid.rs_m3m3 MB.STOIIP_by_VOL_m3 = STOIIP_by_VOL_m3 c_wat_1bar = 4.35 * 10**(-5) c_res_1bar = 7.25 * 10**(-5) MB.c_wat_1bar = c_wat_1bar MB.c_res_1bar = c_res_1bar MB.t_reservoir_init_c = t_res_init_c MB.p_reservoir_init_bar = p_res_init_bar MB.S_wat_connate_d = S_wat_connate_d MB.calc_depletion_above_and_below_pb(N_cum_oil_recovery_m3) self.assertAlmostEqual(MB.p_reservoir_bar, 51.77749, delta=0.00001)
def __init__(self, ESP_structure, MultiPhaseFlow=PVT_fluids.FluidFlow(), fluid=PVT_fluids.FluidStanding()): self.stage_number = ESP_structure.stage_number self.power_ESP_nom_kwt = ESP_structure.power_ESP_nom_kwt self.freq_hz = ESP_structure.freq_hz self.freq_nom_hz = ESP_structure.freq_nom_hz self.q_max_ESP_nom_m3day = ESP_structure.q_max_ESP_nom_m3day self.q_ESP_nom_m3day = ESP_structure.q_ESP_nom_m3day self.esp_calc_data = data_workflow.Data() self.fluid_flow_calc_data = data_workflow.Data() self.fluid_calc_data = data_workflow.Data() self.save_calculated_data = True self.polynom_esp_head_wt = None self.polynom_esp_efficiency_d = None self.polynom_esp_power_wt = None self.stage_height_m = 0.05 self.ESP_lenth = None self.k_sep_total_d = 0.9 self.fluid_flow = MultiPhaseFlow self.fluid = fluid self.option_correct_viscosity = False self.k_rate_degradation_d = 0 self.k_pressure_degradation_d = 0 self.stage_number_in_calc = 1 self.p_intake_bar = None self.t_intake_bar = None self.power_fluid_stage_wt = None self.power_fluid_total_wt = None self.power_ESP_stage_wt = None self.power_ESP_total_wt = None self.dt_stage_c = None self.dt_total_c = None self.dp_stage_bar = None self.dp_total_bar = None self.p_bar = None self.t_c = None self.ESP_efficiency_total_d = None self.ESP_efficiency_stage_d = None self.gas_fraction_d = None self.q_mix_m3day = None self.q_mix_degr_m3day = None self.stage_head_m = None self.ESP_head_total_m = None self.mu_mix_cP = None self.rho_mix_kgm3 = None self.mu_mix_cSt = None self.q_max_ESP_m3day = None self.check = -1
blackoil_option = BlackOil_model.BlackOil_option() blackoil_option.b_wat_cor_number = 1 blackoil_option.mu_wat_cor_number = 1 blackoil_option.rho_wat_cor_number = 1 blackoil_option.z_cor_number = 1 blackoil_option.pseudocritical_temperature_cor_number = 1 blackoil_option.pseudocritical_pressure_cor_number = 1 blackoil_option.rho_gas_cor_number = 1 blackoil_option.b_gas_cor_number = 1 - 1 blackoil_option.mu_dead_oil_cor_number = 2 blackoil_option.sigma_oil_gas_cor_number = 2 blackoil_option.sigma_wat_gas_cor_number = 1 python_fluid = BlackOil_model.Fluid(**keywords_python, option=blackoil_option) multiphase_flow = PVT_fluids.FluidFlow(python_fluid) multiphase_flow.qliq_on_surface_m3day = q_liq_sm3day multiphase_flow.fw_on_surface_perc = watercut_perc python_flow_model_db = data_workflow.Data() python_flow_model_db.clear_data() vba_result_df = None for p_bar in range(1, 400, 10): multiphase_flow.calc(p_bar, t_c) p_atm = uc.bar2atm(p_bar) python_flow_model_db.get_data(multiphase_flow, object_name='python_flow_model') vba_result = uniflocvba.MF_all_mf(p_atma=p_atm, **keywords_vba) this_vba_result_df = create_result_df_from_vba_output( vba_result, p_bar, t_c) try:
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
def __init__(self, fluid=0, well_profile=0, hydr_corr=0, temp_corr=0, pipe=0, reservoir=-1, gamma_oil=0.86, gamma_gas=0.6, gamma_wat=1.0, rsb_m3m3=200.0, h_conductor_mes_m=500, h_conductor_vert_m=500, h_intake_mes_m=1000, h_intake_vert_m=1000, h_bottomhole_mes_m=1500, h_bottomhole_vert_m=1500, d_casing_inner_m=0.120, d_tube_inner_m=0.062, qliq_on_surface_m3day=100, fw_on_surface_perc=10, p_bottomhole_bar=200, t_bottomhole_c=92, p_wellhead_bar=20, t_wellhead_c=20, t_earth_init_on_surface_c=3, t_earth_init_in_reservoir_c=90, geothermal_grad_cm=0.03, p_reservoir_bar=None, well_work_time_sec=60 * 24 * 60 * 60, step_lenth_in_calc_along_wellbore_m=10, without_annulus_space=False, save_all=True, solver_using=0, activate_rus_mode=0, multiplier_for_pi=1, pb_bar=90): """ При создании модели скважины необходимо задать ее конструкцию, PVT свойства флюидов и режим работы вместе с граничными условиями. Кроме параметров, которые предлагается задать при инициализации, можно изменить и другие, входящие в состав модели, путем обращения к необходимым модулям. На что стоит обрать внимание: некоторые параметры выставлены по умолчанию и изменение всех интересующих параметров необходимо выполнить до процесса расчета. :param h_conductor_mes_m: измеренная глубина конца кондуктора, м :param h_conductor_vert_m: вертикальная глубина конца кондуктора, м :param h_intake_mes_m: измеренная глубина конца колонны НКТ (спуска НКТ), м :param h_intake_vert_m: вертикальная глубина конца колонны НКТ (спуска НКТ), м :param h_bottomhole_mes_m: измеренная глубина забоя, м :param h_bottomhole_vert_m: вертикальная глубина забоя, м :param qliq_on_surface_m3day: дебит жидкости на поверхности, м3/сутки :param fw_on_surface_perc: обводненность продукции на поверхности, % :param d_casing_inner_m: внутренний диаметр обсадной колонны, м :param d_tube_inner_m: внутренни диаметр НКТ :param p_bottomhole_bar: давление на забое, бар :param t_bottomhole_c: температура на забое, С :param p_wellhead_bar: давление на устье, бар :param t_wellhead_c: температура на устье, С :param t_earth_init_on_surface_c: начальная температура земли на поверхности (нейтрального слоя), С :param t_earth_init_in_reservoir_c: начальная температура пласта, С :param geothermal_grad_cm: геотермический градиент, С/м :param well_work_time_sec: время работы скважины, сек :param step_lenth_in_calc_along_wellbore_m: длина шага вдоль ствола скважины в расчете, м """ self.h_conductor_mes_m = h_conductor_mes_m self.h_conductor_vert_m = h_conductor_vert_m self.h_intake_mes_m = h_intake_mes_m self.h_intake_vert_m = h_intake_vert_m self.h_bottomhole_mes_m = h_bottomhole_mes_m self.h_bottomhole_vert_m = h_bottomhole_vert_m self.d_casing_inner_m = d_casing_inner_m self.d_tube_inner_m = d_tube_inner_m self.p_bottomhole_bar = p_bottomhole_bar self.t_bottomhole_c = t_bottomhole_c self.p_wellhead_bar = p_wellhead_bar self.t_wellhead_c = t_wellhead_c self.well_work_time_sec = well_work_time_sec self.step_lenth_in_calc_along_wellbore_m = step_lenth_in_calc_along_wellbore_m self.t_earth_init_on_surface_c = t_earth_init_on_surface_c self.t_earth_init_in_reservoir_c = t_earth_init_in_reservoir_c self.geothermal_grad_cm = geothermal_grad_cm self.p_reservoir_bar = p_reservoir_bar if well_profile == 0: self.well_profile = deviation_survey.simple_well_deviation_survey() elif well_profile == 1: self.well_profile = deviation_survey.well_deviation_survey() if pipe == 0: self.pipe = uPipe.Pipe() if hydr_corr == 0: self.pipe.hydr_cor = hydr_cor_Beggs_Brill.Beggs_Brill_cor() if temp_corr == 0: self.pipe.temp_cor = temp_cor_Hasan_Kabir.Hasan_Kabir_cor() elif temp_corr == 1: self.pipe.temp_cor = temp_cor_simple_line.SimpleLineCor() if fluid == 0: self.pipe.fluid_flow.fl = PVT_fluids.FluidStanding( gamma_oil=gamma_oil, gamma_gas=gamma_gas, gamma_wat=gamma_wat, rsb_m3m3=rsb_m3m3) elif fluid == 1: self.pipe.fluid_flow.fl = BlackOil_model.Fluid( gamma_oil=gamma_oil, gamma_gas=gamma_gas, gamma_wat=gamma_wat, rsb_m3m3=rsb_m3m3, t_res_c=t_bottomhole_c, pb_bar=pb_bar) if activate_rus_mode: self.pipe.fluid_flow.fl = BlackOil_model.Fluid( gamma_oil=gamma_oil, gamma_gas=gamma_gas, gamma_wat=gamma_wat, rsb_m3m3=rsb_m3m3, t_res_c=t_bottomhole_c, pb_bar=pb_bar, activate_rus_cor=1) self.data = data_workflow.Data() self.qliq_on_surface_m3day = qliq_on_surface_m3day self.fw_on_surface_perc = fw_on_surface_perc self.h_calculated_vert_m = None self.h_calculated_mes_m = None self.p_calculated_bar = None self.t_calculated_c = None self.t_calculated_earth_init = None self.t_grad_calculated_cm = None self.p_grad_calculated_barm = None self.without_annulus_space = without_annulus_space self.save_all = save_all if reservoir == -1: self.ipr = None elif reservoir == 0: self.ipr = IPR_simple_line.IPRSimpleLine() if self.p_reservoir_bar == None: self.p_reservoir_bar = 1000 * uc.g * self.h_bottomhole_vert_m / 100000 self.ipr.pi_m3daybar = self.ipr.calc_pi_m3daybar( self.qliq_on_surface_m3day, self.p_bottomhole_bar, self.p_reservoir_bar) self.direction_up = None self.solver_using = solver_using self.multiplier_for_pi = multiplier_for_pi self.time_calculated_sec = None self.calculation_number_in_one_step = None