Next Article in Journal
MonoLENS: Monocular Lightweight Efficient Network with Separable Convolutions for Self-Supervised Monocular Depth Estimation
Previous Article in Journal
Improvement of Mandibular Kinetics and Quality of Life in Elderly with Mini-Implant Retained Overdentures: A Preliminary Study
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Performance-Enhanced Cartesian Grid Generation Method: More Robust, Efficient, and Memory-Efficient

China Aerodynamics Research and Development Center, Mianyang 621000, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(19), 10392; https://doi.org/10.3390/app151910392
Submission received: 2 July 2025 / Revised: 15 August 2025 / Accepted: 20 August 2025 / Published: 25 September 2025
(This article belongs to the Section Fluid Science and Technology)

Abstract

To address the limitations of poor robustness, low efficiency, and memory waste in traditional Cartesian grid generation, this paper proposes targeted improvements focusing on three key aspects: the surface mesh data structure, the Cartesian grid data structure, and the determination of the spatial relationship between the grid and the object surface. Specifically, a nested bounding box-based binary tree is established to store discrete triangles, enhancing the efficiency and accuracy of triangle data access. Secondly, a “member packaging and neighbor threading” Cartesian grid structure is constructed, improving generation speed while reducing memory consumption. Thirdly, a comprehensive Cartesian cell classification method is developed, integrating intersection checks, interior/exterior classification, and intersected cell center assessment; three strategies are further proposed to accelerate intersection checks for large-scale grids. The performance of Cartesian grid generation is compared with traditional methods and the commercial CFD code. The results demonstrate a grid generation efficiency of less than two seconds per million cells, significantly outperforming traditional methods, with a 20% reduction in memory consumption. Finally, an airflow simulation past a train illustrates the suitability of the generated grids for practical computational applications.

1. Introduction

Computational Fluid Dynamics (CFD) is increasingly applied in various engineering fields, including aerospace, rail transportation, and construction. As these applications involve increasingly complex geometries and flow fields—such as aircraft [1], high-speed train bogies and pantographs [2], and bridges [3]—the challenges of mesh generation are becoming more pronounced. As a fundamental component of the CFD process, mesh generation plays a critical role, with its robustness, efficiency, and memory usage directly affecting the accuracy and effectiveness of numerical simulations for complex configurations and flow scenarios.
Compared to conventional structured and unstructured meshes, Cartesian grids offer several advantages, including high automation [4,5], excellent adaptability to complex configurations [6,7], and effective capture of flow field structures [8,9,10]. These benefits make Cartesian grids especially useful for simulating complex geometries, drawing significant interest from researchers [11,12,13,14,15,16]. Conventional mesh generation methods involve creating spatial grids that conform to the object’s surface boundaries, typically dividing the process into generating surface and spatial meshes, as shown in Figure 1a,b. In contrast, Cartesian grids are generated directly without relying on surface meshes, resulting in a more streamlined generation process. However, this approach necessitates determining the spatial relationship between the object surface and Cartesian grids, as shown in Figure 1c. Consequently, the robustness, efficiency, and memory usage of Cartesian grid generation critically depend on three core components: the surface mesh data structure, the Cartesian grid data structure, and the method for determining their positional relationship.
Surface meshes are typically represented using discrete triangles, which presents a key challenge in generating Cartesian grids: efficiently reading and storing triangle details using an appropriate data structure. The subsequent tasks—such as determining the Cartesian cell type, calculating wall distances, and reconstructing wall flow variables—depend heavily on effectively retrieving and utilizing triangular information. The efficiency of these processes is closely linked to the data structure used for triangles, which directly impacts both Cartesian grid generation and flow field computation. Therefore, developing a well-designed and efficient data structure for triangles is crucial for enhancing the performance of both Cartesian grid generation and flow field computation. The most common method involves sequentially storing triangle information in an array and using a traversal query to retrieve target triangles. This approach is straightforward, easy to implement, and accurate. When the number of surface triangles is small, the computational cost remains affordable. However, for complex 3D configurations or flows, the number of triangles can reach O (105) to O (106), while the number of the Cartesian cells may soar to O (108) to O (109). The traversal retrieval method can lead to a computational load of O (1013) to O (1015), imposing significant demands on the overall computation source. Identifying that many triangles may not be relevant for the current calculations allows for optimizations; hence, there is no need to compute them. To address this issue, Bonet and Peraire [17] proposed using the Alternating Digital Tree (ADT) to store triangles, significantly improving computational efficiency and making it one of the most popular methods for managing surface mesh data [18]. The ADT abstracts each specific research object through a unique definition that does not depend on the object details, organizing each object within a binary tree structure. Moreover, the ADT cleverly introduces a mapping that extends finite-sized research objects in D-dimensional space to points in 2D space, thereby simplifying the problem of finding intersections between finite-sized objects to locating points within a target area [19]. This enables the rapid elimination of non-target triangles during intersection checks between Cartesian cells and triangles. However, the ADT constructs the binary tree by alternately splitting the search space along the x, y, and z axes, which makes the tree structure highly dependent on the geometric complexity and the distribution density of triangles. This results in an imbalanced binary tree, ultimately leading to unstable efficiency when retrieving triangle information. Therefore, there remains a critical need to develop an efficient surface mesh data structure that can consistently enhance performance across various scenarios.
For Cartesian grids, the data structure not only stores grid information but also provides a logical framework for accessing and modifying that information. An efficient data structure can thus significantly reduce memory usage, facilitate adaptive processes, and enhance the mesh generation efficiency. Common Cartesian grid data structures include unstructured and tree-based methods. Unstructured data structures do not use hierarchical information to infer grid topology. While this method offers flexibility, it requires establishing a vertex-edge-face-cell mapping to ensure unique topological relationships between cells [20]. This complexity results in intricate program implementation and high memory overhead, with each Cartesian cell typically occupying around 30 to 100 words of storage space [21]. Tree-based data structures have long been the mainstream method for hierarchical storage [22,23,24,25,26]. In a tree structure, access paths between layers are established using pointers. This compact format provides nearly all grid connectivity information, and the scalability of leaf nodes facilitates easier adaptation. However, tree-based data structures still exhibit notable shortcomings in two key areas. On the one hand, they tend to consume excessive memory. Since the size of the tree is unknown at compile time, null pointers must be allocated for each leaf node to accommodate future dynamic refinement or coarsening based on geometric or flow field changes. This leads to significant memory wastage, particularly in Cartesian grids, where the majority of cells are leaf nodes, resulting in substantial memory inefficiencies due to numerous idle null pointers. On the other hand, there is instability in neighbor query efficiency. When querying two adjacent Cartesian cells, the path needed for the query can vary depending on their relative positions in the tree, potentially requiring one or more traversals and, in the worst case, even backtracking to the root node. Therefore, further optimization of the tree structure is essential to reduce memory usage and improve neighbor query efficiency.
After reading and storing the geometric surface triangles and generating the initial uniform Cartesian grid, the next step is to determine the positional relationship between the Cartesian grid and the object surface. The accuracy of this determination is crucial for the success of grid generation and flow field calculations, while the efficiency of the process is a core factor impacting the overall performance of grid generation. Various methods exist for determining the positional relationship between the Cartesian grid and the surface. Conventional approaches include the winding number method [27] and the ray tracing method [28,29,30]. The winding number method calculates the sum of angles formed by traversing the boundary of a closed object from the perspective of a test point. If the sum is zero, the point is outside the object; otherwise, it is considered inside. However, this method is less commonly used in practice due to two main drawbacks: it involves numerous small-angle floating-point calculations that can introduce rounding errors, and it requires traversing each edge or face, leading to high computational costs. In contrast, the ray tracing method is widely adopted due to its simplicity and ease of implementation. This method casts a ray from the point in question and determines its position relative to the surface based on the number of intersection points. An even number of intersections indicates the point is outside, while an odd number suggests it is inside. However, ray tracing can sometimes misclassify points due to floating-point calculation errors, resulting in external points being classified as internal, and vice versa. To mitigate the impact of these errors, Capizzano [20] introduced a small threshold value, η. When the result falls below this threshold, an additional ray is cast for further evaluation. While this approach enhances accuracy, it struggles with robustness, particularly for complex geometric shapes. Furthermore, to assess whether a Cartesian cell intersects with the object surface, all eight vertices must be checked. This requirement significantly reduces the efficiency of the ray tracing method, negatively affecting the overall computation cycle and complicating the demands of intricate 3D geometric and flow field calculations. Therefore, there is a pressing need to develop methods for determining the relative position between Cartesian grids and surfaces that effectively address robustness and efficiency.
In summary, this paper is oriented to complex 3D configurations, focusing on the three objectives of Cartesian mesh generation: high robustness, high efficiency, and low memory consumption. Starting from the three core aspects of Cartesian mesh generation, the surface mesh data structure, Cartesian grid data structure, and the method for determining the positional relationship between Cartesian cells and triangles, this paper analyses the reasons for the defects of the conventional method and puts forward improvement measures to develop a reasonable Cartesian mesh generation method. Building on this foundation, it evaluates the robustness, efficiency, and memory consumption of the proposed method qualitatively and quantitatively, comparing it with conventional approaches to highlight its advantages.

