#### 5.8` `Adaptivity And Sizing Functions

##### 5.8.1` `Mesh Adaptivity and Sizing Functions

Cubit provides several options for controlling the density of a mesh by adapting to various geometric, analysis, or user-defined properties. Interval sizes are defined automatically, explicitly, or through sizing functions. The sizing functions can be based on the physical features of the model, a previous analysis solution, or a user-specified bias. Adaptivity can apply to meshing either curves or surfaces.

##### 5.8.1.1` `Adaptive Curve Meshing

Cubit provides several ways to adaptively mesh curves. Three curve meshing schemes are provided for this purpose. They include the following schemes:

The first two schemes use characteristics of the geometric model to define element sizes. The third scheme uses a field function typically defined from a previous analysis solution. FeatureSize is an alpha feature and should be used with caution.

##### 5.8.1.2` `Adaptive Surface Meshing

Adaptive surface meshing in Cubit produces a function following mesh which sizes elements based on the value of the driving function at the spatial location at which the element is to be placed. Adaptive surface meshing is performed using the paving, triadvance or tridelaunay algorithms in combination with an appropriate sizing function. The types of sizing functions that can be used are

Super sizing and test sizing functions are alpha features and shouldbe used with caution.

The procedure for adaptively meshing a surface is to designate paving, triadvance or tridelaunay as the mesh scheme for that surface, assign sizing function types, and mesh the surface.

Surface < id > Scheme {Pave|TriAdvance|TriDelaunay}

Import Sizing Function ’<exodusII_filename>’ Block <block_id> Variable ’<variable_name>’ Time <time> [Deformed]

Surface <id> Sizing Function [Type] Exodus [Min <min_value> Max <max_value>]

Surface <id> Sizing Function [Type] {Constant|Curvature|Interval|Inverse|Linear|Super|Test|None}] [Neighbor [<max_neighbors>]]

(See note below regarding ’Neighbor’ parameter)

Surface <id> Sizing Function [Type] Bias Start Curve <id_range> {Finish Curve <id_range>| Factor <val>}

Mesh Surface <id>

##### 5.8.1.3` `Adaptive Volume Meshing

Adaptive volume meshing in Cubit produces a function following mesh that sizes elements based on the value of the driving function at the spatial location at which the element is to be placed. Adaptive volume meshing is performed using the tetmesh scheme in combination with an appropriate sizing function. The types of sizing functions that can be used are constant, test, geometry adaptive and geometry adaptive (skeleton sizing). Test sizing is an alpha feature and should be used with caution. Other sizing functions will be added in future versions of Cubit.

The procedure for adaptively meshing a volume is to designate tetmesh as the mesh scheme for that volume, assign sizing function types, and mesh the volume.

Volume <id> scheme tetmesh

Volume <id> Sizing Function [Type] {Constant|Test|None}

Mesh Surface <id>

Note regarding ’Neighbor’ parameter: The maximum neighbors is the number of points used by the sizing function to compute the size at the requested point. If the number of neighbors is zero, all of the points on the boundary are used in the size calculation. If the number of neighbors is some other number, only that number of closest points are used in the calculation.

##### 5.8.2` `Bias Sizing Function

Surface <id> Sizing Function Type Bias Start Curve <id_range>

{Finish Curve <id_range>| Factor <val>}

The bias sizing function for surfaces is similar to biasing curves. Indeed, setting a bias sizing function for a surface will bias the boundary curves, as well as control paving to follow the bias inside the surface. You first specify the size of a couple of bounding curves (the start curves), then specify the bias sizing function for the surface.

Discussion:

Recall that for biasing curves, you specify the start and end vertex. For the bias sizing function, you specify the start curves, from which to bias away. The sizes of these curves should already be set before setting the surface sizing function since their average size is taken to be the starting size (almost). If the start curve sizes change, then you should set the surface sizing function again.

You can either supply a geometric factor, or the set of finish curves whose sizes you want to match at that distance. A geometric factor. It automatically sizes and biases or dualbiases the non-start curves, including any finish curves. These curves need not be perpendicular to the starting curves. The interval count and scheme are soft-set, so they won’t be changed if they are already hard-set. If the size of the start curves or finish curves are changed, then the sizing function command should be re-issued.

