Execuse the bad title but I am at loss in giving this question a title.
I know from my studies (EE) that If I place any two dissimilar metals or two semiconductors of different polarities (p-type or n-type) or semiconductors and metals, that a contact potential is pound to be created in between.
What does this potential really represent? It is not a source of Energy or dissipated power!
The second thing, this potential and other things develops due to the difference in work functions between the materials, so electrons really likes going from lower work function to higher work function. Now my question is, after all things are done, there should be an excess of electrons on the metal with lower function due to migration into it.
If the system had an Energy worth of K joules and I put work into it to make the concentrations equal in both metals or semiconductor then the system now has K+W joules. If I stopped the energy source then the system should go to its stable state which is as described in the previous paragraph. Where did the Energy I put into the system go? I know it was lost but where is it?
Third thing, in Electrodynamics, if I put an Electric field the electrons are accelerated to reposition themselves in such way that they feel the applied field no more. If we remove the field, the electrons will go back into their original configuration, therefore the system loses energy, but where does it go?
I have a hard time wrapping my head around those question and I became kinda obsessed with them.