Oscillation of Chocolate bar on soda Why does a piece of chocolate bar oscillate in soda (i.e. floats then after a while sinks and vice versa)? What parameters does the period of oscillation rely on? Is there a specific formula that describes the period?
 A: This is basically an engine powered by pressure and gravity*. As nluigi pointed out, what happens is that bubbles form on the chocolate, make it buoyant, move it to the surface where they burst, the chocolate sinks, and the process repeats. 
Can we specify the parameters and make a model? The most obvious ones are the density of the drink $\rho_d$, the chocolate $\rho_c$ and the bubbles $\rho_b$. The volume of the chocolate is $V_c$ and the bubbles $V_b(t)$. The force on the chocolate will be $$F=-g\left[(\rho_c-\rho_d)V_c + (\rho_b - \rho_d)V_b(t)\right] -kz'(t)$$ where $k$ is a drag term resisting the motion of the chocolate which is at depth $z(t)$ (the scale is so small here that the Reynolds number makes the drag linear rather than quadratic in velocity). Since $\rho_d>\rho_b$ the second term will push the chocolate upward, while first term will push it down if $\rho_c>\rho_d$. 
We can turn this into an equation of motion by dividing by the mass of the chocolate $\rho_cV_c$: $$z''(t)=-g\left[\frac{\rho_c-\rho_d}{\rho_c} + \frac{\rho_b-\rho_d}{\rho_c}\frac{V_B(t)}{V_c}\right ] - kz'(t)$$
Were the bubble size constant this is basically the equation $v'(t)=c-kv(t)$ with solution $v(t)=(c/k) - (A/k)\exp(-kt)$ where $A$ is a constant set by the initial condition. For $A=c$ the chocolate starts from zero velocity, and after a short time ($\approx 1/k$) approaches terminal velocity $c/k$. Incidentally, this is very visible if you look at streams of bubbles from flaws in the glass: the distance between subsequent bubbles first increases as they accelerate, but then becomes constant as they reach terminal velocity.
How do the bubbles grow? This is not entirely trivial. Larger bubbles will have greater surface area to absorb carbon dioxide, and surface tension will be less strong. But they also crowd each other out, and as the chocolate rises the lower pressure will make them grow a bit (although the later effect is negligible in a normal glass). Following Peters above a linear radial growth over time might be reasonable, making $V_b(t)=k_2 t^3$ from the moment bubbles show up, and $k_2$ dependent on how carbonated the drink is, temperature, geometry etc.
Now we can make a simple dynamical system by taking the above equation for the acceleration and combine with the bubble growth. We still have to simplify the bubble release process. We can model it as a certain time $T$ to lose all bubbles. Now if we start time just as all bubbles are gone and the chocolate begins to sink, we have:$$z(0)=0,$$ $$z'(0)=0,$$ $$z''(t)=-g\left[\frac{\rho_c-\rho_d}{\rho_c} + \frac{\rho_b-\rho_d}{\rho_c}\frac{k_2 t^3}{V_c}\right ] - kz'(t).$$
$\rho_c= 1280$, $\rho_d=1050$ (Tonic Water), $\rho_b =1.98$, $V_c = 10^{-7}$, $k=1.8850\cdot 10^{-4}$, $k_2=10^{-6}$.">
Above, model trajectory with $\rho_c= 1280$ (medium chocolate), $\rho_d=1050$ (Tonic Water), $\rho_b =1.98$, $V_c = 10^{-7}$, $k=1.8850\cdot 10^{-4}$, $k_2=10^{-6}$.
At first the first term matters most, making the chocolate accelerate down. If $k_2$ is very small the piece would reach terminal velocity and eventually reach the bottom of the glass where it would come to rest. At some point the second term will become dominant, forcing the acceleration upwards. The third term will try to resist, again limiting speed. But eventually $z(t)=0$ and the bubbles get released, and a new cycle begins after time $T$.
The relevant equation in terms of velocity is $v'(t)=\alpha+\beta t^3 -kv$ where $\alpha=-g\frac{\rho_c-\rho_d}{\rho_c}$ and $\beta=-g\frac{\rho_b-\rho_d}{\rho_c}\frac{k_2 }{V_c}$. This has an explicit solution that can be integrated to give $$z(t)=\left(\frac{\alpha}{k}-\frac{6\beta}{k^4}\right )t +\frac{3\beta}{k^3}t^2 -\frac{\beta}{k^2}t^3 +\frac{b}{4k}t^4 +\left(\frac{6\beta}{k^4}-\frac{\alpha}{k}\right)e^{-kt}$$ (assuming I got the algebra right). This describes the orbit. The period of the oscillation is the first $t>0$ solution of the equation plus the surface delay $T$. 
Unfortunately $z(t)=0$ by this formula has no closed form solution (it is nearly a quartic, so one can approximate using that complex formula), so one needs to solve it numerically. But we can see how it depends on the different densities and volumes, the carbonation level, plus the drag term through $\alpha, \beta, k$.

Period of the sinking and surfacing for different values of $k_2$. Note that for large values the period is short but the maximum depth achieved is very small; the chocolate is basically flopping near the surface rather than sinking. 


*

*The work done comes from the pressure difference between the partial pressure of CO$_2$ in the drink and in the outside atmosphere (as pointed out by Daniel Sank), plus packing the soda deeper in the potential well as light carbon dioxide separates into bubbles and moves to the top, dragging the chocolate with it. We can estimate the work in blowing up a bubble as $W_{pressure}=(p_{dCO2}-p_{aCO2})V_b$ where $p_{aCO2}=39$ Pa is the atmosphere partial pressure and $p_{dCO2}\approx 4p_{aCO2}$ is the dissolved gas partial pressure. For $V_B=10^{-7}$ $W_{pressure}=1.1700\cdot 10^{-5}$ J. The work released by a bubble moving up is $W_{gravity}=gz(\rho_d - \rho_b)V_b$, which for a 10 cm glass is $W_{gravity}=1.0292\cdot 10^{-4}$ J. So for these assumptions gravity is doing more work, but this will not be true for a lower glass.

