def fric(FlowRate, Diam, Nu, PipeRough):
    """Return the friction factor for pipe flow.

    This equation applies to both laminar and turbulent flows.
    """
    #Checking input validity - inputs not checked here are checked by
    #functions this function calls.
    ut.check_range([PipeRough, "0-1", "Pipe roughness"])
    if re_pipe(FlowRate, Diam, Nu) >= RE_TRANSITION_PIPE:
        #Swamee-Jain friction factor for turbulent flow; best for
        #Re>3000 and ε/Diam < 0.02
        f = (0.25 / (np.log10(PipeRough / (3.7 * Diam)
                              + 5.74 / re_pipe(FlowRate, Diam, Nu) ** 0.9
                              )
                     ) ** 2
             )
    else:
        f = 64 / re_pipe(FlowRate, Diam, Nu)
    return f
def fric ( FlowRate , Diam , Nu , PipeRough ) : ut . check_range ( [ PipeRough , "0-1" , "Pipe roughness" ] ) if re_pipe ( FlowRate , Diam , Nu ) >= RE_TRANSITION_PIPE : f = ( 0.25 / ( np . log10 ( PipeRough / ( 3.7 * Diam ) + 5.74 / re_pipe ( FlowRate , Diam , Nu ) ** 0.9 ) ) ** 2 ) else : f = 64 / re_pipe ( FlowRate , Diam , Nu ) return f
Return the friction factor for pipe flow.

    This equation applies to both laminar and turbulent flows.