r'''Calculates internal convection Nusselt number for turbulent vertical
    upward flow in a pipe under supercritical conditions according to [1]_.
        
    .. math::
        Nu_w = 0.00459 Re_w^{0.923} Pr_w^{0.613}
        \left(\frac{\rho_w}{\rho_b}\right)^{0.231}

        \bar{Cp} = \frac{H_w-H_b}{T_w-T_b}
        
    Parameters
    ----------
    Re : float
        Reynolds number with wall fluid properties, [-]
    Pr : float
        Prandtl number with wall fluid properties and an average heat capacity
        between the wall and bulk temperatures [-]
    rho_w : float, optional
        Density at the wall temperature, [kg/m^3]
    rho_b : float, optional
        Density at the bulk temperature, [kg/m^3]

    Returns
    -------
    Nu : float
        Nusselt number with wall fluid properties, [-]

    Notes
    -----
    The range of examined parameters is as follows: 
    P from 22.8 to 27.6 MPa; G from 542-2150 kg/m^2/s; 
    Re from 7.5E4 to 3.16E6; T_b from 75 to 576 degrees Celsius and T_w from
    93 to 649 degrees Celsius.
    
    Cp used in the calculation of Prandtl number should be the average value
    of those at the wall and the bulk temperatures.

    For deteriorated heat transfer, this was the most accurate correlation in 
    [2]_ with a MAD of 18.4%. On the overall database in [3]_, it was the 
    9th most accurate correlation.
    
    If the extra density information is not provided, it will not be used.

    Examples
    --------
    >>> Nu_Swenson(1E5, 1.2, 330, 290.)
    217.92827034803668

    References
    ----------
    .. [1] Swenson, H. S., J. R. Carver, and C. R. Kakarala. "Heat Transfer to 
       Supercritical Water in Smooth-Bore Tubes." Journal of Heat Transfer 87, 
       no. 4 (November 1, 1965): 477-83. doi:10.1115/1.3689139.
    .. [2] Chen, Weiwei, Xiande Fang, Yu Xu, and Xianghui Su. "An Assessment of
       Correlations of Forced Convection Heat Transfer to Water at 
       Supercritical Pressure." Annals of Nuclear Energy 76 (February 2015): 
       451-60. doi:10.1016/j.anucene.2014.10.027.
    .. [3] Yu, Jiyang, Baoshan Jia, Dan Wu, and Daling Wang. "Optimization of 
       Heat Transfer Coefficient Correlation at Supercritical Pressure Using 
       Genetic Algorithms." Heat and Mass Transfer 45, no. 6 (January 8, 2009): 
       757-66. doi:10.1007/s00231-008-0475-4.
    .. [4] Jäger, Wadim, Victor Hugo Sánchez Espinoza, and Antonio Hurtado. 
       "Review and Proposal for Heat Transfer Predictions at Supercritical 
       Water Conditions Using Existing Correlations and Experiments." Nuclear 
       Engineering and Design, (W3MDM) University of Leeds International 
       Symposium: What Where When? Multi-dimensional Advances for Industrial 
       Process Monitoring, 241, no. 6 (June 2011): 2184-2203. 
       doi:10.1016/j.nucengdes.2011.03.022.

def Nu_Swenson(Re, Pr, rho_w=None, rho_b=None):
    r'''Calculates internal convection Nusselt number for turbulent vertical
    upward flow in a pipe under supercritical conditions according to [1]_.
        
    .. math::
        Nu_w = 0.00459 Re_w^{0.923} Pr_w^{0.613}
        \left(\frac{\rho_w}{\rho_b}\right)^{0.231}

        \bar{Cp} = \frac{H_w-H_b}{T_w-T_b}
        
    Parameters
    ----------
    Re : float
        Reynolds number with wall fluid properties, [-]
    Pr : float
        Prandtl number with wall fluid properties and an average heat capacity
        between the wall and bulk temperatures [-]
    rho_w : float, optional
        Density at the wall temperature, [kg/m^3]
    rho_b : float, optional
        Density at the bulk temperature, [kg/m^3]

    Returns
    -------
    Nu : float
        Nusselt number with wall fluid properties, [-]

    Notes
    -----
    The range of examined parameters is as follows: 
    P from 22.8 to 27.6 MPa; G from 542-2150 kg/m^2/s; 
    Re from 7.5E4 to 3.16E6; T_b from 75 to 576 degrees Celsius and T_w from
    93 to 649 degrees Celsius.
    
    Cp used in the calculation of Prandtl number should be the average value
    of those at the wall and the bulk temperatures.

    For deteriorated heat transfer, this was the most accurate correlation in 
    [2]_ with a MAD of 18.4%. On the overall database in [3]_, it was the 
    9th most accurate correlation.
    
    If the extra density information is not provided, it will not be used.

    Examples
    --------
    >>> Nu_Swenson(1E5, 1.2, 330, 290.)
    217.92827034803668

    References
    ----------
    .. [1] Swenson, H. S., J. R. Carver, and C. R. Kakarala. "Heat Transfer to 
       Supercritical Water in Smooth-Bore Tubes." Journal of Heat Transfer 87, 
       no. 4 (November 1, 1965): 477-83. doi:10.1115/1.3689139.
    .. [2] Chen, Weiwei, Xiande Fang, Yu Xu, and Xianghui Su. "An Assessment of
       Correlations of Forced Convection Heat Transfer to Water at 
       Supercritical Pressure." Annals of Nuclear Energy 76 (February 2015): 
       451-60. doi:10.1016/j.anucene.2014.10.027.
    .. [3] Yu, Jiyang, Baoshan Jia, Dan Wu, and Daling Wang. "Optimization of 
       Heat Transfer Coefficient Correlation at Supercritical Pressure Using 
       Genetic Algorithms." Heat and Mass Transfer 45, no. 6 (January 8, 2009): 
       757-66. doi:10.1007/s00231-008-0475-4.
    .. [4] Jäger, Wadim, Victor Hugo Sánchez Espinoza, and Antonio Hurtado. 
       "Review and Proposal for Heat Transfer Predictions at Supercritical 
       Water Conditions Using Existing Correlations and Experiments." Nuclear 
       Engineering and Design, (W3MDM) University of Leeds International 
       Symposium: What Where When? Multi-dimensional Advances for Industrial 
       Process Monitoring, 241, no. 6 (June 2011): 2184-2203. 
       doi:10.1016/j.nucengdes.2011.03.022. 
    '''
    Nu = 0.00459*Re**0.923*Pr**0.613
    if rho_w and rho_b:
        Nu *= (rho_w/rho_b)**0.231
    return Nu