discretize.TreeMesh.stencil_cell_gradient_x#

TreeMesh.stencil_cell_gradient_x#

Differencing operator along x-direction to total (including hanging) x faces.

This property constructs a differencing operator along the x-axis that acts on cell centered quantities; i.e. the stencil for the x-component of the cell gradient. The operator computes the differences between the values at adjacent cell centers along the x-direction, and places the result on the x-faces. The operator is a sparse matrix \(\mathbf{G_x}\) that can be applied as a matrix-vector product to a cell centered quantity \(\boldsymbol{\phi}\), i.e.:

diff_phi_x = Gx @ phi

By default, the operator assumes zero-Neumann boundary conditions on the scalar quantity.

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

The stencil for the x-component of the cell gradient