Method and system for optimizing polyhedral mesh in simulation model
The iterative optimization of polyhedral meshes through stretching and scaling transformations addresses quality issues, enhancing simulation accuracy and efficiency by maintaining mesh quality and reducing interruptions.
Patent Information
- Application Number
- CN202410895636.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-12-06
AI Technical Summary
Existing mesh generation methods for complex geometries, particularly polyhedral meshes, face challenges in maintaining quality during simulation processes, leading to increased solution time and potential simulation interruptions due to poor mesh quality.
An iterative optimization method and system that includes stretching and scaling transformations of polyhedral mesh units, followed by stitching based on temporary node sets, with termination conditions to ensure mesh quality improvement.
Enhances mesh quality, reduces simulation interruption risks, and improves computational efficiency by maintaining or restoring mesh quality, thereby optimizing simulation accuracy and cost-effectiveness.
Smart Images

Figure CN119089722A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of simulation numerical calculation, and in particular to an optimization method and system for a polyhedral mesh in a simulation model. Background Art
[0002] With the rapid development of computer hardware and software, and the increasing maturity of numerical methods such as the finite element method (FEM) and the finite volume method (FVM), numerical simulation plays an increasingly prominent role in engineering and scientific computing. For many engineering and scientific problems, especially those involving complex geometries, the feasibility and reliability of numerical simulation largely depends on the quality of the discrete mesh of the computational domain.
[0003] In the process of discrete mesh generation, triangular or tetrahedral elements are usually used to mesh the discrete area. Compared with quadrilateral or hexahedral meshes, triangular or tetrahedral meshes usually require more elements to achieve the same computational accuracy. However, quadrilateral or hexahedral meshes still have some limitations. For example, it is difficult to generate pure hexahedral meshes for complex geometric shapes. Polyhedral meshes, as an alternative, can better overcome these limitations. Compared with tetrahedral and hexahedral meshes, fewer polyhedral elements are required to achieve the same solution accuracy, with higher computational efficiency, and the ability to flexibly construct meshes to more accurately describe complex geometric shapes.
[0004] During the simulation process, the mesh used for simulation calculation does not always remain unchanged. Mesh changes often deteriorate the mesh quality, resulting in increased solution time or even failure to solve the problem. The time consumed by optimizing the mesh quality is often less than the increased solution time due to poor mesh quality. Therefore, from the perspective of avoiding simulation calculation interruption, improving the accuracy of numerical simulation and saving solution cost, it is necessary to provide an optimization method and system for polyhedral meshes in simulation models. Summary of the invention
[0005] One or more embodiments of the present specification provide a method for optimizing a polyhedral mesh in a simulation model, the method comprising: obtaining first mesh data in the simulation model; performing at least one round of iterative optimization on the first mesh data to obtain second mesh data; wherein the at least one round of iterative optimization comprises: obtaining first mesh data of the current iteration round, the first mesh data comprising a first mesh unit set and a first mesh node set; performing a stretching transformation and a scaling transformation on each first mesh unit in the first mesh unit set to determine a second mesh unit set; determining a temporary node set based on the second mesh unit set and the first mesh node set, each first mesh node in the first mesh node set corresponding to a temporary node subset in the temporary node set; stitching each second mesh unit in the second mesh unit set based on the temporary node set to determine second mesh data; determining whether an optimization termination condition is met, and outputting the second mesh data in response to the optimization termination condition being met; determining the second mesh data as the first mesh data for the next iteration round in response to the optimization termination condition not being met.
[0006] In some embodiments, the termination condition includes: the number of iterations reaches a preset upper limit.
[0007] In some embodiments, the termination condition includes: the quality of the second grid data reaches a preset condition.
[0008] In some embodiments, the preset condition includes: a difference between a quality parameter of the second grid data and a quality parameter of the first grid data is less than a preset value.
[0009] In some embodiments, the preset condition includes: all illegal cells in the second grid data are converted into legal cells.
[0010] In some embodiments, the stretching transformation includes: obtaining a stretching coefficient; stretching each first grid node of the first grid unit based on the stretching coefficient to determine the first grid unit after the stretching transformation.
[0011] In some embodiments, stretching each first grid node of the first grid unit based on the stretch coefficient includes: determining the local tetrahedron of each first grid node; determining the external normal vector of each first grid node based on the local tetrahedron; determining the correction vector of each first grid node based on the adjacent face to which each first grid node belongs in the first grid unit; determining the movement vector of each first grid node based on the external normal vector and the correction vector; and determining the stretched position of each first grid node based on the stretch coefficient and the movement vector.
[0012] In some embodiments, determining the correction vector of each first grid node includes: determining an initial correction vector of each first grid node; obtaining a correction factor of each first grid node; and scaling the initial correction vector based on the correction factor to determine the correction vector.
[0013] In some embodiments, the scaling transformation includes: scaling and stretching the transformed first grid unit based on an initial side length.
[0014] In some embodiments, the scaling transformation includes: scaling and stretching the transformed first grid unit based on the initial volume.
[0015] In some embodiments, determining the temporary node set includes: for each of the first grid nodes, determining a first grid unit subset that includes the first grid node; based on the first grid unit subset, determining a transformed second grid unit subset; based on the transformed second grid unit subset, determining the temporary node subset corresponding to each of the first grid nodes.
[0016] In some embodiments, the determining of the second grid data based on stitching each second grid unit in the second grid unit set based on the temporary node set includes: based on each temporary node subset in the temporary node set, taking a weighted average of the temporary nodes in each temporary node subset to determine the second grid node; and determining the second grid data based on the second grid node and the second grid unit.
[0017] One or more embodiments of the present specification provide an optimization system for a polyhedral mesh in a simulation model, the system comprising: a mesh acquisition module, configured to acquire first mesh data in the simulation model; a mesh optimization module, configured to perform at least one round of iterative optimization on the first mesh data to acquire second mesh data; wherein the at least one round of iterative optimization comprises: acquiring first mesh data of the current iteration round, the first mesh data comprising a first mesh unit set and a first mesh node set; performing a stretching transformation and a scaling transformation on each first mesh unit in the first mesh unit set to determine a second mesh unit set; determining a temporary node set based on the second mesh unit set and the first mesh node set, each first mesh node in the first mesh node set corresponding to a temporary node subset in the temporary node set; stitching each second mesh unit in the second mesh unit set based on the temporary node set to determine second mesh data; determining whether an optimization termination condition is met, and outputting the second mesh data in response to the optimization termination condition being met; determining the second mesh data as the first mesh data for the next iteration round in response to the optimization termination condition not being met. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0019] Figure 1 is an exemplary module diagram of an optimization system for a polyhedral mesh in a simulation model according to some embodiments of the present specification;
[0020] Figure 2 is an exemplary flow chart of a method for optimizing a polyhedral mesh in a simulation model according to some embodiments of the present specification;
[0021] Figure 3 is an exemplary flow chart of at least one round of iterative optimization according to some embodiments of this specification;
[0022] Figure 4 is an exemplary flow chart of stretching each first mesh node based on a stretching coefficient according to some embodiments of this specification;
[0023] Figure 5 is an exemplary schematic diagram of an external normal vector of a first mesh node according to some embodiments of this specification;
[0024] Figure 6 is a schematic diagram of the composition of the correction vector according to some embodiments of this specification;
[0025] Figure 7 is an exemplary schematic diagram of regularization of polyhedral units according to some embodiments of the present specification;
[0026] Figure 8 is an exemplary schematic diagram of a temporary node according to some embodiments of this specification;
[0027] Fig. 9 is an exemplary schematic diagram of the orthogonal quality of a polyhedral mesh according to some embodiments of the present specification;
[0028] Fig.10 The polyhedral mesh and mass distribution before and after optimization shown in Example 1 of this specification;
[0029] Fig.11 This is based on the polyhedral mesh and mass distribution before and after optimization shown in Example 2 of this specification. DETAILED DESCRIPTION
[0030] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of this specification. For ordinary technicians in this field, this specification can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.
[0031] It should be understood that the "system", "device", "unit" and / or "module" used herein are a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0032] As shown in this specification and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "comprise" and "include" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.
[0033] In fluid mechanics simulation, choosing the right mesh type is crucial to accurately simulate complex flow behaviors. Different types of meshes have different flexibility and adaptability. For example, tetrahedral meshes can handle complex geometric shapes well and effectively capture fluid details, but due to the complexity of the geometric shape of the simulation area, the automatically generated unstructured tetrahedral mesh may have poor quality and be difficult to meet the calculation requirements, so it is usually necessary to continuously encrypt it to obtain sufficient accuracy. Hexahedral meshes have a high degree of regularization, and the mesh generation efficiency is high and the quality is good when dealing with regular geometric shapes, but for complex geometric shapes, it is currently difficult to generate pure hexahedral meshes. As an alternative, polyhedral meshes can better overcome these limitations. Compared with tetrahedral and hexahedral meshes, fewer polyhedral units are required to achieve the same solution accuracy, with higher computational efficiency, and the ability to flexibly construct meshes to more accurately describe complex geometric shapes. In actual simulation calculations, CFD simulation based on the finite volume method is the main application field of polyhedral meshes. Currently, mainstream CFD software such as Fluent and STAR-CCM+ all support the generation and simulation of polyhedral meshes.
[0034] Mesh optimization is the process of improving mesh quality through strategies such as topology transformation and node movement. Depending on whether the topology of the mesh changes, mesh optimization techniques can be divided into two categories, namely topology optimization and smoothing. Mesh untwisting is the process of eliminating illegal cells in the mesh while maintaining the topological connection of the mesh, which can be regarded as a special case of smoothing technology.
[0035] In CFD simulation, the mesh used for simulation calculation does not always remain the same. For example, in fluid-solid coupling problems, the deformation of the solid domain will cause the boundary of the fluid domain to change, which will cause the mesh of the fluid domain to change accordingly. In this case, the initially good quality legal mesh may become poor or even illegal due to boundary changes, resulting in a decrease in simulation accuracy or interruption. The time consumed in optimizing the mesh quality is often less than the increased solution time due to poor mesh quality. Therefore, it is meaningful to optimize the mesh quality from the perspective of avoiding simulation interruption, improving the accuracy of numerical simulation, and saving solution costs.
[0036] Figure 1 is an exemplary module diagram of an optimization system for a polyhedral mesh in a simulation model according to some embodiments of the present specification.
[0037] Some embodiments of the present specification provide an optimization system for polyhedral meshes in a simulation model (hereinafter referred to as the optimization system or system). Figure 1 As shown, the system 100 may include a grid acquisition module 110 and a grid optimization module 120 .
[0038] In some embodiments, the grid acquisition module 110 may be used to acquire first grid data in the simulation model.
[0039] In some embodiments, the grid optimization module 120 can be used to perform at least one round of iterative optimization on the first grid data to obtain second grid data; wherein the at least one round of iterative optimization includes: obtaining the first grid data of the current iteration round, the first grid data including a first grid unit set and a first grid node set; performing a stretching transformation and a scaling transformation on each first grid unit in the first grid unit set to determine the second grid unit set; determining a temporary node set based on the second grid unit set and the first grid node set, each first grid node in the first grid node set corresponds to a temporary node subset in the temporary node set; stitching each second grid unit in the second grid unit set based on the temporary node set to determine the second grid data; determining whether the optimization termination condition is met, and outputting the second grid data in response to the optimization termination condition being met; determining the second grid data as the first grid data for the next iteration round in response to the optimization termination condition not being met.
[0040] In some embodiments, the mesh optimization module 120 may also be used to obtain a stretching coefficient; stretch each first mesh node of the first mesh unit based on the stretching coefficient to determine the first mesh unit after the stretching transformation.
[0041] In some embodiments, the mesh optimization module 120 can also be used to determine the local tetrahedron of each first mesh node; based on the local tetrahedron, determine the external normal vector of each first mesh node; based on the adjacent face to which each first mesh node belongs in the first mesh unit, determine the correction vector of each first mesh node; based on the external normal vector and the correction vector, determine the movement vector of each first mesh node; based on the stretch coefficient and the movement vector, determine the stretched position of each first mesh node.
[0042] In some embodiments, the grid optimization module 120 may also be used to determine an initial correction vector for each first grid node; obtain a correction factor for each first grid node; and scale the initial correction vector based on the correction factor to determine a correction vector.
[0043] In some embodiments, the mesh optimization module 120 may also be configured to scale and stretch the transformed first mesh unit based on the initial edge length.
[0044] In some embodiments, the mesh optimization module 120 may also be configured to scale and stretch the transformed first mesh units based on the initial volume.
[0045] In some embodiments, the grid optimization module 120 can also be used to determine, for each first grid node, a first grid unit subset that includes the first grid node; based on the first grid unit subset, determine a transformed second grid unit subset; based on the transformed second grid unit subset, determine a temporary node subset corresponding to each first grid node.
[0046] In some embodiments, the grid optimization module 120 can also be used to determine the second grid node based on each temporary node subset in the temporary node set by weighted averaging the temporary nodes in each temporary node subset; and determine the second grid data based on the second grid node and the second grid unit.
[0047] For more information about the grid acquisition module and the grid optimization module, please refer to the relevant descriptions in the following text.
[0048] It should be noted that the above description of the optimization system and its modules for the polyhedral mesh in the simulation model is only for the convenience of description and cannot limit the present specification to the scope of the embodiments. It is understandable that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the modules or form a subsystem to connect with other modules without deviating from this principle. In some embodiments, Figure 1The grid acquisition module and grid optimization module disclosed in the specification can be different modules in a system, or one module can realize the functions of two or more modules. For example, each module can share a storage module, or each module can have its own storage module. Such variations are within the scope of protection of this specification.
[0049] Figure 2 is an exemplary flow chart of a method for optimizing a polyhedral mesh in a simulation model according to some embodiments of this specification. Figure 2 As shown, the process 200 includes the following steps. In some embodiments, the process 200 may be executed by the optimization system 100 .
[0050] Step S210 : Acquire first grid data in the simulation model. In some embodiments, step S210 may be performed by the grid acquisition module 110 .
[0051] The first mesh data refers to mesh data that needs to be optimized. The first mesh data may be initial mesh data automatically generated by simulation software, mesh data generated during simulation, or mesh data generated during iterative optimization.
[0052] In some embodiments, the first grid data includes a first grid unit set and a first grid node set. The first grid unit set refers to a set of all grid units included in the first grid data. For example, the first grid unit is E j , the first grid unit set is J, E j ∈J. The first grid node set refers to the set of all grid nodes contained in the first grid data. For example, the first grid node is p i , the first grid node set is I,p i ∈I. The first grid unit refers to any grid unit in the first grid data. The first grid node refers to the connection point between the first grid units.
[0053] As mentioned above, the first grid data can be obtained in a variety of ways. In some embodiments, the first grid data can be created by a user. In some embodiments, the first grid data can be obtained during a simulation process. In some embodiments, the first grid data can be obtained during an iterative optimization process.
[0054] Step S220 : performing at least one round of iterative optimization on the first grid data to obtain second grid data. In some embodiments, step S220 may be performed by the grid optimization module 120 .
[0055] The second grid data refers to the grid data generated after the first grid data is optimized. In some embodiments, the grid optimization module can perform at least one round of iterative optimization on the first grid data, and the second grid data of the current iteration round can be obtained after each round of iteration. When the iteratively optimized grid data meets the optimization termination condition, the grid optimization module can also output the second grid data. For more information about the optimization termination condition, please refer to the relevant description below.
[0056] Figure 3 is an exemplary flow chart of at least one round of iterative optimization according to some embodiments of this specification. Figure 3 As shown, process 300 includes the following steps.
[0057] Step S310: Obtain the first grid data of the current iteration round.
[0058] The first mesh data of the current iteration round refers to the mesh data to be optimized in this iteration round, for example, the initial mesh data, the mesh data generated during the simulation process, or the mesh data that does not meet the iteration termination condition after the previous iteration round.
[0059] In some embodiments, the first grid data of the current iteration round can be obtained by user selection. In some embodiments, the grid optimization module can also obtain the second grid data that does not meet the iteration termination condition and use it as the first grid data of the current iteration round to continue iterative optimization.
[0060] Step S320: Perform stretching transformation and scaling transformation on each first grid unit in the first grid unit set to determine a second grid unit set.
[0061] The second grid unit set refers to a grid unit set generated after the first grid unit set is stretched and scaled.
[0062] Stretching transformation refers to the process of stretching the grid nodes of a grid unit to move them so as to change the shape of the grid unit.
[0063] In some embodiments, the stretching transformation includes: obtaining a stretching coefficient; and stretching each first grid node of the first grid unit based on the stretching coefficient to determine the first grid unit after the stretching transformation.
[0064] The stretching coefficient can be used to control the degree of stretching of the first mesh unit. The larger the stretching coefficient, the greater the stretching degree of the first mesh unit. An excessively large stretching coefficient will cause the first mesh unit to be stretched too much and cause the quality of the first mesh unit to deteriorate. On the contrary, an excessively small stretching coefficient will increase the steps of iterative optimization, resulting in a slow speed of mesh optimization. Therefore, in some embodiments, the stretching coefficient is in the range of [0.5, 1.5] to balance the convergence speed and the worst quality.
[0065] In some embodiments, the stretch factor may be obtained through user input.
[0066] The first grid unit after stretching transformation refers to a grid unit obtained after stretching each first grid node of the first grid unit.
[0067] In some embodiments, the mesh optimization module may stretch each first mesh node in the first mesh unit based on the stretch coefficient, thereby determining a first mesh unit after stretching transformation.
[0068] Figure 4 is an exemplary flow chart of stretching each first mesh node based on a stretching coefficient according to some embodiments of this specification. Figure 4 As shown, process 400 includes the following steps.
[0069] Step S410: Determine the local tetrahedron of each first mesh node.
[0070] In some embodiments, since the polyhedral mesh is generated by duality of the tetrahedral mesh, any first mesh node of the first mesh unit is connected to three adjacent edges, and the three adjacent edges constitute the local tetrahedron of the first mesh node.
[0071] Step S420: Determine the external normal vector of each first mesh node based on the local tetrahedron.
[0072] The external normal vector of the first mesh node refers to the surface normal vector of the surface of the first mesh node that is opposite to the first mesh node (also referred to as the opposite surface) in the local tetrahedron of the first mesh node.
[0073] Figure 5 is an exemplary schematic diagram of the external normal vector of the first mesh node according to some embodiments of this specification. Figure 5 As shown, the external normal vector of the first mesh node p0 can be expressed as A, B, and C are three adjacent nodes of the first mesh node p0, and p0A, p0B, and p0C are three adjacent edges connected to the first mesh node p0.
[0074] In some embodiments, the mesh optimization module can determine the outer normal vector of each first mesh node by calculation based on the local tetrahedron. Taking the first mesh node p0 as an example, the outer normal vector of the first mesh node p0 is Exemplary calculation formulas include:
[0075]
[0076] In some embodiments, the outer normal vector of the first mesh node p0 is The modulus is the area of the opposite face (such as △ABC) of the first mesh node p0 in its local tetrahedron.
[0077] Step S430: determining a correction vector of each first mesh node based on the adjacent surface to which each first mesh node belongs in the first mesh unit.
[0078] The adjacent surface to which the first mesh node belongs in the first mesh unit refers to the mesh surface in the first mesh unit that contains the first mesh node. Figure 3 As shown, the adjacent faces to which the first mesh node p0 belongs in the first mesh unit are △Ap0B, △Ap0C and △Bp0C respectively.
[0079] The correction vector of the first mesh node refers to a vector used to correct the stretched position of the first mesh node. In some embodiments, the correction vector can be obtained by a tetrahedron formed by three diagonals of three mesh faces adjacent to the first mesh node. As an example only, the mesh optimization module can obtain the face normal vector of the opposite face of the first mesh node in the above tetrahedron by calculation, and determine the face normal vector as the correction vector of the first mesh node.
[0080] In some embodiments, the diagonal of the first grid node on its adjacent surface is determined according to the number of first grid nodes constituting each adjacent surface. For example, if the adjacent surface is composed of an even number (such as 2n+2, n≥1) of first grid nodes, then the diagonal of the first grid node on its adjacent surface is the line between the first grid node and the first grid node diagonally adjacent to the adjacent surface. For another example, if the adjacent surface is composed of an odd number (such as 2n+1, n≥1) of first grid nodes, then the diagonal of the first grid node on its adjacent surface is the line between the first grid node and the midpoint of the side opposite to it in the adjacent surface (also called the opposite side) (i.e., the midline of the first grid node on its adjacent surface).
[0081] Figure 6 FIG. 1 is a schematic diagram of the composition of the correction vector according to some embodiments of this specification. Figure 6 As shown, Figure 6 (a) shows a first grid unit that is a hexagonal prism unit. Figure 6 (b) The first mesh unit shown is a tetrahedral unit. Figure 6 The first grid node p0 in the first grid unit shown in (a) has three adjacent faces, namely a hexagon and two quadrilaterals. At this time, the diagonals of the first grid node p0 on its adjacent faces are all connecting lines between the first grid node p0 and the first grid nodes (such as p1, p2, p3) diagonal to its adjacent faces, which are respectively recorded as p0p1, p0p2, and p0p3. Figure 6(b) shows that the first grid node p0 in the first grid unit also has three adjacent faces, namely a triangle and two quadrilaterals. At this time, the diagonals of the first grid node p0 on its adjacent faces are: one is the line between the first grid node p0 and the midpoint of the corresponding edge of its adjacent face (such as p3), denoted as p0p3; the other two are the lines between the first grid node p0 and the first grid nodes diagonally adjacent to its adjacent face (such as p1 and p2), denoted as p0p1 and p0p2 respectively.
[0082] In some embodiments, the grid optimization module may determine the correction vector of each first grid node by calculation based on the adjacent surface to which each first grid node belongs in the first grid unit. Taking the first grid node p0 as an example, the correction vector of the first grid node p0 is recorded as Correction vector of the first mesh node p0 Exemplary calculation formulas include:
[0083]
[0084] In some embodiments, the grid optimization module may further determine the correction vector of each first grid node through the following steps. Specifically:
[0085] S1: Determine the initial correction vector of each first grid node.
[0086] The initial correction vector refers to a correction vector that has not been adjusted. In some embodiments, the initial correction vector may be a correction vector calculated by formula (2).
[0087] S2: Obtain the correction factor of each first grid node.
[0088] The correction factor is a parameter used to control the degree of correction. The larger the correction factor, the greater the degree of correction of the initial correction vector. In some embodiments, the correction factor can be obtained through user input.
[0089] S3: Scaling the initial correction vector based on the correction factor to determine the correction vector.
[0090] Taking the first grid node p0 as an example, the correction vector of the first grid node p0 is recorded as in, is the initial correction vector, β is the correction factor, β>0.
[0091] In some embodiments of the present specification, a correction factor is set to correct the initial correction vector, which is beneficial to further improve the accuracy of the correction vector.
[0092] It should be noted that it is not necessary to use the correction factor to correct the initial correction vector. In some cases, the initial correction vector can be directly used as the correction vector. In this case, β=1 can also be considered, that is,
[0093] Step S440: Determine the movement vector of each first mesh node based on the external normal vector and the correction vector.
[0094] The movement vector of the first mesh node may reflect the movement direction and movement distance of the first mesh node.
[0095] In some embodiments, the mesh optimization module can determine the movement vector of each first mesh node by calculation based on the external normal vector and the correction vector. Taking the first mesh node p0 as an example, the movement vector of the first mesh node p0 is recorded as The movement vector of the first mesh node p0 Exemplary calculation formulas include:
[0096]
[0097] From formula (3), we can see that if the correction factor β is too large, the movement vector of the first grid node p0 Will correct the vector , thereby reducing the direction along its outer normal vector The optimization effect brought by the stretching in the direction of , and may reduce the quality of the first grid unit. If the correction factor β is too small, then the movement vector of the first grid node p0 will be biased toward its outward normal vector direction, thereby losing the correction effect, which may also cause the quality of the first grid unit to decrease. Therefore, in some embodiments, the correction factor has a value range of [0.5, 1.5].
[0098] Step S450: Determine the stretching position of each first mesh node based on the stretching coefficient and the movement vector.
[0099] The stretched position of the first mesh node refers to the position of the first mesh node after the stretching transformation.
[0100] In some embodiments, the mesh optimization module may determine the stretched position of each first mesh node by calculation based on the stretch coefficient and the movement vector. Taking the first mesh node p0 as an example, the stretched position of the first mesh node p0 is denoted as p ′ 0, the stretched position p of the first mesh node p0 ′ Exemplary calculation formulas for 0 include:
[0101]
[0102] Where λ is the stretch coefficient, λ>0.
[0103] For any first mesh node p in the polyhedral element k , after the stretching transformation, the first mesh node p k The stretching position can be obtained by formula (4). An exemplary calculation formula is as follows:
[0104]
[0105] For the first grid node p k (k=0,1,2…n-1) composed of any polyhedral unit P, assuming that the first mesh node p k The three adjacent mesh nodes and adjacent faces are V k,1 ,V k,2 ,V k,3 and f k,1 ,f k,2 ,f k,3 , among the three adjacent faces, the first mesh node p k The first grid nodes that form the diagonal lines of the adjacent faces are D k,1 ,D k,2 ,D k,3 According to formula (5), any first grid node p k The stretched position after the stretch transformation is:
[0106]
[0107] Then the stretching transformation of any polyhedral unit P can be expressed as:
[0108]
[0109] Its matrix representation is:
[0110] P′=P+λV+λβD Formula (8)
[0111] Among them, V is the stretching matrix, D is the correction matrix, λ is the stretching coefficient, and β is the correction factor.
[0112] It is worth noting that due to the diversity of shapes and topologies of polyhedral units, in the process of performing the stretching transformation, the stretching matrix and the correction matrix of the first grid unit need to be determined according to the actual topological conditions of the polyhedral unit.
[0113] Scaling transformation refers to the process of scaling the volume mesh formed after the stretching transformation to adjust the size of the volume mesh.
[0114] After the first grid unit is stretched, the size of the first grid unit will usually increase to a certain extent, so the initial size of the first grid unit can be maintained as much as possible by scaling the first grid unit after the stretching transformation. In addition, since the scaling transformation does not affect the quality of the first grid unit, there will be mutual constraints between the first grid units during the grid optimization process, so the first grid unit needs to be scaled.
[0115] In some embodiments, the scaling transformation includes scaling and stretching the transformed first grid unit based on an initial side length.
[0116] The initial side length refers to the average side length of the first mesh unit (polyhedral unit) before the stretch transformation. In some embodiments, the mesh optimization module can scale the first mesh unit after the stretch transformation based on the initial side length, keeping the initial side length unchanged. and Respectively represent the centroid of the first mesh unit before and after the stretch transformation, then the vertex of the first mesh unit after the scaling transformation It can be expressed as:
[0117]
[0118] The contraction coefficient ξ is the ratio of the average side lengths before and after the stretching transformation.
[0119] In some embodiments, the scaling transformation further includes: scaling and stretching the transformed first mesh unit based on the initial volume.
[0120] The initial volume refers to the volume of the first grid unit before the stretching transformation. In some embodiments, the grid optimization module can scale the first grid unit after the stretching transformation based on the initial volume, keeping the initial volume unchanged. For example, for a first grid unit that is too thin and long after the stretching transformation, if its bottom surface shape is greatly deformed, the height of the first grid unit can be reduced accordingly, so as to keep the volume of the first grid unit after the stretching transformation at the initial volume.
[0121] Compared to scaling each first mesh unit after the stretching transformation based on the initial volume, scaling each first mesh unit after the stretching transformation based on the initial edge length is more computationally efficient and has a faster processing speed.
[0122] Figure 7 is an exemplary schematic diagram of the regularization of polyhedral units according to some embodiments of the present specification. In order to intuitively demonstrate the effectiveness of the shape transformation (i.e., stretching transformation and scaling transformation) method for polyhedral units, only Figure 7Taking the three different prism units shown as examples, these three irregular prism units will gradually become corresponding regular prism units through iterative transformation, for example, from (a) to (f).
[0123] Step S330: Determine a temporary node set based on the second grid unit set and the first grid node set.
[0124] The shape transformation of the grid unit can make the polyhedral unit tend to be regular. The operation of each polyhedral unit is independent, but each grid node in a grid unit may belong to multiple grid units at the same time. Figure 8 is an exemplary schematic diagram of a temporary node according to some embodiments of this specification. Figure 8 The first grid node p0 shown in the figure belongs to four first grid units (E0, E1, E2, E3) at the same time. After the shape transformation (i.e., transformation into second grid units), these first grid units will generate multiple temporary nodes corresponding to the first grid node p0. These temporary nodes can make the quality of their corresponding grid units better.
[0125] The temporary node set refers to a set of multiple temporary nodes corresponding to each first grid node generated after stretching transformation and scaling transformation of each first grid node and the first grid unit to which it belongs.
[0126] In some embodiments, the temporary node set includes multiple temporary node subsets, such as Each first grid node in the first grid node set corresponds to a temporary node subset in the temporary node set. For example, the first grid node p0 corresponds to the temporary node subset
[0127] Step S340: stitching each second mesh unit in the second mesh unit set based on the temporary node set to determine the second mesh data.
[0128] In some embodiments, the second grid data includes a second grid unit set and a second grid node set. The second grid node set can be obtained by stitching each second grid unit set in the second grid unit set based on the temporary node set. For more information about the second grid data, please refer to the relevant description in the above text.
[0129] Since the first grid unit generates multiple temporary nodes corresponding to the first grid node p0 after the shape transformation These temporary nodes can make the quality of the corresponding grid units better overall. Therefore, after the shape transformation (i.e., stretching transformation and scaling transformation) of the first grid unit, a weighted average operation of the nodes can be introduced to integrate the temporary nodes belonging to different grid units to form a new grid node (e.g., grid node p1), i.e., the second grid node.
[0130] For the convenience of description, assume that M contains n p grid nodes and n e grid of grid cells, with i∈{1,2,…,n p} represents the subscript of the grid node, j∈{1,2,…,n e} represents the subscript of the grid unit, the grid node set and the grid unit set are represented by I and J respectively. i , use n ie Represents the grid node p i The number of units, J(p i ) indicates that the grid node p is included i A set of grid cells, which stores the numbers of these grid cells in the overall grid.
[0131] After independent shape transformation, the first mesh node p i Belong to n ie The second grid cell will get its corresponding n ie A temporary node subset p′ ij In some embodiments, the first grid node p i The new position of (i.e., the position of the second grid node) can be based on its corresponding temporary node subset p′ ij , obtained by calculation. Exemplary calculation formulas include:
[0132]
[0133] From the above formula, we can see that any weight function w j , as long as it meets the conditions However, in order to better meet the effect of grid optimization, the weight function w can be set j As the grid unit E j Quality-related functions, exemplary weight functions w j The formula is as follows:
[0134]
[0135] Among them, E j is the grid unit, q(E j ) is the quality of the grid unit, η is the weight set for illegal units, η≥1.
[0136] For more information about illegal units, see the following text (such as Fig. 9 ) in the relevant description.
[0137] From the definition of the weight function, it can be seen that low-quality mesh cells, especially illegal cells, have greater weights when determining the updated mesh node positions. Generally speaking, the larger the value of η, the faster the illegal cells are eliminated, but too large η may reduce the quality of mesh cells in the local area of the polyhedral mesh. Therefore, in order to avoid this situation, in some embodiments, η=1.2.
[0138] Step S350: Determine whether the optimization termination condition is met. In response to the optimization termination condition being met, output the second grid data; in response to the optimization termination condition not being met, determine the second grid data as the first grid data of the next iteration round.
[0139] The optimization termination condition refers to the condition that needs to be met to terminate a round of iterative optimization.
[0140] In some embodiments, the optimization termination condition includes: the number of iterations reaches a preset upper limit. The preset upper limit is the maximum number of iterations, which can be set in advance by the user. By directly limiting the maximum number of iterations, not only can the optimization effect be guaranteed to a certain extent, but also the iteration time can be shortened, saving the solution cost.
[0141] In some embodiments, the iteration termination condition also includes: the quality of the second grid data reaches a preset condition.
[0142] The quality of the second grid data refers to an indicator for judging the quality of the grid. In some embodiments, since polyhedral grids are mostly used in fluid simulation calculations, the quality of the second grid data can be determined by using an orthogonal quality criterion commonly used in fluid simulation calculations.
[0143] Fig. 9 FIG. 1 is an exemplary schematic diagram of the orthogonal quality of a polyhedral mesh according to some embodiments of the present specification. Fig. 9 As shown, for the second grid unit P, C P is the unit centroid, and the m faces of the second grid unit are F i , i∈{0,1,…,m-1}, C F Yes i The heart of the noodles, The second grid unit P shares the surface F with it i The line connecting the cell centroids of adjacent cells, surface F i The face normal vector is C P to C F The vector is defined as C P arrive The vector is defined as Get the quality coefficient q 1i and q2i :
[0144]
[0145]
[0146] For a polyhedral cell, the final orthogonal quality q is:
[0147] q=min(q 1i ,q 2i ) i∈{0,1,…,m-1} Formula (14)
[0148] The range of orthogonal quality q is [-1,1]. When q<0, the unit is considered illegal. For legal units, the closer the quality is to 0, the worse the unit orthogonal quality is, and the closer it is to 1, the better the unit orthogonal quality is.
[0149] In some embodiments, based on the second grid node set and the second grid unit set, the maximum quality q of the second grid data can be determined by using the orthogonal quality rule. max , minimum mass q min and the average mass q avg .
[0150] Preset conditions refer to pre-set mesh quality judgment conditions.
[0151] In some embodiments, the preset condition includes: a difference between a quality parameter of the second grid data and a quality parameter of the first grid data is less than a preset value.
[0152] The quality parameter refers to a parameter used to characterize the average quality. The quality parameter is a numerical value, and the larger the numerical value, the better the quality. In some embodiments, the difference between the quality parameter of the second grid data and the quality parameter of the first grid data is less than the preset value, which can be expressed as: in, is the quality parameter of the second grid data, is the quality parameter of the first grid data; ε q It is a preset value (or called convergence tolerance) and can be set in advance by the user.
[0153] In some embodiments, the preset condition further includes: a quality parameter of the second grid data reaches a preset parameter value, wherein the preset parameter value can be set in advance by the user.
[0154] In some embodiments, the preset condition also includes: all illegal cells in the second grid data are converted into legal cells.
[0155] That is, for each second grid cell in the second grid cell set of the second grid data, the orthogonal quality q of each second grid cell is q>0.
[0156] It should be noted that the above-mentioned multiple preset conditions are in parallel relationship. During the mesh iterative optimization process, the iteration can be terminated as long as the quality of the second mesh data meets one of the preset conditions.
[0157] The optimization method of the polyhedral mesh in the simulation model provided in some embodiments of this specification can be used not only to optimize the overall quality of the polyhedral mesh, but also to optimize the local area of the mesh formed by the selected low-quality units. In addition, the method can also shorten the solution time increased by poor mesh quality, save solution costs, and improve the accuracy of numerical simulation.
[0158] It should be noted that the above descriptions of process 200, process 300 and process 400 are only for example and explanation, and do not limit the scope of application of this specification. For those skilled in the art, various modifications and changes can be made to process 200, process 300 and process 400 under the guidance of this specification. However, these modifications and changes are still within the scope of this specification.
[0159] The following is a further demonstration and explanation of the optimization method of the polyhedral mesh in the simulation model provided in some embodiments of this specification in conjunction with specific embodiments.
[0160] In the optimization process of the following embodiment, the mesh boundary nodes remain unchanged, and the improvement of the orthogonal quality q of the mesh data and the aspect ratio α are counted at the same time. -1 The change of α -1 is the ratio of the minimum side length to the maximum side length in the grid unit, α -1 The value is between (0, 1], if α -1 The closer it is to 0, the worse the quality of the grid cell is, and conversely, the closer it is to 1, the better the quality of the grid cell is.
[0161] The polyhedral mesh of Example 1 includes 150295 mesh nodes and 26428 polyhedral units, and the initial mesh (ie, the first mesh data) contains 4228 illegal units. Fig.10 It is based on the polyhedral mesh and mass distribution before and after optimization shown in Example 1 of this specification. Fig.10 As shown in the figure, after at least one round of iterative optimization, the illegal cells in the polyhedral mesh are completely eliminated, and the worst quality of the polyhedral mesh reaches 0.1248, and the average quality of the polyhedral mesh is also significantly improved, from 0.3492 to 0.8361. It can be seen that the optimization method of the polyhedral mesh in the simulation model provided in some embodiments of this specification can realize the detwisting and optimization of the mesh under complex shapes, and can effectively improve the mesh quality.
[0162] The implementation process of Example 1 is as follows:
[0163] 0) Set the stretching coefficient λ = 1, the correction factor β = 1, the maximum number of iterations max_iter = 20, and the preset value (or convergence tolerance) ε q =10 -4 ;
[0164] 1) Acquire the first grid data of Example 1;
[0165] 2) performing a stretching transformation on each first grid unit in the first grid unit set according to formula (8), performing a scaling transformation on each first grid unit in the first grid unit set according to formula (9), and saving the grid nodes of the second grid unit set after the transformation in the temporary node set;
[0166] 3) Keeping the boundary nodes fixed, stitching each second grid unit in the second grid unit set based on the temporary node set, and updating the position of the first grid node (i.e., the second grid node);
[0167] 4) Calculating the quality of each second grid cell in the second grid cell set according to formula (14), and counting the average quality, the worst cell quality, the best cell quality, and the quality distribution of the second grid data;
[0168] 5) After 11 iterations, the iteration termination condition is reached, the iterative optimization is terminated, the second grid data is output, and its quality distribution is counted.
[0169] The polyhedral mesh of Example 2 includes 1,275,924 mesh nodes and 224,400 mesh cells, and the initial mesh (ie, the first mesh data) contains 4 illegal cells and multiple low-quality cells. Fig.11 The polyhedral mesh and its mass distribution before and after optimization shown in Example 2 of this specification are shown in FIG. Fig.11 As shown in the figure, after at least one round of iterative optimization, the quality of the polyhedral mesh has been effectively improved, all illegal cells have been eliminated, the number of low-quality cells has also been reduced, and the average quality has been improved to 0.9669.
[0170] The implementation process of Example 2 is as follows:
[0171] 0) Set the stretching coefficient λ = 1, the correction factor β = 1, the maximum number of iterations max_iter = 20, and the preset value (or convergence tolerance) ε q =10 -4 ;
[0172] 1) Acquire the first grid data of Embodiment 2;
[0173] 2) performing a stretching transformation on each first grid unit in the first grid unit set according to formula (8), performing a scaling transformation on each first grid unit in the first grid unit set according to formula (9), and saving the grid nodes of the second grid unit set after the transformation in the temporary node set;
[0174] 3) Keeping the boundary nodes fixed, stitching each second grid unit in the second grid unit set based on the temporary node set, and updating the position of the first grid node (i.e., the second grid node);
[0175] 4) Calculating the quality of each second grid cell in the second grid cell set according to formula (14), and counting the average quality, the worst cell quality, the best cell quality, and the quality distribution of the second grid data;
[0176] 5) After 15 iterations, the iteration termination condition is reached, the iterative optimization is terminated, the second grid data is output, and its quality distribution is counted.
[0177] Table 1. Quality comparison before and after iterative optimization
[0178] Note: The calculation of average (avg.) mass does not include cells with mass < 0.
[0179] Table 2. Comparison of quality distribution before and after iterative optimization
[0180] Table 1 and Table 2 show the quality comparison of Example 1 and Example 2 before and after iterative optimization. The results show that the optimization method of the polyhedral mesh in the simulation model provided in some embodiments of this specification can effectively eliminate illegal units in the polyhedral mesh, and improve the average orthogonal quality and the worst orthogonal quality of the polyhedral mesh. For the polyhedral mesh with good initial mesh, its orthogonal quality can also be further improved. At the same time, the aspect ratio α -1 There is also a significant improvement, indicating that this method has good detwisting and optimization capabilities.
[0181] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
Claims
1. A method for optimizing a polyhedral mesh in a simulation model, characterized in that: The method comprises: Acquire first grid data in the simulation model; Perform at least one round of iterative optimization on the first grid data to obtain second grid data; wherein the at least one round of iterative optimization includes: Acquire first grid data of a current iteration round, wherein the first grid data includes a first grid unit set and a first grid node set; Performing a stretching transformation and a scaling transformation on each first grid cell in the first grid cell set to determine a second grid cell set; Determine a temporary node set based on the second grid unit set and the first grid node set, each first grid node in the first grid node set corresponds to a temporary node subset in the temporary node set; Determine second mesh data based on stitching each second mesh unit in the second mesh unit set by the temporary node set; Determine whether the optimization termination conditions are met. In response to satisfying the optimization termination condition, outputting the second grid data; In response to not satisfying the optimization termination condition, the second grid data is determined as the first grid data of the next iteration round.
2. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: The termination conditions include: The number of iterations reaches the preset upper limit.
3. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, characterized in that: The termination conditions include: The quality of the second grid data meets a preset condition.
4. The method for optimizing a polyhedral mesh in a simulation model according to claim 3, wherein: The preset conditions include: A difference between a quality parameter of the second grid data and a quality parameter of the first grid data is smaller than a preset value.
5. The method for optimizing a polyhedral mesh in a simulation model according to claim 3, wherein: The preset conditions include: All illegal cells in the second grid data are converted into legal cells.
6. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: The stretching transformation includes: Get the stretch factor; Each first grid node of the first grid unit is stretched based on the stretching coefficient to determine a first grid unit after stretching transformation.
7. The method for optimizing a polyhedral mesh in a simulation model according to claim 6, wherein: The stretching of each first grid node of the first grid unit based on the stretching coefficient comprises: Determining a local tetrahedron of each first mesh node; Based on the local tetrahedron, determining an outer normal vector of each first mesh node; Determine a correction vector of each first mesh node based on an adjacent surface to which each first mesh node belongs in the first mesh unit; Determine a movement vector of each first mesh node based on the external normal vector and the correction vector; Based on the stretch coefficient and the movement vector, a stretch position of each first mesh node is determined.
8. The method for optimizing a polyhedral mesh in a simulation model according to claim 7, wherein: Determining the correction vector of each first grid node includes: Determining an initial correction vector of each first grid node; Obtaining a correction factor for each first grid node; The correction vector is determined by scaling the initial correction vector based on the correction factor.
9. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: The scaling transformation includes: Scales the first mesh cell after the transformation based on the initial edge length.
10. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: The scaling transformation includes: Scales and stretches the transformed first mesh cell based on the initial volume.
11. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: Determining the temporary node set includes: For each of the first grid nodes, determining a first grid unit subset including the first grid node; Determining a transformed second grid unit subset based on the first grid unit subset; Based on the transformed second grid unit subset, the temporary node subset corresponding to each first grid node is determined.
12. The method for optimizing a polyhedral mesh in a simulation model according to claim 1, wherein: The determining of the second grid data by stitching each second grid unit in the second grid unit set based on the temporary node set comprises: Based on each temporary node subset in the temporary node set, performing a weighted average of the temporary nodes in each temporary node subset to determine the second grid node; The second grid data is determined based on the second grid nodes and the second grid cells.
13. A polyhedral mesh optimization system in a simulation model, characterized in that: The system comprises: A grid acquisition module is configured to acquire first grid data in the simulation model; A grid optimization module, configured to perform at least one round of iterative optimization on the first grid data to obtain second grid data; Wherein, the at least one round of iterative optimization includes: Acquire first grid data of a current iteration round, wherein the first grid data includes a first grid unit set and a first grid node set; Performing a stretching transformation and a scaling transformation on each first grid cell in the first grid cell set to determine a second grid cell set; Determine a temporary node set based on the second grid unit set and the first grid node set, each first grid node in the first grid node set corresponds to a temporary node subset in the temporary node set; Determine second mesh data based on stitching each second mesh unit in the second mesh unit set by the temporary node set; Determine whether the optimization termination conditions are met. In response to satisfying the optimization termination condition, outputting the second grid data; In response to not satisfying the optimization termination condition, the second grid data is determined as the first grid data of the next iteration.
