A grid encryption method, computer device, storage medium and program product
By introducing body and surface element error indexes for local grid encryption in high-frequency electromagnetic field calculation, the problems of accuracy and resource consumption in S parameter calculation are solved, and the simulation accuracy and efficiency of structures such as transmission lines and printed circuit boards are improved.
Patent Information
- Application Number
- CN202510542198.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-28
AI Technical Summary
In the prior art, in high-frequency electromagnetic field calculations, especially microwave communications, antenna designs and radio frequency circuits, high-precision calculations of S parameters face challenges of geometric complexity, frequency dependence and unevenness of error distribution, resulting in high computing resource consumption and insufficient accuracy.
By introducing bulk element error index and surface element error index, local encryption is identified and the grid area with the greatest impact on S parameters is used for local encryption. The 0-order vector finite element basis function is used to construct a finite element matrix and perform local grid encryption, improving calculation accuracy and reducing resource consumption.
The S-parameter calculation accuracy of complex structures such as transmission lines, vias and printed circuit boards has been significantly improved, the computing resource consumption has been reduced, and more efficient finite element electromagnetic simulation calculation has been achieved.
Smart Images

Figure CN120068782B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of grid encryption, and particularly to a grid encryption method, a computer device, a storage medium, and a program product. Background Art
[0002] High-frequency electromagnetic field problems are widely applied in fields such as microwave communication, antenna design, and radio frequency circuits. In these problems, the S-parameter is a key index for evaluating the system performance, which is used to reflect the transmission, reflection, and coupling characteristics of electromagnetic waves. However, the high-precision calculation of S-parameters poses the following challenges to the finite element numerical method: geometric complexity, the calculation of high-frequency electromagnetic fields involves complex geometric shapes and boundary conditions, such as sharp corner features, multi-layer interfaces, or small-size structures in microwave devices; frequency dependence, the propagation of high-frequency electromagnetic waves has a shorter wavelength, which poses higher requirements for the resolution of the grid; non-uniformity of error distribution, the electromagnetic field errors are concentrated in sharp corners, current concentration regions, or dielectric interfaces, while the errors may be smaller in other regions. Therefore, there is an urgent need for a grid encryption method that can improve the calculation accuracy of S-parameters for complex structures such as transmission lines, vias, and PCBs in three-dimensional electromagnetic finite element simulations, optimize computing resources, and reduce the computing cost. Summary of the Invention
[0003] The purpose of the present invention is to provide a grid encryption method, a computer device, a storage medium, and a program product. By introducing a volume element error index and a surface element error index, the grid regions that have the greatest impact on the S-parameter are identified and locally encrypted to accelerate convergence. Compared with the traditional global or local grid refinement methods, it can significantly reduce the consumption of computing resources and improve the solution accuracy of the target quantity, and is applicable to the finite element electromagnetic simulation calculations of complex structures such as transmission lines, vias, and printed circuit boards.
[0004] The technical solution provided by the present invention is as follows:
[0005] In the first aspect, the present application provides a grid encryption method, including the steps of:
[0006] Obtain the input initial grid, frequency, maximum number of iterations, and a preset S-parameter change threshold;
[0007] Read the initial grid and perform grid boundary recognition to obtain grid blocks with different material properties;
[0008] Construct a finite element matrix at a single frequency according to the grid blocks with different material properties;
[0009] Solve the finite element matrix to obtain the S-parameter matrix at the current iteration. When the number of iterations is greater than 1, calculate the current S-parameter change amount according to the S-parameter matrix obtained at the current iteration and the S-parameter matrix obtained at the previous iteration;
[0010] When the current S-parameter variation is greater than the preset S-parameter variation threshold, construct the mapping relationship between the four faces of each tetrahedron in the initial mesh and the adjacent tetrahedrons;
[0011] Calculate the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship;
[0012] Calculate the volume error of each tetrahedron according to the volume charge and the volume current density, calculate the surface error of each face of each tetrahedron according to the surface charge and the surface current density, and calculate the total error of each tetrahedron according to the volume error and the surface error of each tetrahedron;
[0013] Calibrate the tetrahedrons that need to be refined according to the total error of each tetrahedron;
[0014] Refine the tetrahedrons that need to be refined and update the initial mesh for the next iteration.
[0015] In one embodiment, the grid boundary recognition includes:
[0016] Based on the markings of different cells in the initial mesh, filter out the grid blocks with different material properties;
[0017] Judge the grid boundary of each piece of material according to the overlapping property of each triangular face in the tetrahedron of each grid block.
[0018] In one embodiment, the calculating the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship includes:
[0019] Calculate the physical property jump amount between each tetrahedron and the adjacent tetrahedrons on the common face according to the mapping relationship;
[0020] Obtain the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the physical property jump amount and the electric field vector of each tetrahedron.
[0021] In one embodiment, the calibrating the tetrahedrons that need to be refined according to the total error of each tetrahedron includes:
[0022] Store the total error of each tetrahedron and sort them in ascending order;
[0023] Successively filter out the tetrahedrons with larger total errors through a reverse iterator. When the total error of a tetrahedron is greater than the preset error value, mark the tetrahedron as the tetrahedron that needs to be refined.
[0024] In one embodiment, it further includes: when the number of tetrahedrons to be encrypted is greater than a preset percentage of the total number of tetrahedrons, the iteration is terminated.
[0025] In one embodiment, it further includes: when the number of iterations is less than the maximum number of iterations and the change amount of the current S parameter is less than the preset S parameter change threshold, it is determined that the grid reaches a converged state and the grid encryption is ended.
[0026] In one embodiment, the maximum number of iterations is 50, and the preset S parameter change threshold is 0.02.
[0027] In a second aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory, where the processor executes the computer program to implement the steps of the grid encryption method described in the first aspect.
[0028] In a third aspect, the present application provides a computer storage medium, on which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, the steps of the grid encryption method described in the first aspect are implemented.
[0029] In a fourth aspect, the present application provides a computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the grid encryption method described in the first aspect are implemented.
[0030] According to the grid encryption method, computer device, storage medium, and program product provided by the present invention, by introducing a volume element error index and a surface element error index, the grid region that has the greatest impact on the S parameter is identified and locally encrypted, accelerating convergence. Compared with traditional global or local grid refinement methods, it can significantly reduce the consumption of computing resources and improve the solution accuracy of the target quantity, and is applicable to finite element electromagnetic simulation calculations of complex structures such as transmission lines, vias, and printed circuit boards. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The following will further illustrate the above characteristics, technical features, advantages, and implementation manners of the present solution in a clear and understandable manner in combination with the drawings of the preferred embodiments.
[0032] Figure 1 is the overall flowchart of an embodiment of the present invention;
[0033] Figure 2 is the flowchart of an embodiment of the present invention;
[0034] Figure 3 is the cross-sectional structure of a PCB along the illustrated metal line and the schematic diagram of the air box calculation domain in an embodiment of the present invention;
[0035] Figure 4 It is a schematic diagram of the initial grid of an embodiment of the present invention;
[0036] Figure 5 It is a schematic diagram of the metal boundary of an embodiment of the present invention;
[0037] Figure 6 It is a schematic diagram of the tetrahedral mesh elements to be encrypted in an embodiment of the present invention;
[0038] Figure 7 It is a schematic diagram of the mesh distribution after encryption in an embodiment of the present invention;
[0039] Figure 8 It is a schematic diagram of the mesh distribution after convergence in an embodiment of the present invention;
[0040] Figure 9 It is a schematic diagram of the mesh distribution after convergence in the prior art of the present invention;
[0041] Figure 10 It is a schematic diagram of the convergence curve of the current S-parameter change amount during the encryption process in an embodiment of the present invention. Detailed implementation manners
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the specific implementation manners of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to these drawings, and other implementation manners can be obtained.
[0043] For the sake of simplicity of the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent their actual structures as products. In addition, for the sake of simplicity and easy understanding of the drawings, in some figures, components with the same structure or function are only schematically shown for one of them, or only one of them is marked. In this article, "one" not only means "only this one", but also can mean "more than one" situation.
[0044] Problems of high-frequency electromagnetic fields are widely applied in fields such as microwave communication, antenna design, and radio frequency circuits. In these problems, the S-parameter is a key index for evaluating the system performance, and is used to reflect the transmission, reflection, and coupling characteristics of electromagnetic waves. However, the high-precision calculation of the S-parameter poses the following challenges to the finite element numerical method: geometric complexity, the calculation of high-frequency electromagnetic fields involves complex geometric shapes and boundary conditions, such as sharp corner features, multi-layer interfaces, or small-size structures in microwave devices; frequency dependence, high-frequency electromagnetic wave propagation has a short wavelength, which poses higher requirements for the resolution of the mesh; non-uniformity of error distribution, electromagnetic field errors are concentrated in sharp corners, current concentration regions, or dielectric interfaces, while the errors may be smaller in other regions.
[0045] Traditional mesh refinement methods, including global refinement and empirical encryption strategies, have the following problems: Global refinement uniformly encrypts the entire computational domain, leading to a sharp increase in the number of meshes and inefficiency; Empirical encryption is a local encryption method based on geometric features, but it cannot effectively correlate with the target physical quantity and is difficult to significantly improve the S-parameter accuracy. Therefore, there is an urgent need for a mesh encryption method that can improve the S-parameter calculation accuracy of complex structures such as transmission lines, vias, and PCBs in three-dimensional electromagnetic finite element simulations, optimize computational resources, and reduce computational costs.
[0046] This solution proposes a target-oriented mesh encryption method based on S-parameters under the 0-order vector finite element basis function, which directly correlates the error estimation of S-parameters with the mesh encryption process to achieve higher accuracy and better computational efficiency. By introducing volume element error indicators and surface element error indicators, it identifies the mesh regions that have the greatest impact on S-parameters and locally encrypts them to accelerate convergence. Compared with traditional global or local mesh refinement methods, it can significantly reduce computational resource consumption and improve the solution accuracy of the target quantity, and is applicable to finite element electromagnetic simulation calculations of complex structures such as transmission lines, vias, and printed circuit boards. Below, this solution will be described in detail with reference to the accompanying drawings:
[0047] An embodiment of the present invention, as Figure 1 and Figure 2 shown, the present invention provides a mesh encryption method, including the steps:
[0048] S100. Obtain the input initial mesh, frequency, maximum number of iterations, and preset S-parameter change threshold;
[0049] S200. Read the initial mesh and perform mesh boundary identification to obtain mesh blocks with different material properties;
[0050] S300. Construct a finite element matrix at a single frequency according to the mesh blocks with different material properties;
[0051] S400. Solve the finite element matrix to obtain the S-parameter matrix at the current iteration. When the number of iterations is greater than 1, calculate the current S-parameter change amount based on the S-parameter matrix obtained at the current iteration and the S-parameter matrix obtained at the previous iteration;
[0052] S500. When the current S-parameter change amount is greater than the preset S-parameter change threshold, construct the mapping relationship between the four faces of each tetrahedron of the initial mesh and the adjacent tetrahedrons;
[0053] S600. Calculate the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship;
[0054] S700. Calculate the volume error of each tetrahedron based on the volume charge and volume current density, calculate the surface error of each surface of each tetrahedron based on the surface charge and surface current density, and calculate the total error of each tetrahedron based on the volume error and surface error of each tetrahedron;
[0055] S800. Calibrate the tetrahedrons that need to be refined according to the total error of each tetrahedron;
[0056] S900. Refine the tetrahedrons that need to be refined and update the initial mesh for the next iteration.
[0057] In this solution, for the initial mesh to be refined, first, the mesh boundary is identified to determine the different material properties of each mesh. Then, a finite element matrix is constructed based on the different material properties of each mesh. The S-parameter matrix at this iteration can be calculated from the finite element matrix. When the change in the current S-parameters is greater than the preset S-parameter change threshold, that is, when the mesh has not converged, the mapping relationships between the four surfaces of each tetrahedron in the initial mesh and the adjacent tetrahedrons are constructed, and the volume charge, volume current density, surface charge, and surface current density of each tetrahedron are calculated. Thus, the volume error and surface error of each tetrahedron can be obtained. The tetrahedrons that need to be refined are determined and refined based on the volume error and surface error as the judgment criteria, which can identify the mesh regions that have the greatest impact on the S-parameters, thereby enabling accurate local refinement, facilitating the improvement of the calculation accuracy, and significantly reducing the consumption of computing resources. It is applicable to the finite element electromagnetic simulation calculations of complex structures such as transmission lines, vias, and printed circuit boards.
[0058] In one embodiment, for a Figure 3 PCB board as shown, its initial mesh is as Figure 4 shown. The initial mesh can be input into the finite element solver in VTK text format. For Figure 4An example of an initial mesh is shown, where the VTK text format contains the coordinate information (X, Y, Z) of 4117 mesh nodes. Here, X, Y, and Z are the x, y, and z components of the coordinates respectively. For example, for the node numbered 0, the coordinate information is (0.088902, -0.002852, 1.98122). The VTK text format also contains information about 22697 mesh elements (N, N0, N1, N2, ...). Here, N is the number of mesh nodes contained in the element, and N0, N1, N2, ... are the numbers of each mesh node in the element. For example, the element numbered 0 is a triangular mesh element, and its mesh information is (3, 66, 150, 500). The element numbered 3730 is a tetrahedral mesh element, and its mesh information is (4, 38, 230, 88, 153). The VTK text format also contains the type numbers of 22697 mesh elements. For example, the triangular element number is 5, and the tetrahedral number is 10. At the same time, the VTK text format also contains 22697 mesh element tags, which are used for mesh boundary identification and material type definition.
[0059] The input information includes both frequency and adaptive encryption information. For example, in one embodiment, the input frequency is 10 GHz. The adaptive encryption information includes the maximum number of iterations for grid encryption to control adaptive encryption and the preset S-parameter change threshold (maximum ) refers to the change amount between the S-parameters obtained from two adjacent iterative calculations during the adaptive mesh generation process. In this embodiment, the maximum number of iterations is 50, and the preset S-parameter change threshold is 0.02. In other embodiments, it can be adjusted according to the calculation accuracy and requirements, and this application does not make any restrictions.
[0060] When reading the initial mesh, the VTK mesh file is read into the mesh data structure of the finite element solver, and different data structures are constructed according to the mesh element type to store the corresponding mesh data. For example, mesh nodes can be stored in the node data structure, which contains the number of the mesh node and its X, Y, Z coordinate components. For example, for node 0: [0, 0.088902, -0.002852, 1.98122]. Triangular elements are stored in the triangular data structure, which contains the number of the triangular element and its N0, N1, N2 mesh node numbers. For example, for triangular element 0: [0, 66, 150, 500]. Tetrahedral elements are stored in the tetrahedral data structure, which contains the number of the tetrahedral element and its N0, N1, N2, N3 mesh node numbers. For example, for the tetrahedral mesh element with mesh number 3730: [0, 38, 230, 88, 153]. Mesh tags are stored in the mesh tag container. For example, the calculation domain tags are all 1, and the corresponding material is vacuum.
[0061] In one embodiment, grid boundary recognition is performed to obtain grid blocks with different material properties, including: screening out grid blocks with different material properties based on the markings of different cells in the initial grid; and determining the grid boundary of each piece of material according to the overlapping properties of each triangular face in the tetrahedron of each grid block.
[0062] Based on the markings of different cells in the grid, grid blocks with different material properties can be screened out. According to the overlapping properties of each triangular face in the tetrahedron of each grid block, the grid boundary of each piece of material can be determined. For example, in a specific implementation, the grid marking of the metal wire is 9, as Figure 5 shown. The method for identifying the metal boundary is as follows: traverse all tetrahedral grid cells marked with 9, mark the overlap of the triangles within these tetrahedral cells, and if a triangle face does not overlap with other triangle faces, then this triangle face belongs to the boundary face.
[0063] According to the grid blocks with different material properties, a finite element matrix at a single frequency can be constructed. The expression of the finite element matrix is:
[0064] (1)
[0065] where is the relative magnetic permeability of the material, is the relative permittivity of the material, is the electric field vector, is the vector edge basis function of the grid cell. In this embodiment, a 0th-order edge basis function is adopted, and the expression is , is the volume coordinate or area coordinate of a point within the grid cell, is the edge length of the edge with starting point numbers i and j within the grid cell. At the same time, in formula (1): is the angular frequency, and its relationship with the frequency f is . In the example, the selected frequency is 10 GHz, and the calculated angular frequency is approximately ; , and in the example, the magnitude of this variable is approximately 209.5845, , are the vacuum permittivity and vacuum permeability respectively; j is the imaginary part symbol in the complex number, is the unit normal vector of the outer normal of the triangular face on the boundary.
[0066] The material properties adopted by the PCB structure in the example are specifically shown in the following table:
[0067]
[0068] By using 0-order vector basis functions, a system of linear equations in the form of AX = B can be constructed. In this example, both A and B are in the form of sparse matrices. Under the initial grid, the dimension of matrix A is (25140, 25140), and the dimension of matrix B is (25140, 3). The first column of matrix B stores the right-hand side terms under the excitation of the first port, the second column stores the right-hand side terms under the excitation of the second port, and the third column stores the right-hand side terms under the simultaneous excitation of both ports.
[0069] Taking the sparse matrices A and B as inputs, a direct sparse matrix solver is called to solve the system of linear equations AX = B. The S-parameter matrix [S] is solved according to formula (2).
[0070] (2)
[0071] where is a matrix with dimensions (p, p) from the (m - p)-th row to the p-th row and from the 0-th column to the p-th column of matrix X, and I is the identity matrix with dimensions (p, p). In this example, under the initial grid, m is 25140 and p is 2. In the first grid refinement iteration based on the initial grid, the initial value is null. In the case where the number of adaptive refinement iterations n is greater than 1, the calculation formula for the change in S-parameters is:
[0072] (3)
[0073] That is, the current S-parameter matrix is subtracted from the S-parameter matrix stored in the previous iteration, and then the absolute value of the maximum amplitude of the obtained new matrix is taken. For example, the calculation process of the change in S-parameters after the first grid refinement in adaptive refinement is:
[0074] That is, the value of the change in S-parameters obtained is 0.9039. The change curve under each grid refinement iteration is as Figure 10 shown.
[0075] When the number of iterations is less than the maximum number of iterations and the current change in S-parameters is less than the preset S-parameter change threshold, it is determined that the grid has reached the convergence state, and the grid refinement ends.
[0076] Specifically, the calculated current change in S-parameters is compared with the preset S-parameter change threshold input in step S100 (for example, the preset S-parameter change threshold is 0.02). If the current iteration step is less than the maximum iteration step (for example, the maximum iteration step is 50) and , then it is determined that in this iteration state, the grid has reached the convergence state; if not, it is determined that in this iteration state, the grid has not reached the convergence state. For example, in a specific implementation, the iteration step n after the grid reaches convergence is 13, and the current change in S-parameters is 0.0113; while when the number of iterations n after convergence is reached using a commercial software grid is 13, the current change in S parameter is 0.02, indicating that the calculation accuracy of the present application is higher.
[0077] In one embodiment, calculating the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship specifically includes: calculating the jump amount of physical properties between each tetrahedron and its adjacent tetrahedrons on the common surface according to the mapping relationship; calculating the volume charge, volume current density, surface charge, and surface current density of each tetrahedron based on the jump amount of physical properties and the electric field vector of each tetrahedron.
[0078] Specifically, in the error calculation of the tetrahedron, to calculate the charge and current density of the four faces of each tetrahedron unit, according to the error estimation theory, it is necessary to calculate the jump amount of physical properties between each tetrahedron and its adjacent tetrahedrons on the common surface. A mapping relationship between each face of each tetrahedron and its adjacent tetrahedrons can be constructed based on the following data structure.
[0080] [{ , }, { , }, { , }, { , }, Ne0],
[0081] [{ , }, { , }, { , }, { , }, Ne1], ...
[0083] In the above data structure, each row contains the face numbers of the four faces of a tetrahedron and the corresponding numbers of adjacent tetrahedron units, and then a global mapping is constructed in sequence according to the tetrahedron numbers. In addition, if several faces of a tetrahedron are located on the boundary, then the triangle on the boundary face of the tetrahedron has no adjacent tetrahedron. When filling the data structure, only the mapping data of the existing adjacent tetrahedrons needs to be filled.
[0084] For example, in the initial grid:
[0085] For the tetrahedron numbered 0, its mapping information is [{0, 8705}, {1, 2}, {2, 116}, {3, 1225}];
[0086] The tetrahedron numbered 1 has mapping information [{4, 3}, {5, 143}, {7, 130}], and there are only three faces of this tetrahedron with adjacent tetrahedrons.
[0087] Based on the finite element solution X, the electric field vector of each tetrahedron can be calculated , and the calculation formula is , that is: multiply the vector basis function of each edge corresponding to the centroid of each tetrahedron by the finite element solution corresponding to this edge, and the superposition is the vector electric field of this tetrahedron. Since the vector basis function used in this embodiment is a vector basis function, the divergence of the electric field is 0, and the volume charge of the corresponding tetrahedron is 0, and since the vector basis function used in this embodiment is of 0th order accuracy, its double curl is 0, and the volume charge , volume current density , surface charge , and surface current density calculation formulas are as follows respectively:
[0088] (4)
[0089] (5)
[0090] (6)
[0091] (7)
[0092] Among them, is the vacuum permittivity, and its numerical value is ; is the vacuum permeability, and its numerical value is ; is the relative permittivity of the material, such as the value in vacuum is 1; is the relative permeability of the material, such as the value in vacuum is 1; is the angular frequency, and its relationship with the frequency f is , in the example, the frequency is 10 GHz, and the calculated angular frequency is approximately ; , in the example, its magnitude is approximately 209.5845; j is the imaginary part symbol in complex numbers, is the unit normal vector of the outer normal of a certain triangular face in the tetrahedron.
[0093] For the calculation of the volume current density vector of the tetrahedron, only need to multiply the electric field vector corresponding to its centroid by the coefficient and its volume.
[0094] For the calculation of the surface charge of a face in a tetrahedron, in combination with the numbers of adjacent tetrahedrons corresponding to this triangular face, subtract the product of the electric field vector at the centroid of an adjacent tetrahedron and the relative permittivity from the product of the electric field vector at the centroid of this tetrahedron and the relative permittivity, and then multiply the calculated vector by the unit normal vector of this face and then by the area of the triangle.
[0095] For the calculation of the surface current density of a face in a tetrahedron, subtract the product of the curl of the electric field at the centroid of an adjacent tetrahedron and the reciprocal of the relative permeability from the product of the curl of the electric field at the centroid of this tetrahedron and the reciprocal of the relative permeability, and then multiply the calculated vector by the unit normal vector of this face and then by the area of the triangle and the coefficient in the formula.
[0096] The formula for calculating the volume error of each tetrahedron according to the volume charge and volume current density, the surface error of each face of each tetrahedron according to the surface charge and surface current density, and the total error of each tetrahedron according to the volume error and surface error of each tetrahedron is:
[0097] (8)
[0098] (9)
[0099] (10)
[0100] The total error of a tetrahedron consists of the volume error within the tetrahedron and the surface errors of its four faces. Its calculation formula is as shown in Formula 10, the calculation formula of the volume error is as shown in Formula 8, and the calculation formula of the surface error is as shown in Formula 9. In the above formulas is the radius of the circumscribed sphere of the tetrahedron, is the radius of the circumscribed circle of the triangular face, is the volume error of the adjacent tetrahedron of a certain face of the tetrahedron, is the surface error of a certain face of the tetrahedron. After calculating the error of the tetrahedron according to the above formula, the total error size of the tetrahedron and the tetrahedron number can be stored in the std::map in C++, in the form of std::map<double, int>, which is convenient for subsequently finding the corresponding tetrahedron mesh element according to the error size.
[0101] In one embodiment, the tetrahedrons that need to be refined are calibrated according to the total errors of each tetrahedron, including: storing the total errors of each tetrahedron and sorting them in ascending order; screening the tetrahedrons with larger total errors in turn through a reverse iterator. When the total error of a tetrahedron is greater than the preset error value, mark this tetrahedron as a tetrahedron that needs to be refined.
[0102] Preferably, when the number of tetrahedrons that need to be refined is greater than the preset percentage of the total number of tetrahedrons, the iteration is terminated.
[0103] Since the total error magnitude of each tetrahedral mesh element calculated by the steps shown in the above embodiments is stored in the form of std::map<double, int>, the sorting property of the map from small to large error is effectively utilized, and at the same time, the tetrahedron numbers corresponding to different errors are stored. Therefore, the tetrahedrons with larger errors can be screened out by using the reverse iterator of the map. When the total error of a certain tetrahedron is greater than the preset error value, the number of this tetrahedron is stored in std::vector, that is, this tetrahedron is marked as the tetrahedron to be refined. In addition, in order to ensure the calculation speed, the number of tetrahedrons to be refined is set not to exceed a preset percentage (such as 30%) of the total number of tetrahedrons in the whole. If it exceeds the constraint number, the iteration is terminated. Figure 6 It shows the tetrahedral mesh elements to be refined found in the first mesh refinement iteration in a specific implementation.
[0104] The mesh file to be refined and the container of the tetrahedron numbers to be refined are input into the mesh refinement solver, and the mesh is refined based on the constrained Delaunay algorithm for the mesh file. After refinement, the mesh is also output as a VTK text file for subsequent mesh reading and finite element calculation. Figure 7 It shows the mesh distribution after encryption by combining the information of the refined elements found in the first mesh refinement iteration with the mesh refinement algorithm in a specific implementation.
[0105] In the adaptive refinement loop, the above steps are repeated, and when the convergence criterion is met, the adaptive refinement is ended. For example, in the 13th iteration, =0.0113, which meets the convergence criterion, and the adaptive refinement is ended. After final convergence, the number of tetrahedral meshes is 145082, and the corresponding finite element matrix dimension is (185714, 185714). At the same number of iteration steps, the number of tetrahedral meshes after convergence of the commercial software is 172231, and the corresponding finite element matrix dimension is (215054, 215054). The mesh distribution after convergence in this example is as Figure 8 shown, and the mesh distribution after convergence of the commercial software is as Figure 9 shown. It can be found that the distribution of the mesh elements after convergence is basically the same, and the mesh density is relatively large mainly near the metal wire, which conforms to the physical law.
[0106] At the same time, the S-parameter matrix is also close to that of the commercial software, as shown in the following table,
[0107]
[0108] The convergence curve of the mesh during the adaptive refinement is as Figure 10As shown, the convergence trend is basically the same as that of commercial software. At the same time, the number of grids and the finite element matrix are reduced compared with commercial grids, achieving a significant reduction in computing resource consumption while improving the computing accuracy, and being applicable to the finite element electromagnetic simulation calculations of complex structures such as transmission lines, vias, and printed circuit boards.
[0109] In one embodiment, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of a grid encryption method in the foregoing embodiment.
[0110] In one embodiment, the present application provides a computer storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of a grid encryption method in the foregoing embodiment are implemented.
[0111] In one embodiment, the present application provides a computer program product, including a computer program or instruction. When the computer program or instruction is executed by a processor, the steps of a grid encryption method in the foregoing embodiment are implemented.
[0112] A grid encryption method of the present application can be implemented by program codes executable by a computing device. Thus, they can be stored in a storage device for execution by the computing device, or made into individual integrated circuit modules respectively, or multiple modules or steps among them can be made into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.
[0113] It should be noted that the above embodiments can be freely combined as needed. The above are only the preferred embodiments of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A grid encryption method, characterized in that, Including the steps: Obtain the input initial grid, frequency, maximum number of iterations, and preset S-parameter change threshold; Read the initial grid and perform grid boundary recognition to obtain grid blocks with different material properties; Construct a finite element matrix at a single frequency based on the grid blocks with different material properties; Solve the finite element matrix to obtain the S-parameter matrix at the current iteration. When the number of iterations is greater than 1, calculate the current S-parameter change amount based on the S-parameter matrix obtained at the current iteration and the S-parameter matrix obtained at the previous iteration; When the current S-parameter change amount is greater than the preset S-parameter change threshold, construct the mapping relationship between the four faces of each tetrahedron of the initial grid and adjacent tetrahedrons; Calculate the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship; Calculate the volume error of each tetrahedron according to the volume charge and the volume current density, calculate the surface error of each face of each tetrahedron according to the surface charge and the surface current density, and calculate the total error of each tetrahedron according to the volume error and the surface error of each tetrahedron; Calibrate the tetrahedrons that need to be refined according to the total error of each tetrahedron; Refine the tetrahedrons that need to be refined and update the initial grid for the next iteration.
2. The grid encryption method according to claim 1, characterized in that, The performing of grid boundary recognition includes: Based on the markings of different elements in the initial grid, filter out the grid blocks with different material properties; Judge the grid boundary of each piece of material according to the overlapping properties of the triangular faces in the tetrahedrons of each grid block.
3. A grid encryption method according to claim 1, characterized in that, The calculating of the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the mapping relationship includes: Calculate the physical property jump amount between each tetrahedron and adjacent tetrahedrons on the common face according to the mapping relationship; Calculate the volume charge, volume current density, surface charge, and surface current density of each tetrahedron according to the physical property jump amount and the electric field vector of each tetrahedron.
4. A grid encryption method according to claim 1, characterized in that The calibrating of the tetrahedrons that need to be refined according to the total error of each tetrahedron includes: Store the total error of each tetrahedron and sort them in ascending order; Successively filter out the tetrahedrons with larger total error through a reverse iterator. When the total error of a tetrahedron is greater than the preset error value, mark this tetrahedron as the tetrahedron that needs to be refined.
5. A grid encryption method according to claim 4, characterized in that It also includes: When the number of tetrahedrons that need to be refined is greater than the preset percentage of the total number of tetrahedrons, jump out of the iteration.
6. A grid encryption method according to claim 1, characterized in that It also includes: When the number of iterations is less than the maximum number of iterations and the current S-parameter change amount is less than the preset S-parameter change threshold, judge that the grid reaches the convergence state and end the grid refinement.
7. A grid encryption method according to claim 1, characterized in that The maximum number of iterations is 50, and the preset S-parameter change threshold is 0.
02.
8. A computer device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the steps of a grid refinement method according to any one of claims 1-7.
9. A computer storage medium having a computer program or instructions stored thereon, characterized in that, The computer program or instruction, when executed by the processor, implements the steps of a grid refinement method according to any one of claims 1-7.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instruction is executed by a processor, the steps of a grid encryption method according to any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Electromagnetic radiation simulation analysis method based on local grid adaptive subdivision
CN115329628A
Multi-physical-target-oriented electromagnetic field grid adaptive regulation and control optimization method in electromagnetic system
CN116151077A