Beispiel #1
0
def k_value_orifice(pipe_id, orifice_id, orifice_l, q, nu=con.WATER_NU):
    """Calculates the minor loss coefficient of an orifice plate in a
    pipe.

    Parameters:
        pipe_id: Entrance pipe's inner diameter from which fluid flows.
        orifice_id: Orifice's inner diameter.
        orifice_l: Orifice's length from start to end.
        q: Fluid's q rate.

        nu: Fluid's dynamic viscosity of the fluid. Default: room
            temperature water (1 * 10**-6 * m**2/s)

    Returns:
        k-value at the orifice.
    """

    if orifice_id > pipe_id:
        raise ValueError('The orifice\'s inner diameter cannot be larger than'
                         'that of the entrance pipe.')

    re = pc.re_pipe(q, pipe_id, nu)  # Entrance pipe's Reynolds number.

    orifice_type = _get_orifice_type(orifice_l, orifice_id)

    if orifice_type == 'thin':
        result = _k_value_thin_sharp_orifice(pipe_id, orifice_id, re)
    elif orifice_type == 'thick':
        result = _k_value_thick_orifice(pipe_id, orifice_id, orifice_l, re)
    elif orifice_type == 'oversize':
        result = k_value_reduction(pipe_id, orifice_id, q) \
               + k_value_expansion(orifice_id, pipe_id, q)
    return result.to(u.dimensionless)
Beispiel #2
0
def k_value_reduction(ent_pipe_id,
                      exit_pipe_id,
                      q,
                      fitting_angle=180,
                      rounded=False,
                      nu=con.WATER_NU,
                      pipe_rough=mats.PVC_PIPE_ROUGH):
    """Calculates the minor loss coefficient (k-value) of a square,
    tapered, or rounded reduction in a pipe. Defaults to square.

    To use tapered, set angle to something that isn't 180.

    To use rounded, set rounded to True.

    Parameters:
        ent_pipe_id: Entrance pipe's inner diameter from which fluid flows.
        exit_pipe_id: Exit pipe's inner diameter to which fluid flows.
        q: Fluid's q rate.

        fitting_angle: Fitting angle. Default: square (180 degrees).
        rounded: Rounded fitting. Default: square (False).

        nu: Fluid's dynamic viscosity of the fluid. Default: room
            temperature water (1 * 10**-6 * m**2/s)
        pipe_rough: Pipe roughness. Default: PVC pipe roughness

    Returns:
        k-value of reduction.
    """

    if ent_pipe_id < exit_pipe_id:
        print(
            'k_value_reduction: Entrance pipe\'s inner diameter is less than '
            'exit pipe\'s inner diameter, using expansion instead.')
        return k_value_expansion(ent_pipe_id, exit_pipe_id, q, fitting_angle,
                                 rounded, nu, pipe_rough)

    f = pc.fric_pipe(q, ent_pipe_id, nu, pipe_rough)  # Darcy friction factor.
    re = pc.re_pipe(q, ent_pipe_id, nu)  # Entrance pipe's Reynolds number.

    fitting_type = _get_fitting_type(fitting_angle, rounded)

    if fitting_type == 'square':
        result = _k_value_square_reduction(ent_pipe_id, exit_pipe_id, re, f)
    elif fitting_type == 'tapered':
        result = _k_value_tapered_reduction(ent_pipe_id, exit_pipe_id,
                                            fitting_angle, re, f)
    elif fitting_type == 'rounded':
        result = _k_value_rounded_reduction(ent_pipe_id, exit_pipe_id, re)
    elif fitting_type == 'ambiguous':
        raise ValueError('The fitting is ambiguously both tapered and rounded.'
                         'Please set only either fitting_angle or rounded.')
    return result.to(u.dimensionless)