Unstructured grid missing boundary surface supplementing method, device, equipment and medium
By constructing and using map function to process grid information files, the problem of missing boundary surfaces in grid files in CFD numerical simulation is solved, and the missing boundary surfaces are effectively supplemented, avoiding the time loss of redrawing the grid, and ensuring the accuracy and efficiency of the simulation.
Patent Information
- Application Number
- CN202510302361.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-03-14
AI Technical Summary
In CFD numerical simulation, the missing interface often occurs in the grid files generated by commercial software, which makes it impossible to determine the missing face boundary type and supplement the missing interface.
By reading the basic information in the grid file, constructing a structure that stores the surface unit information to define the first map function and the second map function, analyzing the composition information of the boundary surface to obtain target information, determining whether the body unit surface exists, updating the surface unit information, determining the number of missing boundary surfaces and adjacent surfaces, judging the missing boundary type according to the adjacent surface boundary type, and supplementing the missing faces.
It effectively supplements the missing boundary interface, avoids the time loss of redrawing the grid, and ensures the accuracy and efficiency of CFD numerical simulation.
Smart Images

Figure CN119808660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of grid data processing, and in particular to a method, device, equipment and medium for supplementing missing boundary surfaces of unstructured grids. Background Art
[0002] Unstructured grids have the advantages of high automation, short generation cycle, and flexible distribution control. They are often used to discretize the spatial regions of complex engineering shapes. They are widely used in computational fluid dynamics (CFD) of complex shapes. At present, unstructured linear units are used in most CFD numerical simulations. At present, the grid information storage file formats generated by commercial software are diverse. Taking CGN as an example, CGNS (CFD General Notation System, CGNS) format is a common format output by unstructured grid software. The CGNS format grid format contains the relationship between unit bodies and points, as well as the coordinate values of points, boundary surface information and other data. However, in actual use, some commercial software will have one or two boundary surfaces missing when generating grid files. At this time, the boundary type of the missing surface will not be known, and the missing boundary surface cannot be supplemented. Therefore, how to supplement the missing boundary surface is a problem that needs to be solved urgently. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for supplementing missing boundary surfaces of unstructured grids, which can supplement missing boundary surfaces and avoid the time loss of redrawing the grid. The specific scheme is as follows:
[0004] In a first aspect, the present application discloses a method for supplementing missing boundary surfaces of an unstructured grid, comprising:
[0005] Read the basic information in the grid file, define the first map function and the second map function by constructing a structure storing the surface unit information, and obtain the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of the composition points of the surface, the boundary surface type number, and the number of the points on the surface;
[0006] Inputting the target key value determined based on the target information into the first map function, parsing the composition information of the volume unit in the grid file, and judging whether each surface of the volume unit exists in the first map function based on the numbers of the points on each surface of the volume unit after the directional arrangement;
[0007] If it exists, update the information of each face unit, write the key-value pair determined based on the corresponding updated information of the subsequent unit into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function;
[0008] The boundary type of the missing boundary surface is determined according to the boundary type of the adjacent surface, the boundary type of the missing boundary surface and the key-value pair corresponding to the unit number are written into the second map function, and the missing boundary surface is supplemented based on all the surface unit information stored in the second map function.
[0009] Optionally, the first map function and the second map function are defined by constructing a structure storing the surface unit information, including:
[0010] Constructing a first structure for storing numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are numbers obtained by sorting the numbers of the points based on a preset size order;
[0011] Constructing a second structure for storing the surface unit number, the surface left unit number, the surface right unit number, the surface point number and the number of constituent points of the surface;
[0012] A first map function and a second map function are defined by respectively determining the first structure and the second structure as a key and a value.
[0013] Optionally, inputting the target key value determined based on the target information into the first map function includes:
[0014] Arrange the numbers of the points on the surface in descending order to obtain a number information array, and determine the number information array as a target key;
[0015] Determine the face unit number, the number of constituent points of the face, and the boundary face type number as target values;
[0016] A target key value determined based on the target key and the target value is input into the first map function.
[0017] Optionally, after judging whether each surface of the body unit exists in the first map function based on the obtained numbers of the points on each surface of the body unit after the directional arrangement, the method further includes:
[0018] If the face of the body unit does not exist in the map function, a first key-value pair is constructed based on the target information of the non-existent face, and the first key-value pair is written into the first map function.
[0019] Optionally, updating the information of each surface unit includes:
[0020] The order of the surface points of each surface unit and the information of the left and right surface units are updated.
[0021] Optionally, the determining the number of missing boundary surfaces and adjacent surfaces of the missing boundary surfaces based on the first map function and the second map function includes:
[0022] Determining the number of the missing boundary surfaces according to the length of the first map function;
[0023] Determine whether the face stored in the second map function is colinear with the missing boundary face, and determine the adjacent faces of the missing boundary face according to the corresponding determination result.
[0024] Optionally, the determining the boundary type of the missing boundary surface according to the boundary type of the adjacent surface includes:
[0025] Determining whether an adjacent surface of the missing boundary surface is missing;
[0026] If not missing, determine whether the boundary types of the adjacent faces are the same, and determine the first sindex value according to the corresponding determination result;
[0027] If the first sindex value is a preset first type value, the most common boundary type among the adjacent faces is determined as the boundary type of the missing boundary face;
[0028] If the first sindex value is a preset second type value, then the normal vector of each adjacent face is multiplied by the normal vector of the missing boundary face, and the boundary type of the adjacent face corresponding to the multiplication result of the maximum value among the corresponding multiplication results is determined as the boundary type of the missing boundary face;
[0029] If one adjacent face of the missing boundary face is missing, determining whether the boundary types of the adjacent faces are the same, and determining a second sindex value according to the corresponding determination result;
[0030] If the second sindex value is a preset third type value, the most common boundary type among the adjacent faces is determined as the boundary type of the missing boundary face;
[0031] If the second sindex value is the preset fourth category value, the normal vector of each adjacent face is multiplied with the normal vector of the missing boundary face, and the boundary type of the adjacent face corresponding to the multiplication result of the maximum value in the corresponding multiplication results is determined as the boundary type of the missing boundary face.
[0032] Optionally, the supplementing the missing boundary surface based on all the surface unit information stored in the second map function includes:
[0033] Constructing a surface information array using all the surface unit information stored in the second map function; the surface information array includes a relationship array between non-structural units and surface units, a relationship array between surface units and surface unit vertices, and an array of the number of points on the surface units;
[0034] The missing boundary surface is supplemented based on the surface information array.
[0035] In a second aspect, the present application discloses a device for supplementing missing boundary surfaces of an unstructured grid, comprising:
[0036] A target information acquisition module is used to read basic information in a grid file, define a first map function and a second map function by constructing a structure storing surface unit information, and acquire target information of a boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the number and coordinates of the point, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of the surface composition points, the boundary surface type number, and the number of the surface points;
[0037] A judgment module, used for inputting the target key value determined based on the target information into the first map function, parsing the composition information of the body unit in the grid file, and judging whether each surface of the body unit exists in the first map function based on the number of the points on each surface of the body unit after the directional arrangement;
[0038] an adjacent face determination module, configured to update the information of each face unit if it exists, write the key-value pair determined based on the corresponding updated information of the subsequent unit into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function;
[0039] A missing surface supplementation module is used to determine the boundary type of the missing boundary surface according to the boundary type of the adjacent surface, write the boundary type of the missing boundary surface and the key-value pair corresponding to the unit number into the second map function, and supplement the missing boundary surface based on all the surface unit information stored in the second map function.
[0040] In a third aspect, the present application discloses an electronic device, comprising:
[0041] Memory, used to store computer programs;
[0042] The processor is used to execute the computer program to implement the method for supplementing missing boundary surfaces of unstructured grids as described above.
[0043] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the method for supplementing missing boundary surfaces of an unstructured grid as described above is implemented.
[0044] When supplementing the missing boundary surface of an unstructured grid, the present application first reads the basic information in the grid file, defines the first map function and the second map function by constructing a structure storing the surface unit information, and obtains the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; the target key value determined based on the target information is input into the first map function, the composition information of the volume unit in the grid file is parsed, and the directional arrangement based on the obtained The numbers of the points on each surface of the body unit after the column are used to determine whether the surfaces of the body unit exist in the first map function; if so, the information of each surface unit is updated, and the key-value pairs determined based on the corresponding updated information of the subsequent units are written into the second map function, and the number of missing boundary surfaces and the adjacent surfaces of the missing boundary surfaces are determined based on the first map function and the second map function; the boundary type of the missing boundary surface is determined according to the boundary type of the adjacent surface, and the key-value pairs corresponding to the boundary type of the missing boundary surface and the unit number are written into the second map function, and the missing boundary surface is supplemented based on the information of all surface units stored in the second map function. It can be seen that the present application processes the grid information file through the map function. The position of the missing surface is determined by parsing the grid file information, and then the boundary type of the missing surface is determined by the adjacent boundary surface information of its surface unit, and then the obtained complete information of the missing surface is written into the parsed grid data array to complete the supplement of the missing boundary surface. This avoids the time loss of redrawing the grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0046] Figure 1 A flow chart of a method for supplementing missing boundary surfaces of unstructured grids disclosed in the present application;
[0047] Figure 2 A schematic diagram of a grid disclosed in this application;
[0048] Figure 3 A schematic diagram of a missing surface disclosed in this application;
[0049] Figure 4 A schematic diagram of adjacent surfaces disclosed in this application;
[0050] Figure 5 This is another adjacent surface schematic diagram disclosed in this application;
[0051] Figure 6 A schematic diagram of the structure of a device for supplementing missing boundary surfaces of an unstructured grid disclosed in the present application;
[0052] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] At present, the formats of mesh information storage files generated by commercial software are diverse. Taking CGN as an example, the CGNS (CFD General Notation System, CGNS) format is a commonly used format for the output of unstructured mesh software. The CGNS format of the mesh contains the relationship between the unit cell and the point, as well as the coordinate values of the points, boundary surface information and other data. However, in actual use, some commercial software will have one or two missing boundary surfaces when generating mesh files. At this time, the boundary type of the missing surface is unknown, and the missing boundary surface cannot be supplemented. In order to solve the above technical problems, the present application discloses a method, device, equipment and medium for supplementing missing boundary surfaces of unstructured meshes, which can supplement missing boundary surfaces and avoid the time loss of redrawing the mesh.
[0055] See also Figure 1 As shown, an embodiment of the present invention discloses a method for supplementing missing boundary surfaces of an unstructured grid, comprising:
[0056] Step S11, read the basic information in the grid file, define the first map function and the second map function by constructing a structure for storing surface unit information, and obtain the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the body unit type and composition information, point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of points on the surface.
[0057] In this embodiment, the present application first reads the basic information in the grid file, including data such as the type and composition information of the volume unit, the point number and coordinates, the type and composition information of the boundary surface, etc. Figure 2 As shown, the mesh is composed of hexahedral elements.
[0058] Then, a first structure is constructed to store the numbers of points on the face; wherein, the numbers of the points on the face stored in the first structure are the numbers after the numbers of each point are sorted based on the preset size order; a second structure is constructed to store the face unit number, the left side unit number of the face, the right side unit number of the face, the number of points on the face, and the number of points constituting the face; by respectively determining the first structure and the second structure as keys and values, the first map function and the second map function are defined. Specifically, a structure is constructed to store face unit information. The first structure FaceOrder is used to store the four point numbers on the face, and the values in the input array facenode[4] are compared in sequence to ensure their uniqueness; the second structure FaceInfor includes the face number face_id, the left side unit number f2cl of the face, the right side unit number f2cr of the face (when the face is a boundary face, the value is a negative number), the number of points on the face f2n_tmp[4], the number of points on the face nNPF, and other information. With these two structures as keys and values, the map function is defined.
[0059] In this embodiment, the boundary surface information in the grid file is processed, that is, the composition information of the boundary surface in the grid file is parsed, and its composition key-value pairs are written into the map function FacesInfor1. The boundary surface types include triangles and quadrilaterals. An array f2ntmp[4] is established to temporarily store the numbering information of the points on the surface, and the numbers face_id of the boundary surface units are arranged from zero. All units of the grid file are looped. According to the CGNS library function, it can be determined whether the current unit is a body unit or a face unit, and the body unit is skipped. When the current unit is determined to be a quadrilateral boundary surface unit, the point numbering information is stored in f2ntmp[4] according to the read information. When the current unit is determined to be a triangle boundary surface unit, the point numbering information is stored in f2ntmp[4] according to the read information, and f2ntmp[3] is set to -1. In other words, according to the CGNS library function, the following can be obtained: ① face unit number findex; ② number of constituent points of each face nodeofface; ③ boundary surface type number bct; ④ numbering information f2ntmp[4] of the points on the surface. When the current cell is determined to be a triangular boundary surface cell, since there are only three point numbers in f2ntmp, set f2ntmp[3] = -1. For the key in FacesInfor1, create a new f2ntmp_[4] array, use the ReorderPnts function to change the arrangement order of f2ntmp[4] to be arranged from large to small, and assign it to f2ntmp_[4], and set f2ntmp_[4] as a structure as the key (unique) of FacesInfor1.
[0060] For the value in FacesInfor1, assign nodeofface to face Infor.nNPF, assign the negative value of bct as the unit number on the left side of the face unit to face_infor.f2cl, use the ReorderPnts function to change the order of f2ntmp[4] so that the value with the smallest point number is in the first place, and then assign its value to face_Infor.f2n_tmp.
[0061] Take the storage information of a unit as an example:
[0062] IntType f2ntmp_[4];
[0063] Reorderpnts_(f2ntmp_,f2ntmp,4);
[0064] if (f2ntmp_[3]==-1) nodeofface=3;
[0065] else nodeofface =4;
[0066] face_Infor.face_id = findex;
[0067] face_Infor.f2cl = -bct[findex];
[0068] face_Infor.nNPF = nodeofface;
[0069] ReorderPnts(f2ntmp, nodeofface);
[0070] for (IntType ii = 0; ii < nodeofface; ii++)
[0071] {
[0072] face_Infor.f2n_tmp[ii] = f2ntmp[ii];
[0073] }
[0074] FaceOrder faceorder(f2ntmp_);
[0075] FacesInfor1.insert(std::make_pair(faceorder, face_Infor));
[0076] findex++;
[0077] Step S12, input the target key value determined based on the target information into the first map function, parse the composition information of the body unit in the grid file, and determine whether the surfaces of the body unit exist in the first map function based on the numbers of the points on each surface of the body unit after the directional arrangement.
[0078] In this embodiment, the numbers of the points on the surface are arranged in order from large to small to obtain a number information array, and the number information array is determined as the target key; the surface unit number, the number of points constituting the surface, and the boundary surface type number are determined as the target value; the target key value determined based on the target key and the target value is input into the first map function. Specifically, the numbers of the points on the surface are arranged in order from large to small to obtain a number information array, and the number information array is determined as the target key; the surface unit number, the number of points constituting the surface, and the boundary surface type number are determined as the target value. The target key value determined according to the target value and the target key is added to the structure FacesInfor1 through the insert function. Repeat the above process to complete the processing of all boundary surfaces and input them into the map function.
[0079] Then, process the volume unit face information in the mesh file. After the above steps, the boundary face units have been processed, and their face_id numbers are all placed in front. Now process the volume unit mesh. Non-structural volume units are generally divided into hexahedrons, triangular prisms, pyramids, and tetrahedrons. According to the vertex information, the volume units are divided into six faces, five faces, five faces, and four faces. Taking the hexahedron as an example, the CGNS library function can construct a C2N[cell][8] two-dimensional array. The first dimension is the hexahedral unit number, and the second dimension represents its 8 vertices. The order of the points is as follows: Figure 2 As shown in the hexahedron in , the point numbering information of the six faces can be constructed, and the array f2ntmp can be used to record the point numbering information of each face in turn:
[0080] f2ntmp[0] = C2N[cindex][0];
[0081] f2ntmp[1] = C2N[cindex][4];
[0082] f2ntmp[2] = C2N[cindex][7];
[0083] f2ntmp[3] = C2N[cindex][3];
[0084] Next, f2ntmp[4] is reordered, and the point numbers are arranged from large to small to obtain f2ntmp_[4]. The structure FaceOrder is used to construct a key with a unique value. Then, the search function of the map function is used to search FacesInfor1 to see if there is a key that is the same as f2ntmp_[4]. In other words, it is necessary to determine whether the faces of the body unit in the first map function exist based on the point numbers on the faces of the body unit after the directional arrangement.
[0085] Step S13: If it exists, update the information of each face unit, write the key-value pairs determined based on the corresponding updated information of the subsequent units into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function.
[0086] In this embodiment, if the face of the body unit does not exist in the map function, a first key-value pair is constructed based on the target information of the non-existent face, and the first key-value pair is written into the first map function. If it exists, the information of each face unit is updated to obtain each updated subsequent unit, that is, the order of the face points of each face unit and the information of the left and right face units are updated. Specifically, if the search in FacesInfor1 does not contain the same key as f2ntmp_[4], it means that the information of the face does not exist in FacesInfor1. At this time, the key-value pair is constructed and written into FacesInfor1 in the same way as in the above-mentioned step of obtaining the target information of the boundary face and determining the target key value based on the target information, where face_id starts from nBFace (the number of boundary faces) and f2cl starts from zero, which is the body unit number. If the search in FacesInfor1 contains the same key as f2ntmp_[4], it means that the information of the face already exists in FacesInfor1, and it also means that the left and right face units have been found. At this time, it is necessary to update the order of the face points and exchange the information of the left and right face units.
[0087] ReorderPnts(f2ntmp, nodeofface);
[0088] facetype = iter->second.f2cl;
[0089] face_Infor.f2cl = cindex;
[0090] face_Infor.f2cr = facetype;
[0091] face_Infor.nNPF = nodeofface;
[0092] face_Infor.face_id = iter->second.face_id;
[0093] for (IntType ii = 0; ii < nodeofface; ii++)
[0094] {
[0095] face_Infor.f2n_tmp[ii] = f2ntmp[ii];
[0096] };
[0097] And after updating the information, delete the key-value pair in FacesInfor1, and add the updated key-value pair in the second map function FacesInfor2;
[0098] FacesInfor1.erase(iter);
[0099] FacesInfor2.insert(std::make_pair(faceorder, face_Infor)).
[0100] In this embodiment, the loop is completed for the faces of all body units. Then, the number of missing boundary faces and the adjacent faces of the missing boundary faces can be determined based on the first map function and the second map function. In this process, the number of missing boundary faces is determined according to the length of the first map function; it is determined whether the face stored in the second map function is colinear with the missing boundary face, and the adjacent faces of the missing boundary face are determined according to the corresponding judgment result. Specifically, according to the above operation, if there is no missing boundary face in the grid file, all face units can find left and right units, the length of FacesInfor1 should become zero, and the length of FacesInfor2 should be the total number of faces nTFace; but when there is a missing boundary face, when looping over the boundary face, the faces that are not missing are written into FacesInfor2. In the loop over the body unit, the unit face that was originally at the boundary cannot confirm the right unit information and cannot be deleted. FacesInfor1 also records other unit information of these boundary faces. At this time, FacesInfor1.size() is the number of missing boundary faces nPFace, and FacesInfor2.size() is nTFace-nPFace. Figure 3 As shown, in this example, FacesInfor1.size()=2, and its position is found in the original grid through point unit composition, and the face numbers are 1344 and 1346. Then, according to FacesInfor1.size(), the number of missing boundary faces is known, and the number of face points of each face is known by FacesInfor1.nNPF, so the number of missing quadrilateral and triangular boundary faces can be known, and then:
[0101] nT_quad += nP_quad;
[0102] nT_tri += nP_ptri;
[0103] nTFace = (4 * nT_tet + 5 * nT_pyr + 5 * nT_pris + 6 * nT_hex + nT_tri+ nT_quad) / 2;
[0104] nBFace = nT_quad + nT_tri;
[0105] In this example, the actual number of boundary faces should be 2072, but because the information stored in CGNS is incorrect, only 2070 boundary faces are written. At this time, correct the number of faces stored in CGNS. Then find the adjacent faces of the missing face, and obtain the adjacent face point composition array arf2n[nNPF_fix][4] and the adjacent face boundary type array arfacetype[nNPF_fix], as well as the number of adjacent faces iaround. FacesInfor1 stores the information of the missing boundary faces, and FacesInfor2 stores the information of all faces except the missing boundary faces. Loop through them respectively, and determine whether they are colinear with the missing boundary faces to determine whether they are adjacent faces of the missing boundary faces. In this example, for the missing faces 1344 and 1346, they have 3 adjacent known faces, the symmetry face number is -1, the far field number is -2, the arfacetype[0-2] of the 1344 face is -1, and the arfacetype[0-2] of the 1346 face is -1, -2, -2 respectively.
[0106] Step S14: determine the boundary type of the missing boundary surface according to the boundary type of the adjacent surface, write the boundary type of the missing boundary surface and the key-value pair corresponding to the unit number into the second map function, and supplement the missing boundary surface based on all the surface unit information stored in the second map function.
[0107] In this embodiment, after determining the adjacent faces of the missing boundary face, the present application determines the boundary type of the missing boundary face according to the boundary type of the adjacent faces. In this process, it is first determined whether the adjacent faces of the missing boundary face are missing; if not, it is determined whether the boundary types of the adjacent faces are the same, and the first sindex value is determined according to the corresponding judgment result; if the first sindex value is a preset first-category value, the most common boundary type among the adjacent faces is determined as the boundary type of the missing boundary face; if the first sindex value is a preset second-category value, the normal vector of each adjacent face is multiplied with the normal vector of the missing boundary face, and the largest value among the corresponding multiplication results is used. The boundary type of the adjacent face corresponding to the multiplication result of the value is determined as the boundary type of the missing boundary face; if an adjacent face of the missing boundary face is missing, it is determined whether the boundary types of the adjacent faces are the same, and the second sindex value is determined according to the corresponding judgment result; if the second sindex value is the preset third type value, the boundary type with the most in the adjacent faces is determined as the boundary type of the missing boundary face; if the second sindex value is the preset fourth type value, the normal vector of each adjacent face is multiplied with the normal vector of the missing boundary face, and the boundary type of the adjacent face corresponding to the multiplication result of the maximum value in the corresponding multiplication results is determined as the boundary type of the missing boundary face. In layman's terms, when iaround = nNPF_fix[ipface], it means that all the adjacent faces of the missing face are there, for quadrilaterals, iaround=4, and for triangles, iaround=3. The repeated point marking method is used to determine the different situations of the boundary types of adjacent faces, and the sindex parameter is used to distinguish different situations. The specific method is: perform a double loop on adjacent faces to determine whether the boundary types of adjacent faces are the same. If they are the same, add 1. For example, if the missing boundary face is a quadrilateral, there are 4 adjacent boundary faces, and the four boundary face types are numbered 1, 1, 2, and 3, indicating that two of them have the same boundary face type, and the other two faces are of the other two types. In this case, sindex=2+2+1+1=6.
[0108] if (iaround == nNPF_fix[ipface]) / / indicates that all four adjacent faces are
[0109] {
[0110] for (IntType ii = 0; ii < iaround; ii++)
[0111] {
[0112] for (IntType jj = 0; jj < iaround; jj++)
[0113] {
[0114] if (arfacetype[ii] == arfacetype[jj])
[0115] {
[0116] ntimes[ii]++;
[0117] }
[0118] }
[0119] if (ntimes[ii] == 4) sindex += 4, pindex1 = arfacetype[ii];
[0120] if (ntimes[ii] == 3) sindex += 3, pindex1 = arfacetype[ii];
[0121] if (ntimes[ii] == 2);
[0122] {
[0123] sindex += 2;
[0124] if (nNPF_fix[ipface] == 3) {
[0125] pindex1 = arfacetype[ii];
[0126] }
[0127] }
[0128] if (ntimes[ii] == 1) sindex += 1;
[0129] }.
[0130] Specifically, sindex has 8 values representing different situations as shown in Table 1.
[0131] Table 1
[0132]
[0133] For the cases where sindex is equal to 16, 10, 9, 6, and 5, it can be determined that the boundary type of the missing face is the most common boundary type among the adjacent faces. For the cases where sindex is equal to 8, 4, and 3, it is judged by the normal vectors of the adjacent faces, and the normal vectors of the missing face and each adjacent face are calculated respectively. The normal vectors of the adjacent edges are multiplied with the normal vector of the missing face in turn, and the boundary type of the face with the largest value is used as the boundary type of the missing face.
[0134] When iaround = nNPF_fix[ipface]-1, it means that the missing face has an adjacent face that is also missing. For a quadrilateral, iaround=3, and for a triangle, iaround=2, which is the same as the previous method. Specifically, sindex has 8 values representing different situations as shown in Table 2.
[0135] Table 2
[0136]
[0137] For the case where sindex is equal to 9 and 4, it can be determined that the boundary type of the missing face is the most common boundary type among the adjacent faces. For the case where sindex is equal to 5, 3, and 2, it is judged by the normal vectors of the adjacent faces, and the normal vectors of the missing face and each adjacent face are calculated respectively. The normal vectors of the adjacent edges are multiplied with the normal vector of the missing face in turn, and the boundary type of the face with the largest value is used as the boundary type of the missing face.
[0138] In a specific embodiment, Figure 3 This is the case in Table 2. There is one missing adjacent face for each of the two missing faces. For the 1344 faces, Figure 4 As shown in the figure, since the boundary types of adjacent faces are all -1, sindex=9, and the boundary type of face 1344 is -1. For face 1346, Figure 5 As shown in the figure, the boundary type of adjacent faces ① and ③ is -2, and the boundary type of adjacent face ② is -1, so sindex=5. At this time, we can only judge by the size of the normal vector product, and we can get , then the boundary type of 1346 faces is -2.
[0139] Repeat the above steps to complete the processing of all missing boundary surfaces, and then write the updated missing boundary surface information (missing boundary surface boundary type, unit number) into FacesInfor2. Finally, use all the face unit information stored in FacesInfor2 to construct the face information array, including the relationship between non-structural units and unit faces f2c[2*nTFace], the relationship between unit faces and unit face vertices f2n[nnodes], the number of points on the face unit nNPF[nTFace] and other arrays to complete the mesh file parsing, and supplement the missing boundary surfaces based on the face information array. This can provide data input for subsequent mesh partitioning and flow field solution.
[0140] In summary, when supplementing the missing boundary surface of an unstructured grid, the present application first reads the basic information in the grid file, defines the first map function and the second map function by constructing a structure for storing the surface unit information, and obtains the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; the target key value determined based on the target information is input into the first map function, the composition information of the volume unit in the grid file is parsed, and the target key value is obtained based on the obtained target key value. The numbers of the points on each surface of the arranged body unit are used to determine whether the surfaces of the body unit exist in the first map function; if so, the information of each surface unit is updated, and the key-value pairs determined based on the corresponding updated information of the subsequent units are written into the second map function, and the number of missing boundary surfaces and the adjacent surfaces of the missing boundary surfaces are determined based on the first map function and the second map function; the boundary type of the missing boundary surface is determined according to the boundary type of the adjacent surface, and the key-value pairs corresponding to the boundary type of the missing boundary surface and the unit number are written into the second map function, and the missing boundary surface is supplemented based on all the surface unit information stored in the second map function. It can be seen that the present application processes the grid information file through the map function. The position of the missing surface is determined by parsing the grid file information, and then the boundary type of the missing surface is determined by the adjacent boundary surface information of its surface unit, and then the obtained complete information of the missing surface is written into the parsed grid data array to complete the supplement of the missing boundary surface. Thereby, the time loss of redrawing the grid is avoided.
[0141] Based on the above embodiment, it can be known that the present application discloses a method for supplementing missing boundary surfaces of unstructured grids, which can complete the supplementation of missing boundary surfaces. Next, the specific supplementation process will be described in detail.
[0142] In a specific embodiment, the CFD simulation configuration is a flat plate, the purpose is to test the high-precision calculation function of the flat plate turbulent boundary layer, the calculated Mach number is Ma=0.2, the calculated temperature T=288.15 K, the incoming flow Reynolds number per meter is 100000, the calculated incoming flow angle of attack and sideslip angle are both 0°, and the calculation grid is as follows: Figure 2 As shown, the grid is composed of unstructured hexahedral grid elements.
[0143] When supplementing the missing faces of the hexahedral mesh unit, first read the basic information in the mesh file. Through the CGNS library function, you can get the data in the CGNS format mesh file, including the unit type and composition information, point number and coordinates, boundary surface type and composition information, etc. Then build a structure to store the face unit information. The first structure FaceOrder is used to store the four point numbers on the face, and the second structure FaceInfor stores the face unit data. Two map functions FacesInfor1 and FacesInfor2 are defined with FaceOrder and FaceInfor as key-value pairs. Next, parse the boundary surface in the mesh to obtain the rearrangement number of the boundary surface, the right unit number, the constituent point number, the number of face points, etc., and input the point orientation arrangement of the surface and these values as key-value pairs into FacesInfor1. Then parse the unit surface in the mesh. Loop through all the faces that make up the volume unit, and determine whether the face already exists in FacesInfor1 by comparing the directional arrangement of the points that make up the face as the value of the key. If it already exists, update the face information, update the unit number on the left, write the key-value pair of the updated information into FacesInfor2, and delete it in FacesInfor1; if it does not exist, generate a key-value pair and input it into FacesInfor1. If there are missing boundary faces in the CGNS mesh file, the remaining length of FacesInfor1 is not zero, and its length is the number of missing faces, and the operation of supplementing the missing face unit information begins. Then, the sindex number is used to judge different situations, and different methods are used to obtain the boundary type of the missing boundary face according to different situations. The specific acquisition process is the same as the method in step S14, which will not be repeated here. After obtaining all the information of the missing face and reordering it, write its key-value pair into FacesInfor2, and use all the face unit information stored in FacesInfor2 to construct a face information array, so as to partition the mesh data obtained by parsing. The flow field solver uses the partitioned grid data to reconstruct the grid, calculate the unit center, volume and other data, and conduct CFD simulation to obtain the flow field characteristics of the flat plate boundary layer.
[0144] In this way, the present application achieves the supplementation of missing boundary surfaces, thereby avoiding the time loss of redrawing the grid.
[0145] See also Figure 6 As shown, an embodiment of the present invention discloses a device for supplementing missing boundary surfaces of unstructured grids, comprising:
[0146] The target information acquisition module 11 is used to read the basic information in the grid file, define the first map function and the second map function by constructing a structure storing the surface unit information, and obtain the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of the surface composition points, the boundary surface type number, and the number of the surface points;
[0147] A judgment module 12 is used to input the target key value determined based on the target information into the first map function, parse the composition information of the body unit in the grid file, and judge whether each surface of the body unit exists in the first map function based on the number of the points on each surface of the body unit after the directional arrangement.
[0148] The adjacent face determination module 13 is used to update the information of each face unit if it exists, write the key-value pair determined based on the corresponding updated information of the subsequent unit into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function;
[0149] The missing surface supplementation module 14 is used to determine the boundary type of the missing boundary surface according to the boundary type of the adjacent surface, write the key-value pair corresponding to the boundary type and unit number of the missing boundary surface into the second map function, and supplement the missing boundary surface based on all the surface unit information stored in the second map function.
[0150] When supplementing the missing boundary surface of an unstructured grid, the present application first reads the basic information in the grid file, defines the first map function and the second map function by constructing a structure storing the surface unit information, and obtains the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of constituent points of the surface, the boundary surface type number, and the number of the points on the surface; the target key value determined based on the target information is input into the first map function, the composition information of the volume unit in the grid file is parsed, and the directional arrangement based on the obtained The numbers of the points on each surface of the body unit after the column are used to determine whether the surfaces of the body unit exist in the first map function; if so, the information of each surface unit is updated, and the key-value pairs determined based on the corresponding updated information of the subsequent units are written into the second map function, and the number of missing boundary surfaces and the adjacent surfaces of the missing boundary surfaces are determined based on the first map function and the second map function; the boundary type of the missing boundary surface is determined according to the boundary type of the adjacent surface, and the key-value pairs corresponding to the boundary type of the missing boundary surface and the unit number are written into the second map function, and the missing boundary surface is supplemented based on the information of all surface units stored in the second map function. It can be seen that the present application processes the grid information file through the map function. The position of the missing surface is determined by parsing the grid file information, and then the boundary type of the missing surface is determined by the adjacent boundary surface information of its surface unit, and then the obtained complete information of the missing surface is written into the parsed grid data array to complete the supplement of the missing boundary surface. This avoids the time loss of redrawing the grid.
[0151] In some specific embodiments, the target information acquisition module 11 can be specifically used to construct a first structure for storing the numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are the numbers after sorting the numbers of each point based on a preset size order; construct a second structure for storing the surface unit number, the left unit number of the surface, the right unit number of the surface, the number of points on the surface, and the number of constituent points of the surface; and define a first map function and a second map function by respectively determining the first structure and the second structure as keys and values.
[0152] In some specific embodiments, the judgment module 12 can be specifically used to arrange the numbers of the points on the surface in order from large to small to obtain a number information array, and determine the number information array as the target key; determine the surface unit number, the number of constituent points of the surface, and the boundary surface type number as the target value; and input the target key value determined based on the target key and the target value into the first map function.
[0153] In some specific embodiments, the device can also be used to construct a first key-value pair based on the target information of the non-existent face if the face of the body unit does not exist in the map function, and write the first key-value pair into the first map function.
[0154] In some specific embodiments, the adjacent surface determination module 13 may be specifically used to update the order of the surface points of each surface unit and the information of the left and right surface units.
[0155] In some specific embodiments, the adjacent face determination module 13 can be specifically used to determine the number of the missing boundary faces according to the length of the first map function; determine whether the face stored in the second map function is colinear with the missing boundary face, and determine the adjacent faces of the missing boundary face according to the corresponding judgment result.
[0156] In some specific embodiments, the missing surface supplementation module 14 can be specifically used to determine whether the adjacent surface of the missing boundary surface is missing; if not, determine whether the boundary types of each adjacent surface are the same, and determine the first sindex value according to the corresponding judgment result; if the first sindex value is a preset first type value, the most common boundary type among the adjacent surfaces is determined as the boundary type of the missing boundary surface; if the first sindex value is a preset second type value, multiply the normal vector of each adjacent surface with the normal vector of the missing boundary surface, and the boundary type of the adjacent surface corresponding to the maximum value of the corresponding multiplication results is determined as the boundary type of the missing boundary surface. The type is determined to be the boundary type of the missing boundary surface; if an adjacent surface of the missing boundary surface is missing, whether the boundary types of each adjacent surface are the same is determined, and the second sindex value is determined according to the corresponding judgment result; if the second sindex value is a preset third category value, the most common boundary type among the adjacent surfaces is determined to be the boundary type of the missing boundary surface; if the second sindex value is a preset fourth category value, the normal vector of each adjacent surface is multiplied with the normal vector of the missing boundary surface, and the boundary type of the adjacent surface corresponding to the multiplication result of the maximum value in the corresponding multiplication results is determined as the boundary type of the missing boundary surface.
[0157] In some specific embodiments, the missing face supplementation module 14 can be specifically used to construct a face information array using all the face unit information stored in the second map function; the face information array includes a relationship array between non-structural units and face units, a relationship array between face units and face unit vertices, and an array of the number of points on the face units; and the missing boundary faces are supplemented based on the face information array.
[0158] Furthermore, the present application also discloses an electronic device. Figure 7This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0159] Figure 7 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the method for supplementing the missing boundary surface of an unstructured grid disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0160] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0161] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0162] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the unstructured grid missing boundary surface supplementation method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0163] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed method for supplementing missing boundary surfaces of unstructured grids is implemented. The specific steps of the method can be referred to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0164] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0165] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0166] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0167] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0168] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for supplementing missing boundary surfaces of unstructured grids, characterized in that: include: Read the basic information in the grid file, define the first map function and the second map function by constructing a structure storing the surface unit information, and obtain the target information of the boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the point number and coordinates, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of the composition points of the surface, the boundary surface type number, and the number of the points on the surface; Inputting the target key value determined based on the target information into the first map function, parsing the composition information of the volume unit in the grid file, and judging whether each surface of the volume unit exists in the first map function based on the numbers of the points on each surface of the volume unit after the directional arrangement; If it exists, update the information of each face unit, write the key-value pair determined based on the corresponding updated information of the subsequent unit into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function; The boundary type of the missing boundary surface is determined according to the boundary type of the adjacent surface, the boundary type of the missing boundary surface and the key-value pair corresponding to the unit number are written into the second map function, and the missing boundary surface is supplemented based on all the surface unit information stored in the second map function.
2. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: The structure of the storage surface unit information constructed to define the first map function and the second map function includes: Constructing a first structure for storing numbers of points on a surface; wherein the numbers of the points on the surface stored in the first structure are numbers obtained by sorting the numbers of the points based on a preset size order; Constructing a second structure for storing the surface unit number, the surface left unit number, the surface right unit number, the surface point number and the number of constituent points of the surface; A first map function and a second map function are defined by respectively determining the first structure and the second structure as a key and a value.
3. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: The step of inputting the target key value determined based on the target information into the first map function comprises: Arrange the numbers of the points on the surface in descending order to obtain a number information array, and determine the number information array as a target key; Determine the face unit number, the number of constituent points of the face, and the boundary face type number as target values; A target key value determined based on the target key and the target value is input into the first map function.
4. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: After judging whether each surface of the volume unit exists in the first map function based on the obtained numbers of the points on each surface of the volume unit after the directional arrangement, the method further includes: If the face of the body unit does not exist in the map function, a first key-value pair is constructed based on the target information of the non-existent face, and the first key-value pair is written into the first map function.
5. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: The updating of information of each surface unit includes: The order of the surface points of each surface unit and the information of the left and right surface units are updated.
6. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: The determining the number of missing boundary surfaces and adjacent surfaces of the missing boundary surfaces based on the first map function and the second map function includes: Determining the number of the missing boundary surfaces according to the length of the first map function; Determine whether the face stored in the second map function is colinear with the missing boundary face, and determine the adjacent faces of the missing boundary face according to the corresponding determination result.
7. The method for supplementing missing boundary surfaces of unstructured grids according to claim 1, characterized in that: The step of determining the boundary type of the missing boundary surface according to the boundary type of the adjacent surface includes: Determining whether an adjacent surface of the missing boundary surface is missing; If not missing, determine whether the boundary types of the adjacent faces are the same, and determine the first sindex value according to the corresponding determination result; If the first sindex value is a preset first type value, the most common boundary type among the adjacent faces is determined as the boundary type of the missing boundary face; If the first sindex value is a preset second type value, then the normal vector of each adjacent face is multiplied by the normal vector of the missing boundary face, and the boundary type of the adjacent face corresponding to the multiplication result of the maximum value among the corresponding multiplication results is determined as the boundary type of the missing boundary face; If one adjacent face of the missing boundary face is missing, determining whether the boundary types of the adjacent faces are the same, and determining a second sindex value according to the corresponding determination result; If the second sindex value is a preset third type value, the most common boundary type among the adjacent faces is determined as the boundary type of the missing boundary face; If the second sindex value is the preset fourth category value, the normal vector of each adjacent face is multiplied with the normal vector of the missing boundary face, and the boundary type of the adjacent face corresponding to the multiplication result of the maximum value in the corresponding multiplication results is determined as the boundary type of the missing boundary face.
8. The method for supplementing missing boundary surfaces of unstructured grids according to any one of claims 1 to 7, characterized in that: The step of supplementing the missing boundary surface based on all the surface unit information stored in the second map function includes: Constructing a surface information array using all the surface unit information stored in the second map function; the surface information array includes a relationship array between non-structural units and surface units, a relationship array between surface units and surface unit vertices, and an array of the number of points on the surface units; The missing boundary surface is supplemented based on the surface information array.
9. A device for supplementing missing boundary surfaces of unstructured grids, characterized in that: include: A target information acquisition module is used to read basic information in a grid file, define a first map function and a second map function by constructing a structure storing surface unit information, and acquire target information of a boundary surface by parsing the composition information of the boundary surface in the grid file; the basic information includes the type and composition information of the volume unit, the number and coordinates of the point, and the type and composition information of the boundary surface; the target information includes the surface unit number, the number of the surface composition points, the boundary surface type number, and the number of the surface points; A judgment module, used for inputting the target key value determined based on the target information into the first map function, parsing the composition information of the body unit in the grid file, and judging whether each surface of the body unit exists in the first map function based on the number of the points on each surface of the body unit after the directional arrangement; an adjacent face determination module, configured to update the information of each face unit if it exists, write the key-value pair determined based on the corresponding updated information of the subsequent unit into the second map function, and determine the number of missing boundary faces and the adjacent faces of the missing boundary faces based on the first map function and the second map function; A missing surface supplementation module is used to determine the boundary type of the missing boundary surface according to the boundary type of the adjacent surface, write the boundary type of the missing boundary surface and the key-value pair corresponding to the unit number into the second map function, and supplement the missing boundary surface based on all the surface unit information stored in the second map function.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the method for supplementing missing boundary surfaces of an unstructured grid as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the method for supplementing missing boundary surfaces of an unstructured grid as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Grid boundary condition processing method of unstructured grid CFD computation
CN105631068A
Space grid processing method and device, terminal equipment and storage medium
CN116432563A
Non-structural linear triangular prism grid unit reconstruction method, system, equipment and medium
CN116522828A