2. Surface Mesh Data Structure Based on Nested Bounding Boxes

To address the imbalance issues commonly associated with conventional ADT data structure, this paper proposes a method for constructing binary trees by splitting along the dimension with the maximum variance, rather than alternating between the x, y, and z axes. The data is sorted along this dimension, and the media position is used to split the data into two parts, corresponding to the left and right nodes of the binary tree. This approach ensures that both the splitting dimension and the splitting position are optimal, resulting in a well-balanced binary tree. Algorithm 1 lists the pseudocode for constructing a binary tree, where Ntri denotes the current number of triangles.
Algorithm 1: Construct the binary tree
1:If (Ntri = 1) then
2: Allocate (TreeNode % Tri)
3: TreeNode % Tri = The last triangle
4: TreeNode % Left => Null ()
5: TreeNode % Right => Null ()
6:Else if (Ntri = 2) then
7: Allocate (TreeNode % Tri)
8: TreeNode % Tri = The first triangle
9: TreeNode % Splitaxis = x-direction
10:If (x-coordinate of the first triangle > x-coordinate of the second triangle) then
11:  TreeNode % Left => The second triangle
12:  TreeNode % Right => Null ()
13:Else
14:  TreeNode % Left => Null ()
15:  TreeNode % Right => The second triangle
16:Endif
17:Else
18:Call Find the direction of greatest discrete
19:TreeNode % Splitaxis = The direction of greatest discrete
20:Call Sort under Splitaxis
21:TreeNode % Tri = The median triangle
22: TreeNode % Left => Smaller coordinate than that of the median triangle
23: TreeNode % Right => Larger coordinate than that of the median triangle
24:Endif
Additionally, this paper introduces an approach to spatial partitioning by storing all vertex information of triangles while constructing a binary tree. By doing so, we can create a bounding box for each tree node, representing the smallest rectangular space enclosing all triangles associated with that node. During the spatial partitioning process, these bounding boxes are divided concurrently. It is important to highlight that the bounding box for each tree node encapsulates all triangles within its spatial region, while the partitioning itself is based on planes determined by triangle centroids. This results in overlapping regions between the partitioning planes and the bounding boxes of both the left and right child nodes, as illustrated in Figure 2a. Additionally, nesting occurs between the bounding boxes of parent and child nodes, as shown in Figure 2b. Therefore, we refer to the constructed binary tree as the Binary Tree based on Nested Bounding Boxes (BT-NBB). This binary tree form proposed in this paper can be used to determine the spatial relationship between Cartesian cells and surface triangles, accurately excluding triangles that do not intersect with the target Cartesian cell, enhancing the robustness of the judgment. Further applications of this nested bounding box format will be elaborated in Section 4.1.
To demonstrate the balance and efficiency of the binary tree constructed using the present method, we partition a two-dimensional space containing 17 data points and compare binary trees built using both conventional and present methods. The partitioning process and the resulting binary trees are illustrated in Figure 3. As shown, the binary tree constructed using the conventional method has a depth of 7 and exhibits an imbalanced structure characterized by deep left branches and shallow right branches. In contrast, the binary tree built using the present method achieves a depth of only 4 and exhibits a more balanced structure. To retrieve the information for point Q, the path in the conventional ADT method is A-H-J-L-M-O-P-Q, while the path using the present method is J-O-N-P-Q. When retrieving information for all 17 points from A to Q, the conventional method requires 72 retrievals, whereas the present method only needs 59. This represents a significant improvement in retrieval efficiency. The efficiency comparison of these two methods in practical Cartesian grid generation is detailed in Section 5.2.

3. Cartesian Grid Data Structure Based on Member Packaging and Neighbor Threading

