AMCAX Kernel
Geometry kernel for CAD/CAE/CAM
AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
2D Boundary Layer Detailed JSON Example

Overview

This tutorial provides detailed configuration methods for using mesh generation and 2D boundary layers.

Functional Description

The boundary layer mesh generation creates a denser mesh distribution in regions near solid surfaces to better capture fluid velocity profile variations and viscous effects.
Input: Selected boundaries; Output: Boundary layer mesh (quadrilateral elements).

STEP Model Description

The STEP format CAD models and their edge and face numbering are shown in the following figures. These models will be used in this tutorial.

Model 1:

Model 2:

Basic JSON Template

Below is the basic JSON configuration. For more complex configurations, please refer to complex JSON template.

{
"BoundaryLayer":
[
{
"DistributionType": "Separation",
"EntityType": "Edge",
"EFPairs":
[
{
"E": 25,
"F": 3
}
],
"Basic":
{
"GrowthRate":
{
"Constant": 1.5
},
"InitLayerHeight":
{
"Absolute": 0.1
},
"NLayers": 5,
"ProblematicAreasTreatment": "COLLAPSE"
}
}
],
"MeshSize": [
{
"CurvatureFactor": 0.2,
"GrowthRate": 1.1,
"MaxSize": 0.85,
"MinSize": 0.1,
"MeshingDim": 2,
"SelectedEntities": []
}
],
"ThreadNum": 1
}


Class key Required Value Range Default Notes
BoundaryLayer EntityType Yes [Face, Edge]
BoundaryLayer EFPairs/SelectedEntities Yes
BoundaryLayer-Basic GrowthRate Yes "Constant"、"Variable" [1.0,2.0] "Constant": Uses a fixed growth rate value for all layers, maintaining the same expansion ratio between consecutive layers.
"Variable": Uses an array of growth rates, allowing different expansion ratios for each layer transition.
BoundaryLayer-Basic InitLayerHeight Yes Absolute:[eps,MaxSize]
Aspect:[eps,1]
"Absolute": Initial layer height remains constant across the entire boundary layer, regardless of local mesh characteristics.
"Aspect": Initial layer height is calculated as a factor multiplied by the local surface mesh length, adapting to local mesh size.
BoundaryLayer-Basic NLayers Yes [1,inf]
BoundaryLayer-Basic ProblematicAreasTreatment Yes STOP、SQUEEZE、COLLAPSE、EXCLUDE STOP:When boundary layer generation encounters issues, stop the process.
SQUEEZE:Squeeze layers to overcome intersection, proximity, or quality issues.
COLLAPSE:Collapse layers in local regions to overcome intersection, proximity, or quality issues.
EXCLUDE:Exclude problematic local regions to overcome intersection, proximity, or quality issues.

Basic Configuration Guide

EntityType & EFPairs

"EntityType": "Edge",
"EFPairs":
[
{
"E": 25,
"F": 3
}
]

Generates quadrilateral mesh elements growing from selected boundary edges into the face interior, as shown in the figure below.
"EntityType": "Edge" indicates 2D boundary layer generation from edges into faces. Specifies growth direction from source edge to target face. Example: growth from edge (tag=25) to face (tag=3). Note: The edge must be a boundary edge of the face.

Basic Parameter Settings

"Basic":
{
"InitLayerHeight":
{
"Absolute": 0.1 // Absolute, Aspect
},
"GrowthRate":
{
"Constant": 1.5 // Constant, Variable
},
"NLayers": 5,
"ProblematicAreasTreatment": "COLLAPSE" // STOP, SQUEEZE, COLLAPSE, EXCLUDE
}

InitLayerHeight

