Monday, 07/24: Writing a pm-code - AIP
Monday, 07/24: Writing a pm-code - AIP
Monday, 07/24: Writing a pm-code - AIP
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
PM: main <strong>code</strong> blocks 26<br />
Solving the Poisson equation<br />
With the grid of densities, ρ i,j,k , in hand, the <strong>code</strong> can proceed to solve the<br />
discretized 7 Poisson equation<br />
˜∇ 2 ˜φ ≈ ˜φi−1,j,k + ˜φ i+1,j,k + ˜φ i,j−1,k + ˜φ i,j+1,k + ˜φ i,j,k−1 + ˜φ i,j,k+1 − 6 ˜φ i,j,k =<br />
= 3 Ω 0<br />
2 a (˜ρ i,j,k − 1).<br />
The discretization thus results in a large system of linear equations relating<br />
unknowns, ˜φ i,j,k , to the known right hand side values. This system can be<br />
solved using FFT.<br />
7 It is customary in PM <strong>code</strong>s to discretize the Laplacian operator using the 7-point template.