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 \(\mathbf{D_f}\) that can be applied as a matrix-vector product to a discrete vector \(\mathbf{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.

(n_cells, n_faces) scipy.sparse.csr_matrix

The numerical divergence operator from faces to cell centers


In continuous space, the divergence operator is defined as:

\[\phi = \nabla \cdot \vec{u} = \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} + \frac{\partial u_z}{\partial z}\]

Where \(\mathbf{u}\) is the discrete representation of the continuous variable \(\vec{u}\) on cell faces and \(\boldsymbol{\phi}\) is the discrete representation of \(\phi\) at cell centers, face_divergence constructs a discrete linear operator \(\mathbf{D_f}\) such that:

\[\boldsymbol{\phi} = \mathbf{D_f \, u}\]

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:

\[\phi_i = \frac{1}{V_i} \sum_{k \in K} A_k \, \vec{u}_k \cdot \hat{n}_k\]

where \(V_i\) is the volume of cell \(i\), \(A_k\) is the surface area of face k, \(\vec{u}_k\) is the value of \(\vec{u}\) on face k, and \(\hat{n}_k\) represents the outward normal vector of face k for cell i.