The thermal equilibrium state of two oppositely charged gases confined to a bounded domain Omega subset of R(m), m = 1,2 or m = 3, is entirely described by the gases' particle densities p, n minimizing the total energy epsilon(p, n). It is shown that for given P,N > 0 the energy functional epsilon admits a unique minimizer in {(p, n) epsilon L(2)(Omega) x L(2)(Omega) : p,n greater than or equal to 0, integral(Omega)P = P,integral(Omega)n = N} and that p, n epsilon C(Omega)boolean AND L(infinity)(Omega). The analysis is applied to the hydrodynamic semiconductor device equations. These equations in general possess more than one thermal equilibrium solution, but only the unique solution of the corresponding variational problem minimizes the total energy. It is equivalent to prescribe boundary data for electrostatic potential and particle densities satisfying the usual compatibility relations and to prescribe V-e and P, N for the variational problem.