discretize.TreeMesh.nodal_gradient#
- TreeMesh.nodal_gradient#
Nodal gradient operator (nodes to edges)
This property constructs the 2nd order numerical gradient operator that maps from nodes to edges. The operator is a sparse matrix
that can be applied as a matrix-vector product to a discrete scalar quantity that lives on the nodes, i.e.:grad_phi = Gn @ phi
Once constructed, the operator is stored permanently as a property of the mesh.
- Returns:
- (
n_edges
,n_nodes
)scipy.sparse.csr_matrix
The numerical gradient operator from nodes to edges
- (
Notes
In continuous space, the gradient operator is defined as:
Where
is the discrete representation of the continuous variable on the nodes and is the discrete representation of on the edges, nodal_gradient constructs a discrete linear operator such that:The Cartesian components of
are defined on their corresponding edges (x, y or z) as follows; e.g. the x-component of the gradient is defined on x-edges. For edge which defines a straight path of length between adjacent nodes and :Note that
may correspond to a value on an x, y or z edge. See the example below.