discretize.TreeMesh.average_cell_to_face#

TreeMesh.average_cell_to_face#

Averaging operator from cell centers to faces (scalar quantities).

This property constructs an averaging operator that maps scalar quantities from cell centers to face. This averaging operator is used when a discrete scalar quantity defined cell centers must be projected to faces. Once constructed, the operator is stored permanently as a property of the mesh. See notes.

Returns:
(n_faces, n_cells) scipy.sparse.csr_matrix

The scalar averaging operator from cell centers to faces

Notes

Let ϕc be a discrete scalar quantity that lives at cell centers. average_cell_to_face constructs a discrete linear operator Acf that projects ϕc to faces, i.e.:

ϕf=Acfϕc

where ϕf approximates the value of the scalar quantity at the faces. For each face, we are performing a weighted average between the values at adjacent cell centers. In 1D, where adjacent cells i and i+1 have widths hi and hi+1, ϕ on face is approximated by:

ϕi+1/2hi+1ϕi+hiϕi+1hi+hi+1

On boundary faces, nearest neighbour is used to extrapolate the value from the nearest cell center. Once the operator is construct, the averaging is implemented as a matrix vector product, i.e.:

phi_f = Acf @ phi_c