# Main Settings for Hex-dominant parametric¶

In this chapter the main settings that are generally required as input by the user are detailed. These parameters appear under the global Hex-dominant parametric settings. These include defining the base domain size and discretization, several types of mesh refinements and their corresponding settings that are explained in detail below.

## Geometry Primitives & Main Properties¶

The Geometry Primitives by default contains the BaseMeshBox and the Material Point that must be specified by the user. Based on the requirements of the user, further geometries can be added that would be required for Region Refinements.

The BaseMeshBox and the Material Point are explained below.

### Base Mesh Box¶

The Base Mesh Box specifies the bounding extents for the base mesh. The bounding extents must then be selected depending upon whether the user requires a mesh for External flow or Internal flow simulations.

• External flow mesh: The bounding extents for the Base Mesh Box also serve as the flow domain boundaries/surfaces that are later specified with a certain Boundary Condition. Therefore in this case, the extents must be some distance upstream, downstream and in the lateral directions to the object.

Important

Generally it is recommended that the extents be at least 2-3D upstream, 6-8D downstream and 2-3D in the lateral directions, where D is the object reference length.

• Internal flow mesh: The case is different. Here the bounding extents for the Base Mesh Box only serve as a reference for the base mesh and therefore are NOT used as the flow domain. The domain is then the inner volume of the geometry and the Boundary Conditions are specified on the resulting geometry surfaces. Thus, the BaseMeshBox extents can be just slightly greater or more than the geometry bounds.

Important

It is recommended that the Base Mesh Box should not be smaller than the geometrical bounding dimension, otherwise the geometry would be truncated by the Base Mesh Box extents.

An example for the Base Mesh Box around the object. (Irrespective of the type of mesh).

### Material Point¶

The material point is used to specify the enclosed space inside the Base Mesh Box that will be kept as the mesh in the Cell Removal part of Castellated Mesh step (see Background for snappy hex mesh). This will be the space which constitutes the final mesh.

So, independent of the Base Mesh Box, the material point determines whether the resulting mesh is for an External flow simulation or Internal flow simulation. The figures below show two scenarios resulting from different specification of the material point for the same BaseMeshBox and object.

• Scenario 1: The point is outside the body

An example of the material point outside the object and the corresponding mesh.

• Scenario 2: The point is inside the body

An example of the material point inside the object and the corresponding mesh.

Important

Please Note: This point should never be on a face, always inside a cell, even after refinements of the mesh. Therefore, coordinates ending in odd values should be preferred.

Additional geometries can be added by the user by clicking on Create new geometry primitive button. These geometries can then be used to refine specific spaces in the mesh by adding Region Refinements under *Mesh Refinements.

The choice of following three shapes are available:

• Cartesian box
• Sphere
• Cylinder

The figure below shows an example of a cartesian box inside the Base Mesh Box and around the object.

An example of a cartesian box geometry primitive.

### Main Properties¶

For the creation of the base mesh the user must specify the number of cells (for Base Mesh Box) in each coordinate direction under Bounding Box Discretization in the main tree (1 level below the Mesh Operations).

The base mesh cell size ( in X-direction ) is then given as:

$\frac{X_{max}-X_{min}}{N_{x}}$

where, $$X_{max}$$ is the maximum X-coordinate, $$X_{min}$$ is the minimum X-coordinate of the Base Mesh Box and $$N_{x}$$ is the number of cells in X-direction.

For the discritization it is recommended to have a base mesh with perfect cube cells to yield better results. This can be achieved if the following formulation holds.

$\frac{X_{max}-X_{min}}{N_{x}}= \frac{Y_{max}-Y_{min}}{N_{y}} = \frac{Z_{max}-Z_{min}}{N_{z}}$

Following the above formulation, a sample Base Mesh with perfect cube cells is shown in the figure below

An example of showing the Base Mesh Box.

Based on the discretized Base Mesh Box, the Coarsest (largest) cell is determined for each coordinate direction and is used to define a refinement of Level 0. This means that any Mesh refinements of Level 0 will have the same cell dimensions as the base mesh cell in respective coordinate directions.

#### Refinement Levels¶

Further, each increment of refinement level reduces the cell dimensions by half. With reference to $$\Delta X_{0}$$, base mesh cell size at level 0, the following formulation holds for cell size in each coordinate direction:

$\Delta X_{n} = \frac{\Delta X_{0}}{2^{n}}$

This refinement levels are illustrated by the figures below:

Figure showing how the refinement levels effect cell size.

An example of different refinement levels for a sample mesh.

Important

It is recommended that the maximum level be set to give cell size in the order of the minimum geometry dimension.

Note: Refinement Levels are not limited, you may specify a level of level 10 or more, but this may result in a huge mesh size.

## Mesh Refinements¶

For the SnappyHexMesh, several refinement option can be selected by the user to get the required mesh. These are all specified under the Mesh Refinement subtree. Each refinement plays a specific role in the meshing process that is briefly described below:

