Monday, July 27, 2026

The Mesh of Engineering Simulation 3: Element Quality

In simulation software such as Finite Element Analysis (FEA) tools, mesh quality is critical to the computation. High-quality elements improve computational speed, whereas low-quality elements compromise accuracy or may even terminate the computation. Common metrics for evaluating element quality include aspect ratio, Jacobian ratio, maximum corner angle, parallel deviation, skewness, characteristic length, orthogonal quality, and warping factor. This article discusses these common mesh (element) quality parameters from the perspectives of practical application and software development. Aspect Ratio The aspect ratio describes the elongation of an element. Defined as the ratio of the longest edge to the shortest edge, it indicates whether the element is excessively elongated. Elongated elements fail to accurately capture gradients along their short-edge direction, leading to significant errors in bending and boundary layer stress calculations. The ideal aspect ratio is 1, and higher values correspond to poorer element quality. Overall, aspect ratios are useful for checking meshes in boundary layers, thin-walled structures, and stretched regions. Press enter or click to view image in full size For general models, the overall aspect ratio should be less than 20; less than 10 in areas of stress concentration. When the aspect ratio exceeds 20, elements become severely stretched, resulting in poor FEA accuracy and convergence difficulties. In CFD boundary layer regions where the mesh is refined in the normal direction, aspect ratios between 30 and 100 are permissible. The numerical methods for calculating aspect ratios are straightforward. For triangles, the aspect ratio is the ratio of the longest edge to the diameter of the equivalent inscribed circle. For quadrilaterals, it is the ratio of the average lengths of the two pairs of opposite edges: max(L1, L2) / min(L1, L2). Tetrahedra are treated similarly to triangles, with the aspect ratio derived from the ratio of the circumscribed sphere radius (R) to the inscribed sphere radius (r). For hexahedra, the aspect ratio is the ratio of the maximum to the minimum length among the 12 edges. As these methods demonstrate, the aspect ratio is a purely geometric length-based calculation that does not utilize Gaussian points or Jacobian determinants. Jacobian Ratio The Jacobian ratio is the ratio of the minimum Jacobian determinant to the maximum Jacobian determinant within an element. The Jacobian uniformity metric reflects distortion gradients and measures how uniform the mapping is across the element. It is specifically designed to capture nodal distortion and local contraction or expansion in high-order elements, serving as a core quality control indicator for higher-order elements. The value ranges from -1 to 1. A ratio of 1 indicates a uniform, undistorted element, while values ​​closer to zero indicate significant distortion. The empirical standards are as follows: Jacobian Ratio | 0.3–1.0 | 0.1–0.3 | 0–0.1 | ≤ 0 Element Quality | High-quality element; stable solution | Distorted; reduced stress accuracy; prone to oscillation | Severely distorted; not recommended for high-precision calculations | Negative Jacobian / Degenerate; solver error There are two standards for calculating the Jacobian ratio that are based on Gaussian points and corner nodes, respectively. The Gaussian point method aligns with the integration locations of the solver’s stiffness matrix, making it a reliable mesh metric for the finite element method. The corner node method only checks geometric vertices; while computationally efficient, it may fail to detect cases where vertices are positive but integration points are negative, so it is typically used for a precursory geometric screening. Press enter or click to view image in full size For linear elements, the Jacobian determinant is constant throughout the element, so the Jacobian ratio remains 1; this fails to reflect the element’s quality. In this case, the element’s Jacobian determinant should be compared against that of an ideal element in order to yield a Jacobian ratio that is not always 1. Additionally, since the Jacobian determinant is constant within the element, the calculation only needs to be performed once per linear element, without iterating through all nodes or Gaussian points. For nonlinear elements, such as second-order elements with midside nodes or higher-order elements, shape functions are of higher degree. Consequently, the Jacobian matrix varies across different integration points within the element, requiring dynamic calculation by substituting coordinates at each integration point. Maximum Corner Angle The maximum corner angle is an intuitive metric for assessing element quality, capable of identifying elements with extremely obtuse angles or those that are nearly flat (degenerate). The maximum angle within the element is reported, typically in degrees. A larger value indicates more severe element distortion; values ​​closer to the ideal equiangular state are preferable. The optimal angle for a quadrilateral is 90° (a right angle) and a triangle is 60°. Angles exceeding 150° indicate a poor-quality element, and elements with angles exceeding 165° are not recommended for solver. Press enter or click to view image in full size Angles (measured in degrees) can be calculated using the formula: θ = arccos(u·v(|u|·|v|))·180/π, where u and v represent the vectors of the two sides forming the angle. For a triangular element, the angles θ0, θ1, and θ2 at the three vertices are calculated; the maximum value among them — max{θ0, θ1, θ2} — is defined as the maximum corner angle. Similarly, the maximum corner angle of a quadrilateral element is max{θ0, θ1, θ2, θ3}. Write on Medium For 3D elements, the maximum corner angle of the element is determined by identifying the maximum corner angle on each face and then comparing these values. For a tetrahedral element with four triangular faces (each with three interior angles), the maximum of all 12 interior angles is taken. A hexahedral element has six quadrilateral faces (each with four vertex angles), so all 24 angles are evaluated to obtain the maximum corner angle of the hexahedron. Skewness Skewness describes the tilt and distortion of an element, measuring the extent to which a quadrilateral or hexahedron deviates from a perfect rectangle or cube. It is a normalized, comprehensive metric that penalizes both excessively large and excessively small angles. As a key indicator of element quality for finite element solvers, it is one of the most commonly used general metrics. The value ranges from 0 to 1: a value of 0 indicates an ideal, orthogonal, and perfectly regular element, while a value of 1 indicates a completely skewed element unsuitable for finite element analysis. Generally, values ​​below 0.2 indicate high-quality elements; values ​​below 0.5 are acceptable. Values ​​above 0.8 indicate poor element quality, leading to reduced numerical accuracy, convergence difficulties in iterative calculations, and potential stress singularities. Press enter or click to view image in full size The general calculation method for skewness is as follows: S = max{ (θmax − θideal) / (180 − θideal), (θideal − θmin) / θideal } Here, θmax is the maximum corner angle, θmin is the minimum interior angle, and θideal is the ideal interior angle. The ideal internal angle for a triangle is 60° and for a quadrilateral is 90°; the ideal dihedral angle for a tetrahedron is approximately 70.5° and for a hexahedron is 90°. For 3D elements such as tetrahedra and hexahedra, skewness is calculated using the maximum or minimum dihedral angle. This method, also known as the equiangular method, supports all element types, including prisms and pyramids. For triangular and tetrahedral elements, skewness can also be calculated using the equi-volume method. The formula is: S = (V_ideal — V_actual) / V_ideal, where V_ideal is the volume of a standard equilateral element sharing the same circumsphere. For pyramid and wedge elements, equiangular skewness is calculated for all quadrilateral faces and equi-volume skewness for all triangular faces; the maximum value obtained is taken as the skewness. Element Quality Element quality is a comprehensive metric for evaluating mesh quality, with values ​​ranging from 0 to 1. A value of 1 represents a perfect square (2D) or a perfect cube (3D), while a value of 0 indicates zero volume or negative volume (indicating mesh distortion failure). Press enter or click to view image in full size The metric is determined as follows: For 2D quadrilateral or triangular elements, the calculation uses the ratio of the element area to the sum of the squares of the edge lengths: Q = C * (A / ΣL²). The area of ​​a triangular element can be obtained as half the magnitude of the vector cross product. Quadrilateral elements can be divided into two adjacent triangles to calculate their area. For 3D elements, the calculation uses the ratio of the element volume to the square root of the cube of the sum of the squares of the edge lengths: Q = C * (V / (ΣL²)^(3/2)). The volume of a 3D element can be obtained by calculating the determinant of the element’s Jacobian matrix. The value of constant C depends on the element type, as specified below: Element | Triangle | Quadrilateral | Tetrahedron | Hexahedron | Wedge | Pyramid Constant Value | 6.928 | 4.0 | 124.70 | 41.57 | 62.354 | 96 In element quality assessment, a quality value greater than 0.7 indicates an acceptable element. For elements in stress concentration zones, a value greater than 0.8 is desirable. Elements with values ​​below 0.05 are considered severely defective and must be repaired. Conclusion This article discusses the quality of common element types, as calculating and visualizing element quality is an essential feature of modern general-purpose finite element analysis software. These quality metrics are used not only for finite element meshing but also for interactive mesh inspection. By visualizing element quality via contour plots, users can quickly and intuitively assess mesh quality and decide whether to use the current mesh for subsequent calculations. Although this article does not discuss triangular prism elements or wedge elements in detail, their quality metrics are calculated similarly to those of tetrahedral and hexahedral elements and can be determined using the same methods. Other quality metrics — such as parallel deviation, orthogonal quality, and warping factor — are not addressed here.

Monday, July 20, 2026

工程仿真软件中的网格3:单元质量

有限元等仿真软件中网格的质量对于计算非常重要。高质量的单元可以提升计算速度,而低质量的单元会影响计算精度,甚至导致计算无法完成。常见的衡量单元质量的纲量有:纵横比,雅可比比值,最大内角,平行偏差,偏斜度,特征长度,正交质量,和翘曲因子等等。本文从实际应用与开发的角度,讨论常见的网格(单元)质量参数。 纵横比Aspect Ratio 纵横比描述单元的细长程度。用单元最长边/最短边的比值,表征单元是否过度细长;细长单元沿短边方向梯度捕捉会失效,使得弯曲、边界层应力误差巨大。理想值为1,数值越大表明单元质量越差。纵横比可以用于边界层、薄壁结构、拉伸网格的检查。 Image 对于通用的模型,整体的纵横比需要小于20,在应力集中区小于10。当纵横比大于20时,单元严重拉伸,有限元计算精度差、迭代难收敛。对于CFD中的边界层,法向加密区域允许 30~100的纵横比。 单元纵横比的数值方法直接。三角形通过计算最长边 / 等效内切圆直径的比值得到纵横比。四边形取两组对边平均长度比值max(L1, L2) / min(L1, L2)得到纵横比。四面体与三角形相似,基于内切球半径 r与外接球半径 R的比值得到纵横比。六面体取12条棱长度的最大 / 最小比值得到纵横比。通过计算方法可见,纵横比是一种纯几何长度计算,不使用高斯点、不使用雅可比。 雅可比比率Jacobian Ratio 雅可比比率是单元内最小与最大雅可比行列式的比值。雅可比变化的均匀性能反映扭曲梯度 ,可以衡量单元内部映射均匀性,专门捕捉高阶单元中节点扭曲、局部收缩膨胀,是二阶单元核心质控指标。值的范围是[-1, 1],比值为1时,表明单元均匀无扭曲;比值越接近零,单元扭曲大。经验标准如下: 雅可比比值 0.3~1.0 0.1~0.3 0 ~0.1 小于等于0 单元质量 优质单元,求解稳定 畸变,应力精度下降,易震荡 严重畸变,不建议用于高精度计算 负雅可比 / 退化,求解报错、发散 雅可比比率的计算有两套标准,分别基于高斯积分点和顶点节点。由于高斯点的计算方式匹配求解器刚度矩阵积分位置,是有限元方法中可靠的网格指标。顶点节点计算方式仅几何顶点校验,计算效率高,但可能会出现 “顶点全正、积分点负” 漏判,常用于快速几何筛查。 Image 对于线性单元,雅可比行列式在单元内部为常数,雅可比比率恒为1,无法表现出线性单元的质量,此时可以对比理想单元的雅可比行列式,得到非恒为1的雅可比比率。同时由于单元内部雅可比行列式恒定,每个线性单元只需计算1 次,无需遍历所有节点或高斯点。 对于非线性单元,如二阶偏置或高阶单元,其形函数是多次的,此时单元内不同积分点的雅可比矩阵是不同的,需要在每个积分点上动态代入坐标计算。 最大内角度 Max Corner Angle 最大内角是一种直观的衡量单元质量的纲量,可以识别钝角极大、近乎扁平退化的单元。常用角度值作为单位,输出单元内最大角度。此数值越大,单元畸变越严重;越接近理想等角越好。四边形最优角度是90°,即直角;三角形最优角度是 60°;超过 150° 为劣质单元。超过165度的单元不建议使用。 Image 角度制的内角可以通过以下公式计算:θ=arccos(u⋅v /∥u∥⋅∥v∥ )⋅180/ π ,u 和v表示内角两条边的向量。三角形单元3 顶点的角度求得θ0, θ1, θ2,取其最大值 max { θ0, θ1, θ2 },即为最大内角。同理,四边形单元的最大内角是max { θ0, θ1, θ2, θ3 }。 对于三维单元,取每一个面上的最大内角,再比较每个面上的最大内角得到单元最大内角。如四面体单元,4 个三角形面,每个面 3 个内角,取全部 12 个内角最大值。六面体有 6 个四边形面,每个面 4 个顶角,遍历所有24个面内角,即可得到该六面体的最大内角。 偏斜度 Skewness 偏斜度描述单元的倾斜扭曲,衡量四边形/六面体偏离矩形/立方体的程度。它是归一化的综合指标,同时惩罚过大角、过小角,是有限元求解器看重的单元质量,因此是最常用的通用单元指标之一。数值范围是[0, 1],0表示单元理想正交,是标准规整单元,1表示单元完全歪斜,无法用于有限元计算。通常情况下,小于0.2表示优质单元;小于0.5的单元都可接受;大于0.8表示单元质量差,数值精度下降,迭代计算难以收敛、可能会导致应力奇异。 Image 偏斜度的通用计算方法如下, S=max{ (θmax−θideal)/(180−θideal), (θideal−θmin)/θideal } 其中,θmax是最大内角,θmax是最小内角。θideal是理想内角。三角形理想内角为60°;四边形是90°;四面体的理想二面角约 70.5°,六面体理想二面角是90°。对于三维单元如四面体和六面体单元,使用的是二面角的最大或最小值来计算偏斜度。此方法也叫等角法,支持所有的单元类型,包括棱柱与金字塔单元。 对于三角形和四面体单元,我们还可以使用体积法来计算偏斜度。公式如下:S= (Videal – Vactual)/ Videal,理想体积Videal是同外接球等边标准单元体积。 对于金字塔和楔形单元,可以分别计算所有四边形面的等角偏斜度,和所有三角形面的等体积偏斜度,取最大值即得到偏斜度。 单元综合质量 单元质量是一项综合网格质量评判指标,数值范围为 0~1。数值为 1 代表完美正方形(二维)或完美正方体(三维);数值为 0 代表单元体积为零或出现负体积(网格畸变失效)。 Image 该指标的计算方式如下: 对于二维四边形 / 三角形单元,采用单元面积与各边长平方和的比值计算;Q = C* (A/∑L²)。三角形单元的面积可以通过向量叉乘模长的一半 得到。四边形单元可以划分为两个相邻的三角形单元,通过这个方法可以计算四边形单元的面积。 对于三维单元,则采用单元体积与各边长平方和立方的平方根的比值计算。Q = C (V/(∑L²)^1.5)。三维单元体积的可以通过计算单元的雅可比矩阵行列式实现。 常数C的大小取决于单元类型,具体数值如下: 单元 三角形 四边形 四面体 六面体 楔形 金字塔形 常数值 6.928 4.0 124.70 41.57 62.354 96 在单元质量评价中,质量值 >0.7为合格单元;应力集中区的单元值期望大于0.8。当单元值小于0.05时,存在严重坏单元,必须修复。 总结 本文讨论了常见单元类型的单元质量,计算并显示单元质量是现代通用有限元的一个必备功能。计算这些纲量不仅用于有限元网格划分,也用于网格的交互检查,云图显示单元质量,用户可以快速直观的了解网格的质量,并决定是否使用当前网格用于后续的计算。 本文未对三棱柱单元与楔形单元作详细讨论,但其单元质量的计算方式与四面体和六面体相似,可以用相同的方法计算得出。本文未对平行偏差,正交质量,翘曲因子等单元质量纲量做讨论。

Saturday, May 30, 2026

Mesh of Engineering Simulation 2: Element Size Control

Most modern engineering simulation software can perform complex meshing, making controlling mesh element size one of the most commonly used features in every operation. Categorized by specific geometric entities, common element size controls span across four levels: vertex, edge, face, and volume. A robust element size control feature helps users quickly obtain high-quality, optimized meshes, which benefits subsequent numerical computations. From a developer’s perspective, this article discusses the application and technical details on how to precisely control element size. Press enter or click to view image in full size Characteristic Length Characteristic length is the most critical numerical value in mesh generation. When performing finite element meshing on a geometric shape (such as a BRep entity imported from a STEP file), we always set one or more global characteristic lengths. The most ubiquitious characteristic length is the maximum element size, which limits the size of the elements to control mesh density. Of course, algorithmically, certain characteristic lengths are internally generated. Calculating based on the geometric body’s bounding box size or curve curvature, the algorithm compares characteristic lengths at each node location and chooses the minimum value. In practicality, due to the complexity of the geometry, users often need to manually refine the mesh at specific locations. This requires setting a local characteristic length for that area which maintains a higher priority than the global characteristic length, overriding it during the meshing process. Although the local locations chosen by users can be points, lines, or faces, these selected regions will all convert into Cartesian coordinates within the mesh space. When generating the mesh, the algorithm determines the final characteristic length size through evaluation and comparison of the current node’s position. Example Taking a 3D cube model as an example, select one of the six faces and set the maximum element size of the chosen face to 0.2. Press enter or click to view image in full size After meshing, we observe that the mesh density on and near the selected face is significantly higher than in other areas. Press enter or click to view image in full size In this example, only one face was selected, but if desired users can select multiple. If dealing with an assembly model, different faces across multiple bodies can be selected. Similarly, mesh refinement can be achieved by selecting a geometric edge. Press enter or click to view image in full size Alternatively, selecting a geometric vertex allows for local mesh refinement around that specific vertex. Press enter or click to view image in full size Conclusion The local density of a finite element mesh depends on the characteristic length of the local elements. When multiple characteristic lengths exist in the same region, the algorithm compares them to determine the minimum characteristic length to use for meshing. For common Delaunay or Advancing Front algorithms, the characteristic length is used to determine the position of the next adjacent mesh node. Because the selected geometric entities are all converted into Cartesian spatial coordinates, there is no difference at the algorithmic level whether the front-end GUI selects a geometric face, edge, or vertex: the characteristic length is always determined based on the spatial position of each node.

Thursday, May 28, 2026

工程仿真软件中的网格2:单元尺寸控制

现代工程仿真软件都可以进行复杂的网格划分,控制网格单元大小是所有复杂网格划分中最常用到的功能。按照指定几何实体来区分,常见的单元尺寸控制分别体现在几何点,几何边,几何面,和几何体四个层级。一个很好的单元尺寸控制功能,可以帮助使用者快速地得到高质量且优化的网格,有助于后续的数值计算。本文从开发者角度,讨论精确控制单元尺寸的应用与技术细节。 Image 特征长度 特征长度是网格划分中的最重要数值。在对几何体(如STEP文件导入生成的BRep实体)进行有限元网格划分时,我们都会设置一个或多个全局特征长度,最常见的特征长度就是最大单元尺寸,这个值限制了单元的大小,从而达到控制网格密度的效果。当然,算法上也可以根据几何体的Bounding Box大小或曲线曲率,内部生成一些特征长度,在每个节点位置比较这些特征长度并取最小值。 实际网格划分中,由于几何体的复杂性,需要人为对某一特定位置加密网格,这就需要对特定位置设定局部特征长度。而局部特征长度优先级会大于全局特征长度,覆盖全局特征长度,参与网格划分。虽然用户常选择的局部位置是点、线、面,而在网格空间,这些选择的区域都转化为笛卡尔坐标。生成网格时,算法会根据当前节点的位置,通过判定和比较,而决定最终的特称长度大小。 示例 以三维立方体模型为例,选择六个面中的一个,并设置所选面的最大单元尺寸为0.2。 Image 网格划分后,可以看到,在所选面及其附近,网格密度明显大于其他位置。 Image 本例只选择了一个面,用户也可以选择多个面,如果是装配体模型,可以选择多个体上的不同的面。同样的,如果选择一条几何边进行加密,也是可以实现。 Image 或者是选择一个几何节点,可以实现对局部节点的网格加密。 Image 总结 有限元网格的局部密度取决于局部单元的特征长度。当同一区域有多个特征长度时,算法上会比较得出最小的特征长度,用于网格划分。对于常见的Delaunay或者Advancing Front算法,特征长度会用于确定下一个相邻网格节点的位置。因为所选的几何实体都会转换为笛卡尔空间坐标,无论前端GUI选择的是几何面,边,还是点,算法层面都没有区别,都是根据每个节点的空间位置来确定特征长度。

Wednesday, May 20, 2026

The mesh of engineering simulation 1: data structures

Modern engineering simulation software is feature-rich. Being the first stage of any simulation pipeline, meshing plays a critical role across the entire software system. The functionality, stability, and efficiency of the meshing module directly impact the usability of the overall software, as meshing is intimately linked to computational functionality, 3D visualization, and human-computer interaction. This blog series will explore the meshing module in engineering simulation software from a developer’s perspective, covering mesh generation, algorithms, data structures, and specialized features. As the first article in the series, this piece discusses mesh data structures and their import/export operations. Press enter or click to view image in full size Data structures of finite element mesh Finite element software connects CAD software to solvers; it takes in geometric topology data from upstream CAD models and generates meshes for downstream solvers. Thus, finite element mesh data structure must bridge the gap between the two by incorporating information from both fields. On top of that, it must support 3D mesh visualization, requiring developers to meticulously develop the underlying data structures. The most common approach is to anchor the design in geometric topology, having each geometric entity contain its lower-level constituents along with the associated finite element node and element information. Press enter or click to view image in full size For example, a geometric model, named Model in the diagram above, might contain data blocks named Region, Face, Edge, and Vertex. This is essentially a simplified Boundary Representation (B-Rep) format — a method that represents solid objects using their boundaries (faces, edges, and vertices), allowing exact curved surfaces and precise topological geometry. Ranked from the highest to the lowest hierarchical level, the topology follows: Compound -> CompSolid -> Solid -> Shell -> Face -> Loop -> Wire -> Edge -> Vertex Become a Medium member This is the standard B-Rep data scheme used by most CAD engines. In this hierarchy: A Wire differs from an Edge in that a Wire possesses curvature. A Loop is a closed sequence of edges that forms the boundary of a Face. A Shell is a connected set of Faces. A CompSolid consists of multiple attached Solids, representing the data format for multi-body parts. Mesh generation requires the special handling of a CompSolid to ensure that the mesh aligns perfectly along embedded faces and embedded edges. (The details of B-Rep data will be discussed in depth in future). The mapping of individual data components is structured as follows: Region: Points to CompSolid and Solid geometries. It contains all geometric face information, all embedded geometric entities, and mesh volumetric element information. Face: Points to Face and Shell geometries. It contains all geometric edge information, the parent geometry it belongs to, embedded geometric entities, and mesh face element information (such as triangular, quadrilateral, and polygonal elements). Edge: Points to Wire and Edge geometries. It contains all geometric vertex information, the parent geometric faces, and the associated mesh line elements. Vertex: Points to Vertex geometries. It contains information about the associated geometric vertex, mesh nodes, and the parent geometric edges. This mapping approach enables rapid queries between mesh and geometry data — such as retrieving all surface elements or nodes on a specific geometric face — which is frequently needed when applying boundary conditions in finite element analysis. Geometry-to-Mesh Conversion There are two primary types of conversions from B-Rep to mesh data: Tessellation/Triangulation: Converts geometry into surface meshes purely for visualization purposes. Solid Meshing: Generates volumetric meshes used for both finite element computation and mesh visualization (e.g., using VTK’s unstructured grid data format). Modern finite element software should support both of these conversions, meanwhile reverse-engineering a mesh back into a B-Rep model is rarely implemented because it is nearly impossible to achieve flawlessly. Import and export of mesh data Mesh data involves heavy traffic. Beyond supporting their own proprietary mesh formats, modern simulation software must also support universal formats. For finite element, finite volume, and spectral element meshes, widely used formats include UNV, VTU (PVTU), GMSH, EXO, CGNS, MED, and INP, each offering unique advantages. Press enter or click to view image in full size Developers can directly leverage these formats or their corresponding SDKs to build core software data structures and handle mesh file I/O: UNV is a feature-rich and easy-to-use mesh format that supports a wide array of mesh elements. It allows the definition of group information (vital for boundary conditions) and supports both ASCII and Binary formats for read/write operations. VTU holds a natural advantage in graphical visualization. It’s backed by the entire open-source VTK source code and ecosystem, making it an excellent format for mesh data I/O. Currently, WELSIM primarily utilizes the UNV and VTU formats as its foundational mesh data structure, fully supporting data import and export for both. As simulation software scales with additional features, developers often need to incorporate supplementary data. This includes mapping relationships between CAD topology and the mesh, hierarchical relationships for remeshing, and mesh mapping between sub-models and global models. Because these datasets vary in size, they require a flexible, compressible data format — ideally the HDF5 file format. Upon completing a mesh generation, WELSIM produces a file named s2m.h5 to store the mapping relationships between the geometric topology and the mesh. Conclusion This article discussed the mesh data structures and I/O methodologies use in simulation software — establishing a proven framework for the meshing modules of general-purpose simulation platforms. It fulfills most functional requirements and adapts exceptionally well to advanced meshing features, like real-time simulation and parallel computing. Furthermore, other complex, specialized features can be successfully developed on top of this foundational data structure, such as boundary layer meshing and internal embedded surface meshing for multi-body parts.

Saturday, May 16, 2026

工程仿真软件中的网格1:数据结构

现代工程仿真软件的功能丰富,网格作为所有仿真计算的入口模块,在整个软件中占据着越来越重要的位置。网格模块的功能、稳定性与效率,直接影响到整个仿真软件的使用。网格直接关系到软件的计算功能,三维显示,人机交互等方面。本系列从开发者的角度探讨工程仿真软件中的网格模块,内容覆盖网格划分,算法,数据结构,特殊功能等。本文作为系列的第一篇文章,讨论网格的数据结构及其输入输出。 Image 有限元网格的数据结构 有限元软件向上承接CAD软件的几何拓扑数据,向下生成求解器支持的网格,因此有限元网格数据需要包含两者的信息,起到承上启下的作用。同时,还需要支持网格的三维显示,因此开发者必须要对数据结构进行精心地构架。最常见的方式,是以几何拓扑为出发点,每个几何体(entity)都包含下一级的几何体和相关的有限元节点与单元信息。 Image 如几何模型命名为Model,会包含名为Region,Face, Edge,和Vertex数据,这本质上是一种简化版的B-Rep格式,即用物体的边界(面/边/点)来表示实体,是精确的曲面与精确的拓扑数据几何。从层级由高到低分类, Compound → CompSolid → Solid → Shell → Face → Loop → Wire-> Edge → Vertex 这也是常见CAD引擎的B-Rep数据方式,其中Wire与Edge的区别是Wire会有曲率,Loop是闭合边序列,构成Face的边界。Shell是连通的Face集合。CompSolid是多个Solid粘连,是多体零件的数据形式。网格划分对于CompSolid要对做特殊处理,需要确保网格要沿着共享内表面和共享边划分。关于B-Rep数据的细节会在以后的文章中详细讨论。 Region数据指向的是CompSolid和Solid几何体,包含所有的几何面信息,内部的几何面,几何边,几何节点,和网格体单元信息。 Face数据指向的是Face和Shell几何体,包含所有几何边信息,所属的几何体,内部的几何边与几何节点信息,以及网格面单元信息,如三角单元,四边形单元,和多边形单元。 Edge数据指向的是Wire与Edge几何体,包含所有的几何节点信息,所属的几何面,所含有的网格线单元。 Vertex数据指向Vertex几何体,包含所属几何节点与网格节点信息,所属几何边的信息。 这样的数据映射方式,可以快速的查找网格与几何体数据,如获得某一个几何面上的网格面单元或节点,这在有限元计算的边界条件上经常用到。 B-Rep与网格的转换有两种,一种是通过tessellation/triangulation网格化/三角化转变为表面网格,用于显示几何体。另一种是实体网格,用于有限元计算和网格显示,如使用VTK的非结构网格数据。现代有限元软件,两种转换都是必备的。而逆向的网格转换为B-Rep几乎难以完美实现,因此很少应用。 网格数据的输入与输出 网格数据有大量的交互需求,现代仿真软件除了支持自有的网格格式外,还需要能够支持常见的通用格式。对于有限元(包含有限体积,谱单元)等类型的网格,常见的格式有UNV, VTU(PVTU), GMSH,EXO,CGNS, MED, INP等。这些格式都各有优点。 Image 开发者可以直接应用这些格式或开发包,来构建软件的核心数据结构和读写网格文件。UNV是一款功能丰富且易于使用的网格格式,支持大量的网格元素,如定义可以支持边界条件的组信息,读写都有ASCII与Binary两种格式支持。VTU在图形显示上有着天然的优势,有整个VTK开源代码与生态的支持,也是一款很好的网格数据读写格式。目前WELSIM主要使用UNV和VTU两种格式作为基础网格数据,同时支持这些格式的数据导入与到处。 当仿真软件的功能变多时,开发者可能还需要增加其他的数据。如CAD拓扑信息与网格的映射关系,动网格数据每个层级的关系,子模型与全局模型的网格映射等等。这些数据是基础网格数据的重要补充,由于这些数据大小可能不一,需要一种灵活且可压缩的数据格式来支持,比较理想的是用Hdf5格式文件。WELSIM会在网格划分完毕后,生成一个名为s2m.h5的文件,来包含几何拓扑与网格的映射关系。 总结 本文讨论了仿真软件的网格数据结构与输入输出方式。是被验证了可以应用于通用仿真软件的网格模块。可以满足大部分功能需求。甚至对于一些高级网格功能,如实时仿真,并行计算都能够很好的适应。对于一些复杂的特殊功能,如边界层网络,多体零件的内部嵌入面网格划分,都可以在此数据结构上进行开发。

Saturday, April 4, 2026

WELSIM releases with all new dark theme GUI

WELSIM, a general-purpose engineering simulation and analysis software, has released its latest 2026R2 version (internal version 3.3). Compared to the previous release, version 2026R2 introduces a majorly upgraded underlying framework alongside a new dark theme, improving the graphical user interface. All new dark theme The newly added dark theme reflects current desktop application designs and is gentler on the eyes. Users can set the appearance theme in Preferences and have three options available: Classic, Dark, and Light. Press enter or click to view image in full size The Classic theme is similar to the Light theme, whereas the Dark theme features a dark background with light‑colored text and icons in the foreground. Starting with this version 2026R2, WELSIM’s default style will be the Dark theme. Comprehensive Framework Upgrade The new version upgrades the key foundational framework, including updating the GUI framework Qt from 5.15 to 6.10 and the 3D rendering engine VTK from 8.2 to 9.2. Press enter or click to view image in full size Upgrading both core frameworks across major versions has improved WELSIM’s stability and performance. Other Improvements and Upgrades The new release optimizes and advances existing features and adds more automated test cases, delivering a better user experience in WELSIM. Become a Medium member Disclaimer: WelSim and its developers are not affiliated with Qt or VTK, nor are they associated with the above‑mentioned development teams or organizations. References to Qt and VTK are made solely for reference in technical blog posts and software documentation.