Previous | ToC | Up | Next |
Bob: I could see that you were not too impressed with my quiet start.
However, I expect that you may be more interested in a more important
improvement I would like to make, the center of mass adjustment.
Alice: Indeed. I think it would be better to shift to a coordinate
system in which the newly created star cluster has its center of mass
in the origin of the coordinate system. In addition, it would be nice
to give the coordinate system a boost in such a way that the velocity
of the center of mass is zero in that coordinate system. Is this what
you had in mind?
Bob: Exactly. It would of course be possible to sprinkle particles
in space, and in velocity space, in pairs, so that you would cancel
the contributions: you could place them at opposite sides of the center,
and give them opposite velocities. But that would create artificial
correlations, and I don't like to do that. Better to create a realization
first, and then to shift the coordinate system in the way you suggested.
After creating our model, we measure the center of mass position
and similarly for the velocity of the center of mass, which I will call
vel_com in the code:
If we then subtract
Here is a straightforward implementation, in file mkplummer5.rb.
At the end of the mkplummer, after all the work is done, I am adding
a line:
which invokes the following method:
Alice: Straightforward indeed. Normally you would have to divide
the positions and the velocities by the total mass, but here the
total mass is unity, so you can skip that. Okay, that looks good,
but as always, let's first do a couple checks.
Bob: Never hurts. Here they are. First the energy:
Hmm, a bit less quiet than before, it seems. Let me try a few more:
Alice: Yes, that must be the reason. Well, that's the price you have to pay
for preventing your model for being off-center!
Bob: Perhaps layering was not such a hot idea after all. Oh, well.
I may as well leave it in, for now.
11. Centering
11.1. Center of Mass Adjustment
, which I will name pos_com in the
code, as follows:
from each particle's
position, and also subtract
from each particle's
velocity, we will be guaranteed that
. This is then the shift that
we ordered.
11.2. Implementation
|gravity> kali mkplummer5.rb -n 1000 | kali energy.rb
==> Plummer's Model Builder <==
Number of particles : N = 1000
pseudorandom number seed given : 0
Screen Output Verbosity Level : verbosity = 1
ACS Output Verbosity Level : acs_verbosity = 1
Floating point precision : precision = 16
Incremental indentation : add_indent = 2
actual seed used : 102454465076170166590054456817370041259
E_kin = 0.249 , E_pot = -0.499 , E_tot = -0.251
That certainly looks fine. Now the quartiles:
|gravity> kali mkplummer5.rb -n 100 | kali quartiles.rb
==> Plummer's Model Builder <==
Number of particles : N = 100
pseudorandom number seed given : 0
Screen Output Verbosity Level : verbosity = 1
ACS Output Verbosity Level : acs_verbosity = 1
Floating point precision : precision = 16
Incremental indentation : add_indent = 2
actual seed used : 200676475510777406202831945260956218951
The values of the three quartiles for r(M) are:
r(1/4) = 0.4624
r(1/2) = 0.7879
r(3/4) = 1.283
11.3. A Bit Disquieting
|gravity> kali mkplummer5.rb -n 100 | kali quartiles.rb
==> Plummer's Model Builder <==
Number of particles : N = 100
pseudorandom number seed given : 0
Screen Output Verbosity Level : verbosity = 1
ACS Output Verbosity Level : acs_verbosity = 1
Floating point precision : precision = 16
Incremental indentation : add_indent = 2
actual seed used : 99631758195921206451479458186316084502
The values of the three quartiles for r(M) are:
r(1/4) = 0.5536
r(1/2) = 0.8253
r(3/4) = 1.299
|gravity> kali mkplummer5.rb -n 100 | kali quartiles.rb
==> Plummer's Model Builder <==
Number of particles : N = 100
pseudorandom number seed given : 0
Screen Output Verbosity Level : verbosity = 1
ACS Output Verbosity Level : acs_verbosity = 1
Floating point precision : precision = 16
Incremental indentation : add_indent = 2
actual seed used : 41391745497524075502477861292072449084
The values of the three quartiles for r(M) are:
r(1/4) = 0.5362
r(1/2) = 0.7709
r(3/4) = 1.263
Definitely less quiet than before. How can shifting . . . ah, shifting
the center of mass also shifts the positions of my idealized mass shells
which provided the scaffolding for sprinkling particles in such a nicely
layered way. Of course!
Previous | ToC | Up | Next |