The sizing function value at a point is defined in terms of the straight-line distance from the point to the closest starting curve. So, it works best if all the starting curves have the same size, and the surface is relatively flat. But, starting curves need not be parallel to one another. Similarly, the non-start curves need not have any particular orientation wrt the start curves.

The bias sizing function was designed to easily set the sizes of a sequence of adjoining surfaces: assign a size to the curve you want to bias away from, then set the bias sizing function of the first surface, with its finish curves being the start curve of the second surface, etc. See the last example below.

Examples:

# bias_sz_fn_demo.jou

brick x 100 y 10 z 10

color vol 1 red

surface 1 scheme pave

surface all except 1 visibility off

# label curve interval

# graph text 2

display

# mesh 1

curve 4 size 2

surface 1 sizing function type bias start curve 4 factor 1.3

mesh surface 1

# see figure 1

# mesh 2

delete mesh

surface 1 sizing function type bias start curve 4 factor {1/1.1}

mesh surface 1

# see figure 2

# mesh 3

reset

cyl rad 6 z 1

cyl rad 4 z 1

sub 2 from 1

section body 1 yplane

section body 1 xplane

surf all except 19 vis off

color vol 1 red

display

# finish curve mesh

surf 19 scheme qtri base scheme pave

surface 19 size 0.7

curve 26 size 0.07

surface 19 sizing function type bias start curve 26 finish curve 25

mesh surface 19

pause

# see Figure 427

Figure 427: Surface with bias sizing function start and finish curve. Scheme qtri, base scheme pave.

# dual bias mesh

delete mesh

curve 25 26 size 0.02

curve 25 26 scheme equal

surface 19 sizing function type bias start curve 26 25 factor 1.3

mesh surface 19

zoom curve 12

pause

# see Figure 428

Figure 428: Close up of surface with dual bias sizing function start and finish curve. Scheme qtri, base scheme pave.

# funny face

reset

prism sides 5 z 1 radius 1

cylinder radius 0.1 z 1

body 2 move -0.4 0 0

subtract 2 from 1

cylinder radius 0.1 z 1

body 3 move 0.2 0 0

subtract 3 from 1

prism sides 6 radius 0.2 z 1

body 4 move 0 -0.4 0

subtract 4 from 1

surface all except 34 visibility off

color vol 1 red

display

surface 34 scheme pave

curve 23 19 size 0.01

surface 34 sizing function type bias start curve 19 23 factor 1.3

mesh surface 34

# see Figure 429

# bias surface chain

reset

cylinder radius 1 z 1

cylinder radius 0.2 z 1

cylinder radius 0.4 z 1

cylinder radius 0.8 z 1

imprint body all

delete body 2 3 4

section body 1 xplane

section body 1 yplane

surface all except 42 43 44 45 vis off

color volume 1 red

surface all scheme pave

curve 55 interval 36

surface 43 sizing function type bias start curve 55 factor 1.3

surface 44 sizing function type bias start curve 57 factor 1.3

# curve 57 had its size determined by a prior bias sizing function

surface 45 sizing function type bias start curve 58 factor 1.3

surface 42 sizing function type bias start curve 55 factor 1.3

mesh surface 42 43 44 45

display

highlight curve in surface 42 43 44 45

# see Figure 430

Figure 430: A chain of biased surfaces. Only one curve's intervals were explicitly set.

##### 5.8.3` `Constant Sizing Function

To use the constant sizing function

On the Command Panel, click on Mesh.

Click on Volume or Surface.

Click on the Intervals action button.

Select Sizing Function from the drop-down menu.

Enter the appropriate value for Select Volumes or Select Surfaces. This can also be done using the Pick Widget function.

Select Constant from the Sizing Functions menu.

Enter in any other appropriate settings.

Click Apply and then Mesh.

Surface <id> Sizing Function [Type] Constant

Volume <id> Sizing Function [Type] Constant

The constant sizing function specifies that a constant element size be used over the interior of the surface or volume. The value used as the constant size is the interval size that has been set for the entity. For example, the following commands will cause the mesh size to be smaller on the interior than on the surface’s bounding curves.