• Surface and Feature refinements are specifically used for the Cell Splitting phase in Castellated Mesh Step. It is then recommended to give refinement level that results in a cell size of the order of geometrical dimensions.
• Region refinements are used to refine one or more volume regions that may be part of the geometry or user-defined under Geometry Primitives (in section Additional geometry entities)
• Layer refinement is used in the Layer addition of meshing process for addition of hexahedral cells aligned to the selected surfaces of the body to increase the accuracy of results.
• Box layers are similar to Layer refinement, but to generate layer mesh on a surface of outer bounding box. Therefore, are only applicable for an external flow mesh.

The settings and parameters for each type of refinement are described in detail below.

### Surface refinement¶

The surface refinement is done only for the selected surfaces. If the user assigns a volume to the surface refinement, the refinement is applied to all surfaces of that volume. Surface refinement can also be used to group cells together - such a group of cells is called a cell zone.

The user must specify two refinement levels, level min and level max. The minimum level is applied first across all of the surfaces. The maximum level is only applied to cells in areas where the normals form an angle greater than the specified resolve feature angle (in Advanced Settings). Therefore, in the following cases, only the minimum level is applied.

1. A flat surface.
2. A surface that has angle between normals less than the value specified for resolve feature angle.

Consequently, Cells that get multiple intersections where the intersections make an angle larger than resolve feature angle value get refined up to the maximum level

The figure below show a mesh with surface refinement of minimum level = 2 and maximum level = 4.

A sample for surface mesh with different refinement levels

The figure below shows a mesh with surface refinement of the same minimum and maximum level of 4.

A sample for surface mesh with same refinement levels

• Create cellZone: This option is by default inactive. If the user assigns a closed volume to this surface refinement and sets this option to True, the refinement will group together all cells enclosed by this volume - such a group of cells is called a cell zone. It is then possible to assign different properties to a cell zone. For example, the user can set it as a rotating region (MRF (Multiple Reference Frame) or AMI (Arbritrary Mesh Interface)), a momentum source, a heat source or a passive scalar source. If the geometry that is being meshed is of STL format, the user can also assign a list of faces that form a closed volume to create a cell zone.

Important

It is recommended that the maximum level be set to give a cell size in the order of the minimum surface dimension. The surface refinement is overwritten by a feature refinement at the geometry edges by the specified feature refinement distance (see Feature refinement below for details).

### Feature refinement¶

This refinement is specifically important as it is used to refine the geometry’s feature edges. The feature edges are extracted based on the Included angle under Surface Feature Extract. So, the edges whose adjacent surface normals have angle less than the included angle are marked for extraction and refinement.

The user must specify the Distance and the level. The edge and surface mesh will then be refined at the specified distance in all directions from the extracted edges as depicted by the figure below.

An sample mesh with feature refinement.

Important

This feature refinement is based on the explicit Feature Snap method that provides better conformation. If this refinement is not used, an implicit feature Snap is used by default. (see Snap Controls in Advance Settings for details)

### Region refinement¶

The region refinement is used to refine the volume mesh for one or more user specified volume regions under geometry primitives or geometry regions. One of the following refinement mode can be applied to each region :

• Inside: Refines all volume mesh cells inside the surface up to the specified level. The surface needs to be closed for this to be possible.
• Outside: Refines the outside volume mesh cells up to the specified level.
• Distance: Refines according to distance to the surface and can accommodate different levels at multiple distances.

Important

It is important to note that the distances need to be specified in descending order.

In the case of inside and outside refinement, the distance is not required so is ignored (but it must be specified). The level then determines the cell size relative to the Base Mesh cell size.

An sample mesh showing the region refinement.

### Layers refinement¶

The layer refinement adds a volume mesh with cells aligned to the surface. The user must enter the following 4 basic parameters:

• Number of layers: Specifies the total number of layers
• expansion Ratio: Specifies the growth of successive layers. The larger the value the greater the difference in height of the layers.
• Final Layer Thickness: Specifies the height (thickness) of the layer that is furthest away from the surface.
• min Thickness: This specifies the overall minimum thickness of all the layers.

Important

This value must be less than the total thickness of all the layers. Otherwise, layers will not be generated.

The values can be give in relative size or absolute size under Advanced settings.

• Relative: In case of relative, for example the FinalLayerThickness is equal to the entered value times the neighboring volume cell size after refinements.
• Absolute: In case of absolute, the fixed value in units of meters is taken.

The figures below shows sample image of layers along an object’s surfaces.

An illustration of layer refinement

Layer refinements around a sample object

### Box Layers¶

The box layer refinement is similar to the Layer refinement but only for the bounding box. This is mainly useful for external flow analysis where the box surface acts as a wall for the flow domain and must be refined with a layer mesh for accuracy. The user must select one additional parameter, which is the box face for layer generation.

## References¶

 [1] Snappy Hex Mesh official user guide, http://cfd.direct/openfoam/user-guide/snappyHexMesh

## Disclaimer¶

This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. OPENFOAM® is a registered trade mark of OpenCFD Limited, producer and distributor of the OpenFOAM software.