r'''Calculates the two-phase non-boiling heat transfer coefficient of a 
    liquid and gas flowing inside a tube of any inclination, as in [1]_ and 
    reviewed in [2]_.

    .. math::
        Nu = \frac{h_{TP} D}{k_l} = 0.56 \left(\frac{V_{gs}}{V_{ls}}
        \right)^{0.3}\left(\frac{\mu_g}{\mu_l}\right)^{0.2} Re_{ls}^{0.6} 
        Pr_l^{1/3}\left(\frac{\mu_b}{\mu_w}\right)^{0.14}
    
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval [-]
    D : float
        Diameter of the tube [m]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mug : float
        Viscosity of gas [Pa*s]
    mu_b : float
        Viscosity of liquid at bulk conditions (average of inlet/outlet 
        temperature) [Pa*s]
    mu_w : float, optional
        Viscosity of liquid at wall temperature [Pa*s]

    Returns
    -------
    h : float
        Heat transfer coefficient [W/m^2/K]

    Notes
    -----
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.
    
    Developed with a vertical pipe, superficial gas/liquid velocity ratios of 
    1-90, in the froth regime, and for fluid mixtures of air and water, 
    toluene, benzene, and methanol.
    
    Examples
    --------
    >>> Ravipudi_Godbold(m=1, x=.9, D=.3, rhol=1000, rhog=2.5, Cpl=2300, kl=.6, mug=1E-5, mu_b=1E-3, mu_w=1.2E-3)
    299.3796286459285

    References
    ----------
    .. [1] Ravipudi, S., and Godbold, T., The Effect of Mass Transfer on Heat
       Transfer Rates for Two-Phase Flow in a Vertical Pipe, Proceedings 6th 
       International Heat Transfer Conference, Toronto, V. 1, p. 505-510, 1978.
    .. [2] Dongwoo Kim, Venkata K. Ryali, Afshin J. Ghajar, Ronald L. 
       Dougherty. "Comparison of 20 Two-Phase Heat Transfer Correlations with 
       Seven Sets of Experimental Data, Including Flow Pattern and Tube 
       Inclination Effects." Heat Transfer Engineering 20, no. 1 (February 1, 
       1999): 15-40. doi:10.1080/014576399271691.

def Ravipudi_Godbold(m, x, D, rhol, rhog, Cpl, kl, mug, mu_b, mu_w=None):
    r'''Calculates the two-phase non-boiling heat transfer coefficient of a 
    liquid and gas flowing inside a tube of any inclination, as in [1]_ and 
    reviewed in [2]_.

    .. math::
        Nu = \frac{h_{TP} D}{k_l} = 0.56 \left(\frac{V_{gs}}{V_{ls}}
        \right)^{0.3}\left(\frac{\mu_g}{\mu_l}\right)^{0.2} Re_{ls}^{0.6} 
        Pr_l^{1/3}\left(\frac{\mu_b}{\mu_w}\right)^{0.14}
    
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval [-]
    D : float
        Diameter of the tube [m]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mug : float
        Viscosity of gas [Pa*s]
    mu_b : float
        Viscosity of liquid at bulk conditions (average of inlet/outlet 
        temperature) [Pa*s]
    mu_w : float, optional
        Viscosity of liquid at wall temperature [Pa*s]

    Returns
    -------
    h : float
        Heat transfer coefficient [W/m^2/K]

    Notes
    -----
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.
    
    Developed with a vertical pipe, superficial gas/liquid velocity ratios of 
    1-90, in the froth regime, and for fluid mixtures of air and water, 
    toluene, benzene, and methanol.
    
    Examples
    --------
    >>> Ravipudi_Godbold(m=1, x=.9, D=.3, rhol=1000, rhog=2.5, Cpl=2300, kl=.6, mug=1E-5, mu_b=1E-3, mu_w=1.2E-3)
    299.3796286459285

    References
    ----------
    .. [1] Ravipudi, S., and Godbold, T., The Effect of Mass Transfer on Heat
       Transfer Rates for Two-Phase Flow in a Vertical Pipe, Proceedings 6th 
       International Heat Transfer Conference, Toronto, V. 1, p. 505-510, 1978.
    .. [2] Dongwoo Kim, Venkata K. Ryali, Afshin J. Ghajar, Ronald L. 
       Dougherty. "Comparison of 20 Two-Phase Heat Transfer Correlations with 
       Seven Sets of Experimental Data, Including Flow Pattern and Tube 
       Inclination Effects." Heat Transfer Engineering 20, no. 1 (February 1, 
       1999): 15-40. doi:10.1080/014576399271691.
    '''
    Vgs = m*x/(rhog*pi/4*D**2)
    Vls = m*(1-x)/(rhol*pi/4*D**2)
    Prl = Prandtl(Cp=Cpl, mu=mu_b, k=kl)
    Rels = D*Vls*rhol/mu_b
    Nu = 0.56*(Vgs/Vls)**0.3*(mug/mu_b)**0.2*Rels**0.6*Prl**(1/3.)
    if mu_w:
        Nu *= (mu_b/mu_w)**0.14
    return Nu*kl/D