To tackle two significant issues associated with the conventional 2N tree Cartesian grid data structure—namely, memory waste from numerous leaf nodes containing null pointers and efficiency instability due to neighbor queries potentially tracing back to the root node—this paper introduces a Cartesian grid data structure that incorporates member packaging and neighbor threading. Member packaging effectively reduces memory consumption, while neighbor-threaded design improves the efficiency of neighbor queries.
Member packaging involves encapsulating a Cartesian cell along with its siblings, resulting in a combined structure referred to as an Oct. In the conventional 2N tree data structure, all leaf cells are allocated null pointers due to the uncertainty of whether they will require further refinement, leading to unnecessary memory usage. In contrast, the data structure based on member packaging and neighbor threading consolidates all sibling leaf cells into a single Oct, as illustrated in Figure 4. Although the member packaging introduces additional overhead related to memory allocation for child octants, it only requires a single null pointer to allocate extra space for potential future refinements, rather than the traditional 2N null pointers, thus optimizing memory allocation. Most importantly, since a significant proportion of cells in Cartesian grids are leaf cells, this encapsulation effectively reduces overall memory consumption. It should be noted that A and B represent root octants corresponding to the coarse Cartesian grid, which cannot be future coarsened.
Neighbor threading not only establishes pointers between parent and child nodes but also allocates four (or six in 3D) additional pointers to the neighbors of the corresponding Oct within the parent cell. This configuration creates a fully threaded access path between cells and their neighbors. As illustrated in Figure 4, when querying the right neighbor cell b of a spatially adjacent cell a, only one operation is required, as the Oct corresponding to cell a’s parent cell stores the right neighbor. The query path is indicated by the dashed line in Figure 4b. In theory, the average number of neighbor queries for the conventional 2N tree data structure is approximately 2. In contrast, for the Cartesian grid data structure presented in this paper, if the neighbor is a sibling, it can be determined directly; otherwise, only one query is needed to locate the neighbor. Consequently, the average number of neighbor queries is around 0.5. This demonstrates that the Cartesian grid data structure ensures consistent efficiency in neighbor queries. A detailed quantitative comparison with the conventional 2N data structure will be provided in Section 5.2.
The implementation process for constructing the member packaging and neighbor threading data structure requires allocating a series of pointers and storing the essential flow field information, location information, and connectivity information, as illustrated in Figure 5. Since all cells are grouped with their siblings into an Oct, each Oct is assigned 2N pointers to all the cells contained within it (Son1, Son2, …, Son2N). Additionally, each Oct holds a pointer to its parent cell (OctFather). To maintain the consistency of neighbor relationships, the level difference between neighboring cells must not exceed 1, and the level of a neighboring cell must be less than or equal to that of the target cell. As a result, each Oct holds six pointers to the parent cells of its six adjacent Octs (OctNeighbor). To facilitate navigation, each Oct must also store its central coordinates (OctCenter) and level information (OctLevel), which corresponds to that of its parent cell. The Cartesian grid data structure features dual-link relationships, requiring not only that each Oct has location information and pointers but also that each Cartesian cell maintains corresponding pointers for effective communication with the Oct. Each Cartesian cell points to its child Oct (OctSon). If the Cartesian cell is a leaf cell—indicating it has not been refined—the pointer is set to null. Conversely, when a leaf cell is refined, a pointer to the appropriate Oct is established. In addition to connectivity information, each Cartesian cell must store flow field data (u, v, w, ρ, T), whether it intersects with a geometrical surface (Cross), triangles intersecting the geometrical surface (TriCross), and the relative position concerning sibling cells (Location).

4. Determination of the Spatial Relationship Between the Cartesian Cell and the Geometric Surface

Based on the relative positions of Cartesian cells and a geometric surface, we classify the cells into three categories: cells intersected with the geometric surface, cells inside the object, and cells outside the object. To facilitate subsequent flow field calculations, we further categorize the intersected cells into two subtypes: cells with centers inside the object and cells with centers outside the object. This section aims to develop a robust and efficient Cartesian cell classification method to address the limitations of conventional approaches in terms of robustness and efficiency. The process for determining the spatial relationship between the Cartesian cell and the geometric surface is illustrated in Figure 6. For each input Cartesian cell, the first step is to use a Cartesian cell-triangle intersection algorithm based on the Separating Axis Theorem to determine whether the Cartesian cell intersects with the geometric surface (intersection check). If the Cartesian cell does not intersect the geometric surface, a painting algorithm is used to classify the cell as inside or outside the object. (inside-outside classification). If the Cartesian cell does intersect with the geometric surface, a dot product algorithm is employed to determine whether the center of the cell is inside or outside the object (center determination). Finally, output the Cartesian cell type.

4.1. Intersection Check Based on the Separating Axis Theorem

The Separating Axis Theorem (SAT) can be intuitively understood through a simple analogy: imagine shining a flashlight on two objects from various angles. By observing the shadows these objects cast on nearby surfaces, you can assess whether they intersect. If, when viewed from any angle, there are no gaps between their shadows, then the two objects must overlap. Conversely, if the shadows are discontinuous, this indicates that the objects do not touch, suggesting the presence of a separating axis between them. By utilizing SAT in our intersection check, we can reliably determine whether a Cartesian cell intersects with a triangle, thereby enhancing the accuracy of the classification process. The Separating Axis Theorem is illustrated in Figure 7.
To apply the SAT for determining whether a Cartesian cell intersects with a triangle, we first need to identify several key parameters: face normal vectors of the Cartesian cell, e1 = (1, 0, 0), e2 = (0, 1, 0), and e3 = (0, 0, 1); Cartesian cell dimensions hx, hy, and hz; and cell center c. Additionally, define three vertices of the triangle v1, v2, and v3; triangle edges l1, l2, and l3; and the triangle normal vector n. To simplify calculations, shift the Cartesian cell center to the origin while maintaining the relative positions between the Cartesian cell and the triangle, as illustrated in Figure 8. The SAT requires 13 axis tests, categorized into three types: (1) The first three tests check whether the Cartesian cell intersects with the bounding box of the triangle, using the face normal vectors of the Cartesian cell. (2) The fourth test evaluates whether the Cartesian cell intersects with the plane defined by the triangle, using the normal vector of the triangle. (3) The remaining nine tests are based on the cross-products of the Cartesian cell’s face normal vectors with triangle edges. If all 13 tests pass, it indicates that no separating axis exists, and the routine returns “The Cartesian cell intersects with the triangle.” If any test identifies a separating axis, terminate the tests immediately and return “The Cartesian cell does not intersect with the triangle.” The algorithm offers two primary advantages. First, it is efficient, employing basic vector operations, which allows for quick computations; once a separating axis is identified, the process can be halted. Second, it is accurate. Since this algorithm was initially proposed by Möllser [31] and has applications in the existing literature [32], the specifics of the implementation will not be discussed further in this paper.
The algorithm described above is designed to determine the intersection between a single Cartesian cell and a single triangle. In practical mesh generation scenarios, the number of geometric surface discretization triangles can range from 105 to 106, while the number of Cartesian cells can reach 108 to 109. Using a brute-force approach to check intersections between each Cartesian cell and the triangle results in a computational load on the order of 1013 to 1015, which is prohibitively high. Consequently, the efficiency of mesh generation falls short of engineering requirements. To achieve accurate intersection determination while minimizing computational costs and enhancing mesh generation efficiency, this paper proposes the following three measures:
Exclude Cartesian cells outside the geometric minimum bounding box.
Given that the computational domain is significantly larger than the geometric minimum bounding box, any Cartesian cell outside the bounding box cannot intersect with the geometric surface. Therefore, checking for intersections between the target Cartesian cells and the geometric minimum bounding box allows for rapid elimination of cells that do not intersect with the surface. Figure 9 illustrates the comparison of Cartesian cells before and after applying this step, highlighting a significant reduction in the number of cells to be evaluated. For those cells that remain, the Cartesian cell-triangle intersection algorithm is then applied for further precise determination.
Use BT-NBB to quickly exclude non-target triangles.
This step is crucial for improving the efficiency of determining intersecting Cartesian cells. As previously mentioned, during the construction of the BT-NBB, each node stores the bounding box information of its corresponding space. Therefore, the positional relationship between the target Cartesian cell and the bounding box of each tree node can be assessed first. This step aims to reduce unnecessary recursive operations in the tree and quickly exclude triangles that do not intersect with the target Cartesian cell. In the actual execution of the algorithm, the process begins by checking if the target Cartesian cell intersects with the root node of the BT-NBB. If there is no intersection, it indicates that the target Cartesian cell does not intersect with the geometric surface, and the algorithm terminates, returning a value of “Non-intersection”. Conversely, check the left and right child nodes of the root node separately, recursively applying the same operation until all triangles have been evaluated. The pseudocode for determining the intersection between the Cartesian cell and triangles, integrated with the BT-NBB, is illustrated in Algorithm 2. In this code, (Tmin, Tmax) represents the coordinate information of the target Cartesian cell T. Initially, the algorithm excludes Cartesian cells that do not intersect with the geometric minimum bounding box, ensuring that only relevant checks are performed.
It is important to note that Figure 2 illustrates the presence of nested bounding boxes, indicating that these nested regions contain triangles. As a result, the target Cartesian cell may intersect with both the left and right subtrees during the execution of the aforementioned program. In such cases, separate searches for each subtree are necessary. When this circumstance arises at a shallower level in the tree, it may require recursion to deeper nodes to determine the type attribute of the target Cartesian cell, which can lead to increased CPU time consumption. Conversely, if this intersection occurs at a deeper level of the tree, its impact on computational efficiency is minimal.
Algorithm 2: The Cartesian cell—triangle intersection determination algorithm integrated with the BT-NBB
1:If ((Timin, Timax) ∩ (Gimin, Gimax) = Ø ) then
2: T%Status = Non-intersection
3:Return
4:Else
5: Call Cartesian cell-triangle intersection determination algorithm (T)
6:If (T%Status = Non-intersection) then
7:  If (the left subtree, TL, exists and TLimin, TLimax) ∩ (Gimin, Gimax) ≠ ) then
8:   Call Cartesian cell-triangle intersection determination algorithm (TL)
9:   Endif
10:If (the right subtree, TR, exists and TRimin, TRimax) ∩ (Gimin, Gimax) ≠ ) then
11:    Call Cartesian cell-triangle intersection determination algorithm (TR)
12:   Endif
13:Endif
14:Endif
Store triangles that intersect with the Cartesian cell.
The process of generating a Cartesian grid primarily involves creating the background grid, recursively refining the Cartesian cells that intersect with the surface triangles, and smoothing the cells to ensure that the level difference between adjacent cells does not exceed one. Among these steps, the recursive refinement is crucial for achieving the desired cell resolution near the surface. A key prerequisite for refining intersecting cells is determining the cell type—whether a Cartesian cell intersects with the surface or not. In practical applications of Cartesian cell type determination, the initial background grid cells can be relatively large, often intersecting multiple triangles, as shown in Figure 10. If we store and mark the triangles intersected by each Cartesian cell, then during refinement, we only need to check if the child cells intersect with the previously marked triangles when determining their intersection with the surface. This paper leverages the parent–child relationship inherent in the Cartesian grid, allowing the number of triangles to check for each Cartesian cell to decrease as the refinement progresses. This approach significantly improves the efficiency of mesh generation.
After performing the intersection determination step for all Cartesian cells, the Cartesian cells are divided into intersected cells and non-intersected cells, as shown in Figure 11 (the non-intersected cells include the region inside the sphere). The cell type determination results are consistent with known positional relationships, proving the correctness of the algorithm. Quantitative results regarding intersection determination efficiency will be further analyzed in Section 5.2.

