Why doesn't the separation of particles by mass via gravity decrease entropy? Let's say we've got a fluid of heavy and light particles inside a cubical flask, which is initially shaken up so that the density of heavy particles is uniform everywhere. Let's also say that these molecules interact identically whether in contact with like or opposite particles (i.e. they don't naturally separate, like water and oil, and they don't naturally mix, like soap and dirt). Over time, the heavier particles will settle at the bottom of the flask. This seems like a decrease in overall entropy to me. However, since potential energy was unleashed when sinking in the flask, it still isn't obvious that this violates any fundamental principle.
So, my next thought is whether or not there is a way to re-capture the heat dispersed while the particles decrease their potential energy through settling, and then use that heat to rotate the cube 90 degrees so that the particles will be level with where they started, which would use up the exact same amount of energy, since their center of mass would be at the same height:
 
(Aside: the particles would only remain on the left edge of the container for a moment - then they would again start settling back down to the bottom.) Since we want to re-capture as much energy as possible, let's use a Carnot engine. We'll situate our cube in a somewhat large, cold container. A thermally isolating barrier will be erected between the cube and the container, and only a Carnot engine will connect the two. We wait for the particles in the cube to settle down, hence giving off heat, which is initially trapped in the cube. We then turn on the engine, and extract a fraction $ \eta $ of the heat dispersed by the settling particles. The formula for $ \eta $ in a general Carnot engine is:
$ \eta = \frac{T_{H}^{*} - T_{C}}{T_{H}^{*}} = 1 - \frac{T_{C}}{T_{H}^{*}} $
Where $ T_{H}^{*} $ is the heat of the cube after settling and $ T_{C} $ is the temperature of the outside fluid, which is assumed to be the same as the temperature of the cube at the start of the experiment. How good can $ \eta $ get? While it would be tricky/impossible to get $ T_{H}^{*} $ arbitrarily large, it wouldn't be too hard to get $ T_{C} $ arbitrarily small. If we take the limit as $ T_{C} $ goes to absolute zero, we'll get infinitesimally close to $ 100\% $ of our energy back! It doesn't matter that $ \eta $ isn't exactly $ 100\% $ - an infinitesimal loss of energy won't explain the finite drop in entropy. We can have, say, a very tiny spring handy to push the cube the last little bit. A diagram of how this machine would work might look like:

Where:


*

*The circular material is the friction-less insulator that separates the cube from the surrounding fluid.

*The square is our cubical flask.

*The dots are the heavier particles (I haven't drawn the lighter particles they displace)

*The four circles connecting the cube with the outside fluid are four Carnot engines. They are initially off. There are four so that the whole rotating chamber (everything inside the circular insulator) is equally balanced, except for the particles.

*red illustrates where (all but infinitesimal leaks of) the energy goes.

*$ \epsilon $ is the temperature of the cube and the surrounding liquid after the Carnot engines extract the heat from the inner cube. $ \eta $ isn't exactly $ 100 \% $, and hence some small energy will remain untapped. 

*$ 4 \delta $ is the amount of energy not extracted.

*$ m^{*} $ is the mass of one of the heavier particles minus one of the lighter particles.

*$ g $ is the acceleration due to gravity.

*$ h $ is the average of the distances the particles fall - that is, half the side length of the cube.  


(Thus, between these last three points, $ m^{*} g h $ is the amount of energy unleashed as the particles fall)


*

*The mechanism used to convert $ m^{*} g h $ energy into the rotation of the chamber isn't shown, but should be pretty basic.


To me, it seems that this machine finitely decreases entropy at an infinitesimal loss of energy. What's gone wrong with my reasoning? Any clarification will be greatly appreciated!
 A: As comments have a way of disappearing in this site I am giving an answer of sorts:

Over time, the heavier particles will settle at the bottom of the flask. 

Wrong. Over time the  particles with the highest density will settle down first, and the ones less dense will settle on top. The dense could be dust of uranium for example. It is buoyancy that works in liquids.
From the link:

an object whose density is greater than that of the fluid in which it is submerged tends to sink. 

The definition of entropy:

Most understand entropy as a measure of molecular disorder within a macroscopic system. The second law of thermodynamics states that an isolated system's entropy never decreases. Such a system spontaneously evolves towards thermodynamic equilibrium, the state with maximum entropy.

The Carnot engine:

It is easily shown that the efficiency ,eta, is maximum when the entire cyclic process is a reversible process. This means the total entropy of the total system consisting of the three parts: the entropy of the hot furnace, the entropy of the "working fluid" of the Heat engine, and the entropy of the cold sink. The total entropy of the system remains constant when the "working fluid" completes one cycle and returns to its original state. (In the general case, the total entropy of this combined system would increase in a general irreversible process).

From the question:

(Thus, between these last three points, m∗gh

is the amount of energy unleashed as the particles fall)
Not really, as buoyancy plays its part too, depending on density of the particles.

The mechanism used to convert m∗gh energy into the rotation of the chamber isn't shown, but should be pretty basic.

As the efficiency is less than 1 or at most 1, at best the entropy will stay the same. Otherwise it will be increasing due to balancing angular momentum ( rotation is introduced) and the heat emitted by your "pretty basic " mechanism.
A: 
Over time, the heavier particles will settle at the bottom of the flask. This seems like a decrease in overall entropy to me. 

The original state where the density is uniform over the system is not an equilibrium state. In thermodynamics, such states do not have entropy, so you cannot compare entropy before and after.
If we extend the definition of entropy so that it applies locally to infinitesimal element of the system, we can define entropy of system even for the initial state - as integral of density of entropy over the volume. I think it is very likely that value of this entropy will be lower than the entropy of the final equilibrium state. It is true that density of gases gets inhomogeneous, but entropy is connected to volume of compatible phase space, not volume of configuration space. It is quite possible that localization of probability density in configuration space gets more than balanced by its dispersal in the momentum space (after the system equilibrates, the molecules have higher total kinetic energy and momenta have wider distribution). To be sure, though, you need to work out the calculation of the entropy integral for the original state, calculate entropy of the final state and compare the two.