reset

brick x 10

surface 1 scheme pave

curve in surface 1 interval 5

surface 1 size 0.5

surface 1 sizing function constant

mesh surface 1

##### 5.8.4` `Curvature Sizing Function

##### 5.8.5` `Exodus II-based Field Function

The ability to specify the size of elements based on a general field function is also available in Cubit. With this capability, the desired element size can be determined using a field variable read from a time-dependent variable in an Exodus II file. Both quadrilateral and triangle elements are supported for surfaces, but only tetrahedral elements are supported for volumes at this time.

A field function is a time-dependent variable in an Exodus II file. Either node-based or element-based variables may be used. Currently, field functions are imported from element and node-based Exodus II data. The mesh block containing the corresponding elements must be imported along with the field function data.

Exodus variable-based adaptive meshing is accomplished in Cubit in several steps:

Surface mesh scheme set to Pave or TriAdvance, and/or volume mesh scheme set to Tetmesh. Bounding curve mesh schemes can also optionally be set to Stride (see comments below.)

An Exodus mesh and time-dependent variable for that mesh is read into Cubit.

The mesh and variable data are associated to geometry.

The Exodus variable is normalized to give localized size measures, and the surface/volume sizing function type is designated.

Geometry is meshed

Import Sizing Function ’<exodusII_filename>’ Block <block_id> Variable ‘<variable_name>’ Time <time_val> [Deformed]

Note that when a sizing function is read in, the mesh is stored in an ExodusMesh object for the corresponding geometry, and therefore the geometry is not considered meshed. Also note that if deformation is not being modeled, the geometry to which the mesh is being associated must be in the same state as it was when that mesh was written (see Importing a Mesh for more details on importing meshes).

Once the field function has been read in and assigned to geometry, it can be normalized before being used to generate a mesh. The normalization parameters are specified in the same command that is used to specify the sizing function type for the surface or volume.

To use the exodus II-based field function

On the Command Panel, click on Mesh.

Click on volume or surface.

Click on the Intervals action button.

Select Sizing Function from the drop-down menu.

Enter the appropriate value for Select Volumes or Select Surfaces. This can also be done using the Pick Widget function.

Select Exodus from the Sizing Functions menu.

Enter in the appropriate settings for Min Size and Max Size.

Click Apply and then Mesh.

Surface <id> Sizing Function Type Exodus [Min <min_val> Max <max_val>]

Volume <id> Sizing Function Type Exodus [Min <min_val> Max <max_val>]

After the sizing function normalization, the geometry may be meshed using the normal meshing command.

##### 5.8.5.1` `Curve Meshing with Exodus II - based Field Functions

In addition to the capability to adaptively mesh surface using a field function, curves may also be meshed separately using the Exodus II information. The Stride scheme for meshing curves is used for this purpose. If the user does not specify a mesh scheme for the curve, Cubit will default to scheme Stride when the Exodus sizing function is used for surfaces and volumes defined by that curve.

##### 5.8.6` `Geometry Adaptive Sizing Function (Skeleton Sizing)

The geometry adaptive sizing function, also referred to as the skeleton sizing function (Quadros 2005; Quadros 2004; Quadros 2004(2)), automatically generates a mesh sizing function based upon geometric properties of the model. This sizing scheme attempts to create a sizing function that allows unstructured meshing schemes to generate a mesh with the following properties:

The sizes of the mesh elements vary smoothly throughout the mesh

The mesh elements resolve the geometry to a sufficient degree

The mesh elements do not over-resolve the geometry.

The geometry adaptive sizing function can be used to create sizing information for surfaces, solids, and assemblies.

This sizing function uses geometric properties to influence mesh size. The scheme calculates or estimates:

3D-proximity (thickness though the volume)

2D-proximity (thickness across a surface)

1D-proximity (curve length)

Surface curvature

Curve curvature.

##### 5.8.6.1` `Skeleton Sizing Behaviors

Skeleton sizing can be specified on single or multiple surface(s)/volume(s) at a time from the GUI (Meshing Control Panel) or the command-line. The following describes how specifying sizing on entities can change skeleton sizing’s behavior:

