# Phase separation - density functional theory

I would like to get the equilibrium density profile $\rho(x)$ of a non ideal gas that has phase separated. I start by defining a simple free energy density. The total free energy $F[\rho]$ is a functional of the density. Then, minimizing $F[\rho]$, I expect to find $\rho(x)$ at equilibrium.

My result fails to find the right density $\rho(x)$. I think it comes from the fact that there exist no unique solution. For example, the gas can be more concentrated on the right side, or on the left side.

Free energy density:

$f(x)=\rho(x)\log(\rho(x))+(1-\rho(x))\log(1-\rho(x)) + \chi\rho^2(x)$

The first two terms account for the entropy and the third term accounts for the interaction between particles. For $\chi<0$ the interaction is attractive and causes the phase separation.

Total free energy:

$F[\rho]=\int f(\rho(x))dx$

The total free energy has to be minimized with respect to $\rho(x)$ with the constraint that the total mass is conserved :

$M=\int \rho(x)dx$

So using the Lagrange multiplier to constraint the minimization, the problem is now to minimize the modified free energy $G[\rho]$:

$G[\rho]=\int L(\rho(x),x)dx$

with $L=f(\rho(x))-\mu \rho(x)$.

We want $\frac{\delta G}{\delta \rho}=0$ so using the Euler Lagrange equation : $\frac{\partial L}{\partial \rho}=0$

$\log\frac{\rho}{1-\rho} + 2 \chi \rho - \mu =0$