AMCAX Kernel
Geometry kernel for CAD/CAE/CAM
AMCAX Kernel 1.0.0.0
2D Boundary Layer Detailed JSON Example

Overview

This tutorial provides detailed configuration methods for using mesh generation and two-dimensional boundary layers.

Feature 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).

Basic Json Example

Below is the basic JSON configuration. For more complex configurations, please refer to Advanced Json Example.

{
"BoundaryLayer":
[
{
"DistributionType": "Separation",
"EntityType": "Edge",
"EFPairs":
[
{
"E": 1,
"F": 1
}
],
"Basic":
{
"GrowthRate":
{
"Constant": 1.2
},
"InitLayerHeight":
{
"Absolute": 0.01
},
"NLayers": 15,
"ProblematicAreasTreatment": "COLLAPSE"
}
}
],
"MeshSize": [
{
"GrowthRate": 1.1,
"MeshingDim": 1,
"SelectedEntities": [5,6]
},
{
"GrowthRate": 1.0,
"MeshingDim": 2,
"SelectedEntities": []
}
],
"ThreadNum": 1
}


Class Key Required Value Range Default Notes
BoundaryLayer EntityType Yes [Face, Edge] N/A
BoundaryLayer EFPairs/SelectedEntities Yes N/A
BoundaryLayer-Basic GrowthRate Yes "Constant"
"Variable" [1.0,2.0]
N/A "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]
N/A "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] N/A
BoundaryLayer-Basic ProblematicAreasTreatment Yes STOP、SQUEEZE、COLLAPSE、EXCLUDE N/A 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": 1,
"F": 1
}
]

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=1) to face (tag=1). Note: The edge must be a boundary edge of the face.

Basic Parameter Settings

"Basic":
{
"InitLayerHeight":
{
"Absolute": 0.01 // "Absolute": xx/"Aspect": xx
},
"GrowthRate":
{
"Constant": 1.1 // "Constant": xx/"Variable":[xx,...,xx]
},
"NLayers": 3,
"ProblematicAreasTreatment": "COLLAPSE" // STOP/SQUEEZE/COLLAPSE/EXCLUDE
}

GrowthRate

Constant Growth Rate: Uniform growth factor between consecutive layers.

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

Variable Growth Rate: Independent growth rates for each layer starting from the second layer (Note: first layer growth rate is always 0 and must match the number of layers).

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

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)

"Absolute": 0.01 // Value Range:[eps,MaxSize]

Aspect Mode: Initial layer height defined as a factor of local surface mesh length, calculated by multiplying the local surface mesh size.

"Aspect": 0.8 // Value Range:[eps,1]

NLayers

NLayers: Specifies the desired number of boundary layer mesh.

"NLayers": 3, // 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.

  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 Example

{
"BoundaryLayer":
[
{
"DistributionType": "Separation",
"EntityType": "Edge",
"EFPairs":
[
{
"E": 1,
"F": 1
},
{
"E": 2,
"F": 1
}
],
"Basic":
{
"InitLayerHeight":
{
"Absolute": 0.01 // "Absolute": xx/"Aspect": xx
},
"GrowthRate":
{
"Constant": 1.1 // "Constant": xx/"Variable":[xx,...,xx]
},
"NLayers": 15,
"AdditionalOuterLayers": 3,
"LastAspect": 0.8,
"ProblematicAreasTreatment": "COLLAPSE" // STOP/SQUEEZE/COLLAPSE/EXCLUDE
},
"SideTreatment":
{
"CollapseFreeEdges": false // true/false
},
"VectorTreatment":
{
"SmoothTopCapShellMesh": true, // true/false
"SmoothVectors": [true,45], // 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": [
{
"CurvatureFactor": 0.2,
"GrowthRate": 1.1,
"MaxSize": 0.2,
"MeshingDim": 1,
"MinSize": 0.1,
"SelectedEntities": [5,6]
},
{
"CurvatureFactor": 0.2,
"GrowthRate": 1.0,
"MaxSize": 2,
"MeshingDim": 2,
"MinSize": 1,
"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] or false [true,45] Maximum allowable angle deviation from initial position
BoundaryLayer-VectorTreatment SeparateVectors No true,[eps,180] or 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 ProximityCheckFactor No true,[eps,inf] or false false Enable only in "SQUEEZE" mode, maximum aspect ratio
BoundaryLayer-GrowthControls ProximityCheckFactor No true,[eps,inf] or false false Proximity check factor, controls gap between opposing boundary layer regions
BoundaryLayer-GrowthControls-SQUEEZE MiniLayerAspect No true,[eps,inf] or 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.01 // "Absolute": xx/"Aspect": xx
},
"GrowthRate":
{
"Constant": 1.1 // "Constant": xx/"Variable":[xx,...,xx]
},
"NLayers": 3,
"AdditionalOuterLayers": 3,
"LastAspect": 0.4,
"ProblematicAreasTreatment": "COLLAPSE" // STOP/SQUEEZE/COLLAPSE/EXCLUDE
}

AdditionalOuterLayers

AdditionalOuterLayers: Number of additional boundary layers to match the last layer with nearby triangular elements. Defaults to 0 if the last layer size exceeds nearby triangular element size.

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

LastAspect

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

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

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.

"CollapseFreeEdges": false
"CollapseFreeEdges": true

Vector Treatment Settings

"VectorTreatment":
{
"SmoothTopCapShellMesh": true, // Value Range: {false,true}
"SmoothVectors": [true,45], // Value Range: {false,[true,[0,180°]]},Default: [true,45]
"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.

"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.

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

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 gaps 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.

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

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

The following are the imported CAD model and the generated mesh model.

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.

Json example

{
"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,45],
"SeparateVectors": [true,270],
"SeparateNumber": 2
}
}
],
"MeshSize": [
{
"CurvatureFactor": 0.2,
"GrowthRate": 1.0,
"MaxSize": 0.5,
"MeshingDim": 2,
"MinSize": 0.1,
"SelectedEntities": []
}
],
"ThreadNum": 1
}

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