Single surfaces/volumes – If skeleton sizing is applied to surfaces/volumes one at a time, each entity’s sizing is not influenced by the others. On the command-line, issue a separate command for each entity. In the GUI, specify only one surface or volume before selecting Apply Size.

Multiple surfaces – If skeleton sizing is applied on multiple surfaces together, then geometric features of a particular surface may affect its neighboring surfaces.

Multiple volumes (assembly sizing) – Skeleton sizing can be applied to assembly models so that geometric features of a volume may influence its neighbors. Volumes should first be imprinted and merged before they are specified together for skeleton sizing.

##### 5.8.6.2` `Command Line Syntax

Surface <surface_id_range> Sizing Function Skeleton

{[scale <1 to 10 = 7>] [time_accuracy_level <1 to 3 = 2>]

[min_depth <3 to 8 = 5>] [max_depth <4 to 9 = 7>] [facet_extract_ang <1 to 30 = 10>]

[min_num_layers_2d < 1 to N = 1>] [min_num_layers_1d < 1 to N = 1>]

[max_span_ang_surf <5.0 to 75.0 = 45.0 degrees>]

[max_span_ang_curve <5.0 to 75.0 = 45.0 degrees>]

[min_size <float>] [max_size <float>] [max_gradient <float=1.5>]}

Volume <range> Sizing Function Skeleton

{[scale <1 to 10 = 7>] [time_accuracy_level <1 to 3 = 2>]

[min_depth <3 to 8 = 5>] [max_depth <4 to 9 = 7>] [facet_extract_ang <1 to 30 = 10>]

[min_num_layers_3d < 1 to N = 1>] [min_num_layers_2d < 1 to N = 1>]

[min_num_layers_1d < 1 to N = 1>]

[max_span_ang_surf <5.0 to 75.0 = 45.0 degrees>]

[max_span_ang_curve <5.0 to 75.0 = 45.0 degrees>]

[min_size <float>] [max_size <float>] [max_gradient <float=1.5>]}

The options are explained below:

##### 5.8.6.3` `Basic Arguments

max_size (default=auto): The value for max_size is calculated automatically by default. Users can specify any positive real number based on the dimensions of the model to control the max size of the elements. If the skeleton sizing function creates large elements, than this argument can be used to control the maximum element size.

min_size(default=auto): The value for min_size is calculated automatically by default. Users can specify any positive real number based on dimension of the model to specify the minimum size of the elements.

max_gradient (1.0 to 3.0, default 1.5): The transition in element size is controlled using this parameter. Larger values of max_gradient result in fewer elements, but also lead to more abrupt transitions in size and possibly poorer quality elements.

##### 5.8.6.3.1` `Scaling and Accuracy Arguments:

scale (1 to 10, default 7): The overall size of the elements is controlled by this argument. A coarser mesh can be generated by increasing the value of scale up to 10.0. To get a finer mesh, decrease the value of the scale (minimum value = 1).

time_accuracy_level (1 to 3, default 2): This controls the computational time and accuracy level by adjusting various internal parameters of the skeleton sizing function. Users should try levels in increasing order. Level 1 takes the shortest time to compute the skeleton sizing function and Level 3 takes the longest time to compute the skeleton sizing function. However, Level 1 is less accurate than Level 2 and Level 3.

##### 5.8.6.4` `Advanced Arguments

##### 5.8.6.4.1` `Lattice Arguments:

The skeleton sizing function is generated and stored on a background octree grid whose cells are subdivided based on the graphics facets of the model. The level of subdivision of the background grid affects how well the sizing function captures the geometric complexity of features. Reasonable defaults have been selected for the following two refinement (subdivision) parameters, but these may be overridden for use with simple (decrease parameters) or more complex (increase parameters) models.

min_depth (default auto): min_depth controls the maximum cell dimension of the background octree grid. The higher the value of min_depth, the smaller the dimension of the maximum-sized cell. Computational time increases with increasing min_depth. By default the min_depth is calculated based on the geometric complexity of the input model and mesh size specified on sub-entities.

