applied sciences

Article Building Geometry Simplification for Improving Mesh Quality of Model

Gwanyong Park 1 , Changmin Kim 1 , Minhyung Lee 1 and Changho Choi 2,* 1 Institution of Green Building and New Technology, Mirae Environment Plan, Seoul 01905, Korea; [email protected] (G.P.); [email protected] (C.K.); [email protected] (M.L.) 2 Department of Architectural Engineering, Kwangwoon University, Seoul 01897, Korea * Correspondence: [email protected]; Tel.: +82-2-972-5645

 Received: 30 June 2020; Accepted: 1 August 2020; Published: 5 August 2020 

Abstract: Numerical analysis, especially the finite volume method (FVM), is one of the primary approaches employed when evaluating a building environment. A complicated geometry can degrade the mesh quality, leading to numerical diffusions and errors. Thus, this study develops and evaluates an automatic building geometry simplification method based on integrating similar surfaces for the geometry of an indoor space. A regression model showed that the complexity of the simplified geometry and its similarity to the original geometry decreased linearly with the threshold of the method. The mesh quality was significantly improved by the simplification. In particular, the maximum skewness decreased exponentially with the threshold of the method. It is expected that the simplification method and regression model presented in this study can be used to quantitatively control the mesh quality.

Keywords: automation; building model; geometry simplification; finite volume method; mesh quality; model design

1. Introduction The finite volume method (FVM) is commonly used to perform numerical analysis in many fields, including fluid dynamics, owing to its advantages in flux calculations in terms of precision [1]. In the construction field, FVM is used for environmental analyses using computational fluid dynamics (CFD), fire safety analysis [2], and some cases of heat, air, and moisture (HAM) analysis [3,4]. In particular, CFD is widely used in the analysis of aerodynamic environments, e.g., indoor ventilation and micro-environments around occupants [5]. FVM is a method that discretizes and analyzes partial differential equations in the form of algebraic equations. For the computation of algebraic equations, there is a need to divide the target model into finite volumes (“cells”), i.e., to design the mesh. During the mesh design process, a discretization error can occur, and the size of the error is affected by the geometry of the finite volume. Discretization errors not only reduce the accuracy of the , but also cause numerical diffusion, which interferes with the convergence of the simulation. The accuracy and stability of the numerical analysis are quantitatively evaluated using a mesh quality that is calculated based on the geometry of cells [6,7]. The mesh quality of an FVM model is typically evaluated according to the non-orthogonality and skewness. Non-orthogonal cells and skewed cells that are generated near complex surfaces are the main sources of numerical errors. In particular, analyses of buoyancy-driven environments, such as those with natural ventilation, are significantly affected by the mesh quality [8,9]. As the fine features and complexity of the geometry adversely affect the mesh design, a geometry simplification is commonly used as a preprocessing step to improve the mesh quality of the model [10]. Among the numerical analysis processes, the simplification of a complex geometry requires a great

Appl. Sci. 2020, 10, 5425; doi:10.3390/app10165425 www.mdpi.com/journal/applsci Appl. Sci. 2020, 10, 5425 2 of 18 deal of manual work and is time-consuming [11]. In addition, the geometry simplification needs to be repeated manually until the target accuracy is achieved. Moreover, the determination of unnecessary geometrical features, simplification methods, and the level of simplification may depend on an analyst’s arbitrary judgment and experience. Therefore, there is a need for an objective automatic geometry simplification method for the FVM analysis and the evaluation of the mesh quality improvement achieved by the simplification. However, most studies that focus on the simplification of building geometries aim to reduce the computational cost in the visualization process, and there have been relatively few studies focusing on numerical analysis. This study proposes a building geometry simplification method for improving the mesh quality of FVM models. The rest of the paper is organized as follows. Section2 discusses previous studies on geometry simplification in the construction industry, and Section3 discusses the mesh quality metrics. Section4 presents the proposed automatic geometry simplification method for FVM analysis, while Sections5 and6 respectively discuss the evaluation method and results obtained showing the effects of the proposed method. Section7 presents the conclusions and recommendations for future research.

2. Literature Review To achieve the automatic simplification of three-dimensional (3D) geometry, the simplification of a surface mesh is commonly used, such as a mesh decimation algorithm. Surface mesh simplification involves partially deleting the vertices constituting the mesh [12], and was developed for models that include several millions of faces and vertices, such as human body geometry. In research studies on the application of numerical analysis in construction, surface mesh simplification has been used primarily to simplify the computer-simulated person (CSP) geometry in indoor environment analysis models [13,14]. However, building geometries consist mainly of planes that are perpendicular or parallel to each other [15]. Therefore, they are expressed as simple surface meshes with hundreds of vertices. If vertices are deleted using the surface mesh simplification algorithm, the geometry may be excessively deformed. Most studies on the simplification of the 3D geometries of buildings have been conducted for the computational optimization of buildings and map visualization. Kada [16] proposed a method for generating a new polyhedron from the major surfaces of the sidewall of a building geometry, and excluded negligible surfaces with small areas. Thereafter, the detailed geometry of the roof was reproduced as post-processing. Rau et al. [17] varied the complexity of a horizontal cross-section of a building, and formed a prism geometry by sweeping the cross-section in the vertical direction to simplify the building model. Similarly, He et al. [18] integrated buildings with similar heights, and simplified them into a prism geometry with a flat roof in order to simplify a set of adjacent buildings. In most cases, the building geometry is composed of walls that are perpendicular or parallel to each other, with little change in the vertical direction. The abovementioned studies presented simplification methods that consider these geometric features of buildings. However, for visualization of the 3D map, only the exterior geometry of the buildings was targeted, and its applicability to indoor models was not evaluated. Owing to the increased usage of file formats such as building information modeling (BIM) and geography markup language (GML) formats, such as CityGML, simplification studies that use the information of individual components of buildings have been conducted for visualization. Zhao et al. [19] integrated building components using morphological operations to perform a simplification. The hierarchical connection information between components was analyzed to determine the components to be integrated. Geiger et al. [20] classified the level of detail of a building according to the steps (section and height, roof and slab, door and window) required for extracting building components from the BIM model. As these methods use the semantic information of buildings, they are dependent on the data format of the building model. Most of these building simplification methods for visualization purposes apply different simplification criteria to the sidewall and roof surfaces, and they determine mainly the exterior properties of the building. As a consistency Appl. Sci. 2020, 10, 5425 3 of 18 and objective criterion of geometric design is required for the analysis of physical phenomena, these methods are not suitable as preprocessing approaches for numerical analyses. Generally, simplification in FVM analysis is performed at the discretion of the researcher, and there have been a limited number of studies regarding the application of an automatic geometry simplification based on consistent criteria. Ayala et al. [21] approximated the sloping roof of an atrium model for a fire safety analysis, and it was in the form of a staircase-shaped polyhedron. The roof was simplified in four levels depending on the scale of the stairs. From a comparison of the simulation results, the temperature error of the simplified model was analyzed, and was found to be less than 10%. The staircase-like polyhedron model has the advantage of having a simple design for a high-quality hexahedron mesh. The aim of the study was to analyze the behavior of smoke. However, if the planar roof is transformed into a staircase geometry, a vortex may be formed near the roof surface, and the resistance to fluid and smoke may increase, unlike the actual geometry. Piepereit et al. [22] proposed a method for integrating the surface of a building with adjacent surfaces by sweeping the surface in the normal direction to analyze an exterior wind environment. The degree of simplification was controlled using a distance threshold in the integration. As a result of the mesh design for the original and simplified models, the maximum skewness was decreased from 0.96 to 0.80, and the number of mesh cells was reduced by 4.4%. However, the proposed method is not deterministic as the faces are removed in an arbitrary order, and it is possible to generate small angles that are difficult for meshing. These studies confirmed the applicability of geometry simplification methods through objective criteria for building FVM models. However, considering that each method was applied to a specific case, there is a need to evaluate the general effects of simplification on the degree of change in the geometry and mesh quality according to an established simplification threshold.

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 φ in the steady-state condition is as follows [23]: Z Z Z (→v φ)dV = (Γφ φ)dV + QφdV (1) VC ∇· VC ∇· ∇ VC | {z } | {z } | {z } Convection term Diffusion term Source term where VC is the control volume, →v is the velocity vector, Γ is the di ff usivity coefficient, and Q is the source. Figure1 illustrates an approximation of the equation for the analysis of the conservation equation for the two given cells, as shown in Equations (2)–(4). X X (a →n ) (→v φ ) = (a →n ) (Γ φ ) + V Q (2) f f · f f f · φ∇ f C φ f f

