Water at high pressure expands adiabatically to a lower pressure (throttled) through a partially closed valve. You can vary the inlet temperature and outlet pressure . If the exit stream is a compressed liquid, then the outlet temperature is slightly higher than the inlet temperature. If the exit stream is a vapor-liquid mixture, then the outlet temperature is the saturation temperature at the outlet pressure. An energy balance () determines the temperature and the fractions of liquid and vapor in the exit stream, which are shown in the bar graph.
Water at high pressure undergoes Joule–Thomson expansion when passing through a throttling valve. This process is assumed to be adiabatic, so the enthalpy change is zero.
, so , where is the inlet enthalpy and is the exit enthalpy.
When two phases are present, the saturated vapor enthalpy and the saturated liquid enthalpy are used to determine the fraction of the exit stream that is vapor. For the conditions chosen, liquid and vapor exit the throttle at saturation conditions, because .
The steam quality is calculated by:
so that .
When only liquid is present and .
The screencast video at  explains how to use this Demonstration.