def conservation_of_energy(h1, u1, rho1, rho2):
    """Solve conservation of energy for enthalpy

    :param <float> h1: Enthalpy state 1 (J/kg/K)
    :param <float> u1: Velocity state 1 (m/s)
    :param <float> rho1: Density state 1 (kg/m^3)
    :param <float> rho2: Density state 2 (kg/m^3)

    :return <float> h2: Enthalpy state 2 (Pa)
    """

    return h1 + 0.5 * u1 ** 2 * (1 - (rho1 / rho2) ** 2)