Skip to main content

compute_face_metrics

Function compute_face_metrics 

Source
pub fn compute_face_metrics(block: &Block) -> FaceMetrics
Expand description

Compute projected face-area vectors for all three face families.

§I-faces (constant-i surfaces)

An I-face at index (i, j, k) is the quadrilateral formed by the 4 nodes:

  (i, j, k),  (i, j+1, k),  (i, j+1, k+1),  (i, j, k+1)

There are ni such faces in the i-direction (including the two boundary faces at i=0 and i=ni-1), and (nj-1) * (nk-1) faces in each i-plane, giving ni * (nj-1) * (nk-1) I-faces total.

The area vector is:

  S_i = 0.5 * (diag1 x diag2)

where the diagonals connect opposite corners of the quad. The sign convention points S_i in the +i direction (from cell i-1 to cell i).

§J-faces and K-faces

Analogous construction for j-constant and k-constant surfaces.

§Indexing

Within each family the flat index is i-fastest:

  • I-face (i,j,k): i + ni * j + ni * (nj-1) * k with i in 0..ni, j in 0..nj-1, k in 0..nk-1

  • J-face (i,j,k): i + (ni-1) * j + (ni-1) * nj * k with i in 0..ni-1, j in 0..nj, k in 0..nk-1

  • K-face (i,j,k): i + (ni-1) * j + (ni-1) * (nj-1) * k with i in 0..ni-1, j in 0..nj-1, k in 0..nk