Tuesday, April 12, 2011

Trouble with energies resolved

Some time ago, when I had a discussion with Jerry about how to find the density maximum.  He was confused about why the density maximum was not located at the median position, and also what was causing symmetry to be lost.  This led him to write an independent code to solve the problem.  His code does not explicitly enforce symmetry (he does particle pushes on both sides of zero).  However as far as we have been able to tell, the density maximum remains at x=0 and the particle positions are symmetric (though we have not run to as great a time as I have run Walter's code). 

I have compared most of our results between the two codes, and the good news is, most of the key points are the same in both.  One of my favorites, though (about the energy) showed a discrepancy.  When I plotted the energy versus time plot from the output of Jerry's code (for the same initial conditions), I got the following:


This looks qualitatively different than what I have been getting with Walter's code:


This worried me quite a bit, because you'll note that the tendency of the particles to stay sorted in energy is not true in both versions.  I have spent about a week attempting to track this down, and today Jerry and I used runs with 8 particles each to try and sort out what was going wrong.  We found that although the positions and velocities agreed between the two codes, the energies did not.  This led us to total up

$\sum_{\rm particles} \frac{1}{2}v^2 +p$

And compare it between time steps.  Although the log file shows that energy is conserved (and I think it definitely is), this sum is not the same between time steps.  We discovered that the p being printed should be divided by a factor of two, in other words, if the force is defined as $(M_R-M_L)$ then the potential energy of the ith particle needs to be

$p_i =\sum_{j} \frac{1}{2} \left| x_i - x_j \right|$

This means all the energy plots I have made so far are wrong, and in particular, the monotonicity result is probably going to go away.  I'll remake them tomorrow, and we can see. 

On the bright side, I think that was the only outstanding problem that I knew about regarding the data and simulations.   But it's making me sad, even though the fact that you can SEE the phase mixing in the E vs. T plot is really pretty cool.  Sigh. 

No comments:

Post a Comment