def conservation_of_momentum(p1, u1, rho1, rho2):
    """Solve conservation of momentum for pressure

    :param <float> p1: Pressure state 1 (Pa)
    :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> p2: Pressure state 2 (Pa)
    """

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