The two-charge potential of this chapter is to be evaluated on a grid of nodes in binary64
PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Scientific programming for physicists · Scientific programming for physicists
Computational Physics, Ch Arrays: a field is a rectangle of numbers
Problem
The two-charge potential of this chapter is to be evaluated on a grid of 6000×6000 nodes in binary64. The distance arrays r1 and r2 are built first and stay in place, and the field is returned by k*q1/r1 + k*q2/r2. Take 1MB to be 106 bytes.
((a)) State the memory one full grid of these numbers occupies.
((b)) Count the full grids that are alive at the peak of that return expression, taking each of the two contributions to be built as an array of its own and the sum to be written back into one of them rather than into a further array, and state the peak memory in MB.
((c)) Keeping that same count of grids, find the largest square grid of side N whose evaluation fits in 2GB, that is 2×109 bytes.