Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configure the mesh

Balance mesh detail and cell count by choosing where finer spacing is needed, which geometric features to preserve, and which small details can be simplified. These controls help you capture the geometry that matters for your simulation while avoiding unnecessary cells.

Merge the settings below into your existing request. Each plot compares one setting at a time in the same fluid domain, using cuboids or the CAD tutorial’s heatsink.

Set the global cell size

mesh_settings.max_cell_size sets the global upper limit on cell size, in meters:

{
  "mesh_settings": {
    "max_cell_size": 0.002
  }
}

Use [x, y, z] values to set different limits by direction. A null entry leaves that direction without an explicit upper limit.

Coarse rectilinear mesh surrounding an orange cuboid, with a 10 mm global maximum cell size.
A smaller global limit reduces cell spacing throughout the domain and increases the total cell count.

Refine a component

Component max_cell_size sets a local cell-size limit within the component’s bounding box. Add it to either a cuboid component or a CAD component:

{
  "tag": "box",
  "max_cell_size": 0.0005
}

A value smaller than the global limit adds refinement for component features. Because cells grow with finite growth-rates, this also adds refinement to the surrounding region of said component.

Rectilinear mesh with a 5 mm cell-size limit on the orange central cuboid and a coarser surrounding region.
The smaller component limit adds fine spacing around the orange cuboid. Its mesh planes extend through the surrounding fluid.

Preserve CAD vertices

preserve_cad_vertices adds mesh planes at the imported CAD vertices. Set it on a CAD component to align the mesh with features such as pin edges and gaps:

{
  "tag": "pinned_heatsink",
  "preserve_cad_vertices": true
}

This is enabled by default. Turning it off leaves the CAD shape represented by the mesh built from the other sizing controls. Preserving vertices can improve feature alignment, but detailed geometry can introduce many closely spaced planes and increase the cell count.

The complete orange CAD heatsink centered inside the fluid mesh, with vertex preservation off.
With vertex preservation off, the heatsink pins have uneven widths. Turning it on retains the regular 8×8 pin array.

Merge nearby mesh planes

mesh_settings.fuse_threshold merges fixed axis coordinates that are closer than the threshold, in meters. Increase it to remove narrow cell intervals caused by nearly aligned component faces:

{
  "mesh_settings": {
    "fuse_threshold": 0.001
  }
}

Fusing works independently on each axis and can move component faces. In this example, the nearby x coordinates merge while the boxes remain separated along y.

Two separate orange cuboids with nearly aligned x faces producing a narrow interval between mesh planes.
A larger fuse threshold merges the nearby x planes and removes the narrow cell interval. The boxes remain separate.

Remove small cuboid components

mesh_settings.bbox_cull_threshold removes cuboids whose three dimensions are all below the threshold, in meters. Increase it to omit small components that do not need to be represented:

{
  "mesh_settings": {
    "bbox_cull_threshold": 0.003
  }
}

This removes the component and the fixed mesh planes it contributes. In the example below, a 3 mm threshold removes the 2 mm cube attached to the larger box. This setting does not remove CAD components.

A small orange cube attached to the top of the larger cuboid like a screw head, with fine mesh spacing around it.
Raising the cull threshold removes the small protrusion and reduces the total cell count. The larger box remains.

Refine a boundary region

mesh_resolution controls the number of cells across a boundary region. For a circle, it requests at least that many cells across its diameter:

{
  "boundary": {
    "circle": {
      "side": "x_min",
      "center": [0.05, 0.02],
      "radius": 0.01,
      "mesh_resolution": 12
    }
  }
}
A circular inlet on the x-min face highlighted in cyan, showing its coarse representation by rectangular boundary faces.
Higher resolution represents the cyan inlet with more, smaller faces. The circular opening still follows the rectangular mesh.

Smooth cell-size transitions

max_growth_rate limits size changes between neighboring cells. boundary_layer_growth_rate controls growth through estimated boundary layers, and max_aspect_ratio limits cell stretching:

"mesh_settings": {
  "max_cell_size": 0.002,
  "max_growth_rate": 1.2,
  "boundary_layer_growth_rate": 1.2,
  "max_aspect_ratio": 30.0
}

Lower growth limits make spacing change more gradually. A lower aspect-ratio limit restricts stretching. Both can increase the total cell count.

A cuboid with a 1 mm local cell-size limit, with cells growing toward the 10 mm global limit under a maximum growth rate of 2.5.
Both views use a 1 mm component limit and a 10 mm global limit. A lower growth rate keeps cells small farther from the cuboid.

See also