File: mesh_quality.tex

package info (click to toggle)
code-saturne 6.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 63,340 kB
  • sloc: ansic: 354,724; f90: 119,812; python: 87,716; makefile: 4,653; cpp: 4,272; xml: 2,839; sh: 1,228; lex: 170; yacc: 100
file content (121 lines) | stat: -rw-r--r-- 5,806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
%-------------------------------------------------------------------------------

% This file is part of Code_Saturne, a general-purpose CFD tool.
%
% Copyright (C) 1998-2019 EDF S.A.
%
% This program is free software; you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free Software
% Foundation; either version 2 of the License, or (at your option) any later
% version.
%
% This program is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
% details.
%
% You should have received a copy of the GNU General Public License along with
% this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
% Street, Fifth Floor, Boston, MA 02110-1301, USA.

%-------------------------------------------------------------------------------

\nopagebreak

\section*{Flagging of bad cells\label{sec:bad_cells}}

\hypertarget{badcells}{}

No current meshing tool that we know of is capable of generating a complex mesh
in reasonable time without some cells of bad ``quality''.
To reduce the number of iterations required to obtain an acceptable mesh, we may
try to flag the few bad quality cells that are considered almost unavoidable, so
as to limit their impact on the solver's robustness.

As of the current version of \CS, no specific treatment is done, but ``bad cells''
are marked, so as as to allow the user to know where to expect issues with the mesh.

By default, the mesh quality is inspected at the very beginning of every
calculation. The estimated quality is defined by at least five criteria:

\begin{itemize}
\item[$\bullet$] the cell's non-orthogonality,
\item[$\bullet$] the cell's offset,
\item[$\bullet$] the cell's distorsion (or least-squares gradient criteria),
\item[$\bullet$] the cell's volume ratio,
\item[$\bullet$] ``guilt by association'',
\item[$\bullet$] and possibly supplementary user criteria.
\end{itemize}

Supplementary user criteria will not be discussed here but an example of how to
define them is provided in the user subroutine \texttt{cs\_user\_mesh.c}.\\

As a rule of thumb users need to be aware that bad cells could lead to a
degradation of the solution quality, or worse, to a failed calculation.
Generally, a cell quality is degraded by non-conforming joining operations, especially
when joined cells have different sizes or thicknesses, but even painstakingly
built block-structured meshes may have cells of bad quality when they involve
a combination of warping, anisotropy and refinement variation.

See the \doxygenfile{cs__mesh__bad__cells_8c.html}{programmers reference of the dedicated subroutine}
for further details.

\subsection*{Cell non-orthogonality}

For a finite volume solver, the mesh cells should be as ``orthogonal'' as
possible. Consequently, the compliance with this criterion is of particular
interest in order to avoid the degradation of the solution quality.

A cell's non-orthogonality relative to a face is evaluated as:
\begin{equation}
Q^{ortho}_{\fij} = \dfrac{\vect{\centi\centj} \cdot \vect{S}_{\ij}}{\norm{\vect{\centi \centj}} ~ \norm{\vect{S}_{\ij}}}
\end{equation}
where $\vect{\centi\centj}$ is a distance vector between two consecutive cell centers and
$\vect{S}_{\ij}$ is the surface vector normal to the face.

Orthogonal cells have a value of $Q^{ortho}_{\face}$ which tends towards $1.0$ for all the faces.
Therefore, a cell is flagged bad if $Q^{ortho}_{\face} < 0.1$ for any of its faces.

\subsection*{Cell offset}

A cell's offset (relative to a face) is evaluated in a manner consistent with
iterative gradient recontruction:
\begin{equation}
Q^{offset}_{\fij} = 1 - \sqrt[3]{\dfrac{ \norm{\vect{\cento \centf}} \norm{ \vect{S}_{\ij}}}{ \norm{\vol{\celli}} }}
\end{equation}
where $\vol{\celli}$ is the cell's volume, $\vect{S}_{\ij}$ is the surface normal to the face, and
$\vect{\cento \centf}$ is the difference between the face's center and its
intersection with the segment joining adjacent cell centers.

Orthogonal cells have a value of $Q^{offset}$ which tends towards $1.0$.
Therefore, a cell is flagged bad if $ Q^{offset} < 0.1$ for any of its faces.

\subsection*{Cell distorsion}

This criterion evaluates a distorsion level based on least squares gradient
computation. As a first step, the geometric matrix containing information on distance
vectors between neighboring cells is built (see the construction of the C matrix
in the least squares gradient computation for more details). In a second step,
the matrix's eigenvalues are estimated using a Jacobi transformation method.
The min/max eigenvalues ratio is used as the cell's distorsion criteria:
\[Q_{LSQ} = \frac{min(|C_{egv}|)}{max(|C_{egv}|)}\]
where \(C_{egv}\) are the eigenvalues of the geometric matrix build according to
the least squares gradient computation.\\
Cubic cells have a value of \(Q_{LSQ}\) which tends towards $1.0$.
Therefore, a cell is flagged bad if \(Q_{LSQ} < 0.1\).

\subsection*{Cell volume ratio}

A cell's volume ratio criteria gives an estimation of cell's caracteristic size
continuity. It is evaluated as:
\[Q_{vol} = min\left(\frac{V_{1}}{V_{2}}, \frac{V_{2}}{V_{1}}\right)\]
where \(V_{1}\) and \(V_{2}\) are the respective volumes of two neighboring cells.\\
Neighboring cells with the same size have a value of \(Q_{vol}\) which tends
towards $1.0$.
Therefore, two neighboring cells are flagged bad if \(Q_{vol} < 0.1^{2}\).

\subsection*{Guilt by association}

Once we have finished with determining which cells are flagged "bad", the last
step is to mark initially ``good'' cells (according to the above criteria) as
``bad'' when all their neighbors are flagged ``bad''.