#### 9.6` `Clean Up the Geometry

Meshing packages have the challenge of dealing with a host of geometry problems. Many of these problems can be generalized as file translation issues. Typically, the geometry used in a meshing package has not been created there but in one of many CAD packages. Exporting these files out of CAD and into a neutral file format (IGES, STEP, SAT) accepted by the meshing software can introduce misrepresentations in the geometry. If the CAD and meshing packages do not support the same file formats, a second translation may be necessary, possibly introducing even more problems.

Another complication caused by file translation is that of tolerances. Some CAD packages see two points as coincident if they are within 1e-3 units, while others use 1e-6. If the meshing software’s tolerance is finer than the CAD package’s, this disparity in tolerance can cause subsequent geometry modification operations in the meshing package to inadvertently create sliver features, which tend to be difficult and tedious to deal with. This tolerance problem also causes misalignment issues between adjacent volumes of assemblies, hindering the sharing of coincident geometry in order to produce a conformal mesh.

Modeling errors caused by the user in the CAD package is another problem that the meshing package has to correct. In the CAD package, the user may not create the geometry correctly, causing some parts to overlap, or introduce small gaps between parts that should touch. Many times these problems are detected in the meshing package at a point when it is not feasible to simply go back into the CAD system and fix the problem, so the meshing package must be capable of correcting it.

Several approaches for addressing the geometry cleanup problem have been proposed in the literature, but they typically provide operations that are automatically applied to the geometry once one or more topology problems have been identified. While very effective in many cases, they generally lack the ability for the user to have control over the resolution of these CAD issues while still maintaining the option for automation. The ITEM environment provides tools to both diagnose these common issues and to provide a list of solutions from which the user may select that will correct the problems.

For the purposes of mesh generation, features in a solid model that should be carefully considered and addressed prior to meshing generally fit in one of four categories:

Bad geometry representation As a result of translation errors between CAD representations, errors or differences in the way the geometry is interpreted may occur. Depending on the severity of the problem, sometimes a mesh can be generated even with a less-than perfect geometric representation, however, in most cases, these should be resolved before meshing.

Small details in the model In some cases there exist small details in the geometry that, if meshed, would result in very small elements and a potentially huge element budget. Small curves and surfaces can sometimes result from details in the design solid model that may not be necessary for analysis or may even be a result of careless construction of the CAD model. In either case, it is important to remove or modify these features before meshing.

Compatible topology for meshing scheme Several meshing algorithms, such as the structured, mapping and sweeping techniques require a specific configuration of vertices, curves and surfaces in order to operate. Operations to decompose the geometry into a meshable topology are often needed. Other unstructured techniques like paving, and tetrahedral meshing do not require decomposition.

Conformal topology for assemblies Assemblies of parts are often required to have a conformal mesh across their interface. (i.e. Shared nodes at a common boundary). The operations imprint and merge are often required to connect parts together so that when meshed, the representation will be a single continuous mesh.

Being able to recognize when a problem exists and what operations to apply to resolve issues in each of the four categories described above, is indeed an art-form and requires significant experience to become proficient. ITEM will not take the place of an experienced user, but it is intended to offer the user help along the way by detecting potential problems and suggesting solutions they might consider.

##### 9.6.1` `Bad geometry representation

As a result of translation errors between CAD representations, errors or differences in the way the geometry is interpreted may occur. Depending on the severity of the problem, sometimes a mesh can be generated even with a less-than perfect geometric representation, however, in most cases, these should be resolved before meshing.

##### 9.6.1.1` `Detecting Invalid Geometry

In most cases, bad or invalid topology or geometry definition comes from problems which arise in the CAD translation process. CUBIT’s main geometry kernel, ACIS is used to represent the model if it has been imported using an IGES or STEP format. Translation to and from these neutral formats is frequently the cause of bad geometry. ITEM will use the geometry validation procedures built into the ACIS kernel to detect if there is any bad geometry and will list the entities that may be causing a problem.

Since the validation procedures are specific to ACIS, models that may have been imported from another native format such as Pro/E will not provide this diagnostic. Although this may seem like a severe limitation, importing native formats rarely have bad geometry, since no translation process is necessary.

