def isentropic_T_rise_compression(T1, P1, P2, k, eta=1):
    """Calculates the increase in temperature of a fluid which is compressed
    or expanded under isentropic, adiabatic conditions assuming constant
    Cp and Cv.  The polytropic model is the same equation; just provide `n`
    instead of `k` and use a polytropic efficienty for `eta` instead of a
    isentropic efficiency.

    .. math::
        T_2 = T_1 + \\frac{\\Delta T_s}{\\eta_s} = T_1 \\left\\{1 + \\frac{1}
        {\\eta_s}\\left[\\left(\\frac{P_2}{P_1}\\right)^{(k-1)/k}-1\\right]\\right\\}

    Parameters
    ----------
    T1 : float
        Initial temperature of gas [K]
    P1 : float
        Initial pressure of gas [Pa]
    P2 : float
        Final pressure of gas [Pa]
    k : float
        Isentropic exponent of the gas (Cp/Cv) or polytropic exponent `n` to
        use this as a polytropic model instead [-]
    eta : float
        Isentropic efficiency of the process or polytropic efficiency of the
        process to use this as a polytropic model instead [-]

    Returns
    -------
    T2 : float
        Final temperature of gas [K]

    Notes
    -----
    For the ideal case (`eta`=1), the model simplifies to:

    .. math::
        \\frac{T_2}{T_1} = \\left(\\frac{P_2}{P_1}\\right)^{(k-1)/k}

    Examples
    --------
    >>> isentropic_T_rise_compression(286.8, 54050, 432400, 1.4)
    519.5230938217768

    References
    ----------
    .. [1] Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process
       Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf
       Professional Publishing, 2009.
    .. [2] GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors
       Suppliers Association, Tulsa, OK, 2012.
    """
    dT = T1 * ((P2 / P1) ** ((k - 1.0) / k) - 1.0) / eta
    return T1 + dT
