Gradient numerical calculation method and system based on grid self-adaption and hybrid strategy
By adopting a gradient numerical calculation method based on mesh adaptation and a hybrid strategy, the gradient calculation method is dynamically selected, which solves the applicability and stability problems of mesh gradient calculation in CFD programs, improves numerical accuracy and computational efficiency, and is applicable to complex mesh structures.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-04-07
AI Technical Summary
Existing CFD programs struggle to simultaneously guarantee the applicability, stability, and numerical accuracy of grid cell gradient calculations, especially in regions with high distortion, where errors and instabilities are prone to occur.
A gradient numerical calculation method based on mesh adaptation and a hybrid strategy is adopted. By identifying the mesh location and distortion, a hybrid calculation method of Green-Gauss method and weighted least squares method is dynamically selected to improve the numerical accuracy and stability of mesh gradient.
It improves the numerical accuracy, adaptability, and computational efficiency of grid cell gradients, is applicable to general structured non-orthogonal or unstructured grids, avoids the errors and instabilities caused by single methods, and enhances the overall stability and accuracy of CFD simulations.
Smart Images

Figure CN121809136A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computational fluid dynamics (CFD) sub-field of computer aided engineering (CAE), and particularly relates to a gradient numerical calculation method and system based on grid adaptation and hybrid strategy. BACKGROUND
[0002] CFD program belongs to a branch of industrial software about fluid dynamics analysis, which can analyze phenomena involving fluid flow, fluid-structure coupling, heat and mass transfer, and plays an important role in the fields of aerospace engineering, automotive engineering, water conservancy engineering, civil engineering, environmental engineering, etc. CFD program is based on three conservation equations (mass, momentum and energy) as the theoretical basis, and based on finite volume method for grid discretization to construct large-scale numerical matrix, and by solving to obtain the spatial distribution and time variation of basic physical quantities (such as velocity, pressure, temperature and concentration, etc.) at each position in the calculation region, so as to realize the simulation and prediction of complex fluid phenomena.
[0003] The grid schematic diagram is shown in the accompanying Figure 1 The general form of the three conservation equations (mass conservation equation, momentum conservation equation and energy conservation equation) is as follows:
[0004] (1)
[0005] The above formula from left to right , , , is the transient term, the convection term, the diffusion term and the source term respectively. When the finite volume method is used for grid discretization, and the Gauss divergence theorem is considered, the integral form in the grid control volume C is as follows:
[0006] (2)
[0007] In the formula, the control volume; is the surface area of the control volume C; is the area vector of each interface of the control volume C. The diffusion term includes the gradient term, so during the numerical discretization process based on the finite volume method, the numerical calculation of the gradient term of each interface is needed. The interface gradient value can be obtained by interpolation and correction of the gradient values of different control volume centers adjacent to it, and the specific relationship is as follows:
[0008] (3)
[0009] (4)
[0010] wherein is the unit vector of the center line of the grid C and the adjacent grid F; is the distance between the centers of the grid C and the adjacent grid F; is the geometric weight coefficient, , is the vector radius of the grid F and C relative to the coordinate origin, respectively; is the geometric weight of the grid F, ; is the gradient value of the interface f; is the gradient value calculated according to the gradient and the geometric weight coefficient of the grid F and the grid C; , is the corresponding grid center value of the two adjacent grid units sharing the interface f as a common surface; , is the grid center gradient value of the two adjacent grid units sharing the interface f as a common surface;
[0011] It is not difficult to find that the interface gradient value can be obtained by the grid center gradient value, and therefore how to calculate the grid center gradient with high accuracy is crucial. Currently, the calculation of the control volume (grid) center gradient term includes the Green-Gauss method and the weighted least squares method. Both the Green-Gauss method and the weighted least squares method have their own advantages and disadvantages; in addition, during the grid division process, it is impossible to ensure that all grid qualities have high quality, and therefore any one of the above methods cannot simultaneously satisfy the applicability, stability and numerical accuracy of the gradient calculation of all grid units in the calculation region.
[0012] In view of this, the present application is proposed. SUMMARY
[0013] The present application proposes a gradient numerical calculation method and system based on grid self-adaptation and hybrid strategy for the numerical discrete stage based on the finite volume method, which can perform adaptive judgment according to the grid twist degree and grid position recognition, perform gradient calculation of various types of grids in the calculation region based on the hybrid strategy, improve the numerical accuracy, adaptability, stability and calculation efficiency of the overall grid gradient, and provide a new idea for high-precision numerical discrete solution of computational fluid dynamics.
[0014] The present application is implemented by the following technical solutions:
[0015] In a first aspect, the present application provides a gradient numerical calculation method based on grid self-adaptation and hybrid strategy, which comprises:
[0016] obtaining all grid information in the to-be-calculated region; and performing grid position recognition according to all the grid information;
[0017] According to the identified grid position, it is judged whether the grid belongs to an internal grid or not;
[0018] If it does not belong to the internal grid, i.e., it belongs to a boundary layer grid, then a Green-Gauss method is used to calculate the grid center gradient, and the grid center gradient is obtained;
[0019] If it belongs to the internal grid, then a different type of grid element grid distortion calculation method is used to calculate the grid distortion of all internal grids; and according to the grid distortion, a weighting coefficient is calculated; and according to different weighting coefficients, different grid center gradient calculation methods are used to calculate the grid center gradient;
[0020] Based on the grid center gradient of the adjacent grid elements of the interface, the gradient value of the interface is calculated.
[0021] Further, the different types of grid element grid distortion calculation methods include:
[0022] The grid distortion of a triangular type grid element The calculation formula is: wherein, is the area of the target element, is the area of the actual calculation element;
[0023] The grid distortion of a quadrilateral type grid element The calculation formula is: wherein, and are the maximum angle and the minimum angle of each grid element, respectively; max[ ] is the maximum value function;
[0024] The grid distortion of a tetrahedral type grid element or a hexahedral type grid element The calculation formula is: wherein, represents all the faces of the current grid, represents the grid distortion of all the faces of the current grid.
[0025] Further, according to the grid distortion, a weighting coefficient is calculated, including:
[0026] If it is a boundary layer grid, the weighting coefficient is 1;
[0027] If it is an internal grid, and the grid distortion is greater than a second dividing value and less than or equal to 1, the weighting coefficient is 1;
[0028] If it is an internal grid, and the grid distortion is greater than or equal to 0 and less than a first dividing value, the weighting coefficient is 0;
[0029] If the internal grid and the grid distortion is greater than or equal to the first threshold value and less than or equal to the second threshold value, the weighting coefficient is the ratio of the first difference value and the second difference value, the first difference value is the difference between the grid distortion and the first threshold value; the second difference value is the difference between the second threshold value and the first threshold value.
[0030] Further, the first threshold value is less than the second threshold value, both of which are within the range of (0, 1).
[0031] Further, according to different weighting coefficients, different grid center gradient calculation methods are used to calculate the grid center gradient, including:
[0032] If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method;
[0033] If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method;
[0034] If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated based on the hybrid calculation method of the Green-Gauss method and the weighted least squares method.
[0035] Further, the grid center gradient is calculated based on the Green-Gauss method, including:
[0036] Based on the first center value and the second center value of the adjacent grid cells of the interface f, the state value at the intersection of the center line of the adjacent grid cells and the interface is obtained;
[0037] According to the state value , the grid center gradient is calculated based on the Green-Gauss theorem and the approximation processing;
[0038] According to the grid center gradient and the state value , the state value at the interface centroid position and the corrected grid center gradient are obtained;
[0039] The relative deviation of the corrected grid center gradient is calculated, and the cycle is terminated until the relative deviation does not exceed the preset value.
[0040] Further, the grid center gradient is calculated based on the hybrid calculation method of the Green-Gauss method and the weighted least squares method, including:
[0041] The first grid center gradient is calculated using the weighted least squares method;
[0042] Based on the first center value Second Heart Value Obtain the intersection point of the grid center line connecting adjacent grid cells and the interface. State value at ;
[0043] Based on the state value The gradient of the second grid center is calculated based on Green-Gauss's theorem and approximation. ;
[0044] Based on the gradient of the second grid center and state value Make corrections to obtain the state value at the centroid of the interface. and the corrected gradient of the second grid center ;
[0045] Based on the gradient of the first grid center and the corrected gradient of the second grid center The final grid center gradient is calculated using weighted averages.
[0046] Calculate the relative deviation of the final grid center gradient, and terminate the loop when the relative deviation does not exceed the preset value.
[0047] Furthermore, the expression for the hybrid computation method based on the Green-Gauss method and the weighted least squares method is as follows:
[0048]
[0049] In the formula, For the grid center gradient, These are weighting coefficients. The gradient of the first grid center is the gradient value calculated using the weighted least squares method. This is the gradient of the second grid center, which is the gradient value calculated using the Green-Gauss method.
[0050] Secondly, this invention provides a gradient numerical calculation system based on grid adaptation and a hybrid strategy, the system comprising:
[0051] The acquisition unit is used to obtain all grid information within the region to be calculated based on the divided grid file.
[0052] A grid location identification unit is used to identify grid locations based on all grid information.
[0053] The mesh identification and calculation unit is used to determine whether a mesh belongs to an internal mesh based on its identified location. If it does not belong to an internal mesh, i.e., it belongs to a boundary layer mesh, the mesh center gradient is calculated based on the Green-Gauss method to obtain the mesh center gradient. If it belongs to an internal mesh, the mesh distortion of all internal meshes is calculated based on different types of mesh element mesh distortion calculation methods. Weighting coefficients are calculated based on the mesh distortion. And different mesh center gradient calculation methods are used to calculate the mesh center gradient based on different weighting coefficients.
[0054] The gradient value calculation unit is used to calculate the gradient value of the interface based on the grid center gradient of adjacent grid cells.
[0055] Furthermore, weighting coefficients are calculated based on the mesh distortion, including:
[0056] If it is a boundary layer mesh, the weighting factor is 1;
[0057] If it is an internal mesh, and the mesh distortion is greater than the second boundary value and less than or equal to 1, then the weighting factor is 1;
[0058] If it is an internal mesh, and the mesh distortion is greater than or equal to 0 and less than the first boundary value, then the weighting coefficient is 0;
[0059] If it is an internal mesh, and the mesh distortion is greater than or equal to the first boundary value and less than or equal to the second boundary value, then the weighting coefficient is the ratio of the first difference to the second difference. The first difference is the difference between the mesh distortion and the first boundary value; the second difference is the difference between the second boundary value and the first boundary value.
[0060] Furthermore, based on different weighting coefficients, different grid center gradient calculation methods are used to calculate the grid center gradient, including:
[0061] If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method;
[0062] If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method;
[0063] If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
[0064] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described gradient numerical calculation method based on grid adaptation and hybrid strategies.
[0065] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the above-described gradient numerical calculation method based on grid adaptation and hybrid strategies.
[0066] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0067] 1. This invention relates to a gradient numerical calculation method and system based on mesh adaptation and hybrid strategies. For calculation cases based on numerical discretization using the finite volume method, this invention proposes a gradient adaptive correction algorithm that can adaptively determine based on mesh distortion and mesh position identification, and calculate the gradient values of various types of meshes within the calculation area based on a hybrid strategy, thereby improving the numerical accuracy, adaptability, stability, and computational efficiency of the mesh cell gradient.
[0068] 2. Compared with traditional single gradient calculation methods, this invention has higher mesh applicability for general non-orthogonal or unstructured meshes and does not have the problem of erroneous calculation.
[0069] 3. This invention is universal. For the input mesh, it adaptively evaluates the mesh quality and, based on a hybrid strategy, accurately selects the most suitable gradient calculation method for the mesh cells with different degrees of distortion for gradient correction, thus balancing computational stability and numerical accuracy. Attached Figure Description
[0070] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:
[0071] Figure 1 This is a schematic diagram of the grid.
[0072] Figure 2 This is a schematic diagram illustrating an example of calculating the twist degree of a triangular element mesh according to the present invention;
[0073] Figure 3 This is a schematic diagram illustrating an example of calculating the twist of a quadrilateral element mesh according to the present invention.
[0074] Figure 4 This is a flowchart of the gradient numerical calculation method based on mesh adaptation and hybrid strategy of the present invention;
[0075] Figure 5 This is a flowchart of the gradient calculation method based on the Green-Gauss method of the present invention;
[0076] Figure 6 This is a flowchart of the hybrid computation method based on the Green-Gauss method and the weighted least squares method of the present invention;
[0077] Figure 7 This is a block diagram of the gradient numerical calculation system based on mesh adaptation and hybrid strategies of the present invention. Detailed Implementation
[0078] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0079] Currently, the calculation of the gradient term of the control volume (mesh) center includes the Green-Gauss method and the weighted least squares method.
[0080] The first method, the Green-Gauss method, is based on the Green-Gauss theorem. For a mesh cell C, it approximates the cell surface integral by multiplying the value at the centroid of the cell interface with the cell surface area, and uses the average gradient. Approximate substitution ,get:
[0081] (5)
[0082] in, Represents all faces of the current mesh. The value at the centroid of the unit interface can be determined by different control volume cells adjacent to it. Perform interpolation calculations. Let f be the area of surface f. The value represents the mesh volume. Only when the values at the interfaces are calculated accurately can the average gradient value at the mesh center be calculated accurately. Secondly, the numerical discretization process only yields approximate values at the interfaces, and cannot strictly guarantee conservation. Therefore, for both structured and unstructured meshes, the Green-Gauss method (GG) can only achieve a maximum of first-order numerical accuracy. However, this method has strong mesh applicability; even with a large ratio of x and y in the mesh, it can still obtain numerically stable approximations.
[0083] The second method is Weighted Least Squares (WLSQ). Considering the grids F adjacent to grid C, if the gradient of the grid center of grid C... The exact value is known, and it can be determined by linear interpolation:
[0084] (6)
[0085] in The radius vectors of grids F and C relative to the origin of the coordinate system, respectively; The gradient value of grid C can also be expressed as ; , Let F be the corresponding grid center value of the grid cell; in the weighted least squares method, first construct a weighted sum function of the F values of all grid cells adjacent to grid cell C. ,Right now:
[0086] (7)
[0087] in, Let C be the number of faces in the grid. For the mesh that is adjacent to the k-th face as a common face Core value; For grid The radius vector of the center point of grid C; For grid The difference between the grid center value and that of grid C; , , For the radius The projected length on the x, y, z axes; , and These are the partial derivatives of the grid center value of grid C with respect to the x, y, and z axes, respectively. It is a weighting factor. .
[0088] The minimum value of a function should satisfy the following condition:
[0089] (8)
[0090] The system of equations for the unknown gradient is obtained, in matrix form as follows:
[0091] (9)
[0092] Solving the above system of equations will yield the gradient value of the cell center C. A solution exists as long as the left-hand side matrix is not singular. The reciprocal of the nth power of the distance between the lines connecting the grid center points is commonly used as the weighting coefficient, i.e. Here, n is considered to be 1, 2, or 3. When n is 3, the least squares method can calculate the gradient with second-order accuracy. However, for the weighted least squares method, if the distribution of adjacent grids around grid C is highly anisotropic (i.e., there are more adjacent grids on one side and fewer on the other), the calculated gradient value is biased towards one side. Furthermore, this method is less applicable to grids with high distortion or large aspect ratio (such as boundary layers), and may result in erroneous calculations. This indicates that the least squares method has certain requirements for grid quality.
[0093] When discretizing conservation equations using the finite volume method, it is necessary to calculate the gradient values for each grid cell. Currently, the Green-Gauss method or the weighted least squares method is mainly used. The Green-Gauss method has strong applicability and computational stability for different grid types, but its numerical accuracy is low, at most first-order. The weighted least squares method has higher numerical accuracy, reaching second-order, but it may miscalculate gradients for slender grids, and when there is significant anisotropy in the distribution of adjacent grid cells (i.e., more adjacent grid cells on one side and fewer on the other), the calculated gradient values tend to be unilateral, resulting in poor grid applicability. In high-precision fluid numerical simulations, a single gradient calculation method cannot simultaneously guarantee the computational stability and numerical accuracy of the grid gradient.
[0094] Therefore, both the Green-Gauss method and the weighted least squares method have their own advantages and disadvantages. In addition, it is impossible to guarantee that all grids have high quality during the mesh generation process. Therefore, neither of the above methods can simultaneously satisfy the applicability, stability and numerical accuracy of gradient calculation for all grid cells in the computational domain.
[0095] Therefore, for the numerical discretization stage based on the finite volume method, this invention proposes a high-precision gradient numerical calculation method based on mesh adaptation and a hybrid strategy, which balances computational stability and numerical accuracy during mesh gradient calculation. This improves the numerical accuracy, adaptability, stability, and computational efficiency of mesh cell gradients. The method starts with mesh characteristics, calculates feature evaluation quantities related to mesh quality (mesh distortion is selected here) based on the mesh's location (within the boundary layer or computational domain), establishes a mesh adaptive evaluation method based on mesh location identification and distortion, and automatically selects a suitable gradient calculation method based on mesh quality and location. For some meshes, the Green-Gauss method is used; for others, weighted least squares is used; and for still others, a weighted result of both the Green-Gauss and weighted least squares calculations is used. This establishes a hybrid solution strategy based on the Green-Gauss method and weighted least squares, thereby accurately calculating the gradients of all meshes within the computational domain, significantly improving the numerical accuracy and stability of CFD simulations. For detailed calculation procedures, please refer to [link to detailed calculation process]. Figure 4 .
[0096] Example 1
[0097] Mesh skewness measures the degree to which the geometry of mesh elements deviates from an ideal shape (such as a square or cube). Especially when calculating gradients of fluid variables (such as velocity and pressure), highly skewed mesh elements can introduce significant numerical errors. Due to the irregular shape of the mesh elements, large deviations in gradient calculations can lead to a decrease in numerical accuracy. Furthermore, instability of numerical solutions increases in high-skewness regions. Even worse, highly skewed elements can amplify errors in numerical methods, causing non-convergence or divergence of numerical solutions, affecting the overall stability of the simulation. To address the errors caused by mesh skewness, additional post-processing and correction measures are needed to further improve computational efficiency.
[0098] Methods for calculating mesh distortion of different types of mesh elements, including:
[0099] For triangular type mesh cells, such as Figure 2 As shown, the triangle is the actual computational element, and the equilateral triangle corresponding to its circumcircle is called the optimal element. The mesh distortion of the triangular mesh element... The calculation formula is:
[0100] (10)
[0101] in, The area of the target cell. This represents the area of the actual calculation unit;
[0102] The closer the mesh distortion is to 0, the closer the actual computational element is to the target element, and the better the mesh quality. The closer the mesh distortion is to 1, the narrower and longer the mesh, and the larger the aspect ratio. For tetrahedral element C, the distortion can be expressed as:
[0103] (11)
[0104] in, Represents all faces of the current mesh. Represents the mesh distortion of all faces in the current mesh.
[0105] That is, the tetrahedral distortion is the maximum value of the distortion of all its faces.
[0106] For quadrilateral type mesh elements, see attached Figure 3 As shown, each element has a maximum angle and a minimum angle, defined as follows: and Mesh distortion of quadrilateral type mesh cells The calculation formula is:
[0107] (12)
[0108] Where max[ ] is the maximum value function;
[0109] For a hexahedral type element C, the twist can be expressed as:
[0110] (13)
[0111] in, Represents all faces of the current mesh. Represents the mesh distortion of all faces in the current mesh.
[0112] That is, the hexahedral distortion is the maximum value of the distortion of all its faces.
[0113] During gradient calculation, the distortion of the mesh varies at different locations. Applying a single gradient calculation method may not guarantee computational stability and numerical accuracy. Therefore, an adaptive mesh evaluation method is established based on mesh distortion and mesh location identification. The method automatically selects a suitable gradient calculation method based on the mesh quality and mesh location. The Green-Gauss method is used for some meshes, the weighted least squares method is used for others, and a weighted result of the Green-Gauss method and the weighted least squares method is used for still others. In other words, a hybrid solution strategy based on the Green-Gauss method and the weighted least squares method is established, thereby forming a gradient numerical calculation method with high accuracy and high stability.
[0114] The key technique in this calculation method is the definition of the gradient calculation weighting function: setting the weighting coefficients. Related to mesh location and mesh distortion; that is, the weighting coefficients are calculated based on the mesh distortion, including:
[0115] If it is a boundary layer mesh, the weighting factor is 1;
[0116] If it is an internal mesh, and the mesh distortion is greater than the second boundary value and less than or equal to 1, then the weighting factor is 1;
[0117] If it is an internal mesh, and the mesh distortion is greater than or equal to 0 and less than the first boundary value, then the weighting coefficient is 0;
[0118] If it is an internal mesh, and the mesh distortion is greater than or equal to the first boundary value and less than or equal to the second boundary value, then the weighting coefficient is the ratio of the first difference to the second difference. The first difference is the difference between the mesh distortion and the first boundary value; the second difference is the difference between the second boundary value and the first boundary value.
[0119] The first boundary value is less than the second boundary value, and both are within the range of (0,1).
[0120] The specific form is as follows (where t1 and t2 are the first and second boundary values of the mesh distortion, respectively, which can be adjusted according to different numerical accuracy and stability requirements):
[0121] (14)
[0122] The gradient value of grid cell C is determined by the Green-Gauss method and weighted least squares with respect to the coefficients. The weighted average is obtained as follows:
[0123] (15)
[0124] In the formula, For the grid center gradient, These are weighting coefficients. The gradient of the first grid center is the gradient value calculated using the weighted least squares method. This is the gradient of the second grid center, which is the gradient value calculated using the Green-Gauss method.
[0125] Specifically, based on different weighting coefficients, different grid center gradient calculation methods are used to calculate the grid center gradient, including:
[0126] If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method;
[0127] If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method;
[0128] If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
[0129] The gradient numerical calculation method based on mesh adaptation and hybrid strategy established above can avoid the incorrect gradient calculation results obtained by using the weighted least squares method alone in the boundary layer mesh and the internal mesh with large distortion. It can also improve the low numerical accuracy of the internal high-quality mesh when only the Green-Gauss method is used. It can ensure that all meshes in the entire fluid region obtain the correct core gradient and improve the numerical accuracy of the entire fluid region.
[0130] In specific implementation, such as Figure 4 As shown, the present invention provides a gradient numerical calculation method based on mesh adaptation and a hybrid strategy, which includes:
[0131] Step (a): Obtain all grid information within the area to be calculated based on the divided grid file; and identify the grid locations based on all grid information.
[0132] Step (b): Based on the identified grid location, determine whether the grid belongs to the internal grid; if it does not belong to the internal grid, i.e., it belongs to the boundary layer grid, then proceed to step (e-1); if it belongs to the internal grid, then proceed to step (c).
[0133] Step (c): Based on the mesh skewness calculation method for different types of mesh elements, calculate the mesh skewness of all internal meshes according to formulas (10) to (13);
[0134] Step (d): Based on the calculated mesh distortion, calculate the weighting coefficients in the hybrid gradient calculation strategy according to formula (14). ,according to The magnitude of the value determines the different calculation steps;
[0135] if If the value is 1, proceed to step (e-1). If the value is 0, proceed to step (e-2); If the value is any other, proceed to step (e-3).
[0136] Step (e-1): Calculate the grid center gradient based on the Green-Gauss method to obtain the grid center gradient. See details Figure 5 ;
[0137] Step (e-2): Calculate the grid center gradient using the weighted least squares method. The calculation, based on formula (9), obtains the lattice center gradient value by solving the correlation matrix. To ensure second-order numerical accuracy, the weighting factor is considered to be... n=3;
[0138] Step (e-3): Calculate the grid center gradient using a hybrid method combining the Green-Gauss method and weighted least squares. For the calculation process, please refer to [link / reference]. Figure 6 ;
[0139] Step (f): Calculate the gradient value of the interface based on the grid center gradients of adjacent grid cells. That is, calculate the gradient value of the interface based on the first grid center value of the adjacent grid cells of interface f. Second Heart Value The gradient value of the interface is calculated using formula (3). .
[0140] In this embodiment, the gradient calculation method based on the Green-Gauss method is as follows, see details below. Figure 5 :
[0141] Step 1: Based on the first cell center value of the adjacent grid cells of interface f Second Heart Value Obtain the intersection point of the grid center line connecting adjacent grid cells and the interface. State value at ;Right now:
[0142] (16)
[0143] in, These are geometric weighting coefficients;
[0144] Step 2: Based on the state value The grid center gradient was calculated based on Green-Gauss's theorem and approximation. ;Right now:
[0145] (17)
[0146] in, Let C be the volume of the grid. Let f be the area of surface f;
[0147] Step 3: Considering that the intersection of the line connecting the centers of adjacent grid cells and the interface may not be consistent with the center position of the interface, correction is needed to adjust the state value at the interface's centroid. for:
[0148] (18)
[0149] in, , Let f be the grid center gradient of two adjacent grid cells with interface f as the common surface; Let f be the radius vector of the surface relative to the origin; Let C be the radius vector of the grid relative to the origin; Let F be the radius vector of the grid relative to the origin;
[0150] Step 4: Utilize Calculate the grid center gradient of grid cell C (That is, the corrected grid center gradient), specifically expressed as:
[0151] (19)
[0152] Step 5: Calculate the relative deviation of the corrected grid center gradient, i.e.: When relative deviation If the percentage does not exceed 1%, the loop terminates; otherwise, return to step three.
[0153] In this embodiment, the hybrid computation method based on the Green-Gauss method and the weighted least squares method is as follows, see details below. Figure 6 :
[0154] Step 1: Calculate the gradient of the first grid center using the weighted least squares method. Based on formula (9), the grid center gradient value is obtained by solving the correlation matrix, with the weighting factor considered as follows: n=3;
[0155] Step 2: Based on the first grid center value of the adjacent grid cells of interface f Second Heart Value Obtain the intersection point of the grid center line connecting adjacent grid cells and the interface. State value at ;Right now:
[0156] (20)
[0157] Step 3: Based on the state value The gradient of the second grid center is calculated based on Green-Gauss's theorem and approximation. ;Right now:
[0158] (twenty one)
[0159] Step 4: Considering that the intersection of the line connecting the centers of adjacent grid cells and the interface may not be in the same position as the center of the interface, correction is required, namely:
[0160] (twenty two)
[0161] Step 5: Utilize Calculate the center gradient of grid cell C (i.e., the corrected second grid center gradient). Specifically, it is expressed as:
[0162] (twenty three)
[0163] Step 6: Based on the gradient of the first grid center and the corrected gradient of the second grid center The final grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
[0164] Specifically, the expression for the hybrid computation method based on the Green-Gauss method and the weighted least squares method is as follows:
[0165]
[0166] In the formula, For the grid center gradient, These are weighting coefficients. The gradient of the first grid center is the gradient value calculated using the weighted least squares method. This is the gradient of the second grid center, which is the gradient value calculated using the Green-Gauss method.
[0167] Step 7: Calculate the relative deviation of the final grid center gradient, i.e.: When relative deviation If the percentage does not exceed 1%, the loop terminates; otherwise, return to step three.
[0168] This invention addresses the numerical discretization stage based on the finite volume method by proposing a gradient numerical calculation method based on mesh adaptation and a hybrid strategy. This method can adaptively determine gradients based on mesh distortion and mesh location identification, and uses a hybrid strategy to calculate gradients for various mesh types within the computational domain. This avoids incorrect gradient calculation results obtained by using only the weighted least squares method for boundary layer meshes and internal meshes with high distortion. It also improves the low numerical accuracy of high-quality internal meshes when using only the Green-Gauss method, enhancing the overall numerical accuracy, adaptability, stability, and computational efficiency of the mesh gradient. This provides a new approach for high-precision numerical discretization solutions in computational fluid dynamics.
[0169] Example 2
[0170] like Figure 7 As shown, the difference between this embodiment and Embodiment 1 is that this embodiment provides a gradient numerical calculation system based on mesh adaptation and a hybrid strategy. This system corresponds one-to-one with the gradient numerical calculation method based on mesh adaptation and a hybrid strategy in Embodiment 1. The system includes:
[0171] The acquisition unit is used to obtain all grid information within the region to be calculated based on the divided grid file.
[0172] A grid location identification unit is used to identify grid locations based on all grid information.
[0173] The mesh identification and calculation unit is used to determine whether a mesh belongs to an internal mesh based on its identified location. If it does not belong to an internal mesh, i.e., it belongs to a boundary layer mesh, the mesh center gradient is calculated based on the Green-Gauss method to obtain the mesh center gradient. If it belongs to an internal mesh, the mesh distortion of all internal meshes is calculated based on different types of mesh element mesh distortion calculation methods. Weighting coefficients are calculated based on the mesh distortion. And different mesh center gradient calculation methods are used to calculate the mesh center gradient based on different weighting coefficients.
[0174] The gradient value calculation unit is used to calculate the gradient value of the interface based on the grid center gradient of adjacent grid cells.
[0175] As a further implementation, weighting coefficients are calculated based on the mesh distortion, including:
[0176] If it is a boundary layer mesh, the weighting factor is 1;
[0177] If it is an internal mesh, and the mesh distortion is greater than the second boundary value and less than or equal to 1, then the weighting factor is 1;
[0178] If it is an internal mesh, and the mesh distortion is greater than or equal to 0 and less than the first boundary value, then the weighting coefficient is 0;
[0179] If it is an internal mesh, and the mesh distortion is greater than or equal to the first boundary value and less than or equal to the second boundary value, then the weighting coefficient is the ratio of the first difference to the second difference. The first difference is the difference between the mesh distortion and the first boundary value; the second difference is the difference between the second boundary value and the first boundary value.
[0180] As a further implementation, the grid center gradient is calculated using different grid center gradient calculation methods based on different weighting coefficients, including:
[0181] If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method;
[0182] If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method;
[0183] If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
[0184] The execution process of each unit can be carried out according to the gradient numerical calculation method based on mesh adaptation and hybrid strategy in Example 1, and will not be described in detail in this example.
[0185] Meanwhile, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned gradient numerical calculation method based on grid adaptation and hybrid strategy.
[0186] Meanwhile, the present invention also provides a computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the above-mentioned gradient numerical calculation method based on grid adaptation and hybrid strategy.
[0187] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0188] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0189] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0190] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0191] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A gradient numerical calculation method based on mesh adaptation and hybrid strategies, characterized in that, The method includes: Obtain all grid information within the area to be calculated; and identify grid locations based on all grid information. Based on the identified grid location, determine whether the grid belongs to the internal grid; If it does not belong to the internal mesh, that is, to the boundary layer mesh, then the mesh center gradient is calculated based on the Green-Gauss method to obtain the mesh center gradient; If it belongs to the internal mesh, the mesh distortion of all internal meshes is calculated based on the mesh distortion calculation method of different types of mesh elements; and the weighting coefficient is calculated according to the mesh distortion; and the mesh center gradient is calculated using different mesh center gradient calculation methods according to different weighting coefficients. The gradient value of the interface is calculated based on the grid center gradient of adjacent grid cells.
2. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 1, characterized in that, Methods for calculating mesh distortion of different types of mesh elements, including: Mesh distortion of triangular mesh cells The calculation formula is: ,in, The area of the target cell. This represents the area of the actual calculation unit; Mesh distortion of quadrilateral type mesh cells The calculation formula is: ,in, and These are the maximum and minimum angles of each grid cell, respectively; max[] is the maximum value function; Mesh distortion of tetrahedral or hexahedral mesh elements The calculation formula is: ,in, Represents all faces of the current mesh. Represents the mesh distortion of all faces of the current mesh.
3. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 1, characterized in that, Based on the mesh distortion, the weighting coefficients are calculated, including: If it is a boundary layer mesh, the weighting factor is 1; If it is an internal mesh, and the mesh distortion is greater than the second boundary value and less than or equal to 1, then the weighting factor is 1; If it is an internal mesh, and the mesh distortion is greater than or equal to 0 and less than the first boundary value, then the weighting coefficient is 0; If it is an internal mesh, and the mesh distortion is greater than or equal to a first boundary value and less than or equal to a second boundary value, then the weighting coefficient is the ratio of the first difference to the second difference, where the first difference is the difference between the mesh distortion and the first boundary value; and the second difference is the difference between the second boundary value and the first boundary value.
4. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 3, characterized in that, The first boundary value is less than the second boundary value.
5. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 1, characterized in that, The grid center gradient is calculated using different methods based on different weighting coefficients, including: If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method; If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method; If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
6. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 5, characterized in that, The grid center gradient is calculated based on the Green-Gauss method, including: Based on the first grid center value of the adjacent grid cells of interface f Second Heart Value Obtain the intersection point of the grid center line connecting adjacent grid cells and the interface. State value at ; According to the state value The grid center gradient is calculated based on Green-Gauss's theorem and approximation. Based on the grid center gradient and the state value Make corrections to obtain the state value at the centroid of the interface. and the corrected grid center gradient; The relative deviation of the corrected grid center gradient is calculated, and the loop terminates when the relative deviation does not exceed a preset value.
7. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 5, characterized in that, A hybrid computational method based on the Green-Gauss method and weighted least squares method is used to calculate the grid center gradient, including: Gradient of the first grid center using weighted least squares method ; Based on the first grid center value of the adjacent grid cells of interface f Second Heart Value Obtain the intersection point of the grid center line connecting adjacent grid cells and the interface. State value at ; According to the state value The gradient of the second grid center is calculated based on Green-Gauss's theorem and approximation. ; According to the gradient of the second grid center and the state value Make corrections to obtain the state value at the centroid of the interface. and the corrected gradient of the second grid center ; According to the gradient of the first grid center and the corrected gradient of the second grid center The final grid center gradient is calculated using weighted averages. The relative deviation of the gradient of the final grid center is calculated, and the loop terminates when the relative deviation does not exceed a preset value.
8. The gradient numerical calculation method based on mesh adaptation and hybrid strategy according to claim 5, characterized in that, The expression for the hybrid computation method based on the Green-Gauss method and weighted least squares is as follows: ; In the formula, For the grid center gradient, These are weighting coefficients. The gradient of the first grid center is the gradient value calculated using the weighted least squares method. This is the gradient of the second grid center, which is the gradient value calculated using the Green-Gauss method.
9. A gradient numerical calculation system based on mesh adaptation and a hybrid strategy, characterized in that, The system includes: The acquisition unit is used to obtain all grid information within the region to be calculated based on the divided grid file. A grid location identification unit is used to identify grid locations based on all grid information. The mesh identification and calculation unit is used to determine whether a mesh belongs to an internal mesh based on its identified mesh location. If it does not belong to an internal mesh, i.e., it belongs to a boundary layer mesh, the mesh center gradient is calculated based on the Green-Gauss method to obtain the mesh center gradient. If it belongs to an internal mesh, the mesh distortion of all internal meshes is calculated based on different types of mesh element mesh distortion calculation methods. Weighting coefficients are calculated based on the mesh distortion. And different mesh center gradient calculation methods are used to calculate the mesh center gradient based on different weighting coefficients. The gradient value calculation unit is used to calculate the gradient value of the interface based on the grid center gradient of adjacent grid cells.
10. The gradient numerical calculation system based on mesh adaptation and hybrid strategy according to claim 9, characterized in that, Based on the mesh distortion, the weighting coefficients are calculated, including: If it is a boundary layer mesh, the weighting factor is 1; If it is an internal mesh, and the mesh distortion is greater than the second boundary value and less than or equal to 1, then the weighting factor is 1; If it is an internal mesh, and the mesh distortion is greater than or equal to 0 and less than the first boundary value, then the weighting coefficient is 0; If it is an internal mesh, and the mesh distortion is greater than or equal to a first boundary value and less than or equal to a second boundary value, then the weighting coefficient is the ratio of the first difference to the second difference, where the first difference is the difference between the mesh distortion and the first boundary value; and the second difference is the difference between the second boundary value and the first boundary value.
11. The gradient numerical calculation system based on mesh adaptation and hybrid strategy according to claim 9, characterized in that, The grid center gradient is calculated using different methods based on different weighting coefficients, including: If the weighting coefficient is 1, the grid center gradient is calculated based on the Green-Gauss method; If the weighting coefficient is 0, the grid center gradient is calculated based on the weighted least squares method; If the weighting coefficient is greater than 0 and less than 1, the grid center gradient is calculated using a hybrid calculation method based on the Green-Gauss method and the weighted least squares method.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the gradient numerical calculation method based on grid adaptation and hybrid strategy as described in any one of claims 1 to 8.
13. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the gradient numerical calculation method based on mesh adaptation and hybrid strategy as described in any one of claims 1 to 8.