It is good practice to always check your model for bad geometry before proceeding to other geometry or meshing operations. In some cases, if a webcut or meshing operation fails, the cause is an invalid geometric definition that has not been adequately healed. Resolving bad geometry problems up front, in most cases is essential to obtaining a mesh. On the other hand, if the location of the bad geometry in the model is such that it will not effect subsequent Boolean or decomposition operations, there may be a chance that completely resolving bad geometry is not necessary. Simply ignoring bad geometry that cannot be easily repaired with automatic procedures may be a reasonable solution, provided the user is aware of the potential limitations.

##### 9.6.1.2` `Resolving Invalid Geometry

To resolve invalid geometry, ITEM uses the heal procedure built into the ACIS geometry kernel. In almost all cases, this is a fully automatic procedure. Simply selecting the automatic repair button will make the appropriate adjustments to the geometry. This can be done one volume at a time by healing the owning volume, or by healing the full model all at once. If healing was successful, No problems detected should be displayed.

If auto repair does not successfully repair the geometry, you may want to try additional options available in Cubit for healing. See the Cubit documentation for a complete description of additional healing options.

##### 9.6.2` `Small details in the model

The small feature removal area of ITEM focuses on identifying and removing small features in the model that will either inhibit meshing or force excessive mesh resolution near the small feature. Small features may result from translating models from one format to another or may be intentional design features. Regardless of the origin small features must often be removed in order to generate a high quality mesh.

ITEM will recognize small features that fall in four classifications:

small curves

small surfaces

narrow surfaces

surfaces with narrow regions

These operations may involve either real, virtual or a combination of both types of operations to remove these features. A virtual operation is one in which does not modify the CAD model, but rather modifies an overlay topology on the original CAD model. Real operations, on the other hand directly modify the CAD model. Where real operations are provided by the solid modeling kernel upon which Cubit is built, virtual operations are provided by Cubit’ CGM (Tautges, 00) module and are implemented independently of the solid modeling kernel. The following describes the diagnostics for finding each of the four classifications of small features and the methods for removing them.

##### 9.6.2.1` `Small Curves

Diagnostic: Small curves are found by simply comparing each curve length in the model to a user-specified characteristic small curve size. A default epsilon ( e) is automatically calculated as 10 percent of the user specified mesh size, but can be overridden by the user.

Solutions: ITEM provides three different solutions for eliminating small curves from the model. The first solution uses a virtual operation to composite surfaces. Two surfaces near the small curve can often be composited together to eliminate the small curve as shown in Figure 513, image (a).

The second solution for eliminating small curves is the collapse curve operation. This operation combines partitioning and compositing of surfaces near the small curve to generate a topology that is similar to pinching the two ends of the curve together into a single point. The partitioning can be done either as a real or virtual operation. Figure 513, image (b) illustrates the collapse curve operation.

The third solution for eliminating small curves is the remove topology operation. This operation can be thought of as cutting out an area around the small curve and then reconstructing the surfaces and curves in the cut-out region so that the small curves no longer exist. (Clark, 07) provides a detailed description of the remove topology operation. This operation has more impact on the actual geometry of the model because it redefines surfaces and curves in the vicinity of a small curve. The reconstruction of curves and surfaces is done using real operations followed by composites to remove extra topology introduced during the operation. Figure 513, image (c) shows the results using the remove topology operation.

Figure 513: "Three operators used for removing small curves (a) composite; (b) collapse curve; (c) remove topology"

##### 9.6.2.2` `Small and Narrow Surfaces

ITEM also addresses the problem of small and narrow surfaces. Both are dealt with in a similar manner and are described here.

Diagnostic: Small surfaces are found by comparing the surface area with a characteristic small area. The characteristic small area is defined simply as the characteristic small curve length squared or .

Narrow surfaces are distinguished from surfaces with narrow regions by the characteristic that the latter can be split such that the narrow region is separated from the rest of the surface. Narrow surfaces are themselves a narrow region and no further splits can be done to separate the narrow region. Figure 514 shows examples of each. ITEM provides the option to split off the narrow regions, subdividing the surface so the narrow surfaces can be dealt with independently.

Figure 514: Two cases illustrating the difference between surfaces with narrow regions and narrow surfaces

Figure 515: When the small surface's underlying geometric definition is the same as a neighbor the curve between them can be regularized out.

##### 9.6.3` `Building a Sweepable Topology

The hex meshing problem presents a number of additional challenges to the user that tetrahedral meshing does not. Where a good quality tetrahedral mesh can generally be created once small features and imprint/merge problems have been addressed, the hexahedral meshing problem poses additional topology constraints which must be met.

