What does the CADfix API provide?
The CADfix API, otherwise known as CFI, provides a comprehensive geometry and meshing platform for the development of apps that take advantage of the full CAD clean-up and simplification functionality of CADfix. The API provides access to a broad range of low-level geometry and meshing operations, including:
- Interrogation, creation and modification of geometry, model structure and attributes
- Extensive geometric calculations (projection, evaluation, ray-firing, curvature, mass properties, medial axis, etc…)
- Storage or extraction of mesh with associativity to the parent CAD entities
- Tessellation of curves and surfaces for display
There are CFI bindings available for Fortran and C, and also an object-oriented CFI (OOCFI) available for use with C++, Python and Java. All these CFI variants can be used on both Windows and Linux operating systems. Applications built upon CFI can be run as a standalone application, as a co-processor called from within a live CADfix session, or as a dynamically loaded plugin which can be loaded directly into CADfix.
Combining NekMesh with CFI
NekMesh is part of the open source Nektar++ Spectral/HP element framework project and aids the generation of high-order meshes from existing linear meshes using a pipeline approach. NekMesh can read in geometry or mesh from a variety of sources such as OpenCascade, Star CCM+ or Gmsh and has the ability to create surface and volume meshes. Once mesh has been read in or generated, there are various correction and optimisation tools which can be used to improve meshes before being passed back to Nektar++ for solving.
The modular structure of NekMesh makes it easy to incorporate different third-party CAD engines and pre/post-processors into the process. CADfix API allows access to both the geometry and linear meshes produced and stored within CADfix for use in the NekMesh pipeline.
Using the CADfix API, Dr Michael Turner, Julian Marcon and Dr Joaquim Peiro from Imperial College and Dr. David Moxey from the University of Exeter were able to design a geometry and mesh processing system based on the CADfix geometry engine. Calls are made to CFI in its standalone mode to interrogate the CADfix geometry and map it to NekMesh objects. This has been implemented on Linux but could equally be setup to run on a Windows PC using the same CFI code.
Along with the original CADfix geometry being passed into NekMesh, the coarse linear meshes generated by CADfix’s meshing tools are accessed first to extract the node and element definitions, and secondly to supply the CAD parency information associating the mesh to the geometry.
Once the model containing the geometry and initial linear mesh has been processed, further calls to CFI are made to support the isoparametric splitting process. Information regarding the original geometry such as parameter values and derivatives on edges and faces, face normals and curvature at a given parameter value, and model bounding boxes can be calculated directly on the original CADfix geometry from within NekMesh. This functionality gives users additional geometric processing power whilst maintaining the algorithmic flow of their own software.
Framework in detail
The framework begins with CADfix importing the original CAD data in the form of a neutral format such as STEP or IGES or a native CAD format, such as CATIA, NX or Creo. CADfix then cleans and prepares the model for the partitioning and meshing process. This could involve several geometry processing operations such as redefining surfaces, collapsing edges and small feature removal.
Flowchart for the High-Order Mesh Upgrade Process
Once the geometry is clean and prepared, we then automatically subdivide the near field to create a partitioning comprised of multiple connected simple volumes. This is achieved firstly by building a thick offset shell around the model. To automate this partitioning, we make use of one of CADfix’s unique geometry operators, the Medial Axis Transform (MAT). This special operator generates a CADfix medial object (MO) to carry the rich MAT information. The MO helps us to robustly resolve complex junctions between partitions.
The Medial Object as shown around the NASA M6 wing
For High Order (HO) meshing we require a single layer of prismatic elements in the near field with a tetrahedral mesh in far field. Therefore, we have been producing a partitioning structure which can support a wholly prismatic near field, either via mitred partitions or by adding a hexahedral partition in concave areas of geometry, such as wing/fuselage junctions.
Left: O-Type blocking, Right: C-Type blocking.
Once these partitions have been built we automatically apply mesh sizing rules to respect curvature, and then balance and align the size distributions to maintain orthogonality to the CAD surfaces as much as possible. In linear meshes at this point we would normally apply a boundary layer sizing style, however the NekMesh HO upgrade process creates this boundary layer, so we fix the number of cells through the partition and increase the thickness of the partition to allow for suitable boundary layer growth.
Once the mesh sizing constraints have been balanced, we mesh the near and far field partitions with a coarse mesh containing prisms (and hex elements if required) in the near field and tetrahedra in the far field. This mesh is then checked for quality issues, such as inverted elements, and is now ready for the NekMesh HO upgrade process.
Example coarse automatic blocking and mesh from CADfix on the NASA CRM.
In the image above, the NASA CRM has been automatically partitioned and automatically meshed with course linear elements ready for HO upgrade through NekMesh. The mesh is much coarser than we would typically provide, but it highlights the special thick single layer of prismatic elements surrounding the skin of the aircraft, the hex corner partition and the tetrahedral far field.
The mesh is passed to NekMesh via the CFI interface with parency and connectivity information attached to the nodes and elements. This coarse mesh is subdivided using an isoparametric approach to obtain the required high order boundary layer subdivision.
High Order upgrade on the NASA CRM from the CADfix linear mesh
Once the prismatic near-field partitions have been split using isoparametric splitting, we get the resulting HO mesh for solving. The high order boundary-layer mesh consisted of 33 hexahedra and 2,042 prisms. The far-field was discretized using 18,084 tetrahedra.
The high order mesh around the leading edge of the Rotor 67.
This work is part of an ongoing collaboration with Imperial College London and has been presented at the 26th IMR and AIAA SciTech 2018. A full paper outlining this technique and the HO upgrade process in more detail is available on the IMR 26 website, and as part of the proceedings of the AIAA SciTech 2018 Forum. Further work has also been carried out between Imperial College London and Elemental Cars using CADfix and CFI which can be read about in our case study.