Where does the energy for osmosis come from? A thought experiment:

A U-shaped tube with semi-permeable membrane at the base. The tube is completely thermally isolated from its surroundings. The liquid (solvent) is at some temperature $T$. When solute is added to one side of the tube the fluid level on that side rises until the increased pressure due to gravity ($\rho gh$) equals the osmotic pressure.

If I understand correctly, osmotic pressure could be used to do work (i.e. lift a weight as the solvent level in one side of U-shaped tube increases). Where does this energy come from? I guess it must be from the internal energy of the fluid.
At this point has the temperature of the fluid decreased?? If so, has it decreased by exactly the work done against gravity divided by the specific heat of the fluid? What does the quantitative treatment of this problem look like?
 A: Yeah, I think you have already answered your own question.
In the general kinetic theory, when a pressure acts to do work, it is because the pressurized molecules have some kinetic energy due to $k_\text B T$ that then gets reduced as a result of impacting a surface that is moving away from them. Assuming the salt molecules re-thermalize very quickly, this does indeed take energy from the solution and ply it into doing work. That energy comes out of the temperature, or more precisely, what the temperature would have otherwise been.
Whether the temperature will have decreased depends on the interaction between the solvent and solute molecules, and whether anything else is going on in the solution. Some solvents like being near certain solutes more than they like being near their own atoms, so as they get more dilute they also release energy, warming up the solution. If you draw only the tiniest about of work out of such a system surely it must still warm up in the osmotic setup. In addition of course the solution could be actively or passively temperature-controlled by other factors, so if you had ice water as your solution of course the energy would ultimately come from the induced phase change. 
A: For a semi-permeable membrane, the molecule that it is permeable to goes through the membrane in both directions.  For the sake of the argument, assume a semi-permeable membrane that is permeable to water, but not permeable to sugar.
When distilled water is placed on one side of this membrane, and a concentrated sugar solution is placed on the other side of the membrane, the membrane sees an interesting effect at the molecular level.  On the distilled water side of the membrane, a lot of water molecules are going across the membrane, with the rate of mass transfer being dependent on the temperature (water molecule velocity is a function of temperature) and the characteristics of the membrane.  On the sugar side of the membrane, a lot of sugar molecules are trying to go through the membrane, but they can't.  These molecules are hindering water molecules on that side of the membrane because they are getting in the way of the water molecules, so a lower rate of water molecules can diffuse from the sugar side of the membrane to the distilled water side of the membrane.  This imbalance means that there is a net flow of water from the distilled water side (higher concentration of water) to the sugar side (lower concentration of water).
As noted, this effect continues, and the level of solution on the sugar side of the membrane continues rising, until the pressure on the sugar side of the membrane is equal to the osmotic pressure of the system.  At that point, there are equal rates of water mass transfer across the membrane, and the water level stops rising on the sugar side of the membrane.
The energy for this process is due to the kinetic energy of the water molecules in the system, but it is also due to the fact that sugar disturbs the rate of mass transfer of water on that side of the membrane.  Note that the temperature of the fluid on both sides of the membrane can be expected to remain constant as the above process takes place.
