コード例 #1
0
 def test_temp_production(self):
     t = ptp.temp(trajectory, 1)
     self.assertIsInstance(t.tft, list)
     self.assertIsInstance(t.tt, list)
     self.assertIsInstance(t.ta, list)
     self.assertIsInstance(t.tc, list)
     self.assertIsInstance(t.tsr, list)
     self.assertIsInstance(t.tfm, list)
コード例 #2
0
    def test_temp_behavior(self):
        t = 2

        # For Drilling
        st = ptd.temp(t, log=True).behavior()
        self.assertEqual(len(st.tbot), len(st.tout))
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tbot, list)
        self.assertIsInstance(st.tout, list)

        # For Production
        st = ptp.temp(t, log=True).behavior()
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tout, list)

        # For Injection
        st = pti.temp(t, log=True).behavior()
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tbot, list)
コード例 #3
0
def define_prod_plot():
    time = request.args.get("time")
    depth = request.args.get("depth")
    wd = request.args.get("wd")
    well_profile = request.args.get("well_profile")
    kop = request.args.get("kop")
    eob = request.args.get("eob")
    build_angle = request.args.get("build_angle")
    kop2 = request.args.get("kop2")
    eob2 = request.args.get("eob2")
    sod = request.args.get("sod")
    eod = request.args.get("eod")
    plot_type = request.args.get("plot_type")
    dt_tft = request.args.get("dt_tft")
    dt_ta = request.args.get("dt_ta")
    dt_tr = request.args.get("dt_tr")
    dt_tc = request.args.get("dt_tc")
    dt_tfm = request.args.get("dt_tfm")
    dt_tsr = request.args.get("dt_tsr")

    # TUBULAR
    n_casings = request.args.get("n_casings")
    dro = request.args.get("dro")
    dri = request.args.get("dri")
    dto = request.args.get("dto")
    dti = request.args.get("dti")

    # OPERATIONAL PARAMETERS
    q = request.args.get("q")

    # DENSITIES
    rhof = request.args.get("rhof")
    rhot = request.args.get("rhot")
    rhoc = request.args.get("rhoc")
    rhor = request.args.get("rhor")
    rhofm = request.args.get("rhofm")
    rhow = request.args.get("rhow")
    rhocem = request.args.get("rhocem")

    wtg = request.args.get("wtg")
    gt = request.args.get("gt")

    if time is None:
        time = 2
        depth = 3000
        wd = 150
        well_profile = "V"
        kop = 600
        eob = 1500
        build_angle = 40
        kop2 = 1800
        eob2 = 2300
        sod = 2000
        eod = 2600
        plot_type = 1
        dt_tft = True
        dt_ta = False
        dt_tr = False
        dt_tc = False
        dt_tfm = True
        dt_tsr = False
        n_casings = 0

        # TUBULAR
        casings_list = []
        dro = 21
        dri = 17.716
        dto = 4.5
        dti = 4

        # OPERATIONAL PARAMETERS
        q = 2000  # production rate, 2000 m3/d

        # DENSITIES
        rhof = 0.85  # production fluid density, sg
        rhot = 7.6
        rhoc = 7.8
        rhor = 7.8
        rhofm = 2.245
        rhow = 1.029
        rhocem = 2.7

        wtg = -0.005
        gt = 0.0238

    else:
        time = float(time)
        depth = float(depth)
        wd = float(wd)
        well_profile = str(well_profile)
        kop = float(kop)
        eob = float(eob)
        build_angle = int(build_angle)
        kop2 = float(kop2)
        eob2 = float(eob2)
        sod = float(sod)
        eod = float(eod)
        plot_type = int(plot_type)
        dt_tft = bool(dt_tft)
        dt_ta = bool(dt_ta)
        dt_tr = bool(dt_tr)
        dt_tc = bool(dt_tc)
        dt_tfm = bool(dt_tfm)
        dt_tsr = bool(dt_tsr)
        n_casings = int(n_casings)

        # TUBULAR
        casings_list = []
        for i in range(1, n_casings + 1):
            csg_dict = {
                "od": float(request.args.get("od" + str(i))),
                "id": float(request.args.get("id" + str(i))),
                "depth": float(request.args.get("depth" + str(i)))
            }
            casings_list.append(csg_dict)
        dro = float(dro)
        dri = float(dri)
        dto = float(dto)
        dti = float(dti)

        # OPERATIONAL PARAMETERS
        q = float(q)

        # DENSITIES
        rhof = float(rhof)
        rhot = float(rhot)
        rhoc = float(rhoc)
        rhor = float(rhor)
        rhofm = float(rhofm)
        rhow = float(rhow)
        rhocem = float(rhocem)

        wtg = float(wtg)
        gt = float(gt)

    inputs = {
        'time': time,
        'depth': depth,
        'wd': wd,
        'well_profile': well_profile,
        'kop': kop,
        'eob': eob,
        'build_angle': build_angle,
        'kop2': kop2,
        'eob2': eob2,
        'sod': sod,
        'eod': eod,
        'plot_type': plot_type,
        'n_casings': n_casings
    }

    # Others parameters: the ones which should be used for the attribute 'change_inputs'
    others = {
        'wd': wd,
        'q': q,
        'rhof': rhof,
        'rhot': rhot,
        'rhoc': rhoc,
        'rhor': rhor,
        'rhofm': rhofm,
        'rhow': rhow,
        'rhocem': rhocem,
        'dro': dro,
        'dri': dri,
        'dto': dto,
        'dti': dti,
        'wtg': wtg,
        'gt': gt
    }

    inputs.update(others)  # Merge 'others' into the 'inputs' dictionary

    error_raised = error_messages(
        inputs
    )  # Checking process for warning messages depending on the inputs

    if error_raised == 0:
        if plot_type != 5:
            temp = ptp.temp(time,
                            mdt=depth,
                            casings=casings_list,
                            profile=well_profile,
                            change_input=others,
                            build_angle=build_angle,
                            kop=kop,
                            eob=eob,
                            kop2=kop2,
                            eob2=eob2,
                            sod=sod,
                            eod=eod)

        if plot_type == 1:
            fig1 = create_figure1(temp)
        if plot_type == 4:
            fig1 = create_figure4(temp.behavior())
        if plot_type == 5:
            temp = ptp.temp(time,
                            mdt=depth,
                            log=True,
                            profile=well_profile,
                            change_input=others,
                            build_angle=build_angle,
                            kop=kop,
                            eob=eob,
                            kop2=kop2,
                            eob2=eob2,
                            sod=sod,
                            eod=eod)
            fig1 = create_figure5(temp,
                                  tft=dt_tft,
                                  ta=dt_ta,
                                  tr=dt_tr,
                                  tc=dt_tc,
                                  tfm=dt_tfm,
                                  tsr=dt_tsr)

        wellpath = get(depth,
                       profile=well_profile,
                       build_angle=build_angle,
                       kop=kop,
                       eob=eob,
                       kop2=kop2,
                       eob2=eob2,
                       sod=sod,
                       eod=eod)
        fig2 = plot_wellpath(wellpath)

        p = row(fig2, fig1)

    else:
        p = figure(sizing_mode='stretch_both')

    return p, inputs