max_depth (default auto): max_depth controls the minimum cell dimension. If the object contains very fine features then increasing the value of max_depth is suggested. The maximum depth has been limited to 9. By default the max_depth is calculated based on the geometric complexity of the input model and mesh size specified on sub-entities.

facet_extract_ang (default 10 degree): facet_extract_ang is used to control the faceted representation of NURBS model. This option gives control of the accuracy of a faceted approximation of the model used to compute the adaptive sizing. For models with high curvature regions, decreasing the tolerance will give a better approximation of the geometry and avoid the creation of random dense meshes. Note that increasing this angle too much can generate invalid facets over curved regions, while decreasing the angle too much can cause signficant slowdowns in sizing calculations.

##### 5.8.6.4.2` `Source Entity Arguments

min_num_layers_3d (Any value greater than 1, default 1): This parameter ensures that a minimum specified number of layers exist across the thickness of the volume. This parameter could be useful in generating meshes for mold flow simulation.

min_num_layers_2d (Any value greater than 1, default 1): This parameter ensures that a minimum specified number of layers exist across the thickness of a surface.

min_num_layers_1d (Any positive integer value, default 1): This ensures that any curve contains a minimum specified number of intervals.

max_span_ang_curve (Range 5.0 to 75.0, default 45.0): Maximum spanning angle is a parameter that controls the mesh size at curved regions of curves. It is defined as the angle subtended by the normals at the end nodes of the mesh edge in the curved region of a curve. When a finer mesh is needed at curved regions of curves, then max_span_ang_curve should be decreased.

max_span_ang_surf (Range 5.0 to 75.0, default 45.0 deg): Maximum spanning angle is a parameter that controls the mesh size at curved regions of surfaces. It is the angle subtended by the normals at the end nodes of the mesh edge in a curved region of a surface. When a finer mesh is needed at curved regions of surfaces, then max_span_ang_surf should be decreased.

Note: These arguments override the basic arguments. For example, time accuracy level 1 internally sets min_depth = 4 and max_depth = 6, and when min_depth is set to 4 and max_depth is set to 7 in the advanced options (recommended for models with fine features), then advanced options override the basic options. In the command-line, to override the depths set by a time_accuracy_level, specify min_depth and max_depth after it.

##### 5.8.6.5` `Skeleton with Other Sizing Controls

##### 5.8.6.6` `Limitations

Currently, the skeleton sizing function is primarily intended for use with ACIS models. Skeleton sizing may be used on facet-based models (STL, facet, and MBG format) models, but results are not guaranteed.

The skeleton sizing function has mainly been tested with trimesh and tetmesh schemes. In general, structured or semi-structured meshing schemes do not have enough flexibility to utilize the skeleton sizing function. It is recommended that the skeleton sizing be used only with unstructured meshing schemes. However, if using skeleton sizing in conjunction with the pave scheme for surfaces, decreasing the max_gradient and scale arguments is suggested.

##### 5.8.7` `Interval Sizing Function

The interval sizing function is similar to the Linear function, but bases edge length at a location on the squared lengths of edges bounding the surface weighted by their inverse distance from the current location. An example is shown below.

Figure 439: NURB mesh with interval sizing function, 34 by 16 density

##### 5.8.8` `Inverse Sizing Function

The inverse sizing function is also similar to the Linear function, but this method bases edge length at a location on the inverse lengths of edges bounding the surface weighted by their inverse distance from the current location (see Figure 440). The difference between the three linear sizing functions (Linear, Interval, Inverse) is sometimes subtle, but is driven by the geometry being meshed since the influence of these functions is strongly controlled by the number, positioning, and mesh density of the bounding curves relative to the interior surface area.

Figure 440: NURB mesh with inverse sizing function, 34 by 16 density

##### 5.8.9` `Linear Sizing Function

Figure 1. NURB mesh with no sizing function, 34 by 16 density

##### 5.8.10` `Sizing Source Sizing Function

An intuitive method for adding a sizing function to the tetrahedral meshing workflow is introduced with Trelis 17.1 in May 2020. This method places a graphical ellipsoid on the model allowing the user to modify the geometry and mesh size settings of the ellipsoid thereby affecting the impact of the sizing function on the mesh.