4.2. Inside-Outside Classification Based on the Painting Algorithm

The painting algorithm is fundamentally an unstructured traversal method that identifies and classifies objects sharing common properties. Its primary advantage lies in the ability to quickly propagate specific attributes to neighboring units without the need to independently test each target unit, thereby reducing classification complexity. The basic principle is as follows: Mark a particular cell for which we are sure that it is outside the geometry. Investigate its neighbors not intersected by the geometry. If the neighbor is not marked, mark it and process its neighbors.
For Cartesian cells, intersected cells have been identified, and non-intersected cells need to be further distinguished. This characteristic aligns well with the painting algorithm, which is both efficient and robust. Therefore, this paper uses the painting algorithm to classify the internal and external Cartesian cells.
In the Cartesian grid framework for internal and external classification using the painting method, the first step is to identify the painting source. Since the Cartesian cell located at the bottom-left of the computational domain is an external cell, it is used as the painting source, as shown in Figure 12, with the attribute of “external cell.” Next is the painting process based on the neighboring cell query algorithm. Mark the neighbors of the painting source as “external cells”. When a neighbor is an intersected cell, do not use this cell to propagate the painting process further. At this point, all painted cells are marked as external cells, and the remaining ones are considered internal or intersected cells. Continuing with the sphere example, a painting algorithm is employed to distinguish between interior and exterior cells. As illustrated in Figure 13, external cells are highlighted in red, while internal cells remain blue. This method effectively and accurately differentiates between interior and exterior cells.

4.3. Determination of the Intersected Cell Center Based on the Sign of a Dot Product

Since Cartesian grids are non-body-fitted, handling the geometry boundary is crucial for this type of grid. Proper handling of the wall boundary imposes stringent requirements on the accuracy of the grid type near the geometry boundary. Currently, there are three known types of cells: intersected cell, interior cell, and exterior cell. The center of an intersected cell may be either inside or outside the geometric surface. If the center of an intersected cell is outside the geometric surface, it is considered a fluid cell and will participate in flow field calculations. Therefore, further differentiation of the centers of intersected cells is required.
This paper uses the dot product method to identify the position of the Cartesian cell center. Implementing the dot product method is as follows: First, determine the outward normal vector n1 of the triangle intersecting with the target Cartesian cell and the vector n2 from the center of the intersecting triangle to the center of the target Cartesian cell. Then, the position relationship between the Cartesian cell center and the geometric surface is determined by checking the sign of the dot product of these two vectors. If the dot product is positive, the center of the target Cartesian cell is on the same side as the outward normal vector of the triangle, meaning it is outside the object. Conversely, if the dot product is negative, the target Cartesian cell center is inside the object. A schematic diagram of the dot product method for determining the relative position of the Cartesian cell center is shown in Figure 14.
It is worth noting that in the Cartesian cell-triangle intersection determination algorithm, the triangles intersecting with the Cartesian cell are already stored. As a result, only one dot product check is needed after the intersection determination. The dot product method avoids the need to re-evaluate all intersected cells as required by the conventional ray tracing method, and it involves only a few addition, subtraction, and multiplication operations, making it efficient and accurate. For example, the dot product method determines the positional relationship between the intersected cell center and the sphere, as shown in Figure 15. Cartesian cells with centers located inside the object, denoted as Cin, are marked in orange, while those with centers outside the object, denoted as Cout, are marked in yellow. From the marking results, it can be seen that the dot product method correctly distinguishes the intersected cell centers.

5. Performance Evaluation of Cartesian Grid Generation Method

To evaluate the performance of the proposed method of Cartesian grid generation, this section tests metrics such as robustness, grid generation efficiency, and memory consumption. The tests are conducted on an Intel single-core Gold 6240R processor, and all programs are compiled on the Visual Studio 2013 platform. For the tests on program runtime and memory consumption, the program is run 10 times to minimize random errors, and the average values are analyzed.

5.1. Robustness