φ = fxφP + (1 fx)φ (3) fi − Q Q fi f = | − | (4) x Q P | − | where a f is the area of face f , and fx is the interpolation factor. Appl. Sci. 2020, 10, x FOR PEER REVIEW 3 of 18 objective criterion of geometric design is required for the analysis of physical phenomena, these methods are not suitable as preprocessing approaches for numerical analyses. Generally, simplification in FVM analysis is performed at the discretion of the researcher, and there have been a limited number of studies regarding the application of an automatic geometry simplification based on consistent criteria. Ayala et al. [21] approximated the sloping roof of an atrium model for a fire safety analysis, and it was in the form of a staircase-shaped polyhedron. The roof was simplified in four levels depending on the scale of the stairs. From a comparison of the simulation results, the temperature error of the simplified model was analyzed, and was found to be less than 10%. The staircase-like polyhedron model has the advantage of having a simple design for a high-quality hexahedron mesh. The aim of the study was to analyze the behavior of smoke. However, if the planar roof is transformed into a staircase geometry, a vortex may be formed near the roof surface, and the resistance to fluid and smoke may increase, unlike the actual geometry. Piepereit et al. [22] proposed a method for integrating the surface of a building with adjacent surfaces by sweeping the surface in the normal direction to analyze an exterior wind environment. The degree of simplification was controlled using a distance threshold in the integration. As a result of the mesh design for the original and simplified models, the maximum skewness was decreased from 0.96 to 0.80, and the number of mesh cells was reduced by 4.4%. However, the proposed method is not deterministic as the faces are removed in an arbitrary order, and it is possible to generate small angles that are difficult for meshing. These studies confirmed the applicability of geometry simplification methods through objective criteria for building FVM models. However, considering that each method was applied to a specific case, there is a need to evaluate the general effects of simplification on the degree of change in the geometry and mesh quality according to an established simplification threshold.

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 𝜙 in the steady-state condition is as follows [23]:

𝛁⋅(𝒗⃗𝝓)𝒅𝑽 = 𝛁⋅𝜞 𝛁𝝓𝒅𝑽 + 𝑸 𝒅𝑽 𝝓 𝝓 (1) 𝑽𝑪 𝑽𝑪 𝑽𝑪 𝐂𝐨𝐧𝐯𝐞𝐜𝐭𝐢𝐨𝐧 𝐭𝐞𝐫𝐦 𝐃𝐢𝐟𝐟𝐮𝐬𝐢𝐨𝐧 𝐭𝐞𝐫𝐦 𝐒𝐨𝐮𝐫𝐜𝐞 𝐭𝐞𝐫𝐦 where 𝑉 is the control volume, 𝑣⃗ is the velocity vector, 𝛤 is the diffusivity coefficient, and 𝑄 is the source. Appl. Sci.Figure2020 , 101 ,illustrates 5425 an approximation of the equation for the analysis of the conservation4 of 18 equation for the two given cells, as shown in Equations (2)–(4).

Figure 1. Non-orthogonalNon-orthogonal and and skew skew cells; cells; P𝑷 andandQ 𝑸are are the the centers centers of of each each cell, cell,f c𝒇is𝒄 the is the face face centroid, centroid,fi 𝒇 𝒏⃗ 𝒇 is𝒊 the is the face face interpolated interpolated value, value, and and→n f is𝒇 a is normal a normal of face of facef . .

Equation (2) is the𝒂 result𝒏 obtained⃗ ⋅𝒗⃗𝝓 by =𝒂 approximating𝒏⃗ ⋅𝜞 the𝛁𝝓 surface +𝑽 integral𝑸 of φ through the flux of 𝒇 𝒇 𝒇 𝒇 𝒇 𝝓 𝒇 𝑪 𝝓 (2) the surface. As the FVM stores𝒇 the values of the𝒇 cell center (φP and φQ), the value representing the face where the two cells are in contact (φ f ) is approximated to the value of the point fi (φ fi ) (Equation (3)). However, this equation assumes that the normal vector of f is parallel to the vector between the centers of the two cells (→n →s ), and that the point f represents the face ( f = fc). Numerical errors and f k f i i diffusion exist for cells that do not match the abovementioned assumptions, as shown in Figure1. To evaluate the error, the mesh quality is evaluated based on the non-orthogonality (θ) and skewness () as follows:    →s f →n f  θ = (→s →n ) = 1 ·  ∠ f , f cos−   (5)  →s →n  | f | × | f | → f fi fc  = | | = | − | (6) →s P Q | f | | − | 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◦ 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.

4. Automatic Geometry Simplification Method for FVM The building geometry simplification method proposed in this study consists of preprocess, face classification, and polyhedron generation steps (Figure2). This method evaluates the similarity between surfaces to classify the surfaces to be removed. When the target model is composed of multiple solid objects, such as internal spaces or structures of the building, there may be numerical errors, such as small gaps between the solids. This can cause simplification errors and increase the number of surfaces, adversely affecting the performance of the algorithm. Considering this, a single solid object is created by uniting the target solids (Figure2b). The similarity between surfaces is evaluated by the Appl. Sci. 2020, 10, 5425 5 of 18 difference in the angle between the surfaces, as well as the distance. For this purpose, the surface of the target model should consist of a flat surface (i.e., a face). Therefore, when there is a curved surface in the target model, the model has to be approximated in the form of a polyhedron composed of faces. In the face classification step, faces are classified into major faces (solid lines in Figure2c) for composing the surface of the simplified model, and minor faces (dotted lines) to be removed from among the surfaces. To fill the empty spaces where minor faces have been removed, solids are generated using the boundaries of stretched major faces, and solids that are similar to the original geometry are selected (Figure2d). The selected solids are united to obtain a simplified building geometryAppl. Sci. 2020 (Figure, 10, x FOR2e). PEER REVIEW 5 of 18

Figure 2. Automatic geometry simplification simplification process.

4.1. Preprocess 4.1. Preprocess If the target building model contains multiple solid objects, a union operation is applied to the If the target building model contains multiple solid objects, a union operation is applied to the solids. A union operation, one of the Boolean operation for polygons, creates the solids containing solids. A union operation, one of the Boolean operation for polygons, creates the solids containing volume of target solids, similar to the union of set ( ). The building model is represented as single volume of target solids, similar to the union of set (∪∪). The building model is represented as single solid by union (Figure2b). Considering the case of numerical errors in the surface(s) that the solids solid by union (Figure 2b). Considering the case of numerical errors in the surface(s) that the solids abut, a geometry repair algorithm [27] is applied after union. abut, a geometry repair algorithm [27] is applied after union. To approximate the target building geometry into a polyhedron, the solid is represented in a To approximate the target building geometry into a polyhedron, the solid is represented in a boundary representation (B-rep) form, and the surface meshes are generated. B-rep is a solid modeling boundary representation (B-rep) form, and the surface meshes are generated. B-rep is a solid method that represents a solid using surface geometric information (set of surfaces, edges, and vertices). modeling method that represents a solid using surface geometric information (set of surfaces, edges, When a curved surface is present in the target geometry, a triangular surface mesh is generated by a and vertices). When a curved surface is present in the target geometry, a triangular surface mesh is tessellation algorithm [28], and each cell of the surface mesh is regarded as a face. generated by a tessellation algorithm [28], and each cell of the surface mesh is regarded as a face. 4.2. Face Classification 4.2. Face Classification To preserve the geometrical characteristics in the simplification process, an insignificant face in To preserve the geometrical characteristics in the simplification process, an insignificant face in the model is integrated into the nearby major face that determines the overall shape of the model. the model is integrated into the nearby major face that determines the overall shape of the model. The surface on building geometries are generally parallel or perpendicular to each other like cuboid. The surface on building geometries are generally parallel or perpendicular to each other like cuboid. Given this characteristics, the faces with large area and has a normal direction similar to that of other Given this characteristics, the faces with large area and has a normal direction similar to that of other faces are considered as major faces. The area a and index p are calculated as the preservation priorities faces are considered as major faces. The area 𝑎 and index 𝑝 are calculated as the preservation for each face of the B-rep solids. p is an index that is defined in this study, and calculated as follows: priorities for each face of the B-rep solids. 𝑝 is an index that is defined in this study, and calculated as follows: P j aj →n i →n j pi ∑=𝒋 𝒂𝒋𝒏P⃗𝒊|⋅𝒏⃗·𝒋 | (7) 𝒑𝒊 = j aj ∑𝒋 𝒂𝒋 (7)

