Skip to main content
`Ctrl`+`K`

# DMPlexComputeOrthogonalQuality

Compute cell-wise orthogonal quality mesh statistic. Optionally tags all cells with orthogonal quality below given tolerance.

## Synopsis

    #include "petscdmplex.h"
    PetscErrorCode DMPlexComputeOrthogonalQuality(DM dm, PeOp PetscFV fv, PetscReal atol, Vec *OrthQual, DMLabel *OrthQualLabel)

Collective

## Input Parameters

- dm - The `DMPLEX` object

- fv - Optional `PetscFV` object for pre-computed cell/face centroid information

- atol - [0, 1] Absolute tolerance for tagging cells.

## Output Parameters

- OrthQual - `Vec` containing orthogonal quality per cell

- OrthQualLabel - `DMLabel` tagging cells below atol with `DM_ADAPT_REFINE`

## Options Database Keys

- -dm_plex_orthogonal_quality_label_view - view OrthQualLabel if label is requested. Currently only `PETSCVIEWERASCII` is supported.

- -dm_plex_orthogonal_quality_vec_view - view OrthQual vector.

## Notes

Orthogonal quality is given by the following formula:

\( \min \left[ \frac{A_i \cdot f_i}{\|A_i\| \|f_i\|} , \frac{A_i \cdot c_i}{\|A_i\| \|c_i\|} \right]\)

Where A_i is the i’th face-normal vector, f_i is the vector from the cell centroid to the i’th face centroid, and c_i is the vector from the current cells centroid to the centroid of its i’th neighbor (which shares a face with the current cell). This computes the vector similarity between each cell face and its corresponding neighbor centroid by calculating the cosine of the angle between these vectors.

Orthogonal quality ranges from 1 (best) to 0 (worst).

This routine is mainly useful for FVM, however is not restricted to only FVM. The `PetscFV` object is optionally used to check for pre-computed FVM cell data, but if it is not passed in then this data will be computed.

Cells are tagged if they have an orthogonal quality less than or equal to the absolute tolerance.

## See Also

DMPlex: Unstructured Grids, `DM`, `DMPLEX`, `DMPlexCheckCellShape()`, `DMCreateLabel()`, `PetscFV`, `DMLabel`, `Vec`

## Level

intermediate

## Location

src/dm/impls/plex/plex.c

## Examples

src/dm/impls/plex/tutorials/ex9.c

Index of all DMPlex routines
Table of Contents for all manual pages
Index of all manual pages