Ejemplo n.º 1
0
def test_alpha_validation(caplog):
    # weld
    kwargs = {
        'v_m': 30,
        'rho_m': 150,
        'D': 0.1,
        'd_p': 0.4,
        'h': 0.023,
        'alpha': 100
    }
    with caplog.at_level(logging.WARNING):
        welded_joint(**kwargs)
    assert "Particle impact angle [degrees], alpha, is outside RP-O501 model boundaries (0-90 deg)." in str(
        caplog.records)
    # reducer
    kwargs = {
        'v_m': 30,
        'rho_m': 150,
        'D1': 0.1,
        'D2': 0.05,
        'd_p': 0.4,
        'alpha': 100
    }
    with caplog.at_level(logging.WARNING):
        reducer(**kwargs)
    assert "Particle impact angle [degrees], alpha, is outside RP-O501 model boundaries (10-80 deg)." in str(
        caplog.records)
    # probes
    kwargs = {'v_m': 30, 'rho_m': 150, 'D': 0.1, 'd_p': 0.4, 'alpha': 100}
    with caplog.at_level(logging.WARNING):
        probes(**kwargs)
    assert "Particle impact angle [degrees], alpha, is outside RP-O501 model boundaries (10-90 deg)." in str(
        caplog.records)
Ejemplo n.º 2
0
def er_sand_rate(E_meas, v_m, rho_m, D, d_p, alpha=60):
    """
    ER probe sand rate calculation, model reference to DNVGL RP-O501, August 2015.
    This approach involve uncertainty, particularly at low bulk flow velocities; Should not be used when v_m < 5 m/s.
    :param E_meas: Measured erosion rate from ER probe [mm/year]
    :param v_m: Upstream mix velocity [m/s]
    :param rho_m: Mix density [kg/m3]
    :param D: Branch pipe diameter [m]
    :param d_p: Particle diameter [mm]
    :param alpha: particle impact angle [degrees], default = 60
    :return: Sand rate [g/s]
    """

    # Input validation
    kwargs = {'E_meas': E_meas, 'v_m': v_m}
    validate_inputs(**kwargs)

    E_rel_theor = probes(v_m, rho_m, D, d_p, alpha=alpha)  # [mm/ton]
    Q_s = 1
    E_theor = erosion_rate(E_rel_theor, Q_s)  # [mm/year]
    Q_s = E_meas / E_theor  # (4.63)

    return Q_s
Ejemplo n.º 3
0
def test_return_nan():
    v_m = 29.3
    rho_m = 30
    mu_m = 1.5e-5
    R = 1
    GF = 2
    D = .1
    d_p = .4
    h = 0.023
    Dm = .2
    D1 = .15
    D2 = .1
    mbr = 15
    R_c = .15
    gap = .04
    H = .15
    # test bend
    kwargs = {
        'v_m': v_m,
        'rho_m': rho_m,
        'mu_m': mu_m,
        'R': R,
        'GF': GF,
        'D': D,
        'd_p': d_p
    }
    for inp in ['v_m', 'rho_m', 'mu_m']:
        kwargs[inp] = -1
        assert np.isnan(bend(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m
        kwargs['mu_m'] = mu_m

    # test tee
    kwargs = {
        'v_m': v_m,
        'rho_m': rho_m,
        'mu_m': mu_m,
        'GF': GF,
        'D': D,
        'd_p': d_p
    }
    for inp in ['v_m', 'rho_m', 'mu_m']:
        kwargs[inp] = -1
        assert np.isnan(tee(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m
        kwargs['mu_m'] = mu_m

    # straight pipe
    kwargs = {'v_m': -1, 'D': D}
    assert np.isnan(straight_pipe(**kwargs))

    # test welded joint
    kwargs = {'v_m': v_m, 'rho_m': rho_m, 'D': D, 'd_p': d_p, 'h': h}
    for inp in ['v_m', 'rho_m']:
        kwargs[inp] = -1
        assert np.isnan(welded_joint(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m

    # test manifold
    kwargs = {
        'v_m': v_m,
        'rho_m': rho_m,
        'mu_m': mu_m,
        'GF': GF,
        'D': D,
        'd_p': d_p,
        'Dm': Dm
    }
    for inp in ['v_m', 'rho_m', 'mu_m']:
        kwargs[inp] = -1
        assert np.isnan(manifold(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m
        kwargs['mu_m'] = mu_m

    # test reducer
    kwargs = {'v_m': v_m, 'rho_m': rho_m, 'D1': D1, 'D2': D2, 'd_p': d_p}
    for inp in ['v_m', 'rho_m']:
        kwargs[inp] = -1
        assert np.isnan(reducer(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m

    # test probes
    kwargs = {'v_m': v_m, 'rho_m': rho_m, 'D': D, 'd_p': d_p}
    for inp in ['v_m', 'rho_m']:
        kwargs[inp] = -1
        assert np.isnan(probes(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m

    # test flexible
    kwargs = {
        'v_m': v_m,
        'rho_m': rho_m,
        'mu_m': mu_m,
        'mbr': mbr,
        'D': D,
        'd_p': d_p
    }
    for inp in ['v_m', 'rho_m', 'mu_m']:
        kwargs[inp] = -1
        assert np.isnan(flexible(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m
        kwargs['mu_m'] = mu_m

    # test choke gallery
    kwargs = {
        'v_m': v_m,
        'rho_m': rho_m,
        'mu_m': mu_m,
        'GF': GF,
        'D': D,
        'd_p': d_p,
        'R_c': R_c,
        'gap': gap,
        'H': H
    }
    for inp in ['v_m', 'rho_m', 'mu_m']:
        kwargs[inp] = -1
        assert np.isnan(choke_gallery(**kwargs))
        kwargs['v_m'] = v_m
        kwargs['rho_m'] = rho_m
        kwargs['mu_m'] = mu_m
Ejemplo n.º 4
0
def test_probes(v_m, rho_m, D, d_p, alpha, material, E):
    assert probes(v_m, rho_m, D, d_p, alpha=alpha, material=material) == E
Ejemplo n.º 5
0
def test_probes(v_m, rho_m, Q_s, D, d_p, alpha, E):
    assert probes(v_m, rho_m, Q_s, D, d_p, alpha) == E