r'''Calculates heat transfer coefficient for condensation
    of a pure chemical inside a vertical tube or tube bundle, as presented in
    [2]_ according to [1]_.

    .. math::
        h = \left(\frac{2f}{2-f}\right)\left(\frac{MW}{1000\cdot 2\pi R T}
        \right)^{0.5}\left(\frac{H_{vap}^2 P \cdot MW}{1000\cdot RT^2}\right)
        
    Parameters
    ----------
    T : float
        Vapor temperature, [K]
    P : float
        Vapor pressure, [Pa]
    MW : float
        Molecular weight of the gas, [g/mol]
    Hvap : float
        Heat of vaporization of the fluid at P, [J/kg]
    f : float
        Correction factor, [-]

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

    Notes
    -----
    f is a correction factor for how the removal of gas particles affects the 
    behavior of the ideal gas in diffusing to the condensing surface. It is
    quite close to one, and has not been well explored in the literature due
    to the rarity of the importance of the kinetic resistance.

    Examples
    --------
    Water at 1 bar and 300 K:
    
    >>> h_kinetic(300, 1E5, 18.02, 2441674)
    30788845.562480535
    
    References
    ----------
    .. [1] Berman, L. D. "On the Effect of Molecular-Kinetic Resistance upon 
       Heat Transfer with Condensation." International Journal of Heat and Mass
       Transfer 10, no. 10 (October 1, 1967): 1463. 
       doi:10.1016/0017-9310(67)90033-6.
    .. [2] Kakaç, Sadik, ed. Boilers, Evaporators, and Condensers. 1 edition. 
       Wiley-Interscience, 1991.
    .. [3] Stephan, Karl. Heat Transfer in Condensation and Boiling. Translated
       by C. V. Green. Softcover reprint of the original 1st ed. 1992 edition. 
       Berlin; New York: Springer, 2013.

def h_kinetic(T, P, MW, Hvap, f=1):
    r'''Calculates heat transfer coefficient for condensation
    of a pure chemical inside a vertical tube or tube bundle, as presented in
    [2]_ according to [1]_.

    .. math::
        h = \left(\frac{2f}{2-f}\right)\left(\frac{MW}{1000\cdot 2\pi R T}
        \right)^{0.5}\left(\frac{H_{vap}^2 P \cdot MW}{1000\cdot RT^2}\right)
        
    Parameters
    ----------
    T : float
        Vapor temperature, [K]
    P : float
        Vapor pressure, [Pa]
    MW : float
        Molecular weight of the gas, [g/mol]
    Hvap : float
        Heat of vaporization of the fluid at P, [J/kg]
    f : float
        Correction factor, [-]

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

    Notes
    -----
    f is a correction factor for how the removal of gas particles affects the 
    behavior of the ideal gas in diffusing to the condensing surface. It is
    quite close to one, and has not been well explored in the literature due
    to the rarity of the importance of the kinetic resistance.

    Examples
    --------
    Water at 1 bar and 300 K:
    
    >>> h_kinetic(300, 1E5, 18.02, 2441674)
    30788845.562480535
    
    References
    ----------
    .. [1] Berman, L. D. "On the Effect of Molecular-Kinetic Resistance upon 
       Heat Transfer with Condensation." International Journal of Heat and Mass
       Transfer 10, no. 10 (October 1, 1967): 1463. 
       doi:10.1016/0017-9310(67)90033-6.
    .. [2] Kakaç, Sadik, ed. Boilers, Evaporators, and Condensers. 1 edition. 
       Wiley-Interscience, 1991.
    .. [3] Stephan, Karl. Heat Transfer in Condensation and Boiling. Translated
       by C. V. Green. Softcover reprint of the original 1st ed. 1992 edition. 
       Berlin; New York: Springer, 2013.
    '''
    return (2*f)/(2-f)*(MW/(1000*2*pi*R*T))**0.5*(Hvap**2*P*MW)/(1000*R*T**2)