The discrete second derivative is assembled as an matrix acting on the interior grid…
PHYSICS · Multi-part · Fermi University Physics · Mathematical Methods for Physics · Computational Physics · Scientific programming for physicists
Scientific Computing for Physicists, Ch Arrays in memory: layout, cost and the data structures of physical problems
Problem
The discrete second derivative dx2d2ui≈Δx2ui−1−2ui+ui+1 is assembled as an N×N matrix acting on the N=5 interior grid values, with Dirichlet boundaries (the boundary values are not among the unknowns) and grid spacing Δx=0.1m.
((a)) State the nonzero pattern of the matrix and compute nnz from nnz=3N−2.
((b)) Write the CSR arrays data, indices and indptr for this matrix, using 32-bit integers for indices and indptr.
((c)) Using storage=8nnz+4nnz+4(N+1) bytes (float64 values, 32-bit indices), compute the total CSR storage in bytes.