auxi/tools/transportphenomena/fluidflow/pressuredrop.py
def f_tr_Haaland(Re_D, ɛ, D, warn=True):
    """
    Calculate the friction factor of turbulent flow (t) in a rough duct (r) for
    the provided conditions with Haaland's equation.

    :param Re_D: Reynolds number for the specified hydraulic diameter.
    :param ɛ: [m] Surface roughness.
    :param D: [m] Duct hydraulic diameter.
    :return: Friction factor.

    Source: lienhard2018, Eq. 7.50.
    """
    if warn:
        try:
            if (ɛ / D) < 0.0 or (ɛ / D) > 0.05:
                raise Warning(
                    f"ɛ/D '{ɛ / D:.3e}' out of range 0.0 <= ɛ/D <= 0.05.")
        except Warning as w:
            ex_type, ex_value, ex_traceback = sys.exc_info()
            print(color_warn("WARNING: "), ex_value)

        try:
            if Re_D < 4000.0 or Re_D > 1.0E8:
                raise Warning(
                    f"Reynolds number '{Re_D:.3e}' out of range "
                    "4000 <= Re_D <= 1E8.")
        except Warning as w:
            ex_type, ex_value, ex_traceback = sys.exc_info()
            print(color_warn("WARNING: "), ex_value)

    return 1 / (1.8 * log10((6.9 / Re_D) + (ɛ / D / 3.7)**1.11))**2
def f_tr_Haaland(Re_D, ɛ, D, warn=True):
    """
    Calculate the friction factor of turbulent flow (t) in a rough duct (r) for
    the provided conditions with Haaland's equation.

    :param Re_D: Reynolds number for the specified hydraulic diameter.
    :param ɛ: [m] Surface roughness.
    :param D: [m] Duct hydraulic diameter.
    :return: Friction factor.

    Source: lienhard2018, Eq. 7.50.
    """
    if warn:
        try:
            if (ɛ / D) < 0.0 or (ɛ / D) > 0.05:
                raise Warning(
                    f"ɛ/D '{ɛ / D:.3e}' out of range 0.0 <= ɛ/D <= 0.05.")
        except Warning as w:
            ex_type, ex_value, ex_traceback = sys.exc_info()
            print(color_warn("WARNING: "), ex_value)

        try:
            if Re_D < 4000.0 or Re_D > 1.0E8:
                raise Warning(
                    f"Reynolds number '{Re_D:.3e}' out of range "
                    "4000 <= Re_D <= 1E8.")
        except Warning as w:
            ex_type, ex_value, ex_traceback = sys.exc_info()
            print(color_warn("WARNING: "), ex_value)

    return 1 / (1.8 * log10((6.9 / Re_D) + (ɛ / D / 3.7)**1.11))**2
def f_tr_Haaland ( Re_D , ɛ, , arn= T rue) : if warn : try : if ( ɛ  ) .0  r  ɛ  / D > 0 05: raise Warning ( f"ɛ/D '{ɛ / D:.3e}' out of range 0.0 <= ɛ/D <= 0.05.") except Warning as w : ex_type , ex_value , ex_traceback = sys . exc_info ( ) print ( color_warn ( "WARNING: " ) , ex_value ) try : if Re_D < 4000.0 or Re_D > 1.0E8 : raise Warning ( f"Reynolds number '{Re_D:.3e}' out of range " "4000 <= Re_D <= 1E8." ) except Warning as w : ex_type , ex_value , ex_traceback = sys . exc_info ( ) print ( color_warn ( "WARNING: " ) , ex_value ) return 1 / ( 1.8 * log10 ( ( 6.9 / Re_D ) + ( ɛ  .7) * *1 .11) ) * *2
Calculate the friction factor of turbulent flow (t) in a rough duct (r) for
    the provided conditions with Haaland's equation.

    :param Re_D: Reynolds number for the specified hydraulic diameter.
    :param ɛ: [m] Surface roughness.
    :param D: [m] Duct hydraulic diameter.
    :return: Friction factor.

    Source: lienhard2018, Eq. 7.50.
Calculate the friction factor of turbulent flow ( t ) in a rough duct ( r ) for the provided conditions with Haaland s equation .