Although progress has been made in automating the hex meshing process, the most robust meshing algorithms still rely on geometric primitives. Mapping [Cook, 82] and sub-mapping [Whiteley, 96] algorithms rely on parametric cubes and sweeping[Knupp, 98; Scott, 05] relies on extrusions. Most real world geometries do not automatically fit into one of these categories so the topology must be changed to match the criteria for one of these meshing schemes. ITEM addresses the hex meshing topology problem through four primary diagnostic and solution mechanisms.

Recognizing nearly sweepable topologies and suggesting source-target pairs

Detecting and compositing surfaces to force a sweep topology

##### 9.6.3.1` `Blend Surfaces

Blend surfaces are common in solid model meshing problems. A blend surface, also known as a fillet or chamfer, is problematic for sweeping algorithms which have trouble assigning vertex types on blend surfaces. While blend surfaces present a challenge for meshing applications, there are many tools within ITEM to help guide the user through possible solutions.

Diagnostic: Blend surfaces are detected by looping over the curves on a surface and examining the angles, surface normals, and curvature of curves and adjacent surfaces.

Solutions: The current solution to blend surfaces is to remove the surface and attempt to extend adjacent surfaces to fill in the gap. An example of blend surfaces that have been removed is shown below. This is useful for models which can be simplified without losing important topology.

Figure 520: A volume which has been simplified by removing blend surfaces.

##### 9.6.3.2` `Geometry Decomposition

Automatic decomposition has been researched and tools have been developed which have met with some limited success [Lu,99 , Staten,05]. Automatic decomposition requires complex feature detection and sub-division algorithms. The decomposition problem is at least on the same order of difficulty as the auto-hex meshing problem. Fully automatic methods for quality hexahedral meshing have been under research and development for many years [Blacker,93 , Folwell,98 , Price,95]. However, a method that can reliably generate hexahedral meshes for arbitrary volumes, without user intervention and that will build meshes of an equivalent quality to mapping and sweeping techniques, has yet to be realized. Although fully automatic techniques continue to progress [Staten,06], the objective of the proposed environment is to reduce the amount of user intervention required while utilizing the tried and true mapping and sweeping techniques as its underlying meshing engine.

Instead of trying to solve the all-hex meshing problem automatically, the ITEM approach to this problem is to maintain user interaction. The ITEM algorithms determine possible decompositions and suggest these to the user. The user can then make the decision as to whether a particular cut is actually useful. This process helps guide new users by demonstrating the types of decompositions that may be useful. It also aids experienced users by reducing the amount of time required to set up decomposition commands.

Diagnostics: The current diagnostic for determining whether a volume is mappable or sweepable is based upon the autoscheme tool described in [White,00]. Given a volume, the autoscheme tool will determine if the topology will admit a mapping, sub-mapping or sweeping meshing scheme. For volumes where a scheme cannot be adequately determined, a set of decomposition solutions are generated and presented to the user.

Solutions: The current algorithm for determining possible cut locations is based on the algorithm outlined in [Lu,99] and is described here for clarity:

Find all curves that form a dihedral angle less than an input value (currently 135)

Build a graph of these curves to determine connectivity

Find all curves that form closed loops

For each closed loop:

Find the surfaces that bound the closed loop

Save the surface

Remove the curves in the closed loop from the processing list

For each remaining curve:

Find the open loops that terminates at a boundary

For each open loop:

Find the surfaces that bound the open loop

Save the surfaces

For each saved surface:

Create an extension of the surface

Present the extended surface to the user as a possible decomposition location.

This relatively simple algorithm detects many cases that are useful in decomposing a volume. Future work will include determining symmetry, sweep, and cylindrical core decompositions. These additional decomposition options should increase the likelihood of properly decomposing a volume for hexahedral meshing.

Figure 521 shows an example scenario for using this tool. The simple model at the top is analyzed using the above algorithm. This results in several different solutions being offered to the user, three of which are illustrated here. As each of the options is selected, the extended cutting surface is displayed providing rapid feedback to the user as to the utility of the given option. Note that all solutions may not result in a volume that is closer to being successfully hex-meshed. Instead the system relies on some user understanding of the topology required for sweeping. Each time a decomposition solution is selected and performed, additional volumes may be added, which will in turn be analyzed by the autoscheme diagnostic tool. This interactive process continues until the volume is successfully decomposed into a set of volumes which are recognized as either mappable or sweepable.