Absolute Mode: Fixed initial layer height for all nodes, independent of local surface mesh size (in contrast to Aspect mode). (Standard initial layer height reference: https://www.cfd-online.com/Tools/yplus.php).In Aspect mode, the value is a factor of the local surface mesh length, and the first layer height is defined by multiplying the local surface mesh size.

To show the mesh generation effect in both Absolute and Aspect modes, add a Linear distribution in the basic JSON example:

{
"Distribution": [
{
"EntityType": "Edge",
"SelectedEntities": [25],
"DistributionType": "Linear",
"Orientation": "Forward",
"Symmetric": true,
"NElement":10,
"EndBeginElementRatio":3
}
]
}

When the initial layer height is in Absolute mode, as shown in the result below, the initial layer height of each node does not change with the local mesh size.

"Aspect": 0.1 // Value range: [eps,1]

When the initial layer height is in Aspect mode, as shown in the result below, the initial layer height of each node changes with the local mesh size, and its value is h0 = size * Aspect.

"Absolute": 0.1 // Value range: [eps,MaxSize]

GrowthRate

Constant growth rate, the growth rate factor for each layer is the same (the next layer is larger than the previous one).

"Constant": 1.5 // Value range: [1,2]

Variable growth rate, starting from the second layer, the growth rate for each layer is independent (note that the growth rate for the first layer is always 0, and it matches the number of layers).

"Variable":[0,1,1,2,2] //Starting from the second layer, the value range:[1,2]

NLayers

NLayers:Specifies the desired number of boundary layer mesh.

"NLayers": 5, //Value Range:[1,inf]

ProblematicAreasTreatment

Methods used when layers cannot be generated due to local geometric features or insufficient space for growing all required layers.To show the effect of different methods on mesh generation, modify EFPairs.

1.When boundary layer generation encounters issues, stop the process.

"ProblematicAreasTreatment": "STOP"

2.Squeeze layers to overcome intersection, proximity, or quality issues.

"ProblematicAreasTreatment": "SQUEEZE"

3.Collapse layers in local regions to overcome intersection, proximity, or quality issues.

"ProblematicAreasTreatment": "COLLAPSE"

4.Exclude problematic local regions to overcome intersection, proximity, or quality issues.

"ProblematicAreasTreatment": "EXCLUDE"

Advanced Json Template

{
"BoundaryLayer":
[
{
"DistributionType": "Separation",
"EntityType": "Edge",
"EFPairs":
[
{
"E": 5,
"F": 1
},
{
"E": 6,
"F": 1
},
{
"E": 7,
"F": 1
},
{
"E": 8,
"F": 1
}
],
"Basic":
{
"InitLayerHeight":
{
"Absolute": 0.1 // "Absolute": xx/"Aspect": xx
},
"GrowthRate":
{
"Constant": 1.2 // "Constant": xx/"Variable":[xx,...,xx]
},
"NLayers": 6,
"AdditionalOuterLayers": 0,
"LastAspect": 0,
"ProblematicAreasTreatment": "COLLAPSE" // STOP/SQUEEZE/COLLAPSE/EXCLUDE
},
"SideTreatment":
{
"CollapseFreeEdges": false // true/false
},
"VectorTreatment":
{
"SmoothTopCapShellMesh": true, // true/false
"SmoothVectors": [true,90], // true-angle/false
"SeparateVectors": false, // true-angle/false
"SeparateNumber": 0
},
"GrowthControls":
{
"MiniFirstLayerHeight": 0, // only when SQUEEZE
"MaxLayerAspect": false, // true only when SQUEEZE, true-aspect/false
"ProximityCheckFactor": false, // true-factor/false
"MiniLayerAspect": false // only when ProximityCheckFactor true and SQUEEZE,ture-aspect/flase
}
}
],
"MeshSize": [
{
"GrowthRate": 1.0,
"MeshingDim": 2,
"SelectedEntities": []
}
],
"ThreadNum": 1
}


Class key Required Value Range Default Notes
BoundaryLayer-Basic AdditionalOuterLayers No [0,inf] 0 Additional outer layers to match the last boundary layer with nearby element size
BoundaryLayer-Basic LastAspect No [eps,1] 0 Last layer aspect ratio, active when additional layers are non-zero
BoundaryLayer-SideTreatment CollapseFreeEdges No true、false false Enables collapsing at free edges, active only in "COLLAPSE" mode
BoundaryLayer-VectorTreatment SmoothTopCapShellMesh No true、false true Allows vectors to deviate from original normal position; otherwise grows orthogonally
BoundaryLayer-VectorTreatment SmoothVectors No true,[0,180]
false
[true,90] Maximum allowable angle deviation from initial position
BoundaryLayer-VectorTreatment SeparateVectors No true,[eps,180]
false
false Separates boundary layer vectors at sharp edges (user-specified angle between faces)
BoundaryLayer-VectorTreatment SeparateNumber No [0,inf] 0 Number of vectors to separate at sharp edges
BoundaryLayer-GrowthControls MiniFirstLayerHeight No [0,inf] 0 Enable only in "SQUEEZE" mode, minimum allowed first layer height, defaults to 5% of initial height when set to 0
BoundaryLayer-GrowthControls MaxLayerAspect No true,[eps,inf]
false
false Enable only in "SQUEEZE" mode, maximum aspect ratio
BoundaryLayer-GrowthControls ProximityCheckFactor No true,[eps,inf] false
false Proximity check factor, controls the minimum gap between two opposing boundary layer regions
BoundaryLayer-GrowthControls-SQUEEZE MiniLayerAspect No true,[eps,inf]
false
false Minimum aspect ratio, active only when "ProximityCheckFactor" is enabled and in "SQUEEZE" mode

Advanced Configuration Guide

Basic Parameter Settings

"Basic":
{
"InitLayerHeight":
{
"Absolute": 0.1 // "Absolute": xx/"Aspect": xx
},
"GrowthRate":
{
"Constant": 1.5 // "Constant": xx/"Variable":[xx,...,xx]
},
"NLayers": 3,
"AdditionalOuterLayers": 2,
"LastAspect": 0.8,
"ProblematicAreasTreatment": "COLLAPSE" // STOP/SQUEEZE/COLLAPSE/EXCLUDE
}

AdditionalOuterLayers

AdditionalOuterLayers: The number of additional boundary layers to match the last boundary layer with nearby triangular cell sizes. If the size of the last boundary layer is larger than the nearby triangular cell size, even if this parameter is set, it will default to 0.

"AdditionalOuterLayers": 2, // Value Range:[0,inf],Default:0

LastAspect

LastAspect: Aspect ratio of the last layer, configurable only when AdditionalOuterLayers is non-zero.

"LastAspect": 0.8, // Value Range:[eps,1],Default:0

The boundary layer mesh is generated on edge 25 of face 3, and the results are as follows:

Side Treatment Settings

"SideTreatment":
{
"CollapseFreeEdges": false // Value Range:{false,true},Default:false
}

CollapseFreeEdges

Allow collapsing at free edges when the angle between two faces exceeds a certain value, gradually reducing mesh layers near face intersection lines.
Select edges 25 and 26 on face 3 to generate boundary layer meshes to observe the free edge collapsing function.

"CollapseFreeEdges": false
"CollapseFreeEdges": true

Vector Treatment Settings

"VectorTreatment":
{
"SmoothTopCapShellMesh": true, // Value Range:{false,true}
"SmoothVectors": [true,90], // Value Range:{false,[true,[0,180°]]},Default:[true,90]
"SeparateVectors": false, // Value Range:{false,[true,[eps,180]]},Default:false
"SeparateNumber": 0 // Value Range:[0,inf],Default:0
}

SmoothTopCapShellMesh

When enabled, this option allows growth vectors to deviate from their original normal positions. If disabled, layers grow orthogonally. This operation enables more layers to be generated as the mesh expands more in enclosed regions, though it may result in lower quality (less orthogonal) elements.
To clearly see the difference, adjust the initial layer height and thickness of the boundary layer.

"SmoothTopCapShellMesh": false
"SmoothTopCapShellMesh": true

SmoothVectors

When enabled, users can specify the maximum allowable angle deviation from the original normal position. This operation allows more layers to be generated as the mesh expands in enclosed regions, though it may result in lower quality (less orthogonal) elements.

"SmoothVectors": [true,15]
"SmoothVectors": [true,45]

SeparateVectors,SeparateNumber

Separates boundary layer vectors at sharp edges (where the angle between two faces is user-specified). When disabled, boundary layers remain unsplit, resulting in a continuous layer mesh around sharp edges but with skewed elements. When enabled, the generated mesh has better quality elements, but the exposed sides will be meshed with triangular elements.
To demonstrate the effect of this function, generate boundary layer meshes on edges 5 and 6 of face 1. Since the angle between edges 5 and 6 is 270 degrees, consider separating the boundary layer vectors at this location.

"SeparateVectors": false,
"SeparateNumber": 0
"SeparateVectors": [true,270],
"SeparateNumber": 1

Growth Controls Settings

"GrowthControls":
{
"MiniFirstLayerHeight": 0, // Enable only in "SQUEEZE" mode,Value Range:[0,inf],Default:5% of initial height
"MaxLayerAspect": false, // Enable only in "SQUEEZE" mode,Value Range:{false,[true,[eps,inf]]},Default:flase
"ProximityCheckFactor": false, // {false,[true,[eps,inf]]},Default:false
"MiniLayerAspect": false // Only when "ProximityCheckFactor" is enabled and in "SQUEEZE" mode,Value Range:{false,[true,[eps.inf]]},Default:false
}

MiniFirstLayerHeight

Minimum allowed height when squeeze is activated. If not specified (=0), the first layer height may compress to 5% of initial height before switching to COLLAPSE mode.

MaxLayerAspect

Maximum allowed aspect ratio when squeeze is activated. In absolute mode, layers may overgrow in areas with small surface element lengths, potentially becoming very tall. After specifying maximum aspect ratio, layer height remains constant once the allowed ratio is reached.

ProximityCheckFactor

Enable this option to control the minimum gap between opposing boundary layer regions. The minimum distance between boundary layers is defined as the proximity check factor multiplied by the sum of opposing mesh sizes. This option is crucial for ensuring sufficient space for generating high-quality triangular meshes.
To demonstrate the effect of this function, generate boundary layers on edges 5, 6, 7, and 8 of face 1. Since the boundary layer generated by edge 8 may intersect with edge 10, select SQUEEZE mode and set this parameter to control the minimum gap between regions.

"ProximityCheckFactor": false
"ProximityCheckFactor": [true,0.1]

MiniLayerAspect

When squeeze is activated with specified ProximityCheckFactor, defines maximum allowed aspect ratio for boundary layers. If the boundary layer's aspect ratio becomes less than this value with specified ProximityCheckFactor, the boundary layer will compress to the allowed minimum ratio before switching to COLLAPSE mode.

Complex Configuration Example 1

Now boundary layer mesh needs to be generated from edges 5, 6, 7, 8 towards face 1. At right angles, we want to have 3 normal directions, so under VectorTreatment, SeparateVectors is set to [true, 270] and SeparateNumber is set to 2. The generated boundary layer with these parameters may contact edge 10, so the problem area treatment method is set to COLLAPSE mode.

{
"BoundaryLayer":
[
{
"DistributionType": "Separation",
"EntityType": "Edge",
"EFPairs":
[
{
"E": 5,
"F": 1
},
{
"E": 6,
"F": 1
},
{
"E": 7,
"F": 1
},
{
"E": 8,
"F": 1
}
],
"Basic":
{
"GrowthRate":
{
"Constant":1.2
},
"InitLayerHeight":
{
"Absolute": 0.01
},
"NLayers": 7,
"AdditionalOuterLayers": 3,
"LastAspect": 0.8,
"ProblematicAreasTreatment": "COLLAPSE"
},
"SideTreatment":
{
"CollapseFreeEdges": false
},
"VectorTreatment":
{
"SmoothTopCapShellMesh": true,
"SmoothVectors": [true,90],
"SeparateVectors": [true,270],
"SeparateNumber": 2
}
}
],
"MeshSize": [
{
"CurvatureFactor": 0.2,
"GrowthRate": 1.0,
"MaxSize": 0.5,
"MeshingDim": 2,
"MinSize": 0.1,
"SelectedEntities": []
}
],
"ThreadNum": 1
}

Result:

Click here example02 to get the full source code of the 2D boundary layer detailed JSON example. Everyone can download it as needed.