A method for HFSS mesh format conversion
By converting HFSS mesh data into a universal format, the difficulty of cross-platform verification is solved, enabling the circulation and reuse of mesh data and ensuring the consistency and reliability of simulation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA
- Filing Date
- 2026-03-05
- Publication Date
- 2026-06-09
AI Technical Summary
The HFSS mesh format cannot be directly read and used between different simulation software, which increases the difficulty of cross-platform verification and makes it impossible to realize the circulation and reuse of mesh simulation data.
A method is proposed to convert the mesh data generated by HFSS into a common standardized mesh file format. By identifying and filtering out metallic regions and retaining non-metallic regions, and by applying finite conductor boundary conditions to the metal-fitting surface, a computational domain mesh is generated, enabling cross-software simulation verification and result comparison.
This technology enables the reuse of HFSS mesh data across different simulation platforms, providing a reliable foundation for cross-platform simulation verification and result comparison, and ensuring the consistency and reliability of simulation results.
Smart Images

Figure CN122174550A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electromagnetic simulation design, specifically a method for HFSS mesh format conversion. Background Technology
[0002] Electromagnetic simulation, as a modern research method parallel to theoretical analysis and experimental measurement, has played an indispensable role in engineering design and scientific research. This method boasts significant advantages such as low cost, short cycle time, and easy parameter adjustment, which can greatly improve product development efficiency and performance optimization capabilities. It assists engineers in verifying the electromagnetic characteristics of a system under different operating conditions during the design phase, thereby ensuring key indicators such as electromagnetic compatibility and signal integrity.
[0003] In simulations based on mainstream numerical algorithms such as the finite element method and finite-difference time-domain (FDTD), the mesh plays a crucial role in discretizing the continuous physical model into a computer-solvable problem. As the carrier of numerical computation, the mesh quality not only directly determines the accuracy of the simulation results but also profoundly affects the computational efficiency and numerical convergence of the solution process. Therefore, comparing results using the same mesh across different commercial simulation software is an effective method for verifying simulation reliability when conducting simulation confidence assessments.
[0004] Mesh formats often differ across simulation software. Meshes exported by HFSS software are in their proprietary format and cannot be directly read and used by other simulation platforms. This limits the flow and reuse of mesh simulation data between different software programs. Computational models across different software programs cannot maintain mesh-level uniformity, and cross-platform result comparisons can only be performed based on different meshes. It is difficult to eliminate the influence of mesh factors on numerical results, increasing the difficulty of cross-platform verification. Summary of the Invention
[0005] To address the incompatibility issue of the HFSS mesh format with other simulation software, this invention proposes a method for HFSS mesh format conversion. This method accurately converts mesh data generated by HFSS software into a universal, standardized mesh file format, enabling the reuse of HFSS mesh data across different simulation platforms and providing a reliable foundation for cross-software simulation verification and result comparison.
[0006] A method for HFSS grid format conversion includes the following steps:
[0007] Step 1: Import the mesh data corresponding to the HFSS software project file of the target electromagnetic simulation into the Visual Studio development environment (the finite element mesh generated by HFSS is a tetrahedral mesh structure). Input the physical properties and constraint information defined in the project, including the material-model mapping relationship m_MaterialIndex and the boundary-model mapping relationship m_BoundaryIndex, as the complete input data source for subsequent mesh transformation and computational domain reconstruction.
[0008] Mesh data is stored in .ngmesh format and is associated with the unique identifier m_ID set by the volume and surface in the model. These mesh data are stored in different subfolders under the project results directory according to their type: the cmesh folder stores the final mesh data, and the imesh folder stores the initial mesh data.
[0009] `m_MaterialIndex` is an index container that uses the unique identifier `m_ID` corresponding to the model volume and the unique identifier `selfid` corresponding to the material as key-value pairs. To distinguish between metallic and non-metallic materials, the `selfid` of metallic materials has an additional specific numerical value `value`.
[0010] m_BoundaryIndex is an indexed container that stores key-value pairs of a unique identifier m_ID corresponding to a volume or surface of the model and a boundary condition value. If a boundary condition is applied to a volume of the model, the boundary value is incremented by a specific value for identification. For models made of metal, the volume identifier m_ID is also stored in this container as a key-value pair with the boundary value of the finite conductor plus the value.
[0011] Step 2: Create a string "unit" to store the mesh length unit. Create four containers: meshBody_, meshVertex_, meshFacet_, and meshRegion_ to store the corresponding model body information, mesh vertex information, face information, and volume mesh information, respectively. Read the mesh data and update the above parameters.
[0012] In HFSS mesh files, vertex coordinates are stored using the meter as the base unit in the International System of Units (SI), while the original design units associated with the model are recorded by a separate string variable.
[0013] `meshBody_` is an indexed container with the model body's unique identifier `m_ID` as the key and the HFSS model body structure as the value. The HFSS model body structure contains the following information: the model body's `m_ID`, the model name, whether it is a sheet body, the number of faces contained in the model body, and the `m_ID`s of those faces.
[0014] meshVertex_ is a dynamic array container that stores vertex information. The elements are vertex information structures. The vertex information structure contains the vertex ID and a three-dimensional coordinate array pt[3], which is used to store the X, Y, and Z coordinate values of the vertex.
[0015] `meshFacet_` is a dynamic array container that stores facet information. Each element is a facet information structure. The facet information structure contains the following information: facet ID (FacetID), whether it is planar, the number of triangular meshes on the facet, the number of model faces associated with the facet, a list of m_IDs for the associated model faces, triangular mesh information contained in the facet (face mesh ID (seid), the facet ID of the associated facet, and the vertex IDs of the three vertices), the m_ID of the model face corresponding to the facet, and the boundary values corresponding to the facet's boundary conditions.
[0016] `meshRegion_` is a dynamic array container that stores volume mesh information. Each element is a volume mesh information structure. The volume mesh information structure contains the following information: the RegionID of the volume mesh number, the m_ID of the corresponding model volume, and the VertexIDs of the four vertices.
[0017] Step 3: Based on the material information and meshRegion information in m_MaterialIndex, identify and filter out all metallic body meshes, retaining only non-metallic material regions for electromagnetic calculations. Simultaneously, extract the surface information (including vertex coordinates and boundary conditions) of the ideal conductor material model mesh and store it in backGroundFace, and the surface information computFace of the non-metallic material model mesh.
[0018] The electromagnetic computational domain mesh refers to a collection of regularly shaped and controllable-sized mesh cells that discretize the solution space of electromagnetic simulation. Due to the skin effect within metals and the absence of electromagnetic fields within ideal conductors, the algorithm marks mesh cells within metal regions as "field-free regions," eliminating the need to solve for their internal field values. However, the surface boundaries of the metal are the core carriers of electromagnetic constraints and must always participate in the solution process as part of the computational domain. Based on this characteristic, mesh cells within the metal regions are removed from the overall mesh. Finite conductor boundary conditions matching the metal properties are applied to the mesh surfaces that conform to the metal surface, and other boundary conditions are also applied to the mesh surfaces accordingly, thus obtaining the adjusted computational domain mesh.
[0019] The specific process for filtering out the metal part of the mesh is as follows:
[0020] Iterate through the volume meshes in `meshRegion_`, and based on the `m_ID` of the model volume associated with the volume mesh, query `m_MaterialIndex` to obtain the corresponding material identifier `selfid`. By checking the presence or absence of a specific value in `selfid`, identify whether the volume mesh is a metallic material. If it is a non-metallic material, store the volume mesh's RegionID and VertexID in `tempRegionID` and `tempNodeID` respectively, and extract all surface information of the volume mesh and store it in `computFace`. If it is an ideally conducting metallic material, store all its surface information in `backGroundFace`.
[0021] Step 4: Clean up the original vertex set meshVertex_ obtained in Step 2, remove isolated vertices that are not referenced by the retained volume mesh, generate the computational domain vertex set meshVertexCD_, complete the remapping of vertex indices, update the vertex connection relationships of the retained volume mesh, and finally generate the computational domain volume mesh information meshRegionCD_ containing effective volume mesh elements.
[0022] Step 5: Based on the information of m_BoundaryIndex, meshBody_, and meshFacet_, determine the final model face m_ID and boundary condition values corresponding to each facet. Combine the information in computFace and backgroundFace to correct and update the boundary condition values. Filter out faces that do not need to participate in the calculation, and combine the vertex information in meshVertexCD_ to generate the computational domain facet information meshFacetCD_.
[0023] The specific process of assigning and updating the final corresponding model face m_ID and boundary condition values in meshFacet_ is as follows:
[0024] Establish a mapping table `faceToBody_` between model faces and their associated model bodies using the information in `meshBody_`. Iterate through all faces in `meshFacet_`, retrieve the list of model face IDs associated with each face, and perform the following processing:
[0025] For background mesh faces with m_ID greater than 2000000000, set the boundary value of the face to -1.
[0026] For other model faces, query m_BoundaryIndex: if a boundary condition corresponding to m_ID is found, assign that boundary value; if not found, look up the model body to which the face belongs through the faceToBody_ mapping table. If the model body to which the face belongs has a boundary condition in m_BoundaryIndex, subtract a specific value from the corresponding boundary value and assign it to the face; otherwise, assign a boundary value of 0.
[0027] If a patch is associated with only one model face, then the face's m_ID and boundary value are set as the patch's final values. If a patch is associated with multiple model faces, then the patch's final corresponding m_ID and boundary value are determined according to the following priority: if there is a model face with an excitation boundary type, then the m_ID and boundary value of that excitation face are used; if there is no excitation face, then the m_ID and boundary value corresponding to the model face with the largest boundary value on the patch are selected as the final value of the current patch.
[0028] After completing the assignment, set the boundary value of the facet where all face meshes are not in the computFace to -1. Then, iterate through meshFacet_ again and set the boundary value of the facet with the current boundary value of 0 and at least one face mesh in the backGroundFace to the value corresponding to the boundary of the ideal conductor. This completes the assignment and update of the model face m_ID and boundary condition values in the facet.
[0029] Step 6: Based on meshVertexCD_ and unit information, create the point information required to output a general volume mesh format: number of points nodeCnt_ and point coordinates nodeCord_.
[0030] nodeCnt_ is the number of vertices in the container meshVertexCD_.
[0031] By traversing meshVertexCD_, the X, Y, and Z coordinate values of each vertex are extracted, and the units are converted according to the original design units stored in unit, finally obtaining the vertex coordinate array nodeCord_ represented by the original design units.
[0032] Step 7: Based on the information in m_MaterialIndex, meshFacetCD_, and meshRegionCD_, create the volume mesh data required to output the general volume mesh format: number of volume meshes tetraCnt_, volume mesh point sequence tetraNodeArray_, volume mesh surface boundary information tetraFaceBc_, number of boundaries bcCnt_, boundary value information used bcArray_, volume mesh material information tetraMaterial_, number of model materials materialCnt_, and material number information used materialArray_.
[0033] tetraCnt_ represents the number of volumetric meshes in meshRegionCD_.
[0034] Extract the four vertex IDs (VertexID) of each volume mesh in meshRegionCD_ and store them sequentially in tetraNodeArray_.
[0035] Iterate through meshFacetCD_ to obtain the face mesh information (including its three vertex numbers and corresponding boundary values) of each face and store it in boundaryFace; then, iterate through tetraNodeArray_, read it in groups of four vertex numbers, generate a tetrahedral cell for each group, and construct four outer surface meshes for each cell in sequence.
[0036] For each outer surface, check if there is a matching face mesh with the same vertex number in boundaryFace: if a match is found, record the boundary value of the matching face mesh; if no match is found, record the boundary value as 0.
[0037] The boundary values corresponding to the four outer surfaces are stored sequentially in tetraFaceBc_ according to the construction order, thus completing the recording of the surface boundary conditions of the volume mesh. At the same time, the non-repeating boundary values are stored in the boundary set bcSet, where bcCnt_ is the number of data stored in bcSet and bcArray_ is the array storing the boundary values in bcSet.
[0038] Iterate through meshRegionCD_ to obtain the m_ID of the model body associated with each volume mesh. Obtain the corresponding material identifier selfid by querying the m_MaterialIndex mapping table. Store the selfids in tetraMaterial_ in the order of the volume mesh. At the same time, store the unique selfids in the material set materialSet, where materialCnt_ is the number of data stored in materialSet and materialArray_ is the array that stores the material selfids in materialSet.
[0039] Step 8: Based on the meshFacetCD information, classify the nodes according to their positional relationship on the boundary into internal points, boundary face points, boundary edge points, and special boundary points. The classification results are stored in the dynamic array nodeType_.
[0040] The specific steps for classifying node types are as follows:
[0041] First, all nodes are initially set to internal points. Nodes located on any boundary surface of the computational domain are marked as boundary surface points. Boundary edges (edges that appear only once on all boundary surfaces) are identified, and nodes located on these edges are marked as boundary edge points. Further, the number of boundary edges associated with each node is checked. If a node is associated with more than two boundary edges, its type is changed to a special boundary node. Finally, boundary surfaces whose boundary type is an excitation port are specially processed: if no nodes on this surface have been marked as special boundaries, one boundary edge point on that surface is changed to a special boundary point.
[0042] Step 9: Based on the nodeCnt_, nodeCord_, tetraCnt_, tetraNodeArray_, tetraFaceBc_, bcCnt_, bcArray_, tetraMaterial_, materialCnt_, materialArray_, and nodeType_ information obtained in the above steps, output a general-format volumetric mesh .vtu file.
[0043] Furthermore, the specific process of vertex index remapping in step 4 is as follows:
[0044] The vertices in tempNodeID are renumbered, generating a mapping table tempNodeMap from the original vertex numbers to the new vertex numbers. Then, meshVertex_ is traversed, and according to the mapping table, the new number of each valid vertex (i.e., the vertex that exists in tempNodeMap) and its corresponding X, Y, Z coordinates are stored in the computational domain vertex set meshVertexCD_, completing the remapping of the computational domain vertices.
[0045] Furthermore, the specific process for generating the domain mesh information meshRegionCD in step 4 is as follows:
[0046] The RegionIDs in tempRegionID are renumbered to generate a mapping table tempRegionMap_ from the original volume mesh numbers to the new volume mesh numbers. Then, meshRegion_ is traversed, and the two mapping tables tempRegionMap and tempNodeMap are queried to select the volume mesh elements of non-metallic materials. The new volume mesh number, the associated model volume m_ID, and the new vertex numbers of the four vertices after remapping are stored in the computational domain volume mesh information meshRegionCD_, thus completing the generation and index update of the computational domain volume mesh.
[0047] Furthermore, the specific process for generating the domain patch information meshFacetCD_ in step 5 is as follows:
[0048] After correcting and updating the boundary condition values, traverse the meshFacet, select the face with a boundary value that is not -1 from all faces, combine it with the vertex information in meshVertexCD_, update the vertex number corresponding to each model face in the face, and store it in the computational domain face information meshFacetCD_, thus completing the generation of the computational domain face information meshFacetCD_.
[0049] In summary, this invention addresses the challenges of HFSS proprietary mesh data, such as its complex structure, closed format, and lack of public interfaces. It proposes a systematic analytical and reconstructive method that achieves complete extraction and accurate mapping of mesh topological relationships, material properties, and boundary features. While maintaining the geometric accuracy and topological consistency of the original mesh, it efficiently and accurately converts proprietary format data into a standardized, universal mesh format file. This effectively breaks down data barriers between different simulation software, constructing a unified data representation system that can be shared across solution platforms. This provides a unified and reliable mesh data foundation for cross-platform simulation verification, multi-tool result comparison, and multi-physics collaborative analysis. Attached Figure Description
[0050] Figure 1 This is a flowchart of the present invention;
[0051] Figure 2 This is a model diagram of an embodiment;
[0052] Figure 3 This is a comparison between the general mesh obtained from the example conversion and the mesh results from the commercial software HFSS;
[0053] Figure 4 This is a comparison chart of the results obtained from the example in the high-frequency electromagnetic simulation software and the results obtained in HFSS. Detailed Implementation
[0054] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.
[0055] A method for HFSS grid format conversion, see reference Figure 1 It includes the following steps:
[0056] Step 1: Import the mesh data corresponding to the HFSS 2020R1 software project file for the target electromagnetic simulation into the Visual Studio 2019 development environment. Input the physical properties and constraint information defined in the project, including these, as the complete input data source for subsequent mesh transformation and computational domain reconstruction. This embodiment takes the PIFA antenna simulation in HFSS 2020R1 as an example. Import the mesh data corresponding to the project file. The model structure is as follows: Figure 2 As shown.
[0057] Step 2: Create a string "unit" to store the mesh length unit. Create four containers: meshBody_, meshVertex_, meshFacet_, and meshRegion_ to store the corresponding model body information, mesh vertex information, face information, and volume mesh information, respectively. Read the mesh data and update the above parameters.
[0058] Step 3: Based on the material information and meshRegion information in m_MaterialIndex, identify and filter out all metallic body meshes, retaining only non-metallic material regions for electromagnetic calculations. Simultaneously, extract the surface information (including vertex coordinates and boundary conditions) of the ideal conductor material model mesh and store it in backGroundFace, and the surface information computFace of the non-metallic material model mesh.
[0059] The specific process for filtering out the metal part of the mesh is as follows:
[0060] Iterate through the volume meshes in `meshRegion_`, and based on the `m_ID` of the model volume associated with the volume mesh, query `m_MaterialIndex` to obtain the corresponding material identifier `selfid`. By checking the presence or absence of a specific value in `selfid`, identify whether the volume mesh is a metallic material. If it is a non-metallic material, store the volume mesh's RegionID and VertexID in `tempRegionID` and `tempNodeID` respectively, and extract all surface information of the volume mesh and store it in `computFace`. If it is an ideally conducting metallic material, store all its surface information in `backGroundFace`.
[0061] Step 4: Clean up the original vertex set meshVertex_ obtained in Step 2, remove isolated vertices that are not referenced by the retained volume mesh, generate the computational domain vertex set meshVertexCD_, complete the remapping of vertex indices, update the vertex connection relationships of the retained volume mesh, and finally generate the computational domain volume mesh information meshRegionCD_ containing effective volume mesh elements.
[0062] The specific process of vertex index remapping is as follows:
[0063] The vertices in tempNodeID are renumbered, generating a mapping table tempNodeMap from the original vertex numbers to the new vertex numbers. Then, meshVertex_ is traversed, and according to the mapping table, the new number of each valid vertex (i.e., the vertex that exists in tempNodeMap) and its corresponding X, Y, Z coordinates are stored in the computational domain vertex set meshVertexCD_, completing the remapping of the computational domain vertices.
[0064] The specific process for generating the computational domain volume mesh (meshRegionCD) is as follows:
[0065] The RegionIDs in tempRegionID are renumbered to generate a mapping table tempRegionMap_ from the original volume mesh numbers to the new volume mesh numbers. Then, meshRegion_ is traversed, and the two mapping tables tempRegionMap and tempNodeMap are queried to select the volume mesh elements of non-metallic materials. The new volume mesh number, the associated model volume m_ID, and the new vertex numbers of the four vertices after remapping are stored in the computational domain volume mesh information meshRegionCD_, thus completing the generation and index update of the computational domain volume mesh.
[0066] Step 5: Based on the information of m_BoundaryIndex, meshBody_, and meshFacet_, determine the final model face m_ID and boundary condition values corresponding to each facet. Combine the information in computFace and backgroundFace to correct and update the boundary condition values. Filter out faces that do not need to participate in the calculation, and combine the vertex information in meshVertexCD_ to generate the computational domain facet information meshFacetCD_.
[0067] The specific process of assigning and updating the final corresponding model face m_ID and boundary condition values in meshFacet_ is as follows:
[0068] Establish a mapping table `faceToBody_` between model faces and their associated model bodies using the information in `meshBody_`. Iterate through all faces in `meshFacet_`, retrieve the list of model face IDs associated with each face, and perform the following processing:
[0069] For background mesh faces with m_ID greater than 2000000000, set the boundary value of the face to -1.
[0070] For other model faces, query m_BoundaryIndex: if a boundary condition corresponding to m_ID is found, assign that boundary value; if not found, look up the model body to which the face belongs through the faceToBody_ mapping table. If the model body to which the face belongs has a boundary condition in m_BoundaryIndex, subtract a specific value from the corresponding boundary value and assign it to the face; otherwise, assign a boundary value of 0.
[0071] If a patch is associated with only one model face, then the face's m_ID and boundary value are set as the patch's final values. If a patch is associated with multiple model faces, then the patch's final corresponding m_ID and boundary value are determined according to the following priority: if there is a model face with an excitation boundary type, then the m_ID and boundary value of that excitation face are used; if there is no excitation face, then the m_ID and boundary value corresponding to the model face with the largest boundary value on the patch are selected as the final value of the current patch.
[0072] After completing the assignment, set the boundary value of the facet where all face meshes are not in the computFace to -1. Then, iterate through meshFacet_ again and set the boundary value of the facet with the current boundary value of 0 and at least one face mesh in the backGroundFace to the value corresponding to the boundary of the ideal conductor. This completes the assignment and update of the model face m_ID and boundary condition values in the facet.
[0073] The specific process of generating the computational domain patch meshFacetCD is as follows:
[0074] After correcting and updating the boundary condition values, traverse the meshFacet, select the face with a boundary value that is not -1 from all faces, combine it with the vertex information in meshVertexCD_, update the vertex number corresponding to each model face in the face, and store it in the computational domain face information meshFacetCD_, thus completing the generation of the computational domain face information meshFacetCD_.
[0075] Step 6: Based on meshVertexCD_ and unit information, create the point information required to output a general volume mesh format: number of points nodeCnt_ and point coordinates nodeCord_.
[0076] By traversing meshVertexCD_, the X, Y, and Z coordinate values of each vertex are extracted, and the units are converted according to the original design units stored in unit, finally obtaining the vertex coordinate array nodeCord_ represented by the original design units.
[0077] Step 7: Based on the information in m_MaterialIndex, meshFacetCD_, and meshRegionCD_, create the volume mesh data required to output the general volume mesh format: number of volume meshes tetraCnt_, volume mesh point sequence tetraNodeArray_, volume mesh surface boundary information tetraFaceBc_, number of boundaries bcCnt_, boundary value information used bcArray_, volume mesh material information tetraMaterial_, number of model materials materialCnt_, and material number information used materialArray_.
[0078] Extract the four vertex IDs (VertexID) of each volume mesh in meshRegionCD_ and store them sequentially in tetraNodeArray_.
[0079] The `meshFacetCD_` function iterates through each facet to obtain its mesh information (including its three vertex numbers and corresponding boundary values) and stores it in `boundaryFace`. Then, iterates through `tetraNodeArray_`, reading data in groups of four vertex numbers, generating a tetrahedral element for each group, and sequentially constructing four outer surface meshes for each element. For each outer surface, it searches `boundaryFace` for a matching facet mesh with the same vertex numbers: if a match is found, its boundary value is recorded; otherwise, a boundary value of 0 is recorded. The boundary values corresponding to the four outer surfaces are sequentially stored in `tetraFaceBc_` according to the construction order, completing the recording of the volume mesh surface boundary conditions. Simultaneously, unique boundary values are stored in a boundary set `bcSet`, where `bcCnt_` represents the number of data points stored in `bcSet`, and `bcArray_` is the array storing the boundary values in `bcSet`.
[0080] Iterate through meshRegionCD_ to obtain the m_ID of the model body associated with each volume mesh. Obtain the corresponding material identifier selfid by querying the m_MaterialIndex mapping table. Store the selfids in tetraMaterial_ in the order of the volume mesh. At the same time, store the unique selfids in the material set materialSet, where materialCnt_ is the number of data stored in materialSet and materialArray_ is the array that stores the material selfids in materialSet.
[0081] Step 8: Based on the meshFacetCD information, classify the nodes according to their positional relationship on the boundary into internal points, boundary face points, boundary edge points, and special boundary points. The classification results are stored in the dynamic array nodeType_.
[0082] The specific steps for classifying node types are as follows:
[0083] First, all nodes are initially set to internal points. Nodes located on any boundary surface of the computational domain are marked as boundary surface points. Boundary edges (edges that appear only once on all boundary surfaces) are identified, and nodes located on these edges are marked as boundary edge points. Further, the number of boundary edges associated with each node is checked. If a node is associated with more than two boundary edges, its type is changed to a special boundary node. Finally, boundary surfaces whose boundary type is an excitation port are specially processed: if no nodes on this surface have been marked as special boundaries, one boundary edge point on that surface is changed to a special boundary point.
[0084] Step 9: Based on the nodeCnt_, nodeCord_, tetraCnt_, tetraNodeArray_, tetraFaceBc_, bcCnt_, bcArray_, tetraMaterial_, materialCnt_, materialArray_, and nodeType_ information obtained in the above steps, output a general volumetric mesh format .vtu file. Compare the HFSS mesh with the converted mesh, for example... Figure 3 As shown.
[0085] By comparison Figure 3 It can be seen that the mesh file generated by this invention maintains a high degree of consistency with the original HFSS mesh, indicating that this conversion method has good fidelity in terms of geometric features and discretization accuracy. Furthermore, the converted mesh is imported into the high-frequency electromagnetic simulation software for solving, and the solution results are compared with the corresponding HFSS calculation results. For example... Figure 4 As shown, the results of the two methods are basically consistent, effectively verifying the computational reliability of the optical wave solver when using the same mesh, and providing strong evidence for evaluating its numerical accuracy and confidence level. Therefore, this invention solves the format barrier of HFSS meshes when used across platforms, constructs a reusable mesh pathway, and provides stable and reliable mesh data for result comparison, algorithm verification, and collaborative design between different simulation software, which has clear engineering value for promoting the verification of domestic simulation tools.
Claims
1. A method for HFSS grid format conversion, characterized in that, Includes the following steps: Step 1: Import the mesh data corresponding to the HFSS software project file of the target electromagnetic simulation into the Visual Studio development environment, and input the physical properties and constraint information defined in the project, including the material-model mapping relationship m_MaterialIndex and the boundary-model mapping relationship m_BoundaryIndex, as the complete input data source for subsequent mesh transformation and computational domain reconstruction. Mesh data is stored in .ngmesh format and is associated with the mesh data through the unique identifier m_ID set by the volume and surface in the model. Mesh data is stored in different subfolders under the project results directory according to its type: the cmesh folder stores the final mesh data and the imesh folder stores the initial mesh data. m_MaterialIndex is an index container with key-value pairs consisting of the unique identifier m_ID corresponding to the model body and the unique identifier selfid corresponding to the material. To distinguish between metallic and non-metallic materials, the selfid of metallic materials is augmented with a specific numerical value. m_BoundaryIndex is an index container that uses key-value pairs of a unique identifier m_ID corresponding to a volume or face of the model and boundary condition values. If boundary conditions are applied to the model body, the boundary values will be incremented by a specific value for identification; for models made of metal, the body identifier m_ID will also be stored as a key-value pair with the boundary values of the finite conductor and the result of incrementing the value. Step 2: Create a string "unit" to store the mesh length unit, and create four containers "meshBody_", "meshVertex_", "meshFacet_", and "meshRegion_" to store the corresponding model body information, mesh vertex information, face information, and volume mesh information, respectively. Read the mesh data and update the above parameters. In HFSS mesh files, vertex coordinates are stored using the meter as the base unit in the International System of Units (SI), while the original design units associated with the model are recorded by a separate string variable. `meshBody_` is an indexed container with the unique identifier `m_ID` of the model body as the key and the HFSS model body structure as the value. The HFSS model body structure contains the following information: the model body's `m_ID`, the model name, whether it is a sheet body, the number of faces contained in the model body, and the `m_ID` of these faces. meshVertex_ is a dynamic array container for storing vertex information. Its elements are vertex information structures. The vertex information structure contains the vertex ID and a three-dimensional coordinate array pt[3], which is used to store the X, Y, and Z coordinate values of the vertex. `meshFacet_` is a dynamic array container that stores facet information. Each element is a facet information structure. The facet information structure contains the following information: facet ID (FacetID), whether it is a plane, the number of triangular meshes on the facet, the number of model faces associated with the facet, a list of m_IDs of the associated model faces, triangular mesh information contained in the facet, the m_ID of the model face corresponding to the facet, and the boundary values corresponding to the facet's boundary conditions. The triangular mesh information includes the facet ID (seid), the facet ID of the facet to which it belongs, and the VertexIDs of its three vertices. meshRegion_ is a dynamic array container that stores volume mesh information. Each element is a volume mesh information structure. The volume mesh information structure contains the following information: RegionID of the volume mesh number, m_ID of the corresponding model body, and VertexID of the four vertices. Step 3: Based on the material information and meshRegion information in m_MaterialIndex, identify and filter out all metallic body meshes, retaining only non-metallic material regions for electromagnetic calculations; at the same time, extract the surface information of the ideal conductor material model body mesh and store it in backGroundFace, and the surface information computFace of the non-metallic material model body mesh. The surface information includes the coordinates of the three vertices and the boundary conditions. The specific process for filtering out the metal part of the mesh is as follows: Traverse the volume mesh in meshRegion_, and query m_MaterialIndex to obtain the corresponding material identifier selfid based on the m_ID of the model body associated with the volume mesh; by checking the presence or absence of a specific value in selfid, identify whether the volume mesh is a metallic material: if it is a non-metallic material, store the volume mesh's RegionID and VertexID in tempRegionID and tempNodeID respectively, and extract all surface information of the volume mesh and store it in computFace; if it is an ideal conductor metallic material, store all its surface information in backgroundFace; Step 4: Clean up the original vertex set meshVertex_ obtained in Step 2, remove isolated vertices that are not referenced by the retained volume mesh, generate the computational domain vertex set meshVertexCD_, complete the remapping of vertex indices, update the vertex connection relationships of the retained volume mesh, and finally generate the computational domain volume mesh information meshRegionCD_ containing effective volume mesh cells. Step 5: Based on the information of m_BoundaryIndex, meshBody_, and meshFacet_, determine the final model face m_ID and boundary condition value corresponding to each facet. Combine the information in computFace and backGroundFace to correct and update the boundary condition values. Filter out faces that do not need to participate in the calculation. Combine the vertex information in meshVertexCD_ to generate the computation domain facet information meshFacetCD_. The specific process of assigning and updating the final corresponding model face m_ID and boundary condition values in meshFacet_ is as follows: Establish a mapping table `faceToBody_` between model faces and their associated model bodies using the information in `meshBody_`. Iterate through all faces in `meshFacet_`, retrieve the list of model face IDs associated with each face, and perform the following processing: For background mesh faces with m_ID greater than 2000000000, set the boundary value of the face to -1; For other model faces, query m_BoundaryIndex: if a boundary condition corresponding to m_ID is found, assign that boundary value; if not found, search the model body to which the face belongs through the faceToBody_ mapping table. If the model body to which the face belongs has a boundary condition in m_BoundaryIndex, subtract a specific value from the corresponding boundary value and assign it to the face; otherwise, assign a boundary value of 0. If a patch is associated with only one model face, then the face's m_ID and boundary value are set as the final value of the patch. If a patch is associated with multiple model faces, then the final corresponding m_ID and boundary value of the patch are determined according to the following priority: if there is a model face with an excitation boundary type, then the m_ID and boundary value of that excitation face are used; if there is no excitation face, then the m_ID and boundary value corresponding to the model face with the largest boundary value on the patch are selected as the final value of the current patch. After completing the assignment, set the boundary value of the facet where all face meshes are not in the computFace to -1. Then iterate through meshFacet_ again and set the boundary value of the facet where the current boundary value is 0 and at least one face mesh is in the backGroundFace to the value corresponding to the ideal conductor boundary. This completes the assignment and update of the model face m_ID and boundary condition values in the facet. Step 6: Based on meshVertexCD_ and unit information, create the point information required to output a general volume mesh format: number of points nodeCnt_ and point coordinates nodeCord_; nodeCnt_ represents the number of vertices in the container meshVertexCD_; By traversing meshVertexCD_, the X, Y, and Z coordinate values of each vertex are extracted, and the units are converted according to the original design units stored in unit, finally obtaining the vertex coordinate array nodeCord_ represented by the original design units; Step 7: Based on the information in m_MaterialIndex, meshFacetCD_, and meshRegionCD_, create the volume mesh data required to output the general volume mesh format: number of volume meshes tetraCnt_, volume mesh point sequence tetraNodeArray_, volume mesh surface boundary information tetraFaceBc_, number of boundaries bcCnt_, boundary value information used bcArray_, volume mesh material information tetraMaterial_, number of model materials materialCnt_, and material number information used materialArray_; tetraCnt_ represents the number of volume meshes in meshRegionCD_; Extract the four vertex IDs (VertexID) of each volume mesh in meshRegionCD_ and store them sequentially into tetraNodeArray_; Iterate through meshFacetCD_ to obtain the face mesh information of each face and store it in boundaryFace. The face mesh information includes three vertex numbers and corresponding boundary values. Then, iterate through tetraNodeArray_, read it in groups of four vertex numbers, generate a tetrahedral cell for each group, and build four outer surface meshes for each cell in sequence. For each outer surface, check in boundaryFace whether there is a matching face mesh with the same vertex number: if the match is successful, record the boundary value of the matching face mesh; If no match is found, record the boundary value as 0; The boundary values corresponding to the four outer surfaces are stored sequentially in tetraFaceBc_ according to the construction order, thus completing the recording of the surface boundary conditions of the volume mesh; at the same time, the non-repeating boundary values are stored in the boundary set bcSet, bcCnt_ is the number of data stored in bcSet, and bcArray_ is the array storing the boundary values in bcSet. Iterate through meshRegionCD_ to obtain the m_ID of the model body associated with each volume mesh. Obtain the corresponding material identifier selfid by querying the m_MaterialIndex mapping table. Store the selfids in tetraMaterial_ in the order of the volume mesh. At the same time, store the unique selfids in the material set materialSet, where materialCnt_ is the number of data stored in materialSet and materialArray_ is the array that stores the material selfids in materialSet. Step 8: Based on the meshFacetCD information, classify the nodes according to their positional relationship on the boundary into internal points, boundary face points, boundary edge points, and special boundary points. The classification results are stored in the dynamic array nodeType_. The specific steps for classifying node types are as follows: First, all nodes are initially set to internal points. Nodes located on any computational domain boundary are marked as boundary point points. Boundary edges that appear only once on all boundary surfaces are identified, and nodes on these edges are marked as boundary edge points. Further, the number of boundary edges associated with each node is checked. If a node is associated with more than two boundary edges, its type is changed to a special boundary node. Finally, boundary surfaces whose boundary type is excitation port are specially processed: if no nodes on the surface have been marked as special boundaries, one boundary edge point on the surface is changed to a special boundary point. Step 9: Based on the nodeCnt_, nodeCord_, tetraCnt_, tetraNodeArray_, tetraFaceBc_, bcCnt_, bcArray_, tetraMaterial_, materialCnt_, materialArray_, and nodeType_ information obtained in the above steps, output a general-format volumetric mesh .vtu file.
2. The method for HFSS mesh format conversion as described in claim 1, characterized in that, The specific process of remapping vertex indices in step 4 is as follows: The vertices in tempNodeID are renumbered to generate a mapping table tempNodeMap from the original vertex numbers to the new vertex numbers. Then, meshVertex_ is traversed, and according to the mapping table, the new number of each vertex existing in tempNodeMap and its corresponding X, Y, Z coordinates are stored in the computational domain vertex set meshVertexCD_, thus completing the remapping of the computational domain vertices.
3. The method for HFSS mesh format conversion as described in claim 1, characterized in that, The specific process for generating the meshRegionCD in step 4 is as follows: The RegionIDs in tempRegionID are renumbered to generate a mapping table tempRegionMap_ from the original volume mesh number to the new volume mesh number. Then, meshRegion_ is traversed, and the two mapping tables tempRegionMap and tempNodeMap are queried to select the volume mesh elements of non-metallic materials. The new volume mesh number, the associated model volume m_ID, and the new vertex numbers of the four vertices after remapping are stored in the computational domain volume mesh information meshRegionCD_, thus completing the generation and index update of the computational domain volume mesh.
4. The method for HFSS mesh format conversion as described in claim 1, characterized in that, The specific process for generating the meshFacetCD_ domain patch information in step 5 is as follows: After correcting and updating the boundary condition values, traverse the meshFacet, select the face with a boundary value that is not -1 from all faces, combine it with the vertex information in meshVertexCD_, update the vertex number corresponding to each model face in the face, and store it in the computational domain face information meshFacetCD_, thus completing the generation of the computational domain face information meshFacetCD_.