Figure 521: ITEM decomposition tool shows 3 of the several solutions generated that can be selected to decompose the model for hex meshing

##### 9.6.3.3` `Recognizing Nearly Sweepable Regions

The purpose of geometry operations such as decomposition is to transform an unmeshable region into one or more meshable regions. However, even the operations suggested by the decomposition tool can degenerate into guesswork if they are not performed with a specific purpose in mind. Without a geometric goal to work toward, it can be difficult to recognize whether a particular operation will be useful.

Incorporated within the proposed ITEM environment are algorithms that are able to detect geometry that is nearly sweepable, but which are not fully sweepable due to some geometric feature or due to incompatible constraints between adjacent sections of geometry. By presenting potential sweeping configurations to the user, ITEM provides suggested goals to work towards, enabling the user to make informed decisions while preparing geometry for meshing.

Unlike the decomposition solutions presented in the previous section, the purpose of recognizing nearly sweepable regions is to show potential alternative source-target pairs for sweeping even when the autoscheme tool does not recognize the topology as strictly sweepable. When combined with the decomposition solutions and the forced sweepability capability described later, it provides the user with an additional powerful strategy for building a hexahedral mesh topology.

Diagnostics: In recognizing nearly sweepable regions, the diagnostic tool employed is once again the autoscheme tool described in [White, 00]. Volumes that do not meet the criteria defined for mapping or sweeping are presented to the user. The user may then select from these volume for which potential source-target pairs are computed.

Solutions: The current algorithm for determining possible sweep configurations is an extension of the autoscheme algorithm described in [White, 00]. Instead of rejecting a configuration which does not meet the required sweeping constraints, the sweep suggestion algorithm ignores certain sweeping roadblocks until it has identified a nearly feasible sweeping configuration. The suggestions are presented graphically, as seen in figure 522. In most cases, the source-target pairs presented by the sweep suggestion algorithm are not yet feasible for sweeping given the current topology. The user may use this information for further decomposition or to apply solutions identified by the forced sweepability capability described next. The sweep suggest algorithm also provides the user with alternative feasible sweep direction solutions as shown in figure 522. This is particularly useful when dealing with interconnected volumes where sweep directions are dependent on neighboring volumes.

Figure 522: (a) ITEM displays the source and target of a geometry that is nearly sweepable The region is not currently sweepable due to circular imprints on the side of the cylinder (b) Alternative feasible sweep directions are also computed.

##### 9.6.3.4` `Forced Sweepability

In some cases, decomposition alone is not sufficient to provide the necessary topology for sweeping. The forced sweepability capability attempts to force a model to have sweepable topology given a set of source and target surfaces. The source-target pairs may have been identified manually by the user, or defined as one the solutions from the sweep suggestion algorithm described above. All of the surfaces between source and target surfaces are referred to as linking surfaces. Linking surfaces must be mappable or submappable in order for the sweeping algorithm to be successful. There are various topology configurations that will prevent linking surfaces from being mappable or submappable.

Diagnostics: The first check that is made is for small curves. Small curves will not necessarily introduce topology that is not mappable or submappable but will often enforce unneeded mesh resolution and will often degrade mesh quality as the mesh size has to transition from small to large. Next, the interior angles of each surface are checked to see if they deviate far from 90 multiples. As the deviation from 90 multiples increases the mapping and submapping algorithms have a harder time classifying corners in the surface. If either of these checks identify potential problems they are flagged and potential solutions are generated.

Solutions: If linking surface problems are identified ITEM will analyze the surface and generate potential solutions for resolving the problem. Compositing the problem linking surface with one of its neighbors is a current solution that is provided. ITEM will look at the neighboring surfaces to decide which combination will be best. When remedying bad interior angles the new interior angles that would result after the composite are calculated in order to choose the composite that would produce the best interior angles. Another criterion that is considered is the dihedral angle between the composite candidates. Dihedral angles close to 180 are desirable. The suggested solutions are prioritized based on these criteria before being presented to the user. Figure 1 shows an example of a model before and after running the forced sweepability solutions. The top and bottom of the cylinder were chosen as the source and target surfaces respectively.

Figure 523: Non-submappable linking surface topology is composited out to force a sweepable volume topology