discretize.TreeMesh.face_divergence#

TreeMesh.face_divergence#

Face divergence operator (faces to cell-centres).

This property constructs the 2nd order numerical divergence operator that maps from faces to cell centers. The operator is a sparse matrix Df that can be applied as a matrix-vector product to a discrete vector u that lives on mesh faces; i.e.:

div_u = Df @ u

Once constructed, the operator is stored permanently as a property of the mesh. See notes for additional details.

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

The numerical divergence operator from faces to cell centers

Notes

In continuous space, the divergence operator is defined as:

ϕ=u=uxx+uyy+uzz

Where u is the discrete representation of the continuous variable u on cell faces and ϕ is the discrete representation of ϕ at cell centers, face_divergence constructs a discrete linear operator Df such that:

ϕ=Dfu

For each cell, the computation of the face divergence can be expressed according to the integral form below. For cell i whose corresponding faces are indexed as a subset K from the set of all mesh faces:

ϕi=1VikKAkukn^k

where Vi is the volume of cell i, Ak is the surface area of face k, uk is the value of u on face k, and n^k represents the outward normal vector of face k for cell i.