19.01.2015 Views

Monday, 07/24: Writing a pm-code - AIP

Monday, 07/24: Writing a pm-code - AIP

Monday, 07/24: Writing a pm-code - AIP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PM: main <strong>code</strong> blocks 30<br />

After n time steps, a n = a i + n∆a, during the step n + 1, we should have<br />

coordinates ˜x n at a n and momenta ˜p n−1/2 at a n−1/2 = a n − ∆a/2 from the<br />

previous step. Assigning density and solving the Poisson equation gives<br />

potential ˜φ n at a n . For the assumed variables and units, positions and<br />

momenta are updated as follows:<br />

˜p n+1/2 = ˜p n−1/2 + f(a n )˜g n ∆a;<br />

˜x n+1 = ˜x n + a −2<br />

n+1/2 f(a n+1/2)˜p n+1/2 ∆a.<br />

Here, ˜g n = − ˜∇ ˜φ n is acceleration at the particle’s position. This acceleration<br />

can be obtained by interpolating accelerations from the neighboring cell<br />

centers. The latter are given by<br />

˜g x i,j,k = −( ˜φ i+1,j,k − ˜φ i−1,j,k )/2, ˜g y i,j,k = −( ˜φ i,j+1,k − ˜φ i,j−1,k )/2,<br />

˜g z i,j,k = −( ˜φ i,j,k+1 − ˜φ i,j,k−1 )/2.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!