Free Energy Density Functional from 0D Cavities