This section evaluates the robustness of the proposed method using six 3D geometric shapes: sphere, train, bogie, pantograph, car, and DPW6 aircraft. These shapes vary in complexity and span multiple industries, providing a comprehensive assessment of the algorithm’s robustness. Figure 16 displays the Cartesian grids generated using the described method. The figure demonstrates that, whether dealing with simple shapes like a sphere or more intricate configurations such as a bogie or pantograph, the generated grids faithfully represent the geometric shapes with a well-distributed mesh, indicating that the enhanced Cartesian grid generation method proposed in this paper is both feasible and reliable. Additionally, the Cartesian grid generated in this paper has an aspect ratio of 1:1, and due to the orthogonality of the Cartesian grid, it is free from distortion.

5.2. Efficiency

As mentioned earlier, factors affecting the efficiency of Cartesian grid generation include the surface mesh data structure, the Cartesian grid data structure, and the cell type determination method. In practical applications, two additional factors also directly affect mesh generation efficiency. One is the density of the surface triangular mesh, which influences the time required to retrieve triangle information and determine intersected cells. The other is the number of Cartesian cells, which impacts the time needed to assess intersected cells and interior/exterior cells. Therefore, to evaluate the efficiency of the mesh generation method proposed in this paper and its advantages over conventional methods, this section conducts quantitative tests from the five aspects mentioned above. The configurations used for testing consist of six forms with varying complexity, as illustrated in Figure 16. It is important to note that this section is solely dedicated to evaluating mesh generation efficiency and does not assess whether the mesh meets the requirements for flow field calculations. The number of triangles ranges from 103 to 106, while the number of Cartesian cells spans from 106 to 108. The specific test results are as follows:
The impact of surface mesh data structure on mesh generation efficiency.
Before evaluating the impact of surface mesh data structures on mesh generation efficiency, we first compared the time taken to create conventional ADTs and BT-NBBs presented in this paper, as shown in Table 1. Ntri and NCart mean the number of triangles and Cartesian cells, respectively. Overall, the time required to build ADTs is less than that for BT-NBBs. For geometrical shapes of varying complexity, the time difference in creating BT-NBBs can be substantial. For example, the construction times for a train model with 386,282 triangles and a car model with 1,211,367 triangles are 0.62 s and 3.89 s, respectively. This indicates that when the number of triangles triples, the construction time increases by more than sixfold. Combined with construction time data from other geometric shapes, this demonstrates that the construction time does not maintain direct proportionality to the number of triangular meshes. Instead, the time required to construct ADTs increases approximately linearly with both the geometric complexity and the number of triangles. This is because, during the construction of ADTs, the space containing triangles is divided alternately along the x, y, and z axes, with the resulting subspaces corresponding to the sub-nodes of the ADT. The required time is solely dependent on the number of alternating divisions, which is related to the configuration’s complexity and the number of triangles. However, constructing a BT-NBB requires determining which axis to use for space partitioning (calculating the variance and identifying the dimension with the highest variance) and sorting all the data along that dimension. The time spent on these two steps—calculating variance and sorting—is uncertain, leading to a lack of regularity in the time required to construct the BT-NBB.
The three columns on the right side of Table 1 clearly demonstrate that the grid generation efficiency using the BT-NBB method exhibits at least an order of magnitude improvement over the ADT. Notably, for the car, the grid generation time is reduced from 1.29 h to under half a minute, resulting in an efficiency increase of more than two orders of magnitude. Although the construction of the BT-NBB takes 3.89 s compared to just 0.39 s for the ADT, the topological distribution of the surface triangles is generally stable, requiring the construction of either the BT-NBB or the ADT only once per calculation. Thus, the time savings in grid generation gained by sacrificing some tree construction time with the BT-NBB are significant.
The impact of Cartesian grid data structure on mesh generation efficiency.
Table 2 illustrates the comparison of CPU time using commercial CFD code Star-CCM+, the conventional 2N tree data structure and the member packaging and neighbor threading data structure (MP-NT). Given that the Star-CCM+ is also automatically generated grid, it is chosen as a comparison object. From the table, it can be observed that the grid generation efficiency of Star-CCM+ is relatively lower than the other two methods. This may be due to its use of a cutting cell approach. For the present method, multiple levels of refinement are required during the grid generation process, which alters the neighbor relationships. Consequently, it is essential to determine the neighbor relationships multiple times. The cumulative benefits of the MP-NT data structure lead to a total reduction of more than 50% than 2N. Furthermore, the DPW6 aircraft benchmarked in this study exhibits geometric similarities to the wing-body configuration tested in the earlier publication [26]. While the previous methodology achieved a mesh generation efficiency of approximately 1.1 s per million cells, our optimized approach reduces this to 0.47 s per million cells for comparable geometries, thereby further highlighting the enhanced efficiency of the proposed methodology.
The impact of cell type determination methods on the efficiency of intersection tests.
Table 3 compares the intersection test times using the ray tracing method and the approach presented in this paper based on the SAT. The results show that the proposed method improves intersection check efficiency in most cases by an order of magnitude. For the bogie, the efficiency increases by 312 times. Thus, the Cartesian cell-triangle intersection determination method based on the SAT ensures robustness and efficiency.
The impact of surface mesh density on Cartesian grid generation time.
The impact of surface mesh density on Cartesian grid generation time is mainly reflected in the retrieval of triangle information and the determination of intersected cells, with the surface mesh data structure having a significant effect. Therefore, Table 4 uses DPW6 aircraft as an example to compare the influence of surface mesh data structure on Cartesian grid generation time with varying surface mesh densities. The surface mesh ranges from 104 to 105 triangles, while the Cartesian grid is on the order of 107 cells. Even if the Cartesian grid is successfully generated, the CPU time required by ADT is two orders of magnitude longer than that of the BT-NBB method. As the number of triangles increases from 30,021 to 413,529, the time taken to generate the Cartesian grid using the BT-NBB method only rises from 9.53 to 18.17. The larger the number of triangles, the more pronounced the advantages of the BT-NBB method. Although constructing the BT-NBB tree takes longer when the surface mesh count is higher, it is a one-time effort. Sacrificing some construction time to gain benefits in grid generation time is worthwhile. Additionally, surface mesh triangle counts typically range from 104 to 105 and rarely reach the million level. Therefore, using the BT-NBB method proposed in this paper, the density of the surface mesh affects grid generation time, but the impact is minimal; even at higher densities, a high grid generation efficiency can still be maintained.

5.3. Memory Consumption

For Cartesian grids, the non-body-fitted characteristics result in a substantial number of cells for viscous flow calculations. This high cell count can lead to memory shortages during mesh generation or flow field computations, impacting the overall computational process. To alleviate memory consumption and reduce the demands on computer hardware, low-memory Cartesian grid technology is becoming an emerging trend. This section examines how the Cartesian grid data structure affects memory consumption.
Table 5 compares the memory consumption of the conventional 2N data structure with the MP-NT method. In six different configurations featuring varying complexities and numbers of Cartesian cells, the MP-NT data structure achieves over a 20% reduction in memory consumption compared to the conventional 2N structure. This result demonstrates that the MP-NT data structure is both stable and effective in minimizing memory usage for Cartesian grids.

5.4. Airflow Past a Train

