Nernst Equation and Energy I have a question regarding the Nernst equation and energy in a system. I know this is also a chemistry question, but I was interested in the thermodynamics (the energy of a system), so I decided to post it in Physics SE. Please let me know if I should move it to Chemistry.
First, I want to confirm that I understand the Nernst equation correctly. Voltage is a measure of the energy/charge, so whatever the voltage is calculated for a half cell, is the amount of energy per charge in that half cell (even though voltage is arbitrary).
So for example, if there are exactly 1 coulomb worth of charge in the solution, if the half cell potential is calculated to be 1V, there is 1 joule per coulomb of charge, and therefore there is 1 J of energy in that half cell (again, yes this is arbitrary... I know there isn't actually 1 joule). I'm often wrong, so feel free to correct me if that's the case.

Okay, assuming the above is correct:
Let's use an example of a concentration cell - a voltaic battery that contains the same ions and electrodes in both half cells, and generates voltage due to differences in concentration of ions between the cells.
When I use the Nernst equation to calculate the energy (from the potentials) for two half cells at equilibrium, versus two half cells that aren't at equilibrium, why is the energy at equilibrium higher than when the energy isn't at equilibrium? Shouldn't the total energy at equilibrium be lower (as work is done by the system, lowering its total energy)?

Here's an example (for the sake of simplicity, I'll set the standard potential as 1V, and the constant that comes before the log(Q) as 1. I'll also assume that at 1M concentration, there is 1 coulomb of charge in solution):
Let's consider two situations: One at equilibrium, where the concentrations of both half cells is 0.5M (therefore there are 0.5 coulombs of charge in each half cell).
Plugging into the Nernst equation gives: 1 - (1)*log(1/0.5) = 0.699V for both half-cells.
0.699V * 0.5 C * 2 half cells = 0.699J of total energy.
The next situation is where the concentration of one half cell is 0.25, and the other is 0.75 (therefore 0.25 and 0.75 coulombs of charge each).
Half Cell 1: 1 - log(1/0.25) = 0.398V * 0.25C = 0.010 J
Half Cell 2: 1 - log(1/0.75) = 0.875V * 0.75C = 0.656 J
Total energy = 0.010J + 0.656J = 0.666J of total energy.
0.666J is smaller than 0.699J... but why? Shouldn't the energy at equilibrium be less than the energy when not in equilibrium? What am I doing wrong? Or where is this extra energy at equilibrium coming from?
 A: You take the meaning of the half cell potential E wrong. It does not mean if you put through the half cell $\rm{1 C}$, you store $\rm{1 J}$.
Additionally, you ignore the half cell potential change with the passing charge. Therefore, all the reasoning is flawed.
A potential of a half cell is conventionally related to the potential of the standard hydrogen electrode (=half cell ), taken as the zero potential reference.    
Voltage of a cell is given by the potential difference between half cells.     
If a half cell of the potential E is combined with the hydrogen half cell, 1 Coulomb provided by the cell does |E| Joules of the electromotoric work .    
If the concentration cell is supposed, than in the cell equilibrium with the same ion concentrations at both half cells, there are the same potentials and therefore zero cell voltage.
The open voltage of such a concentration cell would be
$$U = \frac{RT}{nF}.\ln{\frac{c_1}{c_2}},  \ \  c_1 >= c_2$$
For the standard electrochemical temperature $\mathrm{25 ^\circ C}$
$$U = \frac{0.059}{n}.\log{\frac{c_1}{c_2}}$$
About the cell energy:
Let suppose that


*

*Both half-cells have volume $V$.

*Active components have molar concentration $c_1$ and $c_2$.

*The starting state is equilibrium with the common concentration $c_0$.

*The initial cell voltage $U = 0$ .


If we charge the cell by the charge  $$Q = \int_{t=0}^{t_1} I .dt$$, 
The transformed molar amount $N = \frac Q{nF}$ 
The final concentration would be:
$$c_1 = c_0 + \frac Q{nFV}$$
$$c_2 = c_0 - \frac Q{nFV}$$
the stored energy will be 
$$E = \int_0^Q U . dq$$
$$E = \int_0^Q \left(\frac{RT}{nF}ln{\frac{c_0 + \frac q{nFV}}{c_0 - \frac q{nFV}}} \right) dq$$
$$E = \int_0^Q \left(\frac{RT}{nF}ln{\frac{c_0.nFV + q}{c_0.nFV - q}} \right) dq$$
Note that $c_0.nFV$ is the total charge capacity of the half cell, with meaning that charge would make from $c_0$ either $c = 0$ either $c = 2 * c_0$.
If we use $Q_{tot} = c_0.nFV$, then
$$E = \int_0^Q \left(\frac{RT}{nF}ln{\frac{Q_{tot} + q}{Q_{tot} - q}} \right) dq$$
According to the online symbolic integrator :
$$ \int \ln \frac {a+x}{a-x}  dx = x\ln\left(\dfrac{\left|x+a\right|}{\left|x-a\right|}\right)+a\left(\ln\left(\left|x+a\right|\right)+\ln\left(\left|x-a\right|\right)\right) + C$$
Therefore, the finite integral above is:
$$E = \frac {RT}{nF} *   \left[ Q\ln\left(\frac{Q_{tot} +Q}{  Q_{tot} -Q} \right) + Q_{tot} 
\ln\left(1 - {\left( \frac{ Q}{ Q_{tot}}\right)}^2 \right) \right] $$
If we consider $ Q=Q_{tot}/2$ , i.e charging $c_0->1.5c_0, c_0->0.5c_0$,  then
$$E = \frac {RT}{nF} *   \left[ Q\ln(3) + 2Q
\ln\left(3/4\right) \right] $$
$$E = \frac {2.6RT}{nF} * Q  =  1.3RTVc_0$$
If we consider $ \frac{Q}{Q_{tot}} << 1$ then 
$$\begin{align}
(Q_{tot} + Q)/(
Q_{tot} - Q ) &= 1 + 2.\frac{Q}{Q_{tot}} \\
\ln{(1+ 2.\frac{Q}{Q_{tot}})} &= 2.\frac{Q}{Q_{tot}} \\
\ln\left(1 - {\left( \frac{ Q}{ Q_{tot}}\right)}^2 \right) &= -{\left(\frac{ Q}{ Q_{tot}}\right)}^2
\end{align}$$
$$E = \frac {RT}{nF} *  \frac {Q^2}{Q_{tot}}  $$
If we then consider concentrations $c_1>c_2$, then for $  |c_1-c_2| << (c_1+c_2)/2$ :
$$Q_{tot}=nFV\frac{c_1+c_2}{2}  $$
$$ Q=nFV\frac{c_1-c_2}{2}  $$
the free energy of cell would be: 
$$E = \frac{1}{2}RTV \frac{{(c_1-c_2)}^2}{c_1+c_2} $$
For $20 ^{\circ}\rm{C}$, it would be
$$E = 1219 .V \frac{{(c_1-c_2)}^2}{c_1+c_2} $$
Note that $c$ means everywhere the molar concentrations.
There is important to add we cannot use full $Q_{tot}$, as other electrolytic reactions would kick in, not allowing us to use high enough external voltage for $Q_{tot}$ going toward zero. Additionally, the energy evaluation consider no loses at electrode boundary transition and low enough current to neglect the Ohmic loses.
It would be an advantege not to use classical concentration cells, but cells with different half-cell redox systems, like the vanadium flow cell:
$$\frac{V^{2+}}{V^{3+} },  \frac{ VO^{2+}}{ VO_2^+} 
$$
