r'''Computes the wall correction factor for heat transfer between a fluid
    and a wall. These coefficients were derived for internal flow inside a 
    pipe, but can be used elsewhere where appropriate data is missing. It is
    also useful to compare these results with the coefficients used in various
    heat transfer coefficients.
    
    .. math::
        \frac{Nu}{Nu_{\text{constant properties}}} 
        = \left(\frac{\mu}{\mu_{wall}}\right)^n

    Parameters
    ----------
    mu : float
        Viscosity (or Prandtl number) of flowing fluid away from the heat
        transfer surface, [Pa*s]
    mu_wall : float
        Viscosity (or Prandtl number) of the fluid at the wall, [Pa*s]
    turbulent : bool
        Whether or not to use the turbulent coefficient, [-]
    liquid : bool
        Whether or not to use the liquid phase coefficient; otherwise the gas
        coefficient is used, [-]
        
    Returns
    -------
    factor : float
        Correction factor for heat transfer; to be multiplied by the Nusselt
        number, or heat transfer coefficient to obtain the actual result, [-]

    Notes
    -----
    The exponents are determined as follows:
        
    +-----------+--------+---------+---------+
    | Regime    | Phase  | Heating | Cooling |
    +===========+========+=========+=========+
    | Turbulent | Liquid | 0.11    | 0.25    |
    +-----------+--------+---------+---------+
    | Turbulent | Gas    | 0.5     | 0       |
    +-----------+--------+---------+---------+
    | Laminar   | Liquid | 0.14    | 0.14    |
    +-----------+--------+---------+---------+
    | Laminar   | Gas    | 0       | 0       |
    +-----------+--------+---------+---------+    
    
    Examples
    --------
    >>> wall_factor_Nu(mu=8E-4, mu_wall=3E-4, turbulent=True, liquid=True)
    1.1139265634480144
    
    >>> wall_factor_Nu(mu=8E-4, mu_wall=3E-4, turbulent=False, liquid=True)
    1.147190712947014
    
    >>> wall_factor_Nu(mu=1.5E-5, mu_wall=1.3E-5, turbulent=True, liquid=False)
    1.0741723110591495
    
    >>> wall_factor_Nu(mu=1.5E-5, mu_wall=1.3E-5, turbulent=False, liquid=False)
    1.0

    References
    ----------
    .. [1] Kays, William M., and Michael E. Crawford. Convective Heat and Mass 
       Transfer. 3rd edition. New York: McGraw-Hill Science/Engineering/Math,
       1993.

def wall_factor_Nu(mu, mu_wall, turbulent=True, liquid=False):
    r'''Computes the wall correction factor for heat transfer between a fluid
    and a wall. These coefficients were derived for internal flow inside a 
    pipe, but can be used elsewhere where appropriate data is missing. It is
    also useful to compare these results with the coefficients used in various
    heat transfer coefficients.
    
    .. math::
        \frac{Nu}{Nu_{\text{constant properties}}} 
        = \left(\frac{\mu}{\mu_{wall}}\right)^n

    Parameters
    ----------
    mu : float
        Viscosity (or Prandtl number) of flowing fluid away from the heat
        transfer surface, [Pa*s]
    mu_wall : float
        Viscosity (or Prandtl number) of the fluid at the wall, [Pa*s]
    turbulent : bool
        Whether or not to use the turbulent coefficient, [-]
    liquid : bool
        Whether or not to use the liquid phase coefficient; otherwise the gas
        coefficient is used, [-]
        
    Returns
    -------
    factor : float
        Correction factor for heat transfer; to be multiplied by the Nusselt
        number, or heat transfer coefficient to obtain the actual result, [-]

    Notes
    -----
    The exponents are determined as follows:
        
    +-----------+--------+---------+---------+
    | Regime    | Phase  | Heating | Cooling |
    +===========+========+=========+=========+
    | Turbulent | Liquid | 0.11    | 0.25    |
    +-----------+--------+---------+---------+
    | Turbulent | Gas    | 0.5     | 0       |
    +-----------+--------+---------+---------+
    | Laminar   | Liquid | 0.14    | 0.14    |
    +-----------+--------+---------+---------+
    | Laminar   | Gas    | 0       | 0       |
    +-----------+--------+---------+---------+    
    
    Examples
    --------
    >>> wall_factor_Nu(mu=8E-4, mu_wall=3E-4, turbulent=True, liquid=True)
    1.1139265634480144
    
    >>> wall_factor_Nu(mu=8E-4, mu_wall=3E-4, turbulent=False, liquid=True)
    1.147190712947014
    
    >>> wall_factor_Nu(mu=1.5E-5, mu_wall=1.3E-5, turbulent=True, liquid=False)
    1.0741723110591495
    
    >>> wall_factor_Nu(mu=1.5E-5, mu_wall=1.3E-5, turbulent=False, liquid=False)
    1.0

    References
    ----------
    .. [1] Kays, William M., and Michael E. Crawford. Convective Heat and Mass 
       Transfer. 3rd edition. New York: McGraw-Hill Science/Engineering/Math,
       1993.
    '''
    params = wall_factor_Nu_defaults[(turbulent, liquid)]
    return wall_factor(mu=mu, mu_wall=mu_wall, **params)