To evaluate whether the generated Cartesian grid meets the requirements for actual calculations, an example of airflow over a train is examined. The incoming airflow velocity is 97.22 m/s, with a yaw angle of 0°. The total number of Cartesian cells is 7.25 million. The local pressure distribution on the train surface is shown in Figure 17, where a significant positive pressure region is observed near the nose, consistent with previous results in the literature [33]. Figure 17 also presents two planes (y = 0.05 and z = 0) to display the Cartesian grid distribution around the train. Figure 18 provides a quantitative comparison between the numerical pressure results and the wind tunnel experimental data at the z = 0 cross-section, with experimental details and results from [34]. In Figure 18, x denotes the position along the length of the train, with x = 0 representing the nose of the train. H represents the height of the train, and Cp is the pressure coefficient. The comparison clearly demonstrates that the numerical results closely align with the wind tunnel test data, confirming that the Cartesian grid generated in this study is highly effective for flow field calculations.

6. Conclusions

This article focuses on the Cartesian grid generation method, starting with the core aspects of Cartesian grid generation: the surface mesh data structure, the Cartesian grid data structure, and the determination of the positional relationship between the Cartesian grid and the geometrical surface. This study identifies the root causes of issues such as insufficient robustness, low efficiency, and memory waste in conventional methods for Cartesian grid generation, aiming to address these challenges. First, a surface mesh data structure based on nested bounding boxes is established to store discrete triangle information. Two criteria are employed to create a balanced binary tree: using maximum variance to determine the optimal splitting dimension and median nodes to identify the optimal splitting position. The spatial locations of the triangles are stored using nested bounding boxes, which enhances the accuracy and efficiency of retrieving and accessing triangle information. Second, by member packaging and neighbor threading in the Cartesian grid data structure, redundant null pointers in leaf cells are eliminated, reducing memory usage while establishing relationships between neighbors to enhance query efficiency. Finally, a set of methods for determining Cartesian cell types is established. Specifically, the methods involve using the Separating Axis Theorem to ascertain whether the Cartesian cell intersects with the geometric surface; employing a painting algorithm to determine whether the Cartesian cell is outside or inside the object; and utilizing the dot product method to identify whether the center of the intersected Cartesian cell is located inside or outside the object. In addition, to improve the efficiency and accuracy of intersection determination between large-scale triangles and Cartesian cells, this paper proposes three measures: excluding Cartesian cells that do not intersect with the geometric minimum bounding box; employing a surface mesh data structure based on the concept of nested bounding boxes to quickly eliminate non-target triangles; and storing triangles that intersect with the Cartesian cells.
To demonstrate the feasibility and reliability of the Cartesian grid generation method presented in this paper, six geometries of varying complexity—such as a sphere, train, bogie, pantograph, car, and DPW6 aircraft—covering diverse industries, are used to evaluate the robustness, efficiency, and memory consumption of the proposed method. Regarding robustness, our proposed method successfully generates Cartesian grids for six geometries, demonstrating exceptional robustness. For efficiency, we conducted a comprehensive evaluation from five perspectives, achieving a grid generation speed of no more than two seconds per million cells—marking a substantial improvement over conventional methods. Additionally, memory consumption is reduced by 20% compared to conventional methods. Furthermore, an example of airflow past a train is provided. The pressure profile on train surface closely aligns with the wind tunnel test data, confirming that the generated Cartesian grid meets the necessary requirements for actual calculations. Overall, our method demonstrates significant advancements in robustness, efficiency, and memory usage. However, considering that geometric deformations in practical engineering may require the reconstruction of surface mesh data structures, the associated time costs could become evident. Therefore, further enhancements in this area are warranted in future work.

Author Contributions

Conceptualization, Z.T. and J.C.; methodology, X.Y.; software, L.B.; validation, S.M.; formal analysis, C.L.; investigation, L.B.; resources, L.B.; data curation, S.M.; writing—original draft preparation, S.M.; writing—review and editing, S.M.; visualization, S.M.; supervision, L.B. and J.C.; project administration, L.B.; funding acquisition, L.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Acknowledgments

