How does the Sun affect the movement of water molecules to create motion in the ocean?

The Sun's energy causes water molecules to evaporate from the ocean surface. This causes a decrease in the density of the water, which creates a pressure gradient that drives the ocean currents. The Sun's energy also causes winds to blow across the ocean surface, which further drives the ocean currents.