Thermodynamics for Non-equilibrium Pattern Formation