We are grateful for the resources provided by State Key Laboratory of Aerodynamics.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Zhou, H.; Hu, K.; Mao, L.; Sun, M.; Cao, J. Research on planing motion and stability of amphibious aircraft in waves based on cartesian grid finite difference method. Ocean Eng. 2023, 272, 113848. [Google Scholar] [CrossRef]
  2. Kim, H.; Hu, Z.; Thompson, D. Effect of different typical high speed train pantograph recess configurations on aerodynamic noise. Proc. Inst. Mech. Eng. Part F J. Rail Rapid Transit 2021, 235, 573–585. [Google Scholar] [CrossRef]
  3. Chen, J.; Xiao, Z.; Zheng, Y.; Zheng, J.; Li, C.; Liang, K. Automatic sizing functions for unstructured surface mesh generation. Int. J. Numer. Methods Eng. 2017, 109, 577–608. [Google Scholar] [CrossRef]
  4. Meng, S.; Zhou, D.; Yuan, X.; Li, X.; Chen, H.; Bi, L. Enhanced strategy for adaptive Cartesian grid generation with arbitrarily complex 3D geometry. Adv. Eng. Softw. 2022, 174, 103304. [Google Scholar] [CrossRef]
  5. Meng, S.; Zhou, D.; Bi, L.; Li, X.; Luo, C.; Du, H. Anisotropic Cartesian Grid Generation Strategy for Arbitrarily Complex Geometry Based on a Fully Threaded Tree. Comput. Des. 2023, 155, 103447. [Google Scholar] [CrossRef]
  6. Péron, S.; Benoit, C.; Renaud, T.; Mary, I. An immersed boundary method on Cartesian adaptive grids for the simulation of compressible flows around arbitrary geometries. Eng. Comput. 2021, 37, 2419–2437. [Google Scholar] [CrossRef]
  7. Al-Marouf, M.; Samtaney, R. A versatile embedded boundary adaptive mesh method for compressible flow in complex geometry. J. Comput. Phys. 2017, 337, 339–378. [Google Scholar] [CrossRef]
  8. Jude, D.; Sitaraman, J.; Wissink, A. An octree-based, cartesian navier–stokes solver for modern cluster architectures. J. Supercomput. 2022, 78, 11409–11440. [Google Scholar] [CrossRef]
  9. Herrero-Pérez, D.; Picó-Vicente, S.G. A parallel geometric multigrid method for adaptive topology optimization. Struct. Multidiscip. Optim. 2023, 66, 225. [Google Scholar] [CrossRef]
  10. Gai, G.; Wachs, A. High fidelity adaptive Cartesian octree grid computations of the flow past a Platonic polyhedron up to a Reynolds number of 200. Powder Technol. 2023, 420, 118390. [Google Scholar] [CrossRef]
  11. Di Angelo, L.; Duronio, F.; De Vita, A.; Di Mascio, A. Cartesian Mesh Generation with Local Refinement for Immersed Boundary Approaches. J. Mar. Sci. Eng. 2021, 9, 572. [Google Scholar] [CrossRef]
  12. Sugaya, K.; Imamura, T. Turbulent flow simulations of the common research model on Cartesian grids using recursive fitting approach. J. Comput. Phys. 2022, 467, 111460. [Google Scholar] [CrossRef]
  13. Vanky, P.; Mark, A.; Hunger, F.; Saucedo, G.V.; Haeger-Eugensson, M.; Bennetsen, J.C.; Tarraso, J.; Adelfio, M.; Kalagasidis, A.S.; Sardina, G. Evaluation of an immersed boundary numerical framework to address the wind field in complex urban topographies. Build. Environ. 2024, 266, 112036. [Google Scholar] [CrossRef]
  14. Luo, C.; Bi, L.; Meng, S.; Gao, H.; Yuan, X.; Tang, Z. A novel algorithm for fluid dynamics simulation with cell-adaptive Cartesian grids and immersed boundary method. Phys. Fluids 2025, 37, 046122. [Google Scholar] [CrossRef]
  15. Yu, X.; Fuhrman, D.R.; Shao, Y. Improved immersed boundary/wall modeling method for RANS solver coupled with wall functions: Application to Cartesian grid systems. Eng. Appl. Comput. Fluid Mech. 2025, 19, 2486657. [Google Scholar] [CrossRef]
  16. Chen, H.; Wang, Z.; Tian, L.; Liu, J.; Qin, N.; Zhao, N. Coupling immersed boundary method with wall function for high Reynolds number compressible flows on adaptive Cartesian grids. Phys. Fluids 2025, 37, 016143. [Google Scholar] [CrossRef]
  17. Bonet, J.; Peraire, J. An alternating digital tree (ADT) algorithm for 3D geometric searching and intersection problems. Int. J. Numer. Methods Eng. 1991, 31, 1–17. [Google Scholar] [CrossRef]
  18. Aftosmis, M.J.; Berger, M.J.; Melton, J.E. Robust and Efficient Cartesian Mesh Generation for Component-Based Geometry. AIAA J. 1998, 36, 952–960. [Google Scholar] [CrossRef]
  19. Deister, F.; Tremel, U.; Hassan, O.; Weatherill, N.P. Fully automatic and fast mesh size specification for unstructured mesh generation. Eng. Comput. 2004, 20, 237–248. [Google Scholar] [CrossRef]
  20. Capizzano, F. Automatic generation of locally refined Cartesian meshes: Data management and algorithms. Int. J. Numer. Methods Eng. 2018, 113, 789–813. [Google Scholar] [CrossRef]
  21. Aftosmis, M.J. Solution Adaptive Cartesian Grid Methods for Aerodynamic Flows with Complex Geometries. In Proceedings of the 28th Computational Fluid Dynamics, Snowmass Village, CO, USA, 29 June–2 July 1997. [Google Scholar]
  22. Schukmann, A.; Schneider, A.; Haas, V.; Böhle, M. Analysis of Hierarchical Grid Refinement Techniques for the Lattice Boltzmann Method by Numerical Experiments. Fluids 2023, 8, 103. [Google Scholar] [CrossRef]
  23. Tamaki, Y.; Imamura, T. Efficient dimension-by-dimension higher order finite-volume methods for a Cartesian grid with cell-based refinement. Comput. Fluids 2017, 144, 74–85. [Google Scholar] [CrossRef]
  24. Zhang, W.; Pan, Y.; Wang, J.; Di Santo, V.; Lauder, G.V.; Dong, H. An efficient tree-topological local mesh refinement on Cartesian grids for multiple moving objects in incompressible flow. J. Comput. Phys. 2023, 479, 111983. [Google Scholar] [CrossRef]
  25. Li, C.; Yan, D. Numerical modelling of hook and claw-type vacuum pump performance based on cut cell Cartesian method. Vacuum 2023, 215, 112385. [Google Scholar] [CrossRef]
  26. Li, X.; Yang, M.; Bi, L.; Xu, R.; Luo, C.; Yuan, S.; Yuan, X.; Tang, Z. An efficient Cartesian mesh generation strategy for complex geometries. Comput. Methods Appl. Mech. Eng. 2024, 418, 116564. [Google Scholar] [CrossRef]
  27. Foley, J.D.; van Dam, A.; Feiner, S.K.; Hughes, J.; McGuire, M.; Sklar, D.F.; Akeley, K. Computer Graphics, Principle and Practice; Addison-Wesley: Boston, MA, USA, 1995; ISBN 0-201-84840-6. [Google Scholar]
  28. Ishida, T.; Takahashi, S.; Nakahashi, K. Efficient and Robust Cartesian Mesh Generation for Building-Cube Method. J. Comput. Sci. Technol. 2008, 2, 435–446. [Google Scholar] [CrossRef]
  29. Shamseddine, M.; Lakkis, I. A novel spatio-temporally adaptive parallel three-dimensional DSMC solver for unsteady rarefied micro/nano gas flows. Comput. Fluids 2019, 186, 1–14. [Google Scholar] [CrossRef]
  30. Seshadri, P.K.; De, A. A novel sharp interface immersed boundary framework for viscous flow simulations at arbitrary Mach number involving complex and moving boundaries. Comput Fluids 2020, 206, 104579. [Google Scholar] [CrossRef]
  31. Akenine-Möllser, T. Fast 3D Triangle-Box Overlap Testing. J. Graph Tools 2001, 6, 29–33. [Google Scholar] [CrossRef]
  32. Zhang, C.; Schwartzentruber, T.E. Robust cut-cell algorithms for DSMC implementations employing multi-level Cartesian grids. Comput. Fluids 2012, 69, 122–135. [Google Scholar] [CrossRef]
  33. Gao, G.; Li, F.; He, K.; Wang, J.; Zhang, J.; Miao, X. Investigation of bogie positions on the aerodynamic drag and near wake structure of a high-speed train. J. Wind Eng. Ind. Aerodyn. 2019, 185, 41–53. [Google Scholar] [CrossRef]
  34. Zhang, L.; Yang, M.-Z.; Liang, X.-F. Experimental study on the effect of wind angles on pressure distribution of train streamlined zone and train aerodynamic forces. J. Wind Eng. Ind. Aerodyn. 2018, 174, 330–343. [Google Scholar] [CrossRef]
