# Thermodynamics

## Phase diagram of an ideal solution at fixed temperature

The following plot shows the vapor-liquid phase diagram for a binary ideal mixture (components: A and B). The vapor pressures of the pure substances are $p_A^*$ and $p_B^*$, respectively.

The blue curve shows the vapor pressure $p$ of the mixture as a function of the mole fraction of A in the liquid $x_A^l$:

$p=p_B^*+(p_A^*-p_B^*)x_A^l$

The red curve shows the vapor pressure $p$ of the mixture as a function of the mole fraction of A in the vapor $x_A^v$:

$p=\dfrac{p_A^*p_B^*}{p_A^*-(p_A^*-p_B^*)x_A^v}$

In the example below $p_A^*=1$ (a.u.) and the value of $p_B^*$ can be changed moving the slider below.

slider.py example

The number of moles in each phase (liquid or vapor) can be obtained from the lever rule:

$n^l\overline{\text{BK}}=n^v\overline{\text{KR}}$

slider.py example