##### 5.8.10.1` `Commands Available

select [sizing_source <ids>] [{add|remove}]

create sizing_source id ellipsoid[location <options>]

[radius <xval> <yval> <zval>] [axis <options>][size <value>] growth_factor <value>]

delete sizing_source id <value>

modify sizing_source id ellipsoid[location <options>]

[radius <xval> <yval> <zval>] [axis <options>][size <value>] growth_factor <value>]

sizing_source visibility {on|off}

##### 5.8.10.2` `Possible workflow using the GUI

##### 5.8.10.2.1` `Create the sizing source ellipsoid

Navigate to the Sizing Sources action buttons

Select Mode - Mesh

Select Entity - Sizing Sources

Select Action - Create Sizing Function Source

Complete the command panel dialog

Clicking on the Location or Axis pushbuttons will launch additional dialogs for precise location and management of the ellipsoid.

##### 5.8.10.3` `Attach the sizing source ellipsoid(s) to the volume(s)

After creating the sizing source ellipsoids the next step is to assign these sizing functions to volumes. Simply creating the sizing sources will not affect the meshing. In order to have these sizing sources act as sizing functions the sources must be attached (or assigned) to volumes.

Select Action - Attach Sizing Function Source

Select the Add Volume(s) radio button

Pick the volumes that will use Sizing Source sizing functions

Click Apply

Note: Use this same command panel to remove the association between Sizing Source sizing functions and volumes. Select the Remove Volume(s) radio button then click Apply.

##### 5.8.10.4` `Set the volume’s meshing scheme to tetmesh and mesh the volume

Once the sizing sources are created and assigned to volumes, mesh the volumes using Cubit.

volume <n> scheme tetmesh

mesh volume <n>

##### 5.8.10.5` `Modify a Sizing Source sizing function

An existing Sizing Source may be modified using one of several methods:

From the Cubit command line

From the Modify Sizing Function Source command panel

From the Properties Page

##### 5.8.10.6` `Selecting and picking a Sizing Source

Users may select a Sizing Source using several methods:

From the command line

select sizing_source <id>

From the model tree

Using the select filter on the toolbar then click on a Sizing Source object

From a Sizing Source pickwidget on a command panel

##### 5.8.10.7` `Changing the visibility of a Sizing Source

The visibility of a Sizing Source can be toggled on and off from the toolbar

##### 5.8.10.8` `Deleting a Sizing Source sizing object

A Sizing Source may be deleted using several methods:

From the command line

delete sizing_source id <n>

From the model tree by clicking on a Sizing Source, then right-click to show the context menu.

From the Sizing Sources Delete command panel

The command panel supports deleting multiple Sizing Source objects with one command.

From the graphics window when the Sizing Source select filter is active and Sizing Source is selected

With the Delete key

After selecting a Sizing Source object in the model tree or in the graphics window press the Delete key on your keyboard.

##### 5.8.11` `Geometry Adaptive for TriMesh and TetMesh Schemes

The trimesh and tetmesh schemes in Cubit are based upon third party libraries known as MeshGems that are developed and distributed by Distene. They are robust and fast triangle and tet meshing algorithms that have built in capabilities for adaptively controlling the mesh size based upon feature sizes. In most cases the sizing controls provided as part of the scheme command are sufficient to control mesh sizes. As such, the sizing functions described in this section cannot be used with the the MeshGems triangle and tet meshing algorithms. If a sizing function is assigned to a volume or surface, and the trimesh or tetmesh scheme is selected, rather than using the MeshGems algorithm for meshing the surfaces, it will automatically revert to using the triadvance scheme. Any settings defined with the trimesh or tetmesh scheme will be ignored and the sizing function will be used to determine local mesh sizes. When using the trimesh and tetmesh schemes, recommended practice is to mesh all surfaces and volumes simultaneously. This provides the greatest flexibility to the algorithms to determine feature sizes and their effect on neighboring surfaces and volumes. The default settings for trimesh and tetmesh schemes will automatically provide geometry adaptive mesh sizing. These default settings can however be adjusted by using the settings on the scheme command. The scheme settings are described in the tetmesh and trimesh sections of the documentation.