Figure 1. Generation processes of structured, unstructured, and Cartesian grids. (a) structured grid; (b) unstructured grid; (c) Cartesian grid.
Figure 1. Generation processes of structured, unstructured, and Cartesian grids. (a) structured grid; (b) unstructured grid; (c) Cartesian grid.
Applsci 15 10392 g001
Figure 2. Diagram of the nested bounding box structure. (a) The bounding box corresponding to triangle T2 partially overlaps with the bounding box of T3, resulting in overlapping regions between the bounding boxes of the left and right child nodes. (b) The bounding box corresponding to triangle T2 nests with the bounding box of T4, forming a nested relationship between the bounding boxes of parent and child nodes.
Figure 2. Diagram of the nested bounding box structure. (a) The bounding box corresponding to triangle T2 partially overlaps with the bounding box of T3, resulting in overlapping regions between the bounding boxes of the left and right child nodes. (b) The bounding box corresponding to triangle T2 nests with the bounding box of T4, forming a nested relationship between the bounding boxes of parent and child nodes.
Applsci 15 10392 g002
Figure 3. Region partitioning and the constructed binary trees: (a) conventional ADT, (b) present method.
Figure 3. Region partitioning and the constructed binary trees: (a) conventional ADT, (b) present method.
Applsci 15 10392 g003
Figure 4. Schematic diagram of Cartesian grid and the corresponding member packaging and neighbor threading data structure. (a) 2D Cartesian mesh; (b) Data structure in 2D.
Figure 4. Schematic diagram of Cartesian grid and the corresponding member packaging and neighbor threading data structure. (a) 2D Cartesian mesh; (b) Data structure in 2D.
Applsci 15 10392 g004
Figure 5. Schematic diagram of the implementation process for constructing the Cartesian grid data structure.
Figure 5. Schematic diagram of the implementation process for constructing the Cartesian grid data structure.
Applsci 15 10392 g005
Figure 6. Flowchart for determining Cartesian cell types.
Figure 6. Flowchart for determining Cartesian cell types.
Applsci 15 10392 g006
Figure 7. Illustration of the Separating Axis Theorem.
Figure 7. Illustration of the Separating Axis Theorem.
Applsci 15 10392 g007
Figure 8. Parameter definitions for the Cartesian cell-triangle intersection determination method.
Figure 8. Parameter definitions for the Cartesian cell-triangle intersection determination method.
Applsci 15 10392 g008
Figure 9. Example of excluding Cartesian cells that do not intersect with the geometric minimum bounding box.
Figure 9. Example of excluding Cartesian cells that do not intersect with the geometric minimum bounding box.
Applsci 15 10392 g009
Figure 10. Triangles that intersect with a son cell must also intersect with the parent cell.
Figure 10. Triangles that intersect with a son cell must also intersect with the parent cell.
Applsci 15 10392 g010
Figure 11. An example of intersection determination results.
Figure 11. An example of intersection determination results.
Applsci 15 10392 g011
Figure 12. The basic implementation principle of the painting method under Cartesian grid framework.
Figure 12. The basic implementation principle of the painting method under Cartesian grid framework.
Applsci 15 10392 g012
Figure 13. Example of the process of using the painting method to determine the interior and exterior Cartesian cells. (a) step 1; (b) step 2; (c) step 3; (d) step 4; (e) step 5; (f) step 6.
Figure 13. Example of the process of using the painting method to determine the interior and exterior Cartesian cells. (a) step 1; (b) step 2; (c) step 3; (d) step 4; (e) step 5; (f) step 6.
Applsci 15 10392 g013
Figure 14. Schematic diagram of the principle of the dot product method.
Figure 14. Schematic diagram of the principle of the dot product method.
Applsci 15 10392 g014
Figure 15. Application example of the dot product method.
Figure 15. Application example of the dot product method.
Applsci 15 10392 g015
Figure 16. Cartesian grids generated based on different 3D configurations.
Figure 16. Cartesian grids generated based on different 3D configurations.
Applsci 15 10392 g016
Figure 17. Pressure coefficient contour on train surface.
Figure 17. Pressure coefficient contour on train surface.
Applsci 15 10392 g017
Figure 18. Pressure coefficient profile on train surface (z = 0).
Figure 18. Pressure coefficient profile on train surface (z = 0).
Applsci 15 10392 g018
Table 1. Comparison of construction times and Cartesian grid generation times for ADT and BT-NBB.
Table 1. Comparison of construction times and Cartesian grid generation times for ADT and BT-NBB.
ConfigurationNtriNCartConstruction Time [s]Cartesian Grid Generation Time [s]
ADTBT-NBBADTBT-NBBADT/BT-NBB
Sphere492627,875,3810.000.01472.5113.9433.90
DPW6 aircraft30,02120,413,6650.020.06851.019.5389.30
Train386,28215,272,2710.130.623351.3513.60246.42
Bogie93,87613,332,8310.020.22470.347.6261.72
Pantograph299,11027,821,6410.090.574977.3114.89334.27
Car1,211,3678,146,1360.393.894644.9616.16287.44
Table 2. Comparison of mesh generation time.
Table 2. Comparison of mesh generation time.
ConfigurationStar-CCM+2NMP-NT
NCartCPU Time
[s/Million Cell]
NCartCPU Time
[s/Million Cell]
NCartCPU Time
[s/Million Cell]
Sphere12,725,11447.3527,875,3815.7227,875,3810.50
DPW6 aircraft10,865,45863.3220,413,6656.7420,413,6650.47
Train12,991,67848.7315,272,2716.9215,272,2710.89
Bogie14,448,89972.5013,332,8317.0913,332,8310.57
Pantograph8,518,330101.5427,821,6417.0927,821,6410.54
Car8,465,738108.968,146,1367.368,146,1361.98
Table 3. Comparison of intersection test times between the ray tracing method and the method proposed in this paper.
Table 3. Comparison of intersection test times between the ray tracing method and the method proposed in this paper.
ConfigurationNtriNCartRay Tracing [s]Present [s]Ray Tracing/Present
Sphere49269,215,01679.651.1966.93
DPW630,0219,958,279157.422.7557.24
Train386,28226,045,677335.397.0147.84
Bogie93,87622,651,588730.462.34312.16
Pantograph299,11011,096,576985.404.10240.34
Car1,211,3673,594,0081432.187.12201.15
Table 4. The impact of surface mesh density on Cartesian grid generation time.
Table 4. The impact of surface mesh density on Cartesian grid generation time.
ConfigurationNtriNCartConstruction Tree Time [s]Cartesian Grid Generation Time [s]
ADTBT-NBBADTBT-NBB
DPW6 aircraft30,02120,413,6650.020.06851.089.53
98,5850.030.222290.1210.98
413,5290.141.198234.5618.17
Table 5. Comparison of memory consumption between 2N and MP-NT data structures.
Table 5. Comparison of memory consumption between 2N and MP-NT data structures.
ConfigurationNtriNCart2N [GB]MP-NT [GB]Diff. [%]
Sphere492627,875,3819.547.4122.3
DPW6 aircraft30,02120,413,6656.955.4222.0
Train386,28215,272,2715.154.0820.7
Bogie93,87613,332,8314.543.5022.9
Pantograph299,11027,821,6419.457.3722.0
Car1,211,3678,146,1362.682.0722.7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Meng, S.; Bi, L.; Luo, C.; Chen, J.; Yuan, X.; Tang, Z. A Performance-Enhanced Cartesian Grid Generation Method: More Robust, Efficient, and Memory-Efficient. Appl. Sci. 2025, 15, 10392. https://doi.org/10.3390/app151910392

AMA Style

Meng S, Bi L, Luo C, Chen J, Yuan X, Tang Z. A Performance-Enhanced Cartesian Grid Generation Method: More Robust, Efficient, and Memory-Efficient. Applied Sciences. 2025; 15(19):10392. https://doi.org/10.3390/app151910392

Chicago/Turabian Style

Meng, Shuang, Lin Bi, Canyan Luo, Jianqiang Chen, Xianxu Yuan, and Zhigong Tang. 2025. "A Performance-Enhanced Cartesian Grid Generation Method: More Robust, Efficient, and Memory-Efficient" Applied Sciences 15, no. 19: 10392. https://doi.org/10.3390/app151910392

APA Style

Meng, S., Bi, L., Luo, C., Chen, J., Yuan, X., & Tang, Z. (2025). A Performance-Enhanced Cartesian Grid Generation Method: More Robust, Efficient, and Memory-Efficient. Applied Sciences, 15(19), 10392. https://doi.org/10.3390/app151910392

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop