How to generate meshes for the CAE simulations with CAD Exchanger SDK?

Computational methods are widely used in engineering to define the bottlenecks in the early stages of the design, test alternative hypotheses, and reduce prototyping. And one of the basic but important obstacles in this path is the necessity to convert a solid geometry into a polygonal one with a high degree of accuracy. Following this express aim, CAD Exchanger elaborated the tool to build high-quality FEA-tailored meshes — Advanced Meshers add-on.

We invite you to study the meshing algorithm, its customization options, and the advanced features of the tool.

What is a computational mesh?

Difference between visualization and computational mesh
Difference between visualization and computational mesh

A computational mesh is defined by its application. For working visualization, e.g. displaying a CAD model in a work view, any sufficiently granular mesh will do, as long as it can be generated quickly enough. However, for FEA (finite element analysis), which is the exact purpose of generating a computational mesh, a different performance-to-quality ratio applies. A higher-quality mesh, with triangles being closer to equilateral, can make the FEA calculations results more accurate.

Computational mesh must be built with regard to the geometry, physics and field of application of a simulated system, its boundary and load conditions, as well as the type of analysis to be performed. If the mesh is high-quality, problem-specific, and free from excessive details, then the FEA solver gets enough data on the underlying geometry to quantify the system behavior.

Computational mesh use cases

CAD Exchanger computational mesh generation
CAD Exchanger computational mesh generation

Numerous businesses have introduced simulation to enhance products quality while reducing development costs and time to market. However, to replace physical prototyping after each design change with virtual computations, it is necessary to ensure that an original CAD model is simulation-ready. This is what FEA-tailored meshers are made for. They support data transfer between design and analysis tools, whether your app uses a field-specific or a multiphysics solver.

  • Structural analysis

The structural analysis allows to compute loads and physical structures performance under these loads. Civil, aerospace and industrial engineering always has on its agenda the question of resilience against external and internal forces, accelerations, and deformations. Converting solids to meshes enables the prediction of vehicles deterioration, loads distribution in bridges, or phone shells weak points, as well as further optimization of their designs.

  • Computational fluid dynamics

In such fields as aerodynamics, weather, and HVAC (heating, ventilation, and air conditioning), CFD (computational fluid dynamics) computations are used to analyze fluids and gases flows. The outcome of the simulation and thus the chance to improve pump efficiency, hull form, or plate heat exchanger flow depends on the quality of the geometry discretization.

  • Computational electromagnetics

Electromagnetic fields behavior is studied within biochemistry, medical imaging, communications, and electrical engineering. In the case of proper input, geometry pre-processing, it is possible to calculate printed circuit board signal integrity, pacemaker electromagnetic interference, aircraft radar cross-section, and other properties related to scattering and radiation through CEM (computational electromagnetics).

How does CAD Exchanger Advanced Meshers work?

CAD Exchanger computational mesh generation
CAD Exchanger computational mesh generation

Advanced Meshers is the CAD Exchanger SDK add-on used to generate high-quality surface and volume computational meshes from the B-Rep models. It can operate on either the geometry from imported files (14 B-Rep formats available) or the one created inside a user’s application.

Meshing algorithms are encapsulated into ModelAlgo_BRepMesher, which allows mesh generation for an entire 3D model, any subtree of a scene graph element, or a particular B-Rep solid or sheet body. The general meshing workflow consists of four steps:

  • B-Rep vertices are mapped into mesh nodes;
  • B-Rep edges are discretized and internal points are mapped to mesh nodes;
  • B-Rep faces are tessellated and internal points are mapped to mesh nodes;
  • Optimization of the generated elements

The following example demonstrates computing a polygonal representation from a particular body:

MeshAlgo_NetgenFactory aFactory;
ModelAlgo_BRepMesherParameters aParam;
aParam.ComputationalMeshAlgo() = aFactory;
ModelData_Part aPart = ...;
ModelData_BRepRepresentation aBRep = aPart.BRepRepresentation();
if (aBRep) {
const ModelData_BodyList& aList = aBRep.Get();
for (size_t i = 0; i < aList.Size(); ++i) {
const ModelData_Body& aBody = aList[i];
ModelAlgo_BRepMesher aMesher (aParam);
ModelData_PolyShapeList aPolyList = aMesher.Compute (aBody);
//explore aPolyList...
}
}

Please refer to the documentation for more details on add-on algorithms and parameters.

Advanced Meshers features

CAD Exchanger computational mesh generation

CAD Exchanger offers the meshing algorithm based on the Netgen solution. This third-party mesher allows to automatically generate high-quality meshes with the geometry-adapted refinement, is open-source and deployable on C++ SDKs. Here are the key features that CAD Exchanger-Netgen synergy provides:

  • Customizable parameters

The Netgen-based algorithm allows to control the meshing result with multiple parameters, including maximum and minimum element sizes (length of its segment set by absolute and/or relative values), mesh granularity (from coarse to fine, or custom), number of optimization steps after the mesh has been computed, etc.

  • Surface and volume meshes

Thanks to an additional Netgen-specific extension, apart from the 2D surface elements, it is possible to generate 3D meshes. Such volume meshes, represented by tetrahedron elements, might be subject to iterative optimization.

CAD Exchanger volume mesh generation
CAD Exchanger volume mesh generation
  • Boundary conditions support

Another extension provides an ability to designate B-Rep faces as elements of certain boundary groups, which allows the easier setup of boundary conditions in the FEA software. The following example demonstrates how to assign boundary conditions to the original B-Rep faces:

ModelData_Body aBody = ...; //original BRep body
const Mesh_NetgenMeshDS& aNetgenMeshDS = aMeshDS.NetgenMeshDS();
for (ModelData_Shape::Iterator i; i.HasNext();) {
const ModelData_Face& aFace = static_cast<const ModelData_Face& aFace> (i.Next());
int aBCIndex = ...; //retrieve the boundary condition id for the face
aNetgenMeshDS.SetFaceBCIndex (aFace, aBCIndex);
}
for (int i = 0; i < aNumberOfBC; ++i) {
Base_String aBCName = ...; //name of the i-th boundary condition
aNetgenMeshDS.SetBCName (aBCIndex, aBCName);
}
  • Export to FEA solvers formats

CAD Exchanger Advanced Meshers allows writing a Netgen-generated mesh in Neutral, Abaqus, Fluent, and OpenFOAM file formats. This way when the mesh is ready, it can be transferred to one of the FEA solvers for further computations. OpenFOAM export also provides options such as boundary condition naming and a gzip-compressed mode.

  • Progress status support

The meshing algorithms within CAD Exchanger SDK support progress status update and notifications, including cancellation of the operation. In case you already have the CAD Exchanger installed, please try the progress bar example. Just insert its source code into your application and modify it as needed.

Advanced Meshers benefits

CAD Exchanger computational mesh generation

Generating 2D and 3D meshes with CAD Exchanger Advanced Meshers add-on is an accurately controlled process compatible with the most common CAD formats and FEA solvers.

  • CAD Exchanger Advanced Meshers ensures interoperability with FEA solvers, allowing to export internal Netgen meshes to the Abaqus, Fluent, OpenFOAM, and Netgen native neutral format.
  • Advances Meshers workflow is tailored to further FEA simulation, enabling both surface and volume meshes, as well as boundary conditions support.
  • Broad settings range allows to get the resulting mesh adjusted to its purpose: built with triangles and tetrahedra, linear (first-order) or quadratic (second-order) elements, according to the preset minimum and maximum element sizes, as well size growth strategies, etc.
  • FEA-tailored mesh generation algorithm guarantees fast and sustainable preprocessing even in the case of several thousand surfaces geometry.

Computing a polygonal representation from a B-Rep one varies considerably according to the further usage of the mesh. Models that are subject to structural, CFD, or computational electromagnetics analysis must consist of high-quality regular triangles with precisely assigned properties relevant for physical simulation. CAD Exchanger Advanced Meshers was designed exactly for this purpose.

You can try it out in practice by applying for an evaluation version of CAD Exchanger SDK. If you already use the tool, check out the Netgen mesher example and run it with the following model in the installation package: /examples/models/LeverArm.xml.

CAD Exchanger is a technology that enables data exchange in the multi-CAD world.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store