2 where 𝑝 is the proposed index, 𝑎 is the area (m ), and 𝑛⃗ is the unit normal of the target face 𝑖. 𝑝 is an average of the scalar product of the normal of the target face and another face’s weighted with the area. By evaluating the priority sequence of the face through 𝑝 along with the face area, it is possible to obtain a model consisting of Cartesian angles, and by preventing the formation of acute angles, the generation of high-quality meshes can be expected [15,29]. The list of entire faces of the target solid is sorted with the area 𝑎 and index 𝑝 to extract the face priority sequence (𝐹) and classified into major and minor faces (Figure 3). In the order of the priority sequence, it is determined whether to remove a face, for faces (𝑓) having a smaller area than each surface (𝑓) (Figure 3a). When the distance (𝑑) and the angle (∠(𝑛⃗,𝑛⃗)) between faces are smaller than the input thresholds, the face 𝑓 is determined to be a minor face, that is, a surface to be removed. The distance (𝑑) is evaluated as the distance from 𝑐 (the center of 𝑓) to the 𝑝 (the foot of Appl. Sci. 2020, 10, 5425 6 of 18

2 where pi is the proposed index, ai is the area (m ), and →n i is the unit normal of the target face i. p is an average of the scalar product of the normal of the target face and another face’s weighted with the area. By evaluating the priority sequence of the face through p along with the face area, it is possible to obtain a model consisting of Cartesian angles, and by preventing the formation of acute angles, the generation of high-quality meshes can be expected [15,29]. The list of entire faces of the target solid is sorted with the area a and index p to extract the face priority sequence (F) and classified into major and minor faces (Figure3). In the order of the priority sequence, it is determined whether to remove a face, for faces ( f2) having a smaller area than each surface ( f1) (Figure3a). When the distance ( d) and the angle (∠(→n 1, →n 2)) between faces are smaller than the input thresholds, the face f2 is determined to be a minor face, that is, a surface to be removed. The distance (d) is evaluated as the distance from c2 (the center of f2) to the p (the foot of the perpendicular from c to f ), that calculated as →d = →n (→c →c ) . At this time, if there is any 2 1 | | | 1· 1 − 2 | geometry that should not be removed according to the purpose of the numerical analysis (Spreserve), it is excluded from the evaluation of minor faces. For example, the opening geometry like door, which is important for CFD analysis, was assigned as Spreserve in Figure3b). After classifying all minor faces (Fminor), the remaining faces are determined to be the major faces. Algorithm 1 shows the pseudocode for the face classification algorithm.

Algorithm 1 Pseudocode for face classification Input: Starget: Set of geometry solids of the target model Spreserve: Set of geometry solids to preserve φthreshold: Angle threshold of simplification dthreshold: Distance threshold of simplification Output: Fmajor: Set of major faces of target geometry Starget Algorithm: (Note that ai is area, →c i is geometric center, →n i is unit normal of face fi) F Sequence of faces on Starget Fpreserve Set of faces on Spreserve

A ai fi F Pn| ∈ → i→ j=1 aj ni n j P Pn | · | fi F h j=1 aj | ∈ i Sort F by A and P in descending order Fminor∅ FOR EACH f1 in F IF ( f1 < Fminor) and ( f1 < Fpreserve) F f ( f F) and ( f , f ) and ( f < Fpreserve) and ( f < F ) 0{ | ∈ 1 major } FOR EACH f2 in F0 d →n (→c →c ) | 1· 1 − 2 | IF (a a ) and (d d ) and ( →n →n cos (φ )) 2 ≤ 1 ≤ threshold | 1 · 2| ≤ threhold F F f minor ← minor ∪ { 2} F f ( f F) and ( f < F ) major{ | ∈ minor } RETURN Fmajor Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 18

⃗ the perpendicular from 𝑐 to 𝑓), that calculated as 𝑑=|𝑛⃗ ∙(𝑐⃗ −𝑐⃗)|. At this time, if there is any geometry that should not be removed according to the purpose of the numerical analysis (𝑆), it is excluded from the evaluation of minor faces. For example, the opening geometry like door, which

is important for CFD analysis, was assigned as 𝑆 in Figure 3b). After classifying all minor Appl.faces Sci. (2020𝐹, 10,), 5425 the remaining faces are determined to be the major faces. Algorithm 1 shows the7 of 18 pseudocode for the face classification algorithm.

FigureFigure 3. 3.Classification Classification ofof minorminor face on on 3D 3D building building model; model; 𝑐⃗→ c isi isthe the center, center, 𝑛⃗→ n isi isthe the unit unit normal normal of of facefacefi ,𝑓→p, is𝑝⃗ the is the foot foot of of perpendicular perpendicular from fromc 2𝑐to tof1 .𝑓. 4.3. Polyhedron Generation Algorithm 1 Pseudocode for face classification Input:After the faces are classified, the base solid of simplified model is generated as a bounding volume.𝑆 The: Set base of solidgeometry need solids to have of butheff ertarget space model outside the original model (i.e., bigger than minimum bounding𝑆 volume),: Set of sincegeometry new solids solid mightto preserve be generated in the simplified model as shown in Figure2d. In this𝜙 study,: aAngle solid threshold that is twice of simplification the length of each dimension of the minimum bounding box was generated.𝑑: Distance threshold of simplification Output:The base solid is split by each plane containing a major face as shown in Figure4. Among the solids𝐹 split by: Set the of planes,major faces the solidof target that geometry will form 𝑆 the simplified model is selected by comparing it with Algorithm: the original model (Figure5a). For each split solid ( Si), the ratio of shared volume of the solid and (Note that 𝑎 is area, 𝑐⃗ is geometric center, 𝑛⃗ is unit normal of face 𝑓) the original solid (Si Starget) over volume of the solid (Si) is calculated. The solid with a volume 𝐹≔ Sequence of ∩faces on 𝑆 ratio of 0.5 or more is selected. Figure 5b shows the calculated volume ratio of part of solids. Finally, 𝐹 ≔ Set of faces on 𝑆 the selected split solids (Figure5c) were united to generate simplified building geometry. Algorithm 2 𝐴≔〈𝑎|𝑓 ∈𝐹〉 is the pseudocode∑ ⃗⋅ for⃗ the polyhedron generation process. 𝑃≔〈 |𝑓 ∈𝐹〉 ∑ Sort 𝐹 by 𝐴 and 𝑃 in descending order Algorithm 2 Pseudocode for polyhedron generation 𝐹 ≔∅ FOR EACH 𝑓 in 𝐹 Input: Starget: Set of geometry solids of the target model IF (𝑓 ∉𝐹) and (𝑓 ∉𝐹) Fmajor: Set of major faces of target geometry Starget 𝐹 ≔𝑓|(𝑓∈𝐹) and (𝑓≠𝑓) and 𝑓 ∉ 𝐹 and 𝑓 ∉ 𝐹 Output: FOR EACH 𝑓 in 𝐹 S : Solids of simplified geometry 𝑑≔|𝑛⃗ ⋅ (c⃗ −c⃗ )|simpli f ied Algorithm: IF (𝑎 ≤𝑎) and (𝑑≤𝑑) and (|𝑛⃗ ⋅𝑛⃗| ≤ cos(𝜙 )) P Plane containing f f Fmajor 𝐹 ←𝐹 ∪{ {𝑓} | ∈ } Sbase Bounding volume of Starget Split S by each plane in P into S = S , S , S , base split { 1 2 3 · · ·} Sselected∅ FOR EACH solid Si in Ssplit r(Volume of S S )/(Volume of S ) i ∩ intersect i IF 0.5 r ≤ S S S selected ← selected ∪ { i} Ssimpli f ied Union of solids in Sselected RETURN Ssimpli f ied Appl. Sci. 2020, 10, x FOR PEER REVIEW 7 of 18

𝐹 ≔ {𝑓|(𝑓 ∈𝐹) and (𝑓 ∉𝐹)} RETURN 𝐹

4.3. Polyhedron Generation After the faces are classified, the base solid of simplified model is generated as a bounding volume. The base solid need to have buffer space outside the original model (i.e., bigger than minimum bounding volume), since new solid might be generated in the simplified model as shown in Figure 2d. In this study, a solid that is twice the length of each dimension of the minimum bounding box was generated. The base solid is split by each plane containing a major face as shown in Figure 4. Among the solids split by the planes, the solid that will form the simplified model is selected by comparing it with the original model (Figure 5a). For each split solid (𝑆), the ratio of shared volume of the solid and the original solid (𝑆 ∩𝑆) over volume of the solid (𝑆) is calculated. The solid with a volume ratio of 0.5 or more is selected. Figure 5b shows the calculated volume ratio of part of solids. Finally, Appl.the selected Sci. 2020, 10split, 5425 solids (Figure 5c) were united to generate simplified building geometry. Algorithm8 of 18 2 is the pseudocode for the polyhedron generation process.

Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 18 FigureFigure 4.4. BaseBase solidsolid splitsplit byby eacheach planeplane containingcontaining aa majormajor face.face.

Figure 5. Selection process of split solids. Figure 5. Selection process of split solids. 5. Evaluation of Simplification Effect Algorithm 2 Pseudocode for polyhedron generation 5.1.Input: Geometrical Properties 𝑆In addition: Set of geometry to the mesh solidsquality, of the target the model changes in the geometric properties according to the𝐹 simplification: Set of major of the faces building of target model geometry were 𝑆 evaluated in terms of the shape similarity and meshingOutput: complexity. The similarity between the original and simplified geometry was evaluated by comparing𝑆 the: Solids D2 shape of simplified distribution geometry of each geometry. The meshing complexity refers to the degree ofAlgorithm: difficulty in the mesh design, which depends on the complexity of the geometry; the meshing complexity𝑃≔{Plane was containing evaluated by𝑓|𝑓 the∈𝐹 inverse} topology count (ITC). 𝑆 ≔ Bounding volume of 𝑆 Split 𝑆 by each plane in 𝑃 into 𝑆 ={𝑆,𝑆,𝑆,⋯} 𝑆 ≔∅ FOR EACH solid 𝑆 in 𝑆 𝑟≔(Volume of 𝑆 ∩𝑆)/(Volume of 𝑆) IF 0.5 ≤ r 𝑆 ←𝑆 ∪ {𝑆} 𝑆 ≔ Union of solids in 𝑆 RETURN 𝑆

5. Evaluation of Simplification Effect

5.1. Geometrical Properties In addition to the mesh quality, the changes in the geometric properties according to the simplification of the building model were evaluated in terms of the shape similarity and meshing complexity. The similarity between the original and simplified geometry was evaluated by comparing the D2 shape distribution of each geometry. The meshing complexity refers to the degree of difficulty in the mesh design, which depends on the complexity of the geometry; the meshing complexity was evaluated by the inverse topology count (ITC).

Appl. Sci. 2020, 10, 5425 9 of 18

5.1.1. Shape Similarity The shape distribution involves the distribution of the geometric characteristics of the model that are evaluated with a shape function, and is used to quantitatively describe and compare the 3D geometry [30,31]. There are numerous shape distributions that apply various shape functions, such as the angle (A3), distance (D1, D2), area (D3), and volume (D4); however, the D2 shape distribution is known to be most suitable for model comparison and classification [32]. The D2 shape distribution is defined as the distribution of the distance between two arbitrary points on a model surface. In practice, it is evaluated based on a histogram of the distance between the two points that are sampled randomly from the surface. The similarity between the shape distributions was evaluated using the Bhattacharyya coefficient. For distributions p (x) and p (x) (x X), the Bhattacharyya coefficient (ρ) is calculated as follows [33]: 1 2 ∈ X q ρ(p1, p2) = p1(x) p2(x) (8) x X ∈ The Bhattacharyya coefficient is equal to the area of the overlapping region between the two distributions. It has a range of 0 ρ 1, and can be interpreted as a standardized similarity ≤ ≤ between the distributions.

5.1.2. Meshing Complexity The meshing complexity and mesh quality of the numerical analysis model increase with the complexity of the target geometry. White et al. [34] proposed the ITC as an index for evaluating the hexahedral meshing complexity, and the calculation formula is as follows:

1 6 12   C = min + , 1 (9) ITC 2 F E | | | | where CITC is the ITC, F is a set of faces, and E is a set of edges in the target model. The ITC is an index for evaluating the complexity of a geometry and the ease of hexahedral meshing based on the basic geometric information, i.e., the number of faces and edges. It has a range of 0 < C 1, and a lower value is calculated for a model with more complex surfaces, which comprises ITC ≤ multiple faces and edges. The ITC of the cube ( F = 6, E = 12), which is ideal for the hexahedron | | | | mesh design, is equal to the maximum value, 1.

5.2. Building Geometry Dataset As the simplification method proposed in this study does not consider building materials or semantic information (e.g., relationships and hierarchies of components), the 3D geometry can be extracted and applied regardless of the data format of the building model. To evaluate the proposed method for models with various geometric characteristics, the building models were obtained from the BIM library available on the web. Two or three models have been selected from every three libraries as follows: Academic Advance Sample, Academic Kingo, Haus30 models from [35], Medical Clinic, Duplex Apartment, Office Building models from [36], and OTC Conference Center, West Riverside Hospital Parking Garage from [37]. The domain for building environment , such as CFD simulations and fire safety assessments, is usually an interior space, rather than a structural part of the building. As such, the geometry of the indoor space (IfcSpace class) was selected for evaluation from among the attributes of the BIM model. To set the boundary conditions for the indoor environmental analysis model, the information of the door and window was required; in consideration of this, the geometries of the openings in doors and windows (IfcOpeningElement class) adjacent to the target space were simultaneously extracted. Of the total 40 spaces that were selected, five were from each respective BIM model, including spaces with complex geometries that could be simplified, such as curved surfaces, walls with different depths, and interior walls. To evaluate the general effect of Appl. Sci. 2020, 10, 5425 10 of 18 the geometry simplification, geometries of various geometrical complexities were selected (Table1). The characteristic length, which is an index that represents the hydrodynamic properties of geometry, was calculated as follows: LC = V/A (10) 3 2 where LC is the characteristic length (m), V is the volume (m ), and A is surface area (m ) of the target geometry.

Table 1. Geometric properties of the building geometry dataset.

Properties Volume (m3) Surface Area (m2) Characteristic Length (m) ITC Average 170.4 233.6 0.592 4.25e-2 Standard deviation 210.8 228.7 0.223 0.101 Minimum 0.960 37.6 1.47e-2 6.46e-4 Maximum 1062.6 1251.7 1.025 0.583

5.3. Implementation and Mesh Design The algorithm implementation and data analysis was performed through Python programming language. The open source library IfcOpenShell [38] was used to analyze the BIM model and extract the geometry. Using Open CASCADE [39], a computer-aided design (CAD) library, and its wrapper library pythonOCC [40], the simplification method was implemented and the D2 shape distribution was evaluated. The mesh of the target building model was designed using the cfMesh library [41]. cfMesh can automatically generate mesh and boundary layers for each geometric shape, and is basically included for use in OpenFOAM [42]. A hexahedron mesh was generated using cfMesh; in the case of complex geometry where there is difficulty in generating high-quality hexahedron meshes, some cells are generated in the shape of a tetrahedron, prism, and pyramid.

5.4. Experiment Settings and Analysis The changes in geometric shape and mesh quality were analyzed according to the threshold of the proposed geometry simplification method. As the building model was mostly composed of perpendicular or parallel surfaces, in the simplification method, the distance threshold had a more dominant effect on the results than the angle threshold. Therefore, the angle threshold (φthreshold) was fixed at 90◦, and the degree of the simplification was controlled according to the distance threshold (dthreshold). Considering the differences in the scale and complexity of individual models, the distance threshold was standardized by a characteristic length, i.e., a metric in the length dimension representing the geometric properties. Each model was simplified with a distance threshold of 0.01, 0.05, 0.1, 0.5, 1.0, 5.0, or 10.0 times the characteristic length, and was compared with the original model. In view of a CFD simulation or fire safety analysis for the building, the geometry of the openings (windows and doors), which significantly affects the indoor aerodynamic environment, was excluded from the target of simplification. There is a trade-off relationship between the accuracy and the computational cost of the numerical analysis according to the number of meshes. The researcher controls the size and number of meshes considering the required accuracy of the model and available computational resources. Considering that, mesh sizes of 0.25, 0.5, 1.0, 2.0, and 4.0 m were designed for each model. The applicability of the geometry simplification was evaluated in terms of the degree of change in the geometry and mesh quality. The similarity between the original and the simplified model was quantitatively evaluated by the Bhattacharyya coefficient between D2 shape distributions. The D2 shape distribution was calculated from the distance between 1,000,000 pairs of points that were randomly extracted from the surface of the target geometry. The mesh quality was evaluated based on the maximum non-orthogonality, maximum skewness, and ratio of hexahedron meshes. In addition, the number of cells was evaluated as it was proportional to the computational cost of the numerical analysis model. The change in each index according to the simplification threshold was analyzed using Appl. Sci. 2020, 10, 5425 11 of 18

Appl. Sci. 2020, 10, x FOR PEER REVIEW 11 of 18 a linear regression model based on ordinary least squares. Unlike other metrics, the skewness does notgenerated have an near upper the limit. surface Typically, of some high-quality complex geometri mesheses. have To aminimize maximum the skewness effects of between these outliers 0 and4; in however, extremely skewed cells with skewness values of 1 1010 or more can be generated near the the statistical analysis, the elliptic envelope method [43] was× applied to the data from the mesh design surfaceto remove of some outliers complex of 1% geometries. of the entire To data. minimize the effects of these outliers in the statistical analysis, the elliptic envelope method [43] was applied to the data from the mesh design to remove outliers of 1%6. ofResults the entire and data.Discussion

6.6.1. Results Simplification and Discussion of Building Geometry 6.1. SimplificationA total of of40 Building geometries Geometry were simplified under six distance thresholds each. The average execution time of the implemented algorithm was 137.5 s (median 37.3 s) with Ryzen 7 3800X A total of 40 geometries were simplified under six distance thresholds each. The average execution processor and 32 GB RAM. Figure 6 shows the simplification of a typical building model for which time of the implemented algorithm was 137.5 s (median 37.3 s) with Ryzen 7 3800X processor and the majority of adjacent surfaces are orthogonal to each other. The gray surfaces and blue surfaces 32 GB RAM. Figure6 shows the simplification of a typical building model for which the majority of represent ordinary walls and openings respectively. Figure 6a shows Space 1E24 in the Medical Clinic adjacent surfaces are orthogonal to each other. The gray surfaces and blue surfaces represent ordinary model. As the distance threshold (𝑑 ) of the geometry simplification increased, the details of walls and openings respectively. Figure6a shows Space 1E24 in the Medical Clinic model. As the the geometry were gradually removed, and the overall geometry tended to be similar to a simple distance threshold (d ) of the geometry simplification increased, the details of the geometry were cube. The characteristicthreshold length of the original model (𝐿 ) was calculated as 0.848 m. As a result of gradually removed, and the overall geometry tended to be similar to a simple cube. The characteristic applying the geometry simplification, an inner wall with a thickness of 0.124 m was removed under length of the original model (L ) was calculated as 0.848 m. As a result of applying the geometry the condition of a distance thresholdC0 of 0.5𝐿 (= 0.424 m). Wall faces with vertical distances of 0.353 simplification, an inner wall with a thickness of 0.124 m was removed under the condition of a m and 0.916 m were integrated with a threshold of 1.0𝐿 (= 0.848 m) and 5.0𝐿 (= 4.241 m), distance threshold of 0.5L (= 0.424 m). Wall faces with vertical distances of 0.353 m and 0.916 m respectively. Figure 6b illustratesC0 Space 04 from the Academic Kingo model. For 𝑑 = 0.5𝐿 , were integrated with a threshold of 1.0L (= 0.848 m) and 5.0L (= 4.241 m), respectively. Figure6b some parts of the ceiling surface parallelC0 to the floor were unitedC0 into the remaining non-horizontal illustrates Space 04 from the Academic Kingo model. For d = 0.5L , some parts of the ceiling ceiling. As the opening geometry was excluded from thethreshold simplificationC0 target, when the distance surface parallel to the floor were united into the remaining non-horizontal ceiling. As the opening threshold is 1.0𝐿 or greater, some of the wall face is shifted to a parallel plane to the face of the geometry was excluded from the simplification target, when the distance threshold is 1.0L or greater, doors. C0 some of the wall face is shifted to a parallel plane to the face of the doors.

Figure 6. Simplification of typical building geometry. (a) Space 1E24 of Medical Clinic, (b) Space 04 of Academic Kingo. Figure 6. Simplification of typical building geometry.

WhenWhen the the model model geometry geometry contained contained several several non-orthogonal non-orthogonal and and curved curved surfaces, surfaces, the the geometry geometry mainlymainly changed changed with with a lowa low threshold threshold of belowof below 1.0 L1.0C0𝐿(Figure (Figure7). This 7). This was consideredwas considered to be to because be because the lengththe length of the of perpendicular the perpendicular from the from center, the whichcenter, is which a criterion is a forcriterion surface for integration, surface integration, was relatively was shortrelatively owing short to the owing small angle to the di ffsmallerence angle between difference faces. Figurebetween7a is faces. Space Figure 123 of the7a isAcademic Space 123 Advanced of the SampleAcademicmodel. Advanced The circular Sample column model. inside The circular the original column model inside was the represented original asmodel the column was represented of a regular as 24-sidedthe column polygon of asa regular a generating 24-sided surface polygon mesh. Uponas a applyinggenerating the surface simplification, mesh. Upon it was transformedapplying the tosimplification, an octagonal columnit was transformed (dthreshold = 0.1 toL Can0) octagonal and square column column ( (𝑑dthreshold ==0.1𝐿0.5LC0).) Whenand square the distance column threshold(𝑑 was=0.5𝐿 1.0LC0).(= When0.756 m)the or distance longer, thethreshold column was was 1.0 removed𝐿(= 0.756 as the m) distance or longer, threshold the column exceeded was theremoved diameter as the (0.3 distance m) of the threshold column. exceeded Figure7b the is Spacediameter B112 (0.3 in m) the of OTCthe column. Conference Figure Center 7b model.is Space B112 in the OTC Conference Center model. As in the above examples, it can be observed that the number of surfaces decreases as the distance threshold increases. Appl. Sci. 2020, 10, 5425 12 of 18

As in the above examples, it can be observed that the number of surfaces decreases as the distance Appl. Sci. 2020, 10, x FOR PEER REVIEW 12 of 18 thresholdAppl. Sci. 2020 increases., 10, x FOR PEER REVIEW 12 of 18

Figure 7. Simplification of building geometry with curved faces. (a) Space 123 of Academic Advanced Figure 7. Simplification of building geometry with curved faces. Sample, (b) Space B112Figure of OTC7. Simplification Conference of Center. building geometry with curved faces. Figure 8 shows the averages of the geometric properties of the target model according to the FigureFigure8 8shows shows the the averagesaverages ofof the geometric pr propertiesoperties of of the the target target model model according according to tothe simplification threshold. Based on the calculated results of the Bhattacharyya coefficient, the thesimplification simplification threshold. threshold. Based Based on the on thecalculat calculateded results results of the of theBhattacharyya Bhattacharyya coefficient, coefficient, the similarity with the original geometry tended to decrease as the degree of simplification increased. thesimilarity similarity with with the the original original geometry geometry tended tended to to decrease decrease as as the the degree degree of simplificationsimplification increased.increased. When the distance threshold was a maximum (𝑑𝑑 =10.0𝐿=10.0𝐿), the mean of the Bhattacharyya WhenWhen thethe distancedistance thresholdthreshold waswas aa maximummaximum ((dthreshold= 10.0LC0),), the the mean mean of of the the Bhattacharyya Bhattacharyya 3 coefficientcoecoefficientfficient was was 0.963, 0.963, and and the the standardstandard standard errorerror error waswas was 5.835.83 5.83 × × 10 10⁻⁻3 3(Figure (Figure(Figure 88a). a).8a). Based Based on on thethe the resultsresults results ofof of thethe the × − statisticalstatistical analysis, analysis, no no significant significant significant change change in in the the Bhattacharyya Bhattacharyya coefficient coecoefficientfficient was was observed observed according according to to thethe geometrical geometrical properties properties (ITC (ITC and and characteristic characteristic le length). length).ngth). In InIn contrast,contrast, thethe distance distance thresholdthreshold ofof the the simplificationsimplificationsimplification had hadhad a linearaa linearlinear relationship relationshiprelationship with with thewith Bhattacharyya ththee BhattacharyyaBhattacharyya coefficient. coefficient.coefficient. From the FromFrom result the ofthe regression resultresult ofof regressionanalysisregression (Table analysis analysis2), the (Table (Table similarity 2), 2), the the with similarity similarity the original with with geometrythe the original original decreased geometry geometry by decreased approximatelydecreased by by approximately approximately 0.31% when 0.31% when the distance threshold increased by 1.0 𝐿. the0.31% distance when threshold the distance increased threshold by 1.0increasedLC0. by 1.0 𝐿.

Figure 8. Changes in geometrical features resulting from simplification. (a) Bhattachayya confficient, Figure 8. Changes in geometrical features resulting from simplification. (b) Number of edgesFigure and 8. Changes faces, (c) in ITC. geometrical features resulting from simplification.

TableTableTable 2. 2. Regression Regression analysis analysis of of Bhattacharyya Bhattacharyya coefficient. coe coefficient.fficient.

2 2 MultipleMultiple R MultipleR 2 R2 AdjustedAdjustedAdjusted R R 2 R2 F-StatisticF-StatisticF-Statistic p-Value pp-value-value 0.2369 0.2363 363.9 <2.2e-16 0.2369 0.23690.2363 0.2363 363.9 363.9 <2.2e-16 <2.2e-16 Variable Coefficient Standard error p-value Variable VariableCoefficient Coefficient StandardStandard Error error p-Value p-value (Intercept)(Intercept) 0.99182880.9918288 0.0006793 0.0006793 <2e-16<2e-16 (Intercept) 0.9918288 0.0006793 <2e-16 𝑑/𝐿 −0.0031480 0.0001650 <2e-16 𝑑/𝐿d /L −0.00314800.0031480 0.00016500.0001650 <2e-16 <2e-16 threshold C0 − AccordingAccording to to the the characteristics characteristics of of the the simplificat simplificationion method method for for integrating integrating similar similar surfaces, surfaces, the the numbernumber of of faces faces and and edges edges in in the the model model tended tended to to decrease. decrease. In In the the original original model, model, the the average average numbernumber of of faces faces was was 1243 1243 and and the the number number of of edge edges swas was 1866; 1866; however, however, with with the the simplification simplification under under a condition of 𝑑 =10.0𝐿, the numbers were reduced to 224 and 335, respectively (Figure a condition of 𝑑 =10.0𝐿, the numbers were reduced to 224 and 335, respectively (Figure 8b).8b). As As a a result, result, the the ITC, ITC, which which represents represents the the he hexahedralxahedral meshing meshing complexity, complexity, showed showed an an increasing increasing Appl. Sci. 2020, 10, 5425 13 of 18

According to the characteristics of the simplification method for integrating similar surfaces, the number of faces and edges in the model tended to decrease. In the original model, the average numberAppl. Sci. of2020 faces, 10, x was FOR 1243 PEER and REVIEW the number of edges was 1866; however, with the simplification under13 of a18 condition of dthreshold = 10.0LC0, the numbers were reduced to 224 and 335, respectively (Figure8b). Astrend. a result, The theaverage ITC, whichITC ofrepresents the original the model hexahedral increased meshing fromcomplexity, 0.0425 (standard showed error an increasing0.0165) to trend.0.0929 The(SEaverage 0.0315) under ITC of a the condition original of model 𝑑 increased=5.0𝐿 from, 0.0425and to (standard 0.0847 (SE error 0.0212) 0.0165) for to𝑑 0.0929 (SE= 10.0𝐿 0.0315). under a condition of dthreshold = 5.0LC0, and to 0.0847 (SE 0.0212) for dthershold = 10.0LC0. 6.2. Mesh Quality Improvement by Geometry Simplification 6.2. Mesh Quality Improvement by Geometry Simplification A hexahedral mesh of each size was designed for the original and simplified geometries, and the respectiveA hexahedral mesh mesh qualities of each were size evaluated. was designed The fordata the of original10,661 cases and simplifiedwere collected, geometries, except for and some the respectivecases where mesh simplification qualities were was evaluated.not performed The because data of 10,661the distance cases threshold were collected, value exceptwas too for small, some or caseswhere where mesh simplification generation failed was notowing performed to the excess becauseively the large distance mesh threshold size when value compared was too with small, the orvolume where of mesh the model. generation Among failed them, owing there towere the 10,549 excessively datasets large with mesh approximately size when 1% compared of the outliers with theremoved volume considering of the model. the Amongdistribution them, of there the mesh were 10,549quality. datasets Among with the mesh approximately quality metrics, 1% of thethe outliersmaximum removed skewness considering formed a the distribution distribution with of thean ex meshtremely quality. longAmong tail on the the right mesh side quality (skewness metrics, of thedistribution maximum 15.54); skewness considering formed athis distribution distribution with, the an maximum extremely skewness long tail onwas the log-transformed right side (skewness before ofthe distribution analysis. 15.54); considering this distribution, the maximum skewness was log-transformed beforeFigure the analysis. 9 shows the proportion of hexahedron cells in the mesh and the relative number of cells accordingFigure 9to shows the simplification the proportion threshold of hexahedron and mesh cells size. in the From mesh the and result the relativeof meshing number the oforiginal cells accordinggeometry, to the the proportion simplification of hexahedron threshold andcells meshamon size.g all cells From tended the result to decrease of meshing as the the mesh original size geometry,increased the(Figure proportion 9a). Hexahedron of hexahedron cells have cells amongthe advantage all cells of tended having to fewer decrease numerical as the errors, mesh size and increasedcan be designed (Figure9 a).with Hexahedron a relatively cells small have number the advantage of cells, ofbut having it is difficult fewer numerical to achieve errors, a high-quality and can bemesh designed design with for acomplex relatively geometries. small number The ofvolume cells, butrange it is of di ffithecult target to achieve building a high-quality models was mesh 0.96– design1062.6 form3,complex and the characteristic geometries. The length volume range range was 0.015–1.025 of the target m. building As the mesh models size was was 0.96–1062.6 set to be larger m3, andrelative the characteristic to the volume length and complexity range was 0.015–1.025 of the target m. geometry, As the mesh it was size believed was set tothat be the larger proportion relative to of thecells volume with geometries and complexity such ofas thetetrahedron, target geometry, pyramid, it wasand believedprism increased that the to proportion represent of the cells detailed with geometriesgeometry of such the asmodel tetrahedron, surface. pyramid,The hexahedron and prism cell increasedratio of the to simplified represent themodel detailed increased geometry linearly of theaccording model surface.to the simplification The hexahedron threshold. cell ratio For of all the mesh simplified sizes, modelthe hexahedron increased cell linearly ratio accordingof the model to thesimplified simplification with threshold.𝑑 = For 10.0𝐿 all mesh increased sizes, the by hexahedron an average cell of ratio10.4% of thewhen model compared simplified with with the doriginalthreshold = model.10.0LC 0 increased by an average of 10.4% when compared with the original model.

FigureFigure 9. 9.Statistical Statistical featuresfeatures of of mesh mesh according according to to simplification simplification threshold threshold and and mesh mesh size. size.

FigureFigure9 b9b shows shows the the number number of of cells cells standardized standardized with with the the cell cell number number of of the the original original model. model. Overall,Overall, thethe numbernumber ofof cells cells decreased decreased with with simplification, simplification, andand thethe eefffectfect of of the the computational computational cost cost reductionreduction inin the numerical numerical analysis analysis was was expected. expected. However, However, the number the number of cells of exceeded cells exceeded the original the

model in some conditions with 𝑑 ≤0.5𝐿, particularly when the mesh size was 4.0 m. This was believed to result from the generation of cells other than the hexahedron, as described above, which could be prevented by setting an appropriate simplification threshold and mesh size. Figure 10 shows the changes in the maximum non-orthogonality and skewness, which affect the accuracy and stability of the FVM. Both metrics tended to decrease with an increasing simplification threshold, that is, the mesh quality improved. The total average maximum non-orthogonality of the Appl. Sci. 2020, 10, 5425 14 of 18 original model in some conditions with d 0.5L , particularly when the mesh size was 4.0 m. threshold ≤ C0 This was believed to result from the generation of cells other than the hexahedron, as described above, which could be prevented by setting an appropriate simplification threshold and mesh size. Figure 10 shows the changes in the maximum non-orthogonality and skewness, which affect theAppl. accuracy Sci. 2020, 10 and, x FOR stability PEER REVIEW of the FVM. Both metrics tended to decrease with an increasing14 of 18 simplification threshold, that is, the mesh quality improved. The total average maximum original model was 69.6°, and the log-transformed maximum skewness (log(𝜖))) was 0.82. With the non-orthogonality of the original model was 69.6◦, and the log-transformed maximum skewness geometry simplification, the metrics decreased to 65.3° and 0.47 with 𝑑 =1.0𝐿 ; under the (log ())) was 0.82. With the geometry simplification, the metrics decreased to 65.3◦ and 0.47 with dcondition= 1.0of L𝑑; under=10.0𝐿 the condition, the values of d decreased= 10.0 toL 51.0°, the and values −0.13, decreased respectively. to 51.0 In contrast,and 0.13, as threshold C0 threshold C0 ◦ − respectively.a larger mesh Inwas contrast, designed, as the a larger mesh meshquality was improv designed,ed on average; the mesh however, quality improvedthere was no on consistent average; however,tendency. there For example, was no consistent the maximum tendency. skewness For example, of the 4.0-m the maximummesh was skewnesshigher than of that the 4.0-mof the mesh2.0-m wasmesh higher under than the that𝑑 of the≤1.0𝐿 2.0-m mesh condition. under the d 1.0L condition. threshold ≤ C0

FigureFigure 10. 10.Mesh Mesh qualityquality accordingaccording toto simplification simplification threshold threshold and and mesh mesh size. size.

ForFor a a quantitative quantitative analysis analysis of theof etheffect effect of the of geometry the geometry simplification simplification on the meshon the quality, mesh a quality, multiple a linearmultiple regression linear regression analysis was analysis performed was performed (Tables3– 5(Tables). The independent3–5). The independent variables includedvariables theincluded ITC (CITC0) and characteristic length (LC0) of the original geometry, the maximum size of the designed the ITC (𝐶) and characteristic length (𝐿) of the original geometry, the maximum size of the meshdesigned (s), andmesh the ( degree𝑠 ), and of the simplification degree of simplification normalized with normalized the characteristic with the length characteristic (dthreshold /lengthLC0). Considering the nonlinear relationship between the mesh size and quality, the square term of the mesh (𝑑/𝐿). Considering the nonlinear relationship between the mesh size and quality, the square 2 sizeterm (s of) wasthe addedmesh size as an (𝑠 independent) was added variable. as an independent In the case of variable. maximum In non-orthogonality, the case of maximum the e ffnon-ect oforthogonality, the characteristic the effect length of was the notcharacteristic statistically length significant was not (p-value statistically= 0.350), significant and it was (p excluded-value = 0.350), from theand analysis. it was excluded from the analysis. All of the linear regression models were evaluated as being statistically significant (p-value < 2.2 Table 3. Regression analysis of hexahedron cell ratio. × 10−1⁶). For all the metrics, the mesh quality improved with the increasing simplification threshold ( 𝑑/𝐿 ) andMultiple the geometry R2 Adjustedcharacteristic R2 metricsF-Statistic ( 𝐶 and 𝐿p-Value)). Considering that the 2 adjusted R of all linear0.3806 models was less 0.3784 than 0.4, it is estimated 169.7 that some<2.2e-16 factors that affected the mesh quality were not considered in this study. However, considering the statistical significance of Variable Coefficient Standard Error p-Value the individual variables, there is an effect in improving the mesh quality for FVM analysis with the geometry simplification(Intercept) process proposed 0.706601 in this study. 0.014671 In particular,

Table 3. Regression analysis of hexahedron cell ratio.

Multiple R2 Adjusted R2 F-Statistic p-value 0.3806 0.3784 169.7 <2.2e-16 Variable Coefficient Standard error p-value (Intercept) 0.706601 0.014671 <2e-16

𝑑/𝐿 0.012601 0.001138 <2e-16 𝑠 −0.174158 0.012044 <2e-16 𝑠 0.030040 0.002733 <2e-16 Appl. Sci. 2020, 10, 5425 15 of 18

Table 4. Regression analysis of maximum non-orthogonality.

Multiple R2 Adjusted R2 F-Statistic p-Value 0.2143 0.2120 94.21 <2.2e-16 Variable Coefficient Standard Error p-Value (Intercept) 103.5349 2.3859 <2e-16 d /L 2.3652 0.2556 <2e-16 threshold C0 − s 22.6681 2.7056 <2e-16 − s2 3.9979 0.6139 1.04e-10 C 84.6206 5.8553 <2e-16 ITC0 −

Table 5. Regression analysis of log-transformed maximum skewness.

Multiple R2 Adjusted R2 F-Statistic p-Value 0.2370 0.2343 85.81 <2.2e-16 Variable Coefficient Standard Error p-Value (Intercept) 3.01519 0.16625 <2e-16 d /L 0.11820 0.01290 <2e-16 threshold C0 − s 1.20214 0.13649 <2e-16 − s2 0.21268 0.03097 9.86e-12 C 4.63938 0.29573 <2e-16 ITC0 − L 0.71985 0.19068 0.000167 C0 −

All of the linear regression models were evaluated as being statistically significant (p-value < 2.2 10 16). For all the metrics, the mesh quality improved with the increasing × − simplification threshold (dthreshold/LC0) and the geometry characteristic metrics (CITC0 and LC0)). Considering that the adjusted R2 of all linear models was less than 0.4, it is estimated that some factors that affected the mesh quality were not considered in this study. However, considering the statistical significance of the individual variables, there is an effect in improving the mesh quality for FVM analysis with the geometry simplification process proposed in this study. In particular, the maximum skewness decreased exponentially according to the distance threshold ( = exp (3.02 0.118(d /L ) 1.20s + 0.213s2 4.64C 0.720L )), and the corresponding − threshold C0 − − ITC0 − C0 quality improvement effect was expected to be high. From the regression models, it is expected that the mesh quality can be predicted, and an appropriate simplification threshold (dthreshold) can be selected before designing a building FVM simulation model.

7. Conclusions This study proposed an automatic simplification methodology of building geometries to improve the accuracy and stability of the FVM model, and analyzed changes in geometry and mesh quality by simplification. The geometry simplification method proposed in this study integrates similar faces through angle and a distance threshold, and removes insignificant faces from the surfaces composing the building model. To evaluate the applicability of the simplification method, the geometries of the building models obtained from the public BIM library were simplified under various conditions. To evaluate the extent of the shape changes from the simplification method, the similarity between the original and simplified geometry was evaluated using the D2 shape distribution and Bhattacharyya coefficient. In addition, the complexity of the building model and hexahedron meshing were evaluated using the ITC. As a result, the similarity of simplified geometry to the original model and the complexity decreased in proportion to the distance threshold. Therefore, it was determined that the degree of geometry changes could be controlled linearly using the threshold of the simplification method. The mesh quality of the building model was evaluated using the maximum non-orthogonality, skewness, and the hexahedron cell ratio as each affects the accuracy and stability of Appl. Sci. 2020, 10, 5425 16 of 18

FVM analysis. The mesh quality metrics showed a significant change based on the distance threshold from the geometry simplification and the complexity of the original geometry. All three mesh quality metrics improved with geometry simplification. In particular, the maximum skewness showed an exponential decrease. To evaluate the priority of the faces to be removed among the building surfaces, an index for evaluating the similarity between the normal vector of a target face and other faces was proposed in this study. The proposed algorithm guarantees identical results with the same input as the results achieved by evaluating the priority order of entire faces with the index. Furthermore, the hexahedral meshing complexity of the geometry is expected to be reduced as Cartesian angles are formed. The experimental results showed that the mesh quality of an FVM model can be quantitatively controlled using the geometry simplification method proposed in this study. In particular, through the linear regression model, it is possible to estimate the mesh quality from the geometrical properties of the original model and the size of the mesh to be designed, as well as to evaluate the required threshold for simplification. However, considering the low adjusted R2 of the regression model, it is believed that there may be a cause of error that has not been considered in this study. In practice, it is expected that the mesh quality can be further improved by applying multiple simplification thresholds and/or traditional preprocessing methods, such as the blocking of geometries. This study evaluated the applicability of a geometry simplification method in terms of the geometry changes and the improvement of the mesh quality. However, considering that differences may occur in the analysis results as the geometry changes, further studies are needed to evaluate the effects of geometry simplification methods on individual FVM analysis results, such as those for CFD, fire dynamics simulations, and thermal simulations. Based on these studies, it is expected that an appropriate geometry simplification threshold can be presented while considering the relationship between the error caused by the geometry change and the effect of improving the mesh quality.

Author Contributions: Conceptualization, C.K. and M.L.; methodology, G.P., C.K. and M.L.; software, G.P.; validation, G.P., C.K. and M.L.; formal analysis, G.P.; investigation, G.P., M.L.; resources, G.P.; data curation, G.P.; writing—original draft preparation, G.P.; writing—review and editing, G.P. and C.K.; visualization, G.P.; supervision, C.K. and C.C.; project administration, C.K. and C.C.; funding acquisition, C.C. All authors have read and agreed to the published version of the manuscript. Funding: This work is supported by the Korea Agency for Infrastructure Technology Advancement(KAIA) grant funded by the Ministry of Land, Infrastructure and Transport (Grant 20CTAP-C152000-02). The present research has been conducted by the Research Grant of Kwangwoon University in 2019. Conflicts of Interest: The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

References

1. Eymard, R.; Gallouët, T.; Herbin, R. Finite volume methods. Handb. Numer. Anal. 2000, 7, 713–1018. 2. McGrattan, K.; Hostikka, S.; McDermott, R.; Floyd, J.; Weinschenk, C.; Overholt, K. Fire dynamics simulator user’s guide. NIST Spec. Publ. 2013, 1019. 3. Krykowski, T.; Zybura, A. Modelling of reinforced concrete element damage as a result of reinforcement corrosion. Procedia Eng. 2013, 57, 614–623. [CrossRef] 4. Hendrickx, R.; De Clercq, H. Heat and moisture simulations of repair mortars: Benchmark experiments and practical cases in conservation. In Historic Mortars; Springer: Berlin/Heidelberg, Germany, 2019; pp. 319–336. 5. Nielsen, P.V. Fifty years of CFD for room air distribution. Build. Environ. 2015, 91, 78–90. [CrossRef] 6. Knupp, P. Remarks on Mesh Quality; Sandia National Lab.(SNL-NM): Albuquerque, NM, USA, 2007. 7. Burkhart, T.A.; Andrews, D.M.; Dunning, C.E. Finite element modeling mesh quality, energy balance and validation methods: A review with recommendations associated with the modeling of bone tissue. J. Biomech. 2013, 46, 1477–1488. [CrossRef][PubMed] 8. Denner, F.; van Wachem, B.G.M. Compressive VOF method with skewness correction to capture sharp interfaces on arbitrary meshes. J. Comput. Phys. 2014, 279, 127–144. [CrossRef] Appl. Sci. 2020, 10, 5425 17 of 18

9. Ishigaki, M.; Abe, S.; Sibamoto, Y.; Yonomoto, T. Influence of mesh non-orthogonality on numerical simulation of buoyant jet flows. Nucl. Eng. Des. 2017, 314, 326–337. [CrossRef] 10. Ricci, A.; Kalkman, I.; Blocken, B.; Burlando, M.; Freda, A.; Repetto, M.P. Local-scale forcing effects on wind flows in an urban environment: Impact of geometrical simplifications. J. Wind Eng. Ind. Aerodyn. 2017, 170, 238–255. [CrossRef] 11. Ali, Z.; Tyacke, J.; Watson, R.; Tucker, P.; Shahpar, S. Efficient preprocessing of complex geometries for CFD simulations. Int. J. Comput. Fluid Dyn. 2019, 1–17. [CrossRef] 12. Heok, T.K.; Daman, D. A review on level of detail. In Proceedings of the International Conference on Computer Graphics, Imaging and Visualization, 2004 (CGIV 2004), Penang, Malaysia, 2 July 2004; IEEE: New York, NY, USA, 2004; pp. 70–75. 13. Li, X.; Yan, Y.; Tu, J. The simplification of computer simulated persons (CSPs) in CFD models of occupied indoor spaces. Build. Environ. 2015, 93, 155–164. [CrossRef] 14. Yan, Y.; Li, X.; Yang, L.; Tu, J. Evaluation of manikin simplification methods for CFD simulations in occupied indoor environments. Build. Environ. 2016, 127, 611–626. [CrossRef] 15. Forberg, A.; Mayer, H. Simplification of 3D building data. 3D building data. ZFV-Zeitschrift fur Geodasie, Geoinformation und Landmanagement 2006, 131, 148–152. 16. Kada, M. 3D building generalization based on half-space modeling. Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2006, 36, 58–64. 17. Rau, J.-Y.; Chen, L.; Tseng, D.-C. Automatic Generalization of Digital Building Models. In Proceedings of the Asian Association on Remote Sensing—26th Asian Conference on Remote Sensing and 2nd Asian Space Conference (ACRS 2005), Hanoi, Vietnam, 7–11 November 2005; Volume 2. 18. He, S.; Moreau, G.; Martin, J.-Y. Footprint-based generalization of 3D building groups at medium level of detail for multi-scale urban visualization. Int. J. Adv. Softw. 2012, 5, 377–387. 19. Zhao, J.; Zhu, Q.; Du, Z.; Feng, T.; Zhang, Y. Mathematical morphology-based generalization of complex 3D building models incorporating semantic relationships. ISPRS J. Photogramm. Remote Sens. 2012, 68, 95–111. [CrossRef] 20. Geiger, A.; Benner, J.; Haefele, K.H. Generalization of 3D IFC building models. In 3D Geoinformation Science; Springer: Berlin/Heidelberg, Germany, 2015; pp. 19–35. 21. Ayala, P.; Cantizano, A.; Gutiérrez-Montes, C.; Rein, G. Influence of atrium roof geometries on the numerical predictions of fire tests under natural ventilation conditions. Energy Build. 2013, 65, 382–390. [CrossRef] 22. Piepereit, R.; Deininger, M.; Kada, M.; Pries, M.; Voß, U. A Sweep-plane Algorithm For The Simplification Of 3d Building Models In The Application Scenario Of Wind Simulations. Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2018, XLII-4/W10, 151–156. [CrossRef] 23. Gullberg, R. Computational Fluid Dynamics in OpenFOAM. 2017. Available online: http://folk.ntnu.no/preisig/HAP_Specials/AdvancedSimulation_files/2017/project%20reports/CFD/ Rebecca%20Gullberg%20-%20CFD_Mesh_Report.pdf (accessed on 30 June 2020) 24. Greenshields, C.J. OpenFOAM user guide. OpenFOAM Found. Ltd Version 2015, 3, e2888. 25. Hefny, M.M.; Ooka, R. CFD analysis of pollutant dispersion around buildings: Effect of cell geometry. Build. Environ. 2009, 44, 1699–1706. [CrossRef] 26. Sosnowski, M.; Gnatowska, R.; Grabowska, K.; Krzywa´nski,J.; Jamrozik, A. Numerical Analysis of Flow in Building Arrangement: Computational Domain Discretization. Appl. Sci. 2019, 9, 941. [CrossRef] 27. Butlin, G.; Stops, C. CAD data repair. In Proceedings of the 5th International Meshing Roundtable, Pittsburgh, PA, USA, 10–11 October 1996; pp. 7–12. 28. Guo, J.; Ding, F.; Jia, X.; Yan, D.-M. Automatic and high-quality surface mesh generation for CAD models. Comput.-Aided Des. 2019, 109, 49–59. [CrossRef] 29. Wang, J.; Yu, Z. A novel method for surface mesh smoothing: Applications in biomedical modeling. In Proceedings of the 18th international meshing roundtable, Salt Lake City, UT, USA, 25–28 October 2009; Springer: Berlin/Heidelberg, Germany, 2009; pp. 195–210. 30. Osada, R.; Funkhouser, T.; Chazelle, B.; Dobkin, D. Matching 3D models with shape distributions. In Proceedings of the International Conference on Shape Modeling and Applications, Genoa, Italy, 7–11 May 2001; IEEE: New York, NY, USA, 2001; pp. 154–166. 31. Osada, R.; Funkhouser, T.; Chazelle, B.; Dobkin, D. Shape distributions. ACM Trans. Graph. 2002, 21, 807–832. [CrossRef] Appl. Sci. 2020, 10, 5425 18 of 18

32. Wohlkinger, W.; Vincze, M. Ensemble of shape functions for 3D object classification. In Proceedings of the 2011 IEEE International Conference on Robotics and Biomimetics, Phuket, Thailand, 7–11 December 2011; pp. 2987–2992. 33. Bhattacharyya, A. On a measure of divergence between two statistical populations defined by their probability distributions. Bull. Calcutta Math. Soc. 1943, 35, 99–109. 34. White, D.R.; Saigal, S.; Owen, S.J. Meshing complexity: Predicting meshing difficulty for single part CAD models. Eng. Comput. 2005, 21, 76–90. [CrossRef] 35. DURAARK Datasets. Available online: http://duraark.eu/data-repository/ (accessed on 27 April 2020). 36. East, E.W. Common Building Information Model Files and Tools. Available online: https://www.nibs.org/ page/bsa_commonbimfiles (accessed on 27 April 2020). 37. Dimyadi, J.; Dimalen, D. Open IFC Model Repository. Available online: http://openifcmodel.cs.auckland.ac. nz/ (accessed on 27 April 2020). 38. Krijnen, T. IfcOpenShell. 2011. Available online: http://ifcopenshell.org (accessed on 30 June 2020). 39. OPEN CASCADE Company. ; OPEN CASCADE Company: Guyancourt, France, 2019. 40. Paviot, T.; Feringa, J. pythonOCC; 3D CAD/CAE/PLM Development Framework for the Python Programming Language. 2018. Available online: https://github.com/tpaviot/pythonocc (accessed on 30 June 2020) 41. Jureti´c,F. cfMesh User Guide. Creat. Fields Ltd. 2015. Available online: http://cfmesh.com (accessed on 30 June 2020). 42. Lee, W.; Kim, D.; Park, Y.; Huh, K.Y. Development of a Web-Based Open Source CAE Platform for Simulation of IC Engines. Int. J. Automot. Technol. 2020, 21, 169–179. [CrossRef] 43. Hoyle, B.; Rau, M.M.; Paech, K.; Bonnett, C.; Seitz, S.; Weller, J. Anomaly detection for machine learning redshifts applied to SDSS galaxies. Mon. Not. R. Astron. Soc. 2015, 452, 4183–4194. [CrossRef]

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).