# discretize.TreeMesh.average_edge_to_cell_vector#

TreeMesh.average_edge_to_cell_vector#

Averaging operator from edges to cell centers (vector quantities).

This property constructs the averaging operator that independently maps the Cartesian components of vector quantities from edges to cell centers. This averaging operators is used when a discrete vector quantity defined on mesh edges must be approximated at cell centers. Once constructed, the operator is stored permanently as a property of the mesh.

Be aware that the Cartesian components of the original vector are defined on their respective edges; e.g. the x-component lives on x-edges. However, the x, y and z components are being averaged separately to cell centers. The operation is implemented as a matrix vector product, i.e.:

u_c = Aec @ u_e

Returns:
(dim * n_cells, n_edges) scipy.sparse.csr_matrix

The vector averaging operator from edges to cell centers. Since we are averaging a vector quantity to cell centers, the first dimension of the operator is the mesh dimension times the number of cells.

Notes

Let $$\mathbf{u_e}$$ be the discrete representation of a vector quantity whose Cartesian components are defined on their respective edges; e.g. $$u_x$$ is defined on x-edges. average_edge_to_cell_vector constructs a discrete linear operator $$\mathbf{A_{ec}}$$ that projects each Cartesian component of $$\mathbf{u_e}$$ independently to cell centers, i.e.:

$\mathbf{u_c} = \mathbf{A_{ec}} \, \mathbf{u_e}$

where $$\mathbf{u_c}$$ is a discrete vector quantity whose Cartesian components defined at the cell centers and organized into a 1D array of the form np.r_[ux, uy, uz]. For each cell, and for each Cartesian component, we are simply taking the average of the values defined on the cell’s corresponding edges and placing the result at the cell’s center.