discretize.utils.av#

discretize.utils.av(n)[source]#

Create 1D averaging operator from nodes to cell-centers.

For n cells, the 1D averaging operator from nodes to centerss is sparse, has shape (n, n+1) and takes the form:

\[\begin{split}\begin{bmatrix} 1/2 & 1/2 & & & \\ & 1/2 & 1/2 & & \\ & & \ddots & \ddots & \\ & & & 1/2 & 1/2 \end{bmatrix}\end{split}\]
Parameters:
nint

Number of cells

Returns:
(n, n + 1) scipy.sparse.csr_matrix

The 1D averaging operator from nodes to centers.