# Building Geometry Simplification for Improving Mesh Quality of Numerical Analysis Model
## 3 Mesh Quality  
In FVM analysis, the differential equation of the physical phenomena needs to be discretized for the control volume (i.e., a cell in the mesh). For example, the conservation equation of the variable \(\phi\) in the steady-state condition is as follows [23]:  
\[\underbrace{\int_{V_{C}}\
abla\cdot(\overrightarrow{v}\phi)dV}_{\text{Convection term}}=\underbrace{\int_{V_{C}}\
abla\cdot(\Gamma_{\phi}\
abla\phi)dV}_{\text{ Diffusion term}}+\underbrace{\int_{V_{C}}Q_{\phi}dV}_{\text{Source term}} \tag{1}\]  
where \(V_{C}\) is the control volume, \(\overrightarrow{v}\) is the velocity vector, \(\Gamma\) is the diffusivity coefficient, and \(Q\) is the source.  
Figure 1 illustrates an approximation of the equation for the analysis of the conservation equation for the two given cells, as shown in Equations (2)-(4).  
\[\sum_{f}{(a_{f}\overrightarrow{n_{f}})\cdot(\overrightarrow{v}\phi_{f})}=\sum _{f}{(a_{f}\overrightarrow{n_{f}})\cdot(\Gamma_{\phi}\
abla\phi_{f})}+V_{C}Q _{\phi} \tag{2}\]  
\[\phi_{f_{i}}=f_{x}\phi_{P}+(1-f_{x})\phi_{Q} \tag{3}\]  
\[f_{x}=\frac{|Q-f_{i}|}{|Q-P|} \tag{4}\]  
where \(a_{f}\) is the area of face \(f\), and \(f_{x}\) is the interpolation factor.  
Equation (2) is the result obtained by approximating the surface integral of \(\phi\) through the flux of the surface. As the FVM stores the values of the cell center (\(\phi_{P}\) and \(\phi_{Q}\)), the value representing the face where the two cells are in contact (\(\phi_{f}\)) is approximated to the value of the point \(f_{i}\) (\(\phi_{f_{i}}\)) (Equation (3)). However, this equation assumes that the normal vector of \(f\) is parallel to the vector between the centers of the two cells (\(\overrightarrow{n}_{f}\parallel\overrightarrow{s}_{f}\)), and that the point \(f_{i}\) represents the face (\(f_{i}=f_{c}\)). Numerical errors and diffusion exist for cells that do not match the abovementioned assumptions, as shown in Figure 1. To evaluate the error, the mesh quality is evaluated based on the non-orthogonality (\(\theta\)) and skewness (\(\epsilon\)) as follows:  
\[\theta=\angle(\overrightarrow{s}_{f},\ \overrightarrow{n}_{f})=\cos^{-1} \left(\frac{\overrightarrow{s}_{f}\cdot\overrightarrow{n}_{f}}{| \overrightarrow{s}_{f}|\times|\overrightarrow{n}_{f}|}\right) \tag{5}\]  
\[\epsilon=\frac{|\overrightarrow{r}_{f}|}{|\overrightarrow{s}_{f}|}=\frac{| f_{i}-f_{c}|}{|P-Q|} \tag{6}\]  
The non-orthogonality and skewness are metrics that are used to evaluate the deviation of the mesh from each assumption. The lower the values of both metrics, the higher the mesh quality. A mesh with high values for both metrics not only has a large error, but is also likely to experience numerical diffusion in the process of the numerical analysis. Both metrics are evaluated for all adjacent cells of the designed mesh. As a small number of low-quality meshes can affect the convergence and error of the entire model, the mesh quality of the model is generally evaluated based on the maximum value. The mesh quality that is recommended in OpenFOAM, which is an open source CFD software, is a maximum non-orthogonality \(70^{\circ}\) and a maximum skewness \(4.0\)[24].  
The type of polyhedron for the cells also influences the numerical error. A cell is classified by the type of polyhedron, e.g., hexahedron and tetrahedron. Tetrahedron cells are easy to design, but are known to cause numerical errors and diffusion because of their low quality [25; 26]. In contrast, hexahedron cells have advantages in terms of their accuracy and computational efficiency in analysis, although it is difficult to design high-quality cells in the case of complex geometries [7; 9]. In addition, with hexahedron cells, a mesh containing a relatively small number of cells can be designed, thereby reducing